From 828686d4ebe055d1c6583192bc57742e101ff931 Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Fri, 20 Jun 2014 14:58:48 -0700 Subject: glsl/glcpp: Drop extra, final newline from most output The glcpp parser is line-based, so it needs to see a NEWLINE token at the end of each line. This causes a trick for files that end without a final newline. Previously, the lexer for glcpp punted in this case by unconditionally returning a NEWLINE token at end-of-file, (causing most files to have an extra blank line at the end). Here, we refine this by lexing end-of-file as a NEWLINE token only if the immediately preceding token was not a NEWLINE token. The patch is a minor change that only looks huge for two reasons: 1. Almost all glcpp test result ".expected" files are updated to drop the extra newline. 2. All return statements from the lexer are adjusted to use a new RETURN_TOKEN macro that tracks the last-token-was-a-newline state. Reviewed-by: Jordan Justen --- src/glsl/glcpp/tests/047-if-elif-else.c.expected | 1 - 1 file changed, 1 deletion(-) (limited to 'src/glsl/glcpp/tests/047-if-elif-else.c.expected') diff --git a/src/glsl/glcpp/tests/047-if-elif-else.c.expected b/src/glsl/glcpp/tests/047-if-elif-else.c.expected index e5b53a3fa59..54d30861197 100644 --- a/src/glsl/glcpp/tests/047-if-elif-else.c.expected +++ b/src/glsl/glcpp/tests/047-if-elif-else.c.expected @@ -9,4 +9,3 @@ success_1 success_2 success_3 - -- cgit v1.2.3