# HG changeset patch # User johnsen@johnsen-desktop # Date 1208509666 -7200 # Node ID c09464468e1d6d3d69f179249a60fbdd42f7e4ce # Parent c893a4f0954d1934cf8d0c0aebcec72106039ee2 Updated lexer with comment handling to run Comments test at succes rate diff -r c893a4f0954d -r c09464468e1d lexer/Lexer.d --- a/lexer/Lexer.d Fri Apr 18 11:03:17 2008 +0200 +++ b/lexer/Lexer.d Fri Apr 18 11:07:46 2008 +0200 @@ -103,6 +103,7 @@ return Token(Tok.EOF, Location(position, this.source), 0); case '*': + position += 2; while(getNextChar != CharType.EOF) { ++position; @@ -113,12 +114,27 @@ return Token(Tok.EOF, Location(position, this.source), 0); case '+': + position += 2; + int nesting = 1; while(getNextChar != CharType.EOF) { ++position; if(source.data[position-2] == '+') if(source.data[position-1] == '/') - return this.next; + { + position++; + nesting--; + } + + if(source.data[position-2] == '/') + if(source.data[position-1] == '+') + { + nesting++; + position++; + } + + if(nesting == 0) + return this.next; } return Token(Tok.EOF, Location(position, this.source), 0);