@Doru: This might solve the problem:

isStartOfLine
(position = 0) ifTrue: [ ^ true ].
        ^ ((collection at: position) = Character cr) or: [ (collection at: position) = Character lf ].

Do you agree?

Cheers,
Jan


On 3 September 2014 14:46, Tudor Girba <tudor@tudorgirba.com> wrote:
Hi,

Jan has implemented a nice parser that allows us to specify easily productions that depend on text having to be on a new line.

For example, in Pillar, a header is specified through an exclamation mark starting on a new line. Now, you can parse this as:

#startOfLine asParser , $! asParser , #newline asParser negate star

Pretty cool!


@Jan: I think we need to enhance a bit the implementation. The implementation looks like this right now:
isStartOfLine
(position = 0) ifTrue: [ ^ true ].
^ (collection at: position) = Character cr.

This will work when the line ending is either cr or lf+cr. However, it won't work if the line ending is just lf.

For example, in my parsers, the newline implementation looks like:
(#cr asParser , #lf asParser optional) / #lf asParser / #cr asParser


What do you think?

Cheers,
Doru

--

"Every thing has its own flow"

_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev