From 714fa3215c7306b908968b55e2548b56affd4e94 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Wed, 25 Aug 2021 16:58:54 +0300 Subject: [PATCH] scanner: make the 1. float error a warning for now --- vlib/gg/gg_darwin.c.v | 2 ++ vlib/gg/gg_darwin.m | 1 - vlib/v/scanner/scanner.v | 2 +- vlib/v/scanner/tests/float_literals_dot_err.out | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/vlib/gg/gg_darwin.c.v b/vlib/gg/gg_darwin.c.v index 78e8a4545c..d95b8c4bde 100644 --- a/vlib/gg/gg_darwin.c.v +++ b/vlib/gg/gg_darwin.c.v @@ -8,6 +8,8 @@ fn C.darwin_draw_string(x int, y int, s string, cfg voidptr) fn C.darwin_text_width(s string) int +fn C.darwin_text_width_runes(r []rune) int + fn C.darwin_window_refresh() fn C.darwin_draw_rect(f32, f32, f32, f32, voidptr) diff --git a/vlib/gg/gg_darwin.m b/vlib/gg/gg_darwin.m index d6bb5a1481..3ec883d0e6 100644 --- a/vlib/gg/gg_darwin.m +++ b/vlib/gg/gg_darwin.m @@ -68,7 +68,6 @@ int darwin_text_width(string s) { return (int)(ceil(size.width)); } - void darwin_draw_rect(float x, float y, float width, float height, gx__Color c) { NSColor* color = nscolor(c); NSRect rect = NSMakeRect(x, y, width, height); diff --git a/vlib/v/scanner/scanner.v b/vlib/v/scanner/scanner.v index a74543f4ee..20f852491c 100644 --- a/vlib/v/scanner/scanner.v +++ b/vlib/v/scanner/scanner.v @@ -438,7 +438,7 @@ fn (mut s Scanner) ident_dec_number() string { s.pos-- } else { // 5. - s.error('float literals should have a digit after the decimal point, e.g. `5.0`') + s.warn('float literals should have a digit after the decimal point, e.g. `5.0`') } } } diff --git a/vlib/v/scanner/tests/float_literals_dot_err.out b/vlib/v/scanner/tests/float_literals_dot_err.out index 039445b585..93e9b35b88 100644 --- a/vlib/v/scanner/tests/float_literals_dot_err.out +++ b/vlib/v/scanner/tests/float_literals_dot_err.out @@ -1,4 +1,4 @@ -vlib/v/scanner/tests/float_literals_dot_err.vv:2:9: error: float literals should have a digit after the decimal point, e.g. `5.0` +vlib/v/scanner/tests/float_literals_dot_err.vv:2:9: warning: float literals should have a digit after the decimal point, e.g. `5.0` 1 | fn main() { 2 | a := 1. | ^