fixed grammar attributes (debug, token limit) not being set

attributes are not set when generating flattened grammar access

fix: explicitly copy attributes to flattenedGrammar
This commit is contained in:
overflowerror 2022-01-18 14:31:54 +01:00
parent 7f10364f08
commit 87d5b57f62
3 changed files with 43 additions and 40 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

@ -70,6 +70,9 @@ public class FlattenedGrammarAccess {
flattenedGrammar.setInitBlock(copiedBlock);
}
flattenedGrammar.setDebug(grammar.isDebug());
flattenedGrammar.setTokenLimit(grammar.getTokenLimit());
Map<RuleWithParameterValues, AbstractRule> origToCopy = new LinkedHashMap<>();
List<AbstractRule> copies = copyRuleStubs(names, origToCopy, filter.getRules(grammar),
filter.isDiscardRuleTypeRef());

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);
}
}