Skip to content

Instantly share code, notes, and snippets.

@nchanged
Created May 21, 2019 07:32
Show Gist options
  • Save nchanged/8db0eaca2722cb608288576cb343788e to your computer and use it in GitHub Desktop.
Save nchanged/8db0eaca2722cb608288576cb343788e to your computer and use it in GitHub Desktop.
export enum CharType {
Fill = 1,
ALPHABET = 1 << 2,
DIGIT = 1 << 3,
COLON = 1 << 4, // ":"
SEMICOLON = 1 << 5, // ";",
HYPHEN = 1 << 6, // "<"
NUMBER_SIGN = 1 << 7,
END_OF_LINE = 1 << 8,
QUESTION_MARK = 1 << 9,
AT_SIGN = 1 << 10, // @
LEFT_CURLY_BRACE = 1 << 11, // { left curly brace
RIGHT_CURLY_BRACE = 1 << 12, // { left curly brace
VERTICAL_BAR = 1 << 13, // { left curly brace
TILDE = 1 << 14,
LEFT_SQUARE_BRACKET = 1 << 15,
BACK_SLASH = 1 << 16,
RIGHT_SQUARE_BRACKET = 1 << 17,
//CARET = 1 << 17,
UNDERSCORE = 1 << 18,
SPACE = 1 << 19,
LEFT_PARENTHESIS = 1 << 20,
RIGHT_PARENTHESIS = 1 << 21,
ASTERISK = 1 << 22,
UNARY = 1 << 23,
DOLLAR = 1 << 24,
PERCENT = 1 << 25,
AMPERSAND = 1 << 26,
QUOATATION_MARK = 1 << 27,
COMMA = 1 << 28,
PERIOD = 1 << 29,
FORWARD_SLASH = 1 << 30
}
export const CharTypes = [
CharType.Fill, // 0 - "NUL" null character
CharType.Fill, // 1 - "SOH" start of header
CharType.Fill, // 2 - "STX" start of text
CharType.Fill, // 3 - "ETX" end of text
CharType.Fill, // 4 - "EOT" end of transmission
CharType.Fill, // 5 - "ENQ" enquiry
CharType.Fill, // 6 - "ACK" acknowledge
CharType.Fill, // 7 - "BEL" bell (ring)
CharType.Fill, // 8 - "BS" backspace
CharType.Fill, // 9 - "HT" horizontal tab
CharType.END_OF_LINE, // 10 - "LF" line feed
CharType.Fill, // 11 - "VT" vertical tab
CharType.Fill, // 12 - "FF" form feed
CharType.Fill, // 13 - "CR" carriage return
CharType.Fill, // 14 - "SO" shift out
CharType.Fill, // 15 - "SI" shift in
CharType.Fill, // 16 - "DLE" data link escape
CharType.Fill, // 17 - "DC1" device control 1
CharType.Fill, // 18 - "DC2" device control 2
CharType.Fill, // 19 - "DC3" device control 3
CharType.Fill, // 20 - "DC4" device control 4
CharType.Fill, // 21 - "NAK" negative acknowledge
CharType.Fill, // 22 - "SYN" synchronize
CharType.Fill, // 23 - "ETB" end transmission block
CharType.Fill, // 24 - "CAN" cancel
CharType.Fill, // 25 - "EM" end of medium
CharType.Fill, // 26 - "SUB" substitute
CharType.Fill, // 27 - "ESC" escape
CharType.Fill, // 28 - "FS" file separator
CharType.Fill, // 29 - "GS" group separator
CharType.Fill, // 30 - "RS" record separator
CharType.Fill, // 31 - "US" unit separator
CharType.SPACE, // 32 - "" space
CharType.UNARY, // 33 - "!" exclamation mark
CharType.QUOATATION_MARK, // 34 - """ quotation mark
CharType.NUMBER_SIGN, // 35 - "#" number sign
CharType.DOLLAR, // 36 - "$" dollar sign
CharType.PERCENT, // 37 - "%" percent sign
CharType.AMPERSAND, // 38 - "&" ampersand
CharType.QUOATATION_MARK, // 39 - "'" apostrophe
CharType.LEFT_PARENTHESIS, // 40 - "(" left parenthesis
CharType.RIGHT_PARENTHESIS, // 41 - ")" right parenthesis
CharType.ASTERISK, // 42 - "*" asterisk
CharType.UNARY, // 43 - +" plus sign
CharType.COMMA, // 44 - "," comma
CharType.HYPHEN | CharType.UNARY, // 45 - "-" hyphen
CharType.PERIOD, // 46 - "." period
CharType.FORWARD_SLASH, // 47 - "/" slash
CharType.DIGIT, // 48 - "0" digit 0
CharType.DIGIT, // 49 - "1" digit 1
CharType.DIGIT, // 50 - "2" digit 2
CharType.DIGIT, // 51 - "3" digit 3
CharType.DIGIT, // 52 - "4" digit 4
CharType.DIGIT, // 53 - "5" digit 5
CharType.DIGIT, // 54 - "6" digit 6
CharType.DIGIT, // 55 - "7" digit 7
CharType.DIGIT, // 56 - "8" digit 8
CharType.DIGIT, // 57 - "9" digit 9
CharType.COLON, // 58 - ":" colon
CharType.SEMICOLON, // 59 - ";" semicolon
CharType.UNARY, // 60 - "<" less-than
CharType.UNARY, // 61 - "=" equals-to
CharType.UNARY, // 62 - ">" greater-than
CharType.QUESTION_MARK, // 63 - "?" question mark
CharType.AT_SIGN, // 64 - "@" at sign
CharType.ALPHABET, // 65 - "A" uppercase A
CharType.ALPHABET, // 66 - "B" uppercase B
CharType.ALPHABET, // 67 - "C" uppercase C
CharType.ALPHABET, // 68 - "D" uppercase D
CharType.ALPHABET, // 69 - "E" uppercase E
CharType.ALPHABET, // 70 - "F" uppercase F
CharType.ALPHABET, // 71 - "G" uppercase G
CharType.ALPHABET, // 72 - "H" uppercase H
CharType.ALPHABET, // 73 - "I" uppercase I
CharType.ALPHABET, // 74 - "J" uppercase J
CharType.ALPHABET, // 75 - "K" uppercase K
CharType.ALPHABET, // 76 - "L" uppercase L
CharType.ALPHABET, // 77 - "M" uppercase M
CharType.ALPHABET, // 78 - "N" uppercase N
CharType.ALPHABET, // 79 - "O" uppercase O
CharType.ALPHABET, // 80 - "P" uppercase P
CharType.ALPHABET, // 81 - "Q" uppercase Q
CharType.ALPHABET, // 82 - "R" uppercase R
CharType.ALPHABET, // 83 - "S" uppercase S
CharType.ALPHABET, // 84 - "T" uppercase T
CharType.ALPHABET, // 85 - "U" uppercase U
CharType.ALPHABET, // 86 - "V" uppercase V
CharType.ALPHABET, // 87 - "W" uppercase W
CharType.ALPHABET, // 88 - "X" uppercase X
CharType.ALPHABET, // 89 - "Y" uppercase Y
CharType.ALPHABET, // 90 - "Z" uppercase Z
CharType.LEFT_SQUARE_BRACKET, // 91 - "[" left square bracket
CharType.FORWARD_SLASH, // 92 - "\" backslash
CharType.RIGHT_SQUARE_BRACKET, // 93 - "]" right square bracket
CharType.UNARY, // 94 - "^" caret
CharType.UNDERSCORE, // 95 - "_" underscore
CharType.Fill, // 96 - "`" grave accent
CharType.ALPHABET, // 97 - "a" lowercase a
CharType.ALPHABET, // 98 - "b" lowercase b
CharType.ALPHABET, // 99 - "c" lowercase c
CharType.ALPHABET, // 100 - "d" lowercase d
CharType.ALPHABET, // 101 - "e" lowercase e
CharType.ALPHABET, // 102 - "f" lowercase f
CharType.ALPHABET, // 103 - "g" lowercase g
CharType.ALPHABET, // 104 - "h" lowercase h
CharType.ALPHABET, // 105 - "i" lowercase i
CharType.ALPHABET, // 106 - "j" lowercase j
CharType.ALPHABET, // 107 - "k" lowercase k
CharType.ALPHABET, // 108 - "l" lowercase l
CharType.ALPHABET, // 109 - "m" lowercase m
CharType.ALPHABET, // 110 - "n" lowercase n
CharType.ALPHABET, // 111 - "o" lowercase o
CharType.ALPHABET, // 112 - "p" lowercase p
CharType.ALPHABET, // 113 - "q" lowercase q
CharType.ALPHABET, // 114 - "r" lowercase r
CharType.ALPHABET, // 115 - "s" lowercase s
CharType.ALPHABET, // 116 - "t" lowercase t
CharType.ALPHABET, // 117 - "u" lowercase u
CharType.ALPHABET, // 118 - "v" lowercase v
CharType.ALPHABET, // 119 - "w" lowercase w
CharType.ALPHABET, // 120 - "x" lowercase x
CharType.ALPHABET, // 121 - "y" lowercase y
CharType.ALPHABET, // 122 - "z" lowercase z
CharType.LEFT_CURLY_BRACE, // 123 - "{" left curly brace
CharType.VERTICAL_BAR, // 124 - "|" vertical bar
CharType.RIGHT_CURLY_BRACE, // 125 - "}" right curly brace
CharType.TILDE // 126 - "~" tilde
];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment