From 7d5d86e44ebbd907c690023b4546a0ae0a37de3a Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Fri, 20 Oct 2023 16:39:26 -0400 Subject: Add grammar support for BEL, HT, LF, and CR characters Add stripping of LF and CR characters if `v2script::grammar::StringExpression`'s `Options::NoStringEscape` is false --- .../v2script/AbstractSyntaxTree.hpp | 26 +++++++++++----------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'include/openvic-dataloader') diff --git a/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp b/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp index 8ff910f..32e7e42 100644 --- a/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp +++ b/include/openvic-dataloader/v2script/AbstractSyntaxTree.hpp @@ -166,9 +166,9 @@ namespace ovdl::v2script::ast { struct AbstractStringNode : public Node { std::string _name; AbstractStringNode(); - AbstractStringNode(std::string&& name); + AbstractStringNode(std::string&& name, bool allow_newline); AbstractStringNode(NodeLocation location); - AbstractStringNode(NodeLocation location, std::string&& name); + AbstractStringNode(NodeLocation location, std::string&& name, bool allow_newline); OVDL_TYPE_DEFINE_SELF; OVDL_RT_TYPE_DEF; OVDL_PRINT_FUNC_DEF; @@ -176,17 +176,17 @@ namespace ovdl::v2script::ast { constexpr std::string_view get_base_type() const override { return ::ovdl::detail::type_name>(); } }; -#define OVDL_AST_STRING_NODE(NAME) \ - struct NAME final : public AbstractStringNode { \ - NAME(); \ - NAME(std::string&& name); \ - NAME(lexy::nullopt); \ - NAME(NodeLocation location); \ - NAME(NodeLocation location, std::string&& name); \ - NAME(NodeLocation location, lexy::nullopt); \ - OVDL_TYPE_DEFINE_SELF; \ - OVDL_RT_TYPE_DEF; \ - OVDL_PRINT_FUNC_DEF; \ +#define OVDL_AST_STRING_NODE(NAME) \ + struct NAME final : public AbstractStringNode { \ + NAME(); \ + NAME(std::string&& name, bool allow_newline = true); \ + NAME(lexy::nullopt); \ + NAME(NodeLocation location); \ + NAME(NodeLocation location, std::string&& name, bool allow_newline = true); \ + NAME(NodeLocation location, lexy::nullopt); \ + OVDL_TYPE_DEFINE_SELF; \ + OVDL_RT_TYPE_DEF; \ + OVDL_PRINT_FUNC_DEF; \ } // Value Expression Nodes -- cgit v1.2.3-56-ga3b1