parser: fix a small bug with <

pull/4967/head
Alexander Medvednikov 2020-05-20 21:47:03 +02:00
parent 82cedbaf62
commit ca81442fac
3 changed files with 6 additions and 6 deletions

View File

@ -25,7 +25,7 @@ fn test_socket() {
received := tos(bytes, blen)
$if debug { println('message received: $received') }
$if debug { println('client: $client.sockfd') }
assert message == received
cleanup(server, client, socket)
}
@ -39,7 +39,7 @@ fn test_socket_write() {
assert line1.trim_space() == message1
cleanup(server, client, socket)
}
fn test_socket_write_fail_without_panic() {
server, client, socket := setup()
message2 := 'a message 2'
@ -48,7 +48,7 @@ fn test_socket_write_fail_without_panic() {
// this test is important for a stable long standing server
client.close() or {}
$if solaris { return } // TODO: fix segfaulting on Solaris
for i:=0; i<3; i++{
for i:=0; i<3; i++ {
socket.write(message2) or {
println('write to a socket without a recipient should produce an option fail: $err | $message2')
assert true

View File

@ -803,8 +803,8 @@ pub fn (mut p Parser) name_expr() ast.Expr {
}
// p.warn('name expr $p.tok.lit $p.peek_tok.str()')
// fn call or type cast
if p.peek_tok.kind == .lpar || (p.peek_tok.kind == .lt && p.peek_tok.pos == p.peek_tok2.pos -
1) { // foo() or foo<int>()
if p.peek_tok.kind == .lpar || (p.peek_tok.kind == .lt && p.peek_tok2.kind == .name &&
p.peek_tok.pos == p.peek_tok2.pos - 1) { // foo() or foo<int>()
mut name := p.tok.lit
if mod.len > 0 {
name = '${mod}.$name'

View File

@ -2,7 +2,7 @@ import os
fn main() {
areas := ['game', 'web', 'tools', 'science', 'systems', 'embedded']
for i :=0;i<areas.len; i++{
for i :=0; i < areas.len; i++{
area:=areas[i]
println('Hello, $area developers!')
}