compound assignment
This commit is contained in:
@@ -150,11 +150,23 @@ lex :: proc(
|
||||
append_token(&stream, source_file, .Greater, start, cursor)
|
||||
}
|
||||
case '+':
|
||||
append_token(&stream, source_file, .Plus, cursor, cursor+1)
|
||||
start := cursor
|
||||
cursor += 1
|
||||
if cursor < len(bytes) && bytes[cursor] == '=' {
|
||||
cursor += 1
|
||||
append_token(&stream, source_file, .Plus_Equal, start, cursor)
|
||||
} else {
|
||||
append_token(&stream, source_file, .Plus, start, cursor)
|
||||
}
|
||||
case '-':
|
||||
append_token(&stream, source_file, .Minus, cursor, cursor+1)
|
||||
start := cursor
|
||||
cursor += 1
|
||||
if cursor < len(bytes) && bytes[cursor] == '=' {
|
||||
cursor += 1
|
||||
append_token(&stream, source_file, .Minus_Equal, start, cursor)
|
||||
} else {
|
||||
append_token(&stream, source_file, .Minus, start, cursor)
|
||||
}
|
||||
case '.':
|
||||
start := cursor
|
||||
cursor += 1
|
||||
@@ -176,8 +188,23 @@ lex :: proc(
|
||||
append_token(&stream, source_file, .At, cursor, cursor+1)
|
||||
cursor += 1
|
||||
case '*':
|
||||
append_token(&stream, source_file, .Star, cursor, cursor+1)
|
||||
start := cursor
|
||||
cursor += 1
|
||||
if cursor < len(bytes) && bytes[cursor] == '=' {
|
||||
cursor += 1
|
||||
append_token(&stream, source_file, .Star_Equal, start, cursor)
|
||||
} else {
|
||||
append_token(&stream, source_file, .Star, start, cursor)
|
||||
}
|
||||
case '/':
|
||||
start := cursor
|
||||
cursor += 1
|
||||
if cursor < len(bytes) && bytes[cursor] == '=' {
|
||||
cursor += 1
|
||||
append_token(&stream, source_file, .Slash_Equal, start, cursor)
|
||||
} else {
|
||||
append_token(&stream, source_file, .Slash, start, cursor)
|
||||
}
|
||||
case '&':
|
||||
append_token(&stream, source_file, .Ampersand, cursor, cursor+1)
|
||||
cursor += 1
|
||||
|
||||
Reference in New Issue
Block a user