scanner: experimental ≠ etc support

pull/1527/head
Alexander Medvednikov 2019-08-05 16:57:54 +02:00
parent 6a9bda806f
commit ae0e3efb8e
2 changed files with 22 additions and 0 deletions

View File

@ -438,6 +438,22 @@ fn (s mut Scanner) scan() ScanRes {
else {
return scan_res(.gt, '')
}
case 0xE2:
//case `≠`:
if nextc == 0x89 && s.text[s.pos + 2] == 0xA0 {
s.pos += 2
return scan_res(.ne, '')
}
// ⩽
else if nextc == 0x89 && s.text[s.pos + 2] == 0xBD {
s.pos += 2
return scan_res(.le, '')
}
// ⩾
else if nextc == 0xA9 && s.text[s.pos + 2] == 0xBE {
s.pos += 2
return scan_res(.ge, '')
}
case `<`:
if nextc == `=` {
s.pos++

View File

@ -9,3 +9,9 @@ fn test_const() {
assert a == 3
assert u == u64(1)
}
fn test_cmp() {
assert 1 2
assert 1 2
assert 1 0
}