-
Notifications
You must be signed in to change notification settings - Fork 2
/
todo
535 lines (420 loc) ยท 22.6 KB
/
todo
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
**************************
* ๆฌกใซใใใใจ *
**************************
* Parser.papillon ใฎใชใใกใฏใฟใชใณใฐ
ใพใใฏ module ใฎ export list ใใกใใใจ parse ใใฆใฟใใใใชใ
ไปฅไธๅ็
ง
import Hoge.Hage(Some(..), hage)
ใใกใใใจใใผในใใ[Import] ใจใใใใใใ Text.Papillon ใๆถใใใใซใใ
import list ใฎ่ฆ็ด ใฏไปฅไธใฎใใใซใชใใจๆใ
name, Name, Name(Name, name), Name(..), (+++)
ใพใจใใใจ
var / typ "(" names? ")" / "(" op ")"
names = (var / typ) (, (var / typ))*
ไธ่จใงๅ
จใฆใฎใใฟใผใณใ็ถฒ็พ
ใใฆใใใ ใใใ?
ใพใ import ่ชไฝใซใไปฅไธใฎใใฟใผใณใใใใ ใใ
import Hage.Hoge
import Hage.Hoge(...)
import Hage.Hoge hiding (...)
import qualified Hage.Hoge
import qualified Hage.Hoge as H
import "package-name" Hoge.Hoge
ใพใจใใใจไปฅไธใฎๆใใใ
"import" strLit? "qualified"? name ("as" name)? "hiding"?
importList?
* hscodelines ใ -rtsopts ใใคใใฆ compile ใใใใใซใใฆใฟใใใใช
* 'c'+ ใใใๆกๅผตใใ
Char ไปฅๅคใฎ token ใงใไฝฟใใใใใซใใใใ
ใคใพใ [Pat]+ ใจใใๆใใซใใใฐ่ฏใใจๆใ
* ('\n' / '\t') ใจใงใใใใใซใใ
* import Text.Papillon ใๆถใใใใ ใ
ไปใฏๅ็ดใช import ๆใใๆถใใชใ
ใกใใใจๆถใใใจๆใฃใใ import ๆใใกใใใจ parse ใใชใใกใใชใใชใ
* { ... } ใ [ ... ] ็ญใฎใชใใง do ใไฝฟใใใ่ฉฆใใใจ
ใพใใฏใdo { ...; ...; ... } ใ่ฉฆใใ็ฉบ (ใคใพใ ;;) ใ่จฑใใ
ใใฎๅพๅฟ
่ฆใใใชใใใใใใฏๆ้ใใใใฐใใใใใฏใใใฎใใกใ
offside rule ใไฝฟใใใใใซใใใ
* { ... } ใ [ ... ] ๅ
ใงใฎ case ใ if
ใจใใซ case ใฎ offside rule ใใใใฉใใใใใ
* { ... } ใ [ ... ] ๅ
ใงใฎ let ... in ...
* homepage ใซ example ใใฎใใ
ใฏใใใฏ็ฐกๅใชไพใใๅพใ
ใซ้ฃใใไพใธใจ
* simple ใช example source file ใไฝๆใใ
* cabal ใฎ description ใใใใใใใพใใซใใ
**************************
* parser ใฎ่กจ่จ/ๆฉ่ฝ้ขไฟ *
**************************
* \n ใ \t ใจ stringE ใฎ้ขไฟใซใคใใฆ่ชฟในใ
ppr ใฎๅ้กใชใฎใใใใใชใ
* escapeC ใซใคใใฆ
\n, \t ไปฅๅคใฎ็นๆฎๆๅญใซใคใใฆใ่ๆ
ฎใใ
* ้็ต็ซฏ่จๅทใซๅคงๆๅญใงๅงใพใใใฎใ่จฑใใใใซใใใใใช
ใใใฏ prefix ใใคใใใใจใงๅฏ่ฝใจๆใใใ
camel, snake, raw ใฎๆๅฎใจใใใใฆ
* ๅผใ็ฎใใงใใใใใซใใ
ไปใฎไปๆงใ ใจ n - s ใ n (negate s) ใซใชใฃใฆใใพใ
* '(' ใฎใใจใซ space ใ่จฑใ
* some <- hage / boke; ใฎใใใช่กจ่จใง U+2190 ใไฝฟใใใใใซใใใใใช(้ข็ฝใใใ)
* str :: Either (String, String) (Either (String, String) ()) ใใใผในใจใฉใผใซใชใ
ไธ่จใ่งฃๆฑบใใใใจ
* offside rule
do ใซ้ขใใใใฎ
case ใซ้ขใใใใฎ
ไปใซๅฟ
่ฆใชใจใใใฏใใใใช?
* op ใฎๅๅพใซ space ใ่จฑใ
* [] ใฎๅ
ๅดใซ space ใ่จฑใ
* parse error ใใคใใพใใ่กจ่จใใคใใใ
ใใจใใฐใ_:parseError ใจใใใจ parse error ใ match ใใใใใชๆใ
catchError ใไฝฟใฃใฆใงใใใใชๆฐใใใใ ...
ใใใใฏ monad ใฎๅ
ๅดใใใใใจใ
็ก็ใใใชใใใใใใฉใ
ใพใใฏ token ใ Maybe token ใซๆกๅผตใใใ
ใใใฆใerror ใ็ใใๅ ดๆใซ Nothing ใๅ
ฅใใใ
ใใใฆใใใใ catch ใงใใใใใซใใใ
ใใ ใใใใใใจ error message ใใใใใฅใใใชใใชใ
monad ใฎๅ
ๅดใใใใใใใใใใใใฎใใชใ
* ไธใงใใใใใใจใฏใ
let x = 3 in x ใงใ'in' ใ็ใใ้ใซ error ใ่ตทใใใ
ใใฎ error ใ '}' ใจ่งฃ้ใใใใใชใจใใซๅฟ
่ฆใ ใ
ใใใฏๅฅใฎใใใใใงใงใใใ ใใใ?
LALR(1) ใงใฏใชใ PEG ใชใใฐๅฅใซๅ้กใชใๆฐใใใใ
let { x = 3 } in x
็ก่ชญๅ
่ชญใฟใๅฏ่ฝใชใฎใงใไปฅไธใงใงใใใใใซๆใ
defs = def defs /
letExp = "let" defs "in" exp
ใงๆฎ้ใซใงใใๆฐใใใใ ...
* !hoge ใฎใใใซใใใจ error ใจใชใใ
* ('c' / 'd') ใซใคใใฆ
ใใใฏไพฟๅฉใงใฏใใใใพใใใใใใใใใ
่ใใๅฟ
่ฆใใใใ
* class SourceList ใซใคใใฆ
ใใจใใฐๅๅใ class Token ใซใใใ
ใใใฆใlistToken ใ่ชๅใงๅฎ็พฉใใใใจใ่ใใใ
* source [Token] ใฎใใใช่กจ่จใๅบๆฅใใใใซใใ
* !x:[True] ใๅใใใจใ็ขบ่ชใใ
* monad, source, prefix ใ้ ไธๅใจใใ
* Foo.Bar.Baz ใ Hoge.Fuga.piyo ใๆฑใใใใใซใใ
lex ใฌใใซใงใฏใใงใซๅฏพๅฟใใฆใใใฎใงใใใจใฏใ
mkName (concatMap (++ ".") m ++ t)
mkName (concatMap (++ ".") m ++ v)
ใฎใใใซใใใฐ่ฏใใ ใใ ใ
* '\xab' "\123\12345" ใฎใใใช่กจ่จใๅฏ่ฝใซใใใ
* floating literal ใไฝฟใใใใใซใใ
ใใฎไป literal ใๅขใใ
**************************
* warning ้ขไฟ *
**************************
* `Pattern matches are overlapped' warning ใไฝใจใใใ
reify ใไฝฟใใPat -> Q (Pat, Bool) ใจใใใ
IO ๅ
ใงใฏ reify ใไฝฟใใชใใฎใงใth :: Bool ใๅฟ
่ฆใซใชใใ
ใจใใใจใmonad: Reader Bool ใจใใๅฟ
่ฆใใใใ
ใใใ branch ใๅใฃใใปใใ่ฏใ
ใใใ Parser.hs ใงไฝฟใใชใใฎใงใฉใใใในใใ่ใใๅฟ
่ฆใใใใ
* Control.Monad.Error ใ้่คใใชใใใใซใใ
ใใใใใๅใ module ใ import ใใชใใใใซใใใใจใ
import ใใๅคๆฐใใฉใใชใฃใฆใใใใใใใใชใใจใใฃใใใใใฉใใใใ
import ๆใใกใใใจ parsing ใใๅฟ
่ฆใใใใใใฉใฎ cost-performance ใ
่ใใๅฟ
่ฆใใใ(ไธปใซ code ใฎ่ค้ๅใซใคใใฆ)
**************************
* ใจใฉใผใกใใปใผใธ้ขไฟ *
**************************
* ParseError ใ่กจ็คบใใ้ขๆฐใ TH ใงไฝๆใงใใชใใ่ใใ
ๅ้กใฏใในใฆใฎๅใ Show ใงใใใใใงใฏใชใใจใใใจใใใ ใ
ใในใฆใฎๅใ Show ใงใใๅ ดๅใซใฎใฟไฝฟใใ้ขๆฐใ TH ใงไฝใฃใฆใใใใ ...
ใใใใซใใฆใใใใใใจ่ๅฏใใใใจ
* peMessage ใงๅ
ฅๆใงใใ message ใซใคใใฆ
ใใฃใจใกใใใจใใ่ฑ่ชใซใงใใใ ใใใ
* ParseError ใฎใใใใใฎ้
็ฎใๅ
ฅๆใใ้ขๆฐใฎๅๅใซใคใใฆ่ฆ็ดใ
cabal haddock ใใใฆใใใใใใ็ขบ่ชใใพใใไธฆใณ้ ใซใคใใฆใ
* showReading ใใณใผใ็ๆใงใใใใช
Show a => ใซใคใใฆใชใใงใใใใชๆฐใใใใใฉ ...
ใงใใๅ
จ้จใ Show a ใงใใใใจใ็ขบ่ชใใใฎใ็ก็ใใช?
็ก็ใใ
* showParseErrorS ใไฝใฃใฆใใใใใช?
ใใ ใdefault ใช่ฑ่ชใฎใกใใปใผใธใ็จๆใใใใจใซใฏๆตๆใใใใช
็ก็ใใ
**************************
* ใชใใกใฏใฟใชใณใฐ้ขไฟ *
**************************
* "char" ใๆฑบใๆใกใซใใฆใใใใๅคๆฐใง็ฝฎใใใใซใใ
* PapillonCore ใซใคใใฆ
ๅใๅผๆฐ็พคใๅคใใฎ้ขๆฐใงๅผใๅใใฆใใ
ใพใใใใใใฎๅผๆฐใฎๅคใใฏไธๅบฆๅคใๆฑบใพใใจๅคใใใชใ
ใฒใจใคใฎๅใใพใใฏใฟใใซใซใพใจใใฆใReaderT ใไฝฟใฃใใใฉใใ
* plain style ใใฉใใใใ
ๅ
จ้จๆถใใฆใใพใใจใใใฎใใฒใจใคใฎๆใ ใ
ใใพใไฝฟใ้ใ็กใใใใชๆฐใใใใ
* ้ขๆฐ็ญใฎๅๅใซใคใใฆ
ใคใใใใฎใๆๅฎใงใใใใใซใใ
ๆๅฎใใชใใใฐไฝใใคใใชใใจใใๆใ
ๆๅฎใใใใฐใใใใใฎๅๅใซใใใใคใ
ใพใ parse ใซใใใใใคใใฆใใพใใ
ใใใจ่กใ่กใใฏ camel case ็จใฎใชใใทใงใณใใคใใฆใ
myParse ใจใใใใใใตใใซใงใใใใใซใใใใ
่ชๅใงไธ็ชๅ
้ ญใๅคงๆๅญใซใใใ
ๅ
้ ญใฎ case ใ ใ้ใใใฎใซใคใใฆใฏใจใใใใใฏ่ชๅทฑ่ฒฌไปปใงใ
camel, snake, none ใใ้ธในใใใใซใใใฃใฆใฎใฏใใใ ใชใ
derivsChars ใจ derivsPosition ใฏ
ๅ
ใ
ใงใฏ camel, snake, none ใฎๅคใซใใฃใฆๅคใใใใจใซใใใใใช
derivs_chars ใจ derivs_position, derivschars ใจ derivsposition ใฎใใใซ
Derivs ใๅๆงใซใใใใใ ใ prefix ใฎไธๆๅญ็ฎใๅคงๆๅญๅใใ
ParseError ใฎใใฃใผใซใๅ
peCode, peMessage, peComment, peReadings, peDerivs, pePosition ใซใคใใฆ
snake ใ raw ใฎใจใใซใฏใใใใใ
pe_code, pe_message, pe_comment, pe_readings, pe_derivs, pe_position
pecode, pemessage, pecomment, pereadings, pederivs, peposition ใฎ
ใใใซใใ
ใพใ prefix ใใใกใใใคใใใใจใซใชใใ ใใ
* papillon command ใฏไฝใๅใใชใใใฐ filter ใจใใใ
ใพใใpapillon [Input] ใ papillon [Input] -o [Output] ใฎๅฝขใไฝฟใใ
ใใฎใใกใซ papillon -h ใ papillon --help ใใ
ใใไฝฟใใใใ GetOpt ใไฝฟใฃใฆใฟใใฎใใใใใใใใชใใ
* Text/Papillon/Parser.hs ใ git ใใๅคใ
ใใใฏ papillon ่ชไฝใใใ็จๅบฆๅฎๅฎใใฆใใใใจใชใใ ใใใ
* Parser.peg ใ token ใไฝฟใฃใฆๆธใ็ดใ
* ParseError ใฎๅใใฉใใใใ
ใงใใใๅใๅ
ฌ้ใใชใใฆใใใใใใชๅฝขใซใใใใ
ใคใพใใๅใฎๆง็ฏๅญใจ reader ใ ใใๅ
ฌ้ใใใจใใๅฝขใซใใใ
* data ParseError ใฎๅๆง็ฏๅญใๅ
ฌ้ใใชใใใใซใใ
data ParseError = ParseError ... ใ TH ใงๆธใใ
ใใใฏ Papillon.hs ใซใฏใใคใใใฎใจใใณใผใใฎๅคๆๆใซ่ฟฝๅ ใใใฎใจใงไฝฟใใ
ใใใฆ Papillon.hs ใใใฏ ParseError ใฏ ParseError(..) ใจใฏใใชใ
ไฝใใจใใฏ makeParseError ใไฝฟใใ
ใใใใใฎ field ใๅ
ฅๅใใใจใใๅฐ็จใฎ้ขๆฐใไฝฟใ
ใจใใใใใฏใใฃใผใซใๅใไฝฟใฃใฆใใใฐ่ฏใใจๆใ
* ไธ่จใฏไปใฎไฝใใ ใจๅฎ่กใงใใชใ
ใคใพใใParseError ใฏ Main ใงๅฎ็พฉใใใฆใใใฎใงใขใฏใปในๅถ้ใใงใใชใ
mkParseError ใไฝใใใใใไฝฟใใจใใใฎใฏๆชใ ใซใใ่ใใ ใใ
ไธ่จใใงใใชใใจใใใใจใง้ญ
ๅใฏๅๆธใใ
* ParseError ใฏ th ใ True ใฎใจใใซใฏใPapillon ใใใฎ export ใงใใใใ...
ไปใฎใพใพใงใใใใใใฉใฃใกใฎใปใใใใใใช
* ไปใฏ Main ๅ
ใงใฎใฟไฝฟใฃใฆใใใใใใไปฅๅคใฎ module ใงไฝฟใฃใใจใใซใ
ๆชไฝฟ็จใฎ warning ใๅบใใจๆใ
ใใใซๅฏพๅฆใใใใจ
pePositionS
ไปใฎ pe... ใใใใ ใใmodule ๅ
ใงไฝฟใใชใๅ ดๅใซ warning ใๅบใฆใใพใ
ใใจใง่ใใใ
* papillonStr ใซใคใใฆ
้ขๆฐๅใซใคใใฆ่ใใ
ใพใใByteString ใ Text ใๆฑใใใฉใใใซใคใใฆใ่ใใใใจ
ใใใ Papillon ใใ export ใใๅฟ
่ฆใฏใชใใฎใใใใใชใ
ใจใใใจใmodule ๆง้ ใๅคใใๅฟ
่ฆใใใใช
* ๅใง่กจ้ใใใชใใใใใใชๅถ้ใซใคใใฆ
ๅฎ้ใฎใจใใใใงใใใ ใใใใใใชใๅใฎๅคใ็กใใใใซใใใปใใ่ฏใใฎใ
ใใใใใใจใใฐ Maybe Char ใไฝฟใใใใ [Char] ใไฝฟใฃใใปใใใ
ๅพใ
ใ++ ใงใคใชใใใฎใๆฅฝใจใใฃใไพๅคใใใใ
ใใใใธใใฎใใฌใผใใชใใซใคใใฆใ่ใใๅฟ
่ฆใใใใ
ไปๅใฎๅ ดๅใฏไพใใฐ {} ใฎใใใใฎใจ็กใใใฎใใพใใใใชใใใจใใ
{} ใฎใใใใฎใฎ Definition ใฏ Maybe TypeQ ใ Nothing ใซๅบๆฅใชใใใจ็ญ
ใใใใ
* SyntaxTree ใฎใชใใกใฏใฟใชใณใฐ
Definition ใฎ Maybe TypeQ ใ Nothing ใซใชใใฎใฏ PlainSelection ใฎใจใใฎใฟ
ใใฃใฆใPlainSelection ใจ Selection ใจใๅใใฆใ
Definition ใฎใจใใใงใพใจใใฆใใใใใ
ใใใใSelection ใฏ ReadFrom ใฎ FromSelection ใงไฝฟใใใฆใใใฎใงใ
ๅใใชใใปใใ่ฏใใจ่ใใใใจใใงใใใ
ใฉใใใใใ
* Traversable ใฎ sequence ใไฝฟใใใจใใใใใ
definitionQ ใฎ fromMaybe ใไฝฟใฃใฆใใใจใใ
* ็ๆใใใใณใผใใใใฃใจใใฃใใใใใใใใใฉใใ่ใใ
ไปใฏใ
somexx_xx = runStateT someyy_yy d
someyy_yy = do ...
ใฎใใใชๆใใ ใใใใใ
somexx_xx = flip runStateT d $ do ...
ใฎใใใชๆใใซใใฆใใพใฃใใใฉใใ ใใใ
ใใ ใใใใใใจใณใผใใฎใในใใๆทฑใใชใฃใฆ่ฆใซใใใชใใจใใใใจใใใ
ไปใฎใพใพใฎใปใใ่ฏใใฎใใใใใชใ
* PapillonCore ใฎใชใใกใฏใฟใชใณใฐ
check ใฎใชใใกใฏใฟใชใณใฐ
Just (p, pc) ใจ Nothing ใฎๅๅ้จๅใฏ็ตฑๅใงใใใ ใใ
ใคใพใ้ขๆฐใฎ้ ญใง match ใใใใซ case ๆใไฝฟใใจใใใใจ
ๅฟ
่ฆใจใใๅคๆฐใฎ้ใใซใใฃใฆใใชใใชใ้ฃใใใจใใใใใใช
Some s ใจใฎใใใใณใฐใฎ้ใซใฏไปฅไธใฎใณใผใใๅฟ
่ฆใจใชใใ
case ret of
Some _ -> return ()
_ -> throwError ...
let Some s = ret
ใใใ Some s ใไปใฎๆง็ฏๅญใๆใใชใใฎใงใใใฐใใใชใใ
let Some s = ret
afterCheck ใฎๅๅใฎๅคๆด
ใใใใฏใcheck ใธใใใใใงๆถใใ
Pat ใ (Pat, Bool) ใจใใๅ
จใฆใ็ถฒ็พ
ใใฆใใ pattern ใฏ (p, True) ใจใใ
ใใใฏ parse ใฎๆฎต้ใงใใฃใฆใใพใใใใช
* SyntaxTree.hs
ๅๅใๅคๆดใใ
* Parser.papillon
pragmaStr ใ String ใงใฏใชใ [Word] ใจใใใ
ใใใฆๆ็ต็ใชๆๆ็ฉใฏ [String] ใจใใใฐ่ฏใใจๆใใใ
ใใฎใพใพ [Word] ใงใใใใใชใ
ใคใพใ String ใใใฏใใใๆง้ ใๆใฃใฆใใใฎใงใ
ใจๆใฃใใ pragma ใฎ็จฎ้กใซไฝใใใใฎใใใใใชใใฎใง้ฃใใใใใ
ไบ็ด่ช monad ใจ source ใ lex (word) ใงๆฑใใใใซใใ
ใใใใใใใใใจ monad ใ source ใๅคๆฐใจใใฆไฝฟใใชใใชใใ
ใใใฏใใฃใใใชใใใใใใชใใชใ
* import ใ list ใซใใ
ใใใใใฐ import Text.Papillon ใ import "..." Control.Monad.Error ็ญใ
ๆถใใฎใ็ฐกๅใซใชใใ ใใ
ใใฎๅ ดๅใฎๅใฏ
data Import =
Import { package :: String, name :: [String], vars :: [ImportVars] }
data ImportVars = Var String | Type String [String] ใฎใใใชๆใใซใชใใใช
******************************
* ๆฉ่ฝ้ขใซใใใ็ดฐใใไฟฎๆญฃ *
******************************
* {-# LANGUAGE ... #-} ใใชใใจใใซใฏใใใ่ฟฝๅ ใใ
* source ใฎ่ฆ็ดใ
ไปใฎๆๆณใ ใจใsource: SomeSource\n ใฎใใใซใชใฃใฆใใใ
ไปๅพใใ่ค้ใชๆๆณใ่จฑๅฎนใใๅ ดๅใซใใใฆ ';' ใงๅบๅใฃใใปใใ่ฏใใใใใใชใ
* papillonStr' ็ญใ String ไปฅๅคใๅใใใใใซใใ
StringLike ใจใใใช
* papillon ใฏ getOpt ใไฝฟใใใใซใใใ
* Papillon.hs ใไธๆธใใใๅฎใ
ใพใ Papillon.hs ใๅญๅจใใฆใใใใไธญ่บซใใใงใใฏใๅใใชใใใฎใพใพใ
็ฐใชใฃใฆใใใ error ็ตไบใใใใจใซใใใใ
* papillon ใฎ commandline argument ใซใคใใฆ
papillon hoge.papillon ใ ใฃใใใๅใ directory ใซ constant ใช source ใ็ฝฎใใ
papillon Hoge.papillon ใ ใฃใใใๅใ directory ใซ
papillon src/Hoge.papillon ใ ใฃใใใsrc/Papillon.hs ใซใ
ใพใใๆ็คบ็ใซ dir ใๆๅฎใใๅ ดๅใใคใพใใ
papillon src/Hoge.papillon dist ใฎใใใซใใๅ ดๅใซใฏใ
dist ไปฅไธใซใmodule ใฎ directory ๆง้ ใไฝๆใใ
ๅญๅจใใๅ ดๅใซใฏใใฎใพใพใใใใซ Papillon.hs ใ็ฝฎใใ
ใจใใใใใๆๅพใฎ version ใ ใใไฝใฃใใ
* char ใจ position ใซใคใใฆ
conflict ใซใคใใฆใฏ2ใคใฎ้ใใใ
ใพใใฏ prefix ใใคใใใจใใใใจ
ใใใฒใจใคใฏ chars ใจ position ใฎๅๅใไธๆธใใงใใใใใซใใใใจ
**************************
* ใใญใฅใกใณใ้ขไฟ *
**************************
* ใจใใใใ็ฐกๅใชใใฅใผใใชใขใซใๆธใใฆใฟใใ
* cabal haddock ใซใคใใฆ
่ชฌๆใๅ
ฅใใฆใฟใใใใช
haddock ใฎๆธๅผใซใคใใฆ่ชฟในใๅฟ
่ฆใใใใช
* homepage ้ขไฟ
sakura VPS ใซ papillon ใ install ใใใฐใ
ใคใณใฟใฉใฏใใฃใใชใใผใธใไฝใใใใช
**************************
* ใใใฑใผใธ/้็บ้ขไฟ *
**************************
* ~/local/portage/dev-haskell/papillon/ ใใฃใฌใฏใใชใๆด็
ๅคใใใผใธใงใณใฏๆถใใฆใใพใใ
* ๆฉ่ฝ่ฟฝๅ ใใใฐใฎไฟฎๆญฃใชใฉใไบ็ดฐใชไฟฎๆญฃไปฅๅคใฏ branch ใไฝใใใจใซใใ
ไฝๆฅญ็จใฎ branch ใไฝใใๅ้กใ็กใใใฐใmaster ใซ marge ใใฆ
branch ใๆถใใจใใไฝๆฅญ็ฟๆ
ฃใใคใใใ
**************************
* ๅพใ
ใใใใจ *
**************************
* ๅบๆฅไธใใฃใใณใผใใ hlint ใง refactoring
* unicode ใธใฎๅฏพๅฟ
* ใใจใใฐ (Node l t):tree ใง warning ใๅบใชใใใใซใใ
ใคใพใใใใใใใฎใใฟใผใณใๅ้งไธๅฏใงใใใชใใฐใ
_ -> ... ใๅใใชใใใใซใใ
ใจใใใใใฏ VarP ใจ WildP ใฎใฟใๅซใใใฎใ check ใใใ
ใฒใจใคใใ constructor ใๆใใชใ็ฉใใใใใจๅๆงใซๆฑใๅฟ
่ฆใใใ
ใใใซใฏใใใใ reify ใๅฟ
่ฆใซใชใใฎใงๅพใ
ใใใใจใซใใใ
ใใใฏ th ใ True ใฎใจใใ ใ reify ใ่ฆใใจใใใใจใงๅฎ็พๅฏ่ฝใ ใใ
**************************
* ็ฎใ้ใใฆๆถใ *
**************************
* ไปฅไธใใใใฎใ ใใๆฌกใฏ module Hoge (...) where ใฎ ... ใฎ้จๅใๅใใใใ
ไธญใ ',' ใง separate ใใใฐ่ฏใใใ้ใฏ intercalate ",\n\t" ใใใใฐ่ฏใใ
ใพใใฏใใจใใใใใparser ใฎๆนใ ใใงใใใ
ใใใซ "(\n\t" ++ intercalate ",\n\t" some ++ ") where\n" ใใใฆใใพใใ
parser ใฎใชใใง '(', ')' ใฎๅฏพๅฟใ่ฆใฆ่กใๅฟ
่ฆใใใใใใใใชใใ
'(', ')', ',' ไปฅๅคใฎๆๅญใฎไธฆใณ str ใจใใฎ 3 ใคใๅบใฆใใใฐ่ฏใใฎใ ใใใ
str ใ ',' ใงๅบๅใฃใใใฎใ strs ใจใใใจใใฒใจใคใฎ่ฆ็ด ใฏใ
str ('(' strs ')')? ใพใใฏ '(' str ')' ใจใชใใใใใ ',' ใง
ๅบๅใฃใใใฎใๅ
จไฝใจใชใใๆๅพใฎ ',' ใฏใใฃใฆใ่ฏใ
ใใใจใ (...) ๅ
ใ String ใจใใฆใใฎใพใพๅบใใใ
ใใใใฏใใฃใจใกใใใจใใผในใใใใ
ใใผในใใๅฟ
่ฆใฏ็กใใใชใ
ใใใๅฟ
่ฆใ็กใใใใ ใใใ
(...) ใฎ ... ใฎ้จๅใ ใใๅบใใฆใใใใใ
ใใใใฏไปใฎใพใพใงใใใใใใใใชใใ
')' _:spaces 'w' 'h' 'e' 'r' 'e' ใ่ช่ญใใใใใใชใ
* papillonFile ใฎ่ฟใๅคใใใใใซใใ
(String, [String], [String], [String], String, DecsQ, String, Bool)
ใจใใฃใๆใใซใใใใใชใๅ
่จณใฏใใใใใ
(pragma, moduleName, exportList, imports, preD, decs, postD, needApp)
ใจใใฃใๆใใ
imports ใจ preD ใฏๅใใชใใฆใใใใใใใใชใใ
ใใใใใจ
(String, [String], [String], String, DecsQ, String, Bool)
ใใฉใฐใใใขใธใฅใผใซๅใใจใฏในใใผใใชในใใใคใณใใผใใชในใใๅฟ
่ฆใ ใ
([Pragma], ModuleName, [Export], [Import], String, DecsQ, String, Bool)
ใจใใฃใๆใใใ
data Pragma = LanguagePragma [String] | OtherPragma String
type ModuleName = [String]
data Export
= ExportV String | ExportT String (Maybe [String])
| ExportM ModuleName
data Import = Import String Bool ModuleName (Maybe String) Bool
(Maybe ImportList)
ไธ่จใฏใกใใฃใจใใใใๆใใใใ
([Pragma], ModuleName, String, String, DecsQ, String, Bool) ใงใใๆฐใใใใ
**************************
* ๅทฆๅๅธฐใซใคใใฆ *
**************************
* position ใ (Integer, pos) ใฎใใใซใใใ
* catchError ใง DirectLeftRecursion ใ catch ใใฆ ParseError ใ
ใใใใใใใกใใปใผใธใใคใใฆ่ฟใใใใใซใใใใ
* ParseError ใ่ฟใใdummy ใฎ grow ใๅฎ็พฉใใใใใใใกใใปใผใธใ่ฟใใใใซใใใ
catchError ใใคใใฆใ
if isDirectLeftRecursion e then grow else throwError e
ใฎใใใซใใใ
* grow ใฎไธญ่บซใไฝใใ
ๅผใณๅบใใฎใปใใงใฏใgrow rule (\x d -> d { hoge = x }) (Left pe)
ใฎใใใชๆใใ
grow ใฎ้ขๆฐ่ชไฝใฏ่ค้
* ็ดๆฅๅทฆๅๅธฐใฎใฟใซๅฏพๅฟใใใใจใซใใ
grow ้ขๆฐใๅฎ็พฉใใ
runStateT rule d { hoge = Left LR } ใฎใใใชๆใใซใใ
... `catchError` \e -> case e of
LR -> grow rule (\x d -> d { hoge = x `runStateT d })
(throwError Fail)
_ -> throwError Fail
ใฎใใใชๅฝขใซใใ
grow ้ขๆฐใฏใฉใใใใใใช
ใจใใใใใparse = ... where ใฎใชใใงๅฎ็พฉใใใใใซใใใ
ใพใใฏใParseError = ... | DirectLeftRecursion ใฎใใใซใใใใใช
ใใใฆใsome :: Char = c:some { c } ใฎใใใช rule ใ่ฉไพกใใฆใ
Left DirectLeftRecursion error ใ่ฟใใใใซใใใใ
ใใฎใใจใcatchError ใง DirectLeftRecursion ใ catch ใใฆ ParseError ใ
ใใใใใใใกใใปใผใธใใคใใฆ่ฟใใใใใซใใใใ
ParseError ใ่ฟใใdummy ใฎ grow ใๅฎ็พฉใใใใใใใกใใปใผใธใ่ฟใ
ใใใซใใใ
grow ใฎไธญ่บซใไฝใใ
* ๅทฆๅๅธฐใฎ่งฃๆฑบใฏใฉใใใใใใช
pappy ใฏใใใซใฒใฉใๆ้ใใใใฃใฆใใ
่งฃๆฑบใใใใฉใใใ switching ใงใใใใใซใใ
ใพใ O ่จๆณใงใฉใฎใใใใซใชใใ่ชฟในใ
ใใใจใใใใใจใใใใ็ดๆฅๅทฆๅๅธฐใ ใชใ
้ๆฅๅทฆๅๅธฐใพใงๅฏพๅฟใใใใจใใใจๅคงๅคใใใ ใ
ใใฃใจ็ดๆฅ็ใชๆนๆณใไฝฟใใใ
ๅใใซใผใซใงๅใๅ
ฅๅใๆคๅบใใๅ ดๅใซใฉใๅใใใ
ใซใผใซใจๅ
ฅๅใฎใใขใ Derivs ใซๅ
ฅใใฆใใ?
**************************
* plain style ใซใคใใฆ *
**************************
* ๅ้กใ็บ็
value <- [0-9]+ / '(' expr ')';
expr <- value;
ใฎใใใช่กจ็พใงใฏใexpr ใฎๅใๅฎใพใใชใใใ็ก้ใซใผใใซใชใฃใฆใใพใ
* plain style ใซใคใใฆ
plain style ใฎไธ็ชใฎๅ้ก็นใจใใฆใฏใๅๅธฐ็ใชๅฎ็พฉใไฝฟใใชใใใจใ
ๆฌกใซๅ้กใชใฎใฏใฒใจใคใใ้ธๆ่ขใ็กใใฆใ Either X () ใฎใใใซใชใฃใฆ
ใใพใใใจใ
* ไธ็ชไธใฎใใผใตใจใใฆ [a-zA-Z] ใฎใใใช่กจ็พใใงใใใใใซใใใ
lower <- [a-z];
lowers <- [a-z]+;
ใฎใใใชๆใใซใงใใใใใใ
StateT char >>= \c -> unless (c `elem` cs) (throwError ...)
* plain style ใง &, ! ใไฝฟใใใใใซใใ <- refactoring ใๅฟ
่ฆใ ใใ
* plain style ใง "hoge" ใจใ'h' ใไฝฟใใใใใซใใ
* ';' ใ็็ฅใงใใใใใซใใใฐใPEG ใใใฎใพใพ่ชญใฟ่พผใใใ
* import Applicative ใฎ่ชญใฟ่พผใฟๆกไปถใซ PlainExpressionHs ใฎๆ็กใๅ
ฅใใใ
ใใใใฏใใใฃใ warning ใฏ็ก่ฆใใใใจใซใใฆใimport Control.Applicative
ใฏ็กๆกไปถใงๅ
ฅใใฆใใพใใจใใใฎใใใใใใชใ
* ไปใฏใ<*> ใ export ใใฆใใใใไปใฎๆนๆณใ็กใใ่ใใใใจ