diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2014-10-29 14:56:55 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2014-10-29 14:56:55 -0700 |
commit | 1a00fe4ea75924bfe594c4d92073cc95eaa2f32d (patch) | |
tree | a6e8992e0821a998236a4dfb5d6f6194a0b7ce97 /src/ast/script.hpp | |
parent | 469991120bcf550b6e2124203103876b6b7be918 (diff) | |
download | tmwa-1a00fe4ea75924bfe594c4d92073cc95eaa2f32d.tar.gz tmwa-1a00fe4ea75924bfe594c4d92073cc95eaa2f32d.tar.bz2 tmwa-1a00fe4ea75924bfe594c4d92073cc95eaa2f32d.tar.xz tmwa-1a00fe4ea75924bfe594c4d92073cc95eaa2f32d.zip |
Item AST
Diffstat (limited to 'src/ast/script.hpp')
-rw-r--r-- | src/ast/script.hpp | 24 |
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 |