Commit 2d04062e authored by Erwan Croze's avatar Erwan Croze 👋🏻

Revert "Loading Vcard grammar instead of build this"

This reverts commit 34e07ea9.
parent e3ed5fd9
/*
vcard_grammar.hpp
Copyright (C) 2017 Belledonne Communications SARL
Copyright (C) 2015 Belledonne Communications SARL
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
......@@ -19,10 +19,6 @@
#ifndef vcard_grammar_hpp
#define vcard_grammar_hpp
#include <belr/grammarbuilder.h>
#define VCARD_GRAMMAR "vcard_grammar"
std::shared_ptr<belr::Grammar> loadVcardGrammar();
extern const char *vcard_grammar;
#endif
......@@ -17,7 +17,7 @@
*/
#include "belcard/belcard_params.hpp"
#include "belcard/vcard_grammar.hpp"
using namespace::std;
using namespace::belr;
......@@ -25,7 +25,8 @@ using namespace::belcard;
template <typename T>
shared_ptr<T> BelCardParam::parseParam(const string& rule, const string& input) {
shared_ptr<Grammar> grammar = loadVcardGrammar();
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
Parser<shared_ptr<BelCardGeneric>> parser(grammar);
T::setHandlerAndCollectors(&parser);
shared_ptr<BelCardGeneric> ret = parser.parseInput(rule, input, NULL);
......@@ -94,7 +95,8 @@ BelCardLanguageParam::BelCardLanguageParam() : BelCardParam() {
}
shared_ptr<BelCardValueParam> BelCardValueParam::parse(const string& input) {
shared_ptr<Grammar> grammar = loadVcardGrammar();
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
Parser<shared_ptr<BelCardGeneric>> parser(grammar);
setHandlerAndCollectors(&parser);
shared_ptr<BelCardGeneric> ret = parser.parseInput("VALUE-param", input, NULL);
......@@ -238,4 +240,4 @@ void BelCardLabelParam::setHandlerAndCollectors(Parser<shared_ptr<BelCardGeneric
BelCardLabelParam::BelCardLabelParam() : BelCardParam() {
setName("LABEL");
}
}
\ No newline at end of file
......@@ -19,7 +19,6 @@
#include "belcard/belcard_parser.hpp"
#include "belcard/belcard.hpp"
#include "belcard/belcard_utils.hpp"
#include "belcard/vcard_grammar.hpp"
#include <iostream>
......@@ -36,7 +35,8 @@ shared_ptr<BelCardParser> BelCardParser::getInstance() {
}
BelCardParser::BelCardParser() {
shared_ptr<Grammar> grammar = loadVcardGrammar();
ABNFGrammarBuilder grammar_builder;
shared_ptr<Grammar> grammar = grammar_builder.createFromAbnf((const char*)vcard_grammar, make_shared<CoreRules>());
_parser = new Parser<shared_ptr<BelCardGeneric>>(grammar);
BelCardList::setHandlerAndCollectors(_parser);
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment