From 2571415d1a7eec72db33cd521ca48fe755c43f9c Mon Sep 17 00:00:00 2001 From: Carl Worth Date: Tue, 1 Jun 2010 12:18:43 -0700 Subject: Implement comment handling in the lexer (with test). We support both single-line (//) and multi-line (/* ... */) comments and add a test for this, (trying to stress the rules just a bit by embedding one comment delimiter into a comment delimited with the other style, etc.). To keep the test suite passing we do now discard any output lines from glcpp that consist only of spacing, (in addition to blank lines as previously). We also discard any initial whitespace from gcc output. In neither case should the absence or presence of this whitespace affect correctness. --- tests/glcpp-test | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests/glcpp-test') diff --git a/tests/glcpp-test b/tests/glcpp-test index ba398af0d5..24110333a5 100755 --- a/tests/glcpp-test +++ b/tests/glcpp-test @@ -3,8 +3,8 @@ for test in *.c; do echo "Testing $test" ../glcpp < $test > $test.glcpp - grep -v '^$' < $test.glcpp > $test.out || true + grep -v '^ *$' < $test.glcpp > $test.out || true gcc -E $test -o $test.gcc - grep -v '^#' < $test.gcc | grep -v '^$' > $test.expected || true + grep -v '^#' < $test.gcc | grep -v '^$' | sed -r -e 's/^ +/ /' > $test.expected || true diff -u $test.expected $test.out done -- cgit v1.2.3