laika.parse.text
Members list
Type members
Classlikes
Common groups of characters as input for parser definitions.
Common groups of characters as input for parser definitions.
These groups are all in the ASCII range. For dealing with the entire unicode range you can use the generic anyWhile
parser that accepts a Char => Boolean
predicate.
Attributes
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
CharGroup.type
Companion with factory methods for creating optimized character parsers.
Companion with factory methods for creating optimized character parsers.
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
Characters.type
A parser for text that ends with a specific delimiter condition, either marking the end of the text span or the start of an embedded inner span.
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
DelimitedText.type
A parser that simplifies the expression of typical conditions for start and end delimiters of inline spans.
A parser that simplifies the expression of typical conditions for start and end delimiters of inline spans.
It allows to specify conditions for the immediately preceding and following character of the parsed delimiter.
As an example, the following parser is only composed of base combinators
lookBehind(1, not(' ')) ~ "**" ~ lookAhead(not(' '))
It looks for the string "**" as a delimiter and does not allow any space character before or after the delimiter
With this API it can be rewritten as:
delimiter("**").prevNot(' ').nextNot(' ')
The only characters that this parser will consume and return as a result are those of the delimiter itself, not the surrounding characters that it validated.
Attributes
- Supertypes
A parser that matches a literal string.
A parser that matches a literal string.
Attributes
- Supertypes
-
trait Serializabletrait Producttrait Equalstrait PrefixedParser[String]class Parser[String]class Objecttrait Matchableclass AnyShow all
A variant of the Characters type that can be used as a stable prefix for an optimized span parser as it is always non-empty. It's created by the oneOf
method in TextParsers
and usually not used directly.
A variant of the Characters type that can be used as a stable prefix for an optimized span parser as it is always non-empty. It's created by the oneOf
method in TextParsers
and usually not used directly.
Attributes
- Supertypes
A parser that is associated with a non-empty set of trigger characters for performance optimizations.
A parser that is associated with a non-empty set of trigger characters for performance optimizations.
There is usually no need to create such a parser manually, as some of the basic building blocks in TextParsers
create such a parser (e.g. the literal
, oneOf
or someOf
parsers).
This set only has only an effect when this parser is used in an optimized parser for recursive spans, meaning it is either registered as a top-level parser (with SpanParser.standalone
or SpanParser.recursive
) or passed to a custom span parser with InlineParser.embed
. In all other use cases this parser behaves just like plain parser.
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
trait CodeParserBaseclass CharParserclass NumericParserclass StringParserclass TagParserclass IdParserclass DelimiterParserclass Literalclass PrefixCharacters[T]Show all
- Self type
Factories and utilities for creating or processing PrefixedParser instances.
Factories and utilities for creating or processing PrefixedParser instances.
Attributes
- Companion
- trait
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type
-
PrefixedParser.type
Base text parsers that provide optimized low-level parsers for typical requirements of text markup parsers. In particular they are meant as an efficient replacement for scenarios where usually regex parsers are used. In cases where different parsers need to be tried for relatively short input sequences, regex parsers tend to be less efficient. Furthermore, these base parsers may also improve readability, as it allows to combine simple low-level parsers to higher-level parsers based on the Laika combinator API, instead of producing long regexes which may be hard to read.
Base text parsers that provide optimized low-level parsers for typical requirements of text markup parsers. In particular they are meant as an efficient replacement for scenarios where usually regex parsers are used. In cases where different parsers need to be tried for relatively short input sequences, regex parsers tend to be less efficient. Furthermore, these base parsers may also improve readability, as it allows to combine simple low-level parsers to higher-level parsers based on the Laika combinator API, instead of producing long regexes which may be hard to read.
Attributes
- Companion
- object
- Supertypes
- Known subtypes
-
object TextParsers.typeobject builders.type
Instance that allows to import all text parsers in isolation.
Instance that allows to import all text parsers in isolation.
Usually it is more convenient to import laika.parse.api._ to get all parser builders with one import.
Attributes
- Companion
- trait
- Supertypes
- Self type
-
TextParsers.type
Processes whitespace, removing or replacing most whitespace characters except for newline and space.
Processes whitespace, removing or replacing most whitespace characters except for newline and space.
It modifies string input in the following ways:
-
Replaces all occurrences of tabs with the corresponding number of spaces, depending on the column the tab is placed in and the configured
tabStops
value. -
Removes any return character.
-
Replaces form feed and vertical tab with spaces.
The processor should run on text input before it is passed to the actual parsers as they would not be able to deal with tabs properly.
Attributes
- Companion
- object
- Supertypes
-
trait String => Stringclass Objecttrait Matchableclass Any
Companion for creating instances of WhitespacePreprocessor.
Companion for creating instances of WhitespacePreprocessor.
Attributes
- Companion
- class
- Supertypes
-
class Objecttrait Matchableclass Any
- Self type