mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
parser: add some infrastructure for more specific errors
* compiler: change s.line_nr in just one place, so that s.last_nl_pos will be updated in tandem too. * Cleanup spurious spaces. * Store ScannerPos info inside the cached tokens. Use the stored information when errors are encountered. * Fix #2079 ( cannot use type...in assignment ). * do not store scannerpos per each token, instead rescan the source once on error to get the position. * compiler: implement highlighting for errors. Use only line/col info stored in the cached tokens. * fixing building on windows * Split can_show_color to _nix and _win files.
This commit is contained in:
committed by
Alexander Medvednikov
parent
cbf5de7c8f
commit
8b8cd13929
11
vlib/term/can_show_color_nix.v
Normal file
11
vlib/term/can_show_color_nix.v
Normal file
@@ -0,0 +1,11 @@
|
||||
module term
|
||||
|
||||
import os
|
||||
|
||||
fn C.isatty(int) int
|
||||
|
||||
pub fn can_show_color() bool {
|
||||
if os.getenv('TERM') == 'dumb' { return false }
|
||||
if C.isatty(1) != 0 { return true }
|
||||
return false
|
||||
}
|
||||
10
vlib/term/can_show_color_win.v
Normal file
10
vlib/term/can_show_color_win.v
Normal file
@@ -0,0 +1,10 @@
|
||||
module term
|
||||
|
||||
import os
|
||||
|
||||
// TODO: implement proper checking on windows too.
|
||||
// For now, just return false by default
|
||||
pub fn can_show_color() bool {
|
||||
if os.getenv('TERM') == 'dumb' { return false }
|
||||
return false
|
||||
}
|
||||
Reference in New Issue
Block a user