Class: Piggly::Parser::Nodes::Sql

Inherits:
Expression show all
Defined in:
lib/piggly/parser/nodes.rb

Instance Attribute Summary

Attributes inherited from NodeClass

#source_text

Instance Method Summary collapse

Methods inherited from Expression

#expression?, #terminal?

Methods inherited from NodeClass

#assignment?, #block?, #branch?, #comment?, #datatype?, #else?, #expression?, #for?, #identifier?, #if?, #indent, #keyword?, #label?, #loop?, #named?, #statement?, #string?, #stub?, #tag_id, #tagged?, #token?, #while?, #whitespace?

Methods included from Traversal

#count, #find, #flatten, #inject, #select

Instance Method Details

#sql?Boolean

Returns:

  • (Boolean)


256
257
258
# File 'lib/piggly/parser/nodes.rb', line 256

def sql?
  true
end

#styleObject



254
# File 'lib/piggly/parser/nodes.rb', line 254

def style; "tQ"; end

#tag(prefix = nil, id = nil) ⇒ Object



260
261
262
263
264
265
266
267
268
269
# File 'lib/piggly/parser/nodes.rb', line 260

def tag(prefix = nil, id = nil)
  unless defined? @tag_id
    if named?(:cond) and parent.for?
      # This node is the conditional in a FOR loop
      Tags::UnconditionalLoopTag.new(prefix, id)
    else
      Tags::EvaluationTag.new(prefix, id)
    end.tap{|tag| @tag_id = tag.id }
  end
end