mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
improve tokenizer
This commit is contained in:
parent
7fe9535b00
commit
61076ffbf7
@ -134,8 +134,8 @@ const char* tokenizer_next_expr_until(tokenizer_t* tokenizer, const char* str) {
|
||||
lparent++;
|
||||
} else if (c == ')') {
|
||||
lparent--;
|
||||
tokenizer->cursor++;
|
||||
if (lparent <= 0) {
|
||||
tokenizer->cursor++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -176,3 +176,13 @@ TEST(Tokenizer, expr8) {
|
||||
|
||||
tokenizer_deinit(t);
|
||||
}
|
||||
|
||||
TEST(Tokenizer, expr9) {
|
||||
tokenizer_t tokenizer;
|
||||
|
||||
tokenizer_t* t = tokenizer_init_ex(&tokenizer, "{fformat(\"%2.2lf F\", round($value * 1.8 + 32))}", 100, "{}", "=,");
|
||||
ASSERT_EQ(string(tokenizer_next_expr_until(t, ",}")), string("fformat(\"%2.2lf F\", round($value * 1.8 + 32))"));
|
||||
|
||||
tokenizer_deinit(t);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user