blob: 5a6c8aa8a5bcfa766fb3f26edd3319f3ba98d548 [file] [log] [blame]
Chris Lattnera8058742007-11-18 02:57:27 +00001//===- TGLexer.cpp - Lexer for TableGen -----------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
Chris Lattner30609102007-12-29 20:37:13 +00005// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
Chris Lattnera8058742007-11-18 02:57:27 +00007//
8//===----------------------------------------------------------------------===//
9//
10// Implement the Lexer for TableGen.
11//
12//===----------------------------------------------------------------------===//
13
Chris Lattner6aaca042007-11-18 05:25:45 +000014#include "TGLexer.h"
Peter Collingbourne7c788882011-10-01 16:41:13 +000015#include "llvm/TableGen/Error.h"
Chris Lattner099e1982009-06-21 03:36:54 +000016#include "llvm/Support/SourceMgr.h"
Chris Lattnera8058742007-11-18 02:57:27 +000017#include "llvm/Support/MemoryBuffer.h"
Chuck Rose III8b0ec642007-11-21 19:36:25 +000018#include "llvm/Config/config.h"
Bill Wendlingcd466f52010-12-08 20:02:49 +000019#include "llvm/ADT/StringSwitch.h"
20#include "llvm/ADT/Twine.h"
Chris Lattnera8058742007-11-18 02:57:27 +000021#include <cctype>
Duncan Sands4520dd22008-10-08 07:23:46 +000022#include <cstdio>
Anton Korobeynikovae9f3a32008-02-20 11:08:44 +000023#include <cstdlib>
24#include <cstring>
Dan Gohman63f97202008-10-17 01:33:43 +000025#include <cerrno>
Chris Lattnera8058742007-11-18 02:57:27 +000026using namespace llvm;
27
Chris Lattner8070ea32009-06-21 03:41:50 +000028TGLexer::TGLexer(SourceMgr &SM) : SrcMgr(SM) {
Chris Lattneraa739d22009-03-13 07:05:43 +000029 CurBuffer = 0;
30 CurBuf = SrcMgr.getMemoryBuffer(CurBuffer);
Chris Lattnera8058742007-11-18 02:57:27 +000031 CurPtr = CurBuf->getBufferStart();
Chris Lattner56a9fcf2007-11-19 07:43:52 +000032 TokStart = 0;
Chris Lattnera8058742007-11-18 02:57:27 +000033}
34
Chris Lattner1e3a8a42009-06-21 03:39:35 +000035SMLoc TGLexer::getLoc() const {
36 return SMLoc::getFromPointer(TokStart);
Chris Lattner1c8ae592009-03-13 16:01:53 +000037}
38
Chris Lattnerc8a9bbc2007-11-19 07:38:58 +000039/// ReturnError - Set the error to the specified string at the specified
Chris Lattnerf4601652007-11-22 20:49:04 +000040/// location. This is defined to always return tgtok::Error.
Benjamin Kramerd1e17032010-09-27 17:42:11 +000041tgtok::TokKind TGLexer::ReturnError(const char *Loc, const Twine &Msg) {
Chris Lattnerc8a9bbc2007-11-19 07:38:58 +000042 PrintError(Loc, Msg);
Chris Lattnerf4601652007-11-22 20:49:04 +000043 return tgtok::Error;
Chris Lattnerc8a9bbc2007-11-19 07:38:58 +000044}
Chris Lattnera8058742007-11-18 02:57:27 +000045
Chris Lattnera8058742007-11-18 02:57:27 +000046int TGLexer::getNextChar() {
47 char CurChar = *CurPtr++;
48 switch (CurChar) {
49 default:
Chris Lattnerc1819182007-11-18 05:48:46 +000050 return (unsigned char)CurChar;
Chris Lattneraa739d22009-03-13 07:05:43 +000051 case 0: {
Chris Lattnera8058742007-11-18 02:57:27 +000052 // A nul character in the stream is either the end of the current buffer or
53 // a random nul in the file. Disambiguate that here.
54 if (CurPtr-1 != CurBuf->getBufferEnd())
55 return 0; // Just whitespace.
56
57 // If this is the end of an included file, pop the parent file off the
58 // include stack.
Chris Lattner1e3a8a42009-06-21 03:39:35 +000059 SMLoc ParentIncludeLoc = SrcMgr.getParentIncludeLoc(CurBuffer);
60 if (ParentIncludeLoc != SMLoc()) {
Chris Lattneraa739d22009-03-13 07:05:43 +000061 CurBuffer = SrcMgr.FindBufferContainingLoc(ParentIncludeLoc);
62 CurBuf = SrcMgr.getMemoryBuffer(CurBuffer);
Chris Lattner1c8ae592009-03-13 16:01:53 +000063 CurPtr = ParentIncludeLoc.getPointer();
Chris Lattnera8058742007-11-18 02:57:27 +000064 return getNextChar();
65 }
66
67 // Otherwise, return end of file.
68 --CurPtr; // Another call to lex will return EOF again.
69 return EOF;
Chris Lattneraa739d22009-03-13 07:05:43 +000070 }
Chris Lattnera8058742007-11-18 02:57:27 +000071 case '\n':
72 case '\r':
73 // Handle the newline character by ignoring it and incrementing the line
74 // count. However, be careful about 'dos style' files with \n\r in them.
75 // Only treat a \n\r or \r\n as a single line.
76 if ((*CurPtr == '\n' || (*CurPtr == '\r')) &&
77 *CurPtr != CurChar)
Chris Lattnerc1819182007-11-18 05:48:46 +000078 ++CurPtr; // Eat the two char newline sequence.
Chris Lattnera8058742007-11-18 02:57:27 +000079 return '\n';
80 }
81}
82
Chris Lattnerf4601652007-11-22 20:49:04 +000083tgtok::TokKind TGLexer::LexToken() {
Chris Lattner56a9fcf2007-11-19 07:43:52 +000084 TokStart = CurPtr;
Chris Lattnera8058742007-11-18 02:57:27 +000085 // This always consumes at least one character.
86 int CurChar = getNextChar();
87
88 switch (CurChar) {
89 default:
Chris Lattnerc2b08752010-10-05 22:59:29 +000090 // Handle letters: [a-zA-Z_#]
David Greene065f2592009-05-05 16:28:25 +000091 if (isalpha(CurChar) || CurChar == '_' || CurChar == '#')
Chris Lattnera8058742007-11-18 02:57:27 +000092 return LexIdentifier();
93
Chris Lattnerf4601652007-11-22 20:49:04 +000094 // Unknown character, emit an error.
95 return ReturnError(TokStart, "Unexpected character");
96 case EOF: return tgtok::Eof;
97 case ':': return tgtok::colon;
98 case ';': return tgtok::semi;
99 case '.': return tgtok::period;
100 case ',': return tgtok::comma;
101 case '<': return tgtok::less;
102 case '>': return tgtok::greater;
103 case ']': return tgtok::r_square;
104 case '{': return tgtok::l_brace;
105 case '}': return tgtok::r_brace;
106 case '(': return tgtok::l_paren;
107 case ')': return tgtok::r_paren;
108 case '=': return tgtok::equal;
109 case '?': return tgtok::question;
110
Chris Lattnera8058742007-11-18 02:57:27 +0000111 case 0:
112 case ' ':
113 case '\t':
114 case '\n':
115 case '\r':
116 // Ignore whitespace.
117 return LexToken();
118 case '/':
119 // If this is the start of a // comment, skip until the end of the line or
120 // the end of the buffer.
121 if (*CurPtr == '/')
122 SkipBCPLComment();
123 else if (*CurPtr == '*') {
124 if (SkipCComment())
Chris Lattnerf4601652007-11-22 20:49:04 +0000125 return tgtok::Error;
126 } else // Otherwise, this is an error.
127 return ReturnError(TokStart, "Unexpected character");
Chris Lattnera8058742007-11-18 02:57:27 +0000128 return LexToken();
129 case '-': case '+':
130 case '0': case '1': case '2': case '3': case '4': case '5': case '6':
131 case '7': case '8': case '9':
132 return LexNumber();
133 case '"': return LexString();
134 case '$': return LexVarName();
135 case '[': return LexBracket();
136 case '!': return LexExclaim();
137 }
138}
139
140/// LexString - Lex "[^"]*"
Chris Lattnerf4601652007-11-22 20:49:04 +0000141tgtok::TokKind TGLexer::LexString() {
Chris Lattnera8058742007-11-18 02:57:27 +0000142 const char *StrStart = CurPtr;
143
Chris Lattnerea9f4df2009-03-13 21:03:27 +0000144 CurStrVal = "";
145
Chris Lattnera8058742007-11-18 02:57:27 +0000146 while (*CurPtr != '"') {
147 // If we hit the end of the buffer, report an error.
Chris Lattnerc8a9bbc2007-11-19 07:38:58 +0000148 if (*CurPtr == 0 && CurPtr == CurBuf->getBufferEnd())
149 return ReturnError(StrStart, "End of file in string literal");
150
151 if (*CurPtr == '\n' || *CurPtr == '\r')
152 return ReturnError(StrStart, "End of line in string literal");
Chris Lattnera8058742007-11-18 02:57:27 +0000153
Chris Lattnerea9f4df2009-03-13 21:03:27 +0000154 if (*CurPtr != '\\') {
155 CurStrVal += *CurPtr++;
156 continue;
157 }
158
Chris Lattnera8058742007-11-18 02:57:27 +0000159 ++CurPtr;
Chris Lattnerea9f4df2009-03-13 21:03:27 +0000160
161 switch (*CurPtr) {
162 case '\\': case '\'': case '"':
163 // These turn into their literal character.
164 CurStrVal += *CurPtr++;
165 break;
Chris Lattnere023bb62009-03-13 21:23:43 +0000166 case 't':
Chris Lattner7f3b28a2009-03-13 21:33:17 +0000167 CurStrVal += '\t';
Chris Lattnere023bb62009-03-13 21:23:43 +0000168 ++CurPtr;
169 break;
170 case 'n':
Chris Lattner7f3b28a2009-03-13 21:33:17 +0000171 CurStrVal += '\n';
Chris Lattnere023bb62009-03-13 21:23:43 +0000172 ++CurPtr;
173 break;
174
Chris Lattnerea9f4df2009-03-13 21:03:27 +0000175 case '\n':
176 case '\r':
177 return ReturnError(CurPtr, "escaped newlines not supported in tblgen");
178
179 // If we hit the end of the buffer, report an error.
180 case '\0':
181 if (CurPtr == CurBuf->getBufferEnd())
182 return ReturnError(StrStart, "End of file in string literal");
183 // FALL THROUGH
184 default:
185 return ReturnError(CurPtr, "invalid escape in string literal");
186 }
Chris Lattnera8058742007-11-18 02:57:27 +0000187 }
188
Chris Lattnera8058742007-11-18 02:57:27 +0000189 ++CurPtr;
Chris Lattnerf4601652007-11-22 20:49:04 +0000190 return tgtok::StrVal;
Chris Lattnera8058742007-11-18 02:57:27 +0000191}
192
Chris Lattnerf4601652007-11-22 20:49:04 +0000193tgtok::TokKind TGLexer::LexVarName() {
Chris Lattnera8058742007-11-18 02:57:27 +0000194 if (!isalpha(CurPtr[0]) && CurPtr[0] != '_')
Chris Lattnerf4601652007-11-22 20:49:04 +0000195 return ReturnError(TokStart, "Invalid variable name");
Chris Lattnera8058742007-11-18 02:57:27 +0000196
197 // Otherwise, we're ok, consume the rest of the characters.
198 const char *VarNameStart = CurPtr++;
199
200 while (isalpha(*CurPtr) || isdigit(*CurPtr) || *CurPtr == '_')
201 ++CurPtr;
202
Chris Lattnerf4601652007-11-22 20:49:04 +0000203 CurStrVal.assign(VarNameStart, CurPtr);
204 return tgtok::VarName;
Chris Lattnera8058742007-11-18 02:57:27 +0000205}
206
207
Chris Lattnerf4601652007-11-22 20:49:04 +0000208tgtok::TokKind TGLexer::LexIdentifier() {
Chris Lattnerc2b08752010-10-05 22:59:29 +0000209 // The first letter is [a-zA-Z_#].
Chris Lattnerf4601652007-11-22 20:49:04 +0000210 const char *IdentStart = TokStart;
Benjamin Kramer37d42af2011-10-06 18:23:56 +0000211
Chris Lattnerc2b08752010-10-05 22:59:29 +0000212 // Match the rest of the identifier regex: [0-9a-zA-Z_#]*
213 while (isalpha(*CurPtr) || isdigit(*CurPtr) || *CurPtr == '_' ||
214 *CurPtr == '#')
215 ++CurPtr;
Benjamin Kramer37d42af2011-10-06 18:23:56 +0000216
Chris Lattnera8058742007-11-18 02:57:27 +0000217 // Check to see if this identifier is a keyword.
Benjamin Kramer37d42af2011-10-06 18:23:56 +0000218 StringRef Str(IdentStart, CurPtr-IdentStart);
219
Benjamin Kramer37d42af2011-10-06 18:23:56 +0000220 if (Str == "include") {
Chris Lattnerf4601652007-11-22 20:49:04 +0000221 if (LexInclude()) return tgtok::Error;
222 return Lex();
Chris Lattnera8058742007-11-18 02:57:27 +0000223 }
Benjamin Kramer37d42af2011-10-06 18:23:56 +0000224
Benjamin Krameree573182011-10-06 18:53:43 +0000225 tgtok::TokKind Kind = StringSwitch<tgtok::TokKind>(Str)
226 .Case("int", tgtok::Int)
227 .Case("bit", tgtok::Bit)
228 .Case("bits", tgtok::Bits)
229 .Case("string", tgtok::String)
230 .Case("list", tgtok::List)
231 .Case("code", tgtok::Code)
232 .Case("dag", tgtok::Dag)
233 .Case("class", tgtok::Class)
234 .Case("def", tgtok::Def)
235 .Case("multidef", tgtok::MultiDef)
236 .Case("defm", tgtok::Defm)
237 .Case("multiclass", tgtok::MultiClass)
238 .Case("field", tgtok::Field)
239 .Case("let", tgtok::Let)
240 .Case("in", tgtok::In)
241 .Default(tgtok::Id);
242
243 if (Kind == tgtok::Id)
244 CurStrVal.assign(Str.begin(), Str.end());
245 return Kind;
Chris Lattnera8058742007-11-18 02:57:27 +0000246}
247
248/// LexInclude - We just read the "include" token. Get the string token that
249/// comes next and enter the include.
250bool TGLexer::LexInclude() {
251 // The token after the include must be a string.
Chris Lattnerf4601652007-11-22 20:49:04 +0000252 tgtok::TokKind Tok = LexToken();
253 if (Tok == tgtok::Error) return true;
254 if (Tok != tgtok::StrVal) {
255 PrintError(getLoc(), "Expected filename after include");
Chris Lattnera8058742007-11-18 02:57:27 +0000256 return true;
257 }
258
259 // Get the string.
Chris Lattnerf4601652007-11-22 20:49:04 +0000260 std::string Filename = CurStrVal;
Joerg Sonnenbergerdd137902011-06-01 13:10:15 +0000261 std::string IncludedFile;
Chris Lattnera8058742007-11-18 02:57:27 +0000262
Chris Lattner7ee5d5f2009-06-21 05:06:04 +0000263
Joerg Sonnenbergerdd137902011-06-01 13:10:15 +0000264 CurBuffer = SrcMgr.AddIncludeFile(Filename, SMLoc::getFromPointer(CurPtr),
265 IncludedFile);
Chris Lattnerd926e042009-06-21 05:33:06 +0000266 if (CurBuffer == -1) {
Chris Lattnerf4601652007-11-22 20:49:04 +0000267 PrintError(getLoc(), "Could not find include file '" + Filename + "'");
Chris Lattnera8058742007-11-18 02:57:27 +0000268 return true;
269 }
270
Joerg Sonnenbergerdd137902011-06-01 13:10:15 +0000271 Dependencies.push_back(IncludedFile);
Chris Lattnera8058742007-11-18 02:57:27 +0000272 // Save the line number and lex buffer of the includer.
Chris Lattner7ee5d5f2009-06-21 05:06:04 +0000273 CurBuf = SrcMgr.getMemoryBuffer(CurBuffer);
Chris Lattnera8058742007-11-18 02:57:27 +0000274 CurPtr = CurBuf->getBufferStart();
275 return false;
276}
277
278void TGLexer::SkipBCPLComment() {
279 ++CurPtr; // skip the second slash.
280 while (1) {
281 switch (*CurPtr) {
282 case '\n':
283 case '\r':
284 return; // Newline is end of comment.
285 case 0:
286 // If this is the end of the buffer, end the comment.
287 if (CurPtr == CurBuf->getBufferEnd())
288 return;
289 break;
290 }
291 // Otherwise, skip the character.
292 ++CurPtr;
293 }
294}
295
296/// SkipCComment - This skips C-style /**/ comments. The only difference from C
297/// is that we allow nesting.
298bool TGLexer::SkipCComment() {
299 ++CurPtr; // skip the star.
300 unsigned CommentDepth = 1;
301
302 while (1) {
303 int CurChar = getNextChar();
304 switch (CurChar) {
305 case EOF:
Chris Lattnerf4601652007-11-22 20:49:04 +0000306 PrintError(TokStart, "Unterminated comment!");
Chris Lattnera8058742007-11-18 02:57:27 +0000307 return true;
308 case '*':
309 // End of the comment?
310 if (CurPtr[0] != '/') break;
311
312 ++CurPtr; // End the */.
313 if (--CommentDepth == 0)
314 return false;
315 break;
316 case '/':
317 // Start of a nested comment?
318 if (CurPtr[0] != '*') break;
319 ++CurPtr;
320 ++CommentDepth;
321 break;
322 }
323 }
324}
325
326/// LexNumber - Lex:
327/// [-+]?[0-9]+
328/// 0x[0-9a-fA-F]+
329/// 0b[01]+
Chris Lattnerf4601652007-11-22 20:49:04 +0000330tgtok::TokKind TGLexer::LexNumber() {
Chris Lattnera8058742007-11-18 02:57:27 +0000331 if (CurPtr[-1] == '0') {
332 if (CurPtr[0] == 'x') {
333 ++CurPtr;
Chris Lattnerf4601652007-11-22 20:49:04 +0000334 const char *NumStart = CurPtr;
Chris Lattnera8058742007-11-18 02:57:27 +0000335 while (isxdigit(CurPtr[0]))
336 ++CurPtr;
337
Chris Lattnerc8a9bbc2007-11-19 07:38:58 +0000338 // Requires at least one hex digit.
339 if (CurPtr == NumStart)
Chris Lattner4226bb02009-06-21 19:22:49 +0000340 return ReturnError(TokStart, "Invalid hexadecimal number");
Chris Lattnerc8a9bbc2007-11-19 07:38:58 +0000341
Dan Gohman63f97202008-10-17 01:33:43 +0000342 errno = 0;
Chris Lattnerf4601652007-11-22 20:49:04 +0000343 CurIntVal = strtoll(NumStart, 0, 16);
Dan Gohman63f97202008-10-17 01:33:43 +0000344 if (errno == EINVAL)
Chris Lattner4226bb02009-06-21 19:22:49 +0000345 return ReturnError(TokStart, "Invalid hexadecimal number");
Dan Gohman63f97202008-10-17 01:33:43 +0000346 if (errno == ERANGE) {
347 errno = 0;
348 CurIntVal = (int64_t)strtoull(NumStart, 0, 16);
349 if (errno == EINVAL)
Chris Lattner4226bb02009-06-21 19:22:49 +0000350 return ReturnError(TokStart, "Invalid hexadecimal number");
Dan Gohman63f97202008-10-17 01:33:43 +0000351 if (errno == ERANGE)
Chris Lattner4226bb02009-06-21 19:22:49 +0000352 return ReturnError(TokStart, "Hexadecimal number out of range");
Dan Gohman63f97202008-10-17 01:33:43 +0000353 }
Chris Lattnerf4601652007-11-22 20:49:04 +0000354 return tgtok::IntVal;
Chris Lattnera8058742007-11-18 02:57:27 +0000355 } else if (CurPtr[0] == 'b') {
356 ++CurPtr;
Chris Lattnerf4601652007-11-22 20:49:04 +0000357 const char *NumStart = CurPtr;
Chris Lattnera8058742007-11-18 02:57:27 +0000358 while (CurPtr[0] == '0' || CurPtr[0] == '1')
359 ++CurPtr;
Chris Lattnerc8a9bbc2007-11-19 07:38:58 +0000360
361 // Requires at least one binary digit.
362 if (CurPtr == NumStart)
363 return ReturnError(CurPtr-2, "Invalid binary number");
Chris Lattnerf4601652007-11-22 20:49:04 +0000364 CurIntVal = strtoll(NumStart, 0, 2);
365 return tgtok::IntVal;
Chris Lattnera8058742007-11-18 02:57:27 +0000366 }
367 }
368
369 // Check for a sign without a digit.
Chris Lattnerf4601652007-11-22 20:49:04 +0000370 if (!isdigit(CurPtr[0])) {
371 if (CurPtr[-1] == '-')
372 return tgtok::minus;
373 else if (CurPtr[-1] == '+')
374 return tgtok::plus;
Chris Lattnera8058742007-11-18 02:57:27 +0000375 }
376
377 while (isdigit(CurPtr[0]))
378 ++CurPtr;
Chris Lattnerf4601652007-11-22 20:49:04 +0000379 CurIntVal = strtoll(TokStart, 0, 10);
380 return tgtok::IntVal;
Chris Lattnera8058742007-11-18 02:57:27 +0000381}
382
383/// LexBracket - We just read '['. If this is a code block, return it,
384/// otherwise return the bracket. Match: '[' and '[{ ( [^}]+ | }[^]] )* }]'
Chris Lattnerf4601652007-11-22 20:49:04 +0000385tgtok::TokKind TGLexer::LexBracket() {
Chris Lattnera8058742007-11-18 02:57:27 +0000386 if (CurPtr[0] != '{')
Chris Lattnerf4601652007-11-22 20:49:04 +0000387 return tgtok::l_square;
Chris Lattnera8058742007-11-18 02:57:27 +0000388 ++CurPtr;
389 const char *CodeStart = CurPtr;
390 while (1) {
391 int Char = getNextChar();
392 if (Char == EOF) break;
393
394 if (Char != '}') continue;
395
396 Char = getNextChar();
397 if (Char == EOF) break;
398 if (Char == ']') {
Chris Lattnerf4601652007-11-22 20:49:04 +0000399 CurStrVal.assign(CodeStart, CurPtr-2);
400 return tgtok::CodeFragment;
Chris Lattnera8058742007-11-18 02:57:27 +0000401 }
402 }
403
Chris Lattnerc8a9bbc2007-11-19 07:38:58 +0000404 return ReturnError(CodeStart-2, "Unterminated Code Block");
Chris Lattnera8058742007-11-18 02:57:27 +0000405}
406
407/// LexExclaim - Lex '!' and '![a-zA-Z]+'.
Chris Lattnerf4601652007-11-22 20:49:04 +0000408tgtok::TokKind TGLexer::LexExclaim() {
Chris Lattnera8058742007-11-18 02:57:27 +0000409 if (!isalpha(*CurPtr))
Bill Wendlingdd2b6cb2010-12-08 13:03:15 +0000410 return ReturnError(CurPtr - 1, "Invalid \"!operator\"");
Chris Lattnera8058742007-11-18 02:57:27 +0000411
412 const char *Start = CurPtr++;
413 while (isalpha(*CurPtr))
414 ++CurPtr;
415
416 // Check to see which operator this is.
Bill Wendlingcd466f52010-12-08 20:02:49 +0000417 tgtok::TokKind Kind =
418 StringSwitch<tgtok::TokKind>(StringRef(Start, CurPtr - Start))
419 .Case("eq", tgtok::XEq)
420 .Case("if", tgtok::XIf)
David Greene1434f662011-01-07 17:05:37 +0000421 .Case("head", tgtok::XHead)
422 .Case("tail", tgtok::XTail)
Bill Wendlingcd466f52010-12-08 20:02:49 +0000423 .Case("con", tgtok::XConcat)
424 .Case("shl", tgtok::XSHL)
425 .Case("sra", tgtok::XSRA)
426 .Case("srl", tgtok::XSRL)
427 .Case("cast", tgtok::XCast)
David Greene1434f662011-01-07 17:05:37 +0000428 .Case("empty", tgtok::XEmpty)
Bill Wendlingcd466f52010-12-08 20:02:49 +0000429 .Case("subst", tgtok::XSubst)
430 .Case("foreach", tgtok::XForEach)
431 .Case("strconcat", tgtok::XStrConcat)
432 .Default(tgtok::Error);
David Greened418c1b2009-05-14 20:54:48 +0000433
Bill Wendlingcd466f52010-12-08 20:02:49 +0000434 return Kind != tgtok::Error ? Kind : ReturnError(Start-1, "Unknown operator");
Chris Lattnera8058742007-11-18 02:57:27 +0000435}
436