aboutsummaryrefslogtreecommitdiff
path: root/src/openvic-dataloader/v2script/SimpleGrammar.hpp
diff options
context:
space:
mode:
author George L. Albany <Megacake1234@gmail.com>2024-05-13 22:50:54 +0200
committer GitHub <noreply@github.com>2024-05-13 22:50:54 +0200
commita5a6ff376cf0ff8fa48fcd750c16395b099223a4 (patch)
treec0b7aa641b72b5f2650691cba22d17de335622f6 /src/openvic-dataloader/v2script/SimpleGrammar.hpp
parent725310939d2b324d79ea4193a72000e21dcc1a2a (diff)
parent458180da5e61887cd9f820e573f307d0a640128d (diff)
Merge pull request #44 from OpenVicProject/fix/error-handling
Fix bugs in #37
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>;