{"record":{"id":"64cbd2e33d39ca21","repo":"rouge-ruby/rouge","slug":"state-state-name-cannot-continue-after-rule","errorCode":null,"errorMessage":"State :#{state.name} cannot continue after #{rule.inspect}, which will always match.","messagePattern":"State :#(.+?) cannot continue after #(.+?), which will always match\\.","errorType":"exception","errorClass":"ClosedState","httpStatus":null,"severity":"error","filePath":"lib/rouge/regex_lexer.rb","lineNumber":284,"sourceCode":"      # @overload rule(re, token, next_state=nil)\n      # @overload rule(re, &callback)\n      #\n      # @param [Regexp] re\n      #   a regular expression for this rule to test.\n      # @param [String] tok\n      #   the token type to yield if `re` matches.\n      # @param [#to_s] next_state\n      #   (optional) a state to push onto the stack if `re` matches.\n      #   If `next_state` is `:pop!`, the state stack will be popped\n      #   instead.\n      # @param [Proc] callback\n      #   a block that will be evaluated in the context of the lexer\n      #   if `re` matches.  This block has access to a number of lexer\n      #   methods, including {RegexLexer#push}, {RegexLexer#pop!},\n      #   {RegexLexer#token}, and {RegexLexer#delegate}.  The first\n      #   argument can be used to access the match groups.\n      def rule(re, *args, &callback)\n        raise ClosedState.new(self) if @closed\n\n        matches_empty = re =~ ''\n\n        callback ||= Rule.make_action(re, *args)\n\n        rules << Rule.new(@lexer_class, re, callback)\n\n        close! if matches_empty && !context_sensitive?(re)\n      end\n\n      def context_sensitive?(re)\n        source = re.source\n        return true if source =~ /[(][?]<?[!=]/\n\n        # anchors count as lookahead/behind\n        return true if source =~ /[$^]/\n\n        false","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/rouge-ruby/rouge/blob/bd7dad7b0939c556e582a0370686f6fc022c8af5/lib/rouge/regex_lexer.rb#L266-L302","documentation":"Error \"State :#{state.name} cannot continue after #{rule.inspect}, which will always match.\" thrown in rouge-ruby/rouge.","triggerScenarios":"Thrown at lib/rouge/regex_lexer.rb:284 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bd7dad7b0939c556e582a0370686f6fc022c8af5","analyzedAt":"2026-08-23T11:34:50.713Z","schemaVersion":2},"datasetVersion":"2026-08-23T16:17:53.355Z"}