-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Grammar Breaks between versions for TF and HCL specifically #163
Comments
so i am comparing the lark file and going back and forth between the functions. binary_op : expression binary_term new_line_or_comment? to binary_op : expression binary_term the terraform specific parser will work but the hcl specific parsing does not. I leave both those settings as they are on the newest version, the HCL proper parser will work but the terrafrom parser will break. |
so in order to make it work for me, i just forked the version and instantiated different modules , one for tf and one for hcl. This get me where i want to go and you guys are doing great work. There is something unique in the lark file on lines start : body LINE 3/4 changes
new_line_and_or_comma: new_line_or_comment | "," | "," new_line_or_comment identifier : /[a-zA-Z_][a-zA-Z0-9_-]*/ ?expression : expr_term | operation | conditional conditional : expression "?" new_line_or_comment? expression new_line_or_comment? ":" new_line_or_comment? expression ?operation : unary_op | binary_op Line 16/15 changes
!binary_operator : "==" | "!=" | "<" | ">" | "<=" | ">=" | "-" | "*" | "/" | "%" | "&&" | "||" | "+" expr_term : "(" new_line_or_comment? expression new_line_or_comment? ")" STRING_LIT : """ (STRING_CHARS | INTERPOLATION)* """ int_lit : DECIMAL+ tuple : "[" (new_line_or_comment* expression new_line_or_comment* ",")* (new_line_or_comment* expression)? new_line_or_comment* "]" heredoc_template : /<<(?P[a-zA-Z][a-zA-Z0-9.-]+)\n(?:.|\n)*?(?P=heredoc)/ function_call : identifier "(" new_line_or_comment? arguments? new_line_or_comment? ")" index_expr_term : expr_term index !for_tuple_expr : "[" new_line_or_comment? for_intro new_line_or_comment? expression new_line_or_comment? for_cond? new_line_or_comment? "]" %ignore /[ \t]+/ |
What do you mean by terraform specific parser and hcl specific parser? Lines 10 to 16 in fc8805e
.tf files are written in HCL2 language.
|
Just to note that we also recently ran into problems parsing terraform projects after upgrading from 4.3.0 to 4.3.4 The problem can be reproduced in 4.3.4 using a simple hcl format data file like so: somedata = {
number = 8 * 1024
number2 = 4
} which results in: So presumably the issue is that recent changes broke the parsing of arithmetic expressions such as update: it's not just arithmetic expressions, see link added below |
I mean, that in reading HCL within terraform and its objects breaks on the specified version but will make the terragrunt hybrid HCL work. so when on on the older versions of this language pack, i am able to work with the terragrunt hybrid HCL/GO componenets with no issue, but the TF HCL has problems with question marks and ternaries. If if upgrade, the newer version will be able to handle the hybrid terraform HCL better, but now the Terragrunt Hybrid HCL\GO object blocks wont parse and throw the errors stated above. |
I have been trying to create a tool that will crawl all the hcl in our terragrunt directories and ran into an interesting issue.
When i update to version 4.3.3 the hcl parser throws an error as follows.
I also understand that i am doing odd things with a change out of the question mark. That was on my journey to figure out what was going on with the parser.
however i am able to run terraform parser effeciently.
When i downgrade to 4.3.0 to make the hcl work, i get this error for the terraform
terraform is as follows
Here is the code for the tf parser
Here is the code for the hcl parser
The text was updated successfully, but these errors were encountered: