File: unicode.tml

package info (click to toggle)
libyaml-tiny-perl 1.64-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 556 kB
  • ctags: 80
  • sloc: perl: 1,363; makefile: 2
file content (440 lines) | stat: -rw-r--r-- 7,164 bytes parent folder | download | duplicates (15)
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
# Test unicode strings in key and value contexts

%TestML 0.1.0

###
# These tests target unicode characters that are handled special or known to be
# problematic. Test YNY (YAML→Native→YAML) and NYN roundtripping.
#
# YAML scalar emission does quoting based on first character, presence of
# escape characters, and special ambiguous cases like ': '. These ones
# character strings go a long way towards making sure an implementation is
# correct.
###


# Make a mapping { "$code" : "$code" } where code is a unicode code point:

# Dump mapping matches *yaml
*code.dump_code_key_value == *yaml

# Load *yaml then dump matches *yaml
*yaml.load_yaml.dump_yaml == *yaml

# Dump mapping the load memory-matches mapping
*code.code_key_value.dump_yaml.load_yaml === *code.code_key_value


# 0 → \0 "null"
#
# \z is the other YAML "null" encoding. Most implementations (including
# libyaml), seem to go with \0 when emitting.
=== Code point 0
--- code: 0
--- yaml
"\0": "\0"


# 1-6,14-27,29-31 → \x##
=== Code point 1
--- code: 1
--- yaml
"\x01": "\x01"


# 7 → \a "bell" (alarm)
=== Code point 7
--- code: 7
--- yaml
"\a": "\a"


# 8 → \b "backspace"
=== Code point 8
--- code: 8
--- yaml
"\b": "\b"


# 9 → \t "horizontal tab"
=== Code point 9
--- code: 9
--- yaml
"\t": "\t"


# 10 → \n "linefeed" (newline)
=== Code point 10
--- code: 10
--- yaml
"\n": "\n"


# 11 → \v "vertical tab"
=== Code point 11
--- code: 11
--- yaml
"\v": "\v"


# 11 → \f "form feed"
=== Code point 12
--- code: 12
--- yaml
"\f": "\f"


# 11 → \f "carriage return"
=== Code point 13
--- code: 13
--- yaml
"\r": "\r"

# 27 → \e "escape"
=== Code point 27
--- code: 27
--- yaml
"\e": "\e"


# Space character needs quotes.
=== Code point 32
--- code: 32
--- yaml
' ': ' '


# ! is a tag indicator. Needs quotes.
=== Code point 33
--- code: 33
--- yaml
'!': '!'


# Quote single quotes with double quotes.
=== Code point 34
--- code: 34
--- yaml
'"': '"'


# '#' is comment character. Needs quotes.
=== Code point 35
--- code: 35
--- yaml
'#': '#'


# $ has no special meaning. No quotes.
=== Code point 36
--- code: 36
--- yaml
$: $


# % is directive indicator. Needs quotees.
=== Code point 37
--- code: 37
--- yaml
'%': '%'


# & is anchor indicator. Needs quotes.
=== Code point 38
--- code: 38
--- yaml
'&': '&'


# Quote double quotes with single quotes.
=== Code point 39
--- code: 39
--- yaml
"'": "'"


# ( has no special meaning. No quotes.
=== Code point 40
--- code: 40
--- yaml
(: (


# ) has no special meaning. No quotes.
=== Code point 41
--- code: 41
--- yaml
): )


# * is an alias indicator. Needs quotes.
=== Code point 42
--- code: 42
--- yaml
'*': '*'


# + has no special meaning. No quotes.
=== Code point 43
--- code: 43
--- yaml
+: +


# , is a list separator. Needs quotes.
=== Code point 44
--- code: 44
--- yaml
',': ','


# - is a sequence element marker. In many contexts it is not ambiguous when
# unquoted, but in others it is ambiguous. libyaml always quotes it so going
# with that for now.
=== Code point 45
--- code: 45
--- yaml
'-': '-'


# . has no special meaning. No quotes.
=== Code point 46
--- code: 46
--- yaml
.: .


# / has no special meaning. No quotes.
=== Code point 47
--- code: 47
--- yaml
/: /


# 48-57 → 0-9 "digitss"
# These values are strings, so must quote them.
=== Code point 48
--- code: 48
--- yaml
'0': '0'


