[DTC PATCH 2/2] Preserve scanner state when /include/ing.

Scott Wood scottwood at freescale.com
Tue Jan 8 07:27:51 EST 2008


This allows /include/s to work when in non-default states,
such as PROPNODECHAR.

We may want to use state stacks to get rid of BEGIN_DEFAULT() altogether...

Signed-off-by: Scott Wood <scottwood at freescale.com>
---
 dtc-lexer.l |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dtc-lexer.l b/dtc-lexer.l
index f2836a8..920b87f 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -18,7 +18,7 @@
  *                                                                   USA
  */
 
-%option noyywrap nounput yylineno
+%option noyywrap nounput yylineno stack
 
 %x INCLUDE
 %x BYTESTRING
@@ -55,7 +55,7 @@ static int dts_version; /* = 0 */
 %}
 
 %%
-<*>"/include/"		BEGIN(INCLUDE);
+<*>"/include/"		yy_push_state(INCLUDE);
 
 <INCLUDE>\"[^"\n]*\"	{
 			yytext[strlen(yytext) - 1] = 0;
@@ -63,7 +63,7 @@ static int dts_version; /* = 0 */
 				/* Some unrecoverable error.*/
 				exit(1);
 			}
-			BEGIN_DEFAULT();
+			yy_pop_state();
 		}
 
 
-- 
1.5.3



More information about the Linuxppc-dev mailing list