added hoisting debug and tokenLimit settings to grammar definition

This commit is contained in:
overflowerror 2022-01-17 16:51:04 +01:00
parent e317d65b45
commit 2deeea0bd5
16 changed files with 6769 additions and 5418 deletions

View file

@ -61,38 +61,6 @@ public class TracingSugarTest {
return result;
}
public IGeneratorNode _name(final Property target) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
ILocationData location = this.location(target, feature, -1);
CompositeGeneratorNode trace = this.trace(location);
this.append(trace, target.getName());
return trace;
}
public IGeneratorNode _name(final Property target, final boolean useForDebugging) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
ILocationData location = this.location(target, feature, -1);
CompositeGeneratorNode trace = this.trace(location, useForDebugging);
this.append(trace, target.getName());
return trace;
}
public IGeneratorNode _name(final Property target, final Function<String, String> stringProvider) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
ILocationData location = this.location(target, feature, -1);
CompositeGeneratorNode trace = this.trace(location);
this.append(trace, stringProvider.apply(target.getName()));
return trace;
}
public IGeneratorNode _extends(final Type target, final Function<Type, String> stringProvider) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("extends");
ILocationData location = this.location(target, feature, -1);
CompositeGeneratorNode trace = this.trace(location);
this.append(trace, stringProvider.apply(target.getExtends()));
return trace;
}
public IGeneratorNode _name(final Type target) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
ILocationData location = this.location(target, feature, -1);
@ -117,6 +85,14 @@ public class TracingSugarTest {
return trace;
}
public IGeneratorNode _extends(final Type target, final Function<Type, String> stringProvider) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("extends");
ILocationData location = this.location(target, feature, -1);
CompositeGeneratorNode trace = this.trace(location);
this.append(trace, stringProvider.apply(target.getExtends()));
return trace;
}
public IGeneratorNode _parentId(final Type target, final Function<Property, String> stringProvider) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("parentId");
ILocationData location = this.location(target, feature, -1);
@ -125,6 +101,30 @@ public class TracingSugarTest {
return trace;
}
public IGeneratorNode _name(final Property target) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
ILocationData location = this.location(target, feature, -1);
CompositeGeneratorNode trace = this.trace(location);
this.append(trace, target.getName());
return trace;
}
public IGeneratorNode _name(final Property target, final boolean useForDebugging) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
ILocationData location = this.location(target, feature, -1);
CompositeGeneratorNode trace = this.trace(location, useForDebugging);
this.append(trace, target.getName());
return trace;
}
public IGeneratorNode _name(final Property target, final Function<String, String> stringProvider) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
ILocationData location = this.location(target, feature, -1);
CompositeGeneratorNode trace = this.trace(location);
this.append(trace, stringProvider.apply(target.getName()));
return trace;
}
public IGeneratorNode _name(final UnresolvedProxyProperty target) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
ILocationData location = this.location(target, feature, -1);

View file

