lib/parser/gedcom_parser.rb
#Manages the parsing state stack and calling process_line() to create objects to hold the data.
#Takes a lineno for error reporting 
# and a tokenised GEDCOM line (including tokenizing the data value as a word array).
Manages the parsing state stack and calling process_line() to create objects to hold the data.
Takes a lineno for error reporting
and a tokenised GEDCOM line (including tokenizing the data value as a word array).
Manages the parsing state stack and calling process_line () to create objects to hold the data . Takes a lineno for error reporting and a tokenised GEDCOM line ( including tokenizing the data value as a word array ) .
def parse_line(lineno, tokens)
    current_level = @parse_state.level
    new_level = tokens.level
    if current_level > new_level
      while current_level > new_level
        current_level -= 1
        @parse_state.pop
      end
      process_line(lineno, tokens)  
    elsif current_level == new_level
      process_line(lineno, tokens)  
    elsif current_level < new_level
      raise "Level increased by more than 1 (current_level = #{current_level}, new_level = #{new_level})"
    end
  end
def parse_line ( lineno , tokens ) current_level = @parse_state . level new_level = tokens . level if current_level > new_level while current_level > new_level current_level -= 1 @parse_state . pop end process_line ( lineno , tokens ) elsif current_level == new_level process_line ( lineno , tokens ) elsif current_level < new_level raise "Level increased by more than 1 (current_level = #{current_level}, new_level = #{new_level})" end end
Manages the parsing state stack and calling process_line() to create objects to hold the data.
Manages the parsing state stack and calling process_line () to create objects to hold the data .
#need to look in the ::TAGS hash for tags that match the level this line is on. #Annoyingly, Level 0 has the data and the TAG, reversed for xrefs.  #Reduce the parse state stack until we are at the new level #We are now at the same level, so we process the line #We are already at the same level, so we just process the line
lineno
tokens