Skip to content
This repository has been archived by the owner on Nov 23, 2017. It is now read-only.

Issue using operators on plain old JS method invocations #159

Open
dbousamra opened this issue Nov 29, 2012 · 3 comments
Open

Issue using operators on plain old JS method invocations #159

dbousamra opened this issue Nov 29, 2012 · 3 comments
Labels

Comments

@dbousamra
Copy link
Collaborator

My apologies on the tittle - I struggled to come up with a useful description.

Take this code:

roy> let a = 10
roy> let c = 9

If one tries to perform the following:

roy> a - Math.sqrt(c)

the compiler errors with:

Error: Parse error on line 1: Unexpected '('
    at Object.parseError (/Users/domlebo70/Documents/workspace/Roy/roy/lib/parser.js:335:11)
    at Object.parse (/Users/domlebo70/Documents/workspace/Roy/roy/lib/parser.js:411:22)
    at Interface.nodeRepl (/Users/domlebo70/Documents/workspace/Roy/roy/src/compile.js:619:30)
    at Interface.EventEmitter.emit (events.js:96:17)
    at Interface._onLine (readline.js:200:10)
    at Interface._line (readline.js:518:8)
    at Interface._ttyWrite (readline.js:736:14)
    at ReadStream.onkeypress (readline.js:97:10)
    at ReadStream.EventEmitter.emit (events.js:126:20)
    at emitKey (readline.js:1058:12)

No combination of bracket placement seems to get around it.

@puffnfresh
Copy link
Owner

The deep issue is that it looks like operator parsing is a bit broken.

But anyway, function application doesn't need parentheses. You want to use a - (Math.sqrt c).

@dbousamra
Copy link
Collaborator Author

Ah cheers.

@rtfeldman
Copy link
Collaborator

To confirm, is a - Math.sqrt(c) supposed to be valid, except the parser is rejecting it? Or is only a - (Math.sqrt c) intended to be allowed?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants