Skip to content

Commit 9b977b2

Browse files
authored
Fix some bugs (#17)
* add test * fix: fix some bugs
1 parent efd1e0d commit 9b977b2

File tree

14 files changed

+7301
-7241
lines changed

14 files changed

+7301
-7241
lines changed

crates/lexer-generator/resources/scan.l

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,9 +1137,9 @@ other .
11371137
loop {
11381138
nchars -= 1;
11391139

1140-
if nchars > 1 &&
1140+
if !(nchars > 1 &&
11411141
(get_char_by_byte_pos(&yytext, nchars - 1) == '+' ||
1142-
get_char_by_byte_pos(&yytext, nchars - 1) == '-') {
1142+
get_char_by_byte_pos(&yytext, nchars - 1) == '-')) {
11431143
break;
11441144
}
11451145
}

crates/lexer-generator/src/lexer_generator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn construct_rule_defs(flex_file: &FlexFile) -> String {
129129
// {original_pattern}
130130
Rule {{
131131
state: State::{s},
132-
pattern: Regex::new(r#"^({pattern})"#).unwrap(),
132+
pattern: Regex::new(r#"(?-u)^({pattern})"#).unwrap(),
133133
kind: RuleKind::{rule_kind},
134134
}}"###,
135135
original_pattern = rule.pattern,

0 commit comments

Comments
 (0)