-
Notifications
You must be signed in to change notification settings - Fork 0
/
postal.rl~
45 lines (43 loc) · 1.17 KB
/
postal.rl~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Generated by abnfgen at Fri Mar 19 11:48:35 2010
# Output file: postal.rl
# Sources:
# core
# postal.abnf
%%{
# write your name
machine generated_from_abnf;
# generated rules, define required actions
ALPHA = 0x41..0x5a | 0x61..0x7a;
BIT = "0" | "1";
CHAR = 0x01..0x7f;
CR = "\r";
LF = "\n";
CRLF = CR LF;
CTL = 0x00..0x1f | 0x7f;
DIGIT = 0x30..0x39;
DQUOTE = "\"";
HEXDIG = DIGIT | "A"i | "B"i | "C"i | "D"i | "E"i | "F"i;
HTAB = "\t";
SP = " ";
WSP = SP | HTAB;
LWSP = ( WSP | ( CRLF WSP ) )*;
OCTET = 0x00..0xff;
VCHAR = 0x21..0x7e;
first_name = ALPHA*;
initial = ALPHA;
personal_part = first_name | ( initial "." );
last_name = ALPHA*;
suffix = ( "Jr."i | "Sr."i | ( "I"i | "V"i | "X"i )+ );
name_part = ( ( personal_part SP )* last_name ( SP suffix )? CRLF ) | ( personal_part CRLF );
apt = DIGIT{1,4};
house_num = ( DIGIT | ALPHA ){1,8};
street_name = VCHAR+;
street = ( apt SP )? house_num SP street_name CRLF;
town_name = ( ALPHA | SP )+;
state = ALPHA{2};
zip_code = DIGIT{5} ( "-" DIGIT{4} )?;
zip_part = town_name "," SP state SP{1,2} zip_code CRLF;
postal_address = name_part street zip_part;
# instantiate machine rules
main:= postal_address;
}%%