Productions and token

Top  Previous  Next

Examples > E-mail address > Productions and token

 

Fortunately the syntax of the specification is very similar to the syntax of the TextTransformer. The elements can be transformed easily into productions and tokens. Because hyphens are not allowed in script names of the TextTransformer, they are transformed to underscores. Single characters are enclosed in double quotes. Elements, which consist in single characters or character classes, become tokens. Their names are written in upper case to separate them more clearly from the productions.

 

 

 

Produktion

Definition

1

mailbox

addr-spez | phrase route_addr

2

addr_spec

local_part "@" domain

3

phrase

( word )+

4

route_addr

< ( route )? addr_spez >

5

local_part

word ("." word)*

6

domain

sub_domain ("." sub_domain )*

7

word

ATOM | quoted_string

8

route

"@" domain ("," "@" domain )* :

9

sub_domain

domain_ref | domain_literal

11

quoted_string

"\"" ( QTEXT | QUOTED_PAIR )* "\""

12

domain_ref

ATOM

13

domain_literal

( DTEXT | QUOTED_PAIR )*

 

 

 

Token

Definition

10

ATOM

[^()<>@,;:\\"\.\[\]\x{00}-\x{20}\x{7f}]+

14

CHAR

[\x00-\x7F]

17

CR

\r

18

SPECIALS

[()<>@,;:\\"\.\[\]]

19

QTEXT

[^*\\\r\x80-\xFF]

20

DTEXT

[^\[\]\\\r\x80-\xFF]

21

QUOTED_PAIR

\\[\x00-\x7F]

 

 

 

23

CTEXT

[^()\\\r\x80-\xFF]

 

 

The comment production is set in the project options as an inclusion. So, in front of every new token is tested automatically, whether there might be an included comment. Such comments can be nested unlike the use of regular expressions to the comment recognition.

 

 

The complete project is in:

 

\TextTransformer\Examples\Mailbox\mailbox1.ttp

 

 



This page belongs to the TextTransformer Documentation

Home  Content  German