Esempio n. 1
0
 /// <summary>
 /// Initializes a new instance of the Lexer class with the given input
 /// </summary>
 /// <param name="automaton">DFA automaton for this lexer</param>
 /// <param name="terminals">Terminals recognized by this lexer</param>
 /// <param name="separator">SID of the separator token</param>
 /// <param name="input">Input to this lexer</param>
 protected BaseLexer(Automaton automaton, Symbol[] terminals, int separator, TextReader input)
 {
     this.automaton   = automaton;
     symTerminals     = new ROList <Symbol>(new List <Symbol>(terminals));
     separatorID      = separator;
     text             = new StreamingText(input);
     tokens           = new TokenRepository(symTerminals, text);
     RecoveryDistance = DEFAULT_RECOVERY_MATCHING_DISTANCE;
 }
Esempio n. 2
0
 /// <summary>
 /// Initializes this matcher
 /// </summary>
 /// <param name="automaton">This lexer's automaton</param>
 /// <param name="separator">Terminal index of the SEPARATOR terminal</param>
 /// <param name="text">The input text</param>
 /// <param name="errors">Delegate for raising errors</param>
 /// <param name="maxDistance">The maximum Levenshtein distance between the input and the DFA</param>
 /// <param name="index">The index in the input from wich the error was raised</param>
 public FuzzyMatcher(Automaton automaton, int separator, BaseText text, AddLexicalError errors, int maxDistance, int index)
 {
     this.automaton   = automaton;
     this.separator   = separator;
     this.text        = text;
     this.errors      = errors;
     this.maxDistance = maxDistance;
     originIndex      = index;
 }