scanner: fix SlashEqual generation not skipping its own chars
- parser: allow SlashEqual on main mkAssign/mkSet call - readme: += and gang are done
This commit is contained in:
parent
e0a60ddc2c
commit
4479e78356
3 changed files with 8 additions and 5 deletions
|
@ -34,7 +34,6 @@ negatively charged towards
|
||||||
|
|
||||||
## wip
|
## wip
|
||||||
|
|
||||||
- `+=`, `-=`, and the rest of the gang
|
|
||||||
- no `for` yet
|
- no `for` yet
|
||||||
- no arrays yet
|
- no arrays yet
|
||||||
- no `map` yet
|
- no `map` yet
|
||||||
|
|
|
@ -756,7 +756,7 @@ pub const Parser = struct {
|
||||||
.ColonEqual => return try self.mkVarDecl(expr.Variable, value, mutable),
|
.ColonEqual => return try self.mkVarDecl(expr.Variable, value, mutable),
|
||||||
.Equal => return try self.mkAssign(expr.Variable, value),
|
.Equal => return try self.mkAssign(expr.Variable, value),
|
||||||
|
|
||||||
.PlusEqual, .MinusEqual, .StarEqual => {
|
.PlusEqual, .MinusEqual, .StarEqual, .SlashEqual => {
|
||||||
var new_op = try self.mkToken(new_op_ttype, new_lexeme, op.line);
|
var new_op = try self.mkToken(new_op_ttype, new_lexeme, op.line);
|
||||||
return try self.mkAssign(
|
return try self.mkAssign(
|
||||||
expr.Variable,
|
expr.Variable,
|
||||||
|
@ -775,7 +775,9 @@ pub const Parser = struct {
|
||||||
return Result.CompileError;
|
return Result.CompileError;
|
||||||
},
|
},
|
||||||
|
|
||||||
.PlusEqual, .MinusEqual, .StarEqual => {
|
.Equal => return try self.mkSet(get.struc, get.name, value),
|
||||||
|
|
||||||
|
.PlusEqual, .MinusEqual, .StarEqual, .SlashEqual => {
|
||||||
var new_op = try self.mkToken(new_op_ttype, new_lexeme, op.line);
|
var new_op = try self.mkToken(new_op_ttype, new_lexeme, op.line);
|
||||||
return try self.mkSet(
|
return try self.mkSet(
|
||||||
get.struc,
|
get.struc,
|
||||||
|
@ -784,7 +786,6 @@ pub const Parser = struct {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
.Equal => return try self.mkSet(get.struc, get.name, value),
|
|
||||||
else => unreachable,
|
else => unreachable,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -317,7 +317,10 @@ pub const Scanner = struct {
|
||||||
var next = self.peekNext();
|
var next = self.peekNext();
|
||||||
|
|
||||||
switch (next) {
|
switch (next) {
|
||||||
'=' => return self.makeToken(.SlashEqual),
|
'=' => {
|
||||||
|
self.current += 1;
|
||||||
|
return self.makeToken(.SlashEqual);
|
||||||
|
},
|
||||||
|
|
||||||
'/' => blk2: {
|
'/' => blk2: {
|
||||||
while (self.peek() != '\n' and !self.isAtEnd()) {
|
while (self.peek() != '\n' and !self.isAtEnd()) {
|
||||||
|
|
Loading…
Reference in a new issue