[antlr-interest] Checking for expression end in Javascript parser

shmuel siegel antlr at shmuelhome.mine.nu
Wed Oct 26 11:28:33 PDT 2005


Tech wrote:
> One aspect that is different is that Javascript expressions end either 
> at a semi colon, or at the earliest new line that makes a valid 
> expression.

As far as I know, this is not a valid definition for javascript 
statements. It is true for control statements like "return" or "break" 
but not for arithmetic statements.

Consider,
	<script>
		a=3
		+4
		alert(a);
	</script>

It is legal and will result in an alert with the value 7. In general, a 
new line only marks the end of a statement if the next token cannot be 
part of the previous pattern.


-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.12.4/146 - Release Date: 10/21/2005



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.12.4/146 - Release Date: 10/21/2005



More information about the antlr-interest mailing list