Sync with 5.1.0
[deliverable/titan.core.git] / compiler2 / asn1 / Block.cc
CommitLineData
970ed795
EL
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
12extern void asn1la_newtokenbuf(Asn::TokenBuf *tb);
13extern int asn1_yyparse();
14#define yyparse asn1_yyparse
15
16namespace 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.023915 seconds and 5 git commands to generate.