engine: resources, lang: funcs, parser: Add panic magic
It's valuable to check your runtime values and to shut down the entire engine in case something doesn't match. This patch adds some magic plumbing to support a "panic" mechanism. A new "panic" statement gets transparently converted into a panic function and panic resource. The former errors if the input is not empty. The latter must be present to consume the value, but doesn't actually do anything.
This commit is contained in:
@@ -231,6 +231,11 @@
|
||||
}
|
||||
return BOOL
|
||||
}
|
||||
/panic/ {
|
||||
yylex.pos(lval) // our pos
|
||||
lval.str = yylex.Text()
|
||||
return PANIC_IDENTIFIER
|
||||
}
|
||||
/"(\\.|[^"])*"/
|
||||
{ // This matches any number of the bracketed patterns
|
||||
// that are surrounded by the two quotes on each side.
|
||||
|
||||
Reference in New Issue
Block a user