* lex.el (lex-gen-ccel-unibyte-automata-state): Jump start of loop
[elisp/flim.git] / ew-parse.scm
1 (define field-grammar
2 '(
3 ; Terminal symbols
4 *anchor*
5 *err*
6
7 tag-mailbox
8 tag-mailbox*
9 tag-mailbox+
10 tag-address*
11 tag-address+
12 tag-phrase*
13 tag-phrase-msg-id*
14
15 ;; S : STD11 structured field
16 ;; M : MIME structured field
17 ;; U : Unstructured field
18
19 lt              ; S/M
20 gt              ; S/M
21 at              ; S/M
22 comma           ; S/M
23 semicolon       ; S/M
24 colon           ; S/M
25
26 dot             ; S
27 atom            ; S
28
29 slash           ; M
30 question        ; M
31 equal           ; M
32 token           ; M
33
34 qs-begin        ; S/M
35 qs-end          ; S/M
36 qs-texts        ; S/M
37 qs-wsp          ; S/M
38 qs-fold         ; S/M
39 qs-qfold        ; S/M
40 qs-qpair        ; S/M
41
42 dl-begin        ; S/M
43 dl-end          ; S/M
44 dl-texts        ; S/M
45 dl-wsp          ; S/M
46 dl-fold         ; S/M
47 dl-qfold        ; S/M
48 dl-qpair        ; S/M
49
50 cm-begin        ; S/M
51 cm-end          ; S/M
52 cm-nested-begin ; S/M
53 cm-nested-end   ; S/M
54 cm-texts        ; S/M
55 cm-wsp          ; S/M
56 cm-fold         ; S/M
57 cm-qfold        ; S/M
58 cm-qpair        ; S/M
59
60 wsp             ; S/M
61 fold            ; S/M
62
63 us-texts        ; U
64 us-wsp          ; U
65 us-fold         ; U
66
67 ; Productions
68 (start (tag-mailbox gap mailbox)                  : ()
69   (tag-mailbox* gap mailbox*)                     : ()
70   (tag-mailbox+ gap mailbox+)                     : ()
71   (tag-address* gap address*)                     : ()
72   (tag-address+ gap address+)                     : ()
73   (tag-phrase* gap phrase*)                       : ()
74   (tag-phrase-msg-id* gap phrase-msg-id*)         : ())
75 (address* ()                                      : ()
76   (address+)                                      : ())
77 (address+ (address)                               : ()
78   (address+ comma-gap address)                    : ())
79 (address (mailbox)                                : ()
80   (group)                                         : ())
81 (addr-spec (local-part at-gap domain)             : ())
82 (date (atom-gap atom-gap atom-gap)                : ())
83 (date-time (atom-gap comma-gap date time)         : ()
84   (date time)                                     : ())
85 (domain (sub-domain)                              : ()
86   (domain dot-gap sub-domain)                     : ())
87 (domain-ref (atom-gap)                            : ())
88 (group (phrase colon-gap mailbox* semicolon-gap)  : ())
89 (hour (atom-gap colon-gap atom-gap)               : ()
90   (atom-gap colon-gap atom-gap colon-gap atom-gap): ())
91 (local-part (word)                                : ()
92   (local-part dot-gap word)                       : ())
93 (mailbox (addr-spec)                              : ()
94   (phrase route-addr)                             : ()
95   (route-addr)                                    : ())
96 (mailbox* ()                                      : ()
97   (mailbox+)                                      : ())
98 (mailbox+ (mailbox)                               : ()
99   (mailbox+ comma-gap mailbox)                    : ())
100 (month (atom-gap)                                 : ())
101 (msg-id (lt-gap addr-spec gt-gap)                 : ())
102 (phrase (phrase-c)                                : (ew-mark-phrase $1 $look))
103 (phrase-c (word)                                  : $1
104   (phrase-c word)                                 : $1)
105 (route (at-domain+ colon-gap)                     : ())
106 (at-domain+ (at-gap domain)                       : ()
107   (at-domain+ comma-gap at-gap domain)            : ())
108 (route-addr (lt-gap route/ addr-spec gt-gap)      : ())
109 (route/ ()                                        : ()
110   (route)                                         : ())
111 (sub-domain (domain-ref)                          : ()
112   (domain-literal-gap)                            : ())
113 (time (hour zone)                                 : ())
114 (word (atom-gap)                                  : $1
115   (quoted-string-gap)                             : $1)
116 (zone (atom-gap)                                  : ())
117 (phrase/ ()                                       : ()
118   (phrase)                                        : ())
119 (phrase* ()                                       : ()
120   (phrase+)                                       : ())
121 (phrase+ (phrase)                                 : ()
122   (phrase+ comma-gap phrase)                      : ())
123 (phrase-msg-id* (phrase/)                         : ()
124   (phrase-msg-id* msg-id phrase/)                 : ())
125 (word1or2 (word)                                  : ()
126   (word comma-gap word)                           : ())
127 (gap ()                                           : ()
128   (gap wsp)                                       : ()
129   (gap fold)                                      : ()
130   (gap comment)                                   : ())
131 (lt-gap (lt gap)                                  : ())
132 (gt-gap (gt gap)                                  : ())
133 (at-gap (at gap)                                  : ())
134 (comma-gap (comma gap)                            : ())
135 (semicolon-gap (semicolon gap)                    : ())
136 (colon-gap (colon gap)                            : ())
137 (dot-gap (dot gap)                                : ())
138 (quoted-string-gap (quoted-string gap)            : $1)
139 (domain-literal-gap (domain-literal gap)          : ())
140 (atom-gap (atom gap)                              : $1)
141 (quoted-string (qs-begin qs qs-end)               : $1)
142 (qs ()                                            : ()
143   (qs qs-texts)                                   : ()
144   (qs qs-wsp)                                     : ()
145   (qs qs-fold)                                    : ()
146   (qs qs-qfold)                                   : ()
147   (qs qs-qpair)                                   : ())
148 (domain-literal (dl-begin dl dl-end)              : ())
149 (dl ()                                            : ()
150   (dl dl-texts)                                   : ()
151   (dl dl-wsp)                                     : ()
152   (dl dl-fold)                                    : ()
153   (dl dl-qfold)                                   : ()
154   (dl dl-qpair)                                   : ())
155 (comment (cm-begin cm cm-end)                     : ())
156 (cm ()                                            : ()
157   (cm cm-nested-begin)                            : ()
158   (cm cm-nested-end)                              : ()
159   (cm cm-texts)                                   : ()
160   (cm cm-wsp)                                     : ()
161   (cm cm-fold)                                    : ()
162   (cm cm-qfold)                                   : ()
163   (cm cm-qpair)                                   : ())
164
165 ))
166
167 (gen-lalr1 field-grammar "ew-parse.el"
168 "(provide 'ew-parse)
169 (require 'ew-data)
170 "
171 "(put 'ew:cm-texts 'decode 'ew-decode-comment)
172 (put 'ew:cm-wsp 'decode 'ew-decode-comment)
173 (put 'ew:cm-fold 'decode 'ew-decode-comment)
174 (put 'ew:cm-qfold 'decode 'ew-decode-comment)
175 (put 'ew:cm-qpair 'decode 'ew-decode-comment)
176 (put 'ew:us-texts 'decode 'ew-decode-unstructured)
177 (put 'ew:us-wsp 'decode 'ew-decode-unstructured)
178 (put 'ew:us-fold 'decode 'ew-decode-unstructured)
179 "
180 'ew)
181
182 (print-states)