Re: Parenthesized Target Notation

Roger Browne <[email protected]>
Newsgroups gmane.comp.lang.eiffel.smalleiffel
Message-ID <1115362677.14580.12.camel@eden>
On Fri, 2005-05-06 at 11:25 +1200, Richard A. O'Keefe wrote:
> I suspect that a rule along the lines of 'if the syntax would allow a
> semicolon at the end of a line, act as if there was a semicolon there'
> would do the least damage.

In the amber language, I've approached the identical problem in a
different way. After seeing an operator expression (of which an
identifier is a degenerate case), the parser looks for a possible left
parenthesis - but the parser only looks as far as the end of the current
line. If it fails to find the left parenthesis, the expression or
instruction is complete (in which case the left parenthesis on the next
line will eventually be parsed as a new expression or instruction).

This gives identical results in the cases involving parentheses that you
presented...

>         (a			-- no semicolon here
>          - b) < c
> 	f			-- semicolon here
> 	(x+1).g
> 	f(			-- no semicolon here
> 	 x+1).g

...without the parser needing to consider the presence or absence of
semicolons.

Regards,
Roger
-- 
Roger Browne <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.