linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [DTC PATCH 2/2] Preserve scanner state when /include/ing.
@ 2008-01-07 20:27 Scott Wood
  2008-01-10  4:05 ` David Gibson
  2008-01-10 14:16 ` Jon Loeliger
  0 siblings, 2 replies; 3+ messages in thread
From: Scott Wood @ 2008-01-07 20:27 UTC (permalink / raw)
  To: jdl; +Cc: linuxppc-dev

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@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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [DTC PATCH 2/2] Preserve scanner state when /include/ing.
  2008-01-07 20:27 [DTC PATCH 2/2] Preserve scanner state when /include/ing Scott Wood
@ 2008-01-10  4:05 ` David Gibson
  2008-01-10 14:16 ` Jon Loeliger
  1 sibling, 0 replies; 3+ messages in thread
From: David Gibson @ 2008-01-10  4:05 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev, jdl

On Mon, Jan 07, 2008 at 02:27:51PM -0600, Scott Wood wrote:
> 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...

And we should, if we're going to go to stacked states at all.  I was
anticipating we might need to use stacked states for handling
propnamestate as we need expression support.  I just hadn't realised
we already needed it for includes.


-- 
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] 3+ messages in thread

* Re: [DTC PATCH 2/2] Preserve scanner state when /include/ing.
  2008-01-07 20:27 [DTC PATCH 2/2] Preserve scanner state when /include/ing Scott Wood
  2008-01-10  4:05 ` David Gibson
@ 2008-01-10 14:16 ` Jon Loeliger
  1 sibling, 0 replies; 3+ messages in thread
From: Jon Loeliger @ 2008-01-10 14:16 UTC (permalink / raw)
  To: Scott Wood; +Cc: linuxppc-dev

So, like, the other day Scott Wood mumbled:
> 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@freescale.com>

Hmmm..  With this applied, I get the usual warning:

        CHK version_gen.h
         CC dtc-lexer.lex.o
    dtc-lexer.lex.c:1901: warning: 'yy_top_state' defined but not used

*grumble*

Applied.

jdl

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-01-10 14:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-07 20:27 [DTC PATCH 2/2] Preserve scanner state when /include/ing Scott Wood
2008-01-10  4:05 ` David Gibson
2008-01-10 14:16 ` 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).