public ILexemeFactory Get(LexerRuleType lexerRuleType)
 {
     ILexemeFactory lexemeFactory = null;
     if (!_registry.TryGetValue(lexerRuleType, out lexemeFactory))
         return null;
     return lexemeFactory;
 }
Beispiel #2
0
 private static int ComputeHashCode(
     ITerminal terminal,
     LexerRuleType terminalLexerRuleType,
     TokenType tokenType)
 {
     return(HashCode.Compute(
                terminalLexerRuleType.GetHashCode(),
                tokenType.GetHashCode(),
                terminal.GetHashCode()));
 }
 public override bool Equals(object obj)
 {
     if (obj is null)
     {
         return(false);
     }
     if (!(obj is StringLiteralLexerRule terminalLexerRule))
     {
         return(false);
     }
     return(LexerRuleType.Equals(terminalLexerRule.LexerRuleType) &&
            Literal.Equals(terminalLexerRule.Literal));
 }
Beispiel #4
0
        public override bool Equals(object obj)
        {
            if (((object)obj) == null)
            {
                return(false);
            }
            var terminalLexerRule = obj as TerminalLexerRule;

            if (((object)terminalLexerRule) == null)
            {
                return(false);
            }
            return(LexerRuleType.Equals(terminalLexerRule.LexerRuleType) &&
                   Terminal.Equals(terminalLexerRule.Terminal));
        }
Beispiel #5
0
 protected BaseLexerRule(LexerRuleType lexerRuleType, TokenType tokenType)
 {
     _lexerRuleType = lexerRuleType;
     _tokenType = tokenType;
 }
Beispiel #6
0
 protected BaseLexerRule(LexerRuleType lexerRuleType, TokenType tokenType)
 {
     _lexerRuleType = lexerRuleType;
     _tokenType     = tokenType;
 }