cenotelie / hime

Apache License 2.0
27 stars 4 forks source link

Rules not being found? #81

Closed ethindp closed 1 year ago

ethindp commented 1 year ago

The documentation indicates that the order of rules in a rules block is irrelevant, however I'm suffering this strange problem where the order of rules apparently does matter. I have this rule:

    pragma ->
        ('pragma' identifier (LPAREN pragma_argument_association (COMMA pragma_argument_association)* RPAREN)? SEMICOLON);
    pragma_argument_association ->
        ((identifier ARROW)? (name | expression))
        | (aspect_mark ARROW (name | expression));

Yet himecc indicates that expression can't be found. (It does this for a huge number of other productions as well.) I declare expression as follows:

    expression ->
        relation (('and' | ('and' 'then') | 'or' | ('or' 'else') | 'xor') relation)*;

And all the other rules that it claims it can't find are available, I'm just unsure why it can't find them.

ethindp commented 1 year ago

Update: so I thought this might be a lexical problem, but it doesn't appear so. I still get errors like:

error: Cannot find symbol `expression`
    --> ada.gram:(141, 38)
     |
141  |  ((identifier ARROW)? (name | expression))
     |                               ^^^^^^^^^^

The only change is that inline strings have been replaced with lexical tokens, like:

    expression ->
        relation ((AND_KEYWORD | (AND_KEYWORD THEN_KEYWORD) | OR_KEYWORD | (OR_KEYWORD ELSE_KEYWORD) | XOR_KEYWORD) relation)*;

The full grammar is here: ada.txt

cc @woutersl

ethindp commented 1 year ago

Anyone able to reproduce this issue?

ethindp commented 1 year ago

Update: the issue no longer occurs, so it was probably fixed in one of the newer releases.