Action Tags

Backus-Naur Form (BNF)

The following is a complete Backus-Naur Form (BNF) definition of the Action Tags language.

Templates

A template is a file and is treated as a single block. A block is text with tags mixed within it. A block does not need to contain any text (i.e., <text> can be the empty string) or tags (i.e., a template can contain just text). A block can be printed to a file, emailed or even erased from the template after it is processed.

<template> ::= <block>

<block> ::= <interpreted text>

<interpreted text> ::= <interpreted element> | <interpreted text><interpreted element>

<interpreted element> ::= <text> | <tag>

Tags

There are six types of tags. Output tags display name values (i.e., are replaced by their values) in the template. Name values usually come from the input form name value pairs or from a record in the table of a database. Assignment tags allow you to assign new values to names. Block tags allow you to conditionally process blocks. While tags allow you to repeat a block until some condition is reached. For tags allow you to loop using an iteration variable. Foreach tags allow you to repeat a block for each record of a record set. Remote tags allow you to execute a block on a remote server.

<tag> ::= <statement tag> | <block tag>
       | <while tag> | <for tag> | <foreach tag>
       | <remote tag>

Statement Tag

<statement tag> ::= {% <statement set> }

<statement set> ::= <statement> | <statement set> ; <statement>

<statement> ::= <expression> | <assignment>

<assignment> ::= <variable> <assignment operator> <expression>

Block Tag

<block tag> ::= {% <conditional block>* <unconditional block> }

<conditional block> ::= ( <expression> } <block> {% )

<unconditional block> ::= ( } <block> {% )

While Tag

<while tag> ::= {% * <conditional block> }

For Tag

<for tag> ::= {% * <for conditional block> }

<for conditional block> ::= ( <assignment> ; <expression>  ; <assignment>} <block> {% )

Foreach Tag

<foreach tag> ::= {% * <identifier> <unconditional block> }

Remote Tag
URL specifies the address of the remote action tags processor.

<remote tag> ::= {% ^ <URL> <unconditional block> }

<URL> ::= <text>

Variables

Variables are used to access form input names, database records and text files. Variables can store temporary values within the template.

<variable> ::= <identifier>
             | <identifier> [ <expression> ]
             | <identifier> . <identifier>
             | <identifier> [ <expression> ] . <identifier>
             | <identifier> [ <expression> ] [ <expression> ]

<identifier> ::= <word character>+

<word character> ::= a .. z | A .. Z | 0 .. 9 | _

Expressions

Expressions are used assign variables new values and to determine whether a conditional block will be executed. The hierarchy of operators is the same as Perl and JavaScript (for those operators implemented). Note that variables within expressions must appear in tag form.

<assignment operator> ::= = | += | -= | .=

<expression> ::= <and expression>
               | <expression> || <and expression>

<and expression> ::= <equality expression>
                   | <and expression> && <equality expression>

<equality expression> ::= <greater expression>
                        | <equality expression> <equality operator> <greater expression>

<equality operator> ::= == | != | <> | eq | ne

<greater expression> ::= <simple expression>
                       | <greater expression> <greater operator> <simple expression>

<greater operator> ::= <= | >= | lt | gt | le | ge | < | >

<simple expression> ::= <term>
                      | <simple expression> <simple operator> <term>

<simple operator> ::= + | - | .

<term> ::= <factor> | <term> <term operator> <factor>

<term operator> ::= * | / | %

<factor> ::= <constant> | ( <expression> ) | <variable>
           | <function name> ( <expression list> )
           | <factor prefix> <factor>

<constant> ::= <number> | <string constant> | "<interpreted text>"

<function name> ::= appendtable | colname | colnum | count | ct
                  | date | delete | escape | exists | filelist
                  | getcookie | htpasswd | httpget | httppost | index
                  | int | interpret | lc | length | macro
                  | myd | mydt | myt | ncf | newrecset
                  | print | quotemeta | rand | read | recindex
                  | recset | rept | resequence | rindex | rmdir
                  | setcol | setcookie | sort | sprintf | sql
                  | sqlf | stat | subfield | substitute | substr
                  | ta | tabletotext | tabtext | texttotable | trim
                  | uc | unescape | unlink | ut | var
                  | wtabtext

<expression list> ::= <expression> | <expression list> , <expression>

<factor prefix> ::= ! | + | -

<string constant> ::= '<text>' | q^<text>^

<text> ::= <any character except specified terminator>*

<number> ::= <digit>+ | <digit>*.<digit>+

<digit> ::= 0 .. 9

Note that tags within an assignment statement or expression can be used to specify all or part of a variable identifier. Note also that comparison conditional expressions can have more than two terms. For example, 5 <= A && A <= 15 can be written 5 <= A <= 15

 

 

| Home |


July 19, 2003

System resources to generate this page:
1: READ FILE A: /home/action/public_html/_global.shtml (0s)
19: READ FILE A: /home/action/adocs/docs/bnf.shtml (0s)
6: READ FILE A: /home/action/adocs/docs/inc_header.html (0s)
134: SQL SELECT (FNC): DBI:mysql:action_database:localhost (0s)
160: READ FILE A: /home/action/adocs/docs/inc_trailer.html (1s)