1. Kirill Simonov
  2. pyyaml-legacy

Source

pyyaml-legacy / experimental / bnfyaml / yaml.bnf

  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
;; 4.1. Characters

;; 4.1.1. Character Set

; [1] characters as defined by the Unicode standard, excluding most control characters and the surrogate blocks 
c-printable ::= \x9 | 
                \xA | 
                \xD | 
              [ \x20-\x7E] | 
                \x85 | 
              [ \xA0-\xD7FF] | 
              [ \xE000-\xFFFD] | 
              [ \x10000-\x10FFFF]

;; 4.1.2. Encoding

; [2] unicode BOM
c-byte-order-mark ::= \xFEFF                                             


;; 4.1.3. Indicators

; [3] starts a flow sequence collection 
c-sequence-start ::= "["                                                
; [4] ends a flow sequence collection 
c-sequence-end ::= "]"                                                  
; [5] starts a flow mapping collection 
c-mapping-start ::= "{"                                                 
; [6] ends a flow mapping collection 
c-mapping-end ::= "}"                                                   
; [7] indicates a sequence entry 
c-sequence-entry ::= "-"                                                
; [8] separates a key from its value 
c-mapping-entry ::= ":"                                                 
; [9] separates flow collection entries 
c-collect-entry ::= ","                                                 
; [10] a complex key 
c-complex-key ::= "?"                                                   
; [11] indicates a tag property 
c-tag ::= "!"                                                           
; [12] an anchor property 
c-anchor ::= "&"                                                        
; [13] an alias node 
c-alias ::= "*"                                                         
; [14] a literal scalar 
c-literal ::= "|"                                                       
; [15] a folded scalar 
c-folded ::= ">"                                                        
; [16] a single quoted scalar 
c-single-quote ::= "'"                                                  
; [17] a double quoted scalar 
c-double-quote ::= """                                                  
; [18] a throwaway comment 
c-throwaway ::= "#"                                                     
; [19] a directive 
c-directive ::= "%"                                                     
; [20] reserved for future use 
c-reserved ::= "@" | 
               "`"                                                      
; [21] indicator characters 
c-indicators ::= "[" | 
                 "]" | 
                 "{" | 
                 "}" | 
                 "-" | 
                 ":" | 
                 "?" | 
                 "," | 
                 "!" | 
                 "*" | 
                 "&" | 
                 "|" | 
                 ">" | 
                 "'" | 
                 """ | 
                 "#" | 
                 "%" | 
                 "@" | 
                 "`"  
                 
;; 4.1.4 Line Breaks
                                                                                   
; [22] aSCII line feed (LF) 
b-line-feed ::= \xA                                                     
; [23] aSCII carriage return (CR) 
b-carriage-return ::= \xD                                               
; [24] unicode next line (NEL) 
b-next-line ::= \x85                                                    
; [25] unicode line separator (LS) 
b-line-separator ::= \x2028                                             
; [26] unicode paragraph separator (PS) 
b-paragraph-separator ::= \x2029                                        
; [27] line break characters 
b-char ::=           b-line-feed | 
               b-carriage-return | 
                     b-next-line | 
                b-line-separator | 
           b-paragraph-separator
; [28] line break with non-specific semantics 
b-generic ::= ( b-carriage-return b-line-feed ) | 
                              b-carriage-return | 
                                    b-line-feed | 
                                    b-next-line                                             
; [29] line break with specific semantics 
b-specific ::= b-line-separator | 
               b-paragraph-separator                                    
; [30] any non-content line break 
b-any ::= b-generic | 
          b-specific 

;; 4.1.5. Miscellaneous
          
; [31] characters valid in a line 
nb-char ::= c-printable - b-char                                        
; [32] white space valid in a line 
s-char ::= \x9 | 
           \x20                                                         
; [33] non-space characters valid in a line 
ns-char ::= nb-char - s-char                                            
; [34] aSCII letters, A-Z or a-z 
ns-ascii-letter ::= [\x41-\x5A] | 
                    [\x61-\x7A] 
; [35] 0-9
ns-decimal-digit ::= [\x30-\x39]  
; [36] 0-9, A-F or a-f 
ns-hex-digit ::= ns-decimal-digit | 
                 [\x41-\x46] | 
                 [\x61-\x66] 
