summaryrefslogtreecommitdiffstats
path: root/src/parser.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/parser.cpp')
-rw-r--r--src/parser.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/parser.cpp b/src/parser.cpp
index 0333243..ce408eb 100644
--- a/src/parser.cpp
+++ b/src/parser.cpp
@@ -66,8 +66,8 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
switch (token) {
case TOK_SYMBOL_LC:
parser->state = STATE_RULE_BAR;
- state->new_rule(value->str);
- free(value->str);
+ state->new_rule(*value->str);
+ delete value->str;
return 1;
case TOK_TYPE:
@@ -111,13 +111,13 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
case STATE_RULE:
switch (token) {
case TOK_SYMBOL_LC:
- state->add_rule_nonterminal(value->str);
- free(value->str);
+ state->add_rule_nonterminal(*value->str);
+ delete value->str;
return 1;
case TOK_SYMBOL_UC:
- state->add_rule_terminal(value->str);
- free(value->str);
+ state->add_rule_terminal(*value->str);
+ delete value->str;
return 1;
case TOK_CHAR:
@@ -125,8 +125,8 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
return 1;
case TOK_BLOCK:
- state->add_rule(value->str);
- free(value->str);
+ state->add_rule(*value->str);
+ delete value->str;
parser->state = STATE_INIT;
return 1;
@@ -147,8 +147,8 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
case TOK_SYMBOL:
case TOK_SYMBOL_UC:
case TOK_SYMBOL_LC:
- state->add_rule_var(value->str);
- free(value->str);
+ state->add_rule_var(*value->str);
+ delete value->str;
parser->state = STATE_RULE_VAR;
return 1;
}
@@ -166,13 +166,13 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
case STATE_RULE_VAR_POST:
switch (token) {
case TOK_SYMBOL_LC:
- state->add_rule_nonterminal(value->str);
- free(value->str);
+ state->add_rule_nonterminal(*value->str);
+ delete value->str;
return 1;
case TOK_SYMBOL_UC:
- state->add_rule_terminal(value->str);
- free(value->str);
+ state->add_rule_terminal(*value->str);
+ delete value->str;
return 1;
case TOK_CHAR:
@@ -180,8 +180,8 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
return 1;
case TOK_BLOCK:
- state->add_rule(value->str);
- free(value->str);
+ state->add_rule(*value->str);
+ delete value->str;
parser->state = STATE_INIT;
return 1;
@@ -196,14 +196,14 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
case STATE_TYPE:
switch (token) {
case TOK_SYMBOL_LC:
- state->add_type_nonterminal(value->str);
- free(value->str);
+ state->add_type_nonterminal(*value->str);
+ delete value->str;
parser->state = STATE_TYPE_NONTERM;
return 1;
case TOK_SYMBOL_UC:
- state->add_type_terminal(value->str);
- free(value->str);
+ state->add_type_terminal(*value->str);
+ delete value->str;
parser->state = STATE_TYPE_TERM;
return 1;
}
@@ -212,8 +212,8 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
case STATE_TYPE_NONTERM:
if (token == TOK_BLOCK) {
- state->set_type_nonterminal(value->str);
- free(value->str);
+ state->set_type_nonterminal(*value->str);
+ delete value->str;
parser->state = STATE_INIT;
return 1;
}
@@ -222,8 +222,8 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
case STATE_TYPE_TERM:
if (token == TOK_BLOCK) {
- state->set_type_terminal(value->str);
- free(value->str);
+ state->set_type_terminal(*value->str);
+ delete value->str;
parser->state = STATE_TYPE_TERM_BLOCK;
return 1;
}
@@ -235,8 +235,8 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
case TOK_SYMBOL:
case TOK_SYMBOL_UC:
case TOK_SYMBOL_LC:
- state->set_type_terminal_name(value->str);
- free(value->str);
+ state->set_type_terminal_name(*value->str);
+ delete value->str;
parser->state = STATE_INIT;
return 1;
}
@@ -244,8 +244,8 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
case STATE_HEADER:
if (token == TOK_BLOCK) {
- state->set_header_block(value->str);
- free(value->str);
+ state->set_header_block(*value->str);
+ delete value->str;
parser->state = STATE_INIT;
return 1;
}
@@ -254,8 +254,8 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
case STATE_SOURCE:
if (token == TOK_BLOCK) {
- state->set_source_block(value->str);
- free(value->str);
+ state->set_source_block(*value->str);
+ delete value->str;
parser->state = STATE_INIT;
return 1;
}
@@ -264,8 +264,8 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
case STATE_EXTRA_ARG:
if (token == TOK_BLOCK) {
- state->add_extra_arg(value->str);
- free(value->str);
+ state->add_extra_arg(*value->str);
+ delete value->str;
parser->state = STATE_EXTRA_ARG_NAME;
return 1;
}
@@ -276,8 +276,8 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
case TOK_SYMBOL:
case TOK_SYMBOL_UC:
case TOK_SYMBOL_LC:
- state->set_extra_arg_name(value->str);
- free(value->str);
+ state->set_extra_arg_name(*value->str);
+ delete value->str;
parser->state = STATE_INIT;
return 1;
}
@@ -289,7 +289,7 @@ int parser_push(parser_t *parser, int token, const parser_value_t *value, parser
case TOK_SYMBOL_LC:
case TOK_CHAR:
case TOK_BLOCK:
- free(value->str);;
+ delete value->str;;
}
return -1;