aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/v2script/SimpleGrammar.hpp
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2024-05-11 20:37:50 +0200
committer Spartan322 <Megacake1234@gmail.com>2024-05-11 22:27:30 +0200
commit458180da5e61887cd9f820e573f307d0a640128d (patch)
treec0b7aa641b72b5f2650691cba22d17de335622f6 /src/openvic-dataloader/v2script/SimpleGrammar.hpp
parent725310939d2b324d79ea4193a72000e21dcc1a2a (diff)
Fix bugs in #37fix/error-handling
Fix error handling dropping errors Fix error handling segfaults Improve error messages
Diffstat (limited to 'src/openvic-dataloader/v2script/SimpleGrammar.hpp')
-rw-r--r--src/openvic-dataloader/v2script/SimpleGrammar.hpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/openvic-dataloader/v2script/SimpleGrammar.hpp b/src/openvic-dataloader/v2script/SimpleGrammar.hpp
index bd4adaa..731a7f1 100644
--- a/src/openvic-dataloader/v2script/SimpleGrammar.hpp
+++ b/src/openvic-dataloader/v2script/SimpleGrammar.hpp
@@ -5,6 +5,8 @@
#include <lexy/callback.hpp>
#include <lexy/dsl.hpp>
+#include <lexy/dsl/identifier.hpp>
+#include <lexy/dsl/symbol.hpp>
#include "detail/dsl.hpp"
@@ -37,12 +39,14 @@ namespace ovdl::v2script::grammar {
/* REQUIREMENTS: DAT-631 */
static constexpr auto comment_specifier = LEXY_LIT("#") >> lexy::dsl::until(lexy::dsl::newline).or_eof();
+ static constexpr auto ascii = lexy::dsl::ascii::alpha_digit_underscore / LEXY_ASCII_ONE_OF("+:@%&'-.");
+
/* REQUIREMENTS:
* DAT-632
* DAT-635
*/
static constexpr auto windows_1252_data_specifier =
- lexy::dsl::ascii::alpha_digit_underscore / LEXY_ASCII_ONE_OF("+:@%&'-.") /
+ ascii /
lexy::dsl::lit_b<0x8A> / lexy::dsl::lit_b<0x8C> / lexy::dsl::lit_b<0x8E> /
lexy::dsl::lit_b<0x92> / lexy::dsl::lit_b<0x97> / lexy::dsl::lit_b<0x9A> / lexy::dsl::lit_b<0x9C> /
dsl::make_range<0x9E, 0x9F>() /
@@ -74,6 +78,8 @@ namespace ovdl::v2script::grammar {
.map<'r'>('\r')
.map<'t'>('\t');
+ static constexpr auto id = lexy::dsl::identifier(data_char_class);
+
template<ParseOptions Options>
struct SimpleGrammar {
struct StatementListBlock;
@@ -194,14 +200,14 @@ namespace ovdl::v2script::grammar {
template<ovdl::detail::string_literal Keyword, auto Production, auto Value = dsl::default_kw_value<ast::ParseState, ast::IdentifierValue, Keyword>>
using keyword_rule = dsl::keyword_rule<
ast::ParseState,
- Identifier<StringEscapeOption>,
+ id,
ast::AssignStatement,
Keyword, Production, Value>;
template<ovdl::detail::string_literal Keyword, auto Production, auto Value = dsl::default_kw_value<ast::ParseState, ast::IdentifierValue, Keyword>>
using fkeyword_rule = dsl::fkeyword_rule<
ast::ParseState,
- Identifier<StringEscapeOption>,
+ id,
ast::AssignStatement,
Keyword, Production, Value>;