mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v and v2: support @VEXE
This commit is contained in:
parent
715d4f6601
commit
e09447d011
@ -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)))
|
||||
}
|
||||
|
@ -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)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user