The cl-lex Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The cl-lex Reference Manual

This is the cl-lex Reference Manual, version 1.1.3, generated automatically by Declt version 2.4 "Will Decker" on Wed Jun 20 11:12:45 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

cl-lex

cl-lex is a set of Common Lisp macros for generating lexical analyzers automatically. Registers (including named registers) can be accessed by number or name in token generation code. The cl-ppcre library is used for implementing regular expressions. Lexers generated using cl-lex can be used with cl-yacc.


Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

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


Previous: , Up: Systems   [Contents][Index]

2.1 cl-lex

Author

David J. Rosenbaum <djr7C4@gmail.com>

License

GPL3

Description

Common Lisp macros for generating lexical analyzers

Version

1.1.3

Dependency

cl-ppcre

Source

cl-lex.asd (file)

Components

Next: , Previous: , Up: Top   [Contents][Index]

3 Files

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


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 cl-lex.asd

Location

cl-lex.asd

Systems

cl-lex (system)


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.2 cl-lex/packages.lisp

Parent

cl-lex (system)

Location

packages.lisp

Packages

cl-lex


Previous: , Up: Lisp files   [Contents][Index]

3.1.3 cl-lex/lex.lisp

Dependency

packages.lisp (file)

Parent

cl-lex (system)

Location

lex.lisp

Exported Definitions
Internal Definitions

with-gensyms (macro)


Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 cl-lex

Source

packages.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

with-gensyms (macro)


Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

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


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Macros

Macro: define-string-lexer NAME &body PATTERNS

Defines a function that takes a string and keyword arguments for the start and end of the string and returns a closure that takes no arguments and will return the next token each time it is called. When the input string is exhausted or no more matches are found the closure will return nil. Each pattern must be a regular expression or a list of one regular expression or a list containing a regular expression as the first element and the rest of the elements of the list forming an implicit progn. If a pattern is a regular expression or a list of one element, then text in the string that matches the regular expression is ignored. If a pattern is a list of two elements then when the regular expression matches text the sub-strings that match each register in the regular expression are bound to the symbols that represent the registers. Any text that matches named registers is bound to a variable with the same name as the register name. If the same name is used for more than one register then subsequent have the appropriate index appended to their names. If a register is not named, then text that matches it is bound to $i where i is the index of the register. The entire matching sub-string is bound to $@. If no text matches a register then its variable is bound to nil. All symbols are interned in the current package when the macro is expanded. The start and end variables passed to the function are accessible from inside the implicit progn’s from the patterns. Patterns are applied in the order they are provided and multiple patterns cannot be applied to the same piece of text. Any text that is not matched to a pattern is skipped. The behavior of the regular expressions can be modified by setting the appropriate variables in the cl-ppcre regex library.

Package

cl-lex

Source

lex.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: stream-lexer READ-SOURCE-LINE STRING-LEXER OPENING-DELIMITER-P CLOSING-DELIMITER-P &key STREAM

Returns a closure that takes no arguments and will return each token from stream when called. read-source-line is a function that takes an input stream and returns a line of the source. When EOF is encountered, read-source-line should return t. string-lexer is a function that returns a lexer that behaves as if it was returned by a function defined using define-string-lexer. opening-delimiter-p is a function that takes a character and returns true if it is an opening delimiter and false otherwise. closing-delimiter-p is a function that takes a character. When there no more tokens are left, nil is returned. nil is also returned when a newline is encountered and there are no open delimiters. If the closure is called again after EOF has been encountered a condition of type end-of-file is signalled.

Package

cl-lex

Source

lex.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Macros

Macro: with-gensyms (&rest SYMBOLS) &body BODY

Replaces symbols in body with new symbols created by gensym. body is treated as an implicit progn.

Package

cl-lex

Source

lex.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   C   F   L  
Index Entry  Section

C
cl-lex.asd: The cl-lex<dot>asd file
cl-lex/lex.lisp: The cl-lex/lex<dot>lisp file
cl-lex/packages.lisp: The cl-lex/packages<dot>lisp file

F
File, Lisp, cl-lex.asd: The cl-lex<dot>asd file
File, Lisp, cl-lex/lex.lisp: The cl-lex/lex<dot>lisp file
File, Lisp, cl-lex/packages.lisp: The cl-lex/packages<dot>lisp file

L
Lisp File, cl-lex.asd: The cl-lex<dot>asd file
Lisp File, cl-lex/lex.lisp: The cl-lex/lex<dot>lisp file
Lisp File, cl-lex/packages.lisp: The cl-lex/packages<dot>lisp file

Jump to:   C   F   L  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   D   F   M   S   W  
Index Entry  Section

D
define-string-lexer: Exported macros

F
Function, stream-lexer: Exported functions

M
Macro, define-string-lexer: Exported macros
Macro, with-gensyms: Internal macros

S
stream-lexer: Exported functions

W
with-gensyms: Internal macros

Jump to:   D   F   M   S   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables


Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   C   P   S  
Index Entry  Section

C
cl-lex: The cl-lex system
cl-lex: The cl-lex package

P
Package, cl-lex: The cl-lex package

S
System, cl-lex: The cl-lex system

Jump to:   C   P   S