Skip to content

Commit

Permalink
Merge pull request #181 from xuwei-k/replace-with
Browse files Browse the repository at this point in the history
add `-Xsource:3` option. avoid deprecated `with`
  • Loading branch information
eed3si9n authored Oct 4, 2024
2 parents e0277cc + 9d0bad5 commit c39f455
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
10 changes: 10 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ ThisBuild / developers := List(
ThisBuild / description := "Contraband is a description language for your datatypes and APIs, currently targeting Java and Scala."
Global / semanticdbEnabled := true
Global / semanticdbVersion := "4.10.1"
ThisBuild / scalacOptions ++= {
scalaBinaryVersion.value match {
case "2.12" =>
Seq("-Xsource:3")
case "2.13" =>
Seq("-Xsource:3-cross")
case _ =>
Nil
}
}

lazy val root = (project in file("."))
.enablePlugins(TravisSitePlugin)
Expand Down
21 changes: 7 additions & 14 deletions library/src/main/scala/sbt/contraband/parser/SchemaParser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.parboiled2._
import CharPredicate.{ HexDigit, Digit19, AlphaNum }
import scala.util.{ Failure, Success, Try }

trait Tokens extends StringBuilding with PositionTracking { this: Parser with Ignored =>
trait Tokens extends StringBuilding with PositionTracking { this: Parser & Ignored =>

def Token = rule { Punctuator | Name | NumberValue | StringValue }

Expand Down Expand Up @@ -153,14 +153,7 @@ trait Ignored extends PositionTracking { this: Parser =>
}

trait Document {
this: Parser
with Values
with Operations
with Types
with Tokens /* with Operations*/
with Ignored /*with Fragments with Operations with Values*/
with Directives
with TypeSystemDefinitions =>
this: Parser & Values & Operations & Types & Tokens & Ignored & Directives & TypeSystemDefinitions =>

def `package` = rule { Keyword("package") }

Expand All @@ -183,7 +176,7 @@ trait Document {
}

trait TypeSystemDefinitions {
this: Parser with Tokens with Ignored with Directives with Types with Operations with Values /*with Fragments*/ =>
this: Parser & Tokens & Ignored & Directives & Types & Operations & Values =>

def scalar = rule { Keyword("scalar") }
def `type` = rule { Keyword("type") }
Expand Down Expand Up @@ -304,7 +297,7 @@ trait TypeSystemDefinitions {
}

trait Operations extends PositionTracking {
this: Parser with Tokens with Ignored /*with Fragments*/ with Values with Types with Directives =>
this: Parser & Tokens & Ignored & Values & Types & Directives =>

// def OperationDefinition = rule {
// Comments ~ trackPos ~ SelectionSet ~> ((comment, pos, s) => ast.OperationDefinition(selections = s._1, comments = comment, trailingComments = s._2, position = Some(pos))) |
Expand Down Expand Up @@ -360,7 +353,7 @@ trait Operations extends PositionTracking {
}
}

trait Values { this: Parser with Tokens with Ignored with Operations with Types with Directives =>
trait Values { this: Parser & Tokens & Ignored & Operations & Types & Directives =>

def ValueConst: Rule1[ast.Value] = rule {
NumberValue | RawValue | StringValue | BooleanValue | NullValue | EnumValue | ListValueConst | ObjectValueConst
Expand Down Expand Up @@ -439,7 +432,7 @@ trait Values { this: Parser with Tokens with Ignored with Operations with Types
}

trait Directives {
this: Parser with Tokens with Operations with Ignored with Values with Operations with Types =>
this: Parser & Tokens & Operations & Ignored & Values & Operations & Types =>

def Directives = rule { Directive.+ ~> (_.toList) }

Expand All @@ -450,7 +443,7 @@ trait Directives {

}

trait Types { this: Parser with Tokens with Ignored =>
trait Types { this: Parser & Tokens & Ignored =>
def `lazy` = rule { Keyword("lazy") }

def Type: Rule1[ast.Type] = rule { LazyType | NonNullType | ListType | NamedType }
Expand Down

0 comments on commit c39f455

Please sign in to comment.