Closed whusted closed 9 years ago
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
We removed unary increments and decrements when we merged exponents.
We've got this working now!
For example:
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