- Task 1: OCaml/dune scaffold with woc CLI (exit codes 0/1/2), just woc-build/woc-test - Task 2: Diagnostics module — WO-E coded diagnostics with excerpts, related sites, ordered dedup collector, exit-code decision - Task 3: Newline-significant lexer mirroring rt conventions (self/me/subscribe/insert stay idents), --dump-tokens, golden test framework with bless mode - Task 4: Declaration parser — class/type/interface/fn signatures, @gc/@table annotations, brace-depth skip-on-block (service/policy/on), decl-level recovery, --dump-ast goldens - 13 golden fixtures (tokens + AST) with WOC_BLESS=1 support - just woc-test green (14 diag + 93 runner checks)
33 lines
651 B
Text
33 lines
651 B
Text
-- representative token fixture: comments, newlines, literals, annotations, punctuation
|
|
@table(name: "products", index: [name])
|
|
class Product {
|
|
let name: Text = "widget"
|
|
let price: Int = 42
|
|
let tags: [Text] = []
|
|
let in_stock: Bool = true
|
|
|
|
fn discounted(pct: Int) -> Int {
|
|
let cut = self.price * pct / 100
|
|
if cut >= self.price {
|
|
return 0
|
|
} else {
|
|
return self.price - cut
|
|
}
|
|
}
|
|
|
|
fn total(counts: [Int]) -> Int {
|
|
let sum = 0
|
|
for n in counts {
|
|
sum = sum + n
|
|
}
|
|
return sum
|
|
}
|
|
|
|
fn clearance() -> Bool {
|
|
let ok = self.price <= 50
|
|
while ok {
|
|
return false
|
|
}
|
|
return ok
|
|
}
|
|
}
|