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
|
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
|
-
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
assert _parse(c_style).doc == "Do we get a comment?"
def multiline_ps1():
ps1_style= """
<#
# api: cpp
# title: second
version: 2.1
# version: 2.1
# category: nonpython
#
# Won't work without hashes
# Didn't work without hashes
#>
"""
print(_parse(ps1_style))
assert _parse(ps1_style).version == "2.1"
# requires adapting the continuation line detection (including spaced points)
# and detecting multiline markers, and stripping them (end up in doc else)
# Required adapting the continuation line detection (including spaced points).
# Multiline enclosures contents are now captured, thus trailign #> or */ stripped.
ps1_style= """
<#
api: cpp
title: second
version: 2.2
category: nonpython
config: {name:x}
{name:y}
priority: bad
Didn't work without hashes
#>
"""
# Notably will only work with up to 3 spaces. Acceptable format constraint,
# but makes continuation less readable
print(_parse(ps1_style))
assert _parse(ps1_style).version == "2.2"
assert len(_parse(ps1_style).config) == 2
assert _parse(ps1_style).priority == "bad"
# should still migrate to hash() detection and regex generation
def indent_cpp():
cpp_style= """
// api: cpp
// title: third
// version: 3.3
// category: doubleprefix
//
// Basically just // instead of #
"""
assert _parse(cpp_style).version == "3.3"
|