diff --git a/vlib/compiler/scanner.v b/vlib/compiler/scanner.v index 636127a076..e17c9f61c1 100644 --- a/vlib/compiler/scanner.v +++ b/vlib/compiler/scanner.v @@ -4,6 +4,7 @@ module compiler import os +import v.pref const ( single_quote = `\'` @@ -550,6 +551,7 @@ fn (s mut Scanner) scan() ScanRes { s.pos++ name := s.ident_name() // @FN => will be substituted with the name of the current V function + // @VEXE => will be substituted with the path to the V compiler // @FILE => will be substituted with the path of the V source file // @LINE => will be substituted with the V line number where it appears (as a string). // @COLUMN => will be substituted with the column where it appears (as a string). @@ -560,6 +562,10 @@ fn (s mut Scanner) scan() ScanRes { if name == 'FN' { return scan_res(.string, s.fn_name) } + if name == 'VEXE' { + vexe := pref.vexe_path() + return scan_res(.string, cescaped_path( vexe ) ) + } if name == 'FILE' { return scan_res(.string, cescaped_path(os.real_path(s.file_path))) } diff --git a/vlib/v/scanner/scanner.v b/vlib/v/scanner/scanner.v index 739fe6639e..72e7744641 100644 --- a/vlib/v/scanner/scanner.v +++ b/vlib/v/scanner/scanner.v @@ -6,6 +6,7 @@ module scanner import ( os v.token + v.pref ) const ( @@ -560,6 +561,7 @@ pub fn (s mut Scanner) scan() token.Token { s.pos++ name := s.ident_name() // @FN => will be substituted with the name of the current V function + // @VEXE => will be substituted with the path to the V compiler // @FILE => will be substituted with the path of the V source file // @LINE => will be substituted with the V line number where it appears (as a string). // @COLUMN => will be substituted with the column where it appears (as a string). @@ -570,6 +572,10 @@ pub fn (s mut Scanner) scan() token.Token { if name == 'FN' { return s.scan_res(.string, s.fn_name) } + if name == 'VEXE' { + vexe := pref.vexe_path() + return s.scan_res(.string, cescaped_path( vexe ) ) + } if name == 'FILE' { return s.scan_res(.string, cescaped_path(os.real_path(s.file_path))) }