diff options
author | David Gibson <dgibson@sneetch.(none)> | 2005-06-16 14:36:37 +1000 |
---|---|---|
committer | David Gibson <dgibson@sneetch.(none)> | 2005-06-16 14:36:37 +1000 |
commit | 4102d840d993e7cce7d5c5aea8ef696dc81236fc (patch) | |
tree | ab70f0a9e968780ed282f1bbd8d7ea1be3db5b6b /dtc-lexer.l | |
parent | fc14dad7692d84d5f0f547fd0456b3f98526b6cc (diff) | |
download | dtc-4102d840d993e7cce7d5c5aea8ef696dc81236fc.tar.gz |
Initial label support. Also switch to glr-parser mode and get rid of
hacks that were necessary without it.
Diffstat (limited to 'dtc-lexer.l')
-rw-r--r-- | dtc-lexer.l | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/dtc-lexer.l b/dtc-lexer.l index 02283a9..4819e54 100644 --- a/dtc-lexer.l +++ b/dtc-lexer.l @@ -32,9 +32,9 @@ WS [ \t\n] %{ #include "dtc.h" -#include "y.tab.h" +#include "dtc-parser.tab.h" -#undef LEXDEBUG 1 +/*#define LEXDEBUG 1 */ %} @@ -83,7 +83,15 @@ WS [ \t\n] return ']'; } -{PROPCHAR}+(@{UNITCHAR}+)?/{WS}*\{ { +{PROPCHAR}+ { +#ifdef LEXDEBUG + fprintf(stderr, "PropName: %s\n", yytext); +#endif + yylval.str = strdup(yytext); + return DT_PROPNAME; + } + +{PROPCHAR}+(@{UNITCHAR}+)? { #ifdef LEXDEBUG fprintf(stderr, "NodeName: %s\n", yytext); #endif @@ -91,15 +99,16 @@ WS [ \t\n] return DT_NODENAME; } -{PROPCHAR}+ { + +[a-zA-Z_][a-zA-Z0-9_]*: { #ifdef LEXDEBUG - fprintf(stderr, "PropName: %s\n", yytext); + fprintf(stderr, "Label: %s\n", yytext); #endif yylval.str = strdup(yytext); - return DT_PROPNAME; + yylval.str[yyleng-1] = '\0'; + return DT_LABEL; } - <*>{WS}+ /* eat whitespace */ <*>"/*"([^*]|\*+[^*/])*\*+"/" { |