Home | History | Annotate | Download | only in Lex

Lines Matching refs:Tok

47 bool TokenConcatenation::IsIdentifierStringPrefix(const Token &Tok) const {
50 if (!Tok.needsCleaning()) {
51 if (Tok.getLength() < 1 || Tok.getLength() > 3)
54 const char *Ptr = SM.getCharacterData(SM.getSpellingLoc(Tok.getLocation()));
55 return IsStringPrefix(StringRef(Ptr, Tok.getLength()),
59 if (Tok.getLength() < 256) {
62 unsigned length = PP.getSpelling(Tok, TokPtr);
66 return IsStringPrefix(StringRef(PP.getSpelling(Tok)), LangOpts.CPlusPlus0x);
73 TokenInfo[tok::identifier ] |= aci_custom;
74 TokenInfo[tok::numeric_constant] |= aci_custom_firstchar;
75 TokenInfo[tok::period ] |= aci_custom_firstchar;
76 TokenInfo[tok::amp ] |= aci_custom_firstchar;
77 TokenInfo[tok::plus ] |= aci_custom_firstchar;
78 TokenInfo[tok::minus ] |= aci_custom_firstchar;
79 TokenInfo[tok::slash ] |= aci_custom_firstchar;
80 TokenInfo[tok::less ] |= aci_custom_firstchar;
81 TokenInfo[tok::greater ] |= aci_custom_firstchar;
82 TokenInfo[tok::pipe ] |= aci_custom_firstchar;
83 TokenInfo[tok::percent ] |= aci_custom_firstchar;
84 TokenInfo[tok::colon ] |= aci_custom_firstchar;
85 TokenInfo[tok::hash ] |= aci_custom_firstchar;
86 TokenInfo[tok::arrow ] |= aci_custom_firstchar;
89 TokenInfo[tok::amp ] |= aci_avoid_equal; // &=
90 TokenInfo[tok::plus ] |= aci_avoid_equal; // +=
91 TokenInfo[tok::minus ] |= aci_avoid_equal; // -=
92 TokenInfo[tok::slash ] |= aci_avoid_equal; // /=
93 TokenInfo[tok::less ] |= aci_avoid_equal; // <=
94 TokenInfo[tok::greater ] |= aci_avoid_equal; // >=
95 TokenInfo[tok::pipe ] |= aci_avoid_equal; // |=
96 TokenInfo[tok::percent ] |= aci_avoid_equal; // %=
97 TokenInfo[tok::star ] |= aci_avoid_equal; // *=
98 TokenInfo[tok::exclaim ] |= aci_avoid_equal; // !=
99 TokenInfo[tok::lessless ] |= aci_avoid_equal; // <<=
100 TokenInfo[tok::greatergreater] |= aci_avoid_equal; // >>=
101 TokenInfo[tok::caret ] |= aci_avoid_equal; // ^=
102 TokenInfo[tok::equal ] |= aci_avoid_equal; // ==
105 /// GetFirstChar - Get the first character of the token \arg Tok,
107 static char GetFirstChar(Preprocessor &PP, const Token &Tok) {
108 if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
111 } else if (!Tok.needsCleaning()) {
112 if (Tok.isLiteral() && Tok.getLiteralData()) {
113 return *Tok.getLiteralData();
116 return *SM.getCharacterData(SM.getSpellingLoc(Tok.getLocation()));
118 } else if (Tok.getLength() < 256) {
121 PP.getSpelling(Tok, TokPtr);
124 return PP.getSpelling(Tok)[0];
128 /// AvoidConcat - If printing PrevTok immediately followed by Tok would cause
141 const Token &Tok) const {
145 if (PrevTok.getLocation().isFileID() && Tok.getLocation().isFileID() &&
147 Tok.getLocation())
150 tok::TokenKind PrevKind = PrevTok.getKind();
152 PrevKind = tok::identifier;
162 if (Tok.is(tok::equal) || Tok.is(tok::equalequal))
176 FirstChar = GetFirstChar(PP, Tok);
184 case tok::raw_identifier:
185 llvm_unreachable("tok::raw_identifier in non-raw lexing mode!");
188 case tok::identifier: // id+id or id+number or id+L"foo".
190 if (Tok.is(tok::numeric_constant))
191 return GetFirstChar(PP, Tok) != '.';
193 if (Tok.getIdentifierInfo() || Tok.is(tok::wide_string_literal) ||
194 Tok.is(tok::utf8_string_literal) || Tok.is(tok::utf16_string_literal) ||
195 Tok.is(tok::utf32_string_literal) || Tok.is(tok::wide_char_constant) ||
196 Tok.is(tok::utf16_char_constant) || Tok.is(tok::utf32_char_constant))
200 if (Tok.isNot(tok::char_constant) && Tok.isNot(tok::string_literal))
206 case tok::numeric_constant:
207 return isalnum(FirstChar) || Tok.is(tok::numeric_constant) ||
209 case tok::period: // ..., .*, .1234
210 return (FirstChar == '.' && PrevPrevTok.is(tok::period)) ||
213 case tok::amp: // &&
215 case tok::plus: // ++
217 case tok::minus: // --, ->, ->*
219 case tok::slash: //, /*, //
221 case tok::less: // <<, <<=, <:, <%
223 case tok::greater: // >>, >>=
225 case tok::pipe: // ||
227 case tok::percent: // %>, %:
229 case tok::colon: // ::, :>
232 case tok::hash: // ##, #@, %:%:
234 case tok::arrow: // ->*