Class: SyntaxTree::LParen
- Inherits:
-
Object
- Object
- SyntaxTree::LParen
- Defined in:
- lib/syntax_tree.rb
Overview
LParen represents the use of a left parenthesis, i.e., (.
Instance Attribute Summary collapse
-
#comments ⇒ Object
readonly
- Array[ Comment | EmbDoc ]
-
the comments attached to this node.
-
#location ⇒ Object
readonly
- Location
-
the location of this node.
-
#value ⇒ Object
readonly
- String
-
the left parenthesis.
Instance Method Summary collapse
- #child_nodes ⇒ Object
- #format(q) ⇒ Object
-
#initialize(value:, location:, comments: []) ⇒ LParen
constructor
A new instance of LParen.
- #pretty_print(q) ⇒ Object
- #to_json(*opts) ⇒ Object
Constructor Details
#initialize(value:, location:, comments: []) ⇒ LParen
Returns a new instance of LParen.
7983 7984 7985 7986 7987 |
# File 'lib/syntax_tree.rb', line 7983 def initialize(value:, location:, comments: []) @value = value @location = location @comments = comments end |
Instance Attribute Details
#comments ⇒ Object (readonly)
- Array[ Comment | EmbDoc ]
-
the comments attached to this node
7981 7982 7983 |
# File 'lib/syntax_tree.rb', line 7981 def comments @comments end |
#location ⇒ Object (readonly)
- Location
-
the location of this node
7978 7979 7980 |
# File 'lib/syntax_tree.rb', line 7978 def location @location end |
#value ⇒ Object (readonly)
- String
-
the left parenthesis
7975 7976 7977 |
# File 'lib/syntax_tree.rb', line 7975 def value @value end |
Instance Method Details
#child_nodes ⇒ Object
7989 7990 7991 |
# File 'lib/syntax_tree.rb', line 7989 def child_nodes [] end |
#format(q) ⇒ Object
7993 7994 7995 |
# File 'lib/syntax_tree.rb', line 7993 def format(q) q.text(value) end |
#pretty_print(q) ⇒ Object
7997 7998 7999 8000 8001 8002 8003 8004 8005 8006 |
# File 'lib/syntax_tree.rb', line 7997 def pretty_print(q) q.group(2, "(", ")") do q.text("lparen") q.breakable q.pp(value) q.pp(Comment::List.new(comments)) end end |
#to_json(*opts) ⇒ Object
8008 8009 8010 8011 8012 |
# File 'lib/syntax_tree.rb', line 8008 def to_json(*opts) { type: :lparen, value: value, loc: location, cmts: comments }.to_json( *opts ) end |