From ae0e3efb8e95fd6a1e351997451d0328199d2908 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Mon, 5 Aug 2019 16:57:54 +0200 Subject: [PATCH] =?UTF-8?q?scanner:=20experimental=20=E2=89=A0=20etc=20sup?= =?UTF-8?q?port?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- compiler/scanner.v | 16 ++++++++++++++++ vlib/builtin/int_test.v | 6 ++++++ 2 files changed, 22 insertions(+) diff --git a/compiler/scanner.v b/compiler/scanner.v index 24d423cf0a..5ee9164bb3 100644 --- a/compiler/scanner.v +++ b/compiler/scanner.v @@ -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++ diff --git a/vlib/builtin/int_test.v b/vlib/builtin/int_test.v index b2f669b074..32d22aaa52 100644 --- a/vlib/builtin/int_test.v +++ b/vlib/builtin/int_test.v @@ -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 +}