Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:lib\ts_fsm.c Create Date:2022-07-28 07:10:48
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:fsm_find

Proto:static unsigned int fsm_find(struct ts_config *conf, struct ts_state *state)

Type:unsigned int

Parameter:

TypeParameterName
struct ts_config *conf
struct ts_state *state
136  fsm = ts_config_priv(conf)
137  cur = NULL
138  block_idx = 0
139  block_len = 0 , consumed = offset
157  If end_of_data() Then Go to no_match
160  strict = recur != TS_FSM_HEAD_IGNORE
162  startover :
163  match_start = consumed + block_idx
165  When tok_idx < ntokens cycle
166  cur = tokens[tok_idx]
168  If Value is more likely to compile time(tok_idx < (ntokens - 1)) Then next = tokens[tok_idx + 1]
170  Else next = NULL
174  Case recur == TS_FSM_SINGLE
175  If end_of_data() Then Go to no_match
178  If Not match_token(cur, data[block_idx]) Then TOKEN_MISMATCH()
180  Break
182  Case recur == TS_FSM_PERHAPS
183  If end_of_data() || Not match_token(cur, data[block_idx]) Then Continue
186  Break
188  Case recur == TS_FSM_MULTI
189  If end_of_data() Then Go to no_match
192  If Not match_token(cur, data[block_idx]) Then TOKEN_MISMATCH()
195  block_idx++
198  Case recur == TS_FSM_ANY
199  If (next == NULL) Then Go to found_match
202  If end_of_data() Then Continue
205  When Not match_token(next, data[block_idx]) cycle
206  If Not match_token(cur, data[block_idx]) Then TOKEN_MISMATCH()
208  block_idx++
209  If end_of_data() Then Go to no_match
212  Continue
218  Case recur == TS_FSM_HEAD_IGNORE
219  If end_of_data() Then Continue
222  When Not match_token(next, data[block_idx]) cycle
229  If Not match_token(cur, data[block_idx]) Then Go to no_match
232  block_idx++
233  If end_of_data() Then Go to no_match
238  Continue
241  block_idx++
244  If end_of_data() Then Go to found_match
247  no_match :
248  Return UINT_MAX
250  found_match :
251  offset = consumed + block_idx
252  Return match_start