glcpp: Add support for lexing from a string.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 16 Jun 2010 19:01:17 +0000 (12:01 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Mon, 21 Jun 2010 18:25:50 +0000 (11:25 -0700)
The standalone binary still reads from stdin, however.

glcpp/glcpp-lex.l
glcpp/glcpp.h

index cc5f28f8f869b590b65694d051f6b96b1ce45303..f736ac4d59d5efe47fa260ed42231d791166e2db 100644 (file)
@@ -201,3 +201,9 @@ NON_STARS_THEN_STARS        [^*]*[*]+
 }
 
 %%
+
+void
+glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader)
+{
+       yy_scan_string(shader, parser->scanner);
+}
index ac103b7fb835c125d8734cdb8c30cb3b438a3a3a..0d43f0b69e12e96e8f6369e8b76b2a9ee4aaa669 100644 (file)
@@ -159,6 +159,9 @@ glcpp_parser_destroy (glcpp_parser_t *parser);
 int
 glcpp_lex_init_extra (glcpp_parser_t *parser, yyscan_t* scanner);
 
+void
+glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader);
+
 int
 glcpp_lex (yyscan_t scanner);