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
|
module compiler
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import v.pref
|
||||||
|
|
||||||
const (
|
const (
|
||||||
single_quote = `\'`
|
single_quote = `\'`
|
||||||
@ -550,6 +551,7 @@ fn (s mut Scanner) scan() ScanRes {
|
|||||||
s.pos++
|
s.pos++
|
||||||
name := s.ident_name()
|
name := s.ident_name()
|
||||||
// @FN => will be substituted with the name of the current V function
|
// @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
|
// @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).
|
// @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).
|
// @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' {
|
if name == 'FN' {
|
||||||
return scan_res(.string, s.fn_name)
|
return scan_res(.string, s.fn_name)
|
||||||
}
|
}
|
||||||
|
if name == 'VEXE' {
|
||||||
|
vexe := pref.vexe_path()
|
||||||
|
return scan_res(.string, cescaped_path( vexe ) )
|
||||||
|
}
|
||||||
if name == 'FILE' {
|
if name == 'FILE' {
|
||||||
return scan_res(.string, cescaped_path(os.real_path(s.file_path)))
|
return scan_res(.string, cescaped_path(os.real_path(s.file_path)))
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ module scanner
|
|||||||
import (
|
import (
|
||||||
os
|
os
|
||||||
v.token
|
v.token
|
||||||
|
v.pref
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -560,6 +561,7 @@ pub fn (s mut Scanner) scan() token.Token {
|
|||||||
s.pos++
|
s.pos++
|
||||||
name := s.ident_name()
|
name := s.ident_name()
|
||||||
// @FN => will be substituted with the name of the current V function
|
// @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
|
// @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).
|
// @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).
|
// @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' {
|
if name == 'FN' {
|
||||||
return s.scan_res(.string, s.fn_name)
|
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' {
|
if name == 'FILE' {
|
||||||
return s.scan_res(.string, cescaped_path(os.real_path(s.file_path)))
|
return s.scan_res(.string, cescaped_path(os.real_path(s.file_path)))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user