crosslang/golang-lean/GolangLean/Scanner.lean
Maximus Gorog fd3d42ae33 Add 'golang-lean/' from commit 'f5f17019224c6a6c319387214ceb8e29d09251c6'
git-subtree-dir: golang-lean
git-subtree-mainline: 6487c7046f
git-subtree-split: f5f1701922
2026-05-12 02:59:14 -06:00

18 lines
583 B
Text

import GolangLean.Token
import GolangLean.Error
namespace GolangLean
/-! # Scanner — port of `go/scanner/scanner.go`.
Stub. The real implementation is a hand-written DFA over UTF-8 byte input,
faithful to the upstream Go scanner. We start with a `notImpl` sentinel so
the project compiles, then fill in token-by-token alongside the parser. -/
partial def scan (src : String) : Except GoError (Array Token) := do
if src.isEmpty then
return #[⟨.eof, ⟨1, 1, 0⟩⟩]
else
.error (.notImpl "Scanner.scan: see go-upstream/src/go/scanner/scanner.go")
end GolangLean