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

Parser doesn't support assigning to a variable reference #59

Closed
whusted opened this issue Mar 5, 2015 · 3 comments
Closed

Parser doesn't support assigning to a variable reference #59

whusted opened this issue Mar 5, 2015 · 3 comments

Comments

@whusted
Copy link
Collaborator

whusted commented Mar 5, 2015

For example:

z[0] = 'hi'

doesn't parse. While I thought this looked simple to account for in the beginning, my esteemed colleague, and the back to back to back MVP of the LMU CS program, @rachelriv, brought up examples of why this is something we all need to think/talk about

@whusted
Copy link
Collaborator Author

whusted commented Mar 5, 2015

A quick thought on what the function might look like (courtesy of the aforementioned @rachelriv):

parseVarRef = ->
  console.log "Parseing Variable Reference"
  exp = parseExp8()

  while ((at ['.', '[']) and
  (next StartTokens.expression))
    if at '.'
      match '.'
      exp = new MemberAccess exp, parseExpression()
    else if at '['
      match '['
      exp = new ListSubscript exp, parseExpression()
      match ']'

  if at([ '++', '--' ])
    op = match()
    exp = new PostUnaryExpression op, exp
  exp

@juansc
Copy link
Contributor

juansc commented Mar 5, 2015

We removed unary increments and decrements when we merged exponents.

@juansc juansc assigned juansc and unassigned juansc Mar 14, 2015
@rachelriv
Copy link
Collaborator

We've got this working now!

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

No branches or pull requests

3 participants