Class: SublimeDSL::TextMate::Grammar::RuleBuilder::State

Inherits:
Object
  • Object
show all
Defined in:
lib/sublime_dsl/textmate/grammar/dsl_reader.rb

Direct Known Subclasses

BeginEndState, MatchState

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(builder) ⇒ State

Returns a new instance of State.



219
220
221
222
223
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 219

def initialize(builder)
  @scope = @comment = @disabled = nil
  @builder = builder
  @patterns = []
end

Instance Attribute Details

#builderObject

Returns the value of attribute builder.



216
217
218
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 216

def builder
  @builder
end

#commentObject

Returns the value of attribute comment.



217
218
219
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 217

def comment
  @comment
end

#disabledObject

Returns the value of attribute disabled.



217
218
219
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 217

def disabled
  @disabled
end

#scopeObject

Returns the value of attribute scope.



217
218
219
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 217

def scope
  @scope
end

Instance Method Details

#both(captures) ⇒ Object



241
242
243
244
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 241

def both(captures)
  s = state_for(BeginEndState)
  s.both captures
end

#content_scope=(scope) ⇒ Object



246
247
248
249
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 246

def content_scope=(scope)
  s = state_for(BeginEndState)
  s.content_scope = scope
end

#from(re, captures) ⇒ Object



231
232
233
234
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 231

def from(re, captures)
  s = state_for(BeginEndState)
  s.from re, captures
end

#match(re, captures) ⇒ Object



225
226
227
228
229
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 225

def match(re, captures)
  @patterns.empty? or raise Error, "a 'match' rule cannot contain 'include' or 'rule'"
  s = state_for(MatchState)
  s.match re, captures
end

#patternsObject



256
257
258
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 256

def patterns
  @patterns
end

#ruleObject



260
261
262
263
264
265
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 260

def rule
  r = NoMatchRule.new
  init r
  r.patterns.concat @patterns
  r
end

#to(re, captures) ⇒ Object



236
237
238
239
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 236

def to(re, captures)
  s = state_for(BeginEndState)
  s.to re, captures
end

#to_last=(value) ⇒ Object



251
252
253
254
# File 'lib/sublime_dsl/textmate/grammar/dsl_reader.rb', line 251

def to_last=(value)
  s = state_for(BeginEndState)
  s.to_last = value
end