Validate command alias termination
This commit is contained in:
@@ -39,6 +39,7 @@ type Machine struct {
|
||||
transitions map[transitionKey]transition
|
||||
alphabet []symbol
|
||||
literals map[string]struct{}
|
||||
mappings []Mapping
|
||||
}
|
||||
|
||||
// Compile builds a finite stack machine with explicit lookup, restoration,
|
||||
@@ -55,11 +56,15 @@ func compileMachine(resolver *Resolver) *Machine {
|
||||
// Trie controls only move to child nodes. Helper controls prepend a fixed
|
||||
// number of saved symbols and then halt or return to the trie root after a
|
||||
// selected mapping has been completed.
|
||||
// End and boundary symbols are only restored as the final item below any
|
||||
// emitted command tokens. No transition places a marker above ordinary
|
||||
// input, so each remains the unique bottom marker of a valid stack.
|
||||
machine := &Machine{
|
||||
start: 0,
|
||||
halt: len(resolver.trie),
|
||||
transitions: make(map[transitionKey]transition),
|
||||
literals: make(map[string]struct{}),
|
||||
mappings: resolver.mappings,
|
||||
}
|
||||
for _, mapping := range resolver.mappings {
|
||||
for _, path := range []commandpath.Path{mapping.Source, mapping.Target} {
|
||||
|
||||
Reference in New Issue
Block a user