class RedParse::StackMonkey
generic stuff for parsing any(?) language
include Nodes
generic stuff for parsing any(?) language
include Nodes
Attributes
and_expect_node[R]
exemplars[RW]
first_changed_index[R]
hint[R]
monkey_code[R]
name[R]
Public Class Methods
_load(str)
click to toggle source
# File lib/miniredparse.rb, line 80 def self._load str Thread.current[:$RedParse_parser].undumpables[@name] end
new(name,first_changed_index,and_expect_node,options={},&monkey_code)
click to toggle source
# File lib/miniredparse.rb, line 61 def initialize(name,first_changed_index,and_expect_node,options={},&monkey_code) first_changed_index=-first_changed_index if first_changed_index>0 @name,@first_changed_index,@and_expect_node,@monkey_code= name,first_changed_index,and_expect_node,monkey_code end
Public Instance Methods
[](stack)
click to toggle source
# File lib/miniredparse.rb, line 71 def [](stack) result=@monkey_code[stack] return result end
_dump(depth)
click to toggle source
# File lib/miniredparse.rb, line 76 def _dump depth @name end
action2c()
click to toggle source
# File lib/miniredparse.rb, line 84 def action2c #"return the whole thing on first call, just a goto stmt after that" return " goto #@goto_label;\n" if defined? @goto_label =begin <<-E #{@goto_label=@name.gsub(/[^a-z0-9_]/,'_')}: monkey=rb_hash_get(undumpables,rb_cstr2str("#@name")); rb_funcall(monkey,rb_intern("[]"),huh_stack); /*recover from stackmonkey fiddling*/ for(i=0;i<#{-@first_changed_index};++i) { rb_ary_unshift(lexer_moretokens, rb_ary_pop(huh_semantic_stack)); rb_ary_pop(huh_syntax_stack); } goto #{Node===@and_expect_node ? postreduceaction4this_state(@and_expect_node) : shiftaction4this_state }; E =end end