parameters: (self)
return_statement: return action
docstring: Inlined version of run_machine for speed.
docstring_summary: Inlined version of run_machine for speed.
docstring_tokens: Inlined version of run_machine for speed .
function: def run_machine_inlined(self):
          """
          Inlined version of run_machine for speed.
          """
          state = self.initial_state
          cur_pos = self.cur_pos
          cur_line = self.cur_line
          cur_line_start = self.cur_line_start
          cur_char = self.cur_char
          input_state = self.input_state
          next_pos = self.next_pos
          buffer = self.buffer
          buf_start_pos = self.buf_start_pos
          buf_len = len(buffer)
          b_action, b_cur_pos, b_cur_line, b_cur_line_start, b_cur_char, b_input_state, b_next_pos = \
              None, 0, 0, 0, u'', 0, 0
          trace = self.trace
          while 1:
              if trace:  #TRACE#
                  print("State %d, %d/%d:%s -->" % (  #TRACE#
                      state['number'], input_state, cur_pos, repr(cur_char)))  #TRACE#
              # Begin inlined self.save_for_backup()
              #action = state.action #@slow
              action = state['action']  #@fast
              if action is not None:
                  b_action, b_cur_pos, b_cur_line, b_cur_line_start, b_cur_char, b_input_state, b_next_pos = \
                      action, cur_pos, cur_line, cur_line_start, cur_char, input_state, next_pos
              # End inlined self.save_for_backup()
              c = cur_char
              #new_state = state.new_state(c) #@slow
              new_state = state.get(c, NOT_FOUND)  #@fast
              if new_state is NOT_FOUND:  #@fast
                  new_state = c and state.get('else')  #@fast
              if new_state:
                  if trace:  #TRACE#
                      print("State %d" % new_state['number'])  #TRACE#
                  state = new_state
                  # Begin inlined: self.next_char()
                  if input_state == 1:
                      cur_pos = next_pos
                      # Begin inlined: c = self.read_char()
                      buf_index = next_pos - buf_start_pos
                      if buf_index < buf_len:
                          c = buffer[buf_index]
                          next_pos += 1
                      else:
                          discard = self.start_pos - buf_start_pos
                          data = self.stream.read(0x1000)
                          buffer = self.buffer[discard:] + data
                          self.buffer = buffer
                          buf_start_pos += discard
                          self.buf_start_pos = buf_start_pos
                          buf_len = len(buffer)
                          buf_index -= discard
                          if data:
                              c = buffer[buf_index]
                              next_pos += 1
                          else:
                              c = u''
                      # End inlined: c = self.read_char()
                      if c == u'\n':
                          cur_char = EOL
                          input_state = 2
                      elif not c:
                          cur_char = EOL
                          input_state = 4
                      else:
                          cur_char = c
                  elif input_state == 2:
                      cur_char = u'\n'
                      input_state = 3
                  elif input_state == 3:
                      cur_line += 1
                      cur_line_start = cur_pos = next_pos
                      cur_char = BOL
                      input_state = 1
                  elif input_state == 4:
                      cur_char = EOF
                      input_state = 5
                  else:  # input_state = 5
                      cur_char = u''
                      # End inlined self.next_char()
              else:  # not new_state
                  if trace:  #TRACE#
                      print("blocked")  #TRACE#
                  # Begin inlined: action = self.back_up()
                  if b_action is not None:
                      (action, cur_pos, cur_line, cur_line_start,
                       cur_char, input_state, next_pos) = \
                          (b_action, b_cur_pos, b_cur_line, b_cur_line_start,
                           b_cur_char, b_input_state, b_next_pos)
                  else:
                      action = None
                  break  # while 1
                  # End inlined: action = self.back_up()
          self.cur_pos = cur_pos
          self.cur_line = cur_line
          self.cur_line_start = cur_line_start
          self.cur_char = cur_char
          self.input_state = input_state
          self.next_pos = next_pos
          if trace:  #TRACE#
              if action is not None:  #TRACE#
                  print("Doing %s" % action)  #TRACE#
          return action
function_tokens: def run_machine_inlined ( self ) : state = self . initial_state cur_pos = self . cur_pos cur_line = self . cur_line cur_line_start = self . cur_line_start cur_char = self . cur_char input_state = self . input_state next_pos = self . next_pos buffer = self . buffer buf_start_pos = self . buf_start_pos buf_len = len ( buffer ) b_action , b_cur_pos , b_cur_line , b_cur_line_start , b_cur_char , b_input_state , b_next_pos = None , 0 , 0 , 0 , u'' , 0 , 0 trace = self . trace while 1 : if trace : #TRACE# print ( "State %d, %d/%d:%s -->" % ( #TRACE# state [ 'number' ] , input_state , cur_pos , repr ( cur_char ) ) ) #TRACE# # Begin inlined self.save_for_backup() #action = state.action #@slow action = state [ 'action' ] #@fast if action is not None : b_action , b_cur_pos , b_cur_line , b_cur_line_start , b_cur_char , b_input_state , b_next_pos = action , cur_pos , cur_line , cur_line_start , cur_char , input_state , next_pos # End inlined self.save_for_backup() c = cur_char #new_state = state.new_state(c) #@slow new_state = state . get ( c , NOT_FOUND ) #@fast if new_state is NOT_FOUND : #@fast new_state = c and state . get ( 'else' ) #@fast if new_state : if trace : #TRACE# print ( "State %d" % new_state [ 'number' ] ) #TRACE# state = new_state # Begin inlined: self.next_char() if input_state == 1 : cur_pos = next_pos # Begin inlined: c = self.read_char() buf_index = next_pos - buf_start_pos if buf_index < buf_len : c = buffer [ buf_index ] next_pos += 1 else : discard = self . start_pos - buf_start_pos data = self . stream . read ( 0x1000 ) buffer = self . buffer [ discard : ] + data self . buffer = buffer buf_start_pos += discard self . buf_start_pos = buf_start_pos buf_len = len ( buffer ) buf_index -= discard if data : c = buffer [ buf_index ] next_pos += 1 else : c = u'' # End inlined: c = self.read_char() if c == u'\n' : cur_char = EOL input_state = 2 elif not c : cur_char = EOL input_state = 4 else : cur_char = c elif input_state == 2 : cur_char = u'\n' input_state = 3 elif input_state == 3 : cur_line += 1 cur_line_start = cur_pos = next_pos cur_char = BOL input_state = 1 elif input_state == 4 : cur_char = EOF input_state = 5 else : # input_state = 5 cur_char = u'' # End inlined self.next_char() else : # not new_state if trace : #TRACE# print ( "blocked" ) #TRACE# # Begin inlined: action = self.back_up() if b_action is not None : ( action , cur_pos , cur_line , cur_line_start , cur_char , input_state , next_pos ) = ( b_action , b_cur_pos , b_cur_line , b_cur_line_start , b_cur_char , b_input_state , b_next_pos ) else : action = None break # while 1 # End inlined: action = self.back_up() self . cur_pos = cur_pos self . cur_line = cur_line self . cur_line_start = cur_line_start self . cur_char = cur_char self . input_state = input_state self . next_pos = next_pos if trace : #TRACE# if action is not None : #TRACE# print ( "Doing %s" % action ) #TRACE# return action