##
## ScannerConstants.py
##      - class that defines scanner related constants
##

# $Id: ScannerConstants.py,v 1.9 2007/01/18 07:15:10 jarda Exp $


# import of required modules {{{
from Plex import *
# }}}


# class ScannerConstants() {{{
class ScannerConstants(object):
    # DOC {{{
    """Class that defines scanner related constants.
    """
    # }}}


    # STATIC VARIABLES {{{
    # token strings {{{
    S_NEWLINE               = Str('\n')
    S_SPACEORTAB            = ' \t\r'
    S_LEFT_PARENTHESIS      = Str('(')
    S_RIGHT_PARENTHESIS     = Str(')')
    S_EQUAL_SIGN            = Str('=')
    S_PLUS_SIGN             = Str('+')
    S_ASTERISK              = Str('*')
    S_COMA                  = Str(',')
    S_SYMBOL                = Rep1(Any('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_'))
    S_SYMBOL_WITH_DOTS      = Rep1(Any('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_.'))
    S_SYMBOL_WITH_T_AND_H   = Rep1(Any('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_~-'))
    S_PLA_SYMBOL            = Rep1(Any('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_~-[]<>+'))
    S_SLIF_SYMBOL           = Rep1(Any('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:^%[]_./~-<>$'))
    S_DOT                   = Str('.')
    S_LEFT_SQUARE_BRACE     = Str('[')
    S_RIGHT_SQUARE_BRACE    = Str(']')
    S_SINGLE_QUOTE          = Str("'")
    S_DOUBLE_QUOTE          = Str('"')
    S_SEMICOLON             = Str(';')
    S_BAR                   = Str('|')
    S_AT                    = Str('@')
    S_TOKEN                 = Rep1(AnyBut(S_SPACEORTAB + '\n'))
    # }}}

    # tokens {{{
    T_NEWLINE               = 1
    T_LEFT_PARENTHESIS      = 2
    T_RIGHT_PARENTHESIS     = 3
    T_COMMENT_START         = 4
    T_COMMENT               = 5
    T_INPUT                 = 6
    T_OUTPUT                = 7
    T_NAME                  = 8
    T_NAMES                 = 9
    T_INPUTS                = 20
    T_OUTPUTS               = 21
    T_DFF                   = 30
    T_NOT                   = 40
    T_OR                    = 41
    T_AND                   = 42
    T_XOR                   = 43
    T_NAND                  = 44
    T_NOR                   = 45
    T_XNOR                  = 46
    T_BUF                   = 47
    T_SYMBOL                = 100
    T_EQUAL_SIGN            = 101
    T_COMA                  = 102
    T_DOT                   = 103
    T_LEFT_SQUARE_BRACE     = 104
    T_RIGHT_SQUARE_BRACE    = 105
    T_SINGLE_QUOTE          = 106
    T_DOUBLE_QUOTE          = 107
    T_SEMICOLON             = 108
    T_TERMS_COUNT           = 109
    T_END                   = 110
    T_MATRIX_TYPE           = 111
    T_OUTPUT_FUNCTION_NAMES = 112
    T_BINARY_VARIABLE_NAMES = 113
    T_STATES_COUNT          = 114
    T_PLUS_SIGN             = 115
    T_ASTERISK              = 116
    T_RESET_STATE           = 117
    T_AT                    = 118
    T_BAR                   = 119
    T_TRANSITIONS_COUNT     = 120
    T_TOKEN                 = 200
    # }}}

    # lexicon rows {{{
    R_IGNORE_SPACES_AND_TABS = (Rep1(Any(S_SPACEORTAB)), IGNORE)
    R_IGNORE_OTHERS = (Rep1(AnyChar), IGNORE)
    R_NEWLINE = (S_NEWLINE, T_NEWLINE)
    R_SYMBOL = (S_SYMBOL, T_SYMBOL)
    R_EQ_EQUAL_SIGN = (S_EQUAL_SIGN, T_EQUAL_SIGN)
    R_PLUS_SIGN = (S_PLUS_SIGN, T_PLUS_SIGN)
    R_COMA = (S_COMA, T_COMA)
    R_DOT = (S_DOT, T_DOT)
    R_BAR = (S_BAR, T_BAR)
    R_LEFT_PARENTHESIS = (S_LEFT_PARENTHESIS, T_LEFT_PARENTHESIS)
    R_RIGHT_PARENTHESIS = (S_RIGHT_PARENTHESIS, T_RIGHT_PARENTHESIS)
    R_LEFT_SQUARE_BRACE = (S_LEFT_SQUARE_BRACE, T_LEFT_SQUARE_BRACE)
    R_RIGHT_SQUARE_BRACE = (S_RIGHT_SQUARE_BRACE, T_RIGHT_SQUARE_BRACE)
    R_SINGLE_QUOTE = (S_SINGLE_QUOTE, T_SINGLE_QUOTE)
    R_DOUBLE_QUOTE = (S_DOUBLE_QUOTE, T_DOUBLE_QUOTE)
    R_SEMICOLON = (S_SEMICOLON, T_SEMICOLON)
    R_SYMBOL_WITH_DOTS = (S_SYMBOL_WITH_DOTS, T_SYMBOL)
    R_SYMBOL_WITH_T_AND_H = (S_SYMBOL_WITH_T_AND_H, T_SYMBOL)
    R_PLA_SYMBOL = (S_PLA_SYMBOL, T_SYMBOL)
    R_ASTERISK = (S_ASTERISK, T_ASTERISK)
    R_TOKEN = (S_TOKEN, T_TOKEN)
    R_AT = (S_AT, T_AT)
    # }}}
    # }}}


# }}}
