コード例 #1
0
        public virtual List <string> Candidates(int char_index)
        {
            Workspaces.Document item = Item;
            string ffn             = item.FullPath;
            IGrammarDescription gd = GrammarDescriptionFactory.Create(ffn);

            if (gd == null)
            {
                throw new Exception();
            }

            string code = Code.Substring(0, char_index);

            gd.Parse(code, out CommonTokenStream tok_stream, out Parser parser, out Lexer lexer, out IParseTree pt);
            LASets        la_sets = new LASets();
            IntervalSet   int_set = la_sets.Compute(parser, tok_stream);
            List <string> result  = new List <string>();

            foreach (int r in int_set.ToList())
            {
                string rule_name = Lexer.RuleNames[r];
                result.Add(rule_name);
            }
            return(result);
        }
コード例 #2
0
ファイル: ParserDetails.cs プロジェクト: wilsonk/AntlrVSIX
        public virtual List <string> Candidates(int index)
        {
            var item = Item;
            var ffn  = item.FullPath;
            IGrammarDescription gd = GrammarDescriptionFactory.Create(ffn);

            if (gd == null)
            {
                throw new Exception();
            }
            string code = this.Code.Substring(0, index);

            gd.Parse(code, out CommonTokenStream tok_stream, out Parser parser, out Lexer lexer, out IParseTree pt);
            LASets la_sets = new LASets();
            var    result  = la_sets.Compute(parser, tok_stream);

            return(null);
        }