; [37] characters valid in a word 
ns-word-char ::= ns-decimal-digit | 
                  ns-ascii-letter | 
                  "-" 
                 
;; 4.2. Space Processing

;; 4.2.1. Indentation
                 
; [38] specific level of indentation 
i-spaces(n) ::= \x20 x n 

;; 4.2.2. Throwaway comments

; [39] comment trailing a line 
c-nb-throwaway-comment ::= "#" nb-char* 
; [40] types of comment lines
l-comment(n) ::= l-empty-comment(n) | 
                 l-text-comment(n)  
; [41] empty throwaway comment line 
l-empty-comment(n) ::= i-spaces(<n) b-any 
; [42] explicit throwaway comment line 
l-text-comment(n) ::= i-spaces(<n) c-nb-throwaway-comment b-any 
; [43] trailing non-content spaces, comment and line break 
s-b-trailing-comment ::= ( s-char+ c-nb-throwaway-comment? )? b-any 

;; 4.3. YAML Stream

; [44] document stream 
c-l-yaml-stream ::= ( c-l-before-document l-l-implicit-document l-l-after-document? )? ( c-l-before-document l-l-explicit-document l-l-after-document? )* 
; [45] comments before actual document starts 
c-l-before-document ::= c-byte-order-mark? #l-comment(any)* 
; [46] first document with an implicit header line 
l-l-implicit-document ::= l-l-collect-blk-value(any) | 
                          l-l-collect-top-flow-node(any) 
; [47] stream document with an explicit header 
l-l-explicit-document ::= ns-ns-document-header ( s-l-scalar-top-node(any) | 
                          s-l-collect-top-node(any) ) 
                          
;; 4.3.1. Document
                          
; [48] document header 
ns-ns-document-header ::= ns-ns-document-start ( s-char+ c-ns-directive )* 
; [49] document start indicator 
ns-ns-document-start ::= "-" "-" "-" 
; [50] document trailer 
l-l-after-document ::= ns-ns-document-end b-any l-comment(any)* 
; [51] document end indicator 
ns-ns-document-end ::= "." "." "." 
; [52] forbidden non-indented content line 
l-forbidden-non-indented ::= ( ns-ns-document-start s-char nb-char* ) | 
                               ns-ns-document-end 

;; 4.3.2. Directive

; [53] document directive 
c-ns-directive ::= "%" ns-ns-directive-name ":" ns-ns-directive-value 
; [54] document directive name 
ns-ns-directive-name ::= ( ns-char - ":" )+ 
; [55] document directive value 
ns-ns-directive-value ::= ns-char+ 

;; 4.3.3. Presentation Node

; [56] node outside flow collection 
s-l-top-node(n) ::=      s-l-alias-top-node | 
                    s-l-collect-top-node(n) | 
                     s-l-scalar-top-node(n) 
; [57] value node inside flow collection 
ns-ns-flow-value-node(n) ::=      ns-ns-alias-flow-node | 
                               c-c-collect-flow-node(n) | 
                        ns-ns-scalar-flow-value-node(n) 
; [58] key node inside flow collection
ns-ns-flow-key-node(n) ::=     ns-ns-alias-flow-node | 
                            c-c-collect-flow-node(n) | 
                        ns-ns-scalar-flow-key-node(n)  

;; 4.3.4. Node Property

; [59] properties list 
c-ns-properties ::= ( c-ns-tag-property ( s-char+ c-ns-anchor-property )? ) | 
                    ( c-ns-anchor-property ( s-char+ c-ns-tag-property )? ) 
                    
;; 4.3.5. Tag                    
                    
;; 4.3.5.3. Prefixing
                    
; [60] seperate prefix from type 
c-prefix ::= "^" 
; [62] characters valid in a tag 
ns-tag-char ::=         ns-esc-sequence | 
               ( "%" ns-hex-digit x 2 ) | 
          ( ns-char - "\" - "^" - "%" ) 
; [63] non-magical URI character
ns-mundane-tag-char ::= ns-tag-char - ":" - "/"  
; [64] collection tag
c-ns-tag-property ::= "!" ( ; empty (implicit) | 
                              c-ns-private-tag | 
                              ns-ns-global-tag | 
        ( Prefix-of-above? "^" Suffix-of-above ) )  
; [65] private tags 
c-ns-private-tag ::= "!" ns-tag-char+ 
; [66] global tags 
ns-ns-global-tag ::=       ns-ns-core-tag | 
                     ns-ns-vocabulary-tag | 
                     ns-ns-domain-tag 
; [67] shorthand for tag:yaml.org,2002:type names 
ns-ns-core-tag ::= ( ns-mundane-tag-char - "!" ) ns-mundane-tag-char* 
; [68] shorthand for tag:vocabulary.yaml.org,2002:type names
ns-ns-vocabulary-tag ::= ns-word-char+ "/" ns-tag-char*  
; [69] shorthand for tag:domain,date:type names 
ns-ns-domain-tag ::= ns-word-char+ ( "." ns-word-char+ ) "," ns-ns-domain-year ( "-" ns-ns-domain-day-month ( "-" ns-ns-domain-day-month )? )? "/" ns-tag-char* 
; [70] tag domain ownership year
ns-ns-domain-year ::= ns-decimal-digit x 4  

;; 4.3.6. Anchor

; [71] tag domain ownership day or month (01 by default)
ns-ns-domain-day-month ::= ns-decimal-digit x 2  
; [72] associates an anchor with a given node
c-ns-anchor-property ::= "&" ns-ns-anchor-name

;; 4.4. Alias  

; [73] unique anchor name
ns-ns-anchor-name ::= ns-char+  
; [74] alias node outside flow collection 
s-l-alias-top-node ::= s-char ns-ns-alias-flow-node s-b-trailing-comment l-comment(any)* 

;; 4.5. Collection

; [75] alias node inside flow collection
ns-ns-alias-flow-node ::= "*" ns-ns-anchor-name  
; [76] collection node outside flow collection 
s-l-collect-top-node(n) ::= s-l-collect-blk-node(n) | 
                          ( s-s-required(n) c-c-collect-flow-node(n) s-b-trailing-comment l-comment(any)* ) 
; [77] top-level (document) flow collection node 
l-l-collect-top-flow-node(n) ::= i-spaces(n) c-c-collect-flow-node(n) s-b-trailing-comment l-comment(any)* 
; [78] collection node in flow style 
c-c-collect-flow-node(n) ::= ( c-ns-properties s-char+ )? c-c-collect-flow-value(n) 
; [79] collection node in block style 
s-l-collect-blk-node(n) ::= ( s-char+ c-ns-properties )? s-b-trailing-comment l-comment(any)* l-l-collect-blk-value(n) 
; [80] collection value in block style 
l-l-collect-blk-value(n) ::= l-l-blk-seq-value(n) | 
                             l-l-blk-map-value(n) 
; [81] collection value in flow style 
c-c-collect-flow-value(n) ::= c-c-flow-seq-value(n) | 
                              c-c-flow-map-value(n) 
; [82] optional white space separating tokens 
s-s-optional(n) ::= s-char* | 
                  ( s-b-trailing-comment i-spaces(n) s-char+ ) 
                  
;; 4.5.1. Sequence
                  
; [83] required white space separating tokens
s-s-required(n) ::= s-char+ | 
                  ( s-b-trailing-comment i-spaces(n) s-char+ )  
; [84] sequence value in block style; -1 unless the block sequence is the value of an entry of a parent block sequence 
l-l-blk-seq-value(n) ::= ( i-spaces(n-1) c-l-blk-seq-entry(n-1) )+ 
; [85] block sequence node entry 
c-l-blk-seq-entry(n) ::= "-" s-l-inline-node(n) 
; [86] top node or a shorthand inline collection
s-l-inline-node(n) ::=  s-l-top-node(>n) | 
                       i-l-inline-seq(n) | 
                       i-l-inline-map(n)  
; [87] inline sequence node with no properties (where m > 0)
i-l-inline-seq(n) ::= i-spaces(m) c-l-blk-seq-entry(n+m+1) l-l-blk-seq-value(n+m+1)?  
; [88] sequence value in flow style
c-c-flow-seq-value(n) ::= "[" s-s-optional(n) ( ns-ns-flow-seq-entry(n) s-s-optional(n) ( "," s-s-required(n) ns-ns-flow-seq-entry(n) s-s-optional(n) )* )? "]"  
ns-ns-flow-seq-entry(n) ::= ns-ns-flow-value-node(n) | 
                            ns-ns-flow-pair-map(n) ; flow style sequence entry 
                            
;; 4.5.2. Mapping
                            
; [89] mapping value in block style 
l-l-blk-map-value(n) ::= ( i-spaces(n) ns-l-blk-map-entry(n) )+ 
; [90] inline mapping node with no properties (where m > 0) 
i-l-inline-map(n) ::= i-spaces(m) ns-ns-scalar-key-value(n+m+1) s-char* ":" s-l-top-node(>n+m+1) l-l-blk-map-value(n+m+1)? 
; [91] block key:value pair 
ns-l-blk-map-entry(n) ::= ns-l-simple-map-entry(n) ns-l-complex-map-entry(n) 
; [92] simple key:value pair 
ns-l-simple-map-entry(n) ::= ns-ns-flow-key-node(n) s-char* ":" s-l-top-node(>n) 
; [93] complex key:value pair 
ns-l-complex-map-entry(n) ::= "?" s-l-inline-node(n) ( i-spaces(n) ":" s-l-inline-node(n) )? 
; [94] mapping value in flow style 
c-c-flow-map-value(n) ::= "{" s-s-optional(n) ( ns-ns-flow-map-entry(n) s-s-optional(n) ( "," s-s-required(n) ns-ns-flow-map-entry(n) s-s-optional(n) )* )? "}" 
; [95] flow key:value pair 
ns-ns-flow-map-entry(n) ::= ns-ns-flow-key-node(n) ( s-char* ":" s-s-required(n) ns-ns-flow-value-node(n) )? 
; [96] single key:value pair map in flow sequence 
ns-ns-flow-pair-map(n) ::= ns-ns-flow-key-node(n) s-char* ":" s-s-required(n) ns-ns-flow-value-node(n) 

;; 4.6. Scalar

; [97] scalar node outside flow collection 
s-l-scalar-top-node(n) ::= s-l-scalar-top-blk-node(n) | 
                           s-l-scalar-top-flow-node(n) 
; [98] scalar node outside flow collection, in block style 
s-l-scalar-top-blk-node(n) ::= ( s-char+ c-ns-properties )? s-char+ c-l-scalar-blk-value(n) 
; [99] scalar node outside flow collection, in flow style 
s-l-scalar-top-flow-node(n) ::= s-s-required(n) ( c-ns-properties s-char+ )? ns-ns-scalar-top-value(n) s-b-trailing-comment l-comment(any)* 
; [100] scalar node inside flow collection, used as value 
ns-ns-scalar-flow-value-node(n) ::= ( c-ns-properties s-char+ )? ns-ns-scalar-flow-value(n) 
; [101] scalar node inside flow collection, used as key 
ns-ns-scalar-flow-key-node(n) ::= ( c-ns-properties s-char+ )? ns-ns-scalar-key-value(n) 
; [102] scalar value in block style 
c-l-scalar-blk-value(n) ::= c-l-literal(n) | 
                            c-l-folded(n) 
; [103] scalar value in flow style, used as value, inside flow collection 
ns-ns-scalar-flow-value(n) ::= c-c-single-quoted(n) | 
                               c-c-double-quoted(n) | 
                               ns-ns-plain-flow(n) 
; [104] scalar value in flow style, used as value, outside flow collection 
ns-ns-scalar-top-value(n) ::= c-c-single-quoted(n) | 
                              c-c-double-quoted(n) | 
                              ns-ns-plain-top(n) 
; [105] scalar value in flow style, used as key 
ns-ns-scalar-key-value(n) ::= c-c-single-quoted(n) | 
                              c-c-double-quoted(n) | 
                              ns-ns-plain-key 
                              
;; 4.6.1.   End Of line Normalization
                              
; [106] line break converted to a line feed 
b-as-line-feed ::= b-generic 
; [107] a normalized end of line marker 
b-normalized ::= b-as-line-feed | 
                 b-specific 
                 
;; 4.6.2. Block Modifiers
                 
; [108] block scalar modifiers 
ns-ns-blk-modifiers ::= ( ns-explicit-indent c-chomp-control? ) | 
                        ( c-chomp-control ns-explicit-indent? ) 
                        
;; 4.6.3.   Explicit Indentation
                        
; [109] explicit additional indentation level 
ns-explicit-indent ::= ns-decimal-digit 

;; 4.6.4. Chomping

; [110] override the default "clip" chomping
c-chomp-control ::= c-strip-chomp | 
                    c-keep-chomp  
; [111] strip final line break from value 
c-strip-chomp ::= "-" 
; [112] keep trailing line breaks in value 
c-keep-chomp ::= "+" 
; [113] trailing line feeds or comment lines, depending on chomp control) 
l-l-empty-trailing(n) ::= l-empty-comment(n)+ | 
                          l-blk-empty-line-feed(n)+ 
