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