Line Endings

1 view
Skip to first unread message

Graeme Defty

unread,
Feb 1, 2011, 10:33:12 AM2/1/11
to Reia Mailing List
When is a line-end not a line-end?

In the source file tcpserver.re there is a comment as follows:

    # FIXME: Needs better dict literal grammar! And keyword args ;(

Now the PEG parser considers everything after a '#' character up to the next line end to be a comment.

HOWEVER ... a ';' character is considered to be a line end

SO ...

should the ';' character here be considered to be the end of the comment?

It is tempting to say that a '#' comment goes up to the PHYSICAL end of line - it seems simpler to know that everything on that line as you view it in the editor.

Alternatively, it is also simpler to have only one type of line ending.

So I guess the question here is which is the lesser inconvenience:
1) having to scan a comment to be sure where it ends, or
2) having two types of line ending, depending on the context

I started with the view that a single definition of line ending was 'cleaner' (maybe I didn't want to change the parser), but as I type this, I seem to be coming to the opposite conclusion.

Thoughts?

Tony Arcieri

unread,
Feb 2, 2011, 3:47:57 AM2/2/11
to re...@googlegroups.com
Comments MUST be terminated by a true LF-style end of line character. It should be possible to include a ; in a comment.

If you look at the leex scanner Reia presently uses, comments are merely treated as whitespace

--
You received this message because you are subscribed to the Google Groups "Reia" group.
To post to this group, send email to re...@googlegroups.com.
To unsubscribe from this group, send email to reia+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/reia?hl=en.



--
Tony Arcieri
Medioh! Kudelski

Graeme Defty

unread,
Feb 2, 2011, 8:41:59 PM2/2/11
to re...@googlegroups.com

yes - PEG grammar matches this behaviour

Tony Arcieri

unread,
Feb 3, 2011, 3:16:21 AM2/3/11
to re...@googlegroups.com
Great!
Reply all
Reply to author
Forward
0 new messages