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. As 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

[^()<>@,;:\\"\.\[\][:space:][:cntrl:]]+

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]

 

 

space and comment are combined to the ignorable characters and set in the project options. Though the possible nesting of comments cannot be reproduced. In the created C++-code the virtual function IgnoreChars can be overwritten.

 

 

IGNORE        

(\s \// spaces

|\([^)]*\))+ // block comment

 

 

The complete project is in:

 

\TextTransformer\Examples\Mailbox\mailbox1.ttp

 

 



This page belongs to the TextTransformer Documentation

Home  Content  German