* dtc: Trivial lexer cleanups
@ 2007-12-04 22:50 David Gibson
2007-12-05 14:40 ` Jon Loeliger
0 siblings, 1 reply; 2+ messages in thread
From: David Gibson @ 2007-12-04 22:50 UTC (permalink / raw)
To: Jon Loeliger; +Cc: linuxppc-dev
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>
Index: dtc/dtc-lexer.l
===================================================================
--- dtc.orig/dtc-lexer.l 2007-11-22 17:29:51.000000000 +1100
+++ dtc/dtc-lexer.l 2007-11-22 17:30:55.000000000 +1100
@@ -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];
}
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: dtc: Trivial lexer cleanups
2007-12-04 22:50 dtc: Trivial lexer cleanups David Gibson
@ 2007-12-05 14:40 ` Jon Loeliger
0 siblings, 0 replies; 2+ messages in thread
From: Jon Loeliger @ 2007-12-05 14:40 UTC (permalink / raw)
To: David Gibson; +Cc: linuxppc-dev
So, like, the other day David Gibson mumbled:
> 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>
Applied.
jdl
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-12-05 14:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-04 22:50 dtc: Trivial lexer cleanups David Gibson
2007-12-05 14:40 ` Jon Loeliger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).