summaryrefslogtreecommitdiffstats
path: root/src/parse.y
diff options
context:
space:
mode:
Diffstat (limited to 'src/parse.y')
-rw-r--r--src/parse.y14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/parse.y b/src/parse.y
index 46f5ff6..28f13ad 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -2,6 +2,7 @@
%type SYMBOL_UC {std::string *} str
%type SYMBOL_LC {std::string *} str
%type BLOCK {std::string *} str
+%type STRING {std::string *} str
%type CHAR {char} c
%type rule {solar::rule_t *}
@@ -65,7 +66,7 @@ grammar |= grammar EXTRA_ARG BLOCK(type) varname(name) {
}
-rule |= SYMBOL_LC(lhs) '|' '=' rhs(rhs) action(action) {
+rule |= SYMBOL_LC(lhs) "|=" rhs(rhs) action(action) {
auto *ret = new solar::rule_t {solar::item_t(*lhs, rhs->first), rhs->second, *action};
delete lhs;
@@ -98,6 +99,17 @@ rhs |= rhs(rhs) symbol(sym) '(' varname(var) ')' {
return rhs;
}
+rhs |= rhs(rhs) STRING(str) {
+ for (char c : *str) {
+ rhs->first.push_back(solar::symbol_t::make_char(c));
+ rhs->second.emplace_back();
+ }
+
+ delete str;
+
+ return rhs;
+}
+
action |= ';' {
return new std::string;