The linewise-template Reference Manual

Table of Contents

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

The linewise-template Reference Manual

This is the linewise-template Reference Manual, generated automatically by Declt version 2.3 "Robert April" on Tue Jan 09 15:03:11 2018 GMT+0.


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

1 Introduction

LINEWISE-TEMPLATE is a Common Lisp library for processing text files and
streams as templates conforming to simple line-based hierarchical formats.
It is primarily intended for metaprogramming purposes.


[Use Case I]

Suppose you have a program which generates some code in a C-like language,
and you want the code to be inserted in a file which also has to contain
handcrafted code all around the generated parts.  In the spirit of
exploratory programming, you occasionally modify both the handcrafted code
and that part of the program which affects code generation.  You can choose
to keep the handcrafted part as literal data in your Lisp program (a list of
strings or somesuch) and combine them manually, which can become quite ugly
in complex cases.  An arguably better approach is to use some kind of
template.  The following template can be processed by LINEWISE-TEMPLATE to
replace the lines between @BEGIN GENERATED and @END GENERATED:

    #include 
    #include 
    #include "serpent.h"
    #include "unicorn.h"
    
    int main (int argc, char *argv[]) {
        char *opts;
        serpent *s;
        // More vars...
        opts = parse_opts(argc, argv);
        s = init_serpent(opts);
        // More serpents and unicorns...
    
    /************ @BEGIN GENERATED ************/
    // Automatically generated code belongs here
    /************ @END GENERATED ************/
    
        kill_serpent(s);
        // More finalization...
        return 0;
    }

If the template resides in a file called unicorn.c, the following expression
causes the portion between the two lines — called “directives” in
LINEWISE-TEMPLATE parlance — to be replaced with the value of
(GENERATE-UNICORN-CODE):

    (linewise-template:process-template
        ((:file #P"example:path;to;unicorn.c" :update t
          :circumfix '("/(\\*{8,}) *" " *\\1/"))
             :copy
             ((:block "GENERATED")
                  :replace :with (generate-unicorn-code)
                  :preserve-directives t)))

which basically means: copy lines from the file unicorn.c (option :FILE) to
a new version of the same file (option :UPDATE), looking for directives in
lines with multiple-asterisk comments (option :CIRCUMFIX), replacing the
marked part, but keeping the directives that delimit it.  Note that the file
may still serve as template for this processor after having been updated.


[Use Case II]

Suppose you have a program which converts between two textual formats
(called, rather cryptically, “serpent” and “unicorn”), and you want to
create for it a suite of Eos or FiveAM unit tests each of which converts
some serpent input to unicorn, and tests for equality with a reference
unicorn text.  You like to see your tests alongside the code that defines
conversion functions for specific features of serpent; also, both serpent
and unicorn can be heavy on double quotes and backslashes, meaning that
you'd rather see them presented in raw text than in Lisp string literals.
This leads you to a decision to wrap test specs in multiline comments in
your Lisp code and rely on source file postprocessing.  On some occasions,
you want to test the feature that unicorn has, of embedding reports of
conversion errors in the output text.  However, unicorn's error format is
bulky, and its exact presentation is subject to change in the course of your
program's development cycle, meaning that you'd rather replace it with some
convenient shorthand in your test spec.

Here's how you go about the business using LINEWISE-TEMPLATE.  Your tests
shall be marked as blocks, that is, shall begin with a @BEGIN TEST X
directive (where X stands for the name of the test) and end with an @END
TEST directive.  Inside, you'll mark the beginning of the source text with a
@SERPENT, and the beginning of the reference output with a @UNICORN.  Inside
the reference output, you'll have errors designated by @ERROR Y M (where Y
stands for the error type, and M for the error message).  Here is a sample
test template, with some ASCII art substituting for actual serpent and
unicorn:

