feat: implement CLI for parser
This commit is contained in:
parent
d4b410bca9
commit
3aae08ffd4
@ -31,14 +31,18 @@ val cliParser = {
|
|||||||
|
|
||||||
def compile(contents: String): Int = {
|
def compile(contents: String): Int = {
|
||||||
parser.parse(contents) match {
|
parser.parse(contents) match {
|
||||||
case Success(x) => 0
|
case Success(ast) =>
|
||||||
case Failure(msg) => 100
|
// TODO: Do semantics things
|
||||||
|
0
|
||||||
|
case Failure(msg) =>
|
||||||
|
println(msg)
|
||||||
|
100
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
def main(args: Array[String]): Unit =
|
def main(args: Array[String]): Unit =
|
||||||
OParser.parse(cliParser, args, CliConfig()) match {
|
OParser.parse(cliParser, args, CliConfig()) match {
|
||||||
case Some(config) =>
|
case Some(config) =>
|
||||||
System.exit(scala.util.Random.between(0, 3) * 100)
|
System.exit(compile(os.read(os.Path(config.file.getAbsolutePath))))
|
||||||
case None =>
|
case None =>
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user