Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
using peg
using util
class FileExample : AbstractMain
{
@Arg { help="grammar text file" }
File? g
@Arg { help="input file" }
File? in
@Opt { help="how many times to parse" }
Int n := 1
@Opt { help="uses list handler (NullHandler is used otherwise)" }
Bool list := false
override Int run() {
grammar := Grammar.fromStr(g.readAllStr)
input := in.mmap
m := Match.unknown
echo("Preparation finished")
start := Duration.now
n.times {
input.seek(0)
h := list ? ListHandler() : NullHandler()
echo("Handler type: $h.typeof")
p := Parser(grammar, h).run(input)
m = p.match
}
d := Duration.now - start
echo("Match: $m")
echo("Duration: $d.toLocale (${d.toMillis}ms)")
return 0
}
}