-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapi-peg.po
1624 lines (1440 loc) · 53.1 KB
/
api-peg.po
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
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#
# NuINu <don't@send.my>, 2019.
#
#. extracted from /home/bear/work/guile/doc/guile/en/api-peg.texi
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-05-07 12:36+0300\n"
"PO-Revision-Date: 2019-03-06 11:00+0300\n"
"Last-Translator: NuINu <don't@send.my>\n"
"Language-Team: Russian <don't@send.my>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Gtranslator 2.91.7\n"
"Plural-Forms: nplurals=5; plural=n==1 ? 0 : n==2 ? 1 : n<7 ? 2 : n<11 ? 3 : "
"4;\n"
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:6
msgid ""
"@c -*-texinfo-*-\n"
"@c This is part of the GNU Guile Reference Manual.\n"
"@c Copyright (C) 2006, 2010, 2011\n"
"@c Free Software Foundation, Inc.\n"
"@c See the file guile.texi for copying conditions."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:9
msgid ""
"@node PEG Parsing\n"
"@section PEG Parsing"
msgstr ""
"@node PEG Parsing\n"
"@section Разбор(Parsing) PEG "
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:15
msgid ""
"Parsing Expression Grammars (PEGs) are a way of specifying formal\n"
"languages for text processing. They can be used either for matching\n"
"(like regular expressions) or for building recursive descent parsers\n"
"(like lex/yacc). Guile uses a superset of PEG syntax that allows more\n"
"control over what information is preserved during parsing."
msgstr ""
"Разбор граматических выражений(Parsing Expression Grammars --- PEG) \n"
"это спобоб укзания формальных языков для обработки текстов. Их можно\n"
"использовать либо для сопоставления (подобно регулярным выраженям),\n"
"либо для построения парсеров рекурсивного спуска (таких как lex/yacc).\n"
"Guile использует расширенный синтаксис PEG, который позволяет получить\n"
"больший контролироль над тем, какая информация сохраняется при разборе."
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:19
msgid ""
"Wikipedia has a clear and concise introduction to PEGs if you want to\n"
"familiarize yourself with the syntax:\n"
"@url{http://en.wikipedia.org/wiki/Parsing_expression_grammar}."
msgstr ""
"Wikipedia имеет четкое и краткое введение в PEGs если вы хотите "
"ознакомиться\n"
"с его синтаксисом(есть также ее перевод на русском, там же):\n"
"@url{http://en.wikipedia.org/wiki/Parsing_expression_grammar}."
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:26
msgid ""
"The @code{(ice-9 peg)} module works by compiling PEGs down to lambda\n"
"expressions. These can either be stored in variables at compile-time by\n"
"the define macros (@code{define-peg-pattern} and\n"
"@code{define-peg-string-patterns}) or calculated explicitly at runtime\n"
"with the compile functions (@code{compile-peg-pattern} and\n"
"@code{peg-string-compile})."
msgstr ""
"Модуль @code{(ice-9 peg)} работает путем компиляцииg PEGs до лямбда "
"выражений.\n"
"Они могут быть сохранены в переменных во время компиляции с помощью\n"
"макросов (@code{define-peg-pattern} и @code{define-peg-string-patterns}) \n"
"или вычислелны явно во время выполнения с функциями компиляции\n"
"(@code{compile-peg-pattern} и @code{peg-string-compile})."
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:31
msgid ""
"They can then be used for either parsing (@code{match-pattern}) or "
"searching\n"
"(@code{search-for-pattern}). For convenience, @code{search-for-pattern}\n"
"also takes pattern literals in case you want to inline a simple search\n"
"(people often use regular expressions this way)."
msgstr ""
"Затем их можно использовать либо для разбора (@code{match-pattern}) либо\n"
"для поиска (@code{search-for-pattern}). Для удобства, @code{search-for-"
"pattern}\n"
"также принимает образцы литералов в случае, если вы хотите встроить простой "
"поиск\n"
"(люди часто используют регулярные выражения таким образом)."
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:34
msgid ""
"The rest of this documentation consists of a syntax reference, an API\n"
"reference, and a tutorial."
msgstr ""
"Остальная часть этой документации, состоит из ссылок на синтаксис,\n"
"сссылок на API и обучения."
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:41
msgid ""
"@menu\n"
"* PEG Syntax Reference::\n"
"* PEG API Reference::\n"
"* PEG Tutorial::\n"
"* PEG Internals::\n"
"@end menu"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:44
msgid ""
"@node PEG Syntax Reference\n"
"@subsection PEG Syntax Reference"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:46
msgid "@subsubheading Normal PEG Syntax:"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:51
msgid ""
"@deftp {PEG Pattern} sequence a b\n"
"Parses @var{a}. If this succeeds, continues to parse @var{b} from the\n"
"end of the text parsed as @var{a}. Succeeds if both @var{a} and\n"
"@var{b} succeed."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:53
msgid "@code{\"a b\"}"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:56
msgid ""
"@code{(and a b)}\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:60
msgid ""
"@deftp {PEG Pattern} {ordered choice} a b\n"
"Parses @var{a}. If this fails, backtracks and parses @var{b}.\n"
"Succeeds if either @var{a} or @var{b} succeeds."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:62
msgid "@code{\"a/b\"}"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:65
msgid ""
"@code{(or a b)}\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:70
msgid ""
"@deftp {PEG Pattern} {zero or more} a\n"
"Parses @var{a} as many times in a row as it can, starting each @var{a}\n"
"at the end of the text parsed by the previous @var{a}. Always\n"
"succeeds."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:72
msgid "@code{\"a*\"}"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:75
msgid ""
"@code{(* a)}\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:80
msgid ""
"@deftp {PEG Pattern} {one or more} a\n"
"Parses @var{a} as many times in a row as it can, starting each @var{a}\n"
"at the end of the text parsed by the previous @var{a}. Succeeds if at\n"
"least one @var{a} was parsed."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:82
msgid "@code{\"a+\"}"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:85
msgid ""
"@code{(+ a)}\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:88
msgid ""
"@deftp {PEG Pattern} optional a\n"
"Tries to parse @var{a}. Succeeds if @var{a} succeeds."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:90
msgid "@code{\"a?\"}"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:93
msgid ""
"@code{(? a)}\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:97
msgid ""
"@deftp {PEG Pattern} {followed by} a\n"
"Makes sure it is possible to parse @var{a}, but does not actually parse\n"
"it. Succeeds if @var{a} would succeed."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:99
msgid "@code{\"&a\"}"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:102
msgid ""
"@code{(followed-by a)}\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:106
msgid ""
"@deftp {PEG Pattern} {not followed by} a\n"
"Makes sure it is impossible to parse @var{a}, but does not actually\n"
"parse it. Succeeds if @var{a} would fail."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:108
msgid "@code{\"!a\"}"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:111
msgid ""
"@code{(not-followed-by a)}\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:114
msgid ""
"@deftp {PEG Pattern} {string literal} ``abc''\n"
"Parses the string @var{\"abc\"}. Succeeds if that parsing succeeds."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:116
msgid "@code{\"'abc'\"}"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:119
msgid ""
"@code{\"abc\"}\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:123
msgid ""
"@deftp {PEG Pattern} {any character}\n"
"Parses any single character. Succeeds unless there is no more text to\n"
"be parsed."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:125
msgid "@code{\".\"}"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:128
msgid ""
"@code{peg-any}\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:132
msgid ""
"@deftp {PEG Pattern} {character class} a b\n"
"Alternative syntax for ``Ordered Choice @var{a} @var{b}'' if @var{a} and\n"
"@var{b} are characters."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:134
msgid "@code{\"[ab]\"}"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:137
msgid ""
"@code{(or \"a\" \"b\")}\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:140
msgid ""
"@deftp {PEG Pattern} {range of characters} a z\n"
"Parses any character falling between @var{a} and @var{z}."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:142
msgid "@code{\"[a-z]\"}"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:145
msgid ""
"@code{(range #\\a #\\z)}\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:147
msgctxt "/home/bear/work/guile/doc/guile/en/api-peg.texi:147"
msgid "Example:"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:151
msgid ""
"@example\n"
"\"(a !b / c &d*) 'e'+\"\n"
"@end example"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:153
msgid "Would be:"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:161
msgid ""
"@lisp\n"
"(and\n"
" (or\n"
" (and a (not-followed-by b))\n"
" (and c (followed-by (* d))))\n"
" (+ \"e\"))\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:163
msgid "@subsubheading Extended Syntax"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:165
msgid "There is some extra syntax for S-expressions."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:169
msgid ""
"@deftp {PEG Pattern} ignore a\n"
"Ignore the text matching @var{a}\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:173
msgid ""
"@deftp {PEG Pattern} capture a\n"
"Capture the text matching @var{a}.\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:177
msgid ""
"@deftp {PEG Pattern} peg a\n"
"Embed the PEG pattern @var{a} using string syntax.\n"
"@end deftp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:179
msgctxt "/home/bear/work/guile/doc/guile/en/api-peg.texi:179"
msgid "Example:"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:183
msgid ""
"@example\n"
"\"!a / 'b'\"\n"
"@end example"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:185
msgid "Is equivalent to"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:189
msgid ""
"@lisp\n"
"(or (peg \"!a\") \"b\")\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:191
msgid "and"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:195
msgid ""
"@lisp\n"
"(or (not-followed-by a) \"b\")\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:198
msgid ""
"@node PEG API Reference\n"
"@subsection PEG API Reference"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:200
msgid "@subsubheading Define Macros"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:209
msgid ""
"The most straightforward way to define a PEG is by using one of the\n"
"define macros (both of these macroexpand into @code{define}\n"
"expressions). These macros bind parsing functions to variables. These\n"
"parsing functions may be invoked by @code{match-pattern} or\n"
"@code{search-for-pattern}, which return a PEG match record. Raw data can "
"be\n"
"retrieved from this record with the PEG match deconstructor functions.\n"
"More complicated (and perhaps enlightening) examples can be found in the\n"
"tutorial."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:221
msgid ""
"@deffn {Scheme Macro} define-peg-string-patterns peg-string\n"
"Defines all the nonterminals in the PEG @var{peg-string}. More\n"
"precisely, @code{define-peg-string-patterns} takes a superset of PEGs. A "
"normal PEG\n"
"has a @code{<-} between the nonterminal and the pattern.\n"
"@code{define-peg-string-patterns} uses this symbol to determine what "
"information it\n"
"should propagate up the parse tree. The normal @code{<-} propagates the\n"
"matched text up the parse tree, @code{<--} propagates the matched text\n"
"up the parse tree tagged with the name of the nonterminal, and @code{<}\n"
"discards that matched text and propagates nothing up the parse tree.\n"
"Also, nonterminals may consist of any alphanumeric character or a ``-''\n"
"character (in normal PEGs nonterminals can only be alphabetic)."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:240
msgid ""
"For example, if we:\n"
"@lisp\n"
"(define-peg-string-patterns \n"
" \"as <- 'a'+\n"
"bs <- 'b'+\n"
"as-or-bs <- as/bs\")\n"
"(define-peg-string-patterns \n"
" \"as-tag <-- 'a'+\n"
"bs-tag <-- 'b'+\n"
"as-or-bs-tag <-- as-tag/bs-tag\")\n"
"@end lisp\n"
"Then:\n"
"@lisp\n"
"(match-pattern as-or-bs \"aabbcc\") @result{}\n"
"#<peg start: 0 end: 2 string: aabbcc tree: aa>\n"
"(match-pattern as-or-bs-tag \"aabbcc\") @result{}\n"
"#<peg start: 0 end: 2 string: aabbcc tree: (as-or-bs-tag (as-tag aa))>\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:245
msgctxt "/home/bear/work/guile/doc/guile/en/api-peg.texi:245"
msgid ""
"Note that in doing this, we have bound 6 variables at the toplevel\n"
"(@var{as}, @var{bs}, @var{as-or-bs}, @var{as-tag}, @var{bs-tag}, and\n"
"@var{as-or-bs-tag}).\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:250
msgid ""
"@deffn {Scheme Macro} define-peg-pattern name capture-type peg-sexp\n"
"Defines a single nonterminal @var{name}. @var{capture-type} determines\n"
"how much information is passed up the parse tree. @var{peg-sexp} is a\n"
"PEG in S-expression form."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:252
msgid "Possible values for capture-type:"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:262
msgid ""
"@table @code\n"
"@item all\n"
"passes the matched text up the parse tree tagged with the name of the\n"
"nonterminal.\n"
"@item body\n"
"passes the matched text up the parse tree.\n"
"@item none\n"
"passes nothing up the parse tree.\n"
"@end table"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:279
msgid ""
"For Example, if we:\n"
"@lisp\n"
"(define-peg-pattern as body (+ \"a\"))\n"
"(define-peg-pattern bs body (+ \"b\"))\n"
"(define-peg-pattern as-or-bs body (or as bs))\n"
"(define-peg-pattern as-tag all (+ \"a\"))\n"
"(define-peg-pattern bs-tag all (+ \"b\"))\n"
"(define-peg-pattern as-or-bs-tag all (or as-tag bs-tag))\n"
"@end lisp\n"
"Then:\n"
"@lisp\n"
"(match-pattern as-or-bs \"aabbcc\") @result{} \n"
"#<peg start: 0 end: 2 string: aabbcc tree: aa>\n"
"(match-pattern as-or-bs-tag \"aabbcc\") @result{} \n"
"#<peg start: 0 end: 2 string: aabbcc tree: (as-or-bs-tag (as-tag aa))>\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:284
msgctxt "/home/bear/work/guile/doc/guile/en/api-peg.texi:284"
msgid ""
"Note that in doing this, we have bound 6 variables at the toplevel\n"
"(@var{as}, @var{bs}, @var{as-or-bs}, @var{as-tag}, @var{bs-tag}, and\n"
"@var{as-or-bs-tag}).\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:288
msgid ""
"@subsubheading Compile Functions\n"
"It is sometimes useful to be able to compile anonymous PEG patterns at\n"
"runtime. These functions let you do that using either syntax."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:294
msgid ""
"@deffn {Scheme Procedure} peg-string-compile peg-string capture-type\n"
"Compiles the PEG pattern in @var{peg-string} propagating according to\n"
"@var{capture-type} (capture-type can be any of the values from\n"
"@code{define-peg-pattern}).\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:301
msgid ""
"@deffn {Scheme Procedure} compile-peg-pattern peg-sexp capture-type\n"
"Compiles the PEG pattern in @var{peg-sexp} propagating according to\n"
"@var{capture-type} (capture-type can be any of the values from\n"
"@code{define-peg-pattern}).\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:305
msgid ""
"The functions return syntax objects, which can be useful if you want to\n"
"use them in macros. If all you want is to define a new nonterminal, you\n"
"can do the following:"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:310
msgid ""
"@lisp\n"
"(define exp '(+ \"a\"))\n"
"(define as (compile (compile-peg-pattern exp 'body)))\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:312
msgid "You can use this nonterminal with all of the regular PEG functions:"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:317
msgid ""
"@lisp\n"
"(match-pattern as \"aaaaa\") @result{}\n"
"#<peg start: 0 end: 5 string: bbbbb tree: bbbbb>\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:319
msgid "@subsubheading Parsing & Matching Functions"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:327
msgid ""
"For our purposes, ``parsing'' means parsing a string into a tree\n"
"starting from the first character, while ``matching'' means searching\n"
"through the string for a substring. In practice, the only difference\n"
"between the two functions is that @code{match-pattern} gives up if it can't\n"
"find a valid substring starting at index 0 and @code{search-for-pattern} "
"keeps\n"
"looking. They are both equally capable of ``parsing'' and ``matching''\n"
"given those constraints."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:332
msgid ""
"@deffn {Scheme Procedure} match-pattern nonterm string \n"
"Parses @var{string} using the PEG stored in @var{nonterm}. If no match\n"
"was found, @code{match-pattern} returns false. If a match was found, a PEG\n"
"match record is returned."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:335
msgid ""
"The @code{capture-type} argument to @code{define-peg-pattern} allows you to\n"
"choose what information to hold on to while parsing. The options are:"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:344
msgid ""
"@table @code\n"
"@item all\n"
"tag the matched text with the nonterminal\n"
"@item body\n"
"just the matched text\n"
"@item none\n"
"nothing\n"
"@end table"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:349
msgid ""
"@lisp\n"
"(define-peg-pattern as all (+ \"a\"))\n"
"(match-pattern as \"aabbcc\") @result{} \n"
"#<peg start: 0 end: 2 string: aabbcc tree: (as aa)>"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:353
msgid ""
"(define-peg-pattern as body (+ \"a\"))\n"
"(match-pattern as \"aabbcc\") @result{} \n"
"#<peg start: 0 end: 2 string: aabbcc tree: aa>"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:357
msgid ""
"(define-peg-pattern as none (+ \"a\"))\n"
"(match-pattern as \"aabbcc\") @result{} \n"
"#<peg start: 0 end: 2 string: aabbcc tree: ()>"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:363
msgid ""
"(define-peg-pattern bs body (+ \"b\"))\n"
"(match-pattern bs \"aabbcc\") @result{} \n"
"#f\n"
"@end lisp\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:371
msgid ""
"@deffn {Scheme Macro} search-for-pattern nonterm-or-peg string\n"
"Searches through @var{string} looking for a matching subexpression.\n"
"@var{nonterm-or-peg} can either be a nonterminal or a literal PEG\n"
"pattern. When a literal PEG pattern is provided, @code{search-for-pattern} "
"works\n"
"very similarly to the regular expression searches many hackers are used\n"
"to. If no match was found, @code{search-for-pattern} returns false. If a "
"match\n"
"was found, a PEG match record is returned."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:380
msgid ""
"@lisp\n"
"(define-peg-pattern as body (+ \"a\"))\n"
"(search-for-pattern as \"aabbcc\") @result{} \n"
"#<peg start: 0 end: 2 string: aabbcc tree: aa>\n"
"(search-for-pattern (+ \"a\") \"aabbcc\") @result{} \n"
"#<peg start: 0 end: 2 string: aabbcc tree: aa>\n"
"(search-for-pattern \"'a'+\" \"aabbcc\") @result{} \n"
"#<peg start: 0 end: 2 string: aabbcc tree: aa>"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:384
msgid ""
"(define-peg-pattern as all (+ \"a\"))\n"
"(search-for-pattern as \"aabbcc\") @result{} \n"
"#<peg start: 0 end: 2 string: aabbcc tree: (as aa)>"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:392
msgid ""
"(define-peg-pattern bs body (+ \"b\"))\n"
"(search-for-pattern bs \"aabbcc\") @result{} \n"
"#<peg start: 2 end: 4 string: aabbcc tree: bb>\n"
"(search-for-pattern (+ \"b\") \"aabbcc\") @result{} \n"
"#<peg start: 2 end: 4 string: aabbcc tree: bb>\n"
"(search-for-pattern \"'b'+\" \"aabbcc\") @result{} \n"
"#<peg start: 2 end: 4 string: aabbcc tree: bb>"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:402
msgid ""
"(define-peg-pattern zs body (+ \"z\"))\n"
"(search-for-pattern zs \"aabbcc\") @result{} \n"
"#f\n"
"(search-for-pattern (+ \"z\") \"aabbcc\") @result{} \n"
"#f\n"
"(search-for-pattern \"'z'+\" \"aabbcc\") @result{} \n"
"#f\n"
"@end lisp\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:407
msgid ""
"@subsubheading PEG Match Records\n"
"The @code{match-pattern} and @code{search-for-pattern} functions both return "
"PEG\n"
"match records. Actual information can be extracted from these with the\n"
"following functions."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:412
msgid ""
"@deffn {Scheme Procedure} peg:string match-record\n"
"Returns the original string that was parsed in the creation of\n"
"@code{match-record}.\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:418
msgid ""
"@deffn {Scheme Procedure} peg:start match-record\n"
"Returns the index of the first parsed character in the original string\n"
"(from @code{peg:string}). If this is the same as @code{peg:end},\n"
"nothing was parsed.\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:424
msgid ""
"@deffn {Scheme Procedure} peg:end match-record\n"
"Returns one more than the index of the last parsed character in the\n"
"original string (from @code{peg:string}). If this is the same as\n"
"@code{peg:start}, nothing was parsed.\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:430
msgid ""
"@deffn {Scheme Procedure} peg:substring match-record\n"
"Returns the substring parsed by @code{match-record}. This is equivalent to\n"
"@code{(substring (peg:string match-record) (peg:start match-record) (peg:"
"end\n"
"match-record))}.\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:434
msgid ""
"@deffn {Scheme Procedure} peg:tree match-record\n"
"Returns the tree parsed by @code{match-record}.\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:439
msgid ""
"@deffn {Scheme Procedure} peg-record? match-record\n"
"Returns true if @code{match-record} is a PEG match record, or false\n"
"otherwise.\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:443
msgid ""
"Example:\n"
"@lisp\n"
"(define-peg-pattern bs all (peg \"'b'+\"))"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:446
msgid ""
"(search-for-pattern bs \"aabbcc\") @result{}\n"
"#<peg start: 2 end: 4 string: aabbcc tree: (bs bb)>"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:461
msgid ""
"(let ((pm (search-for-pattern bs \"aabbcc\")))\n"
" `((string ,(peg:string pm))\n"
" (start ,(peg:start pm))\n"
" (end ,(peg:end pm))\n"
" (substring ,(peg:substring pm))\n"
" (tree ,(peg:tree pm))\n"
" (record? ,(peg-record? pm)))) @result{}\n"
"((string \"aabbcc\")\n"
" (start 2)\n"
" (end 4)\n"
" (substring \"bb\")\n"
" (tree (bs \"bb\"))\n"
" (record? #t))\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:463
msgid "@subsubheading Miscellaneous"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:469
msgid ""
"@deffn {Scheme Procedure} context-flatten tst lst\n"
"Takes a predicate @var{tst} and a list @var{lst}. Flattens @var{lst}\n"
"until all elements are either atoms or satisfy @var{tst}. If @var{lst}\n"
"itself satisfies @var{tst}, @code{(list lst)} is returned (this is a\n"
"flat list whose only element satisfies @var{tst})."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:476
msgid ""
"@lisp\n"
"(context-flatten (lambda (x) (and (number? (car x)) (= (car x) 1))) '(2 2 (1 "
"1 (2 2)) (2 2 (1 1)))) @result{} \n"
"(2 2 (1 1 (2 2)) 2 2 (1 1))\n"
"(context-flatten (lambda (x) (and (number? (car x)) (= (car x) 1))) '(1 1 (1 "
"1 (2 2)) (2 2 (1 1)))) @result{} \n"
"((1 1 (1 1 (2 2)) (2 2 (1 1))))\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:479
msgctxt "/home/bear/work/guile/doc/guile/en/api-peg.texi:479"
msgid ""
"If you're wondering why this is here, take a look at the tutorial.\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:489
msgid ""
"@deffn {Scheme Procedure} keyword-flatten terms lst\n"
"A less general form of @code{context-flatten}. Takes a list of terminal\n"
"atoms @code{terms} and flattens @var{lst} until all elements are either\n"
"atoms, or lists which have an atom from @code{terms} as their first\n"
"element.\n"
"@lisp\n"
"(keyword-flatten '(a b) '(c a b (a c) (b c) (c (b a) (c a)))) @result{}\n"
"(c a b (a c) (b c) c (b a) c a)\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:492
msgctxt "/home/bear/work/guile/doc/guile/en/api-peg.texi:492"
msgid ""
"If you're wondering why this is here, take a look at the tutorial.\n"
"@end deffn"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:495
msgid ""
"@node PEG Tutorial\n"
"@subsection PEG Tutorial"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:498
msgid ""
"@subsubheading Parsing /etc/passwd\n"
"This example will show how to parse /etc/passwd using PEGs."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:500
msgid "First we define an example /etc/passwd file:"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:511
msgid ""
"@lisp\n"
"(define *etc-passwd*\n"
" \"root:x:0:0:root:/root:/bin/bash\n"
"daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n"
"bin:x:2:2:bin:/bin:/bin/sh\n"
"sys:x:3:3:sys:/dev:/bin/sh\n"
"nobody:x:65534:65534:nobody:/nonexistent:/bin/sh\n"
"messagebus:x:103:107::/var/run/dbus:/bin/false\n"
"\")\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:514
msgid ""
"As a first pass at this, we might want to have all the entries in\n"
"/etc/passwd in a list."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:522
msgid ""
"Doing this with string-based PEG syntax would look like this:\n"
"@lisp\n"
"(define-peg-string-patterns\n"
" \"passwd <- entry* !.\n"
"entry <-- (! NL .)* NL*\n"
"NL < '\\n'\")\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:527
msgid ""
"A @code{passwd} file is 0 or more entries (@code{entry*}) until the end\n"
"of the file (@code{!.} (@code{.} is any character, so @code{!.} means\n"
"``not anything'')). We want to capture the data in the nonterminal\n"
"@code{passwd}, but not tag it with the name, so we use @code{<-}."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:531
msgid ""
"An entry is a series of 0 or more characters that aren't newlines\n"
"(@code{(! NL .)*}) followed by 0 or more newlines (@code{NL*}). We want\n"
"to tag all the entries with @code{entry}, so we use @code{<--}."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:535
msgid ""
"A newline is just a literal newline (@code{'\\n'}). We don't want a\n"
"bunch of newlines cluttering up the output, so we use @code{<} to throw\n"
"away the captured data."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:543
msgid ""
"Here is the same PEG defined using S-expressions:\n"
"@lisp\n"
"(define-peg-pattern passwd body (and (* entry) (not-followed-by peg-any)))\n"
"(define-peg-pattern entry all (and (* (and (not-followed-by NL) peg-any))\n"
"\t\t\t (* NL)))\n"
"(define-peg-pattern NL none \"\\n\")\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:554
msgid ""
"Obviously this is much more verbose. On the other hand, it's more\n"
"explicit, and thus easier to build automatically. However, there are\n"
"some tricks that make S-expressions easier to use in some cases. One is\n"
"the @code{ignore} keyword; the string syntax has no way to say ``throw\n"
"away this text'' except breaking it out into a separate nonterminal.\n"
"For instance, to throw away the newlines we had to define @code{NL}. In\n"
"the S-expression syntax, we could have simply written @code{(ignore\n"
"\"\\n\")}. Also, for the cases where string syntax is really much cleaner,\n"
"the @code{peg} keyword can be used to embed string syntax in\n"
"S-expression syntax. For instance, we could have written:"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:558
msgid ""
"@lisp\n"
"(define-peg-pattern passwd body (peg \"entry* !.\"))\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:561
msgid ""
"However we define it, parsing @code{*etc-passwd*} with the @code{passwd}\n"
"nonterminal yields the same results:"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:571
msgid ""
"@lisp\n"
"(peg:tree (match-pattern passwd *etc-passwd*)) @result{}\n"
"((entry \"root:x:0:0:root:/root:/bin/bash\")\n"
" (entry \"daemon:x:1:1:daemon:/usr/sbin:/bin/sh\")\n"
" (entry \"bin:x:2:2:bin:/bin:/bin/sh\")\n"
" (entry \"sys:x:3:3:sys:/dev:/bin/sh\")\n"
" (entry \"nobody:x:65534:65534:nobody:/nonexistent:/bin/sh\")\n"
" (entry \"messagebus:x:103:107::/var/run/dbus:/bin/false\"))\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:573
msgid "However, here is something to be wary of:"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:578
msgid ""
"@lisp\n"
"(peg:tree (match-pattern passwd \"one entry\")) @result{}\n"
"(entry \"one entry\")\n"
"@end lisp"
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:588
msgid ""
"By default, the parse trees generated by PEGs are compressed as much as\n"
"possible without losing information. It may not look like this is what\n"
"you want at first, but uncompressed parse trees are an enormous headache\n"
"(there's no easy way to predict how deep particular lists will nest,\n"
"there are empty lists littered everywhere, etc. etc.). One side-effect\n"
"of this, however, is that sometimes the compressor is too aggressive.\n"
"No information is discarded when @code{((entry \"one entry\"))} is\n"
"compressed to @code{(entry \"one entry\")}, but in this particular case it\n"
"probably isn't what we want."
msgstr ""
#: /home/bear/work/guile/doc/guile/en/api-peg.texi:597
msgid ""
"There are two functions for easily dealing with this:\n"
"@code{keyword-flatten} and @code{context-flatten}. The\n"
"@code{keyword-flatten} function takes a list of keywords and a list to\n"
"flatten, then tries to coerce the list such that the first element of\n"
"all sublists is one of the keywords. The @code{context-flatten}\n"
"function is similar, but instead of a list of keywords it takes a\n"