Exception: Rouge::RegexLexer::ClosedState

Inherits:
StandardError
  • Object
show all
Defined in:
lib/rouge/regex_lexer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(state) ⇒ ClosedState

Returns a new instance of ClosedState.



21
22
23
# File 'lib/rouge/regex_lexer.rb', line 21

def initialize(state)
  @state = state
end

Instance Attribute Details

#stateObject (readonly)

Returns the value of attribute state.



20
21
22
# File 'lib/rouge/regex_lexer.rb', line 20

def state
  @state
end

Instance Method Details

#ruleObject



25
26
27
# File 'lib/rouge/regex_lexer.rb', line 25

def rule
  @state.rules.last
end

#to_sObject



29
30
31
32
33
34
35
36
37
# File 'lib/rouge/regex_lexer.rb', line 29

def to_s
  rule = @state.rules.last
  msg = "State :#{state.name} cannot continue after #{rule.inspect}, which will always match."
  if rule.re.source.include?('*')
    msg += " Consider replacing * with +."
  end

  msg
end