State

State

A State in a deterministic finite state machine (DFA). The starting state will reperesent the whole DFA.

Constructor

new State()

Source:
Create a new State.

Methods

constructPath(original, replacement, indexopt)

Source:
Construct a path in the DFA for the original ASCII string to the unicode replacement, starting at position index in the original string.
Parameters:
Name Type Attributes Default Description
original String a string of ASCII symbols
replacement String the unicode symbol that should replace the original string
index Number <optional>
0 the index in the original string to start at.
Throws:
There can be only one rule for an original string.
Type
Error

findNextReplacement(str, start, lenopt) → {Array.<String>}

Source:
Find the next replacement given the current DFA in an input string from position start and length len.
Parameters:
Name Type Attributes Default Description
str String the input string
start Number the starting position
len Number <optional>
0 the length of the string sequence to replace
Returns:
- a pair consisting of the string that is being replaced and the replacement, or the empty list.
Type
Array.<String>