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;
104 TokenInfo[tok::utf8_char_constant] |= aci_custom;
107 TokenInfo[tok::amp ] |= aci_avoid_equal; // &=
108 TokenInfo[tok::plus ] |= aci_avoid_equal; // +=
109 TokenInfo[tok::minus ] |= aci_avoid_equal; // -=
110 TokenInfo[tok::slash ] |= aci_avoid_equal; // /=
111 TokenInfo[tok::less ] |= aci_avoid_equal; // <=
112 TokenInfo[tok::greater ] |= aci_avoid_equal; // >=
113 TokenInfo[tok::pipe ] |= aci_avoid_equal; // |=
114 TokenInfo[tok::percent ] |= aci_avoid_equal; // %=
115 TokenInfo[tok::star ] |= aci_avoid_equal; // *=
116 TokenInfo[tok::exclaim ] |= aci_avoid_equal; // !=
117 TokenInfo[tok::lessless ] |= aci_avoid_equal; // <<=
118 TokenInfo[tok::greatergreater] |= aci_avoid_equal; // >>=
119 TokenInfo[tok::caret ] |= aci_avoid_equal; // ^=
120 TokenInfo[tok::equal ] |= aci_avoid_equal; // ==
123 /// GetFirstChar - Get the first character of the token \arg Tok,
125 static char GetFirstChar(Preprocessor &PP, const Token &Tok) {
126 if (IdentifierInfo *II = Tok.getIdentifierInfo()) {
129 } else if (!Tok.needsCleaning()) {
130 if (Tok.isLiteral() && Tok.getLiteralData()) {
131 return *Tok.getLiteralData();
134 return *SM.getCharacterData(SM.getSpellingLoc(Tok.getLocation()));
136 } else if (Tok.getLength() < 256) {
139 PP.getSpelling(Tok, TokPtr);
142 return PP.getSpelling(Tok)[0];
146 /// AvoidConcat - If printing PrevTok immediately followed by Tok would cause
159 const Token &Tok) const {
165 SourceLocation SpellLoc = SM.getSpellingLoc(Tok.getLocation());
169 tok::TokenKind PrevKind = PrevTok.getKind();
171 PrevKind = tok::identifier; // Language keyword or named operator.
181 if (Tok.isOneOf(tok::equal, tok::equalequal))
185 if (Tok.isAnnotation()) {
187 assert(Tok.isOneOf(tok::annot_module_include, tok::annot_module_begin,
188 tok::annot_module_end) &&
203 FirstChar = GetFirstChar(PP, Tok);
210 case tok::raw_identifier:
211 llvm_unreachable("tok::raw_identifier in non-raw lexing mode!");
213 case tok::string_literal:
214 case tok::wide_string_literal:
215 case tok::utf8_string_literal:
216 case tok::utf16_string_literal:
217 case tok::utf32_string_literal:
218 case tok::char_constant:
219 case tok::wide_char_constant:
220 case tok::utf8_char_constant:
221 case tok::utf16_char_constant:
222 case tok::utf32_char_constant:
228 if (Tok.getIdentifierInfo())
236 case tok::identifier: // id+id or id+number or id+L"foo".
238 if (Tok.is(tok::numeric_constant))
239 return GetFirstChar(PP, Tok) != '.';
241 if (Tok.getIdentifierInfo() ||
242 Tok.isOneOf(tok::wide_string_literal, tok::utf8_string_literal,
243 tok::utf16_string_literal, tok::utf32_string_literal,
244 tok::wide_char_constant, tok::utf8_char_constant,
245 tok::utf16_char_constant, tok::utf32_char_constant))
249 if (Tok.isNot(tok::char_constant) && Tok.isNot(tok::string_literal))
256 case tok::numeric_constant:
259 case tok::period: // ..., .*, .1234
260 return (FirstChar == '.' && PrevPrevTok.is(tok::period)) ||
263 case tok::amp: // &&
265 case tok::plus: // ++
267 case tok::minus: // --, ->, ->*
269 case tok::slash: //, /*, //
271 case tok::less: // <<, <<=, <:, <%
273 case tok::greater: // >>, >>=
275 case tok::pipe: // ||
277 case tok::percent: // %>, %:
279 case tok::colon: // ::, :>
282 case tok::hash: // ##, #@, %:%:
284 case tok::arrow: // ->*