Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser Fixes #128

Merged
merged 39 commits into from
Feb 1, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5974d70
Un-Ignore all broken lexer/parser testcases.
StephanErb Dec 23, 2011
b608778
Prevent crash on empty leading sub-TextBlocks.
StephanErb Dec 23, 2011
6848881
Prevent ClassCastExceptions on EOF tokens.
StephanErb Dec 23, 2011
3f528b6
Fix testcase logic.
StephanErb Dec 23, 2011
c396382
Print offset status information in TB toString().
StephanErb Dec 25, 2011
343b656
Add minimal viable replace-all testcase.
StephanErb Dec 25, 2011
3a21b53
Retain the stacktrace when re-throwing lexer errors.
StephanErb Dec 25, 2011
0b025a6
Remove risky TB reuse during merge.
StephanErb Dec 26, 2011
f7bc5ca
Break down replace operations into sub-replaces.
StephanErb Dec 26, 2011
d61acbb
Fix the consumption of unconsumed omitted tokens.
StephanErb Dec 26, 2011
0f6936e
Migrate TextBlockObserver tests.
StephanErb Dec 26, 2011
465e213
Fix broken token relocation test.
StephanErb Dec 26, 2011
148b57d
Fix broken reference replacement test.
StephanErb Dec 26, 2011
75bb984
Adapt scenario tests to expect reuse of root elements
StephanErb Dec 27, 2011
6619acc
Prevent crash on unlexable tokens.
StephanErb Dec 30, 2011
043067f
Fix error reporting.
StephanErb Dec 30, 2011
da310a5
New failing incremental lexer testcase.
StephanErb Dec 30, 2011
684b7ed
Implement parsing scenario tests with alternatives.
StephanErb Jan 8, 2012
328a3f0
Fix the reEvaluation of primitive property inits.
StephanErb Jan 8, 2012
a6cefa2
Correctly unset removed properties.
StephanErb Jan 8, 2012
f7b5cb4
Implement a few more testcases for the handling of alternatives.
StephanErb Jan 9, 2012
6327915
Simplify propertyInit reEvaluation.
StephanErb Jan 9, 2012
db5dfb4
Always notify about resolved references.
StephanErb Jan 12, 2012
7eab9d6
Merge branch 'master' into parser_fixes
StephanErb Jan 19, 2012
3fe76fc
Only unset properties which are completely unused.
StephanErb Jan 22, 2012
d57c943
Continue lexing until token types converge.
StephanErb Jan 29, 2012
3c92ea7
Reformat according to our coding guidelines.
StephanErb Jan 29, 2012
fed0f19
Minor code cleanup.
StephanErb Jan 29, 2012
5a334ab
Revert d57c943. We ended up relexing too much.
StephanErb Jan 30, 2012
18abdf5
Remove token state handling and fix 5a334ab properly.
StephanErb Jan 30, 2012
59b44ae
Remove dead code.
StephanErb Jan 30, 2012
abeeeb3
Perform several (very) minor optimizations.
StephanErb Jan 30, 2012
5a215a4
Minor cleanup.
StephanErb Jan 31, 2012
c1d6e41
Improve the isTBEqual check.
StephanErb Jan 31, 2012
1b000a0
Make use of short-cut boolean evalution
StephanErb Jan 31, 2012
f37cae0
Simplify a rather mean testcase.
StephanErb Jan 31, 2012
a47f706
Improve robustness during the TB equals check.
StephanErb Jan 31, 2012
523b8ea
Remove dead code and comments.
StephanErb Jan 31, 2012
a8547cc
Ignore failing testcases. See issue #120.
StephanErb Feb 1, 2012
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import com.sap.furcas.runtime.common.exceptions.ParserInstantiationException;
import com.sap.furcas.runtime.common.exceptions.ParserInvokationException;
import com.sap.furcas.runtime.parser.incremental.testbase.GeneratedParserAndFactoryTestConfiguration;
import com.sap.furcas.runtime.parser.incremental.testbase.MockPartitionAssignmentHandler;
import com.sap.furcas.runtime.parser.testbase.MockPartitionAssignmentHandler;
import com.sap.furcas.test.testutils.ResourceTestHelper;
import com.sap.ide.cts.parser.errorhandling.SemanticParserException;
import com.sap.ide.cts.parser.incremental.IncrementalParserFacade;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import com.sap.furcas.ide.editor.test.utils.ClassLookupImpl;
import com.sap.furcas.parsergenerator.TCSSyntaxContainerBean;
import com.sap.furcas.runtime.parser.incremental.testbase.GeneratedParserAndFactoryTestConfiguration;
import com.sap.furcas.runtime.parser.incremental.testbase.MockPartitionAssignmentHandler;
import com.sap.furcas.runtime.parser.testbase.MockPartitionAssignmentHandler;
import com.sap.furcas.test.fixture.ScenarioFixtureData;
import com.sap.furcas.test.testutils.ResourceTestHelper;
import com.sap.ide.cts.parser.incremental.IncrementalParserFacade;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
import com.sap.furcas.metamodel.FURCAS.TCS.ConcreteSyntax;
import com.sap.furcas.runtime.common.exceptions.ParserInstantiationException;
import com.sap.furcas.runtime.parser.PartitionAssignmentHandler;
import com.sap.furcas.runtime.parser.impl.DefaultPartitionAssignmentHandlerImpl;
import com.sap.furcas.runtime.parser.impl.ObservableInjectingParser;
import com.sap.ide.cts.parser.incremental.DefaultPartitionAssignmentHandlerImpl;
import com.sap.ide.cts.parser.incremental.IncrementalParserFacade;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -711,8 +711,8 @@ public String toString() {
StringBuilder result = new StringBuilder();
result.append(eClass().getName()).append(", ");
result.append(getVersion()).append(", ");
result.append("o:").append(getOffset()).append(", ");
result.append("l:").append(getLength());
result.append("o:").append(getOffset()).append(isOffsetRelative() ? "r" : "a");
result.append(", ").append("l:").append(getLength());
return result.toString();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ public EcoreModelElementFinder(ResourceSet resourceSet, Set<URI> referenceScope,
this.referenceScope = referenceScope;

queryProcessor = QueryProcessorFactory.getDefault().createQueryProcessor(IndexFactory.getInstance());
// Profiling data suggests that for our current usage pattern these optimizations do more harm
// than good. Stephan Erb 01.11.2011
queryProcessor.turnOffOptimizationForPartitionsDuringScheduling();
queryProcessor.turnOffOptimizationForElementsDuringScheduling();
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
syntax BibtexWithAlternatives {

primitiveTemplate identifier for String default using NAME
: value = "%token%"
;

primitiveTemplate stringSymbol for String using STRING
: value = "unescapeString(%token%)",
serializer="\'%value%\'"
;

template BibTextFile main
: "Library:"
(isDefined(name) ? name {{hasName=true}} : {{hasName=false}})
(isDefined(entries) ? "Entries:" "{" entries "}")
;

template BibTextEntry abstract;

template Article
: [[ "@article" "{"
key ","
"author" "=" "{" author{referenceBy="name", separator="and",
lookupScope="OCL:BibText::Author.allInstances()"}
"}"
"}"
| "article"
]]
;

template Author
: [[ name
| "alternative"
| [[ "nestedAlternativeA" | "nestedAlternativeB" ]]
| "nested" (isDefined(name) ? "name" name : [[ "keywordA" | "keywordB" ]] )
| (isDefined(name) ? "name" name ) "noElse"
]]
;

-- place keywords here (optional, seldom used)

-- place symbols here (optional)
symbols {
coma = "," : leftNone, rightSpace;
lcurly = "{" : leftSpace, rightSpace;
rcurly = "}" : leftSpace, rightSpace;
}

-- place operatorLists here (optional)

-- place tokens here (optional, except for COMMENT)

omitted token COMMENT : endOfLine(start = "//");

-- place lexer here (optional)

}

Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ public MockLexerAdapter(Lexer antlrLexer) {
private ANTLRIncrementalLexerAdapter callbackLexer;
private int nextTokenIndex = 0;

@Override
public int getState(AbstractToken tok) {
// TODO Auto-generated method stub
return 0;
}

@Override
public List<AbstractToken> moreTokens() {
// simulate token consumption on callbacked lexer
Expand All @@ -39,12 +33,6 @@ public void setIncrementalLexer(IncrementalLexer incrementalLexer) {
this.callbackLexer = (ANTLRIncrementalLexerAdapter) incrementalLexer;
}

@Override
public void setState(int state) {
// TODO Auto-generated method stub

}

public void setNextTokens(List<AbstractToken> nextTokens) {
this.nextTokens = nextTokens;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ public MockLexerAdapterWithLookaheadLLStar(Lexer antlrLexer) {
protected ANTLRIncrementalLexerAdapter callbackLexer;
protected int nextTokenIndex = 0;

@Override
public int getState(AbstractToken tok) {
return 0;
}

@Override
public List<AbstractToken> moreTokens() {
// simulate a lookahead of 1 within a LL(*) parser
Expand All @@ -42,10 +37,6 @@ public void setIncrementalLexer(IncrementalLexer incrementalLexer) {
this.callbackLexer = (ANTLRIncrementalLexerAdapter) incrementalLexer;
}

@Override
public void setState(int state) {
}

public void setNextTokens(List<AbstractToken> nextTokens) {
this.nextTokens = nextTokens;
}
Expand Down
Loading