diff options
author | James Iry <jamesiry@gmail.com> | 2013-02-08 06:49:10 -0800 |
---|---|---|
committer | James Iry <jamesiry@gmail.com> | 2013-02-08 06:49:10 -0800 |
commit | abc87e25d9a8030ed65677df9b41f302025c1717 (patch) | |
tree | dec411c97d84b22ad2d18d03dd0ba77cc58e6bda /test/files | |
parent | 9164c2af4183e04986eb652e09081daba3d0d279 (diff) | |
parent | 6052e19292c95270ac0a4bf30b6df47a257f88d4 (diff) | |
download | scala-abc87e25d9a8030ed65677df9b41f302025c1717.tar.gz scala-abc87e25d9a8030ed65677df9b41f302025c1717.tar.bz2 scala-abc87e25d9a8030ed65677df9b41f302025c1717.zip |
Merge pull request #2091 from JamesIry/2.10.x_SI-6478
[backport] SI-6478 Fixing JavaTokenParser ident
Diffstat (limited to 'test/files')
-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") + } +} |