Scanning: 1) rationalize end-of-input everywhere, 2) prevent infinite loop at end-of-input, 3) use positive chars.
Fixes issue #25. (char 255 aliased to -1 and missing tests for end of input).
1) All layers of input scanning now share a single EndOfInput value.
This avoids translation of it across layers of encapsulation.
2) Some places looking for end of line were not stopping on EndOfInput.
3) Use of "char" for the input made char values > 127 be negative numbers.
This allowed for aliasing of 255 to -1, etc. This is fixed by using
unsigned char.
diff --git a/Test/badChars.frag b/Test/badChars.frag
new file mode 100644
index 0000000..d67bf3a
--- /dev/null
+++ b/Test/badChars.frag
@@ -0,0 +1,6 @@
+#ifþ
+#endif
+#error AÿB
+#if
+#endif
+int aÿ
diff --git a/Test/baseResults/badChars.frag.out b/Test/baseResults/badChars.frag.out
new file mode 100644
index 0000000..e3ab945
--- /dev/null
+++ b/Test/baseResults/badChars.frag.out
@@ -0,0 +1,26 @@
+badChars.frag
+ERROR: 0:1: 'preprocessor evaluation' : bad expression
+ERROR: 0:1: '#if' : unexpected tokens following directive
+ERROR: 0:3: '#error' : A <bad token> B
+ERROR: 0:4: 'preprocessor evaluation' : bad expression
+ERROR: 0:4: '#if' : unexpected tokens following directive
+ERROR: 0:6: 'ÿ' : unexpected token
+ERROR: 0:7: '' : syntax error
+ERROR: 7 compilation errors. No code generated.
+
+
+Shader version: 100
+ERROR: node is still EOpNull!
+0:? Linker Objects
+0:? 'a' (global mediump int)
+
+
+Linked fragment stage:
+
+ERROR: Linking fragment stage: Missing entry point: Each stage requires one "void main()" entry point
+
+Shader version: 100
+ERROR: node is still EOpNull!
+0:? Linker Objects
+0:? 'a' (global mediump int)
+
diff --git a/Test/baseResults/cppComplexExpr.vert.out b/Test/baseResults/cppComplexExpr.vert.out
index 3d881d3..08dd936 100644
--- a/Test/baseResults/cppComplexExpr.vert.out
+++ b/Test/baseResults/cppComplexExpr.vert.out
@@ -5,19 +5,19 @@
ERROR: 0:81: 'preprocessor evaluation' : bad expression
ERROR: 0:81: '#if' : unexpected tokens following directive
ERROR: 0:82: '#error' : good macro
-ERROR: 0:87: 'macro expansion' : end of line in macro substitution: foobar
+ERROR: 0:87: 'macro expansion' : End of line in macro substitution: foobar
ERROR: 0:88: 'preprocessor evaluation' : can't evaluate expression
ERROR: 0:88: 'preprocessor evaluation' : bad expression
ERROR: 0:88: '#if' : unexpected tokens following directive
-ERROR: 0:92: 'macro expansion' : end of line in macro substitution: foobar
+ERROR: 0:92: 'macro expansion' : End of line in macro substitution: foobar
ERROR: 0:93: 'preprocessor evaluation' : can't evaluate expression
ERROR: 0:93: 'preprocessor evaluation' : bad expression
ERROR: 0:93: '#if' : unexpected tokens following directive
-ERROR: 0:99: 'macro expansion' : end of line in macro substitution: foobar
+ERROR: 0:99: 'macro expansion' : End of line in macro substitution: foobar
ERROR: 0:100: 'preprocessor evaluation' : can't evaluate expression
ERROR: 0:100: 'preprocessor evaluation' : bad expression
ERROR: 0:100: '#if' : unexpected tokens following directive
-ERROR: 0:101: 'macro expansion' : end of line in macro substitution: foobar
+ERROR: 0:101: 'macro expansion' : End of line in macro substitution: foobar
ERROR: 0:102: 'preprocessor evaluation' : can't evaluate expression
ERROR: 0:102: 'preprocessor evaluation' : bad expression
ERROR: 0:102: '#if' : unexpected tokens following directive
diff --git a/Test/baseResults/cppNest.vert.out b/Test/baseResults/cppNest.vert.out
index 4ddc7f3..f9534e4 100644
--- a/Test/baseResults/cppNest.vert.out
+++ b/Test/baseResults/cppNest.vert.out
@@ -3,7 +3,7 @@
ERROR: 0:152: '#else' : #else after #else
ERROR: 0:161: '#elif' : #elif after #else
ERROR: 0:169: '#else' : #else after #else
-ERROR: 0:177: 'macro expansion' : EOF in macro FUNC
+ERROR: 0:177: 'macro expansion' : End of input in macro FUNC
ERROR: 0:178: '' : syntax error
ERROR: 6 compilation errors. No code generated.
diff --git a/Test/baseResults/lineContinuation.vert.out b/Test/baseResults/lineContinuation.vert.out
index 5d9726c..b74c7a6 100644
--- a/Test/baseResults/lineContinuation.vert.out
+++ b/Test/baseResults/lineContinuation.vert.out
@@ -13,10 +13,10 @@
ERROR: 0:50: '@' : unexpected token
ERROR: 0:55: '#error' : good continuation
WARNING: 0:62: 'line continuation' : used at end of comment; the following line is still part of the comment
-ERROR: 0:111: 'macro expansion' : end of line in macro substitution: FOOM
+ERROR: 0:111: 'macro expansion' : End of line in macro substitution: FOOM
ERROR: 0:112: 'preprocessor evaluation' : can't evaluate expression
ERROR: 0:112: '#if' : unexpected tokens following directive
-ERROR: 0:117: 'macro expansion' : end of line in macro substitution: FOOM
+ERROR: 0:117: 'macro expansion' : End of line in macro substitution: FOOM
ERROR: 0:118: 'preprocessor evaluation' : can't evaluate expression
ERROR: 0:118: '#if' : unexpected tokens following directive
ERROR: 0:150: '' : syntax error
diff --git a/Test/testlist b/Test/testlist
index 0e619a3..797dca2 100644
--- a/Test/testlist
+++ b/Test/testlist
@@ -25,6 +25,7 @@
cppIndent.vert
cppNest.vert
cppComplexExpr.vert
+badChars.frag
pointCoord.frag
array.frag
array100.frag