parser: do not allow "int?", only "?int"
parent
f27f3515ae
commit
d2d75f3824
|
@ -1022,12 +1022,9 @@ fn (p mut Parser) get_type() string {
|
||||||
p.register_array(typ)
|
p.register_array(typ)
|
||||||
}
|
}
|
||||||
p.next()
|
p.next()
|
||||||
if p.tok == .question || is_question {
|
if is_question {
|
||||||
typ = 'Option_$typ'
|
typ = 'Option_$typ'
|
||||||
p.table.register_type_with_parent(typ, 'Option')
|
p.table.register_type_with_parent(typ, 'Option')
|
||||||
if p.tok == .question {
|
|
||||||
p.next()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// Because the code uses * to see if it's a pointer
|
// Because the code uses * to see if it's a pointer
|
||||||
if typ == 'byteptr' {
|
if typ == 'byteptr' {
|
||||||
|
|
|
@ -154,17 +154,13 @@ fn (p mut Parser) get_type2() Type {
|
||||||
}
|
}
|
||||||
else if is_arr {
|
else if is_arr {
|
||||||
typ = 'array_$typ'
|
typ = 'array_$typ'
|
||||||
// p.log('ARR TYPE="$typ" run=$p.pass')
|
|
||||||
// We come across "[]User" etc ?
|
// We come across "[]User" etc ?
|
||||||
p.register_array(typ)
|
p.register_array(typ)
|
||||||
}
|
}
|
||||||
p.next()
|
p.next()
|
||||||
if p.tok == .question || is_question {
|
if is_question {
|
||||||
typ = 'Option_$typ'
|
typ = 'Option_$typ'
|
||||||
p.table.register_type_with_parent(typ, 'Option')
|
p.table.register_type_with_parent(typ, 'Option')
|
||||||
if p.tok == .question {
|
|
||||||
p.next()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if typ.last_index('__') > typ.index('__') {
|
if typ.last_index('__') > typ.index('__') {
|
||||||
p.error('2 __ in gettype(): typ="$typ"')
|
p.error('2 __ in gettype(): typ="$typ"')
|
||||||
|
|
|
@ -25,7 +25,7 @@ pub fn full_path_to_v() string {
|
||||||
return vexec
|
return vexec
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn run_repl_file(wd string, vexec string, file string) string? {
|
pub fn run_repl_file(wd string, vexec string, file string) ?string {
|
||||||
fcontent := os.read_file(file) or { return error('Could not read file $file') }
|
fcontent := os.read_file(file) or { return error('Could not read file $file') }
|
||||||
content := fcontent.replace('\r', '')
|
content := fcontent.replace('\r', '')
|
||||||
input := content.all_before('===output===\n')
|
input := content.all_before('===output===\n')
|
||||||
|
|
|
@ -9,7 +9,7 @@ import(
|
||||||
encoding.binary
|
encoding.binary
|
||||||
)
|
)
|
||||||
|
|
||||||
pub fn int_u64(max u64) u64? {
|
pub fn int_u64(max u64) ?u64 {
|
||||||
bitlen := bits.len64(max)
|
bitlen := bits.len64(max)
|
||||||
if bitlen == 0 {
|
if bitlen == 0 {
|
||||||
return u64(0)
|
return u64(0)
|
||||||
|
|
|
@ -206,7 +206,7 @@ pub fn dial(address string, port int) ?Socket {
|
||||||
}
|
}
|
||||||
|
|
||||||
// send string data to socket
|
// send string data to socket
|
||||||
pub fn (s Socket) send(buf byteptr, len int) int? {
|
pub fn (s Socket) send(buf byteptr, len int) ?int {
|
||||||
res := int( C.send(s.sockfd, buf, len, 0) )
|
res := int( C.send(s.sockfd, buf, len, 0) )
|
||||||
if res < 0 {
|
if res < 0 {
|
||||||
return error('socket: send failed')
|
return error('socket: send failed')
|
||||||
|
|
Loading…
Reference in New Issue