Syntax

io.github.memo33.metarules.meta.Syntax

The content of this file makes the MetaRUL DSL syntax work. Changes in here are unlikely to be necessary.

The Network type should be provided by dependency injection by extending from Syntax downstream.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Show all
Known subtypes
object DummyNetwork

Members list

Type members

Classlikes

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class DummyNetwork
Self type
object IdTile

Attributes

Supertypes
class Object
trait Matchable
class Any
Self type
IdTile.type
case class Segment(network: Network, flags: Flags)

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
sealed trait SymTile

Attributes

Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Tile
case class Tile(segs: Set[Segment]) extends SymTile

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
trait SymTile
class Object
trait Matchable
class Any
Show all
object Tile

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
Tile.type

Inherited classlikes

Defines a number of implicit conversions most of which are needed to make the MetaRUL syntax work.

Defines a number of implicit conversions most of which are needed to make the MetaRUL syntax work.

Attributes

Inherited from:
ImplicitsSyntax
Supertypes
class Object
trait Matchable
class Any

Attributes

Inherited from:
ImplicitsSyntax
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Implicits

Needs to be implemented for generating RUL2 code for a specific project, along with an Syntax#IdResolver.

Needs to be implemented for generating RUL2 code for a specific project, along with an Syntax#IdResolver.

Attributes

Inherited from:
RuleGeneratorSyntax
Supertypes
class Object
trait Matchable
class Any

The main logic to translate meta code (Rule[Tile]) to proper RUL2 code (Rule[IdTile]). The crux of that is that a single meta rule can result in multiple RUL2 rules, based on the symmetries of the tiles involved. Exactly those rules and orientations will be generated that are necessary. Compare, for example:

The main logic to translate meta code (Rule[Tile]) to proper RUL2 code (Rule[IdTile]). The crux of that is that a single meta rule can result in multiple RUL2 rules, based on the symmetries of the tiles involved. Exactly those rules and orientations will be generated that are necessary. Compare, for example:

scala> transduce( L1Rhw2~WE | (Dirtroad ~> L1Rhw2)~WE )
Rule( 0x57100000,1,0 | 0x57000000,1,0 | 0x57100000,1,0 | 0x57100000,1,0 )
Rule( 0x57100000,3,0 | 0x57000000,3,0 | 0x57100000,3,0 | 0x57100000,3,0 )

scala> transduce( L1Rhw3~WE | (Dirtroad ~> L1Rhw3)~WE )
Rule( 0x57110000,3,0 | 0x57000000,1,0 | 0x57110000,3,0 | 0x57110000,3,0 )
Rule( 0x57110000,3,0 | 0x57000000,3,0 | 0x57110000,3,0 | 0x57110000,3,0 )
Rule( 0x57110000,1,0 | 0x57000000,3,0 | 0x57110000,1,0 | 0x57110000,1,0 )
Rule( 0x57110000,1,0 | 0x57000000,1,0 | 0x57110000,1,0 | 0x57110000,1,0 )

scala> transduce( Mis~WE & Rail~NW | (Dirtroad ~> Mis)~WE & Dirtroad~ES )
Rule( 0x57024580,1,0 | 0x57004A00,3,0 | 0x57024580,1,0 | 0x57024A00,3,0 )

If in doubt, start up the sbt console and use the transduce function to check the output.

Attributes

Inherited from:
RuleTransducerSyntax
Supertypes
class Object
trait Matchable
class Any

Types

type IdResolver = PartialFunction[Tile, IdTile]

The function that maps Tiles (meta syntax) to IdTiles (IID, Rot, Flip).

The function that maps Tiles (meta syntax) to IdTiles (IID, Rot, Flip).

Attributes