From 6d241edf14ba02c4610a7fb725d183355b0719ad Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 8 Mar 2022 15:23:26 +0100 Subject: [PATCH 1/3] delete unused grammar rules --- org.lflang/src/org/lflang/LinguaFranca.xtext | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/org.lflang/src/org/lflang/LinguaFranca.xtext b/org.lflang/src/org/lflang/LinguaFranca.xtext index c466f7a06e..e147194d91 100644 --- a/org.lflang/src/org/lflang/LinguaFranca.xtext +++ b/org.lflang/src/org/lflang/LinguaFranca.xtext @@ -70,17 +70,6 @@ ReactorDecl: Reactor | ImportedReactor; ImportedReactor: reactorClass=[Reactor] ('as' name=ID)?; -//Import: -// 'import' ((importedNamespace=QualifiedNameWithWildcard ('as' alias=ID)?) | importURI=STRING) ';' -//; - - -QualifiedName: - ID ('.' ID)*; - -QualifiedNameWithWildcard: - QualifiedName '.*'?; - /** * Declaration of a reactor class. */ @@ -270,7 +259,7 @@ KeyValuePair: Array: // todo allow empty array in grammar, replace with validator error '[' elements+=Element (',' (elements+=Element))* ','? ']'; - + Element: keyvalue=KeyValuePairs | array=Array From b407fe43bfb5ce783701d755ccb228a6b35dadb2 Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 8 Mar 2022 15:24:07 +0100 Subject: [PATCH 2/3] mutations and reactions should use the same triggers, effects and sources --- org.lflang/src/org/lflang/LinguaFranca.xtext | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.lflang/src/org/lflang/LinguaFranca.xtext b/org.lflang/src/org/lflang/LinguaFranca.xtext index e147194d91..e91ff8605f 100644 --- a/org.lflang/src/org/lflang/LinguaFranca.xtext +++ b/org.lflang/src/org/lflang/LinguaFranca.xtext @@ -212,9 +212,9 @@ STP: Mutation: ('mutation') - ('(' (triggers+=[Trigger] (',' triggers+=[Trigger])*)? ')')? - (sources+=[Input] (',' sources+=[Input])*)? - ('->' effects+=[Effect] (',' effects+=[Effect])*)? + ('(' (triggers+=TriggerRef (',' triggers+=TriggerRef)*)? ')')? + (sources+=VarRef (',' sources+=VarRef)*)? + ('->' effects+=[VarRef] (',' effects+=[VarRef])*)? code=Code; Preamble: From 204e80fc576ded7f9e754562cb5b2bd2816f090d Mon Sep 17 00:00:00 2001 From: Christian Menard Date: Tue, 8 Mar 2022 15:43:14 +0100 Subject: [PATCH 3/3] delete more unused rules --- org.lflang/src/org/lflang/LinguaFranca.xtext | 39 +------------------- 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/org.lflang/src/org/lflang/LinguaFranca.xtext b/org.lflang/src/org/lflang/LinguaFranca.xtext index e91ff8605f..6e071503cd 100644 --- a/org.lflang/src/org/lflang/LinguaFranca.xtext +++ b/org.lflang/src/org/lflang/LinguaFranca.xtext @@ -275,11 +275,6 @@ TypedVariable: Variable: TypedVariable | Timer | Mode; -Trigger: - Action | Input; - -Effect: - Action | Output; VarRef: variable=[Variable] | container=[Instantiation] '.' variable=[Variable] | interleaved?='interleaved' '(' (variable=[Variable] | container=[Instantiation] '.' variable=[Variable]) ')' @@ -300,36 +295,15 @@ Assignment: * Parameter declaration with optional type and mandatory initialization. */ Parameter: - name=ID (':' (type=Type))? - // FIXME: rename Value to Expr + name=ID (':' (type=Type))? ((parens+='(' (init+=Value (',' init+=Value)*)? parens+=')') | (braces+='{' (init+=Value (',' init+=Value)*)? braces+='}') )? ; -Sum : - terms+=Difference ('+' terms+=Difference)*; - -Difference: - terms+=Product ('-' terms +=Product)*; - -Product: - terms+=Quotient ('*' terms+=Quotient)*; - -Quotient: - terms+=Expr ('/' terms += Expr)*; - -Expr : - Value | '(' Sum ')'; - -// Time is either a reference to a parameter or an integer value, -// a number followed by a unit specification (unless the value is zero). -// If it is a constant, the validator should check that if the value -// is non-zero, it is accompanied by a unit. Value: (parameter=[Parameter] | time=Time | literal=Literal | code=Code); - Time: (interval=INT unit=TimeUnit) ; @@ -386,11 +360,6 @@ DottedName: (ID (('.'|'::') ID)*) ; - -Generic: - '<' (DottedName (',' DottedName)*) '>' -; - SignedInt: INT | NEGINT ; @@ -473,10 +442,6 @@ Code: {Code} '{=' body=Body '=}' ; -// The following cannot be terminal because it overlaps ID. -//Path: -// ID ('.' ID)*; - FSName: (ID | '.' | '_')+ ; @@ -543,4 +508,4 @@ Token: '@' | // Single quotes "'" -; +; \ No newline at end of file