class SheepAst::ActionBase

TBD

Attributes

action_factory[RW]
analyzer_core[RW]
data_store[RW]
match_factory[RW]
my_ast_manager[RW]
store_sym[RW]

Public Class Methods

new() click to toggle source
Calls superclass method SheepAst::Log::new
# File lib/sheep_ast/action/action_base.rb, line 42
def initialize
  super()
  @nq = false
end

Public Instance Methods

action(data, node) click to toggle source
# File lib/sheep_ast/action/action_base.rb, line 48
def action(data, node); end
description() click to toggle source
# File lib/sheep_ast/action/action_base.rb, line 123
def description
  name
end
inspect() click to toggle source
# File lib/sheep_ast/action/action_base.rb, line 118
def inspect
  "custom inspect <#{self.class.name} object_id = #{object_id}, store_sym = #{store_sym.inspect}"
end
keyword_data(data) click to toggle source
# File lib/sheep_ast/action/action_base.rb, line 51
def keyword_data(data)
  hash = {}
  data.stack.each_with_index do |elem, index|
    key = data.stack_symbol[index]
    value = hash[key] unless key.nil?

    expr = T.cast(match_factory.from_id(elem), MatchBase).matched_expr
    if value.nil?
      hash[key] = expr
    elsif value.instance_of?(Array)
      value << expr
    else
      hash[key] = [value, expr]
    end
  end

  stack = []
  T.must(data.file_info).namespace_stack.each do |elem|
    stack << elem unless elem.nil?
  end

  hash[:_namespace] = stack
  hash[:_raw_line] = data.raw_line
  hash[:_data] = data
  return hash
end
need_qualify() click to toggle source
# File lib/sheep_ast/action/action_base.rb, line 108
def need_qualify
  @nq = true
end
need_qualify?() click to toggle source
# File lib/sheep_ast/action/action_base.rb, line 113
def need_qualify?
  return @nq
end
qualifier?() click to toggle source
# File lib/sheep_ast/action/action_base.rb, line 99
def qualifier?
  if @qualifier.nil?
    return false
  else
    return true
  end
end
really_end?(data) click to toggle source
# File lib/sheep_ast/action/action_base.rb, line 79
def really_end?(data)
  ldebug? and ldebug 'really_end'
  if @qualifier.nil?
    lfatal warning
    missing_impl
  else
    ret = @qualifier.qualify(data)
    ldebug? and ldebug "Really end? = #{ret}"
    return ret
  end
end
register_qualifier(qualifier) click to toggle source
# File lib/sheep_ast/action/action_base.rb, line 94
def register_qualifier(qualifier)
  @qualifier = qualifier
end
warning() click to toggle source
# File lib/sheep_ast/action/action_base.rb, line 128
    def warning
      errmsg = <<~ERRORMSG
        To reach here, it means that the node has action, but there are further nodes after this node like:
        root -> this_node -> this_action
                          -> another_node -> another_action
        In this case, qualification to continue node search or just do action is needed.
        You need to implement qualifier function.
        Please use NEQ at syntax_alias.
      ERRORMSG
      return errmsg
    end