[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Somewhat newbie question: multiple lines in one token?
From: |
Robert Collins |
Subject: |
Somewhat newbie question: multiple lines in one token? |
Date: |
Tue, 18 Jun 2002 00:18:01 +1000 |
I'm not sure if this is best asked here, or on a flex list... please
redirect me if needed.
I've got an input file like so:
foo: value
bar: value
multipleline: beginning
space indented line
more space indented line
foo: value
bar: value
I've built a flex .l file to recognize foo:, bar: and multipleline:, and
to grab everything else as a single STRING.
What I've having trouble with is the multipleline: construct. I've tried
varying things:
a lex state with multipleline: as the entry and \n\n as the terminator.
A bison rule:
mline: /* empty */
| STRING
| mline "\n " STRING
;
But I can't seem to get it to do the right thing. I'd be happy with
having a routine called for each line in multipleline. I'd be ecstatic
to get the whole thing in a single hit.
Any suggestions/examples I can learn from?
Rob
- Somewhat newbie question: multiple lines in one token?,
Robert Collins <=