parser.v: string interpolation for pointers

pull/759/head
Alexander Medvednikov 2019-06-28 15:55:18 +02:00
parent 8abc461a55
commit b81f615a75
1 changed files with 4 additions and 1 deletions

View File

@ -2088,11 +2088,14 @@ fn (p mut Parser) typ_to_fmt(typ string) string {
case 'u32': return '%d' case 'u32': return '%d'
case 'f64', 'f32': return '%f' case 'f64', 'f32': return '%f'
case 'i64': return '%lld' case 'i64': return '%lld'
case 'byte*': return '%s' case 'byte*', 'byteptr': return '%s'
// case 'array_string': return '%s' // case 'array_string': return '%s'
// case 'array_int': return '%s' // case 'array_int': return '%s'
case 'void': p.error('cannot interpolate this value') case 'void': p.error('cannot interpolate this value')
default: default:
if typ.ends_with('*') {
return '%p'
}
p.error('unhandled sprintf format "$typ" ') p.error('unhandled sprintf format "$typ" ')
} }
return '' return ''