class SublimeDSL::TextMate::Grammar::RuleBuilder::State

Attributes

builder[RW]
comment[RW]
disabled[RW]
scope[RW]

Public Class Methods

new(builder) click to toggle source
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 219
def initialize(builder)
  @scope = @comment = @disabled = nil
  @builder = builder
  @patterns = []
end

Public Instance Methods

both(captures) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# 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
patterns() click to toggle source
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 256
def patterns
  @patterns
end
rule() click to toggle source
# 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) click to toggle source
# 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) click to toggle source
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 251
def to_last=(value)
  s = state_for(BeginEndState)
  s.to_last = value
end

Private Instance Methods

init(rule) click to toggle source
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 278
def init(rule)
  rule.scope = @scope
  rule.comment = @comment
  rule.disabled = @disabled
end
state_for(klass) click to toggle source
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 269
def state_for(klass)
  s = klass.new(builder)
  s.scope = scope
  s.comment = comment
  s.disabled = disabled
  s.patterns.concat @patterns unless @patterns.empty?
  @builder.state = s
end