I think this is not enough, because when you have cr+lf, you do not want to be true on cr. I think we should go with the the same rule as in the parser I proposed, which means that we need to reason about two characters.DoruOn Wed, Sep 3, 2014 at 3:38 PM, Jan Kurš <kurs.jan@gmail.com> wrote:
@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,
JanOn 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 starPretty 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 asParserWhat 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
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
--"Every thing has its own flow"
_______________________________________________
Moose-dev mailing list
Moose-dev@iam.unibe.ch
https://www.iam.unibe.ch/mailman/listinfo/moose-dev