lib/parser/gedcom_parser.rb
def process_line(lineno, tokens)
    if (tag_line = TAGS[@parse_state.state]) == nil
      raise "In unknown state (#{@parse_state.state})"
    elsif (tag_spec = tag_line[ tokens.index ]) == nil
      if tokens.tag[0,1] == "_" || @parse_state.state == :user_subtag
        print "Unknown tag #{tokens}. "
        tokens.user_tag 
        pp "Converted to #{tokens}"
        process_line(lineno, tokens)
      else
        raise "Tag ([#{tokens.tag},#{tokens.xref}]) not valid in this state (#{@parse_state.state})"
      end
    elsif tag_spec[CHILD_RECORD] != nil #don't push nil states, as these represent terminals
      #Run the handler for this line.
      @transmission.action_handler lineno, tokens, *tag_spec
      #switch to new state
      @parse_state << tag_spec[CHILD_RECORD]
    else 
      #Run the handler for this line.
      @transmission.action_handler lineno, tokens, *tag_spec
    end
        
  end
#Uses the TAGS hash to determine how to process the line.
#Take a a line number for error reporting 
#and the tokenised GEDCOM line. 
Uses the TAGS hash to determine how to process the line.
Take a a line number for error reporting
and the tokenised GEDCOM line.
Uses the TAGS hash to determine how to process the line . Take a a line number for error reporting and the tokenised GEDCOM line .
def process_line(lineno, tokens)
    if (tag_line = TAGS[@parse_state.state]) == nil
      raise "In unknown state (#{@parse_state.state})"
    elsif (tag_spec = tag_line[ tokens.index ]) == nil
      if tokens.tag[0,1] == "_" || @parse_state.state == :user_subtag
        print "Unknown tag #{tokens}. "
        tokens.user_tag 
        pp "Converted to #{tokens}"
        process_line(lineno, tokens)
      else
        raise "Tag ([#{tokens.tag},#{tokens.xref}]) not valid in this state (#{@parse_state.state})"
      end
    elsif tag_spec[CHILD_RECORD] != nil 
      @transmission.action_handler lineno, tokens, *tag_spec
      @parse_state << tag_spec[CHILD_RECORD]
    else 
      @transmission.action_handler lineno, tokens, *tag_spec
    end
  end
def process_line ( lineno , tokens ) if ( tag_line = TAGS [ @parse_state . state ] ) == nil raise "In unknown state (#{@parse_state.state})" elsif ( tag_spec = tag_line [ tokens . index ] ) == nil if tokens . tag [ 0 , 1 ] == "_" || @parse_state . state == :user_subtag print "Unknown tag #{tokens}. " tokens . user_tag pp "Converted to #{tokens}" process_line ( lineno , tokens ) else raise "Tag ([#{tokens.tag},#{tokens.xref}]) not valid in this state (#{@parse_state.state})" end elsif tag_spec [ CHILD_RECORD ] != nil @transmission . action_handler lineno , tokens , * tag_spec @parse_state << tag_spec [ CHILD_RECORD ] else @transmission . action_handler lineno , tokens , * tag_spec end end
Uses the TAGS hash to determine how to process the line.
Uses the TAGS hash to determine how to process the line .
#don't push nil states, as these represent terminals #Run the handler for this line. #switch to new state #Run the handler for this line.
lineno
tokens