Hi Doru,
The package PetitRegex in PPRegexParser class>>initializeEscapeMap
defines various parsers that do not consume anything but that check
for certain conditions (beginning/end of input/word). In a similar way
conditions for lines (whatever your definition of a line is) could be
built.
Lukas
On 26 October 2010 14:53, Tudor Girba <tudor.girba(a)gmail.com> wrote:
Hi,
I have a case of a language that uses a line based syntax.
Here is an example:
'
label1 => any kind of
text on many lines
label2 => more text on
many
lines
label3 => more text'
This should get 3 key-value pairs.
My current solution goes like this:
key := #newline asParser , ('=>' asParser / #newline asParser) negate star ,
'=>' asParser.
p := (key trimBlanks, key negate star flatten) star.
However, this is quite ugly. One idea to make it simpler would be to have a parser for
the beginning of the line. What do you think?
Cheers,
Doru
--
www.tudorgirba.com
"When people care, great things can happen."
_______________________________________________
Moose-dev mailing list
Moose-dev(a)iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev