parser: $if clang, $if msvc, $if mingw
parent
b8b72580a7
commit
ee4db9f96d
|
@ -66,20 +66,19 @@ fn (p mut Parser) comp_time() {
|
||||||
p.genln('#endif')
|
p.genln('#endif')
|
||||||
}
|
}
|
||||||
else if name == 'tinyc' {
|
else if name == 'tinyc' {
|
||||||
p.genln('#ifdef __TINYC__')
|
p.comptime_if_block('__TINYC__')
|
||||||
p.check(.lcbr)
|
|
||||||
p.statements_no_rcbr()
|
|
||||||
if ! (p.tok == .dollar && p.peek() == .key_else) {
|
|
||||||
p.genln('#endif')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if name == 'glibc' {
|
else if name == 'glibc' {
|
||||||
p.genln('#ifdef __GLIBC__')
|
p.comptime_if_block('__GLIBC__')
|
||||||
p.check(.lcbr)
|
}
|
||||||
p.statements_no_rcbr()
|
else if name == 'mingw' {
|
||||||
if ! (p.tok == .dollar && p.peek() == .key_else) {
|
p.comptime_if_block('__MINGW32__')
|
||||||
p.genln('#endif')
|
}
|
||||||
}
|
else if name == 'msvc' {
|
||||||
|
p.comptime_if_block('__MSC_VER__')
|
||||||
|
}
|
||||||
|
else if name == 'clang' {
|
||||||
|
p.comptime_if_block('__clang__')
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
println('Supported platforms:')
|
println('Supported platforms:')
|
||||||
|
@ -439,3 +438,12 @@ fn (p mut Parser) gen_array_map(str_typ string, method_ph int) string {
|
||||||
p.close_scope()
|
p.close_scope()
|
||||||
return 'array_' + map_type
|
return 'array_' + map_type
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn (p mut Parser) comptime_if_block(name string) {
|
||||||
|
p.genln('#ifdef $name')
|
||||||
|
p.check(.lcbr)
|
||||||
|
p.statements_no_rcbr()
|
||||||
|
if ! (p.tok == .dollar && p.peek() == .key_else) {
|
||||||
|
p.genln('#endif')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue