v/vlib/v/parser/comptime.v

25 lines
359 B
V
Raw Normal View History

2020-02-10 14:42:57 +01:00
module parser
2020-02-17 14:15:42 +01:00
import (
v.ast
)
pub fn (p mut Parser) comp_if() ast.CompIf {
p.next()
p.check(.key_if)
if p.tok.kind == .not {
p.next()
}
p.check_name()
if p.tok.kind == .question {
p.next()
}
p.parse_block()
if p.tok.kind == .dollar && p.peek_tok.kind == .key_else {
p.next()
p.check(.key_else)
p.parse_block()
}
return ast.CompIf{}
}