Пример #1
0
        public Antlr4EditorNavigationSource([NotNull] Antlr4EditorNavigationSourceProvider provider, [NotNull] ITextBuffer textBuffer)
        {
            Requires.NotNull(provider, nameof(provider));
            Requires.NotNull(textBuffer, nameof(textBuffer));

            _provider   = provider;
            _textBuffer = textBuffer;

            _parserRuleNavigationType = provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.ParserRule);
            _lexerRuleNavigationType  = provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.LexerRule);

            string assemblyName = typeof(Antlr4EditorNavigationSource).Assembly.GetName().Name;

            _lexerRuleGlyph  = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/lexericon.png", assemblyName)));
            _parserRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/parsericon.png", assemblyName)));

            _backgroundParser = (Antlr4BackgroundParser)provider.BackgroundParserFactoryService.GetBackgroundParser(textBuffer);
            _backgroundParser.ParseComplete += HandleBackgroundParseComplete;
            _backgroundParser.RequestParse(false);

            var lastParseResult = _backgroundParser.LastResult;

            if (lastParseResult != null)
            {
                UpdateNavigationTargets(lastParseResult);
            }
        }
Пример #2
0
        public Antlr4ReferenceAnchorPoints(Antlr4ReferenceAnchorPointsProvider provider, ITextBuffer textBuffer)
        {
            _provider   = provider;
            _textBuffer = textBuffer;

            _backgroundParser = (Antlr4BackgroundParser)provider.BackgroundParserFactoryService.GetBackgroundParser(textBuffer);
            _backgroundParser.ParseComplete += HandleParseComplete;
        }
        public Antlr4ReferenceAnchorPoints(Antlr4ReferenceAnchorPointsProvider provider, ITextBuffer textBuffer)
        {
            _provider = provider;
            _textBuffer = textBuffer;

            _backgroundParser = (Antlr4BackgroundParser)provider.BackgroundParserFactoryService.GetBackgroundParser(textBuffer);
            _backgroundParser.ParseComplete += HandleParseComplete;
        }
Пример #4
0
        public Antlr4CompletionSource(ITextBuffer textBuffer, Antlr4CompletionSourceProvider provider, Antlr4BackgroundParser backgroundParser)
            : base(textBuffer, provider, Antlr4Constants.Antlr4LanguageGuid)
        {
            BackgroundParser = backgroundParser;
            var shell   = Provider.GlobalServiceProvider.GetShell();
            var package = shell.LoadPackage <AntlrLanguagePackage>();

            _intellisenseOptions = package.IntellisenseOptions;
        }
        public Antlr4IntellisenseController(ITextView textView, Antlr4IntellisenseControllerProvider provider, Antlr4BackgroundParser backgroundParser)
            : base(textView, provider)
        {
            BackgroundParser = backgroundParser;
            ClassificationTagAggregator = provider.AggregatorFactory.CreateTagAggregator<ClassificationTag>(textView.TextBuffer);

            var shell = Provider.GlobalServiceProvider.GetShell();
            var package = shell.LoadPackage<AntlrLanguagePackage>();
            _intellisenseOptions = package.IntellisenseOptions;
        }
Пример #6
0
        public Antlr4IntellisenseController(ITextView textView, Antlr4IntellisenseControllerProvider provider, Antlr4BackgroundParser backgroundParser)
            : base(textView, provider)
        {
            BackgroundParser            = backgroundParser;
            ClassificationTagAggregator = provider.AggregatorFactory.CreateTagAggregator <ClassificationTag>(textView.TextBuffer);

            var shell   = Provider.GlobalServiceProvider.GetShell();
            var package = shell.LoadPackage <AntlrLanguagePackage>();

            _intellisenseOptions = package.IntellisenseOptions;
        }
Пример #7
0
        public Antlr4OutliningTagger(Antlr4OutliningTaggerProvider provider, ITextBuffer textBuffer)
        {
            Contract.Requires <ArgumentNullException>(provider != null, "provider");
            Contract.Requires <ArgumentNullException>(textBuffer != null, "textBuffer");

            _provider   = provider;
            _textBuffer = textBuffer;

            _backgroundParser = (Antlr4BackgroundParser)provider.BackgroundParserFactoryService.GetBackgroundParser(textBuffer);
            _backgroundParser.ParseComplete += HandleBackgroundParseComplete;
            _backgroundParser.RequestParse(false);
        }
Пример #8
0
        public Antlr4OutliningTagger([NotNull] Antlr4OutliningTaggerProvider provider, [NotNull] ITextBuffer textBuffer)
        {
            Requires.NotNull(provider, nameof(provider));
            Requires.NotNull(textBuffer, nameof(textBuffer));

            _provider   = provider;
            _textBuffer = textBuffer;

            _backgroundParser = (Antlr4BackgroundParser)provider.BackgroundParserFactoryService.GetBackgroundParser(textBuffer);
            _backgroundParser.ParseComplete += HandleBackgroundParseComplete;
            _backgroundParser.RequestParse(false);
        }