; [114] empty block line 
l-blk-empty-line-feed(n) ::= i-spaces(<n) b-as-line-feed

;; 4.6.5. Literal
 
; [115] literal scalar 
c-l-literal(n) ::= "|" ns-ns-blk-modifiers? s-b-trailing-comment l-l-literal-value(n)? l-l-empty-trailing(n)? ( l-text-comment(<n) l-comment(any)* )? 
; [116] value of literal scalar 
l-l-literal-value(n) ::= l-l-literal-chunk(n)+ 
; [117] chunk of literal scalar lines 
l-l-literal-chunk(n) ::= l-blk-empty-line-feed(n)* ( l-literal-text(n) | 
                         l-blk-empty-specific(n) ) 
; [118] empty block line with preserved specific line break 
l-blk-empty-specific(n) ::= i-spaces(<n) b-specific 
; [119] literal line character data 
l-literal-text(n) ::= ( i-spaces(n) nb-char+ b-normalized ) - ( l-forbidden-non-indented b-any ) 

;; 4.6.6. Folding

;; 4.6.6.1.   Folding in a block context

; [120] line feed converted to a space 
b-as-space ::= b-generic 
; [121] ignored line feed 
b-ignored ::= b-generic 
; [122] sequence of line feeds in block scalar 
b-l-blk-trimmed(n) ::= b-ignored l-blk-empty-line-feed(n)+ 

