compound assignment

This commit is contained in:
2026-06-22 21:20:15 +02:00
parent 663f4dc658
commit 6512ccd543
14 changed files with 995 additions and 99 deletions
+30 -3
View File
@@ -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