11start : new_line_or_comment ? body new_line_or_comment ?
22body : (attribute | block | one_line_block )*
3- attribute : IDENTIFIER " =" expression new_line_or_comment
4- block : IDENTIFIER ( IDENTIFIER | STRING_LIT )* " {" new_line_or_comment body " }" new_line_or_comment
5- one_line_block : IDENTIFIER ( IDENTIFIER | STRING_LIT )* " {" (IDENTIFIER " =" expression )? " }" new_line_or_comment
3+ attribute : identifier " =" expression new_line_or_comment
4+ block : identifier ( identifier | STRING_LIT )* " {" new_line_or_comment body " }" new_line_or_comment
5+ one_line_block : identifier ( identifier | STRING_LIT )* " {" (identifier " =" expression )? " }" new_line_or_comment
66new_line_and_or_comma : new_line_or_comment | " ," | " ," new_line_or_comment
77new_line_or_comment : ( / \n / | / #. * \n / | / \/\/ . * \n / )+
88
9- IDENTIFIER : / [a-zA-Z_ ][a-zA-Z0-9_- ]* /
9+ identifier : / [a-zA-Z_ ][a-zA-Z0-9_- ]* /
1010
1111? expression : expr_term | operation | conditional
1212
@@ -30,7 +30,7 @@ expr_term : "(" expression ")"
3030 | function_call
3131 | index_expr_term
3232 | get_attr_expr_term
33- | IDENTIFIER
33+ | identifier
3434 | heredoc_template
3535 | heredoc_template_trim
3636 | attr_splat_expr_term
@@ -54,26 +54,26 @@ EXP_MARK : ("e" | "E") ("+" | "-")?
5454
5555tuple : " [" (new_line_or_comment ? expression (new_line_or_comment ? " ," new_line_or_comment ? expression )* new_line_or_comment ? " ," ? )? new_line_or_comment ? " ]"
5656object : " {" (new_line_or_comment ? object_elem (new_line_and_or_comma object_elem )* new_line_and_or_comma ? )? " }"
57- object_elem : (IDENTIFIER | expression ) " =" ? expression
57+ object_elem : (identifier | expression ) " =" ? expression
5858
5959heredoc_template : / <<( ?P<heredoc> [a-zA-Z ][a-zA-Z0-9._- ]+ ) \n (?: . | \n ) +? \n + \s * ( ?P=heredoc ) /
6060heredoc_template_trim : / <<-( ?P<heredoc_trim> [a-zA-Z ][a-zA-Z0-9._- ]+ ) \n (?: . | \n ) +? \n + \s * ( ?P=heredoc_trim ) /
6161
62- function_call : IDENTIFIER " (" new_line_or_comment ? arguments ? new_line_or_comment ? " )"
62+ function_call : identifier " (" new_line_or_comment ? arguments ? new_line_or_comment ? " )"
6363arguments : (expression (new_line_or_comment ? " ," new_line_or_comment ? expression )* (" ," | " ..." )? new_line_or_comment ? )
6464
6565index_expr_term : expr_term index
6666get_attr_expr_term : expr_term get_attr
6767attr_splat_expr_term : expr_term attr_splat
6868full_splat_expr_term : expr_term full_splat
6969? index : " [" expression " ]"
70- ? get_attr : " ." IDENTIFIER
70+ ? get_attr : " ." identifier
7171? attr_splat : " .*" get_attr *
7272? full_splat : " [" " *" " ]" (get_attr | index )*
7373
7474! for_tuple_expr : " [" new_line_or_comment ? for_intro new_line_or_comment ? expression new_line_or_comment ? for_cond ? new_line_or_comment ? " ]"
7575! for_object_expr : " {" new_line_or_comment ? for_intro expression " =>" expression " ..." ? new_line_or_comment ? for_cond ? new_line_or_comment ? " }"
76- ! for_intro : " for" new_line_or_comment ? IDENTIFIER (" ," IDENTIFIER new_line_or_comment ? )? new_line_or_comment ? " in" new_line_or_comment ? expression " :" new_line_or_comment ?
76+ ! for_intro : " for" new_line_or_comment ? identifier (" ," identifier new_line_or_comment ? )? new_line_or_comment ? " in" new_line_or_comment ? expression " :" new_line_or_comment ?
7777! for_cond : " if" new_line_or_comment ? expression
7878
7979%ignore / [ \t ]+ /
0 commit comments