Class: Yap::Shell::Parser::Nodes::ArgumentNode

Inherits:
Object
  • Object
show all
Includes:
Visitor
Defined in:
lib/yap/shell/parser/nodes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Visitor

#accept

Constructor Details

#initialize(token) ⇒ ArgumentNode

Returns a new instance of ArgumentNode.



22
23
24
25
# File 'lib/yap/shell/parser/nodes.rb', line 22

def initialize(token)
  @lvalue = token.value
  @attrs = token.attrs
end

Instance Attribute Details

#lvalueObject (readonly)

Returns the value of attribute lvalue.



20
21
22
# File 'lib/yap/shell/parser/nodes.rb', line 20

def lvalue
  @lvalue
end

Instance Method Details

#double_quoted?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/yap/shell/parser/nodes.rb', line 35

def double_quoted?
  @attrs[:quoted_by] == '"'
end

#escaped?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/yap/shell/parser/nodes.rb', line 27

def escaped?
  @attrs[:escaped]
end

#inspectObject



43
44
45
# File 'lib/yap/shell/parser/nodes.rb', line 43

def inspect
  to_s
end

#quoted?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/yap/shell/parser/nodes.rb', line 31

def quoted?
  double_quoted? || single_quoted?
end

#single_quoted?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/yap/shell/parser/nodes.rb', line 39

def single_quoted?
  @attrs[:quoted_by] == "'"
end

#to_sObject



47
48
49
# File 'lib/yap/shell/parser/nodes.rb', line 47

def to_s
  "ArgumentNode(#{lvalue.inspect} escaped? #{escaped?} double_quoted? #{double_quoted?} single_quoted? #{single_quoted?})"
end