@Override public Set<Binding> getGuiceBindingsRt(Grammar grammar) { BindFactory factory = new BindFactory() .addTypeToType(IParser.class.getName(),getParserClassName(grammar, getNaming())) .addTypeToType(ITokenToStringConverter.class.getName(),AntlrTokenToStringConverter.class.getName()) .addTypeToType(IAntlrTokenFileProvider.class.getName(),getAntlrTokenFileProviderClassName(grammar, getNaming())) .addTypeToType(Lexer.class.getName(), getLexerClassName(grammar, getNaming())) .addTypeToProviderInstance(getLexerClassName(grammar, getNaming()), "org.eclipse.xtext.parser.antlr.LexerProvider.create(" + getLexerClassName(grammar, getNaming()) + ".class)") .addConfiguredBinding("RuntimeLexer", "binder.bind(" + Lexer.class.getName() + ".class)"+ ".annotatedWith(com.google.inject.name.Names.named(" + "org.eclipse.xtext.parser.antlr.LexerBindings.RUNTIME" + ")).to(" + getLexerClassName(grammar, getNaming()) +".class)") .addTypeToType(ITokenDefProvider.class.getName(), AntlrTokenDefProvider.class.getName()); if (containsUnorderedGroup(grammar)) factory = factory.addTypeToType(IUnorderedGroupHelper.class.getName(), UnorderedGroupHelper.class.getName()); return factory.getBindings(); }
@Override public Set<Binding> getGuiceBindingsRt(Grammar grammar) { BindFactory factory = new BindFactory() .addTypeToType(IParser.class.getName(),getFragmentHelper().getParserClassName(grammar)) .addTypeToType(ITokenToStringConverter.class.getName(),AntlrTokenToStringConverter.class.getName()) .addTypeToType(IAntlrTokenFileProvider.class.getName(),getFragmentHelper().getAntlrTokenFileProviderClassName(grammar)) .addTypeToType(Lexer.class.getName(), getFragmentHelper().getLexerClassName(grammar)) .addTypeToProviderInstance(getFragmentHelper().getLexerClassName(grammar), "org.eclipse.xtext.parser.antlr.LexerProvider.create(" + getFragmentHelper().getLexerClassName(grammar) + ".class)") .addConfiguredBinding("RuntimeLexer", "binder.bind(" + Lexer.class.getName() + ".class)"+ ".annotatedWith(com.google.inject.name.Names.named(" + "org.eclipse.xtext.parser.antlr.LexerBindings.RUNTIME" + ")).to(" + getFragmentHelper().getLexerClassName(grammar) +".class)") .addTypeToType(ITokenDefProvider.class.getName(),AntlrTokenDefProvider.class.getName()); if (containsUnorderedGroup(grammar)) factory = factory.addTypeToType(IUnorderedGroupHelper.class.getName(), UnorderedGroupHelper.class.getName()); if (getOptions().isIgnoreCase()) { factory = factory .addTypeToType(ITokenSerializer.IKeywordSerializer.class.getName(), IgnoreCaseKeywordSerializer.class.getName()) .addTypeToType(AbstractIDValueConverter.class.getName(), IgnoreCaseIDValueConverter.class.getName()); } return factory.getBindings(); }
private IParser getRegexParser() { if (regexParser == null) { // no need for sync since we can also use a new regexParser if concurrent access happens by accident IResourceServiceProvider serviceProvider = serviceProviders.getResourceServiceProvider(URI .createURI("a.regex")); regexParser = serviceProvider.get(IParser.class); } return regexParser; }
/** * Initializes the parser with resource related parameters. * * @param parser * the {@link IParser} to initialize, may be {@code null} * @param resourceUri * the resource {@link URI} that the parser should consider, may be {@code null} */ private void initializeParser(final IParser parser, final URI resourceUri) { if (parser instanceof IResourceAwareParser) { final IResourceAwareParser resourceParser = (IResourceAwareParser) parser; if (resourceUri == null) { resourceParser.setFileExtension(null); } else { resourceParser.setFileExtension(URI.decode(resourceUri.fileExtension())); // if uri.fileExtension() is null, URI.decode will return null } } }
public Class<? extends IParser> bindIParser() { return PkmntcgoParser.class; }
public Class<? extends IParser> bindIParser() { return TypesParser.class; }
public Class<? extends IParser> bindIParser() { return RegularExpressionParser.class; }
public Class<? extends IParser> bindIParser() { return N4JSParser.class; }
public Class<? extends IParser> bindIParser() { return N4MFParser.class; }
public Class<? extends IParser> bindIParser() { return MyDslParser.class; }
public Class<? extends IParser> bindIParser() { return BromiumParser.class; }
public Class<? extends IParser> bindIParser() { return DSLPoliciesParser.class; }
public Class<? extends IParser> bindIParser() { return LcDslParser.class; }
public Class<? extends IParser> bindIParser() { return DslParser.class; }
public Class<? extends IParser> bindIParser() { return RestauranteParser.class; }
public Class<? extends IParser> bindIParser() { return OCCIParser.class; }
public Class<? extends IParser> bindIParser() { return PureXbaseParser.class; }
public Class<? extends IParser> bindIParser() { return XbaseParser.class; }
public Class<? extends IParser> bindIParser() { return AssignmentFinderTestLanguageParser.class; }
public Class<? extends IParser> bindIParser() { return QualifiedNameTestLanguageParser.class; }
@Override public IParseResult reparse(IParser parser, IParseResult previousParseResult, ReplaceRegion changedRegion) { if (isBrokenPreviousState(previousParseResult, changedRegion.getOffset())) { return fullyReparse(parser, previousParseResult, changedRegion); } ICompositeNode oldRootNode = previousParseResult.getRootNode(); Iterator<ILeafNode> leafNodes = oldRootNode.getLeafNodes().iterator(); ILeafNode leftNode = getLeftNode(leafNodes, changedRegion.getOffset()); if (leftNode == null) { return fullyReparse(parser, previousParseResult, changedRegion); } ILeafNode rightNode = getRightNode(leafNodes, changedRegion.getEndOffset()); if (rightNode == null) { return fullyReparse(parser, previousParseResult, changedRegion); } while(leafNodes.hasNext()) { if (leafNodes.next().getSyntaxErrorMessage() != null) { return fullyReparse(parser, previousParseResult, changedRegion); } } String originalText = oldRootNode.getText().substring(leftNode.getTotalOffset()); StringBuilder newTextBuilder = new StringBuilder(originalText); changedRegion.shiftBy(-leftNode.getTotalOffset()).applyTo(newTextBuilder); String newText = newTextBuilder.toString(); if (originalText.equals(newText)) { // nothing to do return previousParseResult; } int originalLength = rightNode.getTotalEndOffset() - leftNode.getTotalOffset(); int expectedLength = originalLength - changedRegion.getLength() + changedRegion.getText().length(); if (!isSameTokenSequence(originalText.substring(0, originalLength), newText, expectedLength)) { // different token sequence, cannot perform a partial parse run return fullyReparse(parser, previousParseResult, changedRegion); } PartialParsingPointers parsingPointers = calculatePartialParsingPointers(oldRootNode, leftNode, rightNode); ICompositeNode replaceMe = getReplacedNode(parsingPointers); if (replaceMe == null || replaceMe == oldRootNode || replaceMe.getOffset() == 0 && replaceMe.getEndOffset() == oldRootNode.getLength()) { return fullyReparse(parser, previousParseResult, changedRegion); } String reparseRegion = insertChangeIntoReplaceRegion(replaceMe, changedRegion); EObject oldSemanticElement = getOldSemanticElement(replaceMe, parsingPointers); if (oldSemanticElement == null) return fullyReparse(parser, previousParseResult, changedRegion); if (oldSemanticElement == replaceMe.getParent().getSemanticElement()) { throw new IllegalStateException("oldParent == oldElement"); } IParseResult newParseResult = doParseRegion(parser, parsingPointers, replaceMe, reparseRegion); if (newParseResult == null) { throw new IllegalStateException("Could not perform a partial parse operation"); } replaceOldSemanticElement(oldSemanticElement, previousParseResult, newParseResult); nodeModelBuilder.replaceAndTransferLookAhead(replaceMe, newParseResult.getRootNode()); ((ParseResult) newParseResult).setRootNode(oldRootNode); StringBuilder builder = new StringBuilder(oldRootNode.getText()); changedRegion.applyTo(builder); nodeModelBuilder.setCompleteContent(oldRootNode, builder.toString()); return newParseResult; }
public Class<? extends IParser> bindIParser() { return XtextGrammarTestLanguageParser.class; }
public Class<? extends IParser> bindIParser() { return ActionTestLanguageParser.class; }
public Class<? extends IParser> bindIParser() { return HiddenTokenSequencerTestLanguageParser.class; }
public Class<? extends IParser> bindIParser() { return ModelEditorParser.class; }
public Class<? extends IParser> bindIParser() { return LookaheadTestLanguageParser.class; }
public Class<? extends IParser> bindIParser() { return RefactoringTestLanguage2Parser.class; }
public Class<? extends IParser> bindIParser() { return BuilderTestLanguageParser.class; }
public Class<? extends IParser> bindIParser() { return Bug462047LangParser.class; }
public Class<? extends IParser> bindIParser() { return XImportSectionTestLangParser.class; }
public Class<? extends IParser> bindIParser() { return PartialParserTestLanguageParser.class; }
public Class<? extends IParser> bindIParser() { return GrammarAccessTestLanguageParser.class; }
public Class<? extends IParser> bindIParser() { return IndentationAwareTestLanguageParser.class; }
public Class<? extends IParser> bindIParser() { return TreeTestLanguageParser.class; }
public Class<? extends IParser> bindIParser() { return ReferenceGrammarTestLanguageParser.class; }
public Class<? extends IParser> bindIParser() { return Bug305397Parser.class; }
public Class<? extends IParser> bindIParser() { return ConcreteTestLanguageParser.class; }
public Class<? extends IParser> bindIParser() { return MinitlParser.class; }
public Class<? extends IParser> bindIParser() { return XtextParser.class; }
public Class<? extends IParser> bindIParser() { return AbstractTestLanguageParser.class; }