Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scala/scala-parser-combinators
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.0.6
Choose a base ref
...
head repository: scala/scala-parser-combinators
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1.0.x
Choose a head ref

Commits on May 2, 2017

  1. Copy the full SHA
    0982f5e View commit details
  2. Merge pull request #114 from gourlaysama/bump4

    Update scala version in README and build.sbt
    gourlaysama authored May 2, 2017
    Copy the full SHA
    2cb29f8 View commit details

Commits on Jul 11, 2017

  1. Update to sbt-scala-module 1.0.12

    Add osgi settings only to the `JVM` project. In the JS project they
    caused the resulting jar to be empty.
    
    Fixes #119
    
    Adds MiMa checking to the JS jar.
    
    Minor cleanups in the build definition.
    lrytz committed Jul 11, 2017
    Copy the full SHA
    39f303c View commit details

Commits on Jul 17, 2017

  1. Merge pull request #120 from lrytz/sbt-osgi-0.9.1

    Update to sbt-scala-module 1.0.12
    gourlaysama authored Jul 17, 2017
    Copy the full SHA
    8414ba2 View commit details
  2. Fix build anme to scala-parser-combinators

    The sbt plugin sets `repoName := name.value`, not the other way around.
    lrytz committed Jul 17, 2017
    Copy the full SHA
    bbb18fb View commit details
  3. Initial support for Scala Native

    Antonio Alonso Dominguez committed Jul 17, 2017
    Copy the full SHA
    1d73570 View commit details
  4. Setup travis for native compilation

    Antonio Alonso Dominguez committed Jul 17, 2017
    Copy the full SHA
    1d825f6 View commit details
  5. Run Precise on TravisCI

    Antonio Alonso Dominguez committed Jul 17, 2017
    Copy the full SHA
    0cf4ce6 View commit details
  6. Upgrade Scala Native

    Antonio Alonso Dominguez committed Jul 17, 2017
    Copy the full SHA
    ee2513f View commit details
  7. Skip compilation in Java 6

    Antonio Alonso Dominguez committed Jul 17, 2017
    Copy the full SHA
    fed1867 View commit details
  8. Run Travis build in Trusty

    Antonio Alonso Dominguez committed Jul 17, 2017
    Copy the full SHA
    31895c5 View commit details
  9. Configure Travis via a script

    Antonio Alonso Dominguez committed Jul 17, 2017
    Copy the full SHA
    ed16889 View commit details
  10. Run on Trusty

    Antonio Alonso Dominguez committed Jul 17, 2017
    Copy the full SHA
    4f28290 View commit details
  11. Remove Scala Native dependencies when not in Scala 2.11

    Antonio Alonso Dominguez committed Jul 17, 2017
    Copy the full SHA
    7370390 View commit details

Commits on Jul 19, 2017

  1. Merge pull request #121 from lrytz/build-name-fix

    Fix build anme to scala-parser-combinators
    gourlaysama authored Jul 19, 2017
    Copy the full SHA
    ecb0d4e View commit details

Commits on Jul 28, 2017

  1. Copy the full SHA
    dc35849 View commit details
  2. Merge pull request #123 from gourlaysama/bump-scala-version

    Move to scala 2.12.3 & 2.13.0-M2
    gourlaysama authored Jul 28, 2017
    Copy the full SHA
    615b70f View commit details

Commits on Jul 30, 2017

  1. Merge branch '1.0.x' into native

    A. Alonso Dominguez authored Jul 30, 2017
    Copy the full SHA
    c70911d View commit details

Commits on Jul 31, 2017

  1. Merge pull request #118 from alonsodomin/native

    Support for Scala Native
    gourlaysama authored Jul 31, 2017
    Copy the full SHA
    fd760fc View commit details

Commits on Aug 21, 2017

  1. Fix 2.12 release badge

    gourlaysama committed Aug 21, 2017
    Copy the full SHA
    59e13ca View commit details
  2. Merge pull request #125 from gourlaysama/fix-badge

    Fix 2.12 release badge
    gourlaysama authored Aug 21, 2017
    Copy the full SHA
    21aa25a View commit details

Commits on Oct 10, 2017

  1. Copy the full SHA
    ffaec27 View commit details

Commits on Oct 19, 2017

  1. Copy the full SHA
    90ea0dd View commit details
  2. Merge pull request #131 from SethTisue/travis-openjdk6-fix

    Travis makes us work harder now to actually get OpenJDK 6
    SethTisue authored Oct 19, 2017
    Copy the full SHA
    daf9fe2 View commit details

Commits on Nov 4, 2017

  1. Fix js and native project names

    sbt-crossproject already handles that, but naming them by hand changed
    the name of the produced artifacts
    (`scala-parser-combinators-js_sjs0.6_2.12-...`).
    gourlaysama committed Nov 4, 2017
    Copy the full SHA
    16b7c0c View commit details

Commits on Nov 6, 2017

  1. Copy the full SHA
    18e1a75 View commit details
  2. Merge pull request #132 from gourlaysama/fix-native-support

    Fix js/native support & bump sbt and plugins versions
    gourlaysama authored Nov 6, 2017
    Copy the full SHA
    1f108e5 View commit details

Commits on Jan 31, 2018

  1. Revert "Merge pull request #118 from alonsodomin/native"

    This reverts commit fd760fc, reversing
    changes made to 615b70f.
    
     Conflicts:
    	build.sbt
    	project/plugins.sbt
    gourlaysama committed Jan 31, 2018
    Copy the full SHA
    ba11bea View commit details
  2. Copy the full SHA
    853697c View commit details
  3. Merge pull request #135 from gourlaysama/revert-scala-native

    Revert scala native support
    gourlaysama authored Jan 31, 2018
    Copy the full SHA
    f225fb0 View commit details

Commits on Feb 1, 2018

  1. Copy the full SHA
    fff8f8f View commit details
  2. Merge pull request #137 from SethTisue/bump-versions

    bump various version numbers
    gourlaysama authored Feb 1, 2018
    Copy the full SHA
    dc88d4d View commit details

Commits on Jun 9, 2018

  1. Merge pull request #129 from justinp/1.0.x

    #128: prevent OutOfBoundsException on trailing newline
    SethTisue authored Jun 9, 2018
    Copy the full SHA
    c7b62dc View commit details

Commits on May 9, 2019

  1. allow JDK 11 build

    SethTisue committed May 9, 2019
    Copy the full SHA
    23a8cba View commit details

Commits on Oct 23, 2019

  1. allow JDK 13/14 build

    note that the Travis-CI changes don't make the JDK 6 build
    work, but they do allow the JDK 8 one to run
    SethTisue committed Oct 23, 2019
    Copy the full SHA
    d99be7e View commit details
  2. Merge pull request #246 from SethTisue/allow-building-on-jdk14

    allow JDK 13/14 build (on 1.0.x branch)
    SethTisue authored Oct 23, 2019
    Copy the full SHA
    c4c97ba View commit details
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -25,11 +25,11 @@ script: admin/build.sh

jdk:
- openjdk6
- oraclejdk8
- openjdk8

notifications:
email:
- adriaan.moors@typesafe.com
- adriaan.moors@lightbend.com
- antoine@gourlay.fr

before_cache:
6 changes: 3 additions & 3 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Copyright (c) 2002-2013 EPFL
Copyright (c) 2011-2013 Typesafe, Inc.
Copyright (c) 2002-2018 EPFL
Copyright (c) 2011-2018 Lightbend, Inc.

All rights reserved.

@@ -25,4 +25,4 @@ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
scala-parser-combinators [<img src="https://img.shields.io/travis/scala/scala-parser-combinators.svg"/>](https://travis-ci.org/scala/scala-parser-combinators) [<img src="https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-parser-combinators_2.11.svg?label=latest%20release%20for%202.11"/>](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-parser-combinators_2.11) [<img src="https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-parser-combinators_2.12*.svg?label=latest%20release%20for%202.12"/>](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-parser-combinators_2.12*) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scala/scala-parser-combinators)
scala-parser-combinators [<img src="https://img.shields.io/travis/scala/scala-parser-combinators.svg"/>](https://travis-ci.org/scala/scala-parser-combinators) [<img src="https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-parser-combinators_2.11.svg?label=latest%20release%20for%202.11"/>](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-parser-combinators_2.11) [<img src="https://img.shields.io/maven-central/v/org.scala-lang.modules/scala-parser-combinators_2.12.svg?label=latest%20release%20for%202.12"/>](http://search.maven.org/#search%7Cga%7C1%7Cg%3Aorg.scala-lang.modules%20a%3Ascala-parser-combinators_2.12) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/scala/scala-parser-combinators)
========================

### Scala Standard Parser Combinator Library
@@ -9,7 +9,7 @@ As of Scala 2.11, this library is a separate jar that can be omitted from Scala

## Documentation

* [Current API](http://www.scala-lang.org/files/archive/api/current/scala-parser-combinators/scala/util/parsing/combinator)
* [Current API](https://javadoc.io/page/org.scala-lang.modules/scala-parser-combinators_2.12/latest/scala/util/parsing/combinator/index.html)
* The [Getting Started](docs/Getting_Started.md) guide
* A more complicated example, [Building a lexer and parser with Scala's Parser Combinators](https://enear.github.io/2016/03/31/parser-combinators/)
* "Combinator Parsing", chapter 33 of [_Programming in Scala, Third Edition_](http://www.artima.com/shop/programming_in_scala), shows how to use this library to parse arithmetic expressions and JSON. The second half of the chapter examines how the library is implemented.
@@ -18,7 +18,7 @@ As of Scala 2.11, this library is a separate jar that can be omitted from Scala
To depend on scala-parser-combinators in SBT, add something like this to your build.sbt:

```
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.5"
libraryDependencies += "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.7"
```

(Assuming you're using a `scalaVersion` for which a scala-parser-combinators is published. The first 2.11 milestone for which this is true is 2.11.0-M4.)
@@ -60,7 +60,7 @@ For a detailed unpacking of this example see
Scala-parser-combinators directly supports scala-js 0.6+, starting with v1.0.5:

```
libraryDependencies += "org.scala-lang.modules" %%% "scala-parser-combinators" % "1.0.5"
libraryDependencies += "org.scala-lang.modules" %%% "scala-parser-combinators" % "1.0.7"
```

## Contributing
45 changes: 19 additions & 26 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import ScalaModulePlugin._

scalaVersionsByJvm in ThisBuild := {
val v211 = "2.11.11"
val v212 = "2.12.2"
val v213 = "2.13.0-M1"
val v211 = "2.11.12"
val v212 = "2.12.4"
val v213 = "2.13.0-M2"

Map(
6 -> List(v211 -> true),
7 -> List(v211 -> false),
8 -> List(v212 -> true, v213 -> true, v211 -> false),
9 -> List(v212 -> false, v213 -> false, v211 -> false)
9 -> List(v212 -> false, v213 -> false, v211 -> false),
10 -> List(v212 -> false, v213 -> false, v211 -> false),
11 -> List(v212 -> false, v213 -> false, v211 -> false),
12 -> List(v212 -> false, v213 -> false, v211 -> false),
13 -> List(v212 -> false, v213 -> false, v211 -> false),
14 -> List(v212 -> false, v213 -> false, v211 -> false)
)
}

@@ -19,10 +24,15 @@ lazy val root = project.in(file("."))

lazy val `scala-parser-combinators` = crossProject.in(file(".")).
settings(scalaModuleSettings: _*).
jvmSettings(scalaModuleSettingsJVM).
settings(
name := "scala-parser-combinators-root",
name := "scala-parser-combinators",
version := "1.0.8-SNAPSHOT",
mimaPreviousVersion := Some("1.0.5"),

apiMappings += (scalaInstance.value.libraryJar ->
url(s"https://www.scala-lang.org/api/${scalaVersion.value}/")),

scalacOptions in (Compile, doc) ++= Seq(
"-diagrams",
"-doc-source-url",
@@ -36,32 +46,15 @@ lazy val `scala-parser-combinators` = crossProject.in(file(".")).
)
).
jvmSettings(
// Mima uses the name of the jvm project in the artifactId
// when resolving previous versions (so no "-jvm" project)
name := "scala-parser-combinators"
).
jsSettings(
name := "scala-parser-combinators-js"
).
settings(
moduleName := "scala-parser-combinators",
version := "1.0.6-SNAPSHOT"
).
jvmSettings(
OsgiKeys.exportPackage := Seq(s"scala.util.parsing.*;version=${version.value}")
OsgiKeys.exportPackage := Seq(s"scala.util.parsing.*;version=${version.value}"),
libraryDependencies += "junit" % "junit" % "4.12" % "test",
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
).
jsSettings(
// Scala.js cannot run forked tests
fork in Test := false
).
jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin)).
jvmSettings(
libraryDependencies += "junit" % "junit" % "4.12" % "test",
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
).
jvmSettings(
mimaPreviousVersion := Some("1.0.4")
)
jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))

lazy val `scala-parser-combinatorsJVM` = `scala-parser-combinators`.jvm
lazy val `scala-parser-combinatorsJS` = `scala-parser-combinators`.js
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.15
sbt.version=0.13.18
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
addSbtPlugin("org.scala-lang.modules" % "scala-module-plugin" % "1.0.8")
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14")

addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.16")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.22")
Original file line number Diff line number Diff line change
@@ -63,12 +63,14 @@ case class OffsetPosition(source: CharSequence, offset: Int) extends Position {
* @return the line at `offset` (not including a newline)
*/
def lineContents: String = {
val endIndex = if (source.charAt(index(line) - 1) == '\n') {
index(line) - 1
val lineStart = index(line - 1)
val lineEnd = index(line)
val endIndex = if ( lineStart < lineEnd && source.charAt(lineEnd - 1) == '\n') {
lineEnd - 1
} else {
index(line)
lineEnd
}
source.subSequence(index(line - 1), endIndex).toString
source.subSequence(lineStart, endIndex).toString
}

/** Returns a string representation of the `Position`, of the form `line.column`. */
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package scala.util.parsing.input

import org.junit.Test
import org.junit.Assert.assertEquals

class OffsetPositionTest {
@Test
def printLineContentsWithTrailingNewLine: Unit = {
val op = new OffsetPosition("\n", 1)
assertEquals(op.lineContents, "")
}

@Test
def printLineContentsWithEmptySource: Unit = {
val op = new OffsetPosition("", 0)
assertEquals(op.lineContents, "")
}
}