org.eclipse.xtext.parser.antlr.Lexer Java Examples

The following examples show how to use org.eclipse.xtext.parser.antlr.Lexer. 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: PresentationDamagerTest.java    From xtext-xtend with Eclipse Public License 2.0 6 votes vote down vote up
@Override
public Document createDocument(final String before) throws Exception {
  XtextDocument _xblockexpression = null;
  {
    XtendDocumentTokenSource _xtendDocumentTokenSource = new XtendDocumentTokenSource();
    final Procedure1<XtendDocumentTokenSource> _function = (XtendDocumentTokenSource it) -> {
      AntlrTokenDefProvider _antlrTokenDefProvider = new AntlrTokenDefProvider();
      final Procedure1<AntlrTokenDefProvider> _function_1 = (AntlrTokenDefProvider it_1) -> {
        XtendAntlrTokenFileProvider _xtendAntlrTokenFileProvider = new XtendAntlrTokenFileProvider();
        it_1.setAntlrTokenFileProvider(_xtendAntlrTokenFileProvider);
      };
      AntlrTokenDefProvider _doubleArrow = ObjectExtensions.<AntlrTokenDefProvider>operator_doubleArrow(_antlrTokenDefProvider, _function_1);
      it.setTokenDefProvider(_doubleArrow);
      final Provider<Lexer> _function_2 = () -> {
        return this.createLexer();
      };
      it.setLexer(_function_2);
      it.setFlexerFactory(this.flexerFactory);
    };
    final XtendDocumentTokenSource source = ObjectExtensions.<XtendDocumentTokenSource>operator_doubleArrow(_xtendDocumentTokenSource, _function);
    final XtextDocument document = new XtextDocument(source, null, this.outdatedStateManager, this.operationCanceledManager);
    document.set(before);
    _xblockexpression = document;
  }
  return _xblockexpression;
}
 
Example #2
Source File: XtextDocumentModifyTest.java    From xtext-eclipse with Eclipse Public License 2.0 6 votes vote down vote up
private IXtextDocument createDocument(String model) throws Exception {
	resource = getResource(new StringInputStream(model));
	DocumentTokenSource tokenSource = new DocumentTokenSource();
	tokenSource.setLexer(new Provider<Lexer>(){
		@Override
		public Lexer get() {
			return new InternalXtextLexer();
		}});
	
	final XtextDocument document = new XtextDocument(tokenSource, get(ITextEditComposer.class), new OutdatedStateManager(), new OperationCanceledManager()) {
		@Override
		public <T> T internalModify(IUnitOfWork<T, XtextResource> work) {
			try {
				return work.exec((XtextResource) resource);
			}
			catch (Exception e) {
				throw new RuntimeException(e);
			}
		}
	};
	document.set(model);
	return document;
}
 
Example #3
Source File: DamagerRepairerPerformanceTest.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
protected Document createDocument(String before) {
	DocumentTokenSource source = new DocumentTokenSource();
	source.setLexer(new Provider<Lexer>() {
		@Override
		public Lexer get() {
			return new org.eclipse.xtext.parser.antlr.internal.InternalXtextLexer();
		}
	});
	XtextDocument document = new XtextDocument(source, null, new OutdatedStateManager(), new OperationCanceledManager());
	document.set(before);
	return document;
}
 
Example #4
Source File: TokenSequencePreservingPartialParsingHelper.java    From xtext-extras with Eclipse Public License 2.0 5 votes vote down vote up
protected boolean isSameTokenSequence(String originalText, String newText, int expectedLength) {
	Lexer originalLexer = lexerProvider.get();
	Lexer newLexer = lexerProvider.get();
	originalLexer.setCharStream(new ANTLRStringStream(originalText));
	newLexer.setCharStream(new ANTLRStringStream(newText));
	return isSameTokenSequence(originalLexer, newLexer, expectedLength);
}
 
Example #5
Source File: AbstractSequencerTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends Lexer> bindLexer() {
	return InternalSequencerTestLanguageLexer.class;
}
 
Example #6
Source File: AbstractEcore2XtextTestRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends Lexer> bindLexer() {
	return InternalEcore2XtextTestLexer.class;
}
 
Example #7
Source File: AbstractBug288760TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalBug288760TestLanguageLexer.class);
}
 
Example #8
Source File: AbstractMyDslRuntimeModule.java    From M2Doc with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends Lexer> bindLexer() {
	return InternalMyDslLexer.class;
}
 
Example #9
Source File: AbstractBug362902RuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalBug362902Lexer.class);
}
 
Example #10
Source File: AbstractXtextGrammarTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalXtextGrammarTestLanguageLexer.class);
}
 
Example #11
Source File: AbstractBug309949TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends Lexer> bindLexer() {
	return InternalBug309949TestLanguageLexer.class;
}
 
Example #12
Source File: AbstractBug348427TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalBug348427TestLanguageLexer.class);
}
 
Example #13
Source File: AbstractRefactoringTestLanguage2RuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends Lexer> bindLexer() {
	return InternalRefactoringTestLanguage2Lexer.class;
}
 
Example #14
Source File: AbstractBacktrackingContentAssistTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends Lexer> bindLexer() {
	return InternalBacktrackingContentAssistTestLanguageLexer.class;
}
 
Example #15
Source File: AbstractEnumRulesUiTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalEnumRulesUiTestLanguageLexer.class);
}
 
Example #16
Source File: AbstractDomainmodelRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends Lexer> bindLexer() {
	return InternalDomainmodelLexer.class;
}
 
Example #17
Source File: AbstractOutlineTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalOutlineTestLanguageLexer.class);
}
 
Example #18
Source File: AbstractStatemachineRuntimeModule.java    From xtext-web with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalStatemachineLexer.class);
}
 
Example #19
Source File: AbstractBug303200TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends Lexer> bindLexer() {
	return InternalBug303200TestLanguageLexer.class;
}
 
Example #20
Source File: AbstractBug286935TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends Lexer> bindLexer() {
	return InternalBug286935TestLanguageLexer.class;
}
 
Example #21
Source File: AbstractTerminalRulesTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalTerminalRulesTestLanguageLexer.class);
}
 
Example #22
Source File: AbstractRegionAccessTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalRegionAccessTestLanguageLexer.class);
}
 
Example #23
Source File: AbstractFragmentTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalFragmentTestLanguageLexer.class);
}
 
Example #24
Source File: AbstractEcoreFragmentTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends Lexer> bindLexer() {
	return InternalEcoreFragmentTestLanguageLexer.class;
}
 
Example #25
Source File: AbstractIndentationAwareTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalIndentationAwareTestLanguageLexer.class);
}
 
Example #26
Source File: AbstractBug287941TestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalBug287941TestLanguageLexer.class);
}
 
Example #27
Source File: AbstractSmokeTest.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Lexer get() {
	return new InternalXtendLexer(null);
}
 
Example #28
Source File: AbstractTwoContextsTestLanguageRuntimeModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public void configureRuntimeLexer(Binder binder) {
	binder.bind(Lexer.class)
		.annotatedWith(Names.named(LexerBindings.RUNTIME))
		.to(InternalTwoContextsTestLanguageLexer.class);
}
 
Example #29
Source File: AbstractSyntacticSequencerTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends Lexer> bindLexer() {
	return InternalSyntacticSequencerTestLanguageLexer.class;
}
 
Example #30
Source File: AbstractEncodingTestLanguageRuntimeModule.java    From xtext-core with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends Lexer> bindLexer() {
	return InternalEncodingTestLanguageLexer.class;
}