Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I may sound a bit blunt, but I don't believe you read that many articles (at least, not the right ones) because you don't seem to know the difference between lexer- and parser rules. Be sure you <em>do</em> understand it: <a href="https://stackoverflow.com/questions/4297770/practical-difference-between-parser-rules-and-lexer-rules-in-antlr">Practical difference between parser rules and lexer rules in ANTLR?</a></p> <p>Also checkout this SO Q&amp;A: <a href="http://web.archive.org/web/20130602122135/https://stackoverflow.com/questions/278480/antlr-tutorials" rel="nofollow noreferrer">ANTLR Tutorials</a></p> <p>You're using only lexer rules, which is not correct. Although even lexer rules <em>can</em> be recursive (in ANTLR grammars), you really should avoid it. In your case, most of the rules should be parser rules instead:</p> <pre><code>componentRef : IDENT ('[' expression (',' expression)* ']')? ; expression: componentRef ('(' functionArguments ')')? ; functionArguments: expression (',' expression)* ; IDENT: ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')*; </code></pre> <p>The grammar above won't recognize the input you've posted, but there are no error anymore. A grammar that recognizes the input you've posted, could look like this (untested!) grammar:</p> <pre><code>parse : expr* EOF ; expr : IDENT (index | call)* ; index : '[' expr_list ']' ; call : '(' expr_list ')' ; expr_list : expr (',' expr)* ; IDENT : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'_'|'0'..'9')* ; SPACE : (' ' | '\t' | '\r' | '\n')+ {skip();} ; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload