%{
-#include "parse.h"
+#include <glib.h>
#ifdef HAVE_STDIO_H
# include <stdio.h>
#endif
+%}
+
+%union ParseToken {
+ float real;
+ int integer;
+ char *string;
+ char *identifier;
+ gboolean bool;
+ char character;
+}
+
+%{
+#include "parse.h"
+
extern int yylex();
+/*extern int yyparse();*/
+/*void yyerror(char *err);*/
extern int yylineno;
extern FILE *yyin;
void parse_set_section(char *section);
%}
-%union ParseToken {
- float real;
- int integer;
- char *string;
- char *identifier;
- gboolean bool;
- char character;
-}
-
%token <real> REAL
%token <integer> INTEGER
%token <string> STRING
;
lines:
- | lines tokens '\n' { t.character = $3; parse_token(TOKEN_NEWLINE, t); }
+ | lines tokens '\n' { t.character = $3; parse_token($3, t); }
;
tokens:
;
token:
- REAL { t.real = $1; parse_token(TOKEN_REAL, t); }
- | INTEGER { t.integer = $1; parse_token(TOKEN_INTEGER, t); }
- | STRING { t.string = $1; parse_token(TOKEN_STRING, t); }
- | IDENTIFIER { t.identifier = $1; parse_token(TOKEN_IDENTIFIER, t); }
- | BOOL { t.bool = $1; parse_token(TOKEN_BOOL, t); }
- | '(' { t.character = $1; parse_token(TOKEN_LBRACKET, t); }
- | ')' { t.character = $1; parse_token(TOKEN_RBRACKET, t); }
- | '{' { t.character = $1; parse_token(TOKEN_LBRACE, t); }
- | '}' { t.character = $1; parse_token(TOKEN_RBRACE, t); }
- | '=' { t.character = $1; parse_token(TOKEN_EQUALS, t); }
- | ',' { t.character = $1; parse_token(TOKEN_COMMA, t); }
+ REAL { t.real = $1; parse_token(REAL, t); }
+ | INTEGER { t.integer = $1; parse_token(INTEGER, t); }
+ | STRING { t.string = $1; parse_token(STRING, t); }
+ | IDENTIFIER { t.identifier = $1; parse_token(IDENTIFIER, t); }
+ | BOOL { t.bool = $1; parse_token(BOOL, t); }
+ | '(' { t.character = $1; parse_token($1, t); }
+ | ')' { t.character = $1; parse_token($1, t); }
+ | '{' { t.character = $1; parse_token($1, t); }
+ | '}' { t.character = $1; parse_token($1, t); }
+ | '=' { t.character = $1; parse_token($1, t); }
+ | ',' { t.character = $1; parse_token($1, t); }
;
%%