File tree Expand file tree Collapse file tree 3 files changed +15
-6
lines changed
Expand file tree Collapse file tree 3 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,7 @@ TypeEnum:
6868 ')'
6969 (base_type=Fqn)?
7070 (default=EnumDefault)?
71- ';'
71+ SemiColon
7272;
7373
7474EnumOption:
@@ -89,7 +89,7 @@ TypeAlias:
8989 base=VariableType
9090 CommentAny*
9191 // Catch trailing comments here, not at the end of `Variable`
92- ';'
92+ SemiColon
9393;
9494
9595/*
@@ -106,7 +106,7 @@ Function:
106106 ('EXTENDS' extends=Fqn)?
107107 ('IMPLEMENTS' implements=Fqn)?
108108 (':' return=VariableType (arglist=ArgList)?)?
109- (';' )?
109+ (SemiColon )?
110110 lists*=VariableList
111111;
112112
@@ -167,7 +167,7 @@ Variable:
167167 type=VariableType
168168 (arglist=ArgList)?
169169 (AssignmentSymbol value=AssignmentValue)?
170- ';'
170+ SemiColon
171171 comment=CommentLine?
172172;
173173
@@ -235,6 +235,13 @@ Fqn[noskipws]:
235235 /\s/*-
236236;
237237
238+ /*
239+ Semi-colons may be repeated in valid code
240+ */
241+ SemiColon:
242+ ';'+
243+ ;
244+
238245/*
239246Anything that is considered a value: a literal, a variable, or e.g. a sum
240247*/
Original file line number Diff line number Diff line change @@ -54,6 +54,8 @@ myfloat_no_ws:REAL;
5454 mypointer2 : REFERENCE TO UDINT;
5555 mypointer3 : REFERENCE TO FB_Motor REF= _motor;
5656
57+ extra_semicolons : INT := 7;;;;;;;;;;
58+
5759 timeout1 : TIME := T#2S;
5860 timeout2 : TIME := T#12m13s14ms;
5961
Original file line number Diff line number Diff line change @@ -80,8 +80,8 @@ def test_grammar_variables(meta_model):
8080 filepath = os .path .realpath (tests_dir + "/plc_code/" + filename )
8181 try :
8282 model = meta_model .model_from_file (filepath )
83- except :
84- pytest .fail (f"Error when analyzing the file `{ filename } `" )
83+ except TextXSyntaxError as err :
84+ pytest .fail (f"Error when analyzing the file `{ filename } `: { err } " )
8585 else :
8686 assert model .functions
8787 fb = model .functions [0 ]
You can’t perform that action at this time.
0 commit comments