Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parse error when using an expression as #class #42

Open
progval opened this issue Jun 26, 2014 · 0 comments
Open

Parse error when using an expression as #class #42

progval opened this issue Jun 26, 2014 · 0 comments

Comments

@progval
Copy link
Contributor

progval commented Jun 26, 2014

When using something that is not a string a the #class attribute of an object, I get a parse error.
I would understand if it was a runtime error, but why does the parser error? According to ljs/ljs_parser.mly, #class expects an expression (exactly as for #proto, but in the case of #proto, an expression works)

vlorentz@gommier:~/js/LambdaS5/tests(working)$ echo "{[#proto: 5]}"  | ../obj/s5.d.byte -load init.heap /dev/stdin -continue-s5-eval
object
vlorentz@gommier:~/js/LambdaS5/tests(working)$ echo "{[#class: 'foo']}"  | ../obj/s5.d.byte -load init.heap /dev/stdin -continue-s5-eval
object
vlorentz@gommier:~/js/LambdaS5/tests(working)$ echo "{[#class: 5]}"  | ../obj/s5.d.byte -load init.heap /dev/stdin -continue-s5-eval
Fatal error: exception Failure("parse error at /dev/stdin:1:11-11; unexpected token 5")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant