Titan Core Initial Contribution
[deliverable/titan.core.git] / compiler2 / asn1 / Block.cc
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2014 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
8 #include "Block.hh"
9 #include "TokenBuf.hh"
10 #include "../error.h"
11
12 extern void asn1la_newtokenbuf(Asn::TokenBuf *tb);
13 extern int asn1_yyparse();
14 #define yyparse asn1_yyparse
15
16 namespace Asn {
17
18 using namespace Common;
19
20 Node *parsed_node;
21
22 Block::Block(TokenBuf *p_tokenbuf)
23 : Node(), Location(), tokenbuf(p_tokenbuf)
24 {
25 if (!p_tokenbuf) FATAL_ERROR("NULL parameter: Asn::Block::Block()");
26 }
27
28 Block::Block(const Block& p)
29 : Node(p), Location(p)
30 {
31 tokenbuf=p.tokenbuf->clone();
32 }
33
34 Block::~Block()
35 {
36 delete tokenbuf;
37 }
38
39 Node* Block::parse(int kw_token)
40 {
41 tokenbuf->push_front_kw_token(kw_token);
42 asn1la_newtokenbuf(tokenbuf);
43 if(yyparse()) parsed_node=0;
44 return parsed_node;
45 }
46
47 void Block::dump(unsigned level) const
48 {
49 DEBUG(level, "Block");
50 tokenbuf->dump(level + 1);
51 }
52
53 } // namespace Asn
This page took 0.040492 seconds and 5 git commands to generate.