Java 类org.eclipse.xtext.parser.antlr.AbstractAntlrParser 实例源码

项目:xtext-core    文件:AbstractAntlrParserBasedTokenSourceProvider.java   
@Override
public TokenSource createTokenSource(final CharStream stream) {
  if ((this.parser instanceof AbstractAntlrParser)) {
    return ((AbstractAntlrParser)this.parser).createLexer(stream);
  }
  StringConcatenation _builder = new StringConcatenation();
  String _name = this.parser.getClass().getName();
  _builder.append(_name);
  _builder.append(" should be a subclass of ");
  String _name_1 = AbstractAntlrParser.class.getName();
  _builder.append(_name_1);
  throw new IllegalStateException(_builder.toString());
}
项目:xtext-core    文件:PartialParsingHelperIssue219Test.java   
@Test
public void testIssue219() throws Exception {
    with(PartialParserTestLanguageStandaloneSetup.class);
    String model = "container c1 {\n" + "  children {\n" + "-> C ( ch1 )\n" + "  }" + "}";
    XtextResource resource = getResourceFromString(model);
    assertTrue(resource.getErrors().isEmpty());
    ((PartialParsingHelper) ((AbstractAntlrParser) resource.getParser()).getPartialParser())
            .setTokenRegionProvider(null);
    resource.update(model.indexOf("ch1") + 1, 1, "x");
}