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

Refactor blocks into their own regexes #1

Merged
merged 1 commit into from
Dec 30, 2014
Merged

Conversation

Mouq
Copy link
Contributor

@Mouq Mouq commented Dec 29, 2014

This simplifies a lot of code. On the other hand, this does not change
the prior semantics of terminator detection, which means that if any
whitespace is taken before <.eat_terminator> is called, a final '}'
won't be recognized as terminating a statement.

This commit also turns a few "\s*" heavy places and changes them from
'token's into 'rule's, and overall prefers <.ws> to \s*

This simplifies a lot of code. On the other hand, this does not change
the prior semantics of terminator detection, which means that if any
whitespace is taken before <.eat_terminator> is called, a final '}'
won't be recognized as terminating a statement.

This commit also turns a few "\s*" heavy places and changes them from
'token's into 'rule's, and overall prefers <.ws> to \s*
sergot pushed a commit that referenced this pull request Dec 30, 2014
Refactor blocks into their own regexes
@sergot sergot merged commit 7600f38 into masak:master Dec 30, 2014
@sergot
Copy link
Collaborator

sergot commented Dec 30, 2014

@Mouq , thank you very much for your contribution, we appreciate this. 👍
😄

@raiph raiph mentioned this pull request Jul 15, 2016
masak pushed a commit that referenced this pull request Mar 4, 2017
wip
Try doing this:

    $ bin/007 --backend=i13n examples/name.007

Should get this output:

        # static frame #1
        # call A from line zero: frame 2
        # static frame #3
        # call B from line zero: frame 4
     1. macro name(expr) {
            # static frame #5
            # call C from line zero: frame 6
     2.     if expr ~~ Q::Postfix::Property {
     3.         expr = expr.property;
     4.     }
            # static frame #7
            # call D from line zero: frame 8
     5.     if expr !~~ Q::Identifier {
     6.         throw new Exception {
     7.             message: "Cannot turn a " ~ type(expr) ~ " into a name"
     8.         };
     9.     }
            # static frame #9
            # call E from line zero: frame 10
            # call F from line zero: frame 11
    10.     return quasi { expr.name };
    11. }
    12.
    13. my info = {
    14.     foo: "Bond",
    15.     bar: {
    16.         baz: "James Bond"
    17.     },
    18. };
    19.
    20. say(name(info));           # info
    21. say(name(info.foo));       # foo
    22. say(name(info.bar.baz));   # baz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants