trivia

API Reference

trivia

NON-optimized pattern matcher compatible with OPTIMA, with extensible optimizer interface and clean codebase

No packages.

trivia.benchmark

No packages.

trivia.level0

Bootstrapping Pattern Matching Library for implementing Trivia

TRIVIA.LEVEL0

  • Macro MATCH0 (*what* &body clauses &environment *env*)
  • Macro EMATCH0 (what &body clauses)
  • Macro LAMBDA-MATCH0 (&body clauses)
  • Macro LAMBDA-EMATCH0 (&body clauses)

trivia.level1

Core patterns of Trivia

TRIVIA.LEVEL1

  • Macro MATCH1 (what &body clauses)
  • Condition OR1-PATTERN-INCONSISTENCY  (ERROR)
  • Condition GUARD1-PATTERN-NONLINEAR  (ERROR)
  • Variable *LEXVARS*
    nil
    List of symbol-and-options in the current parsing context.
  • Variable *OR-PATTERN-ALLOW-UNSHARED-VARIABLES*
    t
  • Function CORRECT-PATTERN (pattern)
    Recursively check and try to correct the mismatch in the set of variables in or1 patterns
  • Function PREPROCESS-SYMOPTS (symopt? pattern)
    Ensure the symopts being a list, plus sets some default values.
  • Variable *TRACE-DISPATCHING*
    nil
    Used only for debugging. When non-nil, test-form for pattern matching is printed on the stream.
  • Macro TRACE-WHEN (condition &rest body)
    Evaluate and print the result of the form when *trace-dispatching* is non-nil.
  • Function VARIABLES (pattern &optional *lexvars*)

TRIVIA.FAIL

  • Macro FAIL

TRIVIA.SKIP

  • Macro SKIP

TRIVIA.NEXT

  • Macro NEXT

TRIVIA.LEVEL1.IMPL

No exported symbols.

trivia.level2

NON-optimized pattern matcher compatible with OPTIMA, with extensible optimizer interface and clean codebase

