Home | History | Annotate | Download | only in Lex

Lines Matching refs:tok

48 bool TokenConcatenation::IsIdentifierStringPrefix(const Token &Tok) const {
51 if (!Tok.needsCleaning()) {
52 if (Tok.getLength() < 1 || Tok.getLength() > 3)
55 const char *Ptr = SM.getCharacterData(SM.getSpellingLoc(Tok.getLocation()));
56 return IsStringPrefix(StringRef(Ptr, Tok.getLength()),
60 if (Tok.getLength() < 256) {
63 unsigned length = PP.getSpelling(Tok, TokPtr);
67 return IsStringPrefix(StringRef(PP.getSpelling(Tok)), LangOpts.CPlusPlus11);
74 TokenInfo[tok::identifier ] |= aci_custom;
75 TokenInfo[tok::numeric_constant] |= aci_custom_firstchar;
76 TokenInfo[tok::period ] |= aci_custom_firstchar;
77 TokenInfo[tok::amp ] |= aci_custom_firstchar;
78 TokenInfo[tok::plus ] |= aci_custom_firstchar;
79 TokenInfo[tok::minus ] |= aci_custom_firstchar;
80 TokenInfo[tok::slash ] |= aci_custom_firstchar;
81 TokenInfo[tok::less ] |= aci_custom_firstchar;
82 TokenInfo[tok::greater ] |= aci_custom_firstchar;
83 TokenInfo[tok::pipe ] |= aci_custom_firstchar;
84 TokenInfo[tok::percent ] |= aci_custom_firstchar;
85 TokenInfo[tok::colon ] |= aci_custom_firstchar;
86 TokenInfo[tok::hash ] |= aci_custom_firstchar;
87 TokenInfo[tok::arrow ] |= aci_custom_firstchar;
91 TokenInfo[tok::string_literal ] |= aci_custom;
92 TokenInfo[tok::wide_string_literal ] |= aci_custom;
93 TokenInfo[tok::utf8_string_literal ] |= aci_custom;
94 TokenInfo[tok::utf16_string_literal] |= aci_custom;
95 TokenInfo[tok::utf32_string_literal] |= aci_custom;
96 TokenInfo[tok::char_constant ] |= aci_custom;
97 TokenInfo[tok::wide_char_constant ] |= aci_custom;
98 TokenInfo[tok::utf16_char_constant ] |= aci_custom;
99 TokenInfo[tok::utf32_char_constant ] |= aci_custom;
103 TokenInfo[tok::amp ] |= aci_avoid_equal; // &=
104 TokenInfo[tok::plus ] |= aci_avoid_equal; // +=
105 TokenInfo[tok::minus ] |= aci_avoid_equal; // -=
106 TokenInfo[tok::slash ] |= aci_avoid_equal; // /=
107 TokenInfo[tok::less ] |= aci_avoid_equal; // <=
108 TokenInfo[tok::greater ] |= aci_avoid_equal; // >=
109 TokenInfo[tok::pipe ] |= aci_avoid_equal; // |=
110 TokenInfo[tok::percent ] |= aci_avoid_equal; // %=
111 TokenInfo[tok::star ] |= aci_avoid_equal; // *=
112 TokenInfo[tok::exclaim ] |= aci_avoid_equal; // !=
113 TokenInfo[tok::lessless ] |= aci_avoid_equal; // <<=
114 TokenInfo[tok::greatergreater] |= aci_avoid_equal; // >>=
115 TokenInfo[tok::caret ] |= aci_avoid_equal; // ^=
116 TokenInfo[tok::equal ] |= aci_avoid_equal; // ==
119 /// GetFirstChar - Get the first character of the token \arg Tok,
121 static char GetFirstChar(Preprocessor &PP, const Token &Tok) {
122 if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
125 } else if (!Tok.needsCleaning()) {
126 if (Tok.isLiteral() && Tok.getLiteralData()) {
127 return *Tok.getLiteralData();
130 return *SM.getCharacterData(SM.getSpellingLoc(Tok.getLocation()));
132 } else if (Tok.getLength() < 256) {
135 PP.getSpelling(Tok, TokPtr);
138 return PP.getSpelling(Tok)[0];
142 /// AvoidConcat - If printing PrevTok immediately followed by Tok would cause
155 const Token &Tok) const {
161 SourceLocation SpellLoc = SM.getSpellingLoc(Tok.getLocation());
165 tok::TokenKind PrevKind = PrevTok.getKind();
167 PrevKind = tok::identifier;
177 if (Tok.is(tok::equal) || Tok.is(tok::equalequal))
191 FirstChar = GetFirstChar(PP, Tok);
198 case tok::raw_identifier:
199 llvm_unreachable("tok::raw_identifier in non-raw lexing mode!");
201 case tok::string_literal:
202 case tok::wide_string_literal:
203 case tok::utf8_string_literal:
204 case tok::utf16_string_literal:
205 case tok::utf32_string_literal:
206 case tok::char_constant:
207 case tok::wide_char_constant:
208 case tok::utf16_char_constant:
209 case tok::utf32_char_constant:
215 if (Tok.getIdentifierInfo())
223 case tok::identifier: // id+id or id+number or id+L"foo".
225 if (Tok.is(tok::numeric_constant))
226 return GetFirstChar(PP, Tok) != '.';
228 if (Tok.getIdentifierInfo() || Tok.is(tok::wide_string_literal) ||
229 Tok.is(tok::utf8_string_literal) || Tok.is(tok::utf16_string_literal) ||
230 Tok.is(tok::utf32_string_literal) || Tok.is(tok::wide_char_constant) ||
231 Tok.is(tok::utf16_char_constant) || Tok.is(tok::utf32_char_constant))
235 if (Tok.isNot(tok::char_constant) && Tok.isNot(tok::string_literal))
242 case tok::numeric_constant:
245 case tok::period: // ..., .*, .1234
246 return (FirstChar == '.' && PrevPrevTok.is(tok::period)) ||
249 case tok::amp: // &&
251 case tok::plus: // ++
253 case tok::minus: // --, ->, ->*
255 case tok::slash: //, /*, //
257 case tok::less: // <<, <<=, <:, <%
259 case tok::greater: // >>, >>=
261 case tok::pipe: // ||
263 case tok::percent: // %>, %:
265 case tok::colon: // ::, :>
268 case tok::hash: // ##, #@, %:%:
270 case tok::arrow: // ->*