Module expr

Source

Structs§

All
A [Step] that consumes a list of expressions and only matches if all the child Exprs do.
AnchorEnd
A Step which will match only if the cursor is over the last non-whitespace character in stream. It will return that token.
AnchorStart
A Step which will match only if the cursor is over the first word-like of a token stream. It will return that token.
ExprMap
A map from an Expr to arbitrary data.
FirstMatchOf
A naive expr collection that naively iterates through a list of patterns, returning the first one that matches.
FixedPhrase
Matches a fixed sequence of tokens as they appear in the input. Case-insensitive for words but maintains exact matching for other token types.
LongestMatchOf
A [Step] that returns the farthest offset of the longest match in a list of expressions.
MergeableWords
A Expr that identifies adjacent words that could potentially be merged into a single word.
Optional
An optional expression. Forces the optional expression to always return Some by transmuting None into Some(cursor..cursor).
ReflexivePronoun
Matches reflexive pronouns with configurable strictness.
Repeating
An expression that will match one or more repetitions of the same expression.
SequenceExpr
SimilarToPhrase
SpaceOrHyphen
Matches either a space or a hyphen, useful for matching compound words.
SpelledNumberExpr
Matches spelled-out numbers from one to ninety-nine
TimeUnitExpr
Matches a time unit.
UnlessStep
Provides the ability to use an expression as a condition. If the condition does not match, it will return the result of the provided step.
WordExprGroup
An expression collection to look for expressions that start with a specific word.

Traits§

Expr
A common problem in Harper is that we need to identify tokens that fulfil certain criterion. An Expr is a way to express whether a certain set of tokens fulfil that criteria. When supplied a specific position in a token stream, the job of an Expr is to determine the window of tokens (including the cursor itself) that fulfils whatever criteria the author desires. It is then the job of another system to identify portions of documents that fulfil this criteria.
ExprExt
OwnedExprExt
Step
An atomic step within a larger expression.