mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: add true
and false
to C reserved words (#13781)
This commit is contained in:
parent
d9cca53bd0
commit
f5036629ca
@ -20,10 +20,11 @@ const (
|
||||
// `small` should not be needed, but see: https://stackoverflow.com/questions/5874215/what-is-rpcndr-h
|
||||
c_reserved = ['array', 'auto', 'bool', 'break', 'calloc', 'case', 'char', 'class', 'complex',
|
||||
'const', 'continue', 'default', 'delete', 'do', 'double', 'else', 'enum', 'error', 'exit',
|
||||
'export', 'extern', 'float', 'for', 'free', 'goto', 'if', 'inline', 'int', 'link', 'long',
|
||||
'malloc', 'namespace', 'new', 'panic', 'register', 'restrict', 'return', 'short', 'signed',
|
||||
'sizeof', 'static', 'string', 'struct', 'switch', 'typedef', 'typename', 'union', 'unix',
|
||||
'unsigned', 'void', 'volatile', 'while', 'template', 'small', 'stdout', 'stdin', 'stderr']
|
||||
'export', 'extern', 'false', 'float', 'for', 'free', 'goto', 'if', 'inline', 'int', 'link',
|
||||
'long', 'malloc', 'namespace', 'new', 'panic', 'register', 'restrict', 'return', 'short',
|
||||
'signed', 'sizeof', 'static', 'string', 'struct', 'switch', 'typedef', 'typename', 'union',
|
||||
'unix', 'unsigned', 'void', 'volatile', 'while', 'template', 'true', 'small', 'stdout',
|
||||
'stdin', 'stderr']
|
||||
c_reserved_map = string_array_to_map(c_reserved)
|
||||
// same order as in token.Kind
|
||||
cmp_str = ['eq', 'ne', 'gt', 'lt', 'ge', 'le']
|
||||
|
11
vlib/v/tests/keyword_escaping_test.v
Normal file
11
vlib/v/tests/keyword_escaping_test.v
Normal file
@ -0,0 +1,11 @@
|
||||
fn test_escapes() {
|
||||
@if := 0
|
||||
@for := 0
|
||||
auto := 0
|
||||
calloc := 0
|
||||
stdout := 0
|
||||
signed := 0
|
||||
@true := 0
|
||||
@false := 0
|
||||
assert true
|
||||
}
|
Loading…
Reference in New Issue
Block a user