-
-
Notifications
You must be signed in to change notification settings - Fork 58
Fix lx token identification #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
825303f
cb42d58
7824e6a
26e2b13
862a68c
affca78
a8f0c59
552aa01
beebd1b
ae53e94
ea9c90b
17d415d
7ed18b9
1e55db8
4a5ca84
f25e8b7
051aaf0
08fd72c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -210,7 +210,7 @@ print_groups(FILE *f, const struct fsm_options *opt, | |
| } | ||
|
|
||
| static int | ||
| print_case(FILE *f, const struct ir *ir, | ||
| print_case(FILE *f, const struct ir *ir, fsm_state_t state_id, | ||
| const struct fsm_options *opt, | ||
| const struct fsm_hooks *hooks, | ||
| const char *cp, | ||
|
|
@@ -222,10 +222,16 @@ print_case(FILE *f, const struct ir *ir, | |
| assert(f != NULL); | ||
| assert(cs != NULL); | ||
|
|
||
| assert(state_id < ir->n); | ||
| const struct fsm_state_metadata state_metadata = { | ||
| .end_ids = ir->states[state_id].endids.ids, | ||
| .end_id_count = ir->states[state_id].endids.count, | ||
| }; | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why not pass whatever type There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| switch (cs->strategy) { | ||
| case IR_NONE: | ||
| fprintf(f, "\t\t\t"); | ||
| if (-1 == print_hook_reject(f, opt, hooks, default_reject, NULL)) { | ||
| if (-1 == print_hook_reject(f, opt, hooks, &state_metadata, default_reject, NULL)) { | ||
| return -1; | ||
| } | ||
| fprintf(f, "\n"); | ||
|
|
@@ -254,7 +260,7 @@ print_case(FILE *f, const struct ir *ir, | |
| print_groups(f, opt, ir_indexof(ir, cs), cs->u.partial.groups, cs->u.partial.n); | ||
|
|
||
| fprintf(f, "\t\t\tdefault: "); | ||
| if (-1 == print_hook_reject(f, opt, hooks, default_reject, NULL)) { | ||
| if (-1 == print_hook_reject(f, opt, hooks, &state_metadata, default_reject, NULL)) { | ||
| return -1; | ||
| } | ||
| fprintf(f, "\n"); | ||
|
|
@@ -285,7 +291,7 @@ print_case(FILE *f, const struct ir *ir, | |
|
|
||
| print_ranges(f, opt, cs->u.error.error.ranges, cs->u.error.error.n); | ||
| fprintf(f, " "); | ||
| if (-1 == print_hook_reject(f, opt, hooks, default_reject, NULL)) { | ||
| if (-1 == print_hook_reject(f, opt, hooks, &state_metadata, default_reject, NULL)) { | ||
| return -1; | ||
| } | ||
| fprintf(f, "\n"); | ||
|
|
@@ -398,7 +404,7 @@ print_endstates(FILE *f, | |
|
|
||
| /* unexpected EOT */ | ||
| fprintf(f, "\tdefault: "); | ||
| if (-1 == print_hook_reject(f, opt, hooks, default_reject, NULL)) { | ||
| if (-1 == print_hook_reject(f, opt, hooks, NULL, default_reject, NULL)) { | ||
| return -1; | ||
| } | ||
| fprintf(f, "\n"); | ||
|
|
@@ -435,7 +441,7 @@ fsm_print_cfrag(FILE *f, const struct ir *ir, | |
| } | ||
| fprintf(f, "\n"); | ||
|
|
||
| if (-1 == print_case(f, ir, opt, hooks, cp, &ir->states[i])) { | ||
| if (-1 == print_case(f, ir, i, opt, hooks, cp, &ir->states[i])) { | ||
| return -1; | ||
| } | ||
|
|
||
|
|
@@ -500,6 +506,12 @@ fsm_print_c_body(FILE *f, const struct ir *ir, | |
| break; | ||
| } | ||
|
|
||
| if (hooks->advance != NULL) { | ||
| if (-1 == hooks->advance(f, opt, cp, hooks->hook_opaque)) { | ||
| return -1; | ||
| } | ||
| } | ||
|
|
||
| if (-1 == fsm_print_cfrag(f, ir, opt, hooks, cp)) { | ||
| return -1; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,11 +91,7 @@ struct ir_state { | |
| } error; | ||
|
|
||
| struct { | ||
| /* Note: This is allocated separately, to avoid | ||
| * making the union significantly larger. */ | ||
| struct ir_state_table { | ||
| unsigned to[FSM_SIGMA_COUNT]; | ||
| } *table; | ||
| int not_yet_implemented; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nothing uses this yet, but referencing |
||
| } table; | ||
| } u; | ||
| }; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This may have been causing test failures to go unnoticed before.