From d83518e2367354db2a58972e33a87ac162438c1b Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Wed, 15 Jan 2014 03:31:06 +0000 Subject: [PATCH] Speed up whitespace handling --- stdx/d/lexer.d | 5 +++-- stdx/lexer.d | 2 -- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/stdx/d/lexer.d b/stdx/d/lexer.d index 9eaeabd..f696714 100644 --- a/stdx/d/lexer.d +++ b/stdx/d/lexer.d @@ -581,8 +581,9 @@ public struct DLexer(R) break loop; } } while (!range.empty); - return Token(tok!"whitespace", cache.cacheGet(range.slice(mark)), line, - column, index); + string text = config.whitespaceBehavior == WhitespaceBehavior.skip + ? null : cache.cacheGet(range.slice(mark)); + return Token(tok!"whitespace", text, line, column, index); } Token lexNumber() pure nothrow diff --git a/stdx/lexer.d b/stdx/lexer.d index 0543638..9659afe 100644 --- a/stdx/lexer.d +++ b/stdx/lexer.d @@ -272,8 +272,6 @@ mixin template Lexer(R, IDType, Token, alias defaultTokenFunction, Token _front; } -debug = 1; - struct LexerRange(BufferType) if (isBuffer!BufferType) { this(BufferType r)