Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: replace regex-based type parser with character-based one #400

Merged
merged 1 commit into from
Aug 18, 2023

Commits on Aug 18, 2023

  1. misc: replace regex-based type parser with character-based one

    This commit introduces a complete rewrite of the first layer of the type
    parser. The previous one would use regex to split a raw type in tokens,
    but that led to limitations — mostly concerning quoted strings — that
    are now fixed.
    
    Example of previous limitations, now solved:
    
    ```php
    // Union of strings containing space chars
    (new MapperBuilder())
        ->mapper()
        ->map(
            "'foo bar'|'baz fiz'",
            'baz fiz'
        );
    
    // Shaped array with special chars in the key
    (new MapperBuilder())
        ->mapper()
        ->map(
            "array{'some & key': string}",
            ['some & key' => 'value']
        );
    ```
    romm committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    026ff1e View commit details
    Browse the repository at this point in the history