class Luce::TextSyntax
- Luce::TextSyntax
- Luce::InlineSyntax
- Reference
- Object
Overview
Matches stuff that should just be passed through as straight text.
Direct Known Subclasses
Defined in:
luce/inline_parser.crConstructors
-
.new(pattern : String, sub : String = "", start_character : Int32 | Nil = nil)
Create a new
TextSyntax
which matches text on pattern.
Instance Method Summary
-
#on_match(parser : InlineParser, match : Regex::MatchData) : Bool
Adds a
Text
node to parser and returnstrue
if there is a#substitute
, as long as the preceding character (if any) is not a/
. - #substitute : String
Instance methods inherited from class Luce::InlineSyntax
matches?(parser : InlineParser, start_match_pos : Int32 | Nil = nil) : Bool
matches?,
on_match(parser : InlineParser, match : Regex::MatchData) : Bool
on_match,
pattern : Regex
pattern
Constructor methods inherited from class Luce::InlineSyntax
new(pattern : String, start_character : Int32 | Nil = nil)
new
Constructor Detail
Create a new TextSyntax
which matches text on pattern.
If sub is passed, it is used as a simple replacement for pattern. If start_character is passed, it is used as a pre-matching check which is faster than matching against pattern.
Instance Method Detail
def on_match(parser : InlineParser, match : Regex::MatchData) : Bool
#
Adds a Text
node to parser and returns true
if there is a
#substitute
, as long as the preceding character (if any) is not
a /
.
Otherwise, the parser is advanced by the size of match and
false
is returned.