5 * We reserve no LEGAL rights to the Purdue Compiler Construction Tool
6 * Set (PCCTS) -- PCCTS is in the public domain. An individual or
7 * company may do whatever they wish with source code distributed with
8 * PCCTS or the code generated by PCCTS, including the incorporation of
9 * PCCTS, or its output, into commerical software.
11 * We encourage users to develop software with PCCTS. However, we do ask
12 * that credit is given to us for developing PCCTS. By "credit",
13 * we mean that if you incorporate our source code into one of your
14 * programs (commercial product, research project, or otherwise) that you
15 * acknowledge this fact somewhere in the documentation, research report,
16 * etc... If you like PCCTS and have developed a nice tool with the
17 * output, please mention that you developed it using PCCTS. In
18 * addition, we ask that this header remain intact in our source code.
19 * As long as these guidelines are kept, we expect to continue enhancing
20 * this system and expect to make other tools available as they are
24 * Written by Russell Quong June 30, 1995
25 * Adapted by Terence Parr to ANTLR stuff
26 * Parr Research Corporation
27 * with Purdue University and AHPCRC, University of Minnesota
34 // pointer to a reference counted object
35 // robust in that an unused ANTLRTokenPtr can point to NULL.
37 class ANTLRAbstractToken;
41 ANTLRTokenPtr(ANTLRAbstractToken *addr=NULL){ptr_ = addr; ref();}
42 ANTLRTokenPtr(const ANTLRTokenPtr &lhs) {ptr_ = lhs.ptr_; lhs.ref();}
45 // use ANTLRTokenPtr as a pointer to ANTLRToken
46 ANTLRAbstractToken *operator-> () { return ptr_; }
47 void operator = (const ANTLRTokenPtr lhs);
48 void operator = (ANTLRAbstractToken *addr);
49 unsigned operator != (const ANTLRTokenPtr &q)
50 { return this->ptr_ != q.ptr_; }
51 unsigned operator == (const ANTLRTokenPtr &q)
52 { return this->ptr_ == q.ptr_; }
57 ANTLRAbstractToken *ptr_;
60 //typedef ANTLRTokenPtr _ANTLRTokenPtr;
63 * Since you cannot redefine operator->() to return one of the user's
64 * token object types, we must down cast. This is a drag. Here's
65 * a macro that helps. template: "mytoken(a-smart-ptr)->myfield".
67 #define mytoken(tk) ((ANTLRToken *)(tk.operator->()))