diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2011-02-18 17:42:20 -0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2011-02-18 17:42:20 -0800 |
commit | e6a03f10e5175cbfcb2afb605cb0abca7f03d182 (patch) | |
tree | a212f240403015f0c8faad41f93021c45a113b82 /src/cparse/cparse.ypp | |
parent | 91ca52106c623838957ba24b9baf680902c3ea7d (diff) | |
download | vyatta-cfg-e6a03f10e5175cbfcb2afb605cb0abca7f03d182.tar.gz vyatta-cfg-e6a03f10e5175cbfcb2afb605cb0abca7f03d182.zip |
namespace reorg
Diffstat (limited to 'src/cparse/cparse.ypp')
-rw-r--r-- | src/cparse/cparse.ypp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/cparse/cparse.ypp b/src/cparse/cparse.ypp index 535ec3d..6ce60d0 100644 --- a/src/cparse/cparse.ypp +++ b/src/cparse/cparse.ypp @@ -9,6 +9,8 @@ #include "cparse.hpp" #include "cparse_def.h" +using namespace cparse; + /* to enable tracing, define ENABLE_PARSER_TRACE. may also want to invoke * bison with "-v" (by changing Makefile.am). */ @@ -17,9 +19,6 @@ #define YYDEBUG 1 #endif // ENABLE_PARSER_TRACE -using namespace std; -using namespace cnode; - // stuff from lex extern "C" { extern int cparse_lineno; @@ -42,7 +41,7 @@ static char *nval = NULL; // XXX optimize: use unordered_map with non-vector static map<vector<string>, CfgNode *> node_map; -static Cstore *cstore = NULL; +static Cstore *cstore_ = NULL; static CfgNode *cur_node = NULL; static CfgNode *cur_parent = NULL; static vector<CfgNode *> cur_path; @@ -66,7 +65,7 @@ add_node() cur_node = onode; } else if (onode->isTag()) { // a new value for a "tag node" - cur_node = new CfgNode(pcomps, nname, nval, ncomment, ndeact, cstore); + cur_node = new CfgNode(pcomps, nname, nval, ncomment, ndeact, cstore_); onode->addChildNode(cur_node); } else { /* a new value for a single-value node => invalid? @@ -81,12 +80,12 @@ add_node() } } else { // new node - cur_node = new CfgNode(pcomps, nname, nval, ncomment, ndeact, cstore); + cur_node = new CfgNode(pcomps, nname, nval, ncomment, ndeact, cstore_); CfgNode *mapped_node = cur_node; if (cur_node->isTag() && cur_node->isValue()) { // tag value => need to add the "tag node" on top // (need to force "tag" if the node is invalid => tag_if_invalid) - CfgNode *p = new CfgNode(pcomps, nname, NULL, NULL, ndeact, cstore, + CfgNode *p = new CfgNode(pcomps, nname, NULL, NULL, ndeact, cstore_, true); p->addChildNode(cur_node); mapped_node = p; @@ -192,7 +191,7 @@ cparse::parse_file(FILE *fin, Cstore& cs) // initial state cparse_set_in(fin); - cstore = &cs; + cstore_ = &cs; ndeact = 0; ncomment = NULL; nname = NULL; @@ -202,7 +201,7 @@ cparse::parse_file(FILE *fin, Cstore& cs) pcomp_is_value.clear(); cur_path.clear(); cur_node = NULL; - cur_parent = new CfgNode(pcomps, nname, nval, ncomment, ndeact, cstore); + cur_parent = new CfgNode(pcomps, nname, nval, ncomment, ndeact, cstore_); if (cparse_parse() != 0) { // parsing failed |