LCOV - code coverage report
Current view: top level - gfx/angle/src/compiler/preprocessor - Token.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 40 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //
       2             : // Copyright (c) 2011 The ANGLE Project Authors. All rights reserved.
       3             : // Use of this source code is governed by a BSD-style license that can be
       4             : // found in the LICENSE file.
       5             : //
       6             : 
       7             : #include "compiler/preprocessor/Token.h"
       8             : 
       9             : #include "common/debug.h"
      10             : #include "compiler/preprocessor/numeric_lex.h"
      11             : 
      12             : namespace pp
      13             : {
      14             : 
      15           0 : void Token::reset()
      16             : {
      17           0 :     type = 0;
      18           0 :     flags = 0;
      19           0 :     location = SourceLocation();
      20           0 :     text.clear();
      21           0 : }
      22             : 
      23           0 : bool Token::equals(const Token &other) const
      24             : {
      25           0 :     return (type == other.type) &&
      26           0 :            (flags == other.flags) &&
      27           0 :            (location == other.location) &&
      28           0 :            (text == other.text);
      29             : }
      30             : 
      31           0 : void Token::setAtStartOfLine(bool start)
      32             : {
      33           0 :     if (start)
      34           0 :         flags |= AT_START_OF_LINE;
      35             :     else
      36           0 :         flags &= ~AT_START_OF_LINE;
      37           0 : }
      38             : 
      39           0 : void Token::setHasLeadingSpace(bool space)
      40             : {
      41           0 :     if (space)
      42           0 :         flags |= HAS_LEADING_SPACE;
      43             :     else
      44           0 :         flags &= ~HAS_LEADING_SPACE;
      45           0 : }
      46             : 
      47           0 : void Token::setExpansionDisabled(bool disable)
      48             : {
      49           0 :     if (disable)
      50           0 :         flags |= EXPANSION_DISABLED;
      51             :     else
      52           0 :         flags &= ~EXPANSION_DISABLED;
      53           0 : }
      54             : 
      55           0 : bool Token::iValue(int *value) const
      56             : {
      57           0 :     ASSERT(type == CONST_INT);
      58           0 :     return numeric_lex_int(text, value);
      59             : }
      60             : 
      61           0 : bool Token::uValue(unsigned int *value) const
      62             : {
      63           0 :     ASSERT(type == CONST_INT);
      64           0 :     return numeric_lex_int(text, value);
      65             : }
      66             : 
      67           0 : bool Token::fValue(float *value) const
      68             : {
      69           0 :     ASSERT(type == CONST_FLOAT);
      70           0 :     return numeric_lex_float(text, value);
      71             : }
      72             : 
      73           0 : std::ostream &operator<<(std::ostream &out, const Token &token)
      74             : {
      75           0 :     if (token.hasLeadingSpace())
      76           0 :         out << " ";
      77             : 
      78           0 :     out << token.text;
      79           0 :     return out;
      80             : }
      81             : 
      82             : }  // namespace pp

Generated by: LCOV version 1.13