class Luce::TextSyntax

Overview

Matches stuff that should just be passed through as straight text.

Direct Known Subclasses

Defined in:

luce/inline_syntaxes/text_syntax.cr

Constructors

Instance Method Summary

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, case_sensitive : Bool = true) new

Constructor Detail

def self.new(pattern : String, sub : String = "", start_character : Int32 | Nil = nil) #

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.


def substitute : String #