1 /** 2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef ES2PANDA_PARSER_CORE_LETTERS_H 17 #define ES2PANDA_PARSER_CORE_LETTERS_H 18 19 namespace panda::es2panda::lexer { 20 21 #define LEX_ASCII_MAX_BITS 128 22 23 #define LEX_CHAR_NULL 0x00 /* \0 */ 24 25 // Line Terminators 26 #define LEX_CHAR_LF 0x0A /* line feed */ 27 #define LEX_CHAR_CR 0x0D /* carriage return */ 28 #define LEX_CHAR_LS 0x2028 /* line separator */ 29 #define LEX_CHAR_PS 0x2029 /* paragraph separator */ 30 31 #define LEX_CHAR_LOWERCASE_A 0x61 /* a */ 32 #define LEX_CHAR_LOWERCASE_B 0x62 /* b */ 33 #define LEX_CHAR_LOWERCASE_C 0x63 /* c */ 34 #define LEX_CHAR_LOWERCASE_D 0x64 /* d */ 35 #define LEX_CHAR_LOWERCASE_E 0X65 /* e */ 36 #define LEX_CHAR_LOWERCASE_F 0X66 /* f */ 37 #define LEX_CHAR_LOWERCASE_G 0X67 /* g */ 38 #define LEX_CHAR_LOWERCASE_H 0X68 /* h */ 39 #define LEX_CHAR_LOWERCASE_I 0X69 /* i */ 40 #define LEX_CHAR_LOWERCASE_J 0X6A /* j */ 41 #define LEX_CHAR_LOWERCASE_K 0X6B /* k */ 42 #define LEX_CHAR_LOWERCASE_L 0X6C /* l */ 43 #define LEX_CHAR_LOWERCASE_M 0X6D /* m */ 44 #define LEX_CHAR_LOWERCASE_N 0X6E /* n */ 45 #define LEX_CHAR_LOWERCASE_O 0X6F /* o */ 46 #define LEX_CHAR_LOWERCASE_P 0x70 /* p */ 47 #define LEX_CHAR_LOWERCASE_Q 0x71 /* q */ 48 #define LEX_CHAR_LOWERCASE_R 0x72 /* r */ 49 #define LEX_CHAR_LOWERCASE_S 0x73 /* s */ 50 #define LEX_CHAR_LOWERCASE_T 0x74 /* t */ 51 #define LEX_CHAR_LOWERCASE_U 0x75 /* u */ 52 #define LEX_CHAR_LOWERCASE_V 0x76 /* v */ 53 #define LEX_CHAR_LOWERCASE_W 0x77 /* W */ 54 #define LEX_CHAR_LOWERCASE_X 0x78 /* x */ 55 #define LEX_CHAR_LOWERCASE_Y 0x79 /* y */ 56 #define LEX_CHAR_LOWERCASE_Z 0x7A /* z */ 57 58 #define LEX_CHAR_UPPERCASE_A 0X41 /* A */ 59 #define LEX_CHAR_UPPERCASE_B 0X42 /* B */ 60 #define LEX_CHAR_UPPERCASE_C 0X43 /* C */ 61 #define LEX_CHAR_UPPERCASE_D 0X44 /* B */ 62 #define LEX_CHAR_UPPERCASE_E 0X45 /* E */ 63 #define LEX_CHAR_UPPERCASE_F 0X46 /* F */ 64 #define LEX_CHAR_UPPERCASE_G 0X47 /* G */ 65 #define LEX_CHAR_UPPERCASE_H 0X48 /* H */ 66 #define LEX_CHAR_UPPERCASE_I 0X49 /* I */ 67 #define LEX_CHAR_UPPERCASE_J 0X4A /* J */ 68 #define LEX_CHAR_UPPERCASE_K 0X4B /* K */ 69 #define LEX_CHAR_UPPERCASE_L 0X4C /* L */ 70 #define LEX_CHAR_UPPERCASE_M 0X4D /* M */ 71 #define LEX_CHAR_UPPERCASE_N 0X4E /* N */ 72 #define LEX_CHAR_UPPERCASE_O 0X4F /* O */ 73 #define LEX_CHAR_UPPERCASE_P 0X50 /* P */ 74 #define LEX_CHAR_UPPERCASE_Q 0X51 /* Q */ 75 #define LEX_CHAR_UPPERCASE_R 0X52 /* R */ 76 #define LEX_CHAR_UPPERCASE_S 0X53 /* S */ 77 #define LEX_CHAR_UPPERCASE_T 0X54 /* T */ 78 #define LEX_CHAR_UPPERCASE_U 0X55 /* U */ 79 #define LEX_CHAR_UPPERCASE_V 0X56 /* V */ 80 #define LEX_CHAR_UPPERCASE_W 0X57 /* W */ 81 #define LEX_CHAR_UPPERCASE_X 0x58 /* X */ 82 #define LEX_CHAR_UPPERCASE_Y 0x59 /* Y */ 83 #define LEX_CHAR_UPPERCASE_Z 0x5A /* Z */ 84 85 #define LEX_CHAR_BS 0x08 /* backspace */ 86 #define LEX_CHAR_TAB 0x09 /* character tabulation */ 87 #define LEX_CHAR_VT 0x0B /* liner tabulation */ 88 #define LEX_CHAR_FF 0x0C /* form feed */ 89 #define LEX_CHAR_SP 0x20 /* space */ 90 #define LEX_CHAR_NBSP 0xA0 /* no-break space */ 91 #define LEX_CHAR_ZWNBSP 0xFEFF /* zero width no-break space */ 92 #define LEX_CHAR_IGSP 0x3000 /* ideographic space */ 93 #define LEX_CHAR_MVS 0x180e /* MONGOLIAN VOWEL SEPARATOR (U+180E) */ 94 #define LEX_CHAR_DOUBLE_QUOTE 0x22 /* " */ 95 #define LEX_CHAR_DOLLAR_SIGN 0x24 /* $ */ 96 #define LEX_CHAR_SINGLE_QUOTE 0x27 /* ' */ 97 #define LEX_CHAR_DOT 0x2E /* . */ 98 #define LEX_CHAR_NLINE 0x85 /* nextline */ 99 100 #define LEX_CHAR_0 0x30 /* 0 */ 101 #define LEX_CHAR_1 0x31 /* 1 */ 102 #define LEX_CHAR_2 0x32 /* 2 */ 103 #define LEX_CHAR_3 0x33 /* 3 */ 104 #define LEX_CHAR_4 0x34 /* 4 */ 105 #define LEX_CHAR_5 0x35 /* 5 */ 106 #define LEX_CHAR_6 0x36 /* 6 */ 107 #define LEX_CHAR_7 0x37 /* 7 */ 108 #define LEX_CHAR_8 0x38 /* 8 */ 109 #define LEX_CHAR_9 0x39 /* 9 */ 110 111 #define LEX_CHAR_BACKSLASH 0X5c /* \\ */ 112 #define LEX_CHAR_UNDERSCORE 0x5F /* _ */ 113 114 // Punctuator characters 115 #define LEX_CHAR_EXCLAMATION 0x21 /* exclamation mark */ 116 #define LEX_CHAR_PERCENT 0x25 /* percent sign */ 117 #define LEX_CHAR_AMPERSAND 0x26 /* ampersand */ 118 #define LEX_CHAR_LEFT_PAREN 0x28 /* left parenthesis */ 119 #define LEX_CHAR_RIGHT_PAREN 0x29 /* right parenthesis */ 120 #define LEX_CHAR_ASTERISK 0x2A /* asterisk */ 121 #define LEX_CHAR_PLUS 0x2B /* plus sign */ 122 #define LEX_CHAR_COMMA 0x2C /* comma */ 123 #define LEX_CHAR_PLUS 0x2B /* plus */ 124 #define LEX_CHAR_MINUS 0x2D /* hyphen-minus */ 125 #define LEX_CHAR_DOT 0x2E /* dot */ 126 #define LEX_CHAR_SLASH 0x2F /* solidus */ 127 #define LEX_CHAR_COLON 0x3A /* colon */ 128 #define LEX_CHAR_SEMICOLON 0x3B /* semicolon */ 129 #define LEX_CHAR_LESS_THAN 0x3C /* less-than sign */ 130 #define LEX_CHAR_EQUALS 0x3D /* equals sign */ 131 #define LEX_CHAR_GREATER_THAN 0x3E /* greater-than sign */ 132 #define LEX_CHAR_QUESTION 0x3F /* question mark */ 133 #define LEX_CHAR_LEFT_SQUARE 0x5B /* left square bracket */ 134 #define LEX_CHAR_RIGHT_SQUARE 0x5D /* right square bracket */ 135 #define LEX_CHAR_CIRCUMFLEX 0x5E /* circumflex accent */ 136 #define LEX_CHAR_LEFT_BRACE 0x7B /* left curly bracket */ 137 #define LEX_CHAR_VLINE 0x7C /* vertical line */ 138 #define LEX_CHAR_RIGHT_BRACE 0x7D /* right curly bracket */ 139 #define LEX_CHAR_TILDE 0x7E /* tilde */ 140 #define LEX_CHAR_BACK_TICK 0x60 /* back tick */ 141 #define LEX_CHAR_HASH_MARK 0x23 /* hash mark */ 142 #define LEX_CHAR_AT 0x40 /* at */ 143 144 #define LEX_CHAR_ZWNJ 0x200C /* zero width non-joiner */ 145 #define LEX_CHAR_ZWJ 0x200D /* zero width joiner */ 146 147 #define LEX_VERTICAL_TILDE 0x2E2F /* vertical tilde */ 148 149 #define LEX_TO_ASCII_LOWERCASE(character) ((character) | LEX_CHAR_SP) 150 151 #define LEX_UTF8_2_BYTE_CODE_POINT_MIN (0x80) 152 #define LEX_UTF8_EXTRA_BYTE_MASK (0xC0) 153 154 #define LEX_CHAR_EOS 0xFFFF 155 #define UNICODE_CODE_POINT_MAX 0x10FFFF 156 #define UNICODE_INVALID_CP UINT32_MAX 157 158 } // namespace panda::es2panda::lexer 159 160 #endif 161