;; 4.6.6.2.   Folding flow scalars

; [123] ignored spaces at start of flow scalar line 
i-s-ignored-leading(n) ::= i-spaces(n) s-char+ 
; [124] ignored spaces at end of flow scalar line 
s-s-ignored-trailing ::= s-char+ 
; [125] empty flow line with preserved specific line break 
l-flow-empty-specific(n) ::= ( i-spaces(<n) | 
                               i-s-ignored-leading(n) ) b-specific 
; [126] empty flow line with line break normalized to line feed 
l-flow-empty-line-feed(n) ::= ( i-spaces(<n) | 
                                i-s-ignored-leading(n) ) b-as-line-feed 
; [127] sequence of line feeds in flow scalar 
b-l-flow-trimmed(n) ::= b-ignored l-flow-empty-line-feed(n)+ 
; [128] end of a line in a multi-line flow scalar 
s-l-end-flow-line(n) ::= s-s-ignored-trailing ( b-as-space | 
                                       b-l-flow-trimmed(n) | 
                                               b-specific ) 

;; 4.6.7. Folded

; [129] folded scalar 
c-l-folded(n) ::= ">" ns-ns-blk-modifiers s-b-trailing-comment l-l-folded-value(n)? l-l-empty-trailing(n)? ( l-text-comment(<n) l-comment(any)* )? 
; [130] value of folded scalar 
l-l-folded-value(n) ::= l-blk-empty-line-feed(n)* ( l-l-folded-chunk(n) | 
                        l-l-non-folded-chunk(n) ) 
; [131] value starting with a chunk of folded text 
l-l-folded-chunk(n) ::= ( i-nb-folded-paragraph(n) b-l-blk-trimmed(n) )* i-nb-folded-paragraph(n) b-l-after-folded-chunk(n) 
; [132] single content paragraph folded into multiple physical lines 
i-nb-folded-paragraph(n) ::= ( i-nb-folded-text(n) b-as-space )* i-nb-folded-text(n) 
; [133] folded text line characters 
i-nb-folded-text(n) ::= ( i-spaces(n) ns-char nb-char* ) - l-forbidden-non-indented 
; [134] text following a folded text chunk 
b-l-after-folded-chunk(n) ::= b-normalized ( l-blk-empty-line-feed(n)* l-l-non-folded-chunk(n) )? 
; [135] value starting with non-folded text chunk 
l-l-non-folded-chunk(n) ::= ( l-empty-non-folded(n) | 
                              l-indented-non-folded(n) ) l-l-folded-value(n)? 
