Commit b5553f9
committed
HCL: allow
The HCL lexer reserves `IF` and `IN` as dedicated tokens for use in
for-expressions, but the spec doesn't reserve these as keywords at the
body level. Terraform itself accepts `if` and `in` as attribute names
and object keys, so the parser should too.
Extend the `attribute` and `qualifiedIdentifier` rules to accept `IF`
and `IN` alongside `Identifier`. The visitor walks `qualifiedIdentifier`
children in source order to keep dotted-name positions correct when the
alternatives are interleaved.
Fixes #6446if and in as attribute and object key names1 parent 240bead commit b5553f9
5 files changed
Lines changed: 265 additions & 109 deletions
File tree
- rewrite-hcl/src
- main
- antlr
- java/org/openrewrite/hcl/internal
- grammar
- test/java/org/openrewrite/hcl
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
91 | 91 | | |
92 | 92 | | |
93 | 93 | | |
94 | | - | |
| 94 | + | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
| |||
Lines changed: 29 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
85 | 112 | | |
86 | 113 | | |
87 | 114 | | |
| |||
744 | 771 | | |
745 | 772 | | |
746 | 773 | | |
747 | | - | |
| 774 | + | |
748 | 775 | | |
749 | 776 | | |
750 | 777 | | |
| |||
Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.
0 commit comments