#include "glcpp-parse.h"
%}
-%option reentrant noyywrap
+%option bison-bridge reentrant noyywrap
%option extra-type="glcpp_parser_t *"
%option prefix="glcpp_"
/* 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;
}
}
{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;
}
}
{IDENTIFIER} {
- yylval.str = xtalloc_strdup (yyextra, yytext);
+ yylval->str = xtalloc_strdup (yyextra, yytext);
return IDENTIFIER;
}
}
{OTHER}+ {
- yylval.str = xtalloc_strdup (yyextra, yytext);
+ yylval->str = xtalloc_strdup (yyextra, yytext);
return OTHER;
}
#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}
}
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
{
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;
return NEWLINE;
}
- yylval = node->token->value;
+ *yylval = node->token->value;
ret = node->token->type;
parser->lex_from_node = node->next;
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);