Parser.error(): information about what to do when V doesn't compile

pull/624/head
Alexander Medvednikov 2019-06-26 01:03:41 +02:00
parent 8ceb110412
commit 6a2afa1cfe
1 changed files with 11 additions and 0 deletions

View File

@ -657,6 +657,17 @@ fn (p mut Parser) error(s string) {
println('pass=$p.run fn=`$p.cur_fn.name`') println('pass=$p.run fn=`$p.cur_fn.name`')
} }
p.cgen.save() p.cgen.save()
// V git pull hint
cur_path := os.getwd()
if p.file_path.contains('v/compiler') || cur_path.contains('v/compiler') {
println('\n====================')
println('It looks like you are building V. It is being frequently updated every day.' +
' Most likely there was a change that lead to this error. ')
println('Try to run `git pull`, that will most likely fix it.')
println('If `git pull` doesn\'t help, re-install V from source or download a precompiled' +
' binary from https://vlang.io')
println('====================\n')
}
// p.scanner.debug_tokens() // p.scanner.debug_tokens()
// Print `[]int` instead of `array_int` in errors // Print `[]int` instead of `array_int` in errors
p.scanner.error(s.replace('array_', '[]').replace('__', '.')) p.scanner.error(s.replace('array_', '[]').replace('__', '.'))