File tree Expand file tree Collapse file tree 1 file changed +25
-5
lines changed
Expand file tree Collapse file tree 1 file changed +25
-5
lines changed Original file line number Diff line number Diff line change @@ -132,16 +132,36 @@ class_type :
132132 ;
133133
134134class_specifier:
135- IDENT class_specifier2
136- | EXTENDS! IDENT (class_modification)? string_comment composition
137- END! IDENT!
135+ i : IDENT class_specifier2[ # i]
136+ | EXTENDS! i1 : IDENT (class_modification)? string_comment composition
137+ END! i2 : IDENT!
138138 {
139+ // check if the identifiers at the start and end are the same!
140+ if (i1-> getText() != i2-> getText())
141+ {
142+ throw
143+ ANTLR_USE_NAMESPACE(antlr)
144+ RecognitionException(
145+ " The identifier at start and end are different" ,
146+ modelicafilename, i2-> getLine(), i2-> getColumn());
147+ }
139148 # class_specifier = #([CLASS_EXTENDS,"CLASS_EXTENDS"],#class_specifier);
140149 }
141150 ;
142151
143- class_specifier2 :
144- ( string_comment composition END! IDENT!
152+ class_specifier2 [ RefMyAST i1] :
153+ ( string_comment composition END! i2: IDENT!
154+ {
155+ // check if the identifiers at the start and end are the same!
156+ if (RefMyAST(i1)-> getText() != RefMyAST(# i2)->getText())
157+ {
158+ throw
159+ ANTLR_USE_NAMESPACE(antlr)
160+ RecognitionException(
161+ " The identifier at start and end are different" ,
162+ modelicafilename, i2-> getLine(), i2-> getColumn());
163+ }
164+ }
145165 | EQUALS^ base_prefix type_specifier ( class_modification )? comment
146166 | EQUALS^ enumeration
147167 | EQUALS^ pder
You can’t perform that action at this time.
0 commit comments