1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

scanner: experimental ≠ etc support

This commit is contained in:
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 { else {
return scan_res(.gt, '') 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 `<`: case `<`:
if nextc == `=` { if nextc == `=` {
s.pos++ s.pos++

View File

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