diff options
Diffstat (limited to 'tools/preproc/asm_file.cpp')
-rw-r--r-- | tools/preproc/asm_file.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/preproc/asm_file.cpp b/tools/preproc/asm_file.cpp index eba486e66..7deaccc8a 100644 --- a/tools/preproc/asm_file.cpp +++ b/tools/preproc/asm_file.cpp @@ -197,6 +197,31 @@ Directive AsmFile::GetDirective() return Directive::Unknown; } +// Checks if we're at label that ends with '::'. +// Returns the name if so and an empty string if not. +std::string AsmFile::GetGlobalLabel() +{ + long start = m_pos; + long pos = m_pos; + + if (IsIdentifierStartingChar(m_buffer[pos])) + { + pos++; + + while (IsIdentifierChar(m_buffer[pos])) + pos++; + } + + if (m_buffer[pos] == ':' && m_buffer[pos + 1] == ':') + { + m_pos = pos + 2; + ExpectEmptyRestOfLine(); + return std::string(&m_buffer[start], pos - start); + } + + return std::string(); +} + // Skips tabs and spaces. void AsmFile::SkipWhitespace() { |