mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
dtc: Trivial lexer cleanups
This patch applies a couple of tiny cleanups to the lexer. The not-very-useful 'WS' named pattern is removed, and the debugging printf() for single character tokens is moved to the top of the action, which results in less confusing output when LEXDEBUG is switched on (because it goes before the printf()s for possible resulting lexer state changes). Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
459c955cca
commit
2b67c632df
1 changed files with 3 additions and 5 deletions
|
@ -29,7 +29,6 @@ PROPNODECHAR [a-zA-Z0-9,._+*#?@-]
|
|||
PATHCHAR ({PROPNODECHAR}|[/])
|
||||
LEGACYPATHCHAR [a-zA-Z0-9_@/]
|
||||
LABEL [a-zA-Z_][a-zA-Z0-9_]*
|
||||
WS [[:space:]]
|
||||
|
||||
%{
|
||||
#include "dtc.h"
|
||||
|
@ -193,7 +192,7 @@ static int dts_version; /* = 0 */
|
|||
}
|
||||
|
||||
|
||||
<*>{WS}+ /* eat whitespace */
|
||||
<*>[[:space:]]+ /* eat whitespace */
|
||||
|
||||
<*>"/*"([^*]|\*+[^*/])*\*+"/" {
|
||||
yylloc.filenum = srcpos_filenum;
|
||||
|
@ -207,6 +206,8 @@ static int dts_version; /* = 0 */
|
|||
<*>. {
|
||||
yylloc.filenum = srcpos_filenum;
|
||||
yylloc.first_line = yylineno;
|
||||
DPRINT("Char: %c (\\x%02x)\n", yytext[0],
|
||||
(unsigned)yytext[0]);
|
||||
if (yytext[0] == '[') {
|
||||
DPRINT("<BYTESTRING>\n");
|
||||
BEGIN(BYTESTRING);
|
||||
|
@ -216,9 +217,6 @@ static int dts_version; /* = 0 */
|
|||
DPRINT("<PROPNODENAME>\n");
|
||||
BEGIN(PROPNODENAME);
|
||||
}
|
||||
DPRINT("Char: %c (\\x%02x)\n", yytext[0],
|
||||
(unsigned)yytext[0]);
|
||||
|
||||
return yytext[0];
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue