Skip to content
This repository was archived by the owner on Jan 28, 2021. It is now read-only.

Commit 8508b4c

Browse files
authored
Merge pull request #1 from gnieh/core-std
Separate core and std modules
2 parents dd0fe74 + 6e46b58 commit 8508b4c

File tree

631 files changed

+1190
-464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

631 files changed

+1190
-464
lines changed

.scalariform.conf

+1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@ autoformat=true
22
alignSingleLineCaseStatements=true
33
doubleIndentConstructorArguments=true
44
doubleIndentMethodDeclaration=true
5+
doubleIndentClassDeclaration=true
56
multilineScaladocCommentsStartOnFirstLine=true
67
danglingCloseParenthesis=Prevent

build.sbt

+13-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ val scala212 = "2.12.3"
44
lazy val commonSettings = Seq(
55
organization := "org.gnieh",
66
scalaVersion := scala212,
7+
libraryDependencies ++= Seq(
8+
"org.scalatest" %% "scalatest" % "3.0.3" % Test,
9+
"com.github.pathikrit" %% "better-files" % "2.17.1" % Test),
710
version := "0.1.0-SNAPSHOT",
811
description := "Scala XML library revisited",
912
licenses += ("The Apache Software License, Version 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
@@ -13,7 +16,7 @@ lazy val commonSettings = Seq(
1316
fork in test := true,
1417
scalacOptions in (Compile,doc) ++= Seq("-groups", "-implicits"),
1518
autoAPIMappings := true,
16-
scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked")) ++ publishSettings
19+
scalacOptions ++= Seq("-deprecation", "-feature", "-unchecked", "-Ypartial-unification")) ++ publishSettings
1720

1821
lazy val publishSettings = Seq(
1922
publishMavenStyle := true,
@@ -56,13 +59,17 @@ lazy val xml = project.in(file("."))
5659
.settings(
5760
name := "xml",
5861
packagedArtifacts := Map())
59-
.aggregate(core)
62+
.aggregate(core, std)
6063

6164
lazy val core = project.in(file("core"))
6265
.enablePlugins(ScoverageSbtPlugin)
6366
.settings(commonSettings)
6467
.settings(
65-
name := "xml-core",
66-
libraryDependencies ++= Seq(
67-
"org.scalatest" %% "scalatest" % "3.0.3" % Test,
68-
"com.github.pathikrit" %% "better-files" % "2.17.1" % Test))
68+
name := "xml-core")
69+
70+
lazy val std = project.in(file("std"))
71+
.enablePlugins(ScoverageSbtPlugin)
72+
.settings(commonSettings)
73+
.settings(
74+
name := "xml-std")
75+
.dependsOn(core)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2017 Lucas Satabin
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package scalax.xml
17+
18+
trait Position
19+
20+
object NoPosition extends Position {
21+
override def toString = "<no position>"
22+
}
23+
24+
class LineColumnPosition(line: Int, column: Int) extends Position {
25+
override def toString = f"[$line.$column]"
26+
}
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Copyright (c) 2017 Lucas Satabin
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package scalax.xml
17+
18+
object XmlUtils {
19+
20+
def isXmlWhitespace(c: Char): Boolean =
21+
c == ' ' || c == '\t' || c == '\r' || c == '\n'
22+
23+
}

core/src/main/scala/scalax/xml/XmlException.scala

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
*/
1616
package scalax.xml
1717

18-
case class XmlException(line: Int, column: Int, error: XmlError, message: String) extends Exception {
18+
case class XmlException(position: Position, error: XmlError, message: String) extends Exception {
1919

2020
override def getMessage: String =
21-
f"{$line.$column]: ${error.name} $message"
21+
f"$position: ${error.name} $message"
2222

2323
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Copyright (c) 2017 Lucas Satabin
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package scalax.xml
17+
18+
/** All errors encountered in processing an Xml documents
19+
* have a kind.
20+
* These errors are unique code defined in the various normative documents
21+
* and recommendations.
22+
*/
23+
abstract class XmlError(val name: String)
24+
25+
/** Represents a syntax error according to an XML production rule. */
26+
case class XmlSyntax(id: String) extends XmlError(f"XML [$id]")

0 commit comments

Comments
 (0)