From 77d0c2a44c72cef6fe23351cbe7b473cd3e9b9c5 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 30 Sep 2014 16:51:44 +0200 Subject: [PATCH] jscript: Moved skipping spaces to separated function. --- dlls/jscript/lex.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/dlls/jscript/lex.c b/dlls/jscript/lex.c index 8d8e2d9fd4f..5e0226a41e1 100644 --- a/dlls/jscript/lex.c +++ b/dlls/jscript/lex.c @@ -231,6 +231,16 @@ static BOOL skip_comment(parser_ctx_t *ctx) return TRUE; } +static BOOL skip_spaces(parser_ctx_t *ctx) +{ + while(ctx->ptr < ctx->end && isspaceW(*ctx->ptr)) { + if(is_endline(*ctx->ptr++)) + ctx->nl = TRUE; + } + + return ctx->ptr != ctx->end; +} + static BOOL unescape(WCHAR *str) { WCHAR *pd, *p, c; @@ -534,11 +544,7 @@ static BOOL parse_numeric_literal(parser_ctx_t *ctx, double *ret) static int next_token(parser_ctx_t *ctx, void *lval) { do { - while(ctx->ptr < ctx->end && isspaceW(*ctx->ptr)) { - if(is_endline(*ctx->ptr++)) - ctx->nl = TRUE; - } - if(ctx->ptr == ctx->end) + if(!skip_spaces(ctx)) return tEOF; }while(skip_comment(ctx) || skip_html_comment(ctx));