MCPcopy Create free account
hub / github.com/commontk/CTK / getToken

Method getToken

Documentation/CMakeDoxygenFilter.cpp:100–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98 {}
99
100 int getToken()
101 {
102 // skip whitespace
103 while (isspace(_lastChar) && _lastChar != '\r' && _lastChar != '\n')
104 {
105 _lastChar = getChar();
106 }
107
108 if (isalpha(_lastChar) || _lastChar == '_')
109 {
110 _identifier = _lastChar;
111 while (isalnum(_lastChar = getChar()) || _lastChar == '-' || _lastChar == '_')
112 {
113 _identifier += _lastChar;
114 }
115
116 if (_identifier == "set")
117 return TOK_SET;
118 if (_identifier == "function")
119 return TOK_FUNCTION;
120 if (_identifier == "macro")
121 return TOK_MACRO;
122 if (_identifier == "endfunction")
123 return TOK_ENDFUNCTION;
124 if (_identifier == "endmacro")
125 return TOK_ENDMACRO;
126 return TOK_IDENTIFIER;
127 }
128
129 if (isdigit(_lastChar))
130 {
131 // very lax!! number detection
132 _identifier = _lastChar;
133 while (isalnum(_lastChar = getChar()) || _lastChar == '.' || _lastChar == ',')
134 {
135 _identifier += _lastChar;
136 }
137 return TOK_NUMBER_LITERAL;
138 }
139
140 if (_lastChar == '#')
141 {
142 _lastChar = getChar();
143 if (_lastChar == '!')
144 {
145 // found a doxygen comment marker
146 _identifier.clear();
147
148 _lastChar = getChar();
149 while (_lastChar != EOF && _lastChar != '\n' && _lastChar != '\r')
150 {
151 _identifier += _lastChar;
152 _lastChar = getChar();
153 }
154 return TOK_DOXYGEN_COMMENT;
155 }
156
157 // skip the comment

Callers 1

nextTokenMethod · 0.80

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected