-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename source files and organize imports and
soundness
exports
- Loading branch information
1 parent
81e9993
commit 2bc97ce
Showing
7 changed files
with
141 additions
and
34 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
Contextual, version [unreleased]. Copyright 2024 Jon Pretty, Propensive OÜ. | ||
The primary distribution site is: https://propensive.com/ | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this | ||
file except in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under the | ||
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
either express or implied. See the License for the specific language governing permissions | ||
and limitations under the License. | ||
*/ | ||
|
||
package contextual | ||
|
||
import language.experimental.captureChecking | ||
|
||
trait Insertion[InputType, -ValueType]: | ||
def embed(value: ValueType): InputType |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
Contextual, version [unreleased]. Copyright 2024 Jon Pretty, Propensive OÜ. | ||
The primary distribution site is: https://propensive.com/ | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this | ||
file except in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under the | ||
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
either express or implied. See the License for the specific language governing permissions | ||
and limitations under the License. | ||
*/ | ||
|
||
package contextual | ||
|
||
import language.experimental.captureChecking | ||
|
||
import scala.compiletime.* | ||
|
||
import fulminate.* | ||
import vacuous.* | ||
|
||
case class InterpolationError(error: Message, offset: Optional[Int] = Unset, length: Optional[Int] = Unset) | ||
extends Error(msg"$error at ${offset.or(-1)} - ${length.or(-1)}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
Contextual, version [unreleased]. Copyright 2024 Jon Pretty, Propensive OÜ. | ||
The primary distribution site is: https://propensive.com/ | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this | ||
file except in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under the | ||
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
either express or implied. See the License for the specific language governing permissions | ||
and limitations under the License. | ||
*/ | ||
|
||
package contextual | ||
|
||
import language.experimental.captureChecking | ||
|
||
import rudiments.* | ||
|
||
trait Substitution[InputType, -ValueType, SubstitutionType <: Label] | ||
extends Insertion[InputType, ValueType] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
Contextual, version [unreleased]. Copyright 2024 Jon Pretty, Propensive OÜ. | ||
The primary distribution site is: https://propensive.com/ | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this | ||
file except in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under the | ||
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
either express or implied. See the License for the specific language governing permissions | ||
and limitations under the License. | ||
*/ | ||
|
||
package contextual | ||
|
||
import language.experimental.captureChecking | ||
|
||
import scala.quoted.* | ||
|
||
import vacuous.* | ||
import anticipation.* | ||
|
||
trait Verifier[ResultType] | ||
extends Interpolator[Nothing, Optional[ResultType], ResultType]: | ||
def verify(text: Text): ResultType | ||
protected def initial: Optional[ResultType] = Unset | ||
protected def parse(state: Optional[ResultType], next: Text): Optional[ResultType] = verify(next) | ||
protected def skip(state: Optional[ResultType]): Optional[ResultType] = state | ||
protected def insert(state: Optional[ResultType], value: Nothing): Optional[ResultType] = state | ||
protected def complete(value: Optional[ResultType]): ResultType = value.option.get | ||
|
||
def expand(context: Expr[StringContext])(using Quotes, Type[ResultType])(using thisType: Type[this.type]) | ||
: Expr[ResultType] = expand(context, '{Nil})(using thisType) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
Contextual, version [unreleased]. Copyright 2024 Jon Pretty, Propensive OÜ. | ||
The primary distribution site is: https://propensive.com/ | ||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this | ||
file except in compliance with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software distributed under the | ||
License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, | ||
either express or implied. See the License for the specific language governing permissions | ||
and limitations under the License. | ||
*/ | ||
|
||
package soundness | ||
|
||
export contextual.{Insertion, InterpolationError, Interpolator, Verifier, Substitution} |