in reply to Re: Modifying Parse::RecDescent Grammar to deal with multiline property file entries
in thread Modifying Parse::RecDescent Grammar to deal with multiline property file entries

Thank you for the suggestion.

I need to work on each property as a whole, but could still piece together your ContinuationLine with its corresponding SimpleProp....

In any case, what I was hoping to express was that a property is everything from a line beginning with Var=Val and continuing up to, but not including, the next line beginning with Var=Val. This seems a likely spot for a look-ahead.

I am going to brute force the situation, using regexps and flags to indicate when in a Property, but do hope to poke on this when I can. I will certainly post back any useful conclusions.
  • Comment on Re^2: Modifying Parse::RecDescent Grammar to deal with multiline property file entries

Replies are listed 'Best First'.
Re^3: Modifying Parse::RecDescent Grammar to deal with multiline property file entries
by suaveant (Parson) on Aug 16, 2007 at 17:21 UTC
    yeah you could do something like
    /.*(?=(^[^=]+=|\Z))/ # not tested, but should be about right
    Or you could use the code... set a flag when you find a propname and unset only except continuation lines when it is set. If you need to look at the prop as one piece just build a parse tree... that usually is the better way to go unless you are working on a huge dataset or a real time stream. And, as you say, you could pop it back together in simpleprop.

    Of course.. unless you need them it is often easier to pre-process out the comments.

                    - Ant
                    - Some of my best work - (1 2 3)