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); }
public virtual void Parse() { Workspaces.Document item = Item; string code = item.Code; string ffn = item.FullPath; bool has_changed = item.Changed; item.Changed = false; if (!has_changed) { return; } IGrammarDescription gd = GrammarDescriptionFactory.Create(ffn); if (gd == null) { throw new Exception(); } gd.Parse(this); AllNodes = DFSVisitor.DFS(ParseTree as ParserRuleContext); Comments = gd.ExtractComments(code); Defs = new Dictionary <TerminalNodeImpl, int>(); Refs = new Dictionary <TerminalNodeImpl, int>(); Tags = new Dictionary <TerminalNodeImpl, int>(); Errors = new HashSet <IParseTree>(); Imports = new HashSet <string>(); Attributes = new Dictionary <IParseTree, IList <CombinedScopeSymbol> >(); Cleanup(); }
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); }