diff options
author | James Roper <james@jazzy.id.au> | 2012-10-05 12:22:24 +1000 |
---|---|---|
committer | James Iry <jamesiry@gmail.com> | 2013-02-07 15:00:20 -0800 |
commit | 6052e19292c95270ac0a4bf30b6df47a257f88d4 (patch) | |
tree | 9e01e95923e20f2bb665826c492d3fc9f15b46d0 /test | |
parent | 0dd02d92a363ee13b13eb4536c938d24bb5dd98d (diff) | |
download | scala-6052e19292c95270ac0a4bf30b6df47a257f88d4.tar.gz scala-6052e19292c95270ac0a4bf30b6df47a257f88d4.tar.bz2 scala-6052e19292c95270ac0a4bf30b6df47a257f88d4.zip |
[backport] SI-6478 Fixing JavaTokenParser ident
Backport of 256934160007079f473131469af2df4d023c2cfc from PR
https://github.com/scala/scala/pull/1466
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/parserJavaIdent.check | 26 | ||||
-rw-r--r-- | test/files/run/parserJavaIdent.scala | 26 |
2 files changed, 52 insertions, 0 deletions
diff --git a/test/files/run/parserJavaIdent.check b/test/files/run/parserJavaIdent.check new file mode 100644 index 0000000000..597ddbee47 --- /dev/null +++ b/test/files/run/parserJavaIdent.check @@ -0,0 +1,26 @@ +[1.7] parsed: simple +[1.8] parsed: with123 +[1.6] parsed: with$ +[1.10] parsed: withøßöèæ +[1.6] parsed: with_ +[1.6] parsed: _with +[1.1] failure: java identifier expected + +3start +^ +[1.1] failure: java identifier expected + +-start +^ +[1.5] failure: java identifier expected + +with-s + ^ +[1.3] failure: java identifier expected + +we♥scala + ^ +[1.6] failure: java identifier expected + +with space + ^ diff --git a/test/files/run/parserJavaIdent.scala b/test/files/run/parserJavaIdent.scala new file mode 100644 index 0000000000..c068075e4e --- /dev/null +++ b/test/files/run/parserJavaIdent.scala @@ -0,0 +1,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") + } +} |