diff options
author | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-12 00:37:51 +0000 |
---|---|---|
committer | Richard Smith <richard-llvm@metafoo.co.uk> | 2011-10-12 00:37:51 +0000 |
commit | d5e1d606f8c22ebda17c6fbf952f8c1696428758 (patch) | |
tree | 15b82c6ae27ba0ee786fbc31796d37f0dc3830bf /include/clang/Lex/Lexer.h | |
parent | 13546a871db44c707001f507a9edfd0d5bcc81b4 (diff) |
Handle Perforce-style conflict markers like normal conflict markers. Perforce
swaps over the <<<< and >>>> markers, and uses shorter markers than traditional
tools.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141751 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/Lexer.h')
-rw-r--r-- | include/clang/Lex/Lexer.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/include/clang/Lex/Lexer.h b/include/clang/Lex/Lexer.h index e67013c10e..e01427f574 100644 --- a/include/clang/Lex/Lexer.h +++ b/include/clang/Lex/Lexer.h @@ -26,6 +26,19 @@ class SourceManager; class Preprocessor; class DiagnosticBuilder; +/// ConflictMarkerKind - Kinds of conflict marker which the lexer might be +/// recovering from. +enum ConflictMarkerKind { + /// Not within a conflict marker. + CMK_None, + /// A normal or diff3 conflict marker, initiated by at least 7 <s, + /// separated by at least 7 =s or |s, and terminated by at least 7 >s. + CMK_Normal, + /// A Perforce-style conflict marker, initiated by 4 >s, separated by 4 =s, + /// and terminated by 4 <s. + CMK_Perforce +}; + /// Lexer - This provides a simple interface that turns a text buffer into a /// stream of tokens. This provides no support for file reading or buffering, /// or buffering/seeking of tokens, only forward lexing is supported. It relies @@ -37,8 +50,7 @@ class Lexer : public PreprocessorLexer { const char *BufferEnd; // End of the buffer. SourceLocation FileLoc; // Location for start of file. LangOptions Features; // Features enabled by this language (cache). - bool Is_PragmaLexer : 1; // True if lexer for _Pragma handling. - bool IsInConflictMarker : 1; // True if in a VCS conflict marker '<<<<<<<' + bool Is_PragmaLexer; // True if lexer for _Pragma handling. //===--------------------------------------------------------------------===// // Context-specific lexing flags set by the preprocessor. @@ -66,6 +78,9 @@ class Lexer : public PreprocessorLexer { // line" flag set on it. bool IsAtStartOfLine; + // CurrentConflictMarkerState - The kind of conflict marker we are handling. + ConflictMarkerKind CurrentConflictMarkerState; + Lexer(const Lexer&); // DO NOT IMPLEMENT void operator=(const Lexer&); // DO NOT IMPLEMENT friend class Preprocessor; |