Compare commits

..

No commits in common. "a2990e67c7656bd9771e3052f9cdd4afa4a027ba" and "c64767ba59f52ee269fadf6d7ecc1009777a2625" have entirely different histories.

View File

@ -258,8 +258,7 @@ const Parser = struct {
UnexpectedEnd,
};
const operator_tokens = &.{.symbol_assign, .symbol_plus,
.symbol_dash, .symbol_asterisk, .symbol_forward_slash, .symbol_paren_left, .symbol_comma};
const operator_tokens = &.{.symbol_assign, .symbol_plus, .symbol_dash, .symbol_asterisk, .symbol_forward_slash};
fn parse_expression(self: *Parser) ParseError!void {
var operators = OperatorStack{};
@ -439,7 +438,7 @@ const Parser = struct {
else => self.parse_expression(),
};
switch (self.current_token) {
switch (self.previous_token) {
.symbol_paren_right => break,
.symbol_comma => {},
else => return error.UnexpectedToken,
@ -480,7 +479,6 @@ const Parser = struct {
switch (self.current_token) {
.symbol_assign => {
try self.step();
try self.parse_expression();
field_count += 1;
@ -511,17 +509,10 @@ const Parser = struct {
}
}
try self.chunk.emit_opcode(.push_table);
try self.chunk.emit_operand(field_count);
if (is_call_argument) {
try self.chunk.emit_opcode(.call);
try self.chunk.emit_operand(1);
}
self.step() catch |step_error| switch (step_error) {
error.UnexpectedEnd => return,
};
},
else => {
@ -592,7 +583,7 @@ const Parser = struct {
.symbol_period => switch (self.previous_token) {
.global_identifier => {
// Create local copy of identifier because step() will overwrite captures.
const identifier = self.previous_token.global_identifier;
const identifier = self.previous_token.local_identifier;
try self.step();
try self.current_token.expect(.local_identifier);
@ -604,7 +595,7 @@ const Parser = struct {
.local_identifier => {
// Create local copy of identifier because step() will overwrite captures.
const identifier = self.previous_token.local_identifier;
const identifier = self.previous_token.global_identifier;
try self.step();
try self.current_token.expect(.local_identifier);