vfmt: make work with comptime
parent
23c0bb600c
commit
7c9279c447
|
@ -6,7 +6,7 @@ const (
|
|||
port = 8082
|
||||
)
|
||||
|
||||
pub struct App {
|
||||
struct App {
|
||||
pub mut:
|
||||
vweb vweb.Context // TODO embed
|
||||
cnt int
|
||||
|
|
|
@ -359,7 +359,6 @@ pub fn (mut f Fmt) stmt(node ast.Stmt) {
|
|||
f.stmts(it.stmts)
|
||||
f.writeln('}')
|
||||
}
|
||||
ast.ComptimeCall {}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -539,6 +538,7 @@ pub fn (mut f Fmt) expr(node ast.Expr) {
|
|||
ast.CharLiteral {
|
||||
f.write('`$it.val`')
|
||||
}
|
||||
ast.ComptimeCall {}
|
||||
ast.ConcatExpr {
|
||||
for i, val in it.vals {
|
||||
if i != 0 {
|
||||
|
|
|
@ -55,6 +55,7 @@ fn (mut p Parser) hash() ast.HashStmt {
|
|||
}
|
||||
|
||||
fn (mut p Parser) vweb() ast.ComptimeCall {
|
||||
p.check(.dollar)
|
||||
p.check(.name) // skip `vweb.html()` TODO
|
||||
p.check(.dot)
|
||||
p.check(.name)
|
||||
|
|
|
@ -386,13 +386,7 @@ pub fn (mut p Parser) top_stmt() ast.Stmt {
|
|||
return p.struct_decl()
|
||||
}
|
||||
.dollar {
|
||||
if p.peek_tok.kind == .key_if {
|
||||
return p.comp_if()
|
||||
} else if p.peek_tok.kind == .name {
|
||||
return ast.ExprStmt{
|
||||
expr: p.vweb()
|
||||
}
|
||||
}
|
||||
}
|
||||
.hash {
|
||||
return p.hash()
|
||||
|
@ -501,7 +495,13 @@ pub fn (mut p Parser) stmt() ast.Stmt {
|
|||
return p.return_stmt()
|
||||
}
|
||||
.dollar {
|
||||
if p.peek_tok.kind == .key_if {
|
||||
return p.comp_if()
|
||||
} else if p.peek_tok.kind == .name {
|
||||
return ast.ExprStmt{
|
||||
expr: p.vweb()
|
||||
}
|
||||
}
|
||||
}
|
||||
.key_continue, .key_break {
|
||||
tok := p.tok
|
||||
|
|
|
@ -283,9 +283,12 @@ fn handle_conn<T>(conn net.Socket, app mut T) {
|
|||
$if debug {
|
||||
println('action=$action')
|
||||
}
|
||||
app.$action()
|
||||
/*
|
||||
app.$action() or {
|
||||
conn.send_string(http_404) or {}
|
||||
}
|
||||
*/
|
||||
conn.close() or {}
|
||||
app.reset()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue