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 ///////////////////////////////////////////////////////////////////////////////
15 using namespace Common;
17 extern Node *parsed_node;
22 * A node which represents an unparsed block. When parsing a file,
23 * it is not always known what to expect when a block begins
24 * ('{'). So, the tokens of the block are pushed into a TokenBuf.
25 * Block is a wrapping-class for TokenBuf. As Block is a
26 * Node-descendant, it can be used in the AST.
28 * After the examination of the block's context, it is known what to
29 * expect in the block, so the block can be parsed.
31 class Block : public Node, public Location {
33 /** The wrapped token buffer. */
36 Block(const Block& p);
38 /** Constructs a Block from a TokenBuf. */
39 Block(TokenBuf *p_tokenbuf);
40 /** The destructor. */
42 virtual Block* clone() const
43 {return new Block(*this);}
44 /** Returns the TokenBuf. You can modify (put tokens into/remove
45 * tokens from) it, but do not delete the buffer! */
46 TokenBuf* get_TokenBuf() {return tokenbuf;}
47 /** Parses the block. The expected content is expressed by \a
48 * kw_token, which is a constant defined in the grammar
49 * (asn1p.y). Returns an AST-subtree. To use this function, you
50 * have to include the TokenBuf header, too. */
51 Node* parse(int kw_token);
53 virtual void dump(unsigned) const;
58 #endif /* _Asn_Block_HH */