fixed tokens

This commit is contained in:
2026-09-27 00:14:31 -06:00
parent 6e13571f60
commit 2d9a962cf7
6 changed files with 75 additions and 26 deletions
+5 -5
View File
@@ -9,7 +9,7 @@ namespace spider::asm_ebnf {
}
bool isWhithespaceCharNotCrLf(u32 ch) {
return ch == u32(' ');
return ch == u32(' ') || ch == u32('\t');
}
bool isUTF8CharNotCrLf(u32 ch) {
@@ -17,11 +17,11 @@ namespace spider::asm_ebnf {
}
bool isUTF8CharLitCont(u32 ch) {
return ch != u32('\'');
return ch != u32('\'') && ch != u32('\\') && ch != u32('\r') && ch != u32('\n');
}
bool isUTF8StringLitCont(u32 ch) {
return ch != u32('"');
return ch != u32('"') && ch != u32('\\') && ch != u32('\r') && ch != u32('\n');
}
const Token* letter;
@@ -151,12 +151,12 @@ namespace spider::asm_ebnf {
octal_lit = tf.tag(tf.seq({ tf.opt(sign), tf["0c"], octal_digit, tf.rep(octal_digit) }), "octal_lit", true);
binary_lit = tf.tag(tf.seq({ tf.opt(sign), tf["0b"], binary_digit, tf.rep(binary_digit) }), "binary_lit", true);
literal = tf.tag(tf.choice({ float_lit, decimal_lit, hex_lit, octal_lit, binary_lit, string_lit, char_lit }), "literal");
literal = tf.tag(tf.choice({ hex_lit, octal_lit, binary_lit, float_lit, decimal_lit, string_lit, char_lit }), "literal");
literal_cast = tf.tag(tf.seq({ tf.choice("BSILFD"), ws_optional, tf["("], ws_optional, literal, ws_optional, tf[")"] }), "literal_cast");
literal_decl = tf.tag(tf.choice({ literal, literal_cast }), "literal_decl");
// (* Operands *)
register_tok = tf.tag(tf.seq({ tf["R"], alpha_num_char }), "register", true);
register_tok = tf.tag(tf.seq({ tf["R"], alpha_num_char, tf.not_(tf.choice({ alpha_num_char, tf["_"] })) }), "register", true);
addrm_ind = tf.tag(tf.seq({ tf["["], ws_optional, literal_decl, ws_optional, tf["]"] }), "addrm_ind", true);
addrm_ptr = tf.tag(tf.seq({ tf["["], ws_optional, register_tok, ws_optional, tf["]"] }), "addrm_ptr", true);