Skip to content

Commit 107c1be

Browse files
committed
WIP BROKEN: Base DSL on DSLTree
1 parent de5220b commit 107c1be

File tree

6 files changed

+2159
-2074
lines changed

6 files changed

+2159
-2074
lines changed

Sources/VariadicsGenerator/VariadicsGenerator.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,13 @@ struct VariadicsGenerator: ParsableCommand {
251251
output(" init(")
252252
outputForEach(0..<arity, separator: ", ") { "_ x\($0): T\($0)" }
253253
output(") {\n")
254-
output(" \(patternProtocolRequirementName) = .init(ast: concat(\n ")
254+
output(" \(patternProtocolRequirementName) = .init(node: .concatenation([\n ")
255255
outputForEach(
256256
0..<arity, separator: ", ", lineTerminator: ""
257257
) { i in
258-
"x\(i).\(patternProtocolRequirementName).ast.root"
258+
"x\(i).\(patternProtocolRequirementName).root"
259259
}
260-
output("))\n")
260+
output("]))\n")
261261
output(" }\n}\n\n")
262262

263263
// Emit concatenation builders.

Sources/_StringProcessing/Compiler.swift

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,23 @@ struct RegexProgram {
1717
}
1818

1919
class Compiler {
20-
let ast: AST
20+
let tree: DSLTree
21+
22+
// TODO: Or are these stored on the tree?
2123
var options = MatchingOptions()
2224

2325
init(ast: AST) {
24-
self.ast = ast
26+
self.tree = ast.dslTree
27+
}
28+
29+
init(tree: DSLTree) {
30+
self.tree = tree
2531
}
2632

2733
__consuming func emit() throws -> RegexProgram {
2834
// TODO: Handle global options
29-
let converted = ast.root.dslTreeNode
30-
3135
var codegen = ByteCodeGen(options: options)
32-
try codegen.emitNode(converted)
36+
try codegen.emitNode(tree.root)
3337
let program = codegen.finish()
3438
return RegexProgram(program: program)
3539
}

0 commit comments

Comments
 (0)