aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/MC/MCParser/MCAsmLexer.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm/MC/MCParser/MCAsmLexer.h')
-rw-r--r--include/llvm/MC/MCParser/MCAsmLexer.h43
1 files changed, 22 insertions, 21 deletions
diff --git a/include/llvm/MC/MCParser/MCAsmLexer.h b/include/llvm/MC/MCParser/MCAsmLexer.h
index e3d4181..b05891c 100644
--- a/include/llvm/MC/MCParser/MCAsmLexer.h
+++ b/include/llvm/MC/MCParser/MCAsmLexer.h
@@ -18,7 +18,7 @@
namespace llvm {
-/// AsmToken - Target independent representation for an assembler token.
+/// Target independent representation for an assembler token.
class AsmToken {
public:
enum TokenKind {
@@ -74,25 +74,26 @@ public:
SMLoc getLoc() const;
SMLoc getEndLoc() const;
+ SMRange getLocRange() const;
- /// getStringContents - Get the contents of a string token (without quotes).
+ /// Get the contents of a string token (without quotes).
StringRef getStringContents() const {
assert(Kind == String && "This token isn't a string!");
return Str.slice(1, Str.size() - 1);
}
- /// getIdentifier - Get the identifier string for the current token, which
- /// should be an identifier or a string. This gets the portion of the string
- /// which should be used as the identifier, e.g., it does not include the
- /// quotes on strings.
+ /// Get the identifier string for the current token, which should be an
+ /// identifier or a string. This gets the portion of the string which should
+ /// be used as the identifier, e.g., it does not include the quotes on
+ /// strings.
StringRef getIdentifier() const {
if (Kind == Identifier)
return getString();
return getStringContents();
}
- /// getString - Get the string for the current token, this includes all
- /// characters (for example, the quotes on strings) in the token.
+ /// Get the string for the current token, this includes all characters (for
+ /// example, the quotes on strings) in the token.
///
/// The returned StringRef points into the source manager's memory buffer, and
/// is safe to store across calls to Lex().
@@ -113,8 +114,8 @@ public:
}
};
-/// MCAsmLexer - Generic assembler lexer interface, for use by target specific
-/// assembly lexers.
+/// Generic assembler lexer interface, for use by target specific assembly
+/// lexers.
class MCAsmLexer {
/// The current token, stored in the base class for faster access.
AsmToken CurTok;
@@ -142,7 +143,7 @@ protected: // Can only create subclasses.
public:
virtual ~MCAsmLexer();
- /// Lex - Consume the next token from the input stream and return it.
+ /// Consume the next token from the input stream and return it.
///
/// The lexer will continuosly return the end-of-file token once the end of
/// the main input file has been reached.
@@ -152,37 +153,37 @@ public:
virtual StringRef LexUntilEndOfStatement() = 0;
- /// getLoc - Get the current source location.
+ /// Get the current source location.
SMLoc getLoc() const;
- /// getTok - Get the current (last) lexed token.
- const AsmToken &getTok() {
+ /// Get the current (last) lexed token.
+ const AsmToken &getTok() const {
return CurTok;
}
- /// peekTok - Look ahead at the next token to be lexed.
+ /// Look ahead at the next token to be lexed.
virtual const AsmToken peekTok(bool ShouldSkipSpace = true) = 0;
- /// getErrLoc - Get the current error location
+ /// Get the current error location
const SMLoc &getErrLoc() {
return ErrLoc;
}
- /// getErr - Get the current error string
+ /// Get the current error string
const std::string &getErr() {
return Err;
}
- /// getKind - Get the kind of current token.
+ /// Get the kind of current token.
AsmToken::TokenKind getKind() const { return CurTok.getKind(); }
- /// is - Check if the current token has kind \p K.
+ /// Check if the current token has kind \p K.
bool is(AsmToken::TokenKind K) const { return CurTok.is(K); }
- /// isNot - Check if the current token has kind \p K.
+ /// Check if the current token has kind \p K.
bool isNot(AsmToken::TokenKind K) const { return CurTok.isNot(K); }
- /// setSkipSpace - Set whether spaces should be ignored by the lexer
+ /// Set whether spaces should be ignored by the lexer
void setSkipSpace(bool val) { SkipSpace = val; }
bool getAllowAtInIdentifier() { return AllowAtInIdentifier; }