TRIVIA.LEVEL2

  • Function PATTERN-EXPAND-1 (p)
    expand the given pattern once, just like macroexpand-1. Returns (values expansion-form expanded-p)
  • Function PATTERN-EXPAND (p)
    expand the given pattern downto level1 pattern (i.e. until no expansion is available), just like macroexpand
  • Function PATTERN-EXPAND-ALL (p)
    expand the given pattern recursively
  • Macro DEFPATTERN (name args &body body)
    Adds a new derived pattern. The default value of &optional arguments are '_, instead of nil.
  • Macro DEFPATTERN-INLINE (name args &body body)
    Adds a new inlined derived pattern. These patterns are evaluated from the innermost ones. The default value of &optional arguments are '_, instead of nil.
  • Function INLINE-PATTERN-EXPAND (p)
    Given a pattern p, returns a list of patterns that should be inlined.
  • Function (setf SYMBOL-OPTIMIZER) (new-value symbol)
    Automatically defined setter function.
  • Function SYMBOL-OPTIMIZER (symbol &optional (default common-lisp:nil default-supplied-p))
    Automatically defined getter function. When DEFAULT is supplied, the value is set automatically.
  • Variable *OPTIMIZER*
    :trivial
  • Macro IN-OPTIMIZER (name)
  • Macro DEFOPTIMIZER (name args &body body)
  • Macro MATCH2 (what &body clauses)
    In match2/match2*, the last clause is not enclosed in a block. Therefore, using `next' in the last clause results in jumping to the next innermost matching construct, or results in a compilation error when this is the outermost matching construct.
  • Macro MATCH2+ (what type &body clauses)
    Variant of match2 : can specify the inferred type of the argument
  • Macro MATCH2* (whats &body clauses)
    In match2/match2*, the last clause is not enclosed in a block. Therefore, using `next' in the last clause results in jumping to the next innermost matching construct, or results in a compilation error when this is the outermost matching construct.
  • Macro MATCH2*+ ((&rest whats) (&rest types) &body clauses)
    Variant of match2* : can specify the inferred types of each argument
  • Function GENERATE-MULTI-MATCHER (args *lexvars* clauses &optional in-clause-block)
  • Macro MATCH (what &body clauses)
  • Macro MATCH* (whats &body clauses)
  • Condition MATCH-ERROR  (ERROR)
  • Macro EMATCH (what &body clauses)
  • Macro EMATCH* (whats &body clauses)
  • Macro CMATCH (what &body clauses)
  • Macro CMATCH* (whats &body clauses)
  • Macro MULTIPLE-VALUE-MATCH (values-form &body clauses)
  • Macro MULTIPLE-VALUE-EMATCH (values-form &body clauses)
  • Macro MULTIPLE-VALUE-CMATCH (values-form &body clauses)
  • Macro LAMBDA-MATCH (&body body)
  • Macro LAMBDA-EMATCH (&body body)
  • Macro LAMBDA-CMATCH (&body body)
  • Macro LAMBDA-MATCH* (&body body)
  • Macro LAMBDA-EMATCH* (&body body)
  • Macro LAMBDA-CMATCH* (&body body)
  • Macro DEFUN-MATCH (name (arg) &body body)
  • Macro DEFUN-EMATCH (name (arg) &body body)
  • Macro DEFUN-CMATCH (name (arg) &body body)
  • Macro DEFUN-MATCH* (name args &body body)
  • Macro DEFUN-EMATCH* (name args &body body)
  • Macro DEFUN-CMATCH* (name args &body body)
  • Macro IF-MATCH (pattern arg &body (then &optional else))
    Equivalent to (match ARG (PATTERN THEN) (_ ELSE)).
  • Macro WHEN-MATCH (pattern arg &body body)
    Equivalent to (match ARG (PATTERN BODY...)).
  • Macro UNLESS-MATCH (pattern arg &body body)
    Equivalent to (match ARG (PATTERN) (_ BODY...)).
  • Macro LET-MATCH (bindings &body body)
    Similar to LET, except not only a variable but also a pattern can be used in BINDINGS.
  • Macro LET-MATCH* (bindings &body body)
    Similar to LET-MATCH but matches sequentially.
  • Macro LET-MATCH1 (pattern arg &body body)
    Equivalent to (let-match ((PATTERN ARG)) BODY...).
  • Variable *ARITY-CHECK-BY-TEST-CALL*
    t
    If enabled (non-nil), UNARY-FUNCTION-P tests the arity of the candidate accessor function by FUNCALLing it with *TEST-CALL-ARGUMENT* (see the docstring of *TEST-CALL-ARGUMENT*). PROGRAM-ERROR is treated as a reason of rejection; A function of arity != 1. Other errors, as well as completion of the call without errors, are treated as a success.
  • Variable *TEST-CALL-ARGUMENT*
    42
    An argument used to call the candidate function in UNARY-FUNCTION-P. See *ARITY-CHECK-BY-TEST-CALL* for details.

Also exports

  • TRIVIA.LEVEL1:MATCH1
  • TRIVIA.LEVEL1:*OR-PATTERN-ALLOW-UNSHARED-VARIABLES*
  • TRIVIA.LEVEL1:OR1
  • TRIVIA.LEVEL1:GUARD1

TRIVIA.LEVEL2.IMPL

  • Function PREDICATEP (type)
  • Function PREDICATE-P (type)

trivia.level2.docparser

docparser interface to trivia patterns

No packages.

trivia.ppcre

PPCRE extention of trivia

TRIVIA.PPCRE

  • Macro PPCRE ((regexp &key start end sharedp) &rest subpatterns)
    Accepts both a short form and a long form. Long form: ppcre (regexp &key start end sharedp) &rest subpatterns Short form: ppcre regexp &rest subpatterns

TRIVIA.PPCRE.IMPL

No exported symbols.