From 81f8b261272e2ae34ff752e91401d28c4410d367 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sat, 12 Oct 2019 22:18:19 +0300 Subject: [PATCH] os.path_separator --- compiler/parser.v | 6 +++--- vlib/os/os_nix.v | 1 + vlib/os/os_win.v | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/parser.v b/compiler/parser.v index 33264172aa..9a079a3b1e 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -518,9 +518,9 @@ fn (p mut Parser) const_decl() { continue } mut name := p.check_name() // `Age = 20` - //if ! (name[0] >= `A` && name[0] <= `Z`) { - //p.error('const name must be capitalized') - //} + if p.mod != 'os' && contains_capital(name) { + //p.warn('const names cannot contain uppercase letters, use snake_case instead') + } name = p.prepend_mod(name) mut typ := '' if p.is_vh { diff --git a/vlib/os/os_nix.v b/vlib/os/os_nix.v index 67d4ddda87..e2c5374418 100644 --- a/vlib/os/os_nix.v +++ b/vlib/os/os_nix.v @@ -5,6 +5,7 @@ module os const ( PathSeparator = '/' + path_separator = '/' ) fn init_os_args(argc int, argv &byteptr) []string { diff --git a/vlib/os/os_win.v b/vlib/os/os_win.v index 4128832a2a..0da2514b1c 100644 --- a/vlib/os/os_win.v +++ b/vlib/os/os_win.v @@ -5,6 +5,7 @@ module os const ( PathSeparator = '\\' + path_separator = '\\' ) // Ref - https://docs.microsoft.com/en-us/windows/desktop/winprog/windows-data-types