public Lexer(Stellarmass.LPC.Scanner.Scanner scannedData) { int lineCount = 0; int tokenCount = 0; GreedyLexmePair greedy = new GreedyLexmePair(); List <Lexme> tempTokensList = new List <Lexme>(); foreach (Scanner.CodeLine line in scannedData.Lines) { foreach (Scanner.Token scanned in line.Tokens) { try{ Lexme lexme = new Lexme(); lexme.Data = scanned.Data; lexme.Type = IdentifyType(scanned, lineCount + 1, greedy); //this will automatically combine lexme with any previous lexmes if they are supposed to //be grouped together as a string or comment greedy.CombineGroupedTokens(lexme, tempTokensList, lineCount + 1); } catch (LexerException e) { throw new LexerException(e.Message, lineCount); } tokenCount++; } //end foreach //OLD POSITION lineCount++; tokenCount = 0; } //NEW POSITION //just in case the line ended before we could finish the token list if (greedy.FlushGroup() != null) { tempTokensList.AddRange(greedy.FlushGroup()); } Lines.Add(new Line(tempTokensList, Lines.Count)); }