From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sat, 7 Jul 2007 01:18:50 -0500 (CDT) Subject: [PATCH 06/11] dtc: allow a label: in any dts context Sender: From: Milton Miller To: Jon Loeliger Message-Id: In-Reply-To: Cc: linuxppc-dev@ozlabs.org, David Gibson List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 --- The following patches parse matches in CELLDATA and BYTESTRING in addition to the current INITIAL context; matches in MEMRESERVE and INCLUDE context will not be parsed. diff --git a/dtc-lexer.l b/dtc-lexer.l index 77ccd54..0e356bb 100644 --- a/dtc-lexer.l +++ b/dtc-lexer.l @@ -107,6 +107,16 @@ #endif 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; + } + [bodh]# { yylloc.filenum = srcpos_filenum; yylloc.first_line = yylineno; @@ -189,15 +199,6 @@ #endif } -[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 */ <*>"/*"([^*]|\*+[^*/])*\*+"/" {