Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit98737a2

Browse files
committed
Add support for Scala.js, with cross-compilation.
Scala versions were upgraded to 2.11.7 and 2.12.0-M3.2.12 is only used when running the build on JDK8 or later.JavaTokenParsers.identifier was rewritten not to use a regexp,but rather primitive parsers andCharacter.isJavaIdentifier{Start,Part}. The regexp-basedimplementation relies on Java-specific character ranges.JavaTokenParsers.stringLiteral was slightly adapted with anexpansion of `\p{Cntrl}` into `[\x00-\x1F\x7F]`. The formercharacter range is Java-specific. We also removed an invalid(and useless) `+` at the end of the regexp.The test t4929.scala is JVM-only.
1 parentfd09708 commit98737a2

File tree

40 files changed

+63
-28
lines changed

40 files changed

+63
-28
lines changed

‎.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ script: admin/build.sh
1919
jdk:
2020
-openjdk6
2121
-openjdk7
22+
-oraclejdk8
2223

2324
notifications:
2425
email:

‎build.sbt

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,49 @@
11

2-
scalaModuleSettings
3-
4-
name:="scala-parser-combinators"
5-
6-
version:="1.1.0-SNAPSHOT"
7-
8-
scalaVersion:= crossScalaVersions.value.head
9-
10-
crossScalaVersions:=Seq("2.11.6","2.12.0-M1")
11-
12-
// important!! must come here (why?)
13-
scalaModuleOsgiSettings
14-
15-
OsgiKeys.exportPackage:=Seq(s"scala.util.parsing.*;version=${version.value}")
16-
17-
// needed to fix classloader issues (see scala-xml#20)
18-
fork inTest:=true
19-
20-
libraryDependencies+="junit"%"junit"%"4.11"%"test"
21-
22-
libraryDependencies+="com.novocode"%"junit-interface"%"0.10"%"test"
23-
24-
mimaPreviousVersion:=None
2+
crossScalaVersions inThisBuild:= {
3+
valjavaVersion=System.getProperty("java.version")
4+
valisJDK6Or7=
5+
javaVersion.startsWith("1.6.")|| javaVersion.startsWith("1.7.")
6+
if (isJDK6Or7)
7+
Seq("2.11.7")
8+
else
9+
Seq("2.11.7","2.12.0-M3")
10+
}
11+
12+
lazyval`scala-parser-combinators`= crossProject.in(file(".")).
13+
settings(scalaModuleSettings:_*).
14+
jvmSettings(
15+
name:="scala-parser-combinators-jvm"
16+
).
17+
jsSettings(
18+
name:="scala-parser-combinators-js"
19+
).
20+
settings(
21+
moduleName:="scala-parser-combinators",
22+
version:="1.1.0-SNAPSHOT",
23+
scalaVersion:= crossScalaVersions.value.head
24+
).
25+
jvmSettings(
26+
// important!! must come here (why?)
27+
scalaModuleOsgiSettings:_*
28+
).
29+
jvmSettings(
30+
OsgiKeys.exportPackage:=Seq(s"scala.util.parsing.*;version=${version.value}"),
31+
32+
// needed to fix classloader issues (see scala-xml#20)
33+
fork inTest:=true
34+
).
35+
jsSettings(
36+
// Scala.js cannot run forked tests
37+
fork inTest:=false
38+
).
39+
jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)).
40+
jvmSettings(
41+
libraryDependencies+="junit"%"junit"%"4.11"%"test",
42+
libraryDependencies+="com.novocode"%"junit-interface"%"0.10"%"test"
43+
).
44+
settings(
45+
mimaPreviousVersion:=None
46+
)
47+
48+
lazyval`scala-parser-combinatorsJVM`= `scala-parser-combinators`.jvm
49+
lazyval`scala-parser-combinatorsJS`= `scala-parser-combinators`.js

‎project/plugins.sbt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
addSbtPlugin("org.scala-lang.modules"%"scala-module-plugin"%"1.0.3")
2+
3+
addSbtPlugin("org.scala-js"%"sbt-scalajs"%"0.6.6")

‎src/main/scala/scala/util/parsing/combinator/JavaTokenParsers.scalarenamed to ‎shared/src/main/scala/scala/util/parsing/combinator/JavaTokenParsers.scala

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,12 @@ trait JavaTokenParsers extends RegexParsers {
2626
* <a href="http://docs.oracle.com/javase/specs/jls/se7/html/jls-3.html#jls-3.8">The Java Language Spec</a>.
2727
* Generally, this means a letter, followed by zero or more letters or numbers.
2828
*/
29-
defident:Parser[String]=
30-
"""\p{javaJavaIdentifierStart}\p{javaJavaIdentifierPart}*""".r
29+
defident:Parser[String]= (
30+
""~>// handle whitespace
31+
rep1(acceptIf(Character.isJavaIdentifierStart)("identifier expected but `"+ _+"' found"),
32+
elem("identifier part",Character.isJavaIdentifierPart(_:Char)))^^ (_.mkString)
33+
)
34+
3135
/** An integer, without sign or with a negative sign.*/
3236
defwholeNumber:Parser[String]=
3337
"""-?\d+""".r
@@ -49,7 +53,7 @@ trait JavaTokenParsers extends RegexParsers {
4953
*/
5054
@migration("`stringLiteral` allows escaping single and double quotes, but not forward slashes any longer.","2.10.0")
5155
defstringLiteral:Parser[String]=
52-
("\""+"""([^"\p{Cntrl}\\]|\\[\\'"bfnrt]|\\u[a-fA-F0-9]{4})*+"""+"\"").r
56+
("\""+"""([^"\x00-\x1F\x7F\\]|\\[\\'"bfnrt]|\\u[a-fA-F0-9]{4})*"""+"\"").r
5357
/** A number following the rules of `decimalNumber`, with the following
5458
* optional additions:
5559
*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp