1- /*
2- * Copyright 2025 the original author or authors.
3- * <p>
4- * Licensed under the Apache License, Version 2.0 (the "License");
5- * you may not use this file except in compliance with the License.
6- * You may obtain a copy of the License at
7- * <p>
8- * https://www.apache.org/licenses/LICENSE-2.0
9- * <p>
10- * Unless required by applicable law or agreed to in writing, software
11- * distributed under the License is distributed on an "AS IS" BASIS,
12- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13- * See the License for the specific language governing permissions and
14- * limitations under the License.
15- */
16- // Generated from ~/git/rewrite/rewrite-hcl/src/main/antlr/HCLParser.g4 by ANTLR 4.13.2
1+ // Generated from rewrite-hcl/src/main/antlr/HCLParser.g4 by ANTLR 4.13.2
172package org .openrewrite .hcl .internal .grammar ;
183import org .antlr .v4 .runtime .atn .*;
194import org .antlr .v4 .runtime .dfa .DFA ;
@@ -32,63 +17,63 @@ public class HCLParser extends Parser {
3217 protected static final PredictionContextCache _sharedContextCache =
3318 new PredictionContextCache ();
3419 public static final int
35- FOR_BRACE =1 , FOR_BRACK =2 , IF =3 , IN =4 , BooleanLiteral =5 , NULL =6 , LBRACE =7 ,
36- RBRACE =8 , ASSIGN =9 , Identifier =10 , WS =11 , COMMENT =12 , LINE_COMMENT =13 ,
37- NEWLINE =14 , NumericLiteral =15 , QUOTE =16 , HEREDOC_START =17 , PLUS =18 , AND =19 ,
38- EQ =20 , LT =21 , DOUBLE_COLON =22 , COLON =23 , LBRACK =24 , LPAREN =25 , MINUS =26 ,
39- OR =27 , NEQ =28 , GT =29 , QUESTION =30 , RBRACK =31 , RPAREN =32 , MUL =33 , NOT =34 ,
40- LEQ =35 , DOT =36 , DIV =37 , GEQ =38 , ARROW =39 , COMMA =40 , MOD =41 , ELLIPSIS =42 ,
41- TILDE =43 , TEMPLATE_INTERPOLATION_START =44 , TemplateStringLiteral =45 , TemplateStringLiteralChar =46 ,
42- HP_WS =47 , HP_COMMENT =48 , HP_LINE_COMMENT =49 , HTemplateLiteral =50 , HTemplateLiteralChar =51 ,
20+ FOR_BRACE =1 , FOR_BRACK =2 , IF =3 , IN =4 , BooleanLiteral =5 , NULL =6 , LBRACE =7 ,
21+ RBRACE =8 , ASSIGN =9 , Identifier =10 , WS =11 , COMMENT =12 , LINE_COMMENT =13 ,
22+ NEWLINE =14 , NumericLiteral =15 , QUOTE =16 , HEREDOC_START =17 , PLUS =18 , AND =19 ,
23+ EQ =20 , LT =21 , DOUBLE_COLON =22 , COLON =23 , LBRACK =24 , LPAREN =25 , MINUS =26 ,
24+ OR =27 , NEQ =28 , GT =29 , QUESTION =30 , RBRACK =31 , RPAREN =32 , MUL =33 , NOT =34 ,
25+ LEQ =35 , DOT =36 , DIV =37 , GEQ =38 , ARROW =39 , COMMA =40 , MOD =41 , ELLIPSIS =42 ,
26+ TILDE =43 , TEMPLATE_INTERPOLATION_START =44 , TemplateStringLiteral =45 , TemplateStringLiteralChar =46 ,
27+ HP_WS =47 , HP_COMMENT =48 , HP_LINE_COMMENT =49 , HTemplateLiteral =50 , HTemplateLiteralChar =51 ,
4328 H_NEWLINE =52 ;
4429 public static final int
45- RULE_configFile = 0 , RULE_body = 1 , RULE_bodyContent = 2 , RULE_attribute = 3 ,
46- RULE_block = 4 , RULE_blockLabel = 5 , RULE_expression = 6 , RULE_exprTerm = 7 ,
47- RULE_blockExpr = 8 , RULE_literalValue = 9 , RULE_collectionValue = 10 ,
48- RULE_tuple = 11 , RULE_object = 12 , RULE_objectelem = 13 , RULE_qualifiedIdentifier = 14 ,
49- RULE_forExpr = 15 , RULE_forTupleExpr = 16 , RULE_forObjectExpr = 17 , RULE_forIntro = 18 ,
50- RULE_forCond = 19 , RULE_variableExpr = 20 , RULE_functionCall = 21 , RULE_functionName = 22 ,
51- RULE_arguments = 23 , RULE_index = 24 , RULE_getAttr = 25 , RULE_legacyIndexAttr = 26 ,
52- RULE_splat = 27 , RULE_attrSplat = 28 , RULE_fullSplat = 29 , RULE_operation = 30 ,
53- RULE_unaryOp = 31 , RULE_binaryOp = 32 , RULE_binaryOperator = 33 , RULE_compareOperator = 34 ,
54- RULE_arithmeticOperator = 35 , RULE_logicOperator = 36 , RULE_templateExpr = 37 ,
55- RULE_heredocTemplatePart = 38 , RULE_heredocLiteral = 39 , RULE_quotedTemplatePart = 40 ,
30+ RULE_configFile = 0 , RULE_body = 1 , RULE_bodyContent = 2 , RULE_attribute = 3 ,
31+ RULE_block = 4 , RULE_blockLabel = 5 , RULE_expression = 6 , RULE_exprTerm = 7 ,
32+ RULE_blockExpr = 8 , RULE_literalValue = 9 , RULE_collectionValue = 10 ,
33+ RULE_tuple = 11 , RULE_object = 12 , RULE_objectelem = 13 , RULE_qualifiedIdentifier = 14 ,
34+ RULE_forExpr = 15 , RULE_forTupleExpr = 16 , RULE_forObjectExpr = 17 , RULE_forIntro = 18 ,
35+ RULE_forCond = 19 , RULE_variableExpr = 20 , RULE_functionCall = 21 , RULE_functionName = 22 ,
36+ RULE_arguments = 23 , RULE_index = 24 , RULE_getAttr = 25 , RULE_legacyIndexAttr = 26 ,
37+ RULE_splat = 27 , RULE_attrSplat = 28 , RULE_fullSplat = 29 , RULE_operation = 30 ,
38+ RULE_unaryOp = 31 , RULE_binaryOp = 32 , RULE_binaryOperator = 33 , RULE_compareOperator = 34 ,
39+ RULE_arithmeticOperator = 35 , RULE_logicOperator = 36 , RULE_templateExpr = 37 ,
40+ RULE_heredocTemplatePart = 38 , RULE_heredocLiteral = 39 , RULE_quotedTemplatePart = 40 ,
5641 RULE_stringLiteral = 41 , RULE_templateInterpolation = 42 ;
5742 private static String [] makeRuleNames () {
5843 return new String [] {
59- "configFile" , "body" , "bodyContent" , "attribute" , "block" , "blockLabel" ,
60- "expression" , "exprTerm" , "blockExpr" , "literalValue" , "collectionValue" ,
61- "tuple" , "object" , "objectelem" , "qualifiedIdentifier" , "forExpr" , "forTupleExpr" ,
62- "forObjectExpr" , "forIntro" , "forCond" , "variableExpr" , "functionCall" ,
63- "functionName" , "arguments" , "index" , "getAttr" , "legacyIndexAttr" , "splat" ,
64- "attrSplat" , "fullSplat" , "operation" , "unaryOp" , "binaryOp" , "binaryOperator" ,
65- "compareOperator" , "arithmeticOperator" , "logicOperator" , "templateExpr" ,
66- "heredocTemplatePart" , "heredocLiteral" , "quotedTemplatePart" , "stringLiteral" ,
44+ "configFile" , "body" , "bodyContent" , "attribute" , "block" , "blockLabel" ,
45+ "expression" , "exprTerm" , "blockExpr" , "literalValue" , "collectionValue" ,
46+ "tuple" , "object" , "objectelem" , "qualifiedIdentifier" , "forExpr" , "forTupleExpr" ,
47+ "forObjectExpr" , "forIntro" , "forCond" , "variableExpr" , "functionCall" ,
48+ "functionName" , "arguments" , "index" , "getAttr" , "legacyIndexAttr" , "splat" ,
49+ "attrSplat" , "fullSplat" , "operation" , "unaryOp" , "binaryOp" , "binaryOperator" ,
50+ "compareOperator" , "arithmeticOperator" , "logicOperator" , "templateExpr" ,
51+ "heredocTemplatePart" , "heredocLiteral" , "quotedTemplatePart" , "stringLiteral" ,
6752 "templateInterpolation"
6853 };
6954 }
7055 public static final String [] ruleNames = makeRuleNames ();
7156
7257 private static String [] makeLiteralNames () {
7358 return new String [] {
74- null , null , null , "'if'" , "'in'" , null , "'null'" , "'{'" , "'}'" , "'='" ,
75- null , null , null , null , null , null , null , null , "'+'" , "'&&'" , "'=='" ,
76- "'<'" , "'::'" , "':'" , "'['" , "'('" , "'-'" , "'||'" , "'!='" , "'>'" , "'?'" ,
77- "']'" , "')'" , "'*'" , "'!'" , "'<='" , "'.'" , "'/'" , "'>='" , "'=>'" , "','" ,
78- "'%'" , "'...'" , "'~'" , null , null , null , null , null , null , null , null ,
59+ null , null , null , "'if'" , "'in'" , null , "'null'" , "'{'" , "'}'" , "'='" ,
60+ null , null , null , null , null , null , null , null , "'+'" , "'&&'" , "'=='" ,
61+ "'<'" , "'::'" , "':'" , "'['" , "'('" , "'-'" , "'||'" , "'!='" , "'>'" , "'?'" ,
62+ "']'" , "')'" , "'*'" , "'!'" , "'<='" , "'.'" , "'/'" , "'>='" , "'=>'" , "','" ,
63+ "'%'" , "'...'" , "'~'" , null , null , null , null , null , null , null , null ,
7964 "'\\ n'"
8065 };
8166 }
8267 private static final String [] _LITERAL_NAMES = makeLiteralNames ();
8368 private static String [] makeSymbolicNames () {
8469 return new String [] {
85- null , "FOR_BRACE" , "FOR_BRACK" , "IF" , "IN" , "BooleanLiteral" , "NULL" ,
86- "LBRACE" , "RBRACE" , "ASSIGN" , "Identifier" , "WS" , "COMMENT" , "LINE_COMMENT" ,
87- "NEWLINE" , "NumericLiteral" , "QUOTE" , "HEREDOC_START" , "PLUS" , "AND" ,
88- "EQ" , "LT" , "DOUBLE_COLON" , "COLON" , "LBRACK" , "LPAREN" , "MINUS" , "OR" ,
89- "NEQ" , "GT" , "QUESTION" , "RBRACK" , "RPAREN" , "MUL" , "NOT" , "LEQ" , "DOT" ,
90- "DIV" , "GEQ" , "ARROW" , "COMMA" , "MOD" , "ELLIPSIS" , "TILDE" , "TEMPLATE_INTERPOLATION_START" ,
91- "TemplateStringLiteral" , "TemplateStringLiteralChar" , "HP_WS" , "HP_COMMENT" ,
70+ null , "FOR_BRACE" , "FOR_BRACK" , "IF" , "IN" , "BooleanLiteral" , "NULL" ,
71+ "LBRACE" , "RBRACE" , "ASSIGN" , "Identifier" , "WS" , "COMMENT" , "LINE_COMMENT" ,
72+ "NEWLINE" , "NumericLiteral" , "QUOTE" , "HEREDOC_START" , "PLUS" , "AND" ,
73+ "EQ" , "LT" , "DOUBLE_COLON" , "COLON" , "LBRACK" , "LPAREN" , "MINUS" , "OR" ,
74+ "NEQ" , "GT" , "QUESTION" , "RBRACK" , "RPAREN" , "MUL" , "NOT" , "LEQ" , "DOT" ,
75+ "DIV" , "GEQ" , "ARROW" , "COMMA" , "MOD" , "ELLIPSIS" , "TILDE" , "TEMPLATE_INTERPOLATION_START" ,
76+ "TemplateStringLiteral" , "TemplateStringLiteralChar" , "HP_WS" , "HP_COMMENT" ,
9277 "HP_LINE_COMMENT" , "HTemplateLiteral" , "HTemplateLiteralChar" , "H_NEWLINE"
9378 };
9479 }
@@ -515,7 +500,7 @@ public ExpressionContext(ParserRuleContext parent, int invokingState) {
515500 super (parent , invokingState );
516501 }
517502 @ Override public int getRuleIndex () { return RULE_expression ; }
518-
503+
519504 public ExpressionContext () { }
520505 public void copyFrom (ExpressionContext ctx ) {
521506 super .copyFrom (ctx );
@@ -648,7 +633,7 @@ private ExpressionContext expression(int _p) throws RecognitionException {
648633 setState (127 );
649634 expression (2 );
650635 }
651- }
636+ }
652637 }
653638 setState (133 );
654639 _errHandler .sync (this );
@@ -673,7 +658,7 @@ public ExprTermContext(ParserRuleContext parent, int invokingState) {
673658 super (parent , invokingState );
674659 }
675660 @ Override public int getRuleIndex () { return RULE_exprTerm ; }
676-
661+
677662 public ExprTermContext () { }
678663 public void copyFrom (ExprTermContext ctx ) {
679664 super .copyFrom (ctx );
@@ -1054,7 +1039,7 @@ private ExprTermContext exprTerm(int _p) throws RecognitionException {
10541039 }
10551040 break ;
10561041 }
1057- }
1042+ }
10581043 }
10591044 setState (159 );
10601045 _errHandler .sync (this );
@@ -1303,7 +1288,7 @@ public final TupleContext tuple() throws RecognitionException {
13031288 setState (173 );
13041289 expression (0 );
13051290 }
1306- }
1291+ }
13071292 }
13081293 setState (178 );
13091294 _errHandler .sync (this );
@@ -2186,7 +2171,7 @@ public final ArgumentsContext arguments() throws RecognitionException {
21862171 setState (282 );
21872172 expression (0 );
21882173 }
2189- }
2174+ }
21902175 }
21912176 setState (287 );
21922177 _errHandler .sync (this );
@@ -2479,7 +2464,7 @@ public final AttrSplatContext attrSplat() throws RecognitionException {
24792464 setState (307 );
24802465 getAttr ();
24812466 }
2482- }
2467+ }
24832468 }
24842469 setState (312 );
24852470 _errHandler .sync (this );
@@ -2571,7 +2556,7 @@ public final FullSplatContext fullSplat() throws RecognitionException {
25712556 default :
25722557 throw new NoViableAltException (this );
25732558 }
2574- }
2559+ }
25752560 }
25762561 setState (322 );
25772562 _errHandler .sync (this );
@@ -3066,7 +3051,7 @@ public TemplateExprContext(ParserRuleContext parent, int invokingState) {
30663051 super (parent , invokingState );
30673052 }
30683053 @ Override public int getRuleIndex () { return RULE_templateExpr ; }
3069-
3054+
30703055 public TemplateExprContext () { }
30713056 public void copyFrom (TemplateExprContext ctx ) {
30723057 super .copyFrom (ctx );
@@ -3148,7 +3133,7 @@ public final TemplateExprContext templateExpr() throws RecognitionException {
31483133 match (HEREDOC_START );
31493134 setState (351 );
31503135 match (Identifier );
3151- setState (359 );
3136+ setState (359 );
31523137 _errHandler .sync (this );
31533138 _la = _input .LA (1 );
31543139 do {
@@ -3172,7 +3157,7 @@ public final TemplateExprContext templateExpr() throws RecognitionException {
31723157 }
31733158 }
31743159 }
3175- setState (361 );
3160+ setState (361 );
31763161 _errHandler .sync (this );
31773162 _la = _input .LA (1 );
31783163 } while ( _la ==NEWLINE );
@@ -3768,4 +3753,4 @@ private boolean exprTerm_sempred(ExprTermContext _localctx, int predIndex) {
37683753 _decisionToDFA [i ] = new DFA (_ATN .getDecisionState (i ), i );
37693754 }
37703755 }
3771- }
3756+ }
0 commit comments