2002-03-22 02:20:31 -05:00
|
|
|
#
|
2006-07-06 08:50:51 -04:00
|
|
|
# $originalId: parser.rb,v 1.8 2006/07/06 11:42:07 aamine Exp $
|
2002-03-22 02:20:31 -05:00
|
|
|
#
|
2006-07-06 08:50:51 -04:00
|
|
|
# Copyright (c) 1999-2006 Minero Aoki
|
2002-03-22 02:20:31 -05:00
|
|
|
#
|
2003-11-03 08:55:01 -05:00
|
|
|
# This program is free software.
|
|
|
|
# You can distribute/modify this program under the same terms of ruby.
|
2002-03-22 02:20:31 -05:00
|
|
|
#
|
2003-11-03 08:55:01 -05:00
|
|
|
# As a special exception, when this code is copied by Racc
|
|
|
|
# into a Racc output file, you may use that output file
|
|
|
|
# without restriction.
|
2002-03-22 02:20:31 -05:00
|
|
|
#
|
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
unless defined?(NotImplementedError)
|
|
|
|
NotImplementedError = NotImplementError
|
|
|
|
end
|
|
|
|
|
2002-03-22 02:20:31 -05:00
|
|
|
module Racc
|
|
|
|
class ParseError < StandardError; end
|
|
|
|
end
|
2003-11-03 08:55:01 -05:00
|
|
|
unless defined?(::ParseError)
|
2002-03-22 02:20:31 -05:00
|
|
|
ParseError = Racc::ParseError
|
|
|
|
end
|
|
|
|
|
|
|
|
module Racc
|
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
unless defined?(Racc_No_Extentions)
|
2002-03-22 02:20:31 -05:00
|
|
|
Racc_No_Extentions = false
|
|
|
|
end
|
|
|
|
|
|
|
|
class Parser
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
Racc_Runtime_Version = '1.4.5'
|
|
|
|
Racc_Runtime_Revision = '$originalRevision: 1.8 $'.split[1]
|
2002-03-22 02:20:31 -05:00
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
Racc_Runtime_Core_Version_R = '1.4.5'
|
|
|
|
Racc_Runtime_Core_Revision_R = '$originalRevision: 1.8 $'.split[1]
|
2002-03-22 02:20:31 -05:00
|
|
|
begin
|
|
|
|
require 'racc/cparse'
|
2006-07-06 08:50:51 -04:00
|
|
|
# Racc_Runtime_Core_Version_C = (defined in extention)
|
2003-11-03 08:55:01 -05:00
|
|
|
Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
|
|
|
|
unless new.respond_to?(:_racc_do_parse_c, true)
|
2002-03-22 02:20:31 -05:00
|
|
|
raise LoadError, 'old cparse.so'
|
|
|
|
end
|
2003-11-03 08:55:01 -05:00
|
|
|
if Racc_No_Extentions
|
2002-03-22 02:20:31 -05:00
|
|
|
raise LoadError, 'selecting ruby version of racc runtime core'
|
|
|
|
end
|
|
|
|
|
|
|
|
Racc_Main_Parsing_Routine = :_racc_do_parse_c
|
|
|
|
Racc_YY_Parse_Method = :_racc_yyparse_c
|
|
|
|
Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C
|
|
|
|
Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C
|
|
|
|
Racc_Runtime_Type = 'c'
|
|
|
|
rescue LoadError
|
|
|
|
Racc_Main_Parsing_Routine = :_racc_do_parse_rb
|
|
|
|
Racc_YY_Parse_Method = :_racc_yyparse_rb
|
|
|
|
Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_R
|
|
|
|
Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_R
|
|
|
|
Racc_Runtime_Type = 'ruby'
|
|
|
|
end
|
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
def Parser.racc_runtime_type
|
2002-03-22 02:20:31 -05:00
|
|
|
Racc_Runtime_Type
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def _racc_setup
|
2003-11-03 08:55:01 -05:00
|
|
|
@yydebug = false unless self.class::Racc_debug_parser
|
|
|
|
@yydebug = false unless defined?(@yydebug)
|
|
|
|
if @yydebug
|
|
|
|
@racc_debug_out = $stderr unless defined?(@racc_debug_out)
|
2002-03-22 02:20:31 -05:00
|
|
|
@racc_debug_out ||= $stderr
|
|
|
|
end
|
2003-11-03 08:55:01 -05:00
|
|
|
arg = self.class::Racc_arg
|
|
|
|
arg[13] = true if arg.size < 14
|
2002-03-22 02:20:31 -05:00
|
|
|
arg
|
|
|
|
end
|
|
|
|
|
|
|
|
def _racc_init_sysvars
|
2003-11-03 08:55:01 -05:00
|
|
|
@racc_state = [0]
|
2002-03-22 02:20:31 -05:00
|
|
|
@racc_tstack = []
|
|
|
|
@racc_vstack = []
|
|
|
|
|
|
|
|
@racc_t = nil
|
|
|
|
@racc_val = nil
|
|
|
|
|
|
|
|
@racc_read_next = true
|
|
|
|
|
|
|
|
@racc_user_yyerror = false
|
|
|
|
@racc_error_status = 0
|
|
|
|
end
|
|
|
|
|
|
|
|
###
|
|
|
|
### do_parse
|
|
|
|
###
|
|
|
|
|
|
|
|
def do_parse
|
2003-11-03 08:55:01 -05:00
|
|
|
__send__(Racc_Main_Parsing_Routine, _racc_setup(), false)
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def next_token
|
2002-10-02 12:45:35 -04:00
|
|
|
raise NotImplementedError, "#{self.class}\#next_token is not defined"
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def _racc_do_parse_rb(arg, in_debug)
|
2002-03-22 02:20:31 -05:00
|
|
|
action_table, action_check, action_default, action_pointer,
|
|
|
|
goto_table, goto_check, goto_default, goto_pointer,
|
|
|
|
nt_base, reduce_table, token_table, shift_n,
|
|
|
|
reduce_n, use_result, * = arg
|
|
|
|
|
|
|
|
_racc_init_sysvars
|
|
|
|
tok = act = i = nil
|
|
|
|
nerr = 0
|
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
catch(:racc_end_parse) {
|
|
|
|
while true
|
|
|
|
if i = action_pointer[@racc_state[-1]]
|
|
|
|
if @racc_read_next
|
|
|
|
if @racc_t != 0 # not EOF
|
|
|
|
tok, @racc_val = next_token()
|
|
|
|
unless tok # EOF
|
|
|
|
@racc_t = 0
|
|
|
|
else
|
|
|
|
@racc_t = (token_table[tok] or 1) # error token
|
|
|
|
end
|
|
|
|
racc_read_token(@racc_t, tok, @racc_val) if @yydebug
|
|
|
|
@racc_read_next = false
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
end
|
2003-11-03 08:55:01 -05:00
|
|
|
i += @racc_t
|
|
|
|
unless i >= 0 and
|
|
|
|
act = action_table[i] and
|
|
|
|
action_check[i] == @racc_state[-1]
|
|
|
|
act = action_default[@racc_state[-1]]
|
|
|
|
end
|
|
|
|
else
|
|
|
|
act = action_default[@racc_state[-1]]
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
2003-11-03 08:55:01 -05:00
|
|
|
while act = _racc_evalact(act, arg)
|
2002-03-22 02:20:31 -05:00
|
|
|
;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
###
|
|
|
|
### yyparse
|
|
|
|
###
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def yyparse(recv, mid)
|
2003-11-03 08:55:01 -05:00
|
|
|
__send__(Racc_YY_Parse_Method, recv, mid, _racc_setup(), true)
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def _racc_yyparse_rb(recv, mid, arg, c_debug)
|
2002-03-22 02:20:31 -05:00
|
|
|
action_table, action_check, action_default, action_pointer,
|
|
|
|
goto_table, goto_check, goto_default, goto_pointer,
|
|
|
|
nt_base, reduce_table, token_table, shift_n,
|
|
|
|
reduce_n, use_result, * = arg
|
|
|
|
|
|
|
|
_racc_init_sysvars
|
|
|
|
tok = nil
|
|
|
|
act = nil
|
|
|
|
i = nil
|
|
|
|
nerr = 0
|
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
catch(:racc_end_parse) {
|
|
|
|
until i = action_pointer[@racc_state[-1]]
|
|
|
|
while act = _racc_evalact(action_default[@racc_state[-1]], arg)
|
|
|
|
;
|
|
|
|
end
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
2003-11-03 08:55:01 -05:00
|
|
|
recv.__send__(mid) do |tok, val|
|
|
|
|
unless tok
|
2002-03-22 02:20:31 -05:00
|
|
|
@racc_t = 0
|
|
|
|
else
|
|
|
|
@racc_t = (token_table[tok] or 1) # error token
|
|
|
|
end
|
|
|
|
@racc_val = val
|
|
|
|
@racc_read_next = false
|
|
|
|
|
|
|
|
i += @racc_t
|
2003-11-03 08:55:01 -05:00
|
|
|
unless i >= 0 and
|
|
|
|
act = action_table[i] and
|
|
|
|
action_check[i] == @racc_state[-1]
|
|
|
|
act = action_default[@racc_state[-1]]
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
2003-11-03 08:55:01 -05:00
|
|
|
while act = _racc_evalact(act, arg)
|
|
|
|
;
|
|
|
|
end
|
2002-03-22 02:20:31 -05:00
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
while not (i = action_pointer[@racc_state[-1]]) or
|
2002-03-22 02:20:31 -05:00
|
|
|
not @racc_read_next or
|
2003-11-03 08:55:01 -05:00
|
|
|
@racc_t == 0 # $
|
|
|
|
unless i and i += @racc_t and
|
|
|
|
i >= 0 and
|
|
|
|
act = action_table[i] and
|
|
|
|
action_check[i] == @racc_state[-1]
|
|
|
|
act = action_default[@racc_state[-1]]
|
|
|
|
end
|
|
|
|
while act = _racc_evalact(act, arg)
|
2002-03-22 02:20:31 -05:00
|
|
|
;
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
|
|
|
###
|
|
|
|
### common
|
|
|
|
###
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def _racc_evalact(act, arg)
|
2002-03-22 02:20:31 -05:00
|
|
|
action_table, action_check, action_default, action_pointer,
|
|
|
|
goto_table, goto_check, goto_default, goto_pointer,
|
|
|
|
nt_base, reduce_table, token_table, shift_n,
|
|
|
|
reduce_n, use_result, * = arg
|
2006-07-06 08:50:51 -04:00
|
|
|
nerr = 0 # tmp
|
2002-03-22 02:20:31 -05:00
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
if act > 0 and act < shift_n
|
2002-03-22 02:20:31 -05:00
|
|
|
#
|
|
|
|
# shift
|
|
|
|
#
|
2003-11-03 08:55:01 -05:00
|
|
|
if @racc_error_status > 0
|
2002-03-22 02:20:31 -05:00
|
|
|
@racc_error_status -= 1 unless @racc_t == 1 # error token
|
|
|
|
end
|
|
|
|
@racc_vstack.push @racc_val
|
|
|
|
@racc_state.push act
|
|
|
|
@racc_read_next = true
|
2003-11-03 08:55:01 -05:00
|
|
|
if @yydebug
|
2002-03-22 02:20:31 -05:00
|
|
|
@racc_tstack.push @racc_t
|
2003-11-03 08:55:01 -05:00
|
|
|
racc_shift @racc_t, @racc_tstack, @racc_vstack
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
elsif act < 0 and act > -reduce_n
|
2002-03-22 02:20:31 -05:00
|
|
|
#
|
|
|
|
# reduce
|
|
|
|
#
|
2003-11-03 08:55:01 -05:00
|
|
|
code = catch(:racc_jump) {
|
|
|
|
@racc_state.push _racc_do_reduce(arg, act)
|
2002-03-22 02:20:31 -05:00
|
|
|
false
|
|
|
|
}
|
2003-11-03 08:55:01 -05:00
|
|
|
if code
|
2002-03-22 02:20:31 -05:00
|
|
|
case code
|
|
|
|
when 1 # yyerror
|
|
|
|
@racc_user_yyerror = true # user_yyerror
|
|
|
|
return -reduce_n
|
|
|
|
when 2 # yyaccept
|
|
|
|
return shift_n
|
|
|
|
else
|
2006-07-06 08:50:51 -04:00
|
|
|
raise '[Racc Bug] unknown jump code'
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
elsif act == shift_n
|
2002-03-22 02:20:31 -05:00
|
|
|
#
|
|
|
|
# accept
|
|
|
|
#
|
|
|
|
racc_accept if @yydebug
|
|
|
|
throw :racc_end_parse, @racc_vstack[0]
|
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
elsif act == -reduce_n
|
2002-03-22 02:20:31 -05:00
|
|
|
#
|
|
|
|
# error
|
|
|
|
#
|
|
|
|
case @racc_error_status
|
|
|
|
when 0
|
2003-11-03 08:55:01 -05:00
|
|
|
unless arg[21] # user_yyerror
|
2002-03-22 02:20:31 -05:00
|
|
|
nerr += 1
|
|
|
|
on_error @racc_t, @racc_val, @racc_vstack
|
|
|
|
end
|
|
|
|
when 3
|
2003-11-03 08:55:01 -05:00
|
|
|
if @racc_t == 0 # is $
|
2002-03-22 02:20:31 -05:00
|
|
|
throw :racc_end_parse, nil
|
|
|
|
end
|
|
|
|
@racc_read_next = true
|
|
|
|
end
|
|
|
|
@racc_user_yyerror = false
|
|
|
|
@racc_error_status = 3
|
2003-11-03 08:55:01 -05:00
|
|
|
while true
|
|
|
|
if i = action_pointer[@racc_state[-1]]
|
2002-03-22 02:20:31 -05:00
|
|
|
i += 1 # error token
|
2003-11-03 08:55:01 -05:00
|
|
|
if i >= 0 and
|
|
|
|
(act = action_table[i]) and
|
|
|
|
action_check[i] == @racc_state[-1]
|
|
|
|
break
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
end
|
2003-11-03 08:55:01 -05:00
|
|
|
throw :racc_end_parse, nil if @racc_state.size <= 1
|
2002-03-22 02:20:31 -05:00
|
|
|
@racc_state.pop
|
|
|
|
@racc_vstack.pop
|
2003-11-03 08:55:01 -05:00
|
|
|
if @yydebug
|
2002-03-22 02:20:31 -05:00
|
|
|
@racc_tstack.pop
|
2003-11-03 08:55:01 -05:00
|
|
|
racc_e_pop @racc_state, @racc_tstack, @racc_vstack
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
return act
|
|
|
|
|
|
|
|
else
|
2006-07-06 08:50:51 -04:00
|
|
|
raise "[Racc Bug] unknown action #{act.inspect}"
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
racc_next_state(@racc_state[-1], @racc_state) if @yydebug
|
2002-03-22 02:20:31 -05:00
|
|
|
|
|
|
|
nil
|
|
|
|
end
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def _racc_do_reduce(arg, act)
|
2002-03-22 02:20:31 -05:00
|
|
|
action_table, action_check, action_default, action_pointer,
|
|
|
|
goto_table, goto_check, goto_default, goto_pointer,
|
|
|
|
nt_base, reduce_table, token_table, shift_n,
|
|
|
|
reduce_n, use_result, * = arg
|
|
|
|
state = @racc_state
|
|
|
|
vstack = @racc_vstack
|
|
|
|
tstack = @racc_tstack
|
|
|
|
|
|
|
|
i = act * -3
|
|
|
|
len = reduce_table[i]
|
|
|
|
reduce_to = reduce_table[i+1]
|
|
|
|
method_id = reduce_table[i+2]
|
|
|
|
void_array = []
|
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
tmp_t = tstack[-len, len] if @yydebug
|
|
|
|
tmp_v = vstack[-len, len]
|
|
|
|
tstack[-len, len] = void_array if @yydebug
|
|
|
|
vstack[-len, len] = void_array
|
|
|
|
state[-len, len] = void_array
|
2002-03-22 02:20:31 -05:00
|
|
|
|
|
|
|
# tstack must be updated AFTER method call
|
2003-11-03 08:55:01 -05:00
|
|
|
if use_result
|
2002-03-22 02:20:31 -05:00
|
|
|
vstack.push __send__(method_id, tmp_v, vstack, tmp_v[0])
|
|
|
|
else
|
|
|
|
vstack.push __send__(method_id, tmp_v, vstack)
|
|
|
|
end
|
|
|
|
tstack.push reduce_to
|
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
racc_reduce(tmp_t, reduce_to, tstack, vstack) if @yydebug
|
2002-03-22 02:20:31 -05:00
|
|
|
|
|
|
|
k1 = reduce_to - nt_base
|
2003-11-03 08:55:01 -05:00
|
|
|
if i = goto_pointer[k1]
|
2002-03-22 02:20:31 -05:00
|
|
|
i += state[-1]
|
2003-11-03 08:55:01 -05:00
|
|
|
if i >= 0 and (curstate = goto_table[i]) and goto_check[i] == k1
|
2002-03-22 02:20:31 -05:00
|
|
|
return curstate
|
|
|
|
end
|
|
|
|
end
|
2003-11-03 08:55:01 -05:00
|
|
|
goto_default[k1]
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def on_error(t, val, vstack)
|
2002-03-22 02:20:31 -05:00
|
|
|
raise ParseError, sprintf("\nparse error on value %s (%s)",
|
2003-11-03 08:55:01 -05:00
|
|
|
val.inspect, token_to_str(t) || '?')
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
def yyerror
|
|
|
|
throw :racc_jump, 1
|
|
|
|
end
|
|
|
|
|
|
|
|
def yyaccept
|
|
|
|
throw :racc_jump, 2
|
|
|
|
end
|
|
|
|
|
|
|
|
def yyerrok
|
|
|
|
@racc_error_status = 0
|
|
|
|
end
|
|
|
|
|
2003-11-03 08:55:01 -05:00
|
|
|
#
|
2002-03-22 02:20:31 -05:00
|
|
|
# for debugging output
|
2003-11-03 08:55:01 -05:00
|
|
|
#
|
2002-03-22 02:20:31 -05:00
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def racc_read_token(t, tok, val)
|
2002-03-22 02:20:31 -05:00
|
|
|
@racc_debug_out.print 'read '
|
|
|
|
@racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
|
|
|
|
@racc_debug_out.puts val.inspect
|
|
|
|
@racc_debug_out.puts
|
|
|
|
end
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def racc_shift(tok, tstack, vstack)
|
2002-03-22 02:20:31 -05:00
|
|
|
@racc_debug_out.puts "shift #{racc_token2str tok}"
|
|
|
|
racc_print_stacks tstack, vstack
|
|
|
|
@racc_debug_out.puts
|
|
|
|
end
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def racc_reduce(toks, sim, tstack, vstack)
|
2002-03-22 02:20:31 -05:00
|
|
|
out = @racc_debug_out
|
|
|
|
out.print 'reduce '
|
2003-11-03 08:55:01 -05:00
|
|
|
if toks.empty?
|
2002-03-22 02:20:31 -05:00
|
|
|
out.print ' <none>'
|
|
|
|
else
|
|
|
|
toks.each {|t| out.print ' ', racc_token2str(t) }
|
|
|
|
end
|
|
|
|
out.puts " --> #{racc_token2str(sim)}"
|
|
|
|
|
|
|
|
racc_print_stacks tstack, vstack
|
|
|
|
@racc_debug_out.puts
|
|
|
|
end
|
|
|
|
|
|
|
|
def racc_accept
|
|
|
|
@racc_debug_out.puts 'accept'
|
|
|
|
@racc_debug_out.puts
|
|
|
|
end
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def racc_e_pop(state, tstack, vstack)
|
2002-03-22 02:20:31 -05:00
|
|
|
@racc_debug_out.puts 'error recovering mode: pop token'
|
|
|
|
racc_print_states state
|
|
|
|
racc_print_stacks tstack, vstack
|
|
|
|
@racc_debug_out.puts
|
|
|
|
end
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def racc_next_state(curstate, state)
|
2002-03-22 02:20:31 -05:00
|
|
|
@racc_debug_out.puts "goto #{curstate}"
|
|
|
|
racc_print_states state
|
|
|
|
@racc_debug_out.puts
|
|
|
|
end
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def racc_print_stacks(t, v)
|
2002-03-22 02:20:31 -05:00
|
|
|
out = @racc_debug_out
|
|
|
|
out.print ' ['
|
|
|
|
t.each_index do |i|
|
|
|
|
out.print ' (', racc_token2str(t[i]), ' ', v[i].inspect, ')'
|
|
|
|
end
|
|
|
|
out.puts ' ]'
|
|
|
|
end
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def racc_print_states(s)
|
2002-03-22 02:20:31 -05:00
|
|
|
out = @racc_debug_out
|
|
|
|
out.print ' ['
|
|
|
|
s.each {|st| out.print ' ', st }
|
|
|
|
out.puts ' ]'
|
|
|
|
end
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def racc_token2str(tok)
|
2002-10-02 12:45:35 -04:00
|
|
|
self.class::Racc_token_to_s_table[tok] or
|
2006-07-06 08:50:51 -04:00
|
|
|
raise "[Racc Bug] can't convert token #{tok} to string"
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
|
2006-07-06 08:50:51 -04:00
|
|
|
def token_to_str(t)
|
2002-10-02 12:45:35 -04:00
|
|
|
self.class::Racc_token_to_s_table[t]
|
2002-03-22 02:20:31 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|