diff options
author | lihaoyi <haoyi.sg@gmail.com> | 2014-11-25 03:20:29 -0800 |
---|---|---|
committer | lihaoyi <haoyi.sg@gmail.com> | 2014-11-25 03:20:29 -0800 |
commit | e6a71476fed976ea2a55a03b764caad364444452 (patch) | |
tree | 1e08048bcad42185037ed1bf6faf3ab2a3e13397 | |
parent | 84a654dad942f117f536b7ac2c504dc163c26c34 (diff) | |
download | hands-on-scala-js-e6a71476fed976ea2a55a03b764caad364444452.tar.gz hands-on-scala-js-e6a71476fed976ea2a55a03b764caad364444452.tar.bz2 hands-on-scala-js-e6a71476fed976ea2a55a03b764caad364444452.zip |
works
-rw-r--r-- | build.sbt | 3 | ||||
-rw-r--r-- | scalatexApi/src/main/scala/scalatex/stages/Parser.scala | 8 |
2 files changed, 6 insertions, 5 deletions
@@ -13,7 +13,8 @@ lazy val scalaParser = project.in(file("scalaParser")).settings( testFrameworks += new TestFramework("utest.runner.JvmFramework") ) lazy val scalatexApi = project.in(file("scalatexApi")) - .settings( + .dependsOn(scalaParser) + .settings( scalaVersion := "2.11.4", libraryDependencies ++= Seq( "com.lihaoyi" %% "utest" % "0.2.4", diff --git a/scalatexApi/src/main/scala/scalatex/stages/Parser.scala b/scalatexApi/src/main/scala/scalatex/stages/Parser.scala index 479b786..0b87d97 100644 --- a/scalatexApi/src/main/scala/scalatex/stages/Parser.scala +++ b/scalatexApi/src/main/scala/scalatex/stages/Parser.scala @@ -15,7 +15,7 @@ object Parser extends ((String, Int) => Ast.Block){ new Parser(input, offset).Body.run().get } } -class Parser(input: ParserInput, indent: Int = 0, offset: Int = 0) extends ScalaSyntax(input) { +class Parser(input: ParserInput, indent: Int = 0, offset: Int = 0) extends scalaParser.ScalaSyntax(input) { def offsetCursor = offset + cursor val txt = input.sliceString(0, input.length) val indentTable = txt.split('\n').map{ s => @@ -41,7 +41,7 @@ class Parser(input: ParserInput, indent: Int = 0, offset: Int = 0) extends Scala "@" ~ capture(Identifiers.Id | BlockExpr2 | ('(' ~ optional(Exprs) ~ ')')) } def Header = rule { - "@" ~ capture(Def(false) | Import(false)) + "@" ~ capture(Def | Import) } def HeaderBlock: Rule1[Ast.Header] = rule{ @@ -65,7 +65,7 @@ class Parser(input: ParserInput, indent: Int = 0, offset: Int = 0) extends Scala test(cursorNextIndent() > indent) ~ runSubParser(new Parser(_, cursorNextIndent(), cursor).Body) } - def IfHead = rule{ "@" ~ capture("if" ~ "(" ~ Expr() ~ ")") } + def IfHead = rule{ "@" ~ capture("if" ~ "(" ~ Expr ~ ")") } def IfElse1 = rule{ push(offsetCursor) ~ IfHead ~ BraceBlock ~ optional("else" ~ (BraceBlock | IndentBlock)) } @@ -104,7 +104,7 @@ class Parser(input: ParserInput, indent: Int = 0, offset: Int = 0) extends Scala def TypeArgs2 = rule { '[' ~ Ws ~ Types ~ ']' } def ArgumentExprs2 = rule { '(' ~ Ws ~ - (optional(Exprs ~ ',' ~ Ws) ~ PostfixExpr() ~ ':' ~ Ws ~ '_' ~ Ws ~ '*' ~ Ws | optional(Exprs) ) ~ + (optional(Exprs ~ ',' ~ Ws) ~ PostfixExpr ~ ':' ~ Ws ~ '_' ~ Ws ~ '*' ~ Ws | optional(Exprs) ) ~ ')' } def BlockExpr2: Rule0 = rule { '{' ~ Ws ~ (CaseClauses | Block) ~ Ws ~ '}' } |