rouge-ruby/rouge · error · InvalidRule
#rule used both arguments and a block. Only one is supported
Error message
#rule used both arguments and a block. Only one is supported.
What it means
Error "#rule used both arguments and a block. Only one is supported." thrown in rouge-ruby/rouge.
Source
Thrown at lib/rouge/regex_lexer.rb:177
@group = 0
@sets = []
instance_eval(&defn)
end
def transform(&b)
@mapper = b
end
def group(g)
@group = g
end
def rule(keyword_set, *args, &action)
unless keyword_set.is_a?(Set) || keyword_set.is_a?(Symbol)
raise InvalidKeywordSet.new(@lexer_class)
end
raise InvalidRule if action && args.any?
action ||= Rule.make_action(@covering_regex, *args)
@sets << [keyword_set, action]
end
def default(*args, &block)
@default = block || Rule.make_action(@covering_regex, *args)
end
def to_proc
mapper = @mapper
sets = @sets
default = @default
group = @group
proc do |m|
match = m[group]
match = mapper.call(match) if mapperView on GitHub (pinned to bd7dad7b09)
When it happens
Trigger: Thrown at lib/rouge/regex_lexer.rb:177 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/0f43ac5191f4bf93.
Report an issue: GitHub.