Skip to content
This repository has been archived by the owner on Jan 24, 2020. It is now read-only.

Assignment #27

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

AmaranthineCodices
Copy link
Contributor

In short: Parsing assignments. All of them (I think). This is disturbingly complex, because Lua allows things like this:

h:i().j[k]:l()[m] = true

The intermediate stuff for this is actually very helpful; it'll allow us to parse function calls very easily.

@LPGhatguy
Copy link
Owner

I wonder if it's time to push the concept of an lvalue into the parser's lingo!

match state.peek() {
Some(&Token { kind: TokenKind::Symbol(Symbol::Dot), .. }) => {
let (state, name) = ParseIdentifier.parse(state.advance(1))?;
println!("parsed dot index {:?}", name);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

debug line

Some(&Token { kind: TokenKind::Symbol(Symbol::LeftBracket), .. }) => {
let (state, expression) = ParseExpression.parse(state.advance(1))?;
let (state, _) = ParseSymbol(Symbol::RightBracket).parse(state)?;
println!("parsed bracketed index {:?}", expression);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this too

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

Successfully merging this pull request may close these issues.

3 participants