#|
@BEGIN TEST TOAD
@SERPENT
                                      ________
                                     /        \
                     _____          /   @..@   \
                    /   \_(        /   (\--/)   \
       ____        /  \_(         /   (.>__<.)   \
      /  0 \______/ \_(__________/    ^^^  ^^^    \___________________
   >~'\v____^_^_^_^_(_^_^_^_^_^_^__________________^_^_^_^_^_^_^_^_^_^>

@UNICORN
                                            .
                                      ,;,,;'
                                     ,;;'(
                          __       ,;;' ' \
                        /'  '\'~~'~' \ /'\.)
                     ,;(      )    /  |.
@ERROR INDIGESTION "Unexpected toad while parsing serpent body"
                    ,;' \    /-.,,(   ) \
                         ) /       ) / )|
                         ||        ||  \)
                         (_\       (\
@END TEST
|#

Let's assume that you have defined the functions LIST-SOURCE-FILES which
returns a list of paths; FORMAT-UNICORN-ERROR which takes a type and a
message and returns a unicorn error presentation; and WRITE-TEST which takes
a test name, a serpent input text, and a unicorn reference text, and writes
them to some output file all wrapped up as an Eos / FiveAM (TEST ...) form.
Your template processor could then look like this:

    (linewise-template:process-template
        ((:files (list-source-files))
             :discard
             ((:block "TEST" test-name &aux serpent unicorn)
                  :discard :do (write-test test-name serpent unicorn)
                  ((:after "SERPENT")
                       :copy :to (:var serpent))
                  ((:after "UNICORN")
                       :copy :to (:var unicorn)
                       ((:atomic "ERROR" type message)
                            :replace :with (format-unicorn-error
                                             type message))))))

which means: skim over the lines in source files until you encounter a block
delimited by @BEGIN TEST and @END TEST (without circumfixes in this case);
bind TEST-NAME to the Lisp expression occuring after @BEGIN TEST in the
directive line; inside the block, copy the lines after @SERPENT to a string
referred to by the block-local auxiliary variable SERPENT and the lines
after @UNICORN to a string referred to by the auxiliary variable UNICORN,
while replacing every @ERROR line inside the portion after @UNICORN with the
result of applying FORMAT-UNICORN-ERROR to the two expressions occuring
after @ERROR; at the end of the block, output the test specified by the
values of TEST-NAME, SERPENT and UNICORN.


[The LINEWISE-TEMPLATE Dictionary]

{variable} *DIRECTIVE-CIRCUMFIX*

Prefix or circumfix of directive lines (when in comments etc.): a list of 0,
1 or 2 ppcre strings.  Initial value is NIL.


{variable} *DIRECTIVE-ESCAPE*

String to introduce a directive.  Initial value is "@".


{variable} *DIRECTIVE-BASE-PACKAGES*

List of packages which are to be used by the temporary package established
for reading symbols in directives.  Initial value is '(#:COMMON-LISP).


{variable} *BACKUP-PATHNAME-SUFFIX*

String added to file path in order to obtain the name of the backup file.
Initial value is "~".


{variable} *SOURCE-STREAM*

Reference to the current source stream (the one from which a line most
recently has been read.


{variable} *SOURCE-LINE-COUNT*

Reference to an integer incremented for each line read, and reset for each
subsequent source stream.


{macro} PROCESS-TEMPLATE SPEC

Process the template specified by SPEC, which must have the following
syntax:

               ::= ( 
                          [ * ])

        ::= ([[ {}1 | * ]])

 ::= :FILE  [[ * ]] |
                         :FILES  |
                         :STRING  | :STRINGS  |
                         :STREAM  | :STREAMS 

        ::= :UPDATE  | :BACKUP 

        ::= :CIRCUMFIX  | :ESCAPE  |
                         :BASE-PACKAGES 

 ::= :COPY [[ * ]] |
                         :TRANSFORM [[ * ]] |
                         :REPLACE [[ * ]] |
                         :DISCARD [[ * ]]

          ::= :TO  | 

     ::= :BY  | :TO  |
                         

       ::= :WITH  | 

       ::= 

        ::= :DO  |
                         :PRESERVE-DIRECTIVES 

            ::= ( 
                          [ * ])

           ::=  |
                         (:ATOMIC  [  [  ]]) |
                         (:BLOCK  [  [  ]]) |
                         (:AFTER  [  [  ]])

        ::= NIL |  |
                         (:VAR ) | (:FN ) 

               ::= 

               ::= 

        ::= &TRAILER   ; &TRAILER is matched by name

                ::= 

 |  |  |    ; Evaluated to produce a single
     |  |     ; value of the specified type
                     ::= 

 |  |  |        ; Evaluated to produce a list of
           ::=     ; values of the specified type

       ::      ; Evaluated to produce a list of
                                         ; 0, 1 or 2 strings, conjoined
                                         ; to form a ppcre

The sources specified in  are read from by READ-LINE and the
resulting lines processed in a dynamic environment where
*DIRECTIVE-CIRCUMFIX*, *DIRECTIVE-ESCAPE* and *DIRECTIVE-BASE-PACKAGES* are
bound to the values of the corresponding  (when provided),
*SOURCE-STREAM* is bound to the current source stream, and
*SOURCE-LINE-COUNT* to the number of lines read from that stream.

Lines are processed according to  applying either to the
whole source (those outside of any ), or to some part of the source
delimited by “directives”.  A directive is a line that has a prefix and
suffix matching respectively the first and second element of
*DIRECTIVE-CIRCUMFIX* (unless null), and a middle portion beginning with the
string *DIRECTIVE-ESCAPE* (unless null), followed by keywords given by
s of applicable s, followed by zero or more
whitespace-separated Lisp expressions, followed by zero or more trailer
characters.  In the following, we give examples of directives for
*DIRECTIVE-ESCAPE* = \"@\" and *DIRECTIVE-CIRCUMFIX* = NIL; X stays for
arbitrary names.

A  with a (:BLOCK X ...) selector applies to any part of the source
starting with a @BEGIN X directive and an ending with an @END X directive.

A  with an (:AFTER X ...) selector applies to any part of the
source starting with an @X directive and ending immediately before the start
of any sibling , or before the end of its parent ,
whichever comes first.

A  with an (:ATOMIC X ...) selector applies to just the directive
line.  A plain X selector is shorthand for (:ATOMIC X).

Nested subspecs take precedence over their parent specs.  Nested subspecs
are not allowed inside atomic subspecs.  :ATOMIC selectors are incompatible
with :COPY and :TRANSFORM actions.

If the  is :COPY, affected lines are copied verbatim to
.  If the applicable (sub)spec specifies a non-stream
destination, an output string-stream is used.  If the destination is (:VAR
X), the string associated with the stream is assigned to the variable X once
all affected lines have been copied.  If the destination is (:FN X), the
function to which X evaluates is called on the associated string for side
effects once all affected lines have been copied.

If the (sub)spec does not specify any , it is inherited from
the parent spec; for the topmost  without an explicit destination, and
for a  that specifies :TO NIL, an output string-stream is used.
However, if  includes the option :UPDATE T, the
destination shall instead be a stream writing to a new version of the input
file; additionally, the option :BACKUP T causes the prior version of the
file to be backed up as if by (OPEN ... :IF-EXISTS :RENAME).

If the  is :TRANSFORM, affected lines are copied to a temporary
string, the string is passed to the specified function, and the value
returned by the function is written to the destination as if by :COPY.
Subspecs of this spec shall inherit as destination an output stream writing
to the temporary string.

If the  is :REPLACE, affected lines are not copied.  Instead, the
specified value (unless null) is written to the destination inherited from
the parent spec.  :DISCARD is a shorthand for :REPLACE :WITH NIL.

If  includes some , they are expected to form a
destructuring lambda list.  In this case, Lisp expressions are read from the
directive line after the directive name: until the end of the line if 
contains a &REST and no &KEY keywords, or until the maximum possible number
of arguments needed to satisfy the lambda list is obtained.  The list of
expressions is matched against  as if by DESTRUCTURING-BIND.  Lisp
expressions inside the selector's  are then evaluated in a lexcial
environment where variables from  are bound to the data read, and the
variable from  (if specified) is bound to a substring of the
directive line after the end of the last expression read.  Symbols occuring
in the data are interned in a temporary package which inherits all external
symbols from *DIRECTIVE-BASE-PACKAGES*.

The option :DO X causes the expression X to be executed for side-effects
after all affected lines have been processed.

The option :PRESERVE-DIRECTIVES T causes the directive(s) delimiting the
affected lines to be copied to the specified or inherited destination,
except when both the applicable selector and its parent have :REPLACE or
:DISCARD actions.

The value returned by executing PROCESS-TEMPLATE is the string associated
with the destination stream, if the action in  is :COPY or :TRANSFORM,
the  is NIL or unspecified, and  does not
specify :UPDATE T.  Otherwise, the value is NIL.


[License and Support]

LINEWISE-TEMPLATE has been written and is maintained by Boris Smilga
.  It is distributed under the BSD 3-clause license
(see the file LICENSE for details).


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 linewise-template

Maintainer

Boris Smilga <boris.smilga@gmail.com>

Author

Boris Smilga <boris.smilga@gmail.com>

License

BSD-3-Clause

Description

Linewise file/stream processor for code generation etc.

Dependencies
Source

linewise-template.asd (file)

Component

src (module)


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

3 Modules

Modules are listed depth-first from the system components tree.


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

3.1 linewise-template/src

Parent

linewise-template (system)

Location

Component

linewise-template.lisp (file)


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

4 Files

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


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

4.1 Lisp


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

4.1.1 linewise-template.asd

Location

linewise-template.asd

Systems

linewise-template (system)

Packages

linewise-template-system


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

4.1.2 linewise-template/src/linewise-template.lisp

Parent

src (module)

Location

linewise-template.lisp

Packages

linewise-template

Exported Definitions
Internal Definitions

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

5 Packages

Packages are listed by definition order.


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

5.1 linewise-template-system

Source

linewise-template.asd

Use List

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

5.2 linewise-template

Source

linewise-template.lisp (file)

Use List
Exported Definitions
Internal Definitions

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

6 Definitions

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


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

6.1 Exported definitions


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

6.1.1 Special variables

Special Variable: *backup-pathname-suffix*

String added to file path in order to obtain the name of the backup file.

Package

linewise-template

Source

linewise-template.lisp (file)

Special Variable: *directive-base-packages*

List of packages which are to be used by the temporary package established for reading symbols in directives

Package

linewise-template

Source

linewise-template.lisp (file)

Special Variable: *directive-circumfix*

Prefix or circumfix of directive lines (when in comments etc.): a list of 0, 1 or 2 ppcre strings.

Package

linewise-template

Source

linewise-template.lisp (file)

Special Variable: *directive-escape*

String to introduce a directive

Package

linewise-template

Source

linewise-template.lisp (file)

Special Variable: *source-line-count*

Reference to an integer incremented for each line read, and reset for each subsequent source stream.

Package

linewise-template

Source

linewise-template.lisp (file)

Special Variable: *source-stream*

Reference to the current source stream (the one from which a line most recently has been read).

Package

linewise-template

Source

linewise-template.lisp (file)


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

6.1.2 Macros

Macro: process-template SPEC

Process the template specified by SPEC, which must have the following syntax:

<SPEC> ::= (<SOURCE-SPEC> <ACTION-AND-OPTIONS>
[ <SUBSPEC>* ])

<SOURCE-SPEC> ::= ([[ {<SOURCE-STREAM-SPEC>}1 | <SOURCE-OPTS>* ]])
<SOURCE-STREAM-SPEC> ::= :FILE <PATH> [[ <UPDATE-OPTS>* ]] |
:FILES <PATHS> |
:STRING <STRING> | :STRINGS <STRINGS> | :STREAM <STREAM> | :STREAMS <STREAMS>

<UPDATE-OPTS> ::= :UPDATE <BOOLEAN> | :BACKUP <BOOLEAN>

<SOURCE-OPTS> ::= :CIRCUMFIX <REGEXP-PARTS> | :ESCAPE <STRING> | :BASE-PACKAGES <PACKAGES>

<ACTION-AND-OPTIONS> ::= :COPY [[ <COPY-OPTS>* ]] |
:TRANSFORM [[ <TRANSFORM-OPTS>* ]] | :REPLACE [[ <REPLACE-OPTS>* ]] |
:DISCARD [[ <DISCARD-OPTS>* ]]

<COPY-OPTS> ::= :TO <DESTINATION> | <COMMON-OPTS>

<TRANSFORM-OPTS> ::= :BY <FUNCTION> | :TO <DESTINATION> | <COMMON-OPTS>

<REPLACE-OPTS> ::= :WITH <STRING-OR-NIL> | <COMMON-OPTS>

<DISCARD-OPTS> ::= <COMMON-OPTS>

<COMMON-OPTS> ::= :DO <EXPRESSION> |
:PRESERVE-DIRECTIVES <BOOLEAN>

<SUBSPEC> ::= (<SELECTOR> <ACTION-AND-OPTIONS>
[ <SUBSPEC>* ])

<SELECTOR> ::= <NAME> |
(:ATOMIC <NAME> [ <ARGS> [ <TRAILER-ARG> ]]) | (:BLOCK <NAME> [ <ARGS> [ <TRAILER-ARG> ]]) | (:AFTER <NAME> [ <ARGS> [ <TRAILER-ARG> ]])

<DESTINATION> ::= NIL | <STREAM> |
(:VAR <VAR>) | (:FN <FUNCTION>)

<NAME> ::= <string designator>

<ARGS> ::= <destructuring lambda list>

<TRAILER-ARG> ::= &TRAILER <VAR> ; &TRAILER is matched by name

<VAR> ::= <symbol>

<PATH> | <STRING> | <STRING-OR-NIL> | ; Evaluated to produce a single <STREAM> | <BOOLEAN> | <FUNCTION> ; value of the specified type ::= <expression>

<PATHS> | <STRINGS> | <STREAMS> | ; Evaluated to produce a list of <PACKAGES> ::= <expression> ; values of the specified type

<REGEXP-PARTS> :: <expression> ; Evaluated to produce a list of ; 0, 1 or 2 strings, conjoined ; to form a ppcre

The sources specified in <SOURCE-SPEC> are read from by READ-LINE and the resulting lines processed in a dynamic environment where *DIRECTIVE-CIRCUMFIX*, *DIRECTIVE-ESCAPE* and *DIRECTIVE-BASE-PACKAGES* are bound to the values of the corresponding <SOURCE-OPTS> (when provided), *SOURCE-STREAM* is bound to the current source stream, and *SOURCE-LINE-COUNT* to the number of lines read from that stream.

Lines are processed according to <ACTION-AND-OPTIONS> applying either to the whole source (those outside of any <SUBSPEC>), or to some part of the source delimited by “directives”. A directive is a line that has a prefix and suffix matching respectively the first and second element of *DIRECTIVE-CIRCUMFIX* (unless null), and a middle portion beginning with the string *DIRECTIVE-ESCAPE* (unless null), followed by keywords given by <SELECTOR>s of applicable <SUBSPEC>s, followed by zero or more whitespace-separated Lisp expressions, followed by zero or more trailer characters. In the following, we give examples of directives for *DIRECTIVE-ESCAPE* = "@" and *DIRECTIVE-CIRCUMFIX* = NIL; X stays for arbitrary names.

A <SUBSPEC> with a (:BLOCK X ...) selector applies to any part of the source starting with a @BEGIN X directive and an ending with an @END X directive.

A <SUBSPEC> with an (:AFTER X ...) selector applies to any part of the source starting with an @X directive and ending immediately before the start of any sibling <SUBSPEC>, or before the end of its parent <SUBSPEC>, whichever comes first.

A <SUBSPEC> with an (:ATOMIC X ...) selector applies to just the directive line. A plain X selector is shorthand for (:ATOMIC X).

Nested subspecs take precedence over their parent specs. Nested subspecs are not allowed inside atomic subspecs. :ATOMIC selectors are incompatible with :COPY and :TRANSFORM actions.

If the <ACTION> is :COPY, affected lines are copied verbatim to <DESTINATION>. If the applicable (sub)spec specifies a non-stream destination, an output string-stream is used. If the destination
is (:VAR X), the string associated with the stream is assigned to the variable X once all affected lines have been copied. If the destination is (:FN X), the function to which X evaluates is called on the associated string for side effects once all affected lines have been copied.

If the (sub)spec does not specify any <DESTINATION>, it is inherited from the parent spec; for the topmost <SPEC> without an explicit destination, and for a <SPEC> that specifies :TO NIL, an output string-stream is used. However, if <SOURCE-STREAM-SPEC> includes the option :UPDATE T, the destination shall instead be a stream writing to a new version of the input file; additionally, the option :BACKUP T causes the prior version of the file to be backed up as if by (OPEN ... :IF-EXISTS :RENAME).

If the <ACTION> is :TRANSFORM, affected lines are copied to a temporary string, the string is passed to the specified function, and the value returned by the function is written to the destination as if by :COPY. Subspecs of this spec shall inherit as destination an output stream writing to the temporary string.

If the <ACTION> is :REPLACE, affected lines are not copied. Instead, the specified value (unless null) is written to the destination inherited from the parent spec. :DISCARD is a shorthand for :REPLACE :WITH NIL.

If <SELECTOR> includes some <ARGS>, they are expected to form a destructuring lambda list. In this case, Lisp expressions are read from the directive line after the directive name: until the end of the line if <ARGS> contains a &REST and no &KEY keywords, or until the maximum possible number of arguments needed to satisfy the lambda list is obtained. The list of expressions is matched against <ARGS> as if by DESTRUCTURING-BIND. Lisp expressions inside the selector’s <SUBSPEC> are then evaluated in a lexcial environment where variables from <ARGS> are bound to the data read, and the variable from <TRAILER-ARG> (if specified) is bound to a substring of the directive line after the end of the last expression read. Symbols occuring in the data are interned in a temporary package which inherits all external symbols from *DIRECTIVE-BASE-PACKAGES*.

The option :DO X causes the expression X to be executed for side-effects after all affected lines have been processed.

The option :PRESERVE-DIRECTIVES T causes the directive(s) delimiting the affected lines to be copied to the specified or inherited destination, except when both the applicable selector and its parent have :REPLACE or :DISCARD actions.

The value returned by executing PROCESS-TEMPLATE is the string associated with the destination stream, if the action in <SPEC> is :COPY or :TRANSFORM, the <DESTINATION> is NIL or unspecified, and <SOURCE-STREAM-SPEC> does not specify :UPDATE T. Otherwise, the value is NIL.

Package

linewise-template

Source

linewise-template.lisp (file)


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

6.2 Internal definitions


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

6.2.1 Special variables

Special Variable: $dest$
Package

linewise-template

Source

linewise-template.lisp (file)

Special Variable: $file$
Package

linewise-template

Source

linewise-template.lisp (file)

Special Variable: $input$
Package

linewise-template

Source

linewise-template.lisp (file)

Special Variable: $line$
Package

linewise-template

Source

linewise-template.lisp (file)

Special Variable: $residual-line$
Package

linewise-template

Source

linewise-template.lisp (file)

Special Variable: $state$
Package

linewise-template

Source

linewise-template.lisp (file)

Special Variable: $tmp-file$
Package

linewise-template

Source

linewise-template.lisp (file)

Special Variable: *destination*
Package

linewise-template

Source

linewise-template.lisp (file)


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

6.2.2 Macros

Macro: bind-keys-and-suffix SPEC FORM &body BODY
Package

linewise-template

Source

linewise-template.lisp (file)

Macro: cond/bind CLAUSE &rest MORE-CLAUSES
Package

linewise-template

Source

linewise-template.lisp (file)

Macro: def-compiler-var VAR
Package

linewise-template

Source

linewise-template.lisp (file)

Macro: if/bind (VARS COND) SEQ &optional ALT
Package

linewise-template

Source

linewise-template.lisp (file)

Macro: with-input (INPUT-STREAMS &key FILE FILES STRING STRINGS STREAM STREAMS UPDATE BACKUP CIRCUMFIX ESCAPE BASE-PACKAGES) &body BODY
Package

linewise-template

Source

linewise-template.lisp (file)

Macro: with-temp-package &body BODY
Package

linewise-template

Source

linewise-template.lisp (file)

Macro: with-temporary-output (DESTINATION FILE) &body BODY
Package

linewise-template

Source

linewise-template.lisp (file)


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

6.2.3 Functions

Function: after-selector SELECTOR
Package

linewise-template

Source

linewise-template.lisp (file)

Function: atomic-selector SELECTOR
Package

linewise-template

Source

linewise-template.lisp (file)

Function: backup-pathname FILE
Package

linewise-template

Source

linewise-template.lisp (file)

Function: block-selector SELECTOR
Package

linewise-template

Source

linewise-template.lisp (file)

Function: compile-check-end SELECTOR SIBLING-SELECTORS
Package

linewise-template

Source

linewise-template.lisp (file)

Function: compile-check-end-directive SELECTOR SIBLING-SELECTORS
Package

linewise-template

Source

linewise-template.lisp (file)

Function: compile-check-eot SELECTOR
Package

linewise-template

Source

linewise-template.lisp (file)

Function: compile-copy-directive SELECTOR PRESERVE
Package

linewise-template

Source

linewise-template.lisp (file)

Function: compile-directive-handler SUBS SELECTOR COUSIN-SELECTORS
Package

linewise-template

Source

linewise-template.lisp (file)

Function: compile-pop-state &optional INNER
Package

linewise-template

Source

linewise-template.lisp (file)

Function: compile-push-state SELECTOR DESTINATION DEFAULT-DESTINATION
Package

linewise-template

Source

linewise-template.lisp (file)

Function: compile-write-value VALUE
Package

linewise-template

Source

linewise-template.lisp (file)

Function: compile-yield-dest PLACE FN
Package

linewise-template

Source

linewise-template.lisp (file)

Function: count-registers TREE
Package

linewise-template

Source

linewise-template.lisp (file)

Function: directive RE LINE NARGS
Package

linewise-template

Source

linewise-template.lisp (file)

Function: directive-regex BEGIN/END NAMES
Package

linewise-template

Source

linewise-template.lisp (file)

Function: disallow-atomic SELECTOR ACTION
Package

linewise-template

Source

linewise-template.lisp (file)

Function: get-destination STATE
Package

linewise-template

Source

linewise-template.lisp (file)

Function: lambda-list-keyword-p THING &rest ADDITIONAL
Package

linewise-template

Source

linewise-template.lisp (file)

Function: mapcar-to-streams FN SEQUENCE
Package

linewise-template

Source

linewise-template.lisp (file)

Function: name+nargs SELECTOR
Package

linewise-template

Source

linewise-template.lisp (file)

Function: process-atomic INPUT RESIDUAL-LINE STATE &key (BEGIN BEGIN-HANDLER) (END END-HANDLER) &allow-other-keys
Package

linewise-template

Source

linewise-template.lisp (file)

Function: process-lines INPUT PREV-RESIDUAL-LINE STATE &key (BEGIN BEGIN-HANDLER) (END END-HANDLER) (DIRECTIVE DIRECTIVE-HANDLER) (PLAIN PLAIN-LINE-HANDLER)
Package

linewise-template

Source

linewise-template.lisp (file)

Function: read-line* STREAMS
Package

linewise-template

Source

linewise-template.lisp (file)

Function: sans-circumfix LINE
Package

linewise-template

Source

linewise-template.lisp (file)

Function: selector-lambda-list SELECTOR $TRAILER
Package

linewise-template

Source

linewise-template.lisp (file)

Function: symbol= X Y
Package

linewise-template

Source

linewise-template.lisp (file)

Function: update-scanner ()
Package

linewise-template

Source

linewise-template.lisp (file)

Function: validate-destination DESTINATION
Package

linewise-template

Source

linewise-template.lisp (file)

Function: validate-selector SELECTOR
Package

linewise-template

Source

linewise-template.lisp (file)


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

6.2.4 Generic functions

Generic Function: compile-spec SELECTOR SIBLING-SELECTORS ACTION DETAIL
Package

linewise-template

Source

linewise-template.lisp (file)

Methods
Method: compile-spec SELECTOR SIBLING-SELECTORS ACTION DETAIL around
Method: compile-spec SELECTOR SIBLING-SELECTORS (ACTION (eql discard)) DETAIL
Method: compile-spec SELECTOR SIBLING-SELECTORS (ACTION (eql transform)) DETAIL
Method: compile-spec SELECTOR SIBLING-SELECTORS (ACTION (eql replace)) DETAIL
Method: compile-spec SELECTOR SIBLING-SELECTORS (ACTION (eql copy)) DETAIL

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

Appendix A Indexes


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

A.1 Concepts

Jump to:   F   L   M  
Index Entry  Section

F
File, Lisp, linewise-template.asd: The linewise-template<dot>asd file
File, Lisp, linewise-template/src/linewise-template.lisp: The linewise-template/src/linewise-template<dot>lisp file

L
linewise-template.asd: The linewise-template<dot>asd file
linewise-template/src: The linewise-template/src module
linewise-template/src/linewise-template.lisp: The linewise-template/src/linewise-template<dot>lisp file
Lisp File, linewise-template.asd: The linewise-template<dot>asd file
Lisp File, linewise-template/src/linewise-template.lisp: The linewise-template/src/linewise-template<dot>lisp file

M
Module, linewise-template/src: The linewise-template/src module

Jump to:   F   L   M  

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

A.2 Functions

Jump to:   A   B   C   D   F   G   I   L   M   N   P   R   S   U   V   W  
Index Entry  Section

A
after-selector: Internal functions
atomic-selector: Internal functions

B
backup-pathname: Internal functions
bind-keys-and-suffix: Internal macros
block-selector: Internal functions

C
compile-check-end: Internal functions
compile-check-end-directive: Internal functions
compile-check-eot: Internal functions
compile-copy-directive: Internal functions
compile-directive-handler: Internal functions
compile-pop-state: Internal functions
compile-push-state: Internal functions
compile-spec: Internal generic functions
compile-spec: Internal generic functions
compile-spec: Internal generic functions
compile-spec: Internal generic functions
compile-spec: Internal generic functions
compile-spec: Internal generic functions
compile-write-value: Internal functions
compile-yield-dest: Internal functions
cond/bind: Internal macros
count-registers: Internal functions

D
def-compiler-var: Internal macros
directive: Internal functions
directive-regex: Internal functions
disallow-atomic: Internal functions

F
Function, after-selector: Internal functions
Function, atomic-selector: Internal functions
Function, backup-pathname: Internal functions
Function, block-selector: Internal functions
Function, compile-check-end: Internal functions
Function, compile-check-end-directive: Internal functions
Function, compile-check-eot: Internal functions
Function, compile-copy-directive: Internal functions
Function, compile-directive-handler: Internal functions
Function, compile-pop-state: Internal functions
Function, compile-push-state: Internal functions
Function, compile-write-value: Internal functions
Function, compile-yield-dest: Internal functions
Function, count-registers: Internal functions
Function, directive: Internal functions
Function, directive-regex: Internal functions
Function, disallow-atomic: Internal functions
Function, get-destination: Internal functions
Function, lambda-list-keyword-p: Internal functions
Function, mapcar-to-streams: Internal functions
Function, name+nargs: Internal functions
Function, process-atomic: Internal functions
Function, process-lines: Internal functions
Function, read-line*: Internal functions
Function, sans-circumfix: Internal functions
Function, selector-lambda-list: Internal functions
Function, symbol=: Internal functions
Function, update-scanner: Internal functions
Function, validate-destination: Internal functions
Function, validate-selector: Internal functions

G
Generic Function, compile-spec: Internal generic functions
get-destination: Internal functions

I
if/bind: Internal macros

L
lambda-list-keyword-p: Internal functions

M
Macro, bind-keys-and-suffix: Internal macros
Macro, cond/bind: Internal macros
Macro, def-compiler-var: Internal macros
Macro, if/bind: Internal macros
Macro, process-template: Exported macros
Macro, with-input: Internal macros
Macro, with-temp-package: Internal macros
Macro, with-temporary-output: Internal macros
mapcar-to-streams: Internal functions
Method, compile-spec: Internal generic functions
Method, compile-spec: Internal generic functions
Method, compile-spec: Internal generic functions
Method, compile-spec: Internal generic functions
Method, compile-spec: Internal generic functions

N
name+nargs: Internal functions

P
process-atomic: Internal functions
process-lines: Internal functions
process-template: Exported macros

R
read-line*: Internal functions

S
sans-circumfix: Internal functions
selector-lambda-list: Internal functions
symbol=: Internal functions

U
update-scanner: Internal functions

V
validate-destination: Internal functions
validate-selector: Internal functions

W
with-input: Internal macros
with-temp-package: Internal macros
with-temporary-output: Internal macros

Jump to:   A   B   C   D   F   G   I   L   M   N   P   R   S   U   V   W  

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

A.3 Variables

Jump to:   $   *  
S  
Index Entry  Section

$
$dest$: Internal special variables
$file$: Internal special variables
$input$: Internal special variables
$line$: Internal special variables
$residual-line$: Internal special variables
$state$: Internal special variables
$tmp-file$: Internal special variables

*
*backup-pathname-suffix*: Exported special variables
*destination*: Internal special variables
*directive-base-packages*: Exported special variables
*directive-circumfix*: Exported special variables
*directive-escape*: Exported special variables
*source-line-count*: Exported special variables
*source-stream*: Exported special variables

S
Special Variable, $dest$: Internal special variables
Special Variable, $file$: Internal special variables
Special Variable, $input$: Internal special variables
Special Variable, $line$: Internal special variables
Special Variable, $residual-line$: Internal special variables
Special Variable, $state$: Internal special variables
Special Variable, $tmp-file$: Internal special variables
Special Variable, *backup-pathname-suffix*: Exported special variables
Special Variable, *destination*: Internal special variables
Special Variable, *directive-base-packages*: Exported special variables
Special Variable, *directive-circumfix*: Exported special variables
Special Variable, *directive-escape*: Exported special variables
Special Variable, *source-line-count*: Exported special variables
Special Variable, *source-stream*: Exported special variables

Jump to:   $   *  
S  

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

A.4 Data types

Jump to:   L   P   S  
Index Entry  Section

L
linewise-template: The linewise-template system
linewise-template: The linewise-template package
linewise-template-system: The linewise-template-system package

P
Package, linewise-template: The linewise-template package
Package, linewise-template-system: The linewise-template-system package

S
System, linewise-template: The linewise-template system

Jump to:   L   P   S