-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd03219
commit 116b0da
Showing
7 changed files
with
158 additions
and
76 deletions.
There are no files selected for viewing
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 @@ | ||
/* | ||
Acyclicity, 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 acyclicity | ||
|
||
import language.experimental.captureChecking | ||
|
||
object Digraph: | ||
def apply(id: Dot.Id, statements: Dot.Statement*): Dot = Dot.Digraph(Some(id), false, statements*) | ||
def apply(statements: Dot.Statement*): Dot = Dot.Digraph(None, false, statements*) | ||
def strict(id: Dot.Id, statements: Dot.Statement*): Dot = Dot.Digraph(Some(id), true, statements*) |
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,23 @@ | ||
/* | ||
Acyclicity, 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 acyclicity | ||
|
||
import language.experimental.captureChecking | ||
|
||
object Graph: | ||
def apply(id: Dot.Id, statements: Dot.Statement*): Dot = Dot.Graph(Some(id), false, statements*) | ||
def strict(id: Dot.Id, statements: Dot.Statement*): Dot = Dot.Graph(Some(id), true, statements*) |
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,49 @@ | ||
/* | ||
Acyclicity, 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 acyclicity | ||
|
||
import language.experimental.captureChecking | ||
|
||
import anticipation.* | ||
import contextual.* | ||
import fulminate.* | ||
import gossamer.* | ||
import rudiments.* | ||
import spectacular.* | ||
|
||
object NodeParser extends Interpolator[Unit, Option[Dot.Ref], Dot.Ref]: | ||
private val compassPoints: Set[Text] = Set(t"n", t"e", t"s", t"w", t"ne", t"nw", t"se", t"sw") | ||
def parse(state: Option[Dot.Ref], next: Text): Some[Dot.Ref] = | ||
Some { next.show.cut(t":").to(List) match | ||
case List(id) => | ||
Dot.Ref(Dot.Id(id)) | ||
|
||
case List(id, port) => | ||
Dot.Ref(Dot.Id(id), Some(Dot.Attachment(Dot.Id(port.show)))) | ||
|
||
case List(id, port, point) if compassPoints.contains(point) => | ||
Dot.Ref(Dot.Id(id), Some(Dot.Attachment(Dot.Id(port), | ||
Some(Dot.CompassPoint.valueOf(point.capitalize.s))))) | ||
|
||
case _ => | ||
throw InterpolationError(msg"not a valid node ID") | ||
} | ||
|
||
def initial: Option[Dot.Ref] = None | ||
def complete(value: Option[Dot.Ref]): Dot.Ref = value.get | ||
def skip(state: Option[Dot.Ref]): Option[Dot.Ref] = state | ||
def insert(state: Option[Dot.Ref], value: Unit): Option[Dot.Ref] = state |
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,26 @@ | ||
/* | ||
Acyclicity, 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 acyclicity | ||
|
||
import language.experimental.captureChecking | ||
|
||
object Subgraph: | ||
def apply(id: Dot.Id, statements: Dot.Statement*): Dot.Statement.Subgraph = | ||
Dot.Statement.Subgraph(Some(id), statements*) | ||
|
||
def apply(statements: Dot.Statement*): Dot.Statement.Subgraph = | ||
Dot.Statement.Subgraph(None, statements*) |
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