public static List <Tuple <ITree, string, IToken[]> > ParseAcnInputFiles(IEnumerable <string> inputFiles) { var parsedInputFiles = new List <Tuple <ITree, string, IToken[]> >(); foreach (var inFileName in inputFiles) { ICharStream input = new ANTLRFileStream(inFileName); acnLexer lexer = new acnLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); List <IToken> tokenslst = new List <IToken>(); foreach (IToken token in tokens.GetTokens()) { tokenslst.Add(token); } acnParser parser = new acnParser(tokens); acnParser.moduleDefinitions_return result = parser.moduleDefinitions(); ITree tree = (CommonTree)result.Tree; CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree); nodes.TokenStream = tokens; parsedInputFiles.Add(Tuple.Create(tree, inFileName, tokenslst.ToArray())); } return(parsedInputFiles); }
public static List<Tuple<ITree, string, IToken[]>> ParseAcnInputFiles(IEnumerable<string> inputFiles) { var parsedInputFiles = new List<Tuple<ITree, string, IToken[]>>(); foreach (var inFileName in inputFiles) { ICharStream input = new ANTLRFileStream(inFileName); acnLexer lexer = new acnLexer(input); CommonTokenStream tokens = new CommonTokenStream(lexer); List<IToken> tokenslst = new List<IToken>(); foreach (IToken token in tokens.GetTokens()) { tokenslst.Add(token); } acnParser parser = new acnParser(tokens); acnParser.moduleDefinitions_return result = parser.moduleDefinitions(); ITree tree = (CommonTree)result.Tree; CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree); nodes.TokenStream = tokens; parsedInputFiles.Add(Tuple.Create(tree, inFileName, tokenslst.ToArray())); } return parsedInputFiles; }