summaryrefslogtreecommitdiff
path: root/src/ast/script.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ast/script.hpp')
-rw-r--r--src/ast/script.hpp24
1 files changed, 19 insertions, 5 deletions
diff --git a/src/ast/script.hpp b/src/ast/script.hpp
index 59e53f0..da43f90 100644
--- a/src/ast/script.hpp
+++ b/src/ast/script.hpp
@@ -22,14 +22,14 @@
#include "../compat/result.hpp"
-#include "../io/line.hpp"
+#include "../io/span.hpp"
namespace tmwa
{
-namespace script
+namespace ast
{
-namespace parse
+namespace script
{
using io::Spanned;
@@ -39,7 +39,21 @@ namespace parse
io::LineSpan span;
};
- Result<ScriptBody> parse_script_body(io::LineCharReader& lr);
+ struct ScriptOptions
+ {
+ // don't require a label at the beginning
+ bool implicit_start = false;
+ // label to generate at the beginning if not already present
+ RString default_label;
+ // beginning must be only 'end;'
+ bool no_start;
+ // don't requite an 'end;' at the end
+ bool implicit_end = false;
+ // forbid newlines anywhere between { and }
+ bool one_line = false;
+ };
+
+ Result<ScriptBody> parse_script_body(io::LineCharReader& lr, ScriptOptions opt);
/*
(-- First bare-body-chunk only allowed for npcs, items, magic, functions.
@@ -89,6 +103,6 @@ namespace parse
simple-expr: variable ("[" expr "]")?
simple-expr: function // no longer command/label though
*/
-} // namespace parse
} // namespace script
+} // namespace ast
} // namespace tmwa