selfPath
untyped stringselfPath is where this realm answers, used to build the try-it links.
Value
"/r/moul/x/daily/shuntingyarddemo/v0:"
worked
[]struct{...}worked are the expressions on the root page. Each one is here because it groups in a way the naive left-to-right reading gets wrong.
- OID
- 053881…3dde:4
worked details
refused
[]stringrefused are the inputs worth showing precisely because nothing panics on them. A realm that renders a stored expression is one bad input away from a permanently broken page, and a public path cannot be redeployed.
- OID
- 053881…3dde:14
refused details
Render
func(path string) stringRender renders the demo for gnoweb. Render("") -> the demo page Render("?e=<expr>") -> the three stages for one expression
- OID
- 053881…3dde:15
Render details
renderIndex
func() stringrenderIndex is the fixed page: what the algorithm does, and what it refuses.
- OID
- 053881…3dde:17
renderIndex details
renderOne
func(expr string) stringrenderOne shows the three stages for one caller-supplied expression. The raw query string and every error message go through ui.Inline: both can carry whatever byte the caller sent, and until they are escaped they are attacker-controlled markdown. Tokens and the RPN do not, and are shown as code spans instead. Tokenize accepts a closed alphabet (digits, parentheses and the six operator bytes) and rejects everything else, so a token can only ever spell itself. Running those through ui.Inline would put a literal backslash inside a code span, where markdown does not process escapes, so escaping there makes the page wrong rather than safer.
- OID
- 053881…3dde:18
renderOne details
trace
func(expr string) (string, string)trace returns the RPN and the value of an expression, as display strings. A failure renders as its error, because the refusals are part of the demo.
- OID
- 053881…3dde:19
trace details
tryLink
func(expr string) stringtryLink builds a link to this realm's own ?e= page. The escape is not decoration: a '+' in a query string decodes to a space, so an unescaped "2+3" would reach the parser as "2 3" and be rejected as two numbers in a row.
- OID
- 053881…3dde:20
tryLink details
kindName
func(k v0.Kind) stringkindName names a token kind for the table.
- OID
- 053881…3dde:21