~ubuntu-branches/ubuntu/raring/qtwebkit-source/raring-proposed

« back to all changes in this revision

Viewing changes to Source/ThirdParty/ANGLE/src/compiler/preprocessor/new/Token.cpp

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2013-02-18 14:24:18 UTC
  • Revision ID: package-import@ubuntu.com-20130218142418-eon0jmjg3nj438uy
Tags: upstream-2.3
ImportĀ upstreamĀ versionĀ 2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 "Token.h"
 
8
 
 
9
namespace pp
 
10
{
 
11
 
 
12
void Token::reset()
 
13
{
 
14
    type = 0;
 
15
    flags = 0;
 
16
    location = SourceLocation();
 
17
    value.clear();
 
18
}
 
19
 
 
20
bool Token::equals(const Token& other) const
 
21
{
 
22
    return (type == other.type) &&
 
23
           (flags == other.flags) &&
 
24
           (location == other.location) &&
 
25
           (value == other.value);
 
26
}
 
27
 
 
28
void Token::setAtStartOfLine(bool start)
 
29
{
 
30
    if (start)
 
31
        flags |= AT_START_OF_LINE;
 
32
    else
 
33
        flags &= ~AT_START_OF_LINE;
 
34
}
 
35
 
 
36
void Token::setHasLeadingSpace(bool space)
 
37
{
 
38
    if (space)
 
39
        flags |= HAS_LEADING_SPACE;
 
40
    else
 
41
        flags &= ~HAS_LEADING_SPACE;
 
42
}
 
43
 
 
44
void Token::setExpansionDisabled(bool disable)
 
45
{
 
46
    if (disable)
 
47
        flags |= EXPANSION_DISABLED;
 
48
    else
 
49
        flags &= ~EXPANSION_DISABLED;
 
50
}
 
51
 
 
52
std::ostream& operator<<(std::ostream& out, const Token& token)
 
53
{
 
54
    if (token.hasLeadingSpace())
 
55
        out << " ";
 
56
 
 
57
    out << token.value;
 
58
    return out;
 
59
}
 
60
 
 
61
}  // namespace pp