1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

compiler: support for custom flags

[if custom]fn..{} , #flag custom, $if custom {}
This commit is contained in:
Delyan Angelov
2019-12-23 12:09:00 +02:00
committed by Alexander Medvednikov
parent 42b1660c7e
commit 6e130cd446
7 changed files with 107 additions and 21 deletions

View File

@@ -155,10 +155,22 @@ fn (v mut V) new_parser_from_file(path string) Parser {
println('warning: use "$p" file name instead of "$path"')
}
path_platform = path_ending
path_pcguard = platform_postfix_to_ifdefguard(path_ending)
path_pcguard = v.platform_postfix_to_ifdefguard(path_ending)
break
}
}
if v.compile_defines.len > 0 {
for cdefine in v.compile_defines {
custom_path_ending := '_d_${cdefine}.v'
if path.ends_with(custom_path_ending){
path_platform = custom_path_ending
path_pcguard = v.platform_postfix_to_ifdefguard('custom $cdefine')
break
}
}
}
mut p := v.new_parser(new_scanner_file(path))
p = {
p |