@ -63,6 +63,7 @@ public class XtextParser extends AbstractContentAssistParser {
builder.put(grammarAccess.getGrammarAccess().getGroup_3(), "rule__Grammar__Group_3__0");
builder.put(grammarAccess.getGrammarAccess().getGroup_3_2(), "rule__Grammar__Group_3_2__0");
builder.put(grammarAccess.getGrammarAccess().getGroup_3_2_1(), "rule__Grammar__Group_3_2_1__0");
builder.put(grammarAccess.getGrammarAccess().getGroup_5_0(), "rule__Grammar__Group_5_0__0");
builder.put(grammarAccess.getInitBlockAccess().getGroup(), "rule__InitBlock__Group__0");
builder.put(grammarAccess.getGrammarIDAccess().getGroup(), "rule__GrammarID__Group__0");
builder.put(grammarAccess.getGrammarIDAccess().getGroup_1(), "rule__GrammarID__Group_1__0");
@ -157,7 +158,9 @@ public class XtextParser extends AbstractContentAssistParser {
builder.put(grammarAccess.getGrammarAccess().getHiddenTokensAssignment_3_2_0(), "rule__Grammar__HiddenTokensAssignment_3_2_0");
builder.put(grammarAccess.getGrammarAccess().getHiddenTokensAssignment_3_2_1_1(), "rule__Grammar__HiddenTokensAssignment_3_2_1_1");
builder.put(grammarAccess.getGrammarAccess().getMetamodelDeclarationsAssignment_4(), "rule__Grammar__MetamodelDeclarationsAssignment_4");
builder.put(grammarAccess.getGrammarAccess().getInitBlockAssignment_5(), "rule__Grammar__InitBlockAssignment_5");
builder.put(grammarAccess.getGrammarAccess().getTokenLimitAssignment_5_0_1(), "rule__Grammar__TokenLimitAssignment_5_0_1");
builder.put(grammarAccess.getGrammarAccess().getDebugAssignment_5_1(), "rule__Grammar__DebugAssignment_5_1");
builder.put(grammarAccess.getGrammarAccess().getInitBlockAssignment_5_2(), "rule__Grammar__InitBlockAssignment_5_2");
builder.put(grammarAccess.getGrammarAccess().getRulesAssignment_6(), "rule__Grammar__RulesAssignment_6");
builder.put(grammarAccess.getInitBlockAccess().getCodeAssignment_1(), "rule__InitBlock__CodeAssignment_1");
builder.put(grammarAccess.getGeneratedMetamodelAccess().getNameAssignment_1(), "rule__GeneratedMetamodel__NameAssignment_1");
@ -245,6 +248,7 @@ public class XtextParser extends AbstractContentAssistParser {
builder.put(grammarAccess.getEnumLiteralsAccess().getElementsAssignment_1_1_1(), "rule__EnumLiterals__ElementsAssignment_1_1_1");
builder.put(grammarAccess.getEnumLiteralDeclarationAccess().getEnumLiteralAssignment_0(), "rule__EnumLiteralDeclaration__EnumLiteralAssignment_0");
builder.put(grammarAccess.getEnumLiteralDeclarationAccess().getLiteralAssignment_1_1(), "rule__EnumLiteralDeclaration__LiteralAssignment_1_1");
builder.put(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), "rule__Grammar__UnorderedGroup_5");
}
}

View file

