summaryrefslogtreecommitdiff
path: root/test/files/run/parserJavaIdent.scala
blob: c068075e4e1b001485ce25e9624975854b9c3997 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
object Test extends scala.util.parsing.combinator.JavaTokenParsers {

    def test[A](s: String) {
      val res = parseAll(ident, s) match {
        case Failure(_, in) => Failure("java identifier expected", in)
        case o => o
      }
      println(res)
    }

    def main(args: Array[String]) {
      // Happy tests
      test("simple")
      test("with123")
      test("with$")
      test("withøßöèæ")
      test("with_")
      test("_with")
      // Sad tests
      test("3start")
      test("-start")
      test("with-s")
      test("we♥scala")
      test("with space")
    }
}