# : is a key/value separator. It is not always ambigous when not quoted, but
# libyaml always quotes it at start of a string. Probably wise. Going with that
# for now.
=== Code point 58
--- code: 58
--- yaml
':': ':'


# ; has no special meaning. No quotes.
=== Code point 59
--- code: 59
--- yaml
;: ;


# < has no special meaning. No quotes.
=== Code point 60
--- code: 60
--- yaml
<: <


# = has no special meaning. No quotes.
=== Code point 61
--- code: 61
--- yaml
=: =


# > is a folded scalar indicator. Needs quotes.
=== Code point 62
--- code: 62
--- yaml
'>': '>'


# ? is a mapping key indicator. Needs quotes.
=== Code point 63
--- code: 63
--- yaml
'?': '?'


# @ is a reserved character. Needs quotes.
# TODO Check spec on this.
=== Code point 64
--- code: 64
--- yaml
'@': '@'


# 65-90 → A-Z "upper case letters". No quotes.
=== Code point 65
--- code: 65
--- yaml
A: A


# Some implementations think N means false. This should not be the case in a
# default schema. No quotes.
#
# NOTE:
#   http://yaml.org/type/bool.html suggests that many simple strings should be
#   loaded as boolean, but this is an outdated concept. Currently, only the
#   words true/false/null (lower case) should be loaded specially (not as
#   strings).  This may become even more restrictive in the future. ie Only
#   true/false/null in a flow context.
=== Code point 78
--- code: 78
--- yaml
N: N


# Some implementations think Y means true. This should not be the case in a
# default schema. No quotes.
=== Code point 89
--- code: 89
--- yaml
Y: Y


# [ is a flow sequence start indicator. Needs quotes.
=== Code point 91
--- code: 91
--- yaml
'[': '['


# \ is an escape indicator in double quoted strings. Used on its own it has no
# special meaning. No quotes.
=== Code point 92
--- SKIP
--- code: 92
--- yaml
\: \


# ] is a flow sequence end indicator. Needs quotes.
=== Code point 93
--- code: 93
--- yaml
']': ']'


# ^ has no special meaning. No quotes.
=== Code point 94
--- code: 94
--- yaml
^: ^


# _ has no special meaning. No quotes.
=== Code point 95
--- code: 95
--- yaml
_: _


# ` is a reserved character. Needs quotes.
=== Code point 96
--- code: 96
--- yaml
'`': '`'


# 65-90 → a-z "lower case letters". No quotes.
=== Code point 97
--- code: 97
--- yaml
a: a


# Some implementations think n means false. This should not be the case in a
# default schema. No quotes.
=== Code point 110
--- code: 110
--- yaml
n: n


# Some implementations think y means true. This should not be the case in a
# default schema. No quotes.
=== Code point 121
--- code: 121
--- yaml
y: y


# { is a flow mapping start indicator. Needs quotes.
=== Code point 123
--- code: 123
--- yaml
'{': '{'


# | is a literal scalar indicator. Needs quotes.
=== Code point 124
--- code: 124
--- yaml
'|': '|'


# } is a flow mapping end indicator. Needs quotes.
=== Code point 125
--- code: 125
--- yaml
'}': '}'


# A single ~ has long been used as a plain scalar representation of null. This
# should be deprecated, but may take a while.
=== Code point 126
--- code: 126
--- yaml
'~': '~'
--- unquoted
~: ~


# 127 → "escape"
# YAML does not have a special character. YAML2 should consider \?.
=== Code point 127
--- code: 127
--- yaml
"\x7F": "\x7F"


# 80-84,86-159 → \x##
=== Code point 128
--- code: 128
--- yaml
"\x80": "\x80"


# 133 (\x85) → "next line" (NEL)
=== Code point 133
--- code: 133
--- yaml
"\N": "\N"


# 160 (\xA0) → "non-breaking space"
# It seems extremely odd that YAML does not escape this.
# Investigate further.
=== Code point 160
--- SKIP
--- code: 160
--- yaml
 :  


# 161-… → From here on up use printable unicode chars.
# XXX Need to look into other special code blocks. Especially those known to
# libyaml.
=== Code point 161
--- code: 161
--- yaml
¡: ¡