glcpp: Allow vertical tab and form feed characters in GLSL
authorCarl Worth <cworth@cworth.org>
Tue, 5 Aug 2014 23:33:03 +0000 (16:33 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 4 Jan 2017 22:40:48 +0000 (14:40 -0800)
Of course, these aren't really useful for anything, but the GLSL language
specification does allow them:

The source character set used for the OpenGL shading languages,
outside of comments, is a subset of UTF-8. It includes the following
characters:
...

White space: the space character, horizontal tab, vertical tab, form
feed, carriage-return, and line- feed.

[GLSL Language Specification 4.30.6, section 3.1]

So treat vertical tab ('\v' or ^K) and form-feed ('\f' or ^L) as horizontal
space characters.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/compiler/glsl/glcpp/glcpp-lex.l

index f4a687670108e97f663d3f13eeee4fb1d654aa88..381b97364a36ed2d7a2cfb214409a04a31bb16e9 100644 (file)
@@ -175,7 +175,7 @@ glcpp_lex_update_state_per_token (glcpp_parser_t *parser, int token)
 
 SPACE          [[:space:]]
 NONSPACE       [^[:space:]]
-HSPACE         [ \t]
+HSPACE         [ \t\v\f]
 HASH           #
 NEWLINE                (\r\n|\n\r|\r|\n)
 IDENTIFIER     [_a-zA-Z][_a-zA-Z0-9]*