Imported Upstream version 1.8.8
[platform/upstream/doxygen.git] / vhdlparser / Token.cc
1 /* Generated By:JavaCC: Do not edit this line. Token.cc Version 6.0 */
2 /* JavaCCOptions:STATIC=false,SUPPORT_CLASS_VISIBILITY_PUBLIC=true,TOKEN_INCLUDES=,TOKEN_EXTENDS= */
3 #include "Token.h"
4
5 namespace vhdl {
6 namespace parser {
7
8 /**
9  * Describes the input token stream.
10  */
11
12   /**
13    * An optional attribute value of the Token.
14    * Tokens which are not used as syntactic sugar will often contain
15    * meaningful values that will be used later on by the compiler or
16    * interpreter. This attribute value is often different from the image.
17    * Any subclass of Token that actually wants to return a non-NULL value can
18    * override this method as appropriate.
19    */
20   void * Token::getValue() {
21     return NULL;
22   }
23
24   /**
25    * No-argument constructor
26    */
27   Token::Token() {
28     this->next = NULL;
29     this->specialToken = NULL;
30   }
31
32   /**
33    * Constructs a new token for the specified Image.
34    */
35   Token::Token(int kind)
36   {
37     this->kind = kind;
38     this->next = NULL;
39     this->specialToken = NULL;
40   }
41
42   /**
43    * Constructs a new token for the specified Image and Kind.
44    */
45   Token::Token(int kind, JAVACC_STRING_TYPE image)
46   {
47     this->kind = kind;
48     this->image = image;
49     this->next = NULL;
50     this->specialToken = NULL;
51   }
52
53   /**
54    * Returns the image.
55    */
56   JAVACC_STRING_TYPE Token::toString()
57   {
58     return image;
59   }
60
61   /**
62    * Returns a new Token object, by default. However, if you want, you
63    * can create and return subclass objects based on the value of ofKind.
64    * Simply add the cases to the switch for all those special cases.
65    * For example, if you have a subclass of Token called IDToken that
66    * you want to create if ofKind is ID, simply add something like :
67    *
68    *    case MyParserConstants.ID : return new IDToken(ofKind, image);
69    *
70    * to the following switch statement. Then you can cast matchedToken
71    * variable to the appropriate type and use sit in your lexical actions.
72    */
73   Token *Token::newToken(int ofKind, JAVACC_STRING_TYPE image)
74   {
75     switch(ofKind)
76     {
77       default : return new Token(ofKind, image);
78     }
79   }
80
81   Token *Token::newToken(int ofKind)
82   {
83     return newToken(ofKind, JAVACC_STRING_TYPE((JAVACC_CHAR_TYPE*)""));
84   }
85
86   Token::~Token() {
87     if (specialToken) delete specialToken;
88   }
89
90 }
91 }
92 /* JavaCC - OriginalChecksum=9db9ca693072c4c37bb7cc933c0c5e35 (do not edit this line) */