; [136] not folded due to specific line break 
l-empty-non-folded(n) ::= i-spaces(<n) b-specific 
; [137] not folded due to starting white space 
l-indented-non-folded(n) ::= i-spaces(n) s-char nb-char* b-normalized 

;; 4.6.8. Single Quoted

; [138 single quoted scalar 
c-c-single-quoted(n) ::= "'" nb-nb-single-quoted-value(n)? "'" 
; [139] value of a single quoted scalar 
nb-nb-single-quoted-value(n) ::= nb-nb-one-single-line | 
                               ( nb-l-first-single-line(n) l-l-inner-single-line(n)* i-nb-last-single-line(n) ) 
; [140] one line value of single quoted scalar 
nb-nb-one-single-line ::= nb-single-char+ 
; [141] first line of multi-line single quoted scalar 
nb-l-first-single-line(n) ::= ( nb-single-char* ns-single-char )? s-l-end-flow-line(n) 
; [142] inner line of multi-line single quoted scalar 
l-l-inner-single-line(n) ::= l-flow-empty-specific(n) | 
                           ( i-s-ignored-leading(n) ns-single-char nb-l-first-single-line(n) ) 
; [143] last line of multi-line single quoted scalar 
i-nb-last-single-line(n) ::= i-s-ignored-leading(n) ( ns-single-char nb-single-char* )? 
; [144] indicates a single quote 
ns-escaped-single-quote ::= "'" "'" 
; [145] non-break char valid in a single quoted scalar 
nb-single-char ::= ns-escaped-single-quote | 
                 ( nb-char - "'" ) 
; [146] non-space char valid in a single quoted scalar 
ns-single-char ::= nb-single-char - s-char 

;; 4.6.9. Escaping

; [147] escape character 
c-escape ::= "\" 
; [148] escaped backslash 
ns-esc-escape ::= "\" "\" 
; [149] escaped double quote character 
ns-esc-double-quote ::= "\" """ 
; [150] aSCII alert (BEL) 
ns-esc-bel ::= "\" "a" 
; [151] aSCII backspace (BS) 
ns-esc-backspace ::= "\" "b" 
; [152] aSCII escape (ESC) 
ns-esc-esc ::= "\" "e" 
; [153] aSCII formfeed (FF) 
ns-esc-form-feed ::= "\" "f" 
; [154] aSCII linefeed (LF) 
ns-esc-line-feed ::= "\" "n" 
; [155] aSCII carriage return (CR) 
ns-esc-return ::= "\" "r" 
; [156] aSCII horizontal tab (TAB) 
ns-esc-tab ::= "\" "t" 
; [157] aSCII vertical tab (VTAB) 
ns-esc-vertical-tab ::= "\" "v" 
; [158] aSCII hat (CIRCUMFLEX ACCENT) 
ns-esc-hat ::= "\" "^" 
; [159] aSCII zero (NUL) 
ns-esc-null ::= "\" "0" 
; [160] aSCII space (SP) 
ns-esc-space ::= "\" #20 
; [161] unicode non-breaking space (NBSP) 
ns-esc-non-breaking-space ::= "\" "_" 
; [162] unicode next line (NEL) 
ns-esc-next-line ::= "\" "N" 
; [163] unicode line separator (LS) 
ns-esc-line-separator ::= "\" "L" 
; [164] unicode paragraph separator (PS) 
ns-esc-paragraph-separator ::= "\" "P" 
; [165] 8-bit character 
ns-esc-8-bit ::= "\" "x" ( ns-hex-digit x 2 ) 
; [166] 16-bit character 
ns-esc-16-bit ::= "\" "u" ( ns-hex-digit x 4 ) 
; [167] 32-bit character 
ns-esc-32-bit ::= "\" "U" ( ns-hex-digit x 8 ) 
; [168] escape codes in escaped scalars 
ns-esc-sequence ::=              ns-esc-escape | 
                           ns-esc-double-quote | 
                                    ns-esc-bel | 
                              ns-esc-backspace | 
                                    ns-esc-esc | 
                              ns-esc-form-feed | 
                              ns-esc-line-feed | 
                                 ns-esc-return | 
                                    ns-esc-tab | 
                           ns-esc-vertical-tab | 
                                    ns-esc-hat | 
                                   ns-esc-null | 
                                  ns-esc-space | 
                     ns-esc-non-breaking-space | 
                              ns-esc-next-line | 
                         ns-esc-line-separator | 
                    ns-esc-paragraph-separator | 
                                  ns-esc-8-bit | 
                                 ns-esc-16-bit | 
                                 ns-esc-32-bit 
; [169] escaped (ignored) line break 
b-escaped ::= "\" b-any 

;; 4.6.10. Double Quoted

; [170] double quoted scalar 
c-c-double-quoted(n) ::= """ nb-nb-double-quoted-value(n)? """ 
; [171] value of a double quoted scalar 
nb-nb-double-quoted-value(n) ::= nb-nb-one-double-line | 
                                ( nb-l-first-double-line(n) l-l-inner-double-line(n)* i-nb-last-double-line(n) ) 
; [172] one line value of double quoted scalar 
nb-nb-one-double-line ::= nb-double-char+ 
; [173] first line of multi-line double quoted scalar 
nb-l-first-double-line(n) ::= ( nb-double-char* ns-double-char )? s-l-end-double-line(n) 
; [174] inner line of multi-line double quoted scalar 
l-l-inner-double-line(n) ::= l-flow-empty-specific(n) | 
                           ( i-s-ignored-leading(n) ns-double-char nb-l-first-double-line(n) ) 
; [175] last line of multi-line double quoted scalar 
i-nb-last-double-line(n) ::= i-s-ignored-leading(n) ( ns-double-char nb-double-char* )? 
; [176] end of a line in a multi-line double quoted scalar 
s-l-end-double-line(n) ::= s-l-end-flow-line(n) | 
                         ( s-char* b-escaped ) 
; [177] non-break char valid in a double quoted scalar 
nb-double-char ::= ns-esc-sequence | 
                 ( nb-char - "\" ) 
; [178] non-space char valid in a double quoted scalar 
ns-double-char ::= nb-double-char - s-char 

;; 4.6.11. Plain

; [179] avoiding top indicator chars 
ns-ns-plain-top(n) ::= ns-ns-plain-value(n) 
; [180] avoiding flow indicator chars 
ns-ns-plain-flow(n) ::= ns-ns-plain-value(n) 
; [181] plain scalar used as a key; avoiding flow indicator chars 
ns-ns-plain-key ::= ns-ns-one-plain-line 
; [182] plain scalar used as a value 
ns-ns-plain-value(n) ::= ns-ns-one-plain-line | 
                       ( ns-l-first-plain-line(n) l-l-inner-plain-line(n)* i-ns-last-plain-line(n) ) 
; [183] plain one-line value 
ns-ns-one-plain-line ::= ns-first-plain-char nb-ns-plain-text? 
; [184} first line of multi-line plain scalar 
ns-l-first-plain-line(n) ::= ns-ns-one-plain-line s-l-end-flow-line(n) 
; [185] inner line of multi-line plain scalar 
l-l-inner-plain-line(n) ::= l-flow-empty-specific(n) | 
        ( i-s-ignored-leading(n) ns-plain-char nb-ns-plain-text? s-l-end-flow-line(n) ) 
; [186]last line of multi-line plain scalar
i-ns-last-plain-line(n) ::= i-s-ignored-leading(n) ( ns-plain-char nb-ns-plain-text? )? 
; [187] chunk of plain text 
nb-ns-plain-text ::= nb-plain-char* ns-plain-char 
; [188] first character in a plain scalar 
ns-first-plain-char ::= ( ns-plain-char - c-indicators ) | 
                      ( ( "-" | 
                          "?" | 
                          ":" | 
                          "," ) ns-plain-char ) 
; [189] char allowed in plain scalar used as top level value 
nb-plain-top-char ::= ( nb-char - ":" - "#" ) | 
                      ( ns-plain-char "#" ) | 
                      ( ":" ns-plain-char ) 
; [190] char allowed in plain scalar used as value in a flow collection 
nb-plain-flow-char ::= ( nb-plain-top-char - "[" - "]" - "{" - "}" - "," ) | 
                       ( "," ns-plain-char ) 
; [191] char allowed in plain scalar used as key 
nb-plain-key-char ::= nb-plain-flow-char 
; [192] depending whether reached from top, flow or key plain scalar production 
nb-plain-char ::= nb-plain-top-char | 
                  nb-plain-flow-char | 
                  nb-plain-key-char 
; [193] non-space char valid in a plain scalar 
ns-plain-char ::= nb-plain-char - s-char