diff options
author | Milton Miller <miltonm@bga.com> | 2007-07-07 01:18:50 -0500 |
---|---|---|
committer | Jon Loeliger <jdl@freescale.com> | 2007-07-07 10:10:12 -0500 |
commit | ac6a5e26b4f2239d77eb4aa25383466833949006 (patch) | |
tree | 392430a3e34ba45710112f63d4155bcdde5b7cf5 /dtc-lexer.l | |
parent | 46779e8f8e5a13388835e9251fb741396e2d7f13 (diff) | |
download | device-tree-compiler-ac6a5e26b4f2239d77eb4aa25383466833949006.tar.gz |
dtc: allow a label: in any dts context
Change the lexer to recognise a label in any context. Place
before other celldata and bytestrings to avoid the initial
characters being stolen by other matches.
A label is a character sequence starting with an alphabetic
or underscore optinally followed by the same plus digits and
terminating in a colon.
The included terminating colon will prevent matching hex numbers.
Signed-off-by: Milton Miller <miltonm@bga.com>
Diffstat (limited to 'dtc-lexer.l')
-rw-r--r-- | dtc-lexer.l | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/dtc-lexer.l b/dtc-lexer.l index 77ccd54..384f848 100644 --- a/dtc-lexer.l +++ b/dtc-lexer.l @@ -107,6 +107,16 @@ REFCHAR ({PROPCHAR}|{UNITCHAR}|[/@]) BEGIN(INITIAL); return ';'; } + +<*>[a-zA-Z_][a-zA-Z0-9_]*: { + yylloc.filenum = srcpos_filenum; + yylloc.first_line = yylineno; + DPRINT("Label: %s\n", yytext); + yylval.str = strdup(yytext); + yylval.str[yyleng-1] = '\0'; + return DT_LABEL; + } + <CELLDATA>[bodh]# { yylloc.filenum = srcpos_filenum; yylloc.first_line = yylineno; @@ -189,15 +199,6 @@ REFCHAR ({PROPCHAR}|{UNITCHAR}|[/@]) } -[a-zA-Z_][a-zA-Z0-9_]*: { - yylloc.filenum = srcpos_filenum; - yylloc.first_line = yylineno; - DPRINT("Label: %s\n", yytext); - yylval.str = strdup(yytext); - yylval.str[yyleng-1] = '\0'; - return DT_LABEL; - } - <*>{WS}+ /* eat whitespace */ <*>"/*"([^*]|\*+[^*/])*\*+"/" { |