Documentation
¶
Index ¶
- Variables
- func Parse(lineNum int, dslLine string) (layouttest.Rule, error)
- type AlignmentConstraint
- type AlignmentRule
- type CenteredBetweenRule
- type CompoundSelector
- type EachEdgeMaxBendsRule
- type EdgeEndpointPositionRule
- type EdgeEndpointSideRule
- type EdgeEnterBelowRule
- type EdgeMaxBendsRule
- type EdgeMaxLenRule
- type EdgeMinCornerAngleRule
- type EdgeMinSlopeRule
- type EdgeNoCrossRule
- type EdgeStraightRule
- type EdgeTypeRule
- type EdgeVisibilityRule
- type HCenteredBetweenRule
- type ImplicitBoundariesRule
- type Match
- type MinGapRule
- type MinHeightRule
- type MinPositionRule
- type MinWidthRule
- type NoEdgeRule
- type NodeEdgeGapRule
- type NodeNoStraddleRule
- type Pattern
- type PatternConstraint
- type PatternEdge
- type PatternRule
- type PatternVariable
- type PositionalConstraint
- type PositionalRule
- type PropertyConstraint
- type PropertyRule
- type Scope
- type SizeRule
Constants ¶
This section is empty.
Variables ¶
var EdgeTypeShortcut = map[string]string{
"L": "leadsto",
"P": "partof",
"X": "expresses",
"N": "nearto",
}
EdgeTypeShortcut maps single-letter shortcuts to full edge type names
Functions ¶
Types ¶
type AlignmentConstraint ¶
type AlignmentConstraint struct {
Variables []string // Pattern variable names to align
Property string // Property to align: "center-x", "center-y", "x", "y"
}
AlignmentConstraint represents alignment between pattern variables Example: $a,$b same center-y
type AlignmentRule ¶
type AlignmentRule struct {
// contains filtered or unexported fields
}
AlignmentRule validates that selected nodes have the same value for a property
func (*AlignmentRule) Apply ¶
func (r *AlignmentRule) Apply(layout *layouttest.Layout) error
func (*AlignmentRule) CompactionKey ¶
func (r *AlignmentRule) CompactionKey() string
func (*AlignmentRule) Description ¶
func (r *AlignmentRule) Description() string
func (*AlignmentRule) LineNum ¶
func (r *AlignmentRule) LineNum() int
func (*AlignmentRule) Specificity ¶
func (r *AlignmentRule) Specificity() int
type CenteredBetweenRule ¶
type CenteredBetweenRule struct {
// contains filtered or unexported fields
}
CenteredBetweenRule asserts the selected nodes' center-y sits at the midpoint of two target nodes' center-ys (±10px) — `#x is vertically-centered-between #a,#b`. A node shared between two anchors (e.g. a thing part-of two events on different rows) must read as belonging to both, not tucked onto one anchor's row.
func (*CenteredBetweenRule) Apply ¶
func (r *CenteredBetweenRule) Apply(layout *layouttest.Layout) error
func (*CenteredBetweenRule) CompactionKey ¶
func (r *CenteredBetweenRule) CompactionKey() string
func (*CenteredBetweenRule) Description ¶
func (r *CenteredBetweenRule) Description() string
func (*CenteredBetweenRule) LineNum ¶
func (r *CenteredBetweenRule) LineNum() int
func (*CenteredBetweenRule) Specificity ¶
func (r *CenteredBetweenRule) Specificity() int
type CompoundSelector ¶
type CompoundSelector struct {
TypeSel *layouttest.TypeSelector
TextLenCond *layouttest.TextLengthCondition
}
CompoundSelector combines a type selector with conditions Spec: gl:docs/dev/layout-gen/dsl-reference.md#L254-L262
func (*CompoundSelector) Description ¶
func (s *CompoundSelector) Description() string
func (*CompoundSelector) Key ¶
func (s *CompoundSelector) Key() string
func (*CompoundSelector) Select ¶
func (s *CompoundSelector) Select(layout *layouttest.Layout) []*layouttest.Node
func (*CompoundSelector) Specificity ¶
func (s *CompoundSelector) Specificity() int
type EachEdgeMaxBendsRule ¶
type EachEdgeMaxBendsRule struct {
// contains filtered or unexported fields
}
EachEdgeMaxBendsRule is the fitness DEFAULT: every rendered edge has at most `max` bends. `each edge has max-bends=0` (a @scope global rule) flags any edge that detours, catching routing regressions across the whole corpus. A fixture whose edges legitimately bend overrides it locally — `each edge has max-bends=0 except #a,#b #c,#d` lifts the named edges out of the default (they are then pinned by their own `edge … has max-bends=N`). The local rule replaces the global one for that fixture (same CompactionKey, higher scope specificity). Stubbed (hidden) edges draw no line and are skipped.
func (*EachEdgeMaxBendsRule) Apply ¶
func (r *EachEdgeMaxBendsRule) Apply(layout *layouttest.Layout) error
func (*EachEdgeMaxBendsRule) CompactionKey ¶
func (r *EachEdgeMaxBendsRule) CompactionKey() string
func (*EachEdgeMaxBendsRule) Description ¶
func (r *EachEdgeMaxBendsRule) Description() string
func (*EachEdgeMaxBendsRule) LineNum ¶
func (r *EachEdgeMaxBendsRule) LineNum() int
func (*EachEdgeMaxBendsRule) Specificity ¶
func (r *EachEdgeMaxBendsRule) Specificity() int
type EdgeEndpointPositionRule ¶
type EdgeEndpointPositionRule struct {
// contains filtered or unexported fields
}
EdgeEndpointPositionRule validates the fractional position (0..1) of a routed endpoint along its side. `edge #a,#b has target-position=0.5` asserts the a→b edge meets b at the centre of its side; `0.35`/`0.65` are the spread ports a distributed pair uses. Compared with a small tolerance (the engine uses exact fractions).
func (*EdgeEndpointPositionRule) Apply ¶
func (r *EdgeEndpointPositionRule) Apply(layout *layouttest.Layout) error
func (*EdgeEndpointPositionRule) CompactionKey ¶
func (r *EdgeEndpointPositionRule) CompactionKey() string
func (*EdgeEndpointPositionRule) Description ¶
func (r *EdgeEndpointPositionRule) Description() string
func (*EdgeEndpointPositionRule) LineNum ¶
func (r *EdgeEndpointPositionRule) LineNum() int
func (*EdgeEndpointPositionRule) Specificity ¶
func (r *EdgeEndpointPositionRule) Specificity() int
type EdgeEndpointSideRule ¶
type EdgeEndpointSideRule struct {
// contains filtered or unexported fields
}
EdgeEndpointSideRule validates which side of an endpoint node a routed edge attaches to. `edge #a,#b has target-side=top` asserts the a→b edge meets b's top side; `source-side=` asserts the same for a. Resolves center ports to the side the line actually exits (see layout.EdgeEndpointSide).
func (*EdgeEndpointSideRule) Apply ¶
func (r *EdgeEndpointSideRule) Apply(layout *layouttest.Layout) error
func (*EdgeEndpointSideRule) CompactionKey ¶
func (r *EdgeEndpointSideRule) CompactionKey() string
func (*EdgeEndpointSideRule) Description ¶
func (r *EdgeEndpointSideRule) Description() string
func (*EdgeEndpointSideRule) LineNum ¶
func (r *EdgeEndpointSideRule) LineNum() int
func (*EdgeEndpointSideRule) Specificity ¶
func (r *EdgeEndpointSideRule) Specificity() int
type EdgeEnterBelowRule ¶
type EdgeEnterBelowRule struct {
// contains filtered or unexported fields
}
EdgeEnterBelowRule asserts two edges sharing a target node enter it in a given vertical order — `edge #a,#b does enter-below edge #c,#d`: a→b's final polyline point (its entry port) is strictly below c→d's. The entry ORDER on a side should match the edges' approach directions (an edge arriving from below enters at the lowest slot), and this pins that contract without hard-coding position fractions.
func (*EdgeEnterBelowRule) Apply ¶
func (r *EdgeEnterBelowRule) Apply(layout *layouttest.Layout) error
func (*EdgeEnterBelowRule) CompactionKey ¶
func (r *EdgeEnterBelowRule) CompactionKey() string
func (*EdgeEnterBelowRule) Description ¶
func (r *EdgeEnterBelowRule) Description() string
func (*EdgeEnterBelowRule) LineNum ¶
func (r *EdgeEnterBelowRule) LineNum() int
func (*EdgeEnterBelowRule) Specificity ¶
func (r *EdgeEnterBelowRule) Specificity() int
type EdgeMaxBendsRule ¶
type EdgeMaxBendsRule struct {
// contains filtered or unexported fields
}
EdgeMaxBendsRule asserts a specific edge's routed polyline has at most `max` interior bends (corners between the source and target ports; a straight edge has 0). `edge #a,#b has max-bends=2`. Pairs with EachEdgeMaxBendsRule: the default expects every edge straight, and a fixture pins the few that detour.
func (*EdgeMaxBendsRule) Apply ¶
func (r *EdgeMaxBendsRule) Apply(layout *layouttest.Layout) error
func (*EdgeMaxBendsRule) CompactionKey ¶
func (r *EdgeMaxBendsRule) CompactionKey() string
func (*EdgeMaxBendsRule) Description ¶
func (r *EdgeMaxBendsRule) Description() string
func (*EdgeMaxBendsRule) LineNum ¶
func (r *EdgeMaxBendsRule) LineNum() int
func (*EdgeMaxBendsRule) Specificity ¶
func (r *EdgeMaxBendsRule) Specificity() int
type EdgeMaxLenRule ¶
type EdgeMaxLenRule struct {
// contains filtered or unexported fields
}
EdgeMaxLenRule asserts a routed edge is not absurdly long — `edge #a,#b has max-len=600` requires the routed polyline's total length to stay <= 600px. Guards against a layout pass shoving one endpoint far away to dodge a blocker, stretching a flow edge into a multi-row near-vertical skew (c-git: a join event pushed ~2958px down to clear a concept box hugging its predecessor's port).
func (*EdgeMaxLenRule) Apply ¶
func (r *EdgeMaxLenRule) Apply(layout *layouttest.Layout) error
func (*EdgeMaxLenRule) CompactionKey ¶
func (r *EdgeMaxLenRule) CompactionKey() string
func (*EdgeMaxLenRule) Description ¶
func (r *EdgeMaxLenRule) Description() string
func (*EdgeMaxLenRule) LineNum ¶
func (r *EdgeMaxLenRule) LineNum() int
func (*EdgeMaxLenRule) Specificity ¶
func (r *EdgeMaxLenRule) Specificity() int
type EdgeMinCornerAngleRule ¶
type EdgeMinCornerAngleRule struct {
// contains filtered or unexported fields
}
EdgeMinCornerAngleRule asserts every interior bend of a routed edge turns gently — `edge #a,#b has min-corner-angle=110` fails if any corner's interior angle is below 110°. A 90° corner reads mechanical; the layout prefers obtuse bends ("90° angles should be exceptional; ~120° is fine"). A straight edge (no interior vertex) passes trivially.
func (*EdgeMinCornerAngleRule) Apply ¶
func (r *EdgeMinCornerAngleRule) Apply(layout *layouttest.Layout) error
func (*EdgeMinCornerAngleRule) CompactionKey ¶
func (r *EdgeMinCornerAngleRule) CompactionKey() string
func (*EdgeMinCornerAngleRule) Description ¶
func (r *EdgeMinCornerAngleRule) Description() string
func (*EdgeMinCornerAngleRule) LineNum ¶
func (r *EdgeMinCornerAngleRule) LineNum() int
func (*EdgeMinCornerAngleRule) Specificity ¶
func (r *EdgeMinCornerAngleRule) Specificity() int
type EdgeMinSlopeRule ¶
type EdgeMinSlopeRule struct {
// contains filtered or unexported fields
}
EdgeMinSlopeRule asserts a routed edge is steep enough — `edge #a,#b has min-slope=0.2` requires |dy| >= 0.2*|dx| between the routed endpoints. A near-horizontal flow edge drowns its arrowhead in the node border; vertical edges (dx=0) always pass.
func (*EdgeMinSlopeRule) Apply ¶
func (r *EdgeMinSlopeRule) Apply(layout *layouttest.Layout) error
func (*EdgeMinSlopeRule) CompactionKey ¶
func (r *EdgeMinSlopeRule) CompactionKey() string
func (*EdgeMinSlopeRule) Description ¶
func (r *EdgeMinSlopeRule) Description() string
func (*EdgeMinSlopeRule) LineNum ¶
func (r *EdgeMinSlopeRule) LineNum() int
func (*EdgeMinSlopeRule) Specificity ¶
func (r *EdgeMinSlopeRule) Specificity() int
type EdgeNoCrossRule ¶
type EdgeNoCrossRule struct {
// contains filtered or unexported fields
}
EdgeNoCrossRule asserts two routed edges do not properly cross. `edge #a,#b does not cross edge #c,#d`.
func (*EdgeNoCrossRule) Apply ¶
func (r *EdgeNoCrossRule) Apply(layout *layouttest.Layout) error
func (*EdgeNoCrossRule) CompactionKey ¶
func (r *EdgeNoCrossRule) CompactionKey() string
func (*EdgeNoCrossRule) Description ¶
func (r *EdgeNoCrossRule) Description() string
func (*EdgeNoCrossRule) LineNum ¶
func (r *EdgeNoCrossRule) LineNum() int
func (*EdgeNoCrossRule) Specificity ¶
func (r *EdgeNoCrossRule) Specificity() int
type EdgeStraightRule ¶
type EdgeStraightRule struct {
// contains filtered or unexported fields
}
EdgeStraightRule asserts a routed edge is axis-aligned — `edge #a,#b is horizontal` (endpoint Ys equal) or `is vertical` (endpoint Xs equal), with a 1px tolerance for odd-height/width port rounding. Two nodes that share a row (column) should be joined by a straight line, not a tilted one.
func (*EdgeStraightRule) Apply ¶
func (r *EdgeStraightRule) Apply(layout *layouttest.Layout) error
func (*EdgeStraightRule) CompactionKey ¶
func (r *EdgeStraightRule) CompactionKey() string
func (*EdgeStraightRule) Description ¶
func (r *EdgeStraightRule) Description() string
func (*EdgeStraightRule) LineNum ¶
func (r *EdgeStraightRule) LineNum() int
func (*EdgeStraightRule) Specificity ¶
func (r *EdgeStraightRule) Specificity() int
type EdgeTypeRule ¶
type EdgeTypeRule struct {
// contains filtered or unexported fields
}
EdgeTypeRule validates that an edge between two nodes has a specific type Example: edge #S,@e1 has type=leadsto
func (*EdgeTypeRule) Apply ¶
func (r *EdgeTypeRule) Apply(layout *layouttest.Layout) error
func (*EdgeTypeRule) CompactionKey ¶
func (r *EdgeTypeRule) CompactionKey() string
func (*EdgeTypeRule) Description ¶
func (r *EdgeTypeRule) Description() string
func (*EdgeTypeRule) LineNum ¶
func (r *EdgeTypeRule) LineNum() int
func (*EdgeTypeRule) Specificity ¶
func (r *EdgeTypeRule) Specificity() int
type EdgeVisibilityRule ¶
type EdgeVisibilityRule struct {
// contains filtered or unexported fields
}
EdgeVisibilityRule asserts the layout's rendering class for an edge — `edge #a,#b has visibility=visible|stubbed`. An empty Visibility on the layout counts as visible (the zero value of the class).
func (*EdgeVisibilityRule) Apply ¶
func (r *EdgeVisibilityRule) Apply(layout *layouttest.Layout) error
func (*EdgeVisibilityRule) CompactionKey ¶
func (r *EdgeVisibilityRule) CompactionKey() string
func (*EdgeVisibilityRule) Description ¶
func (r *EdgeVisibilityRule) Description() string
func (*EdgeVisibilityRule) LineNum ¶
func (r *EdgeVisibilityRule) LineNum() int
func (*EdgeVisibilityRule) Specificity ¶
func (r *EdgeVisibilityRule) Specificity() int
type HCenteredBetweenRule ¶
type HCenteredBetweenRule struct {
// contains filtered or unexported fields
}
HCenteredBetweenRule is the horizontal twin of CenteredBetweenRule: `#x is horizontally-centered-between #a,#b` — center-x at the midpoint of the two targets' center-xs (±10px).
func (*HCenteredBetweenRule) Apply ¶
func (r *HCenteredBetweenRule) Apply(layout *layouttest.Layout) error
func (*HCenteredBetweenRule) CompactionKey ¶
func (r *HCenteredBetweenRule) CompactionKey() string
func (*HCenteredBetweenRule) Description ¶
func (r *HCenteredBetweenRule) Description() string
func (*HCenteredBetweenRule) LineNum ¶
func (r *HCenteredBetweenRule) LineNum() int
func (*HCenteredBetweenRule) Specificity ¶
func (r *HCenteredBetweenRule) Specificity() int
type ImplicitBoundariesRule ¶
type ImplicitBoundariesRule struct {
// contains filtered or unexported fields
}
ImplicitBoundariesRule validates that graphs with events have boundary nodes
func (*ImplicitBoundariesRule) Apply ¶
func (r *ImplicitBoundariesRule) Apply(layout *layouttest.Layout) error
func (*ImplicitBoundariesRule) CompactionKey ¶
func (r *ImplicitBoundariesRule) CompactionKey() string
func (*ImplicitBoundariesRule) Description ¶
func (r *ImplicitBoundariesRule) Description() string
func (*ImplicitBoundariesRule) LineNum ¶
func (r *ImplicitBoundariesRule) LineNum() int
func (*ImplicitBoundariesRule) Specificity ¶
func (r *ImplicitBoundariesRule) Specificity() int
type Match ¶
type Match map[string]*layouttest.Node
Match represents a single instance of a pattern matched in the graph Maps pattern variable names to actual layout nodes
func FindPatternMatches ¶
func FindPatternMatches(layout *layouttest.Layout, pattern *Pattern) []Match
FindPatternMatches finds all subgraphs in the layout that match the given pattern Returns a slice of matches, where each match maps variable names to matched nodes
type MinGapRule ¶
type MinGapRule struct {
// contains filtered or unexported fields
}
MinGapRule validates that selected nodes maintain a minimum gap from other nodes Spec: gl:docs/dev/layout-gen/layout-alg.md#L30-L42
func (*MinGapRule) Apply ¶
func (r *MinGapRule) Apply(layout *layouttest.Layout) error
func (*MinGapRule) CompactionKey ¶
func (r *MinGapRule) CompactionKey() string
func (*MinGapRule) Description ¶
func (r *MinGapRule) Description() string
func (*MinGapRule) LineNum ¶
func (r *MinGapRule) LineNum() int
func (*MinGapRule) Specificity ¶
func (r *MinGapRule) Specificity() int
type MinHeightRule ¶
type MinHeightRule struct {
// contains filtered or unexported fields
}
MinHeightRule validates that selected nodes have at least the specified height Spec: gl:docs/dev/layout-gen/dsl-reference.md#L256-L286
func (*MinHeightRule) Apply ¶
func (r *MinHeightRule) Apply(layout *layouttest.Layout) error
func (*MinHeightRule) CompactionKey ¶
func (r *MinHeightRule) CompactionKey() string
func (*MinHeightRule) Description ¶
func (r *MinHeightRule) Description() string
func (*MinHeightRule) LineNum ¶
func (r *MinHeightRule) LineNum() int
func (*MinHeightRule) Specificity ¶
func (r *MinHeightRule) Specificity() int
type MinPositionRule ¶
type MinPositionRule struct {
// contains filtered or unexported fields
}
MinPositionRule validates that a position property (x, y, center-x, center-y) of the selected nodes is at least the specified value — the positional twin of MinWidthRule/MinHeightRule. It lets a target pin "this node lands on a LOWER row / FURTHER column" without hard-coding the exact coordinate (e.g. the v7 canvas-wrap acceptance case).
func (*MinPositionRule) Apply ¶
func (r *MinPositionRule) Apply(layout *layouttest.Layout) error
func (*MinPositionRule) CompactionKey ¶
func (r *MinPositionRule) CompactionKey() string
func (*MinPositionRule) Description ¶
func (r *MinPositionRule) Description() string
func (*MinPositionRule) LineNum ¶
func (r *MinPositionRule) LineNum() int
func (*MinPositionRule) Specificity ¶
func (r *MinPositionRule) Specificity() int
type MinWidthRule ¶
type MinWidthRule struct {
// contains filtered or unexported fields
}
MinWidthRule validates that selected nodes have at least the specified width Spec: gl:docs/dev/layout-gen/dsl-reference.md#L256-L286
func (*MinWidthRule) Apply ¶
func (r *MinWidthRule) Apply(layout *layouttest.Layout) error
func (*MinWidthRule) CompactionKey ¶
func (r *MinWidthRule) CompactionKey() string
func (*MinWidthRule) Description ¶
func (r *MinWidthRule) Description() string
func (*MinWidthRule) LineNum ¶
func (r *MinWidthRule) LineNum() int
func (*MinWidthRule) Specificity ¶
func (r *MinWidthRule) Specificity() int
type NoEdgeRule ¶
type NoEdgeRule struct {
// contains filtered or unexported fields
}
NoEdgeRule asserts the layout contains NO edge between two nodes — `no edge #a,#b`. Used for edges the engine must not synthesise, e.g. a boundary edge on a container whose sub-event already continues the flow.
func (*NoEdgeRule) Apply ¶
func (r *NoEdgeRule) Apply(layout *layouttest.Layout) error
func (*NoEdgeRule) CompactionKey ¶
func (r *NoEdgeRule) CompactionKey() string
func (*NoEdgeRule) Description ¶
func (r *NoEdgeRule) Description() string
func (*NoEdgeRule) LineNum ¶
func (r *NoEdgeRule) LineNum() int
func (*NoEdgeRule) Specificity ¶
func (r *NoEdgeRule) Specificity() int
type NodeEdgeGapRule ¶
type NodeEdgeGapRule struct {
// contains filtered or unexported fields
}
NodeEdgeGapRule asserts the routed a→b polyline keeps at least `gap` px of clearance from the node's box — `node #x keeps gap=N from edge #a,#b`. The detour aesthetic behind it: a bend should use free space around a box, not hug its border. Implemented as an intersection test against the box EXPANDED by N per side: any segment entering the expanded box is closer than N.
func (*NodeEdgeGapRule) Apply ¶
func (r *NodeEdgeGapRule) Apply(layout *layouttest.Layout) error
func (*NodeEdgeGapRule) CompactionKey ¶
func (r *NodeEdgeGapRule) CompactionKey() string
func (*NodeEdgeGapRule) Description ¶
func (r *NodeEdgeGapRule) Description() string
func (*NodeEdgeGapRule) LineNum ¶
func (r *NodeEdgeGapRule) LineNum() int
func (*NodeEdgeGapRule) Specificity ¶
func (r *NodeEdgeGapRule) Specificity() int
type NodeNoStraddleRule ¶
type NodeNoStraddleRule struct {
// contains filtered or unexported fields
}
NodeNoStraddleRule asserts a node's box does not lie on a routed edge — `node #x does not straddle edge #a,#b`. The edge is the straight segment between its routed endpoints; the box is shrunk by 2px so merely touching a border does not count.
func (*NodeNoStraddleRule) Apply ¶
func (r *NodeNoStraddleRule) Apply(layout *layouttest.Layout) error
func (*NodeNoStraddleRule) CompactionKey ¶
func (r *NodeNoStraddleRule) CompactionKey() string
func (*NodeNoStraddleRule) Description ¶
func (r *NodeNoStraddleRule) Description() string
func (*NodeNoStraddleRule) LineNum ¶
func (r *NodeNoStraddleRule) LineNum() int
func (*NodeNoStraddleRule) Specificity ¶
func (r *NodeNoStraddleRule) Specificity() int
type Pattern ¶
type Pattern struct {
Variables []PatternVariable // Pattern variables ($a, $b, $parent, etc.)
Edges []PatternEdge // Edge constraints between variables
}
Pattern represents a graph pattern to match Example: each $child ~P~ $parent has ...
func (*Pattern) Description ¶
Description returns a human-readable description of the pattern
func (*Pattern) GetVariable ¶
func (p *Pattern) GetVariable(name string) *PatternVariable
GetVariable returns the PatternVariable for a given name
func (*Pattern) HasVariable ¶
HasVariable returns true if the pattern has a variable with the given name
func (*Pattern) IsSimpleEdge ¶
IsSimpleEdge returns true if pattern is a single edge between two variables Example: $a ~P~ $b (vs multi-hop: $a ~P~ $b ~P~ $c)
func (*Pattern) VariableNames ¶
VariableNames returns all variable names in the pattern
type PatternConstraint ¶
type PatternConstraint struct {
Type string // "positional", "alignment", "property"
Variables []string // Pattern variables involved in constraint
Details map[string]interface{} // Constraint-specific data
}
PatternConstraint represents a constraint to apply to pattern matches Example: $child right-of $parent with gap=60
type PatternEdge ¶
type PatternEdge struct {
From string // Variable name (source of edge)
To string // Variable name (target of edge)
EdgeType string // Full edge type: "leadsto", "partof", "expresses", "nearto"
}
PatternEdge represents an edge constraint in the pattern Direction matters: From→To
type PatternRule ¶
type PatternRule struct {
// contains filtered or unexported fields
}
PatternRule validates pattern-based constraints across matched subgraphs
func (*PatternRule) Apply ¶
func (r *PatternRule) Apply(layout *layouttest.Layout) error
func (*PatternRule) CompactionKey ¶
func (r *PatternRule) CompactionKey() string
func (*PatternRule) Description ¶
func (r *PatternRule) Description() string
func (*PatternRule) LineNum ¶
func (r *PatternRule) LineNum() int
func (*PatternRule) Specificity ¶
func (r *PatternRule) Specificity() int
type PatternVariable ¶
type PatternVariable struct {
Name string // Variable name without $ prefix (e.g., "child", "a", "parent")
Selector layouttest.Selector // Optional filter (nil = match any node)
}
PatternVariable represents a node variable in the pattern Can have optional selector filters for type, text-length, etc.
type PositionalConstraint ¶
type PositionalConstraint struct {
Subject string // Pattern variable name
Direction string // "above", "below", "left-of", "right-of"
Target string // Pattern variable name
Gap int // Expected gap in pixels
}
PositionalConstraint represents positional relationships between pattern variables Example: $a right-of $b with gap=60
type PositionalRule ¶
type PositionalRule struct {
// contains filtered or unexported fields
}
PositionalRule validates that a node is positioned relative to another Supports: above, below, left-of, right-of with optional gap
func (*PositionalRule) Apply ¶
func (r *PositionalRule) Apply(layout *layouttest.Layout) error
func (*PositionalRule) CompactionKey ¶
func (r *PositionalRule) CompactionKey() string
func (*PositionalRule) Description ¶
func (r *PositionalRule) Description() string
func (*PositionalRule) LineNum ¶
func (r *PositionalRule) LineNum() int
func (*PositionalRule) Specificity ¶
func (r *PositionalRule) Specificity() int
type PropertyConstraint ¶
type PropertyConstraint struct {
Variable string // Pattern variable name
Property string // Property name
Expected string // Expected value
}
PropertyConstraint represents a property assertion on pattern variables Example: $a has type=event
type PropertyRule ¶
type PropertyRule struct {
// contains filtered or unexported fields
}
PropertyRule validates that selected nodes have a specific property value
func (*PropertyRule) Apply ¶
func (r *PropertyRule) Apply(layout *layouttest.Layout) error
func (*PropertyRule) CompactionKey ¶
func (r *PropertyRule) CompactionKey() string
func (*PropertyRule) Description ¶
func (r *PropertyRule) Description() string
func (*PropertyRule) LineNum ¶
func (r *PropertyRule) LineNum() int
func (*PropertyRule) Specificity ¶
func (r *PropertyRule) Specificity() int
type Scope ¶
type Scope struct {
Type string // "global", "local", "parent"
TagExpr string // Boolean expression (optional filter)
RuleHeading string // ### heading where rule was defined (for local)
RuleSection string // ## section where rule was defined (for parent)
}
Scope represents a scope directive that filters which tests see a rule
func ParseScope ¶
ParseScope parses a @scope directive line Format: @scope TYPE [tags: EXPR] Examples:
@scope global @scope global tags: simple @scope parent tags: fork-pattern || merge-pattern @scope local tags: !experimental
func (*Scope) AppliesTo ¶
AppliesTo determines if this scope applies to a given test testTags: tags from the test's @test-tags comment testHeading: the ### heading text where the test is defined testSection: the ## section text where the test is defined
func (*Scope) ScopeSpecificity ¶
ScopeSpecificity returns the specificity level of this scope Higher values = more specific = higher priority in rule compaction 0=global, 1=global+tags, 2=parent, 3=parent+tags, 4=local, 5=local+tags
type SizeRule ¶
type SizeRule struct {
// contains filtered or unexported fields
}
SizeRule validates that selected nodes have specific dimensions