Lines Matching refs:state

9 #            Compile the regular expression paser state table data into initialized C data.
27 $num_states = 1; # Always the state number for the line being compiled.
30 $states{"pop"} = 255; # Add the "pop" to the list of defined state names.
31 # This prevents any state from being labelled with "pop",
32 # and resolves references to "pop" in the next state field.
55 # Does the first token end with a ":"? If so, it's the name of a state.
56 # Put in a hash, together with the current state number,
61 $state_name =~ s/://; # strip off the colon from the state name.
64 print " rbbicst: at line $line-num duplicate definition of state $state_name\n";
70 # otherwise assume that a state definition is on the same line and fall through.
81 # character [n] target-state [^push-state] [function-name]
88 $state_line_num[$num_states] = $line_num; # remember line number with each state
118 # do the destination state.
122 print " rbbicsts: at line $line_num, destination state missing.\n";
128 # do the push state, if present.
134 print " rbbicsts: at line $line_num, expected state after ^ (no spaces).\n";
160 # C source code for the state transition table.
162 # We read all states first, before writing anything, so that the state numbers
170 for ($state=1; $state < $num_states; $state++) {
171 if ($state_char_class[$state] ne "") {
172 if ($charClasses{$state_char_class[$state]} == 0) {
173 $charClasses{$state_char_class[$state]} = 1;
176 if ($state_func_name[$state] eq "") {
177 $state_func_name[$state] = "doNOP";
179 if ($actions{$state_action_name[$state]} == 0) {
180 $actions{$state_func_name[$state]} = 1;
188 $states{"exit"} = 0; # Predefined state name, terminates state machine.
189 for ($state=1; $state<$num_states; $state++) {
190 if ($states{$state_dest_state[$state]} == 0 && $state_dest_state[$state] ne "exit") {
191 print "Error at line $state_line_num[$state]: target state \"$state_dest_state[$state]\" is not defined.\n";
194 if ($state_push_state[$state] ne "" && $states{$state_push_state[$state]} == 0) {
195 print "Error at line $state_line_num[$state]: target state \"$state_push_state[$state]\" is not defined.\n";
205 print "// This file contains the state table for the ICU Regular Expression Pattern Parser\n";
207 print "// the rule parser state definitions file \"regexcst.txt\".\n";
228 # They have no corresponding UnicodeSet object in the state machine,
239 # Normal character class. Fill in array with a ptr to the corresponding UnicodeSet in the state machine.
262 print "// for the pattern parser state machine.\n";
268 print " uint8_t fNextState; // 0-250: normal next-state numbers\n";
269 print " // 255: pop next-state from stack.\n";
275 # emit the state transition table
279 for ($state=1; $state < $num_states; $state++) {
280 print " , {$state_func_name[$state],";
281 if ($state_literal_chars[$state] ne "") {
282 $c = $state_literal_chars[$state];
285 print " $charClasses{$state_char_class[$state]},";
287 print " $states{$state_dest_state[$state]},";
289 # The push-state field is optional. If omitted, fill field with a zero, which flags
290 # the state machine that there is no push state.
291 if ($state_push_state[$state] eq "") {
294 print " $states{$state_push_state[$state]},";
296 print " $state_flag[$state]} ";
298 # Put out a C++ comment showing the number (index) of this state row,
299 # and, if this is the first row of the table for this state, the state name.
300 print " // $state ";
301 if ($stateNames[$state] ne "") {
302 print " $stateNames[$state]";
310 # emit a mapping array from state numbers to state names.
315 for ($state=0; $state<$num_states; $state++) {
316 if ($stateNames[$state] ne "") {
317 print " \"$stateNames[$state]\",\n";