Compare commits
2 Commits
f1a998c25b
...
19398a93e6
Author | SHA1 | Date | |
---|---|---|---|
19398a93e6 | |||
7f2c1c888d |
@ -1,4 +1,4 @@
|
|||||||
<head>
|
<head>
|
||||||
<title>#(title)</title>
|
<title>#(title)</title>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.0/css/bulma.min.css">
|
||||||
</head>
|
</head>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>#(title)</title>
|
<title>#(title)</title>
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@0.9.4/css/bulma.min.css">
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bulma@1.0.0/css/bulma.min.css">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav class="navbar is-dark">
|
<nav class="navbar is-dark">
|
||||||
|
@ -1,16 +1,20 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
|
||||||
<title>#(page.Title)</title>
|
<head>
|
||||||
</head>
|
<title>#(page.Title)</title>
|
||||||
<body>
|
</head>
|
||||||
#for(i, user in users):
|
|
||||||
<div>
|
<body>
|
||||||
<h2>#(toLower(user.Name))</h2>
|
#for(i, user in users):
|
||||||
<p>User ID: #(i)</p>
|
<div>
|
||||||
#if(user.LoggedIn): <p>This user is logged in</p> #!if
|
<h2>#(toLower(user.Name))</h2>
|
||||||
#if(user.IsAdmin): <p>This user is an admin!</p> #!if
|
<p>User ID: #(i)</p>
|
||||||
<p>Registered: #(user.RegisteredTime.Format("01-02-2006"))</p>
|
#(user.LoggedIn ? "hi" : "haii :3")
|
||||||
</div>
|
#if(user.LoggedIn): <p>This user is logged in</p> #!if
|
||||||
#!for
|
#if(user.IsAdmin): <p>This user is an admin!</p> #!if
|
||||||
</body>
|
<p>Registered: #(user.RegisteredTime.Format("01-02-2006"))</p>
|
||||||
|
</div>
|
||||||
|
#!for
|
||||||
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
888
parser/parser.go
888
parser/parser.go
File diff suppressed because it is too large
Load Diff
@ -83,8 +83,21 @@ ExprTag = '#' ignoreErr:'?'? '(' item:Expr ')' {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
Expr = Ternary / Assignment / LogicalExpr
|
Expr = Assignment / TernaryExpr
|
||||||
Assignable = Ternary / LogicalExpr
|
Assignable = TernaryExpr
|
||||||
|
|
||||||
|
TernaryExpr = _ cond:LogicalExpr vals:(_ '?' _ Value _ ':' _ Value)? {
|
||||||
|
if vals == nil {
|
||||||
|
return cond, nil
|
||||||
|
} else {
|
||||||
|
s := toAnySlice(vals)
|
||||||
|
return ast.Ternary{
|
||||||
|
Condition: cond.(ast.Node),
|
||||||
|
IfTrue: s[3].(ast.Node),
|
||||||
|
Else: s[7].(ast.Node),
|
||||||
|
}, nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
LogicalExpr = _ first:ComparisonExpr rest:(_ LogicalOp _ ComparisonExpr)* _ {
|
LogicalExpr = _ first:ComparisonExpr rest:(_ LogicalOp _ ComparisonExpr)* _ {
|
||||||
return toExpr(c, first, rest), nil
|
return toExpr(c, first, rest), nil
|
||||||
@ -174,14 +187,6 @@ Assignment = name:Ident _ '=' _ value:Assignable {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
Ternary = cond:Assignable _ '?' _ ifTrue:Value _ ':' _ elseVal:Value {
|
|
||||||
return ast.Ternary{
|
|
||||||
Condition: cond.(ast.Node),
|
|
||||||
IfTrue: ifTrue.(ast.Node),
|
|
||||||
Else: elseVal.(ast.Node),
|
|
||||||
}, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
MethodCall = value:Value '.' name:Ident params:ParamList {
|
MethodCall = value:Value '.' name:Ident params:ParamList {
|
||||||
return ast.MethodCall{
|
return ast.MethodCall{
|
||||||
Value: value.(ast.Node),
|
Value: value.(ast.Node),
|
||||||
|
Loading…
Reference in New Issue
Block a user