compiler: add all C reserved words to CReserved

pull/1755/head
Delyan Angelov 2019-08-26 20:04:57 +03:00 committed by Alexander Medvednikov
parent d88315d789
commit 99c9410cc2
2 changed files with 37 additions and 3 deletions

View File

@ -124,7 +124,7 @@ fn (p mut Parser) select_query(fn_ph int) string {
for i, field in fields {
mut cast := ''
if field.typ == 'int' {
cast = 'string_int'
cast = 'v_string_int'
}
obj_gen.writeln('${qprefix}$tmp . $field.name = $cast( *(string*)array__get(${qprefix}row.vals, $i) );')
}

View File

@ -102,10 +102,44 @@ const (
'error',
'malloc',
'calloc',
'char',
'free',
'panic',
'register'
// Full list of C reserved words, from: https://en.cppreference.com/w/c/keyword
'auto',
'break',
'case',
'char',
'const',
'continue',
'default',
'do',
'double',
'else',
'enum',
'extern',
'float',
'for',
'goto',
'if',
'inline',
'int',
'long',
'register',
'restrict',
'return',
'short',
'signed',
'sizeof',
'static',
'struct',
'switch',
'typedef',
'union',
'unsigned',
'void',
'volatile',
'while',
]
)