rouge-ruby/rouge · error · InvalidRegex
regex #{@re.inspect} matches empty string, but has no predic
Error message
regex #{@re.inspect} matches empty string, but has no predicate! What it means
Error "regex #{@re.inspect} matches empty string, but has no predicate!" thrown in rouge-ruby/rouge.
Source
Thrown at lib/rouge/regex_lexer.rb:126
@stack.push(state)
end
when Array
# [jneen] TODO: deprecate this.
proc do |stream|
puts " yielding: #{tok.qualname}, #{stream[0].inspect}" if @debug
@output_stream.call(tok, stream[0])
for i_next_state in next_state do
next @stack.pop if i_next_state == :pop!
next @stack.push(@stack.last) if i_next_state == :push
state = @states[i_next_state] || self.class.get_state(i_next_state)
puts " pushing :#{state.name}" if @debug
@stack.push(state)
end
end
when nil
# cannot use an empty-matching regexp with no predicate
raise InvalidRegex.new(re) if matches_empty
proc do |stream|
puts " yielding: #{tok.qualname}, #{stream[0].inspect}" if @debug
@output_stream.call(tok, stream[0])
end
end
end
end
# a State is a named set of rules that can be tested for or
# mixed in.
#
# @see RegexLexer.state
class State
attr_reader :name, :rules
def initialize(name, rules)
@name = name
@rules = rulesView on GitHub (pinned to bd7dad7b09)
When it happens
Trigger: Thrown at lib/rouge/regex_lexer.rb:126 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of rouge-ruby/rouge@bd7dad7b09 (2026-08-23).
Data as JSON: /api/errors/5ffc46af13aa5f3d.
Report an issue: GitHub.