amplify-education / python-hcl2

MIT License
255 stars 56 forks source link

Lark grammar does not support interpolations nested more than 2 times #173

Open weaversam8 opened 1 month ago

weaversam8 commented 1 month ago

Example code:

block {
  a = "${"${"${"a"}"}"}"
}

Expected output:

{'block': [{'block_name': {'a': '${"${"${"a"}"}"}', '__start_line__': 1, '__end_line__': 3}}]}

Actual output:

lark.exceptions.UnexpectedToken: Unexpected token Token('STRING_LIT', '"\n}\n\nblock "') at line 2, column 24.
Expected one of: 
        * FOR_EACH
        * $END
        * IN
        * IF
        * NL_OR_COMMENT
        * FOR
        * NAME
Previous tokens: [Token('RBRACE', '}')]

I plan to fix this in a future PR, just creating this issue for tracking purposes.