diff options
| author | Xe Iaso <me@xeiaso.net> | 2024-06-03 05:13:59 -0700 |
|---|---|---|
| committer | Xe Iaso <me@xeiaso.net> | 2024-06-03 05:14:07 -0700 |
| commit | fef70c0c27a39480dd4559b9e8cb97e5b67e3fa9 (patch) | |
| tree | 140f3f297de31c52268e0de9627d22e8e9856dd2 /cmd | |
| parent | 8971b06cd4fb9cdd5a6280b7f7dc88d61effbfaf (diff) | |
| download | x-fef70c0c27a39480dd4559b9e8cb97e5b67e3fa9.tar.xz x-fef70c0c27a39480dd4559b9e8cb97e5b67e3fa9.zip | |
cmd/hlang: fix grammar link
Signed-off-by: Xe Iaso <me@xeiaso.net>
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/hlang/h/parser.go | 6 | ||||
| -rw-r--r-- | cmd/hlang/http.go | 3 |
2 files changed, 9 insertions, 0 deletions
diff --git a/cmd/hlang/h/parser.go b/cmd/hlang/h/parser.go index 9e9c43f..13d20ed 100644 --- a/cmd/hlang/h/parser.go +++ b/cmd/hlang/h/parser.go @@ -3,12 +3,18 @@ package h //go:generate peggy -o h_gen.go h.peg import ( + "embed" "fmt" "github.com/eaburns/peggy/peg" "within.website/x/langs/jbo/namcu" ) +var ( + //go:embed h.peg + Grammar embed.FS +) + func (p *_Parser) Parse() (int, bool) { pos, perr := _HAccepts(p, 0) return perr, pos >= 0 diff --git a/cmd/hlang/http.go b/cmd/hlang/http.go index 2ab3d6b..d581b03 100644 --- a/cmd/hlang/http.go +++ b/cmd/hlang/http.go @@ -11,6 +11,7 @@ import ( "github.com/a-h/templ" "github.com/rs/cors" + "within.website/x/cmd/hlang/h" "within.website/x/cmd/hlang/run" "within.website/x/xess" ) @@ -28,6 +29,8 @@ func doHTTP() error { http.Handle("/play", templ.Handler(xess.Base("Playground", nil, navbar(), playgroundPage(), footer()))) http.HandleFunc("/api/playground", runPlayground) + http.Handle("/grammar/", http.StripPrefix("/grammar/", http.FileServer(http.FS(h.Grammar)))) + srv := &http.Server{ Addr: ":" + *port, Handler: cors.Default().Handler(http.DefaultServeMux), |