Пример #9
0
        public Antlr4OutliningTagger(ITextBuffer textBuffer, Antlr4BackgroundParser backgroundParser, Antlr4OutliningTaggerProvider provider)
        {
            Contract.Requires <ArgumentNullException>(textBuffer != null, "textBuffer");
            Contract.Requires <ArgumentNullException>(backgroundParser != null, "backgroundParser");
            Contract.Requires <ArgumentNullException>(provider != null, "provider");

            this.TextBuffer       = textBuffer;
            this.BackgroundParser = backgroundParser;
            this._provider        = provider;

            this.BackgroundParser.ParseComplete += HandleBackgroundParseComplete;
            this.BackgroundParser.RequestParse(false);
        }
Пример #10
0
        private IList <IAnchor> CreateReferenceAnchorPoints(ITextSnapshot snapshot, GrammarParser.GrammarSpecContext parseResult)
        {
            if (parseResult == null)
            {
                AntlrParseResultEventArgs resultEventArgs = Antlr4BackgroundParser.ParseSnapshot(snapshot);
                parseResult = (GrammarParser.GrammarSpecContext)resultEventArgs.Result;
            }

            AnchorListener listener = new AnchorListener(snapshot);

            ParseTreeWalker.Default.Walk(listener, parseResult);
            return(listener.Anchors);
        }
        public Antlr4EditorNavigationSource(Antlr4EditorNavigationSourceProvider provider, ITextBuffer textBuffer)
        {
            Contract.Requires<ArgumentNullException>(provider != null, "provider");
            Contract.Requires<ArgumentNullException>(textBuffer != null, "textBuffer");

            _provider = provider;
            _textBuffer = textBuffer;

            _parserRuleNavigationType = provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.ParserRule);
            _lexerRuleNavigationType = provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.LexerRule);

            string assemblyName = typeof(Antlr4EditorNavigationSource).Assembly.GetName().Name;
            _lexerRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/lexericon.png", assemblyName)));
            _parserRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/parsericon.png", assemblyName)));

            _backgroundParser = (Antlr4BackgroundParser)provider.BackgroundParserFactoryService.GetBackgroundParser(textBuffer);
            _backgroundParser.ParseComplete += HandleBackgroundParseComplete;
            _backgroundParser.RequestParse(false);
        }
Пример #12
0
        public Antlr4EditorNavigationSource(Antlr4EditorNavigationSourceProvider provider, ITextBuffer textBuffer)
        {
            Contract.Requires <ArgumentNullException>(provider != null, "provider");
            Contract.Requires <ArgumentNullException>(textBuffer != null, "textBuffer");

            _provider   = provider;
            _textBuffer = textBuffer;

            _parserRuleNavigationType = provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.ParserRule);
            _lexerRuleNavigationType  = provider.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.LexerRule);

            string assemblyName = typeof(Antlr4EditorNavigationSource).Assembly.GetName().Name;

            _lexerRuleGlyph  = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/lexericon.png", assemblyName)));
            _parserRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/parsericon.png", assemblyName)));

            _backgroundParser = (Antlr4BackgroundParser)provider.BackgroundParserFactoryService.GetBackgroundParser(textBuffer);
            _backgroundParser.ParseComplete += HandleBackgroundParseComplete;
            _backgroundParser.RequestParse(false);
        }
Пример #13
0
        public Antlr4EditorNavigationSource(ITextBuffer textBuffer, Antlr4BackgroundParser backgroundParser, IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService)
        {
            Contract.Requires <ArgumentNullException>(textBuffer != null, "textBuffer");
            Contract.Requires <ArgumentNullException>(backgroundParser != null, "backgroundParser");
            Contract.Requires <ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService");

            this.TextBuffer       = textBuffer;
            this.BackgroundParser = backgroundParser;
            this.EditorNavigationTypeRegistryService = editorNavigationTypeRegistryService;

            this._parserRuleNavigationType = this.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.ParserRule);
            this._lexerRuleNavigationType  = this.EditorNavigationTypeRegistryService.GetEditorNavigationType(AntlrEditorNavigationTypeNames.LexerRule);

            string assemblyName = typeof(Antlr4EditorNavigationSource).Assembly.GetName().Name;

            this._lexerRuleGlyph  = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/lexericon.png", assemblyName)));
            this._parserRuleGlyph = new BitmapImage(new Uri(string.Format("pack://application:,,,/{0};component/Resources/parsericon.png", assemblyName)));

            this.BackgroundParser.ParseComplete += HandleBackgroundParseComplete;
            this.BackgroundParser.RequestParse(false);
        }
 public Antlr4QuickInfoSource(ITextBuffer textBuffer, Antlr4BackgroundParser backgroundParser, ITagAggregator<ClassificationTag> aggregator)
 {
     this.Aggregator = aggregator;
     this.BackgroundParser = backgroundParser;
     this.TextBuffer = textBuffer;
 }
Пример #15
0
 public Antlr4QuickInfoSource(ITextBuffer textBuffer, Antlr4BackgroundParser backgroundParser, ITagAggregator <ClassificationTag> aggregator)
 {
     this.Aggregator       = aggregator;
     this.BackgroundParser = backgroundParser;
     this.TextBuffer       = textBuffer;
 }