Hmmm - no compilation error ?

Monte Goulding monte at appisle.net
Mon Oct 29 22:27:49 EDT 2018


The parser is often lenient at the end of statements like this. 

In the case of the return statement it first looks for the expression to return then checks if the next token is either `for` or `with`. If it isn’t either of those it doesn’t look any further or throw an error.

Really we should have a general check for extra stuff after parsing statements but we don’t. Stuff like that can also be a bit risky to add as all of a sudden a lot of scripts that work perfectly well might not compile.

Cheers

Monte

> On 30 Oct 2018, at 12:00 pm, Alex Tweedly via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> I accidentally typed the equivalent of
> 
> function x p
>    return return p
> end x
> 
> i.e. I had the word "return" in there twice.
> 
> And it didn't give me an error on compilation, and also didn't just ignore the repeated word, it simply returned a blank line.
> 
> Does it seem like this is a bug ?  Is the parser too lenient ?
> 
> (LC 9.0.0, and 8.1.5 tested)
> 
> 
> Ohhhh - and while testing it out for this email, I tried to type
> 
> ask "a" & x(3) & "b"
> 
> but instead I did
> 
> ask "a"  x(3) & "b"
> (i.e. missing an '&')
> 
> and that too didn't give an error; it simply ignored the extra part of the line. !?
> 
> Thanks
> 
> Alex.
> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list