Class: Generated::BeginWhileRule

Inherits:
Rule
  • Object
show all
Defined in:
lib/ruby_grammar_builder/generated/rule.rb

Instance Attribute Summary collapse

Attributes inherited from Rule

#location

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ BeginWhileRule

Returns a new instance of BeginWhileRule.



129
130
131
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 129

def initialize(location)
    super(location)
end

Instance Attribute Details

#beginString

Returns The begin pattern.

Returns:

  • (String)

    The begin pattern



117
118
119
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 117

def begin
  @begin
end

#beginCapturesHash<String=>Rule>

Returns The captures rules for begin.

Returns:

  • (Hash<String=>Rule>)

    The captures rules for begin



125
126
127
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 125

def beginCaptures
  @beginCaptures
end

#contentNameString?

Returns The name for the contents matched.

Returns:

  • (String, nil)

    The name for the contents matched



123
124
125
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 123

def contentName
  @contentName
end

#nameString?

Returns The name for this rule.

Returns:

  • (String, nil)

    The name for this rule



121
122
123
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 121

def name
  @name
end

#whileString

Returns The while pattern.

Returns:

  • (String)

    The while pattern



119
120
121
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 119

def while
  @while
end

#whileCapturesHash<String=>Rule>

Returns The captures rules for while.

Returns:

  • (Hash<String=>Rule>)

    The captures rules for while



127
128
129
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 127

def whileCaptures
  @whileCaptures
end

Instance Method Details

#to_hObject



133
134
135
136
137
138
139
140
141
142
# File 'lib/ruby_grammar_builder/generated/rule.rb', line 133

def to_h
    {
        "begin" => @begin,
        "while" => @while,
        "name" => @name,
        "contentName" => @contentName,
        "beginCaptures" => @beginCaptures.transform_values(&:to_h),
        "whileCaptures" => @whileCaptures.transform_values(&:to_h),
    }.compact
end