From 579ad42ce99848639bc0eccebc198466d04aef0d Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Sat, 9 Sep 2023 18:40:11 -0400 Subject: Add requirement comments Moved compound value expression to ValueExpression rule Fulfills: DAT-23, DAT-26, DAT-28, DAT-29, DAT-626, DAT-627, DAT-628, DAT-630, DAT-631, DAT-632, DAT-633, DAT-634, DAT-635, DAT-636, DAT-638, DAT-639, DAT-640, DAT-641, DAT-642, DAT-643 --- src/openvic-dataloader/v2script/Parser.cpp | 6 +++++ src/openvic-dataloader/v2script/SimpleGrammar.hpp | 31 +++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) (limited to 'src/openvic-dataloader') diff --git a/src/openvic-dataloader/v2script/Parser.cpp b/src/openvic-dataloader/v2script/Parser.cpp index 1258bca..0ff7612 100644 --- a/src/openvic-dataloader/v2script/Parser.cpp +++ b/src/openvic-dataloader/v2script/Parser.cpp @@ -160,6 +160,12 @@ constexpr Parser& Parser::load_from_file(const detail::Has_c_str auto& path) { return load_from_file(path.c_str()); } +/* REQUIREMENTS: + * DAT-23 + * DAT-26 + * DAT-28 + * DAT-29 + */ bool Parser::simple_parse() { if (!_buffer_handler->is_valid()) { return false; diff --git a/src/openvic-dataloader/v2script/SimpleGrammar.hpp b/src/openvic-dataloader/v2script/SimpleGrammar.hpp index 3e9a96e..d478bdf 100644 --- a/src/openvic-dataloader/v2script/SimpleGrammar.hpp +++ b/src/openvic-dataloader/v2script/SimpleGrammar.hpp @@ -12,12 +12,27 @@ #include "detail/LexyLitRange.hpp" // Grammar Definitions // +/* REQUIREMENTS: + * DAT-626 + * DAT-627 + * DAT-628 + * DAT-636 + * DAT-641 + * DAT-642 + * DAT-643 + */ namespace ovdl::v2script::grammar { struct StatementListBlock; + /* REQUIREMENTS: DAT-630 */ static constexpr auto whitespace_specifier = lexy::dsl::ascii::blank / lexy::dsl::ascii::newline; + /* REQUIREMENTS: DAT-631 */ static constexpr auto comment_specifier = LEXY_LIT("#") >> lexy::dsl::until(lexy::dsl::newline).or_eof(); + /* REQUIREMENTS: + * DAT-632 + * DAT-635 + */ static constexpr auto data_specifier = lexy::dsl::ascii::alpha_digit_underscore / LEXY_ASCII_ONE_OF("%&'") / lexy::dsl::lit_c<0x2B> / LEXY_ASCII_ONE_OF("-.") / @@ -39,6 +54,10 @@ namespace ovdl::v2script::grammar { }); }; + /* REQUIREMENTS: + * DAT-633 + * DAT-634 + */ struct StringExpression { static constexpr auto escaped_symbols = lexy::symbol_table // .map<'"'>('"') @@ -70,11 +89,17 @@ namespace ovdl::v2script::grammar { }); }; + /* REQUIREMENTS: DAT-638 */ + struct ValueExpression { + static constexpr auto rule = lexy::dsl::p | lexy::dsl::p; + static constexpr auto value = lexy::forward; + }; + struct SimpleAssignmentStatement { static constexpr auto rule = lexy::dsl::position(lexy::dsl::p) >> lexy::dsl::equal_sign + - (lexy::dsl::p | lexy::dsl::p | lexy::dsl::recurse_branch); + (lexy::dsl::p | lexy::dsl::recurse_branch); static constexpr auto value = lexy::callback( [](const char* pos, auto name, auto&& initalizer) { @@ -82,11 +107,12 @@ namespace ovdl::v2script::grammar { }); }; + /* REQUIREMENTS: DAT-639 */ struct AssignmentStatement { static constexpr auto rule = lexy::dsl::position(lexy::dsl::p) >> (lexy::dsl::equal_sign >> - (lexy::dsl::p | lexy::dsl::p | lexy::dsl::recurse_branch) | + (lexy::dsl::p | lexy::dsl::recurse_branch) | lexy::dsl::else_ >> lexy::dsl::return_) | lexy::dsl::p; @@ -102,6 +128,7 @@ namespace ovdl::v2script::grammar { }); }; + /* REQUIREMENTS: DAT-640 */ struct StatementListBlock { static constexpr auto rule = lexy::dsl::position(lexy::dsl::curly_bracketed.open()) >> -- cgit v1.2.3-56-ga3b1