# # DO NOT MODIFY!!!! # This file is automatically generated by Racc 1.4.6 # from Racc grammer file "". # require 'racc/parser.rb' require 'bibtex/lexer' module BibTeX class Parser < Racc::Parser module_eval(<<'...end bibtex.y/module_eval...', 'bibtex.y', 90) attr_reader :lexer, :options DEFAULTS = { :include => [:errors], :debug => ENV['DEBUG'] == true }.freeze def initialize(options = {}) @options = DEFAULTS.merge(options) @lexer = Lexer.new(@options) end def parse(input) @yydebug = debug? @lexer.analyse(input) do_parse #yyparse(@lexer,:each) end def next_token @lexer.next_token end def debug? @options[:debug] == true end def on_error(tid, val, vstack) Log.error("Failed to parse BibTeX on value %s (%s) %s" % [val.inspect, token_to_str(tid) || '?', vstack.inspect]) #raise(ParseError, "Failed to parse BibTeX on value %s (%s) %s" % [val.inspect, token_to_str(tid) || '?', vstack.inspect]) end # -*- racc -*- ...end bibtex.y/module_eval... ##### State transition tables begin ### racc_action_table = [ 14, 33, 38, 32, 36, 33, 18, 32, 15, 34, 29, 16, 37, 34, 33, 33, 32, 32, 53, 39, 4, 4, 34, 34, 6, 6, 26, 5, 5, 24, 26, 44, 45, 49, 41, 42, 27, 43, 22, 29, 47, 48, 21, 20, 54, 55, 19, 57, 7, 45, 45 ] racc_action_check = [ 4, 21, 23, 21, 22, 48, 4, 48, 4, 21, 20, 4, 23, 48, 45, 39, 45, 39, 39, 26, 0, 2, 45, 39, 0, 2, 17, 0, 2, 17, 38, 30, 30, 38, 27, 27, 18, 28, 16, 33, 35, 36, 15, 14, 40, 42, 7, 46, 1, 51, 58 ] racc_action_pointer = [ 18, 48, 19, nil, -4, nil, nil, 46, nil, nil, nil, nil, nil, nil, 35, 34, 30, 16, 28, nil, 5, -7, -6, -1, nil, nil, 12, 24, 24, nil, 18, nil, nil, 34, nil, 27, 34, nil, 20, 7, 41, nil, 35, nil, nil, 6, 34, nil, -3, nil, nil, 35, nil, nil, nil, nil, nil, nil, 36 ] racc_action_default = [ -1, -35, -2, -3, -35, -6, -7, -35, -4, -5, -8, -9, -10, -11, -35, -35, -35, -35, -35, 59, -13, -35, -35, -35, -25, -30, -35, -35, -35, -14, -35, -18, -20, -13, -22, -35, -35, -23, -35, -35, -35, -27, -28, -12, -15, -35, -35, -16, -35, -24, -31, -33, -32, -34, -26, -29, -19, -21, -17 ] racc_goto_table = [ 30, 25, 28, 3, 1, 8, 11, 12, 13, 10, 9, 35, 56, 17, 23, 46, 40, 2, 51, 52, nil, nil, 50, nil, nil, nil, nil, 58 ] racc_goto_check = [ 10, 16, 9, 3, 1, 3, 6, 7, 8, 5, 4, 11, 12, 13, 14, 9, 15, 2, 10, 17, nil, nil, 16, nil, nil, nil, nil, 10 ] racc_goto_pointer = [ nil, 4, 17, 3, 6, 5, 2, 3, 4, -18, -21, -11, -33, 9, -3, -11, -16, -20 ] racc_goto_default = [ nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, 31, nil, nil, nil, nil, nil ] racc_reduce_table = [ 0, 0, :racc_error, 0, 18, :_reduce_1, 1, 18, :_reduce_2, 1, 19, :_reduce_3, 2, 19, :_reduce_4, 2, 20, :_reduce_5, 1, 20, :_reduce_6, 1, 20, :_reduce_7, 1, 21, :_reduce_8, 1, 21, :_reduce_9, 1, 21, :_reduce_10, 1, 21, :_reduce_11, 4, 22, :_reduce_12, 0, 26, :_reduce_13, 1, 26, :_reduce_14, 4, 24, :_reduce_15, 4, 23, :_reduce_16, 3, 28, :_reduce_17, 1, 27, :_reduce_18, 3, 27, :_reduce_19, 1, 29, :_reduce_20, 3, 29, :_reduce_21, 1, 29, :_reduce_22, 3, 25, :_reduce_23, 4, 25, :_reduce_24, 2, 25, :_reduce_25, 4, 30, :_reduce_26, 1, 32, :_reduce_27, 1, 32, :_reduce_28, 2, 32, :_reduce_29, 1, 31, :_reduce_30, 3, 31, :_reduce_31, 3, 33, :_reduce_32, 1, 34, :_reduce_33, 1, 34, :_reduce_34 ] racc_reduce_n = 35 racc_shift_n = 59 racc_token_table = { false => 0, :error => 1, :AT => 2, :COMMA => 3, :COMMENT => 4, :CONTENT => 5, :ERROR => 6, :EQ => 7, :LBRACE => 8, :META_CONTENT => 9, :NAME => 10, :NUMBER => 11, :PREAMBLE => 12, :RBRACE => 13, :SHARP => 14, :STRING => 15, :STRING_LITERAL => 16 } racc_nt_base = 17 racc_use_result_var = true Racc_arg = [ racc_action_table, racc_action_check, racc_action_default, racc_action_pointer, racc_goto_table, racc_goto_check, racc_goto_default, racc_goto_pointer, racc_nt_base, racc_reduce_table, racc_token_table, racc_shift_n, racc_reduce_n, racc_use_result_var ] Racc_token_to_s_table = [ "$end", "error", "AT", "COMMA", "COMMENT", "CONTENT", "ERROR", "EQ", "LBRACE", "META_CONTENT", "NAME", "NUMBER", "PREAMBLE", "RBRACE", "SHARP", "STRING", "STRING_LITERAL", "$start", "bibliography", "objects", "object", "at_object", "comment", "string", "preamble", "entry", "content", "string_value", "string_assignment", "string_literal", "entry_head", "assignments", "key", "assignment", "value" ] Racc_debug_parser = false ##### State transition tables end ##### # reduce 0 omitted module_eval(<<'.,.,', 'bibtex.y', 32) def _reduce_1(val, _values, result) result = BibTeX::Bibliography.new(@options) result end .,., module_eval(<<'.,.,', 'bibtex.y', 33) def _reduce_2(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 35) def _reduce_3(val, _values, result) result = BibTeX::Bibliography.new(@options) << val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 36) def _reduce_4(val, _values, result) result << val[1] result end .,., module_eval(<<'.,.,', 'bibtex.y', 38) def _reduce_5(val, _values, result) result = val[1] result end .,., module_eval(<<'.,.,', 'bibtex.y', 39) def _reduce_6(val, _values, result) result = BibTeX::MetaContent.new(val[0]) result end .,., module_eval(<<'.,.,', 'bibtex.y', 40) def _reduce_7(val, _values, result) result = BibTeX::Error.new(val[0]) result end .,., module_eval(<<'.,.,', 'bibtex.y', 42) def _reduce_8(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 43) def _reduce_9(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 44) def _reduce_10(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 45) def _reduce_11(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 47) def _reduce_12(val, _values, result) result = BibTeX::Comment.new(val[2]) result end .,., module_eval(<<'.,.,', 'bibtex.y', 49) def _reduce_13(val, _values, result) result = '' result end .,., module_eval(<<'.,.,', 'bibtex.y', 50) def _reduce_14(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 52) def _reduce_15(val, _values, result) result = BibTeX::Preamble.new(val[2]) result end .,., module_eval(<<'.,.,', 'bibtex.y', 54) def _reduce_16(val, _values, result) result = BibTeX::String.new(val[2][0],val[2][1]); result end .,., module_eval(<<'.,.,', 'bibtex.y', 56) def _reduce_17(val, _values, result) result = [val[0].downcase.to_sym, val[2]] result end .,., module_eval(<<'.,.,', 'bibtex.y', 58) def _reduce_18(val, _values, result) result = [val[0]] result end .,., module_eval(<<'.,.,', 'bibtex.y', 59) def _reduce_19(val, _values, result) result << val[2] result end .,., module_eval(<<'.,.,', 'bibtex.y', 61) def _reduce_20(val, _values, result) result = val[0].downcase.to_sym result end .,., module_eval(<<'.,.,', 'bibtex.y', 62) def _reduce_21(val, _values, result) result = val[1] result end .,., module_eval(<<'.,.,', 'bibtex.y', 63) def _reduce_22(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 65) def _reduce_23(val, _values, result) result = val[0] << val[1] result end .,., module_eval(<<'.,.,', 'bibtex.y', 66) def _reduce_24(val, _values, result) result = val[0] << val[1] result end .,., module_eval(<<'.,.,', 'bibtex.y', 67) def _reduce_25(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 69) def _reduce_26(val, _values, result) result = BibTeX::Entry.new(:type => val[0].downcase.to_sym, :key => val[2]) result end .,., module_eval(<<'.,.,', 'bibtex.y', 71) def _reduce_27(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 72) def _reduce_28(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 73) def _reduce_29(val, _values, result) result = val[0,2].join result end .,., module_eval(<<'.,.,', 'bibtex.y', 75) def _reduce_30(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 76) def _reduce_31(val, _values, result) result.merge!(val[2]) result end .,., module_eval(<<'.,.,', 'bibtex.y', 78) def _reduce_32(val, _values, result) result = { val[0].downcase.to_sym => val[2] } result end .,., module_eval(<<'.,.,', 'bibtex.y', 80) def _reduce_33(val, _values, result) result = val[0] result end .,., module_eval(<<'.,.,', 'bibtex.y', 81) def _reduce_34(val, _values, result) result = val[0] result end .,., def _reduce_none(val, _values, result) val[0] end end # class Parser end # module BibTeX