Java Code Examples for org.antlr.runtime.Token#equals()
The following examples show how to use
org.antlr.runtime.Token#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AntlrProposalConflictHelper.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Override public boolean existsConflict(String lastCompleteText, String proposal, ContentAssistContext context) { initTokenSources(lastCompleteText, proposal, context); if (!equalTokenSequence(getLastCompleteLexer(), getCombinedLexer())) return true; if (!equalTokenSequence(getProposalLexer(), getCombinedLexer())) return true; Token lastToken = getProposalLexer().nextToken(); if (!lastToken.equals(Token.EOF_TOKEN)) return true; return false; }
Example 2
Source File: AntlrProposalConflictHelper.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected boolean equalTokenSequence(TokenSource first, TokenSource second) { Token token = null; while(!(token = first.nextToken()).equals(Token.EOF_TOKEN)) { Token otherToken = second.nextToken(); if (otherToken.equals(Token.EOF_TOKEN)) { return false; } if (!token.getText().equals(otherToken.getText())) { return false; } } return true; }
Example 3
Source File: AntlrProposalConflictHelper.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
@Override public boolean existsConflict(String lastCompleteText, String proposal, ContentAssistContext context) { initTokenSources(lastCompleteText, proposal, context); if (!equalTokenSequence(getLastCompleteLexer(), getCombinedLexer())) return true; if (!equalTokenSequence(getProposalLexer(), getCombinedLexer())) return true; Token lastToken = getProposalLexer().nextToken(); if (!lastToken.equals(Token.EOF_TOKEN)) return true; return false; }
Example 4
Source File: AntlrProposalConflictHelper.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
protected boolean equalTokenSequence(TokenSource first, TokenSource second) { Token token = null; while (!(token = first.nextToken()).equals(Token.EOF_TOKEN)) { Token otherToken = second.nextToken(); if (otherToken.equals(Token.EOF_TOKEN)) { return false; } if (!token.getText().equals(otherToken.getText())) { return false; } } return true; }