class SublimeDSL::TextMate::Grammar::RuleBuilder::BeginEndState
Public Class Methods
new(builder)
click to toggle source
Calls superclass method
SublimeDSL::TextMate::Grammar::RuleBuilder::State::new
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 328 def initialize(builder) super builder @from = @to = nil @both = {} @content_scope = nil @to_last = nil end
Public Instance Methods
both(captures)
click to toggle source
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 352 def both(captures) @both.empty? or raise Error, "'both' already specified" @both.merge! captures end
content_scope=(scope)
click to toggle source
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 357 def content_scope=(scope) @content_scope = scope end
from(re, captures)
click to toggle source
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 340 def from(re, captures) @from and raise Error, "'from' called twice" @from = Match.new(Tools::RegexpWannabe.new(re.source)) @from.captures.merge! captures end
match(re, captures)
click to toggle source
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 336 def match(re, captures) raise Error, "'match' is invalid with 'from' or 'to'" end
rule()
click to toggle source
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 365 def rule r = BeginEndRule.new init r r.content_scope = @content_scope r.from = @from r.to = @to r.to_last = @to_last r.captures.merge! @both r.patterns.concat @patterns r end
to(re, captures)
click to toggle source
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 346 def to(re, captures) @to and raise Error, "'to' called twice" @to = Match.new(Tools::RegexpWannabe.new(re.source, @from)) @to.captures.merge! captures end
to_last=(value)
click to toggle source
# File lib/sublime_dsl/textmate/grammar/dsl_reader.rb, line 361 def to_last=(value) @to_last = value end