use of org.eclipse.xtend.core.parser.InternalFlexer in project xtext-xtend by eclipse.
the class FlexerBasedContentAssistContextFactory method createContextsForLastCompleteNode.
@Override
protected void createContextsForLastCompleteNode(EObject previousModel, boolean strict) {
String currentNodePrefix = getPrefix(currentNode);
if (!Strings.isEmpty(currentNodePrefix) && !currentNode.getText().equals(currentNodePrefix)) {
InternalFlexer flexer = flexerFactory.createFlexer(new StringReader(currentNodePrefix));
try {
int token = flexer.advance();
if (token == Token.EOF) {
// error case - nothing could be parsed
return;
}
while (token != Token.EOF) {
if (isErrorToken(token))
return;
token = flexer.advance();
}
} catch (IOException e) {
log.error(e.getMessage(), e);
return;
}
}
String prefix = "";
Collection<FollowElement> followElements = parseFollowElements(completionOffset, strict);
// String completeInput = viewer.getDocument().get(0, completionOffset);
// Collection<FollowElement> followElements = parser.getFollowElements(completeInput, strict);
doCreateContexts(lastCompleteNode, currentNode, prefix, previousModel, followElements);
}
Aggregations