Class | Rouge::RegexLexer::StateDSL |
In: |
lib/rouge/regex_lexer.rb
|
Parent: | Object |
rules | [R] |
Mix in the rules from another state into this state. The rules from the mixed-in state will be tried in order before moving on to the rest of the rules in this state.
Define a new rule for this state.
@overload rule(re, token, next_state=nil) @overload rule(re, &callback)
@param [Regexp] re
a regular expression for this rule to test.
@param [String] tok
the token type to yield if `re` matches.
@param [to_s] next_state
(optional) a state to push onto the stack if `re` matches. If `next_state` is `:pop!`, the state stack will be popped instead.
@param [Proc] callback
a block that will be evaluated in the context of the lexer if `re` matches. This block has access to a number of lexer methods, including {RegexLexer#push}, {RegexLexer#pop!}, {RegexLexer#token}, and {RegexLexer#delegate}. The first argument can be used to access the match groups.