summaryrefslogtreecommitdiff
path: root/scalaParser/src/main/scala/scalaParser/ScalaSyntax.scala
diff options
context:
space:
mode:
authorLi Haoyi <haoyi@dropbox.com>2014-11-28 05:53:12 -0800
committerLi Haoyi <haoyi@dropbox.com>2014-11-28 05:53:12 -0800
commit097b5f24938bfb59471da7415be6523a7dfa03f9 (patch)
tree7c35807ee3b3d65a26c3ce6503af53e38e6cb1f6 /scalaParser/src/main/scala/scalaParser/ScalaSyntax.scala
parentc2b5d4125f2b868399828281fb8e53e35be6e0f6 (diff)
downloadhands-on-scala-js-097b5f24938bfb59471da7415be6523a7dfa03f9.tar.gz
hands-on-scala-js-097b5f24938bfb59471da7415be6523a7dfa03f9.tar.bz2
hands-on-scala-js-097b5f24938bfb59471da7415be6523a7dfa03f9.zip
Down to js.Function...
Diffstat (limited to 'scalaParser/src/main/scala/scalaParser/ScalaSyntax.scala')
-rw-r--r--scalaParser/src/main/scala/scalaParser/ScalaSyntax.scala13
1 files changed, 8 insertions, 5 deletions
diff --git a/scalaParser/src/main/scala/scalaParser/ScalaSyntax.scala b/scalaParser/src/main/scala/scalaParser/ScalaSyntax.scala
index 9909e8f..7770bca 100644
--- a/scalaParser/src/main/scala/scalaParser/ScalaSyntax.scala
+++ b/scalaParser/src/main/scala/scalaParser/ScalaSyntax.scala
@@ -112,7 +112,7 @@ class ScalaSyntax(val input: ParserInput) extends Parser with Basic with Identif
}
}
def AnnotType = rule {
- SimpleType ~ zeroOrMore(Annotation)
+ SimpleType ~ optional(NotNewline ~ oneOrMore(Annotation))
}
def SimpleType: R0 = {
def BasicType: R0 = rule {
@@ -132,8 +132,11 @@ class ScalaSyntax(val input: ParserInput) extends Parser with Basic with Identif
def TypePat = rule { CompoundType }
+ def FunctionArgTypes = rule {
+ InfixType | '(' ~ optional(oneOrMore(ParamType) separatedBy ',') ~ ')'
+ }
def Ascription = rule {
- ":" ~ ("_" ~ "*" | InfixType | oneOrMore(Annotation))
+ ":" ~ ("_" ~ "*" | InfixType | oneOrMore(Annotation))
}
def ParamType = rule { K.O("=>") ~ Type | Type ~ "*" | Type }
@@ -147,7 +150,7 @@ class ScalaSyntax(val input: ParserInput) extends Parser with Basic with Identif
(
Bindings |
optional(K.W("implicit")) ~ Id ~ optional(Ascription) |
- "_" ~ optional(Ascription)
+ K.W("_") ~ optional(Ascription)
) ~
K.O("=>")
}
@@ -224,7 +227,7 @@ class ScalaSyntax(val input: ParserInput) extends Parser with Basic with Identif
rule {
SimpleExpr1 ~
zeroOrMore('.' ~ Id | TypeArgs | ArgumentExprs) ~
- optional( "_")
+ optional(K.W("_"))
}
}
@@ -360,7 +363,7 @@ class ScalaSyntax(val input: ParserInput) extends Parser with Basic with Identif
def Import: R0 = {
def ImportExpr: R0 = rule {
- StableId ~ optional('.' ~ ("_" | ImportSelectors))
+ StableId ~ optional('.' ~ (K.W("_") | ImportSelectors))
}
def ImportSelectors: R0 = rule { '{' ~ zeroOrMore(ImportSelector ~ ',') ~ (ImportSelector | K.W("_")) ~ "}" }
def ImportSelector: R0 = rule { Id ~ optional(K.O("=>") ~ (Id | K.W("_"))) }