@ -2423,9 +2423,9 @@ rule__Grammar__Group__5__Impl
}
:
(
{ before(grammarAccess.getGrammarAccess().getInitBlockAssignment_5()); }
(rule__Grammar__InitBlockAssignment_5)?
{ after(grammarAccess.getGrammarAccess().getInitBlockAssignment_5()); }
{ before(grammarAccess.getGrammarAccess().getUnorderedGroup_5()); }
(rule__Grammar__UnorderedGroup_5)
{ after(grammarAccess.getGrammarAccess().getUnorderedGroup_5()); }
)
;
finally {
@ -2817,6 +2817,60 @@ finally {
}
rule__Grammar__Group_5_0__0
@init {
int stackSize = keepStackSize();
}
:
rule__Grammar__Group_5_0__0__Impl
rule__Grammar__Group_5_0__1
;
finally {
restoreStackSize(stackSize);
}
rule__Grammar__Group_5_0__0__Impl
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getGrammarAccess().getTokenLimitKeyword_5_0_0()); }
'tokenLimit'
{ after(grammarAccess.getGrammarAccess().getTokenLimitKeyword_5_0_0()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__Grammar__Group_5_0__1
@init {
int stackSize = keepStackSize();
}
:
rule__Grammar__Group_5_0__1__Impl
;
finally {
restoreStackSize(stackSize);
}
rule__Grammar__Group_5_0__1__Impl
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getGrammarAccess().getTokenLimitAssignment_5_0_1()); }
(rule__Grammar__TokenLimitAssignment_5_0_1)
{ after(grammarAccess.getGrammarAccess().getTokenLimitAssignment_5_0_1()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__InitBlock__Group__0
@init {
int stackSize = keepStackSize();
@ -2835,9 +2889,9 @@ rule__InitBlock__Group__0__Impl
}
:
(
{ before(grammarAccess.getInitBlockAccess().getInitKeyword_0()); }
'@init'
{ after(grammarAccess.getInitBlockAccess().getInitKeyword_0()); }
{ before(grammarAccess.getInitBlockAccess().getStaticKeyword_0()); }
'static'
{ after(grammarAccess.getInitBlockAccess().getStaticKeyword_0()); }
)
;
finally {
@ -8813,6 +8867,116 @@ finally {
}
rule__Grammar__UnorderedGroup_5
@init {
int stackSize = keepStackSize();
getUnorderedGroupHelper().enter(grammarAccess.getGrammarAccess().getUnorderedGroup_5());
}
:
rule__Grammar__UnorderedGroup_5__0
?
;
finally {
getUnorderedGroupHelper().leave(grammarAccess.getGrammarAccess().getUnorderedGroup_5());
restoreStackSize(stackSize);
}
rule__Grammar__UnorderedGroup_5__Impl
@init {
int stackSize = keepStackSize();
boolean selected = false;
}
:
(
(
{getUnorderedGroupHelper().canSelect(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), 0)}?=>(
{
getUnorderedGroupHelper().select(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), 0);
}
{
selected = true;
}
(
{ before(grammarAccess.getGrammarAccess().getGroup_5_0()); }
(rule__Grammar__Group_5_0__0)
{ after(grammarAccess.getGrammarAccess().getGroup_5_0()); }
)
)
)|
(
{getUnorderedGroupHelper().canSelect(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), 1)}?=>(
{
getUnorderedGroupHelper().select(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), 1);
}
{
selected = true;
}
(
{ before(grammarAccess.getGrammarAccess().getDebugAssignment_5_1()); }
(rule__Grammar__DebugAssignment_5_1)
{ after(grammarAccess.getGrammarAccess().getDebugAssignment_5_1()); }
)
)
)|
(
{getUnorderedGroupHelper().canSelect(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), 2)}?=>(
{
getUnorderedGroupHelper().select(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), 2);
}
{
selected = true;
}
(
{ before(grammarAccess.getGrammarAccess().getInitBlockAssignment_5_2()); }
(rule__Grammar__InitBlockAssignment_5_2)
{ after(grammarAccess.getGrammarAccess().getInitBlockAssignment_5_2()); }
)
)
)
)
;
finally {
if (selected)
getUnorderedGroupHelper().returnFromSelection(grammarAccess.getGrammarAccess().getUnorderedGroup_5());
restoreStackSize(stackSize);
}
rule__Grammar__UnorderedGroup_5__0
@init {
int stackSize = keepStackSize();
}
:
rule__Grammar__UnorderedGroup_5__Impl
rule__Grammar__UnorderedGroup_5__1?
;
finally {
restoreStackSize(stackSize);
}
rule__Grammar__UnorderedGroup_5__1
@init {
int stackSize = keepStackSize();
}
:
rule__Grammar__UnorderedGroup_5__Impl
rule__Grammar__UnorderedGroup_5__2?
;
finally {
restoreStackSize(stackSize);
}
rule__Grammar__UnorderedGroup_5__2
@init {
int stackSize = keepStackSize();
}
:
rule__Grammar__UnorderedGroup_5__Impl
;
finally {
restoreStackSize(stackSize);
}
rule__Grammar__NameAssignment_1
@init {
int stackSize = keepStackSize();
@ -8938,15 +9102,49 @@ finally {
restoreStackSize(stackSize);
}
rule__Grammar__InitBlockAssignment_5
rule__Grammar__TokenLimitAssignment_5_0_1
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getGrammarAccess().getInitBlockInitBlockParserRuleCall_5_0()); }
{ before(grammarAccess.getGrammarAccess().getTokenLimitINTTerminalRuleCall_5_0_1_0()); }
RULE_INT
{ after(grammarAccess.getGrammarAccess().getTokenLimitINTTerminalRuleCall_5_0_1_0()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__Grammar__DebugAssignment_5_1
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getGrammarAccess().getDebugHoistingDebugKeyword_5_1_0()); }
(
{ before(grammarAccess.getGrammarAccess().getDebugHoistingDebugKeyword_5_1_0()); }
'hoistingDebug'
{ after(grammarAccess.getGrammarAccess().getDebugHoistingDebugKeyword_5_1_0()); }
)
{ after(grammarAccess.getGrammarAccess().getDebugHoistingDebugKeyword_5_1_0()); }
)
;
finally {
restoreStackSize(stackSize);
}
rule__Grammar__InitBlockAssignment_5_2
@init {
int stackSize = keepStackSize();
}
:
(
{ before(grammarAccess.getGrammarAccess().getInitBlockInitBlockParserRuleCall_5_2_0()); }
ruleInitBlock
{ after(grammarAccess.getGrammarAccess().getInitBlockInitBlockParserRuleCall_5_0()); }
{ after(grammarAccess.getGrammarAccess().getInitBlockInitBlockParserRuleCall_5_2_0()); }
)
;
finally {

View file

@ -1,52 +1,54 @@
'!'=43
'&'=38
'!'=44
'&'=39
'('=23
')'=24
'*'=13
'+'=14
'+='=16
','=22
'->'=47
'.'=26
'..'=49
':'=31
'::'=36
';'=32
'<'=34
'->'=48
'.'=27
'..'=50
':'=32
'::'=37
';'=33
'<'=35
'='=15
'=>'=53
'>'=35
'=>'=55
'>'=36
'?'=12
'?='=19
'?=>'=39
'@'=30
'@init'=25
'EOF'=48
'['=44
']'=45
'as'=28
'current'=42
'enum'=50
'?=>'=40
'@'=31
'EOF'=49
'['=45
']'=46
'as'=29
'current'=43
'enum'=51
'false'=17
'fragment'=52
'generate'=27
'fragment'=54
'generate'=28
'grammar'=20
'hidden'=51
'import'=29
'returns'=33
'terminal'=46
'hidden'=52
'hoistingDebug'=53
'import'=30
'returns'=34
'static'=26
'terminal'=47
'tokenLimit'=25
'true'=18
'with'=21
'{'=40
'|'=37
'}'=41
'{'=41
'|'=38
'}'=42
RULE_ANY_OTHER=11
RULE_ID=4
RULE_INT=7
RULE_JAVACODESTRING=6
RULE_INT=5
RULE_JAVACODESTRING=7
RULE_ML_COMMENT=8
RULE_SL_COMMENT=9
RULE_STRING=5
RULE_STRING=6
RULE_WS=10
T__12=12
T__13=13
@ -90,3 +92,5 @@ T__50=50
T__51=51
T__52=52
T__53=53
T__54=54
T__55=55

View file

@ -13,9 +13,11 @@ import org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider;
import org.eclipse.xtext.parser.antlr.AntlrTokenToStringConverter;
import org.eclipse.xtext.parser.antlr.IAntlrTokenFileProvider;
import org.eclipse.xtext.parser.antlr.ITokenDefProvider;
import org.eclipse.xtext.parser.antlr.IUnorderedGroupHelper;
import org.eclipse.xtext.parser.antlr.Lexer;
import org.eclipse.xtext.parser.antlr.LexerBindings;
import org.eclipse.xtext.parser.antlr.LexerProvider;
import org.eclipse.xtext.parser.antlr.UnorderedGroupHelper;
import org.eclipse.xtext.parser.antlr.XtextAntlrTokenFileProvider;
import org.eclipse.xtext.parser.antlr.XtextParser;
import org.eclipse.xtext.parser.antlr.internal.InternalXtextLexer;
@ -98,6 +100,11 @@ public abstract class AbstractXtextRuntimeModule extends DefaultRuntimeModule {
.to(InternalXtextLexer.class);
}
// contributed by org.eclipse.xtext.xtext.generator.parser.antlr.XtextAntlrGeneratorFragment2
public Class<? extends IUnorderedGroupHelper> bindIUnorderedGroupHelper() {
return UnorderedGroupHelper.class;
}
// contributed by org.eclipse.xtext.xtext.generator.serializer.SerializerFragment2
public Class<? extends ISemanticSequencer> bindISemanticSequencer() {
return XtextSemanticSequencer.class;

View file

@ -229,28 +229,107 @@ ruleGrammar returns [EObject current=null]
(
(
{
newCompositeNode(grammarAccess.getGrammarAccess().getInitBlockInitBlockParserRuleCall_5_0());
getUnorderedGroupHelper().enter(grammarAccess.getGrammarAccess().getUnorderedGroup_5());
}
lv_initBlock_13_0=ruleInitBlock
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getGrammarRule());
(
(
(
{getUnorderedGroupHelper().canSelect(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), 0)}?=>(
{
getUnorderedGroupHelper().select(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), 0);
}
set(
$current,
"initBlock",
lv_initBlock_13_0,
"org.eclipse.xtext.Xtext.InitBlock");
afterParserOrEnumRuleCall();
}
({true}?=>(otherlv_14='tokenLimit'
{
newLeafNode(otherlv_14, grammarAccess.getGrammarAccess().getTokenLimitKeyword_5_0_0());
}
(
(
lv_tokenLimit_15_0=RULE_INT
{
newLeafNode(lv_tokenLimit_15_0, grammarAccess.getGrammarAccess().getTokenLimitINTTerminalRuleCall_5_0_1_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getGrammarRule());
}
setWithLastConsumed(
$current,
"tokenLimit",
lv_tokenLimit_15_0,
"org.eclipse.xtext.common.Terminals.INT");
}
)
)
))
{
getUnorderedGroupHelper().returnFromSelection(grammarAccess.getGrammarAccess().getUnorderedGroup_5());
}
)
)|
(
{getUnorderedGroupHelper().canSelect(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), 1)}?=>(
{
getUnorderedGroupHelper().select(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), 1);
}
({true}?=>((
lv_debug_16_0='hoistingDebug'
{
newLeafNode(lv_debug_16_0, grammarAccess.getGrammarAccess().getDebugHoistingDebugKeyword_5_1_0());
}
{
if ($current==null) {
$current = createModelElement(grammarAccess.getGrammarRule());
}
setWithLastConsumed($current, "debug", lv_debug_16_0 != null, "hoistingDebug");
}
)
))
{
getUnorderedGroupHelper().returnFromSelection(grammarAccess.getGrammarAccess().getUnorderedGroup_5());
}
)
)|
(
{getUnorderedGroupHelper().canSelect(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), 2)}?=>(
{
getUnorderedGroupHelper().select(grammarAccess.getGrammarAccess().getUnorderedGroup_5(), 2);
}
({true}?=>((
{
newCompositeNode(grammarAccess.getGrammarAccess().getInitBlockInitBlockParserRuleCall_5_2_0());
}
lv_initBlock_17_0=ruleInitBlock
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getGrammarRule());
}
set(
$current,
"initBlock",
lv_initBlock_17_0,
"org.eclipse.xtext.Xtext.InitBlock");
afterParserOrEnumRuleCall();
}
)
))
{
getUnorderedGroupHelper().returnFromSelection(grammarAccess.getGrammarAccess().getUnorderedGroup_5());
}
)
)
)?
)*
)
)
{
getUnorderedGroupHelper().leave(grammarAccess.getGrammarAccess().getUnorderedGroup_5());
}
)
(
(
{
newCompositeNode(grammarAccess.getGrammarAccess().getRulesAbstractRuleParserRuleCall_6_0());
}
lv_rules_14_0=ruleAbstractRule
lv_rules_18_0=ruleAbstractRule
{
if ($current==null) {
$current = createModelElementForParent(grammarAccess.getGrammarRule());
@ -258,7 +337,7 @@ ruleGrammar returns [EObject current=null]
add(
$current,
"rules",
lv_rules_14_0,
lv_rules_18_0,
"org.eclipse.xtext.Xtext.AbstractRule");
afterParserOrEnumRuleCall();
}
@ -283,9 +362,9 @@ ruleInitBlock returns [EObject current=null]
leaveRule();
}:
(
otherlv_0='@init'
otherlv_0='static'
{
newLeafNode(otherlv_0, grammarAccess.getInitBlockAccess().getInitKeyword_0());
newLeafNode(otherlv_0, grammarAccess.getInitBlockAccess().getStaticKeyword_0());
}
(
(

View file

@ -1,52 +1,54 @@
'!'=44
'&'=33
'!'=46
'&'=35
'('=16
')'=17
'*'=25
'+'=36
'+='=39
'*'=27
'+'=38
'+='=41
','=14
'->'=46
'.'=19
'..'=52
':'=27
'::'=31
';'=28
'<'=29
'='=38
'=>'=45
'>'=30
'?'=35
'?='=47
'?=>'=34
'@'=23
'@init'=18
'EOF'=51
'['=48
']'=49
'as'=21
'current'=40
'enum'=53
'false'=43
'fragment'=24
'generate'=20
'->'=48
'.'=21
'..'=54
':'=29
'::'=33
';'=30
'<'=31
'='=40
'=>'=47
'>'=32
'?'=37
'?='=49
'?=>'=36
'@'=25
'EOF'=53
'['=50
']'=51
'as'=23
'current'=42
'enum'=55
'false'=45
'fragment'=26
'generate'=22
'grammar'=12
'hidden'=15
'import'=22
'returns'=26
'terminal'=50
'true'=42
'hoistingDebug'=19
'import'=24
'returns'=28
'static'=20
'terminal'=52
'tokenLimit'=18
'true'=44
'with'=13
'{'=37
'|'=32
'}'=41
'{'=39
'|'=34
'}'=43
RULE_ANY_OTHER=11
RULE_ID=5
RULE_INT=7
RULE_JAVACODESTRING=6
RULE_ID=6
RULE_INT=4
RULE_JAVACODESTRING=7
RULE_ML_COMMENT=8
RULE_SL_COMMENT=9
RULE_STRING=4
RULE_STRING=5
RULE_WS=10
T__12=12
T__13=13
@ -90,3 +92,5 @@ T__50=50
T__51=51
T__52=52
T__53=53
T__54=54
T__55=55

View file

@ -996,7 +996,7 @@ public class XtextSemanticSequencer extends AbstractDelegatingSemanticSequencer
* (usedGrammars+=[Grammar|GrammarID] usedGrammars+=[Grammar|GrammarID]*)?
* (definesHiddenTokens?='hidden' (hiddenTokens+=[AbstractRule|RuleID] hiddenTokens+=[AbstractRule|RuleID]*)?)?
* metamodelDeclarations+=AbstractMetamodelDeclaration*
* initBlock=InitBlock?
* (tokenLimit=INT | debug?='hoistingDebug' | initBlock=InitBlock)*
* rules+=AbstractRule+
* )
*/

View file

@ -17,6 +17,7 @@ import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.ParserRule;
import org.eclipse.xtext.RuleCall;
import org.eclipse.xtext.TerminalRule;
import org.eclipse.xtext.UnorderedGroup;
import org.eclipse.xtext.common.services.TerminalsGrammarAccess;
import org.eclipse.xtext.service.AbstractElementFinder;
import org.eclipse.xtext.service.GrammarProvider;
@ -56,8 +57,15 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
private final Keyword cRightParenthesisKeyword_3_3 = (Keyword)cGroup_3.eContents().get(3);
private final Assignment cMetamodelDeclarationsAssignment_4 = (Assignment)cGroup.eContents().get(4);
private final RuleCall cMetamodelDeclarationsAbstractMetamodelDeclarationParserRuleCall_4_0 = (RuleCall)cMetamodelDeclarationsAssignment_4.eContents().get(0);
private final Assignment cInitBlockAssignment_5 = (Assignment)cGroup.eContents().get(5);
private final RuleCall cInitBlockInitBlockParserRuleCall_5_0 = (RuleCall)cInitBlockAssignment_5.eContents().get(0);
private final UnorderedGroup cUnorderedGroup_5 = (UnorderedGroup)cGroup.eContents().get(5);
private final Group cGroup_5_0 = (Group)cUnorderedGroup_5.eContents().get(0);
private final Keyword cTokenLimitKeyword_5_0_0 = (Keyword)cGroup_5_0.eContents().get(0);
private final Assignment cTokenLimitAssignment_5_0_1 = (Assignment)cGroup_5_0.eContents().get(1);
private final RuleCall cTokenLimitINTTerminalRuleCall_5_0_1_0 = (RuleCall)cTokenLimitAssignment_5_0_1.eContents().get(0);
private final Assignment cDebugAssignment_5_1 = (Assignment)cUnorderedGroup_5.eContents().get(1);
private final Keyword cDebugHoistingDebugKeyword_5_1_0 = (Keyword)cDebugAssignment_5_1.eContents().get(0);
private final Assignment cInitBlockAssignment_5_2 = (Assignment)cUnorderedGroup_5.eContents().get(2);
private final RuleCall cInitBlockInitBlockParserRuleCall_5_2_0 = (RuleCall)cInitBlockAssignment_5_2.eContents().get(0);
private final Assignment cRulesAssignment_6 = (Assignment)cGroup.eContents().get(6);
private final RuleCall cRulesAbstractRuleParserRuleCall_6_0 = (RuleCall)cRulesAssignment_6.eContents().get(0);
@ -65,14 +73,14 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
// 'grammar' name=GrammarID ('with' usedGrammars+=[Grammar|GrammarID] (',' usedGrammars+=[Grammar|GrammarID])*)?
// (definesHiddenTokens?='hidden' '(' (hiddenTokens+=[AbstractRule|RuleID] (',' hiddenTokens+=[AbstractRule|RuleID])*)?
// ')')?
// metamodelDeclarations+=AbstractMetamodelDeclaration*
// initBlock=InitBlock?
// rules+=AbstractRule+;
// metamodelDeclarations+=AbstractMetamodelDeclaration* (('tokenLimit' tokenLimit=INT)? & debug?='hoistingDebug'? &
// initBlock=InitBlock?) rules+=AbstractRule+;
@Override public ParserRule getRule() { return rule; }
//'grammar' name=GrammarID ('with' usedGrammars+=[Grammar|GrammarID] (',' usedGrammars+=[Grammar|GrammarID])*)?
//(definesHiddenTokens?='hidden' '(' (hiddenTokens+=[AbstractRule|RuleID] (',' hiddenTokens+=[AbstractRule|RuleID])*)?
//')')? metamodelDeclarations+=AbstractMetamodelDeclaration* initBlock=InitBlock? rules+=AbstractRule+
//')')? metamodelDeclarations+=AbstractMetamodelDeclaration* (('tokenLimit' tokenLimit=INT)? & debug?='hoistingDebug'? &
//initBlock=InitBlock?) rules+=AbstractRule+
public Group getGroup() { return cGroup; }
//'grammar'
@ -163,11 +171,32 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
//AbstractMetamodelDeclaration
public RuleCall getMetamodelDeclarationsAbstractMetamodelDeclarationParserRuleCall_4_0() { return cMetamodelDeclarationsAbstractMetamodelDeclarationParserRuleCall_4_0; }
//(('tokenLimit' tokenLimit=INT)? & debug?='hoistingDebug'? & initBlock=InitBlock?)
public UnorderedGroup getUnorderedGroup_5() { return cUnorderedGroup_5; }
//('tokenLimit' tokenLimit=INT)?
public Group getGroup_5_0() { return cGroup_5_0; }
//'tokenLimit'
public Keyword getTokenLimitKeyword_5_0_0() { return cTokenLimitKeyword_5_0_0; }
//tokenLimit=INT
public Assignment getTokenLimitAssignment_5_0_1() { return cTokenLimitAssignment_5_0_1; }
//INT
public RuleCall getTokenLimitINTTerminalRuleCall_5_0_1_0() { return cTokenLimitINTTerminalRuleCall_5_0_1_0; }
//debug?='hoistingDebug'?
public Assignment getDebugAssignment_5_1() { return cDebugAssignment_5_1; }
//'hoistingDebug'
public Keyword getDebugHoistingDebugKeyword_5_1_0() { return cDebugHoistingDebugKeyword_5_1_0; }
//initBlock=InitBlock?
public Assignment getInitBlockAssignment_5() { return cInitBlockAssignment_5; }
public Assignment getInitBlockAssignment_5_2() { return cInitBlockAssignment_5_2; }
//InitBlock
public RuleCall getInitBlockInitBlockParserRuleCall_5_0() { return cInitBlockInitBlockParserRuleCall_5_0; }
public RuleCall getInitBlockInitBlockParserRuleCall_5_2_0() { return cInitBlockInitBlockParserRuleCall_5_2_0; }
//rules+=AbstractRule+
public Assignment getRulesAssignment_6() { return cRulesAssignment_6; }
@ -178,19 +207,19 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
public class InitBlockElements extends AbstractParserRuleElementFinder {
private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "org.eclipse.xtext.Xtext.InitBlock");
private final Group cGroup = (Group)rule.eContents().get(1);
private final Keyword cInitKeyword_0 = (Keyword)cGroup.eContents().get(0);
private final Keyword cStaticKeyword_0 = (Keyword)cGroup.eContents().get(0);
private final Assignment cCodeAssignment_1 = (Assignment)cGroup.eContents().get(1);
private final RuleCall cCodeJavaCodeParserRuleCall_1_0 = (RuleCall)cCodeAssignment_1.eContents().get(0);
//InitBlock:
// '@init' code=JavaCode;
// 'static' code=JavaCode;
@Override public ParserRule getRule() { return rule; }
//'@init' code=JavaCode
//'static' code=JavaCode
public Group getGroup() { return cGroup; }
//'@init'
public Keyword getInitKeyword_0() { return cInitKeyword_0; }
//'static'
public Keyword getStaticKeyword_0() { return cStaticKeyword_0; }
//code=JavaCode
public Assignment getCodeAssignment_1() { return cCodeAssignment_1; }
@ -2615,9 +2644,8 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
// 'grammar' name=GrammarID ('with' usedGrammars+=[Grammar|GrammarID] (',' usedGrammars+=[Grammar|GrammarID])*)?
// (definesHiddenTokens?='hidden' '(' (hiddenTokens+=[AbstractRule|RuleID] (',' hiddenTokens+=[AbstractRule|RuleID])*)?
// ')')?
// metamodelDeclarations+=AbstractMetamodelDeclaration*
// initBlock=InitBlock?
// rules+=AbstractRule+;
// metamodelDeclarations+=AbstractMetamodelDeclaration* (('tokenLimit' tokenLimit=INT)? & debug?='hoistingDebug'? &
// initBlock=InitBlock?) rules+=AbstractRule+;
public GrammarElements getGrammarAccess() {
return pGrammar;
}
@ -2627,7 +2655,7 @@ public class XtextGrammarAccess extends AbstractElementFinder.AbstractGrammarEle
}
//InitBlock:
// '@init' code=JavaCode;
// 'static' code=JavaCode;
public InitBlockElements getInitBlockAccess() {
return pInitBlock;
}

View file

@ -15,12 +15,16 @@ Grammar:
'grammar' name=GrammarID ('with' usedGrammars+=[Grammar|GrammarID] (',' usedGrammars+=[Grammar|GrammarID])*)?
(definesHiddenTokens?='hidden' '(' (hiddenTokens+=[AbstractRule|RuleID] (',' hiddenTokens+=[AbstractRule|RuleID])*)? ')')?
metamodelDeclarations+=AbstractMetamodelDeclaration*
(initBlock=InitBlock)?
(
('tokenLimit' tokenLimit=INT)? &
debug?='hoistingDebug'? &
initBlock=InitBlock?
)
(rules+=AbstractRule)+
;
InitBlock returns InitBlock:
'@init' code=JavaCode
'static' code=JavaCode
;
GrammarID returns ecore::EString:

View file

@ -255,12 +255,12 @@ public class GeneratorNodeProcessor {
return this.delegate;
}
public boolean contains(final ITextRegion other) {
return this.getDelegate().contains(other);
public boolean contains(final ITextRegion arg0) {
return this.getDelegate().contains(arg0);
}
public boolean contains(final int offset) {
return this.getDelegate().contains(offset);
public boolean contains(final int arg0) {
return this.getDelegate().contains(arg0);
}
public int getEndLineNumber() {
@ -279,12 +279,12 @@ public class GeneratorNodeProcessor {
return this.getDelegate().getOffset();
}
public ITextRegion merge(final ITextRegion region) {
return this.getDelegate().merge(region);
public ITextRegion merge(final ITextRegion arg0) {
return this.getDelegate().merge(arg0);
}
public ITextRegionWithLineInformation merge(final ITextRegionWithLineInformation other) {
return this.getDelegate().merge(other);
public ITextRegionWithLineInformation merge(final ITextRegionWithLineInformation arg0) {
return this.getDelegate().merge(arg0);
}
}