Can I replace indent_loop[3] in following grammar with the the group of 3 INDENT? Where INDENT is lexical rule for indentation.
I just want to write number of INDENT based on the number.
match_node
: match_node_name (tree_operator) (NEW_LINE (indent_loop[3]) ( moduleCall | literals ))*
{ match_node_list.push($match_node_name.text); }
| SINGLE_QUOTE POINTE SINGLE_QUOTE
;
match_node_name
: IDENT_SMALL_LETTERS
;
indent_loop[int scope]
: {scope == 3}? INDENT INDENT INDENT
| {scope == 4}? INDENT INDENT INDENT INDENT
;
INDENT : '\t';
When I did this I was not able to come back to my calling rule and was not able to return this group of indentation? Means, ( moduleCall | literals ))* was not called.
Where I am wrong? I am just begining.
Or is there any other way to do this?