aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2017-11-05 18:26:24 +0000
committergingerBill <bill@gingerbill.org>2017-11-05 18:26:24 +0000
commit66ee2cb6ed8ea511b2f8987678695f66d748cf1e (patch)
tree8f42579e9612198c908380ceefc40cc841f32eeb /src/tokenizer.cpp
parent1d4881cbbe0da6c5f9cd4a99dd1bf65c5e00c51d (diff)
#const value procedure parameters; $N for polymorphic array lengths
Diffstat (limited to 'src/tokenizer.cpp')
-rw-r--r--src/tokenizer.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/tokenizer.cpp b/src/tokenizer.cpp
index dc0c2a56d..f5b5b241f 100644
--- a/src/tokenizer.cpp
+++ b/src/tokenizer.cpp
@@ -155,14 +155,13 @@ TokenPos token_pos(String file, isize line, isize column) {
}
i32 token_pos_cmp(TokenPos const &a, TokenPos const &b) {
- if (a.line == b.line) {
- if (a.column == b.column) {
- isize min_len = gb_min(a.file.len, b.file.len);
- return gb_memcompare(a.file.text, b.file.text, min_len);
- }
+ if (a.line != b.line) {
+ return (a.line < b.line) ? -1 : +1;
+ }
+ if (a.column != b.column) {
return (a.column < b.column) ? -1 : +1;
}
- return (a.line < b.line) ? -1 : +1;
+ return string_compare(a.file, b.file);
}
bool operator==(TokenPos const &a, TokenPos const &b) { return token_pos_cmp(a, b) == 0; }