glcpp: Build a reentrant parser.
diff --git a/glcpp/glcpp-lex.l b/glcpp/glcpp-lex.l
index 933d9f4..06bde3f 100644
--- a/glcpp/glcpp-lex.l
+++ b/glcpp/glcpp-lex.l
@@ -29,7 +29,7 @@
 #include "glcpp-parse.h"
 %}
 
-%option reentrant noyywrap
+%option bison-bridge reentrant noyywrap
 %option extra-type="glcpp_parser_t *"
 %option prefix="glcpp_"
 
@@ -66,7 +66,7 @@
 	/* glcpp doesn't handle #extension, #version, or #pragma directives.
 	 * Simply pass them through to the main compiler's lexer/parser. */
 {HASH}(extension|version|pragma).*\n {
-	yylval.str = xtalloc_strdup (yyextra, yytext);
+	yylval->str = xtalloc_strdup (yyextra, yytext);
 	return OTHER;
 }
 
@@ -130,17 +130,17 @@
 }
 
 {DECIMAL_INTEGER} {
-	yylval.str = xtalloc_strdup (yyextra, yytext);
+	yylval->str = xtalloc_strdup (yyextra, yytext);
 	return INTEGER_STRING;
 }
 
 {OCTAL_INTEGER} {
-	yylval.str = xtalloc_strdup (yyextra, yytext);
+	yylval->str = xtalloc_strdup (yyextra, yytext);
 	return INTEGER_STRING;
 }
 
 {HEXADECIMAL_INTEGER} {
-	yylval.str = xtalloc_strdup (yyextra, yytext);
+	yylval->str = xtalloc_strdup (yyextra, yytext);
 	return INTEGER_STRING;
 }
 
@@ -185,7 +185,7 @@
 }
 
 {IDENTIFIER} {
-	yylval.str = xtalloc_strdup (yyextra, yytext);
+	yylval->str = xtalloc_strdup (yyextra, yytext);
 	return IDENTIFIER;
 }
 
@@ -194,7 +194,7 @@
 }
 
 {OTHER}+ {
-	yylval.str = xtalloc_strdup (yyextra, yytext);
+	yylval->str = xtalloc_strdup (yyextra, yytext);
 	return OTHER;
 }
 
diff --git a/glcpp/glcpp-parse.y b/glcpp/glcpp-parse.y
index fde9b92..8119de3 100644
--- a/glcpp/glcpp-parse.y
+++ b/glcpp/glcpp-parse.y
@@ -133,13 +133,15 @@
 #define yylex glcpp_parser_lex
 
 static int
-glcpp_parser_lex (glcpp_parser_t *parser);
+glcpp_parser_lex (YYSTYPE *yylval, glcpp_parser_t *parser);
 
 static void
 glcpp_parser_lex_from (glcpp_parser_t *parser, token_list_t *list);
 
 %}
 
+%pure-parser
+
 %parse-param {glcpp_parser_t *parser}
 %lex-param {glcpp_parser_t *parser}
 
@@ -1449,13 +1451,13 @@
 }
 
 static int
-glcpp_parser_lex (glcpp_parser_t *parser)
+glcpp_parser_lex (YYSTYPE *yylval, glcpp_parser_t *parser)
 {
 	token_node_t *node;
 	int ret;
 
 	if (parser->lex_from_list == NULL) {
-		ret = glcpp_lex (parser->scanner);
+		ret = glcpp_lex (yylval, parser->scanner);
 
 		/* XXX: This ugly block of code exists for the sole
 		 * purpose of converting a NEWLINE token into a SPACE
@@ -1501,7 +1503,7 @@
 		{
 			macro_t *macro;
 			macro = hash_table_find (parser->defines,
-						 yylval.str);
+						 yylval->str);
 			if (macro && macro->is_function) {
 				parser->newline_as_space = 1;
 				parser->paren_count = 0;
@@ -1519,7 +1521,7 @@
 		return NEWLINE;
 	}
 
-	yylval = node->token->value;
+	*yylval = node->token->value;
 	ret = node->token->type;
 
 	parser->lex_from_node = node->next;
diff --git a/glcpp/glcpp.h b/glcpp/glcpp.h
index 0d43f0b..3441ab8 100644
--- a/glcpp/glcpp.h
+++ b/glcpp/glcpp.h
@@ -163,7 +163,7 @@
 glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader);
 
 int
-glcpp_lex (yyscan_t scanner);
+glcpp_lex (YYSTYPE *lvalp, yyscan_t scanner);
 
 int
 glcpp_lex_destroy (yyscan_t scanner);