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; 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) { public IGeneratorNode _name(final Type target) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("name"); EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
ILocationData location = this.location(target, feature, -1); ILocationData location = this.location(target, feature, -1);
@ -117,6 +85,14 @@ public class TracingSugarTest {
return trace; 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) { public IGeneratorNode _parentId(final Type target, final Function<Property, String> stringProvider) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("parentId"); EStructuralFeature feature = target.eClass().getEStructuralFeature("parentId");
ILocationData location = this.location(target, feature, -1); ILocationData location = this.location(target, feature, -1);
@ -125,6 +101,30 @@ public class TracingSugarTest {
return trace; 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) { public IGeneratorNode _name(final UnresolvedProxyProperty target) {
EStructuralFeature feature = target.eClass().getEStructuralFeature("name"); EStructuralFeature feature = target.eClass().getEStructuralFeature("name");
ILocationData location = this.location(target, feature, -1); ILocationData location = this.location(target, feature, -1);

View file

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

View file

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