Search in sources :

Example 1 with XtendDocumentTokenSource

use of org.eclipse.xtend.ide.editor.model.XtendDocumentTokenSource in project xtext-xtend by eclipse.

the class DocumentRewriterTest method createDocument.

protected XtextDocument createDocument(final String content) throws Exception {
    XtextDocument _xblockexpression = null;
    {
        final IFile file = this._workbenchTestHelper.createFile("Foo", content);
        final Resource resource = this._workbenchTestHelper.getResourceSet().getResource(URI.createPlatformResourceURI(file.getFullPath().toString(), true), true);
        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 = () -> {
                InternalXtendLexer _internalXtendLexer = new InternalXtendLexer();
                return ((Lexer) _internalXtendLexer);
            };
            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(content);
        document.setInput(((XtextResource) resource));
        _xblockexpression = document;
    }
    return _xblockexpression;
}
Also used : AntlrTokenDefProvider(org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider) InternalXtendLexer(org.eclipse.xtend.core.parser.antlr.internal.InternalXtendLexer) Lexer(org.eclipse.xtext.parser.antlr.Lexer) IFile(org.eclipse.core.resources.IFile) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) XtextResource(org.eclipse.xtext.resource.XtextResource) Resource(org.eclipse.emf.ecore.resource.Resource) XtendDocumentTokenSource(org.eclipse.xtend.ide.editor.model.XtendDocumentTokenSource) XtextDocument(org.eclipse.xtext.ui.editor.model.XtextDocument) XtendAntlrTokenFileProvider(org.eclipse.xtend.core.parser.antlr.XtendAntlrTokenFileProvider) InternalXtendLexer(org.eclipse.xtend.core.parser.antlr.internal.InternalXtendLexer)

Example 2 with XtendDocumentTokenSource

use of org.eclipse.xtend.ide.editor.model.XtendDocumentTokenSource in project xtext-xtend by eclipse.

the class PresentationDamagerTest method createDocument.

@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;
}
Also used : AntlrTokenDefProvider(org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider) InternalXtendLexer(org.eclipse.xtend.core.parser.antlr.internal.InternalXtendLexer) Lexer(org.eclipse.xtext.parser.antlr.Lexer) Procedure1(org.eclipse.xtext.xbase.lib.Procedures.Procedure1) XtendDocumentTokenSource(org.eclipse.xtend.ide.editor.model.XtendDocumentTokenSource) XtextDocument(org.eclipse.xtext.ui.editor.model.XtextDocument) XtendAntlrTokenFileProvider(org.eclipse.xtend.core.parser.antlr.XtendAntlrTokenFileProvider)

Aggregations

XtendAntlrTokenFileProvider (org.eclipse.xtend.core.parser.antlr.XtendAntlrTokenFileProvider)2 InternalXtendLexer (org.eclipse.xtend.core.parser.antlr.internal.InternalXtendLexer)2 XtendDocumentTokenSource (org.eclipse.xtend.ide.editor.model.XtendDocumentTokenSource)2 AntlrTokenDefProvider (org.eclipse.xtext.parser.antlr.AntlrTokenDefProvider)2 Lexer (org.eclipse.xtext.parser.antlr.Lexer)2 XtextDocument (org.eclipse.xtext.ui.editor.model.XtextDocument)2 Procedure1 (org.eclipse.xtext.xbase.lib.Procedures.Procedure1)2 IFile (org.eclipse.core.resources.IFile)1 Resource (org.eclipse.emf.ecore.resource.Resource)1 XtextResource (org.eclipse.xtext.resource.XtextResource)1