The dso-lex Reference Manual

This is the dso-lex Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Feb 15 05:51:41 2024 GMT+0.

Table of Contents


1 Systems

The main system appears first, followed by any subsystem dependency.


1.1 dso-lex

Dependencies
  • cl-ppcre (system).
  • dso-util (system).
Source

dso-lex.asd.

Child Component

lex.lisp (file).


2 Files

Files are sorted by type and then listed depth-first from the systems components trees.


2.1 Lisp


2.1.1 dso-lex/dso-lex.asd

Source

dso-lex.asd.

Parent Component

dso-lex (system).

ASDF Systems

dso-lex.


2.1.2 dso-lex/lex.lisp

Source

dso-lex.asd.

Parent Component

dso-lex (system).

Packages

dso-lex.

Public Interface
Internals

3 Packages

Packages are listed by definition order.


3.1 dso-lex

Allows the definition of lexers. See DEFLEXER.

Source

lex.lisp.

Use List
  • cl-ppcre.
  • common-lisp.
  • dso-util.
Public Interface
Internals

4 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


4.1 Public Interface


4.1.1 Macros

Macro: deflexer (name (&key priority-only) &body defs)

Defines a lexer, called as a function of the given NAME, and returning the matched token-class, image, and image-length as values. The body consists of token-class definitions, each being a list of a regular expression, the name of the class, and an optional filter.

Unless PRIORITY-ONLY is true, the longest match will win, and rule-priority will only be used to break ties. Otherwise, the first match wins.

Example:

(deflexer lexer ()
("[0-9]+" number parse-integer)
("[a-zA-Z]" letter))

(lexer "2pi" 1)

Package

dso-lex.

Source

lex.lisp.


4.1.2 Ordinary functions

Function: lex-all (lexer input)
Package

dso-lex.

Source

lex.lisp.

Function: make-lexer (defs &key priority-only)

Returns a lexer function. The DEFS consists of token-class definitions, each being a list of a regular expression, the name of the class, and an optional filter. The returned function takes as arguments an input sequence and an optional start position, and returning the matched token-class, image, and image-length as values.

Unless PRIORITY-ONLY is true, the longest match will win, and rule-priority will only be used to break ties. Otherwise, the first match wins.

Example:

(let ((lexer (make-lexer ’(("[0-9]+" number parse-integer) ("[a-zA-Z]" letter)))))
(funcall lexer "2pi" 1))

Package

dso-lex.

Source

lex.lisp.


4.2 Internals


4.2.1 Ordinary functions

Function: anchor-and-mode (regex)
Package

dso-lex.

Source

lex.lisp.

Function: break-defs (defs)
Package

dso-lex.

Source

lex.lisp.

Function: combine (regex-list)
Package

dso-lex.

Source

lex.lisp.

Function: greedy-lexer-form (input-var start-var defs)
Package

dso-lex.

Source

lex.lisp.

Function: lexer-form (input-var start-var defs)
Package

dso-lex.

Source

lex.lisp.

Function: wrap (regex)
Package

dso-lex.

Source

lex.lisp.


Appendix A Indexes


A.1 Concepts


A.3 Variables