typst-0.7: test/typ/compiler/string-15.out
--- parse tree ---
[ Code
"typ/compiler/string-15.typ"
( line 1 , column 2 )
(Let
(BasicBind (Just (Identifier "test")))
(FuncExpr
[ NormalParam (Identifier "x") , NormalParam (Identifier "y") ]
(Block
(CodeBlock
[ If
[ ( Equals (Ident (Identifier "x")) (Ident (Identifier "y"))
, Block (Content [ Text "\9989" ])
)
, ( Literal (Boolean True)
, Block
(Content
[ Text "\10060"
, Text "("
, Code
"typ/compiler/string-15.typ"
( line 1 , column 47 )
(FuncCall
(Ident (Identifier "repr"))
[ NormalArg (Ident (Identifier "x")) ])
, Space
, Text "/"
, Text "="
, Space
, Code
"typ/compiler/string-15.typ"
( line 1 , column 59 )
(FuncCall
(Ident (Identifier "repr"))
[ NormalArg (Ident (Identifier "y")) ])
, Text ")"
])
)
]
]))))
, SoftBreak
, Comment
, SoftBreak
, Code
"typ/compiler/string-15.typ"
( line 4 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace")) (Literal (String "abc")))
[ NormalArg
(FuncCall
(Ident (Identifier "regex"))
[ NormalArg (Literal (String "[a-z]")) ])
, NormalArg
(FuncExpr
[ NormalParam (Identifier "m") ]
(Block
(CodeBlock
[ Plus
(Plus
(FuncCall
(Ident (Identifier "str"))
[ NormalArg
(FieldAccess
(Ident (Identifier "start")) (Ident (Identifier "m")))
])
(FieldAccess
(Ident (Identifier "text")) (Ident (Identifier "m"))))
(FuncCall
(Ident (Identifier "str"))
[ NormalArg
(FieldAccess
(Ident (Identifier "end")) (Ident (Identifier "m")))
])
])))
])
, NormalArg (Literal (String "0a11b22c3"))
])
, SoftBreak
, Code
"typ/compiler/string-15.typ"
( line 7 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace")) (Literal (String "abcd, efgh")))
[ NormalArg
(FuncCall
(Ident (Identifier "regex"))
[ NormalArg (Literal (String "\\w+")) ])
, NormalArg
(FuncExpr
[ NormalParam (Identifier "m") ]
(Block
(CodeBlock
[ FuncCall
(Ident (Identifier "upper"))
[ NormalArg
(FieldAccess
(Ident (Identifier "text")) (Ident (Identifier "m")))
]
])))
])
, NormalArg (Literal (String "ABCD, EFGH"))
])
, SoftBreak
, Code
"typ/compiler/string-15.typ"
( line 10 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace")) (Literal (String "hello : world")))
[ NormalArg
(FuncCall
(Ident (Identifier "regex"))
[ NormalArg (Literal (String "^(.+)\\s*(:)\\s*(.+)$")) ])
, NormalArg
(FuncExpr
[ NormalParam (Identifier "m") ]
(Block
(CodeBlock
[ Plus
(Plus
(Plus
(FuncCall
(Ident (Identifier "upper"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "at"))
(FieldAccess
(Ident (Identifier "captures"))
(Ident (Identifier "m"))))
[ NormalArg (Literal (Int 0)) ])
])
(FuncCall
(FieldAccess
(Ident (Identifier "at"))
(FieldAccess
(Ident (Identifier "captures"))
(Ident (Identifier "m"))))
[ NormalArg (Literal (Int 1)) ]))
(Literal (String " ")))
(FuncCall
(Ident (Identifier "upper"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "at"))
(FieldAccess
(Ident (Identifier "captures"))
(Ident (Identifier "m"))))
[ NormalArg (Literal (Int 2)) ])
])
])))
])
, NormalArg (Literal (String "HELLO : WORLD"))
])
, SoftBreak
, Code
"typ/compiler/string-15.typ"
( line 13 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace"))
(Literal (String "hello world, lorem ipsum")))
[ NormalArg
(FuncCall
(Ident (Identifier "regex"))
[ NormalArg (Literal (String "(\\w+) (\\w+)")) ])
, NormalArg
(FuncExpr
[ NormalParam (Identifier "m") ]
(Block
(CodeBlock
[ Plus
(Plus
(FuncCall
(FieldAccess
(Ident (Identifier "at"))
(FieldAccess
(Ident (Identifier "captures"))
(Ident (Identifier "m"))))
[ NormalArg (Literal (Int 1)) ])
(Literal (String " ")))
(FuncCall
(FieldAccess
(Ident (Identifier "at"))
(FieldAccess
(Ident (Identifier "captures")) (Ident (Identifier "m"))))
[ NormalArg (Literal (Int 0)) ])
])))
])
, NormalArg (Literal (String "world hello, ipsum lorem"))
])
, SoftBreak
, Code
"typ/compiler/string-15.typ"
( line 16 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace"))
(Literal (String "hello world, lorem ipsum")))
[ NormalArg
(FuncCall
(Ident (Identifier "regex"))
[ NormalArg (Literal (String "(\\w+) (\\w+)")) ])
, KeyValArg (Identifier "count") (Literal (Int 1))
, NormalArg
(FuncExpr
[ NormalParam (Identifier "m") ]
(Block
(CodeBlock
[ Plus
(Plus
(FuncCall
(FieldAccess
(Ident (Identifier "at"))
(FieldAccess
(Ident (Identifier "captures"))
(Ident (Identifier "m"))))
[ NormalArg (Literal (Int 1)) ])
(Literal (String " ")))
(FuncCall
(FieldAccess
(Ident (Identifier "at"))
(FieldAccess
(Ident (Identifier "captures")) (Ident (Identifier "m"))))
[ NormalArg (Literal (Int 0)) ])
])))
])
, NormalArg (Literal (String "world hello, lorem ipsum"))
])
, SoftBreak
, Code
"typ/compiler/string-15.typ"
( line 19 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace")) (Literal (String "123 456")))
[ NormalArg
(FuncCall
(Ident (Identifier "regex"))
[ NormalArg (Literal (String "[a-z]+")) ])
, NormalArg (Literal (String "a"))
])
, NormalArg (Literal (String "123 456"))
])
, ParBreak
, Code
"typ/compiler/string-15.typ"
( line 21 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace")) (Literal (String "abc")))
[ NormalArg (Literal (String ""))
, NormalArg
(FuncExpr [ NormalParam (Identifier "m") ] (Literal (String "-")))
])
, NormalArg (Literal (String "-a-b-c-"))
])
, SoftBreak
, Code
"typ/compiler/string-15.typ"
( line 22 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace")) (Literal (String "abc")))
[ NormalArg (Literal (String ""))
, NormalArg
(FuncExpr [ NormalParam (Identifier "m") ] (Literal (String "-")))
, KeyValArg (Identifier "count") (Literal (Int 1))
])
, NormalArg (Literal (String "-abc"))
])
, SoftBreak
, Code
"typ/compiler/string-15.typ"
( line 23 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace")) (Literal (String "123")))
[ NormalArg (Literal (String "abc"))
, NormalArg
(FuncExpr [ NormalParam (Identifier "m") ] (Literal (String "")))
])
, NormalArg (Literal (String "123"))
])
, SoftBreak
, Code
"typ/compiler/string-15.typ"
( line 24 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace")) (Literal (String "123")))
[ NormalArg (Literal (String "abc"))
, NormalArg
(FuncExpr [ NormalParam (Identifier "m") ] (Literal (String "")))
, KeyValArg (Identifier "count") (Literal (Int 2))
])
, NormalArg (Literal (String "123"))
])
, SoftBreak
, Code
"typ/compiler/string-15.typ"
( line 25 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace")) (Literal (String "a123b123c")))
[ NormalArg (Literal (String "123"))
, NormalArg
(FuncExpr
[ NormalParam (Identifier "m") ]
(Block
(CodeBlock
[ Plus
(Plus
(FuncCall
(Ident (Identifier "str"))
[ NormalArg
(FieldAccess
(Ident (Identifier "start")) (Ident (Identifier "m")))
])
(Literal (String "-")))
(FuncCall
(Ident (Identifier "str"))
[ NormalArg
(FieldAccess
(Ident (Identifier "end")) (Ident (Identifier "m")))
])
])))
])
, NormalArg (Literal (String "a1-4b5-8c"))
])
, SoftBreak
, Code
"typ/compiler/string-15.typ"
( line 28 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace")) (Literal (String "halla warld")))
[ NormalArg (Literal (String "a"))
, NormalArg
(FuncExpr
[ NormalParam (Identifier "m") ]
(Block
(CodeBlock
[ If
[ ( Equals
(FieldAccess
(Ident (Identifier "start")) (Ident (Identifier "m")))
(Literal (Int 1))
, Block (CodeBlock [ Literal (String "e") ])
)
, ( Or
(Equals
(FieldAccess
(Ident (Identifier "start")) (Ident (Identifier "m")))
(Literal (Int 4)))
(Equals
(FieldAccess
(Ident (Identifier "start")) (Ident (Identifier "m")))
(Literal (Int 7)))
, Block (CodeBlock [ Literal (String "o") ])
)
]
])))
])
, NormalArg (Literal (String "hello world"))
])
, SoftBreak
, Code
"typ/compiler/string-15.typ"
( line 32 , column 2 )
(FuncCall
(Ident (Identifier "test"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "replace")) (Literal (String "aaa")))
[ NormalArg (Literal (String "a"))
, NormalArg
(FuncExpr
[ NormalParam (Identifier "m") ]
(FuncCall
(Ident (Identifier "str"))
[ NormalArg
(FuncCall
(FieldAccess
(Ident (Identifier "len"))
(FieldAccess
(Ident (Identifier "captures")) (Ident (Identifier "m"))))
[])
]))
])
, NormalArg (Literal (String "000"))
])
, ParBreak
]
--- evaluated ---
document(body: { text(body: [
]),
text(body: [
]),
text(body: [✅]),
text(body: [
]),
text(body: [✅]),
text(body: [
]),
text(body: [✅]),
text(body: [
]),
text(body: [✅]),
text(body: [
]),
text(body: [✅]),
text(body: [
]),
text(body: [✅]),
parbreak(),
text(body: [✅]),
text(body: [
]),
text(body: [✅]),
text(body: [
]),
text(body: [✅]),
text(body: [
]),
text(body: [✅]),
text(body: [
]),
text(body: [✅]),
text(body: [
]),
text(body: [✅]),
text(body: [
]),
text(body: [✅]),
parbreak() })