blob: fada8fe59de71cd8f29c93f32769d23a0784a6ef (
plain) (
blame)
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
|
discard """
targets: "c cpp"
matrix: "--mm:refc; --mm:arc"
"""
type
GlobNodeKind = enum
LiteralIdent,
Group
GlobNode = object
case kind: GlobNodeKind
of LiteralIdent:
value: string
of Group:
values: seq[string]
PathSegment = object
children: seq[GlobNode]
GlobPattern = seq[PathSegment]
proc parseImpl(): GlobPattern =
if result.len == 0:
result.add PathSegment()
result[^1].children.add GlobNode(kind: LiteralIdent)
block:
const pattern = parseImpl()
doAssert $pattern == """@[(children: @[(kind: LiteralIdent, value: "")])]"""
|