llvm.org GIT mirror llvm / 3959002
Don't repeat name in comment. NFC. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221664 91177308-0d34-0410-b5e6-96231b3b80d8 Rafael Espindola 6 years ago
1 changed file(s) with 20 addition(s) and 20 deletion(s). Raw diff Collapse all Expand all
1717
1818 namespace llvm {
1919
20 /// AsmToken - Target independent representation for an assembler token.
20 /// Target independent representation for an assembler token.
2121 class AsmToken {
2222 public:
2323 enum TokenKind {
7575 SMLoc getEndLoc() const;
7676 SMRange getLocRange() const;
7777
78 /// getStringContents - Get the contents of a string token (without quotes).
78 /// Get the contents of a string token (without quotes).
7979 StringRef getStringContents() const {
8080 assert(Kind == String && "This token isn't a string!");
8181 return Str.slice(1, Str.size() - 1);
8282 }
8383
84 /// getIdentifier - Get the identifier string for the current token, which
85 /// should be an identifier or a string. This gets the portion of the string
86 /// which should be used as the identifier, e.g., it does not include the
87 /// quotes on strings.
84 /// Get the identifier string for the current token, which should be an
85 /// identifier or a string. This gets the portion of the string which should
86 /// be used as the identifier, e.g., it does not include the quotes on
87 /// strings.
8888 StringRef getIdentifier() const {
8989 if (Kind == Identifier)
9090 return getString();
9191 return getStringContents();
9292 }
9393
94 /// getString - Get the string for the current token, this includes all
95 /// characters (for example, the quotes on strings) in the token.
94 /// Get the string for the current token, this includes all characters (for
95 /// example, the quotes on strings) in the token.
9696 ///
9797 /// The returned StringRef points into the source manager's memory buffer, and
9898 /// is safe to store across calls to Lex().
113113 }
114114 };
115115
116 /// MCAsmLexer - Generic assembler lexer interface, for use by target specific
117 /// assembly lexers.
116 /// Generic assembler lexer interface, for use by target specific assembly
117 /// lexers.
118118 class MCAsmLexer {
119119 /// The current token, stored in the base class for faster access.
120120 AsmToken CurTok;
142142 public:
143143 virtual ~MCAsmLexer();
144144
145 /// Lex - Consume the next token from the input stream and return it.
145 /// Consume the next token from the input stream and return it.
146146 ///
147147 /// The lexer will continuosly return the end-of-file token once the end of
148148 /// the main input file has been reached.
152152
153153 virtual StringRef LexUntilEndOfStatement() = 0;
154154
155 /// getLoc - Get the current source location.
155 /// Get the current source location.
156156 SMLoc getLoc() const;
157157
158 /// getTok - Get the current (last) lexed token.
158 /// Get the current (last) lexed token.
159159 const AsmToken &getTok() {
160160 return CurTok;
161161 }
162162
163 /// peekTok - Look ahead at the next token to be lexed.
163 /// Look ahead at the next token to be lexed.
164164 virtual const AsmToken peekTok(bool ShouldSkipSpace = true) = 0;
165165
166 /// getErrLoc - Get the current error location
166 /// Get the current error location
167167 const SMLoc &getErrLoc() {
168168 return ErrLoc;
169169 }
170170
171 /// getErr - Get the current error string
171 /// Get the current error string
172172 const std::string &getErr() {
173173 return Err;
174174 }
175175
176 /// getKind - Get the kind of current token.
176 /// Get the kind of current token.
177177 AsmToken::TokenKind getKind() const { return CurTok.getKind(); }
178178
179 /// is - Check if the current token has kind \p K.
179 /// Check if the current token has kind \p K.
180180 bool is(AsmToken::TokenKind K) const { return CurTok.is(K); }
181181
182 /// isNot - Check if the current token has kind \p K.
182 /// Check if the current token has kind \p K.
183183 bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); }
184184
185 /// setSkipSpace - Set whether spaces should be ignored by the lexer
185 /// Set whether spaces should be ignored by the lexer
186186 void setSkipSpace(bool val) { SkipSpace = val; }
187187
188188 bool getAllowAtInIdentifier() { return AllowAtInIdentifier; }