2 // Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
\r
3 // Use of this source code is governed by a BSD-style license that can be
\r
4 // found in the LICENSE file.
\r
11 #include "numeric_lex.h"
\r
20 location = SourceLocation();
\r
24 bool Token::equals(const Token& other) const
\r
26 return (type == other.type) &&
\r
27 (flags == other.flags) &&
\r
28 (location == other.location) &&
\r
29 (text == other.text);
\r
32 void Token::setAtStartOfLine(bool start)
\r
35 flags |= AT_START_OF_LINE;
\r
37 flags &= ~AT_START_OF_LINE;
\r
40 void Token::setHasLeadingSpace(bool space)
\r
43 flags |= HAS_LEADING_SPACE;
\r
45 flags &= ~HAS_LEADING_SPACE;
\r
48 void Token::setExpansionDisabled(bool disable)
\r
51 flags |= EXPANSION_DISABLED;
\r
53 flags &= ~EXPANSION_DISABLED;
\r
56 bool Token::iValue(int* value) const
\r
58 assert(type == CONST_INT);
\r
59 return numeric_lex_int(text, value);
\r
62 bool Token::uValue(unsigned int* value) const
\r
64 assert(type == CONST_INT);
\r
65 return numeric_lex_int(text, value);
\r
68 bool Token::fValue(float* value) const
\r
70 assert(type == CONST_FLOAT);
\r
71 return numeric_lex_float(text, value);
\r
74 std::ostream& operator<<(std::ostream& out, const Token& token)
\r
76 if (token.hasLeadingSpace())
\r