diff --git a/build.gradle b/build.gradle index 4d5969d8576c5f317ffa16121df7ddb38a81b75e..f02d96dffc91430ccea881c0fe3a47080340e821 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ apply plugin: 'eclipse' apply plugin: 'maven' -project.version = '3.2.12' +project.version = '3.2.13' project.group = 'de.hhu.stups' project.archivesBaseName = "sablecc" diff --git a/src/main/resources/org/sablecc/sablecc/parser.txt b/src/main/resources/org/sablecc/sablecc/parser.txt index b3099ed703952cbb1bd2442d2cb60588c34466d7..7c9c93174b04be3bac4f52ffd14863341129ec7d 100644 --- a/src/main/resources/org/sablecc/sablecc/parser.txt +++ b/src/main/resources/org/sablecc/sablecc/parser.txt @@ -184,6 +184,10 @@ public class Parser implements IParser + token.getText().length()); } + protected boolean addElementsFromListToNewList(String productionRuleAsString) { + return true; + } + $ Macro:ParserInliningPushHeader @@ -399,13 +403,14 @@ Macro:ParserNewHeader { this.firstPopped = null; this.lastPopped = null; - ArrayList nodeList = new ArrayList(); + final boolean addElementsToNewList = addElementsFromListToNewList("$1$"); + ArrayList nodeList = new ArrayList(); $ Macro:ParserNewBodyDecl - ArrayList nodeArrayList$0$ = pop(); + ArrayList nodeArrayList$0$ = pop(); $ @@ -464,32 +469,35 @@ Macro:ParserNewBodyNewTail $ Macro:ParserTypedLinkedListAdd - if($2$Node$3$ != null) - { - $0$Node$1$.add($2$Node$3$); - } + if($2$Node$3$ != null) + { + $0$Node$1$.add($2$Node$3$); + } $ Macro:ParserTypedLinkedListAddAll if($2$Node$3$ != null) //Macro:ParserTypedLinkedListAddAll { - $0$Node$1$.addAll($2$Node$3$); - //$0$Node$1$ = $2$Node$3$; + if(addElementsToNewList){ + $0$Node$1$.addAll($2$Node$3$); + }else{ + $0$Node$1$ = $2$Node$3$; + } } $ Macro:ParserTypedLinkedListAddAll2 - if($2$ != null) //Macro:ParserTypedLinkedListAddAll2 - { - $0$Node$1$.addAll($2$); - } + if($2$ != null) //Macro:ParserTypedLinkedListAddAll2 + { + $0$Node$1$.addAll($2$); + } $ Macro:ParserNewBodyListAdd - nodeList.add($0$Node$1$); + nodeList.add($0$Node$1$); $