ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/OOPSE-2.0/src/antlr/TokenRefCount.cpp
Revision: 2469
Committed: Fri Dec 2 15:38:03 2005 UTC (18 years, 7 months ago) by tim
File size: 705 byte(s)
Log Message:
End of the Link --> List
Return of the Oject-Oriented
replace yacc/lex parser with antlr parser

File Contents

# User Rev Content
1 tim 2469 /* ANTLR Translator Generator
2     * Project led by Terence Parr at http://www.jGuru.com
3     * Software rights: http://www.antlr.org/license.html
4     *
5     * $Id: TokenRefCount.cpp,v 1.1 2005-12-02 15:38:02 tim Exp $
6     */
7     #include "antlr/TokenRefCount.hpp"
8     #include "antlr/Token.hpp"
9    
10     #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
11     namespace antlr {
12     #endif
13    
14     TokenRef::TokenRef(Token* p)
15     : ptr(p), count(1)
16     {
17     if (p && !p->ref)
18     p->ref = this;
19     }
20    
21     TokenRef::~TokenRef()
22     {
23     delete ptr;
24     }
25    
26     TokenRef* TokenRef::getRef(const Token* p)
27     {
28     if (p) {
29     Token* pp = const_cast<Token*>(p);
30     if (pp->ref)
31     return pp->ref->increment();
32     else
33     return new TokenRef(pp);
34     } else
35     return 0;
36     }
37    
38     #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
39     }
40     #endif
41