stage1 初步实现
This commit is contained in:
@@ -270,7 +270,8 @@ spl_tok_vec_t spl_lex(const char *source, const char *fname) {
|
||||
/* Hex literal */
|
||||
offset += 2;
|
||||
col += 2;
|
||||
while (offset < len && isxdigit((unsigned char)source[offset])) {
|
||||
while (offset < len &&
|
||||
(isxdigit((unsigned char)source[offset]) || source[offset] == '_')) {
|
||||
offset++;
|
||||
col++;
|
||||
}
|
||||
@@ -280,7 +281,8 @@ spl_tok_vec_t spl_lex(const char *source, const char *fname) {
|
||||
/* Binary literal */
|
||||
offset += 2;
|
||||
col += 2;
|
||||
while (offset < len && (source[offset] == '0' || source[offset] == '1')) {
|
||||
while (offset < len && (source[offset] == '0' || source[offset] == '1' ||
|
||||
source[offset] == '_')) {
|
||||
offset++;
|
||||
col++;
|
||||
}
|
||||
@@ -290,7 +292,8 @@ spl_tok_vec_t spl_lex(const char *source, const char *fname) {
|
||||
/* Octal literal */
|
||||
offset += 2;
|
||||
col += 2;
|
||||
while (offset < len && source[offset] >= '0' && source[offset] <= '7') {
|
||||
while (offset < len && ((source[offset] >= '0' && source[offset] <= '7') ||
|
||||
source[offset] == '_')) {
|
||||
offset++;
|
||||
col++;
|
||||
}
|
||||
@@ -299,7 +302,8 @@ spl_tok_vec_t spl_lex(const char *source, const char *fname) {
|
||||
}
|
||||
|
||||
/* Decimal integer or float */
|
||||
while (offset < len && isdigit((unsigned char)source[offset])) {
|
||||
while (offset < len &&
|
||||
(isdigit((unsigned char)source[offset]) || source[offset] == '_')) {
|
||||
offset++;
|
||||
col++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user