app/controllers/preprocessor/python/augmentation.rb
# Parses the current line and updates our current state. That state is what several of our
# decisions depends on when it comes to deciding whether or not to add certain debug information.
#
# Note: This method expects to be called on a line that has had trailing whitespace removed.
Parses the current line and updates our current state. That state is what several of our
decisions depends on when it comes to deciding whether or not to add certain debug information.

This method expects to be called on a line that has had trailing whitespace removed.
Parses the current line and updates our current state . That state is what several of our decisions depends on when it comes to deciding whether or not to add certain debug information . This method expects to be called on a line that has had trailing whitespace removed .
def parse_line(line)
    @state[:ll_start] = @state[:ll_end]
    @state[:ll_end] = true
    @state[:line_continuator] = false
    index = 0
    while index < line.length && [" ", "\t"].include?(line[index])
      index += 1
    end
    @state[:indent_string] = line[0...index]
    index = 0
    while index < line.length
      if @state[:in_string].nil?
        index = parse_characters_normal(line, index)
      else
        index = parse_characters_in_string(line, index)
      end
    end
    @state[:ll_end] = @state[:in_string].nil? && @state[:open_braces] == 0 && !@state[:line_continuator]
  end
def parse_line ( line ) @state [ :ll_start ] = @state [ :ll_end ] @state [ :ll_end ] = true @state [ :line_continuator ] = false index = 0 while index < line . length && [ " " , "\t" ] . include? ( line [ index ] ) index += 1 end @state [ :indent_string ] = line [ 0 ... index ] index = 0 while index < line . length if @state [ :in_string ] . nil? index = parse_characters_normal ( line , index ) else index = parse_characters_in_string ( line , index ) end end @state [ :ll_end ] = @state [ :in_string ] . nil? && @state [ :open_braces ] == 0 && ! @state [ :line_continuator ] end
Parses the current line and updates our current state.
Parses the current line and updates our current state .
# If the previous line didn't and a logical line, we're not going to start one. If it did, # we're indeed going to start a new logical line # We will start with the assumption that we're going to end the current logical line. We may layer # find out that we did not, in fact, do so. # Reset the line continuator flag the the last line may have set to true # Find the first non-(space/tab) character # Iterate over the line's characters as long as there are any. We use different iteration # methods depending on whether we're inside a string or not # We have reached the end of the line. Decide whether or not the logical line ends here.
line