Skip to content

Commit

Permalink
now supports printformatted booleans
Browse files Browse the repository at this point in the history
  • Loading branch information
jennyafish committed Jul 3, 2019
1 parent 503925f commit 9346460
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion examples/tsls/formatstring.wyv
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ def convStringAST(input : String, ctx : system.Context, floatPrecision : Int) :
val format : String = "%." + String.ofInt(floatPrecision) + "f"
option.Some[AST](ast.call(str, "ofFormattedFloat", {ast.string(format), exp}))
else
option.None[AST]()
if (ast.types.equals(ty, ast.types.boolean(), ctx))
option.Some[AST](ast.call(exp, "ifTrue", {ast.parseExpression("() => \"true\"", ctx), ast.parseExpression("() => \"false\"", ctx)}))
else
option.None[AST]()


def parseExpr(input : String, ctx : system.Context) : ParsedExpr
Expand Down
2 changes: 2 additions & 0 deletions examples/tsls/formatstringClient.wyv
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ printf(~)
val x = 3
printf(~)
%{x} %{4} %.5{1.6} %{1.7}

printf({%{1 == 2}%{true}})

0 comments on commit 9346460

Please sign in to comment.