class UnwrappedLineParser
Declaration
class UnwrappedLineParser { /* full declaration omitted */ };
Declared at: clang/lib/Format/UnwrappedLineParser.h:76
Member Variables
- private std::unique_ptr<UnwrappedLine> Line
- private SmallVector<clang::format::FormatToken*, 1> CommentsBeforeNextToken
- private clang::format::FormatToken* FormatTok
- private bool MustBreakBeforeNextToken
- private SmallVector<clang::format::UnwrappedLine, 8> Lines
- private SmallVector<clang::format::UnwrappedLine, 4> PreprocessorDirectives
- private SmallVectorImpl<clang::format::UnwrappedLine>* CurrentLines
- private llvm::BitVector DeclarationScopeStack
- private const clang::format::FormatStyle& Style
- private const clang::format::AdditionalKeywords& Keywords
- private llvm::Regex CommentPragmasRegex
- private clang::format::FormatTokenSource* Tokens
- private clang::format::UnwrappedLineConsumer& Callback
- private ArrayRef<clang::format::FormatToken*> AllTokens
- private SmallVector<bool, 8> NestedTooDeep
- private SmallVector< clang::format::UnwrappedLineParser::PPBranch, 16> PPStack
- private int PPBranchLevel
- private SmallVector<int, 8> PPLevelBranchIndex
- private SmallVector<int, 8> PPLevelBranchCount
- private std::stack<int> PPChainBranchIndex
- private clang::format::UnwrappedLineParser:: IncludeGuardState IncludeGuard
- private clang::format::FormatToken* IncludeGuardToken
- private unsigned int FirstStartColumn
Method Overview
- public UnwrappedLineParser(const clang::format::FormatStyle & Style, const clang::format::AdditionalKeywords & Keywords, unsigned int FirstStartColumn, ArrayRef<clang::format::FormatToken *> Tokens, clang::format::UnwrappedLineConsumer & Callback)
- private void addUnwrappedLine(clang::format::UnwrappedLineParser::LineLevel AdjustLevel = LineLevel::Remove)
- private void calculateBraceTypes(bool ExpectClassBody = false)
- private size_t computePPHash() const
- private void conditionalCompilationAlternative()
- private void conditionalCompilationCondition(bool Unreachable)
- private void conditionalCompilationEnd()
- private void conditionalCompilationStart(bool Unreachable)
- private void distributeComments(const SmallVectorImpl<clang::format::FormatToken *> & Comments, const clang::format::FormatToken * NextTok)
- private bool eof() const
- private void flushComments(bool NewlineBeforeNext)
- private void handleAttributes()
- private bool handleCppAttributes()
- private bool isOnNewLine(const clang::format::FormatToken & FormatTok)
- private void keepAncestorBraces()
- private bool mightFitOnOneLine(clang::format::UnwrappedLine & Line, const clang::format::FormatToken * OpeningBrace = nullptr) const
- private void nextToken(int LevelDifference = 0)
- public void parse()
- private void parseAccessSpecifier()
- private clang::format::FormatToken * parseBlock(bool MustBeDeclaration = false, unsigned int AddLevels = 1U, bool MunchSemi = true, bool KeepBraces = true, clang::format::UnwrappedLineParser::IfStmtKind * IfKind = nullptr, bool UnindentWhitesmithsBraces = false, bool CanContainBracedList = true, clang::format::TokenType NextLBracesType = TT_Unknown)
- private bool parseBracedList(bool ContinueOnSemicolons = false, bool IsEnum = false, tok::TokenKind ClosingBraceKind = tok::r_brace)
- private void parseCSharpAttribute()
- private void parseCSharpGenericTypeConstraint()
- private void parseCaseLabel()
- private void parseChildBlock(bool CanContainBracedList = true, clang::format::TokenType NextLBracesType = TT_Unknown)
- private void parseConcept()
- private void parseConstraintExpression()
- private void parseDoWhile()
- private bool parseEnum()
- private void parseFile()
- private void parseForOrWhileLoop()
- private clang::format::FormatToken * parseIfThenElse(clang::format::UnwrappedLineParser::IfStmtKind * IfKind, bool KeepBraces = false)
- private void parseJavaEnumBody()
- private void parseJavaScriptEs6ImportExport()
- private void parseLabel(bool LeftAlignLabel = false)
- private bool parseLevel(const clang::format::FormatToken * OpeningBrace = nullptr, bool CanContainBracedList = true, clang::format::TokenType NextLBracesType = TT_Unknown, clang::format::UnwrappedLineParser::IfStmtKind * IfKind = nullptr, clang::format::FormatToken ** IfLeftBrace = nullptr)
- private void parseLoopBody(bool KeepBraces, bool WrapRightBrace)
- private void parseModuleImport()
- private void parseNamespace()
- private void parseNew()
- private void parseObjCInterfaceOrImplementation()
- private void parseObjCLightweightGenerics()
- private void parseObjCMethod()
- private bool parseObjCProtocol()
- private void parseObjCProtocolList()
- private void parseObjCUntilAtEnd()
- private void parsePPDefine()
- private void parsePPDirective()
- private void parsePPElIf()
- private void parsePPElse()
- private void parsePPEndIf()
- private void parsePPIf(bool IfDef)
- private void parsePPUnknown()
- private void parseParens(clang::format::TokenType AmpAmpTokenType = TT_Unknown)
- private void parseRecord(bool ParseAsExpr = false)
- private bool parseRequires()
- private void parseRequiresClause(clang::format::FormatToken * RequiresToken)
- private void parseRequiresExpression(clang::format::FormatToken * RequiresToken)
- private void parseSquare(bool LambdaIntroducer = false)
- private void parseStatementMacro()
- private bool parseStructLike()
- private void parseStructuralElement(bool IsTopLevel = false, clang::format::TokenType NextLBracesType = TT_Unknown, clang::format::UnwrappedLineParser::IfStmtKind * IfKind = nullptr, clang::format::FormatToken ** IfLeftBrace = nullptr, bool * HasDoWhile = nullptr, bool * HasLabel = nullptr)
- private void parseSwitch()
- private void parseTryCatch()
- private void parseUnbracedBody(bool CheckEOF = false)
- private bool precededByCommentOrPPDirective() const
- private void pushToken(clang::format::FormatToken * Tok)
- private void readToken(int LevelDifference = 0)
- private void readTokenWithJavaScriptASI()
- private void reset()
- private bool tryToParseBracedList()
- private bool tryToParseChildBlock()
- private void tryToParseJSFunction()
- private bool tryToParseLambda()
- private bool tryToParseLambdaIntroducer()
- private bool tryToParsePropertyAccessor()
- private bool tryToParseSimpleAttribute()
Methods
¶UnwrappedLineParser(
const clang::format::FormatStyle& Style,
const clang::format::AdditionalKeywords&
Keywords,
unsigned int FirstStartColumn,
ArrayRef<clang::format::FormatToken*> Tokens,
clang::format::UnwrappedLineConsumer&
Callback)
UnwrappedLineParser(
const clang::format::FormatStyle& Style,
const clang::format::AdditionalKeywords&
Keywords,
unsigned int FirstStartColumn,
ArrayRef<clang::format::FormatToken*> Tokens,
clang::format::UnwrappedLineConsumer&
Callback)
Declared at: clang/lib/Format/UnwrappedLineParser.h:78
Parameters
- const clang::format::FormatStyle& Style
- const clang::format::AdditionalKeywords& Keywords
- unsigned int FirstStartColumn
- ArrayRef<clang::format::FormatToken*> Tokens
- clang::format::UnwrappedLineConsumer& Callback
¶void addUnwrappedLine(
clang::format::UnwrappedLineParser::LineLevel
AdjustLevel = LineLevel::Remove)
void addUnwrappedLine(
clang::format::UnwrappedLineParser::LineLevel
AdjustLevel = LineLevel::Remove)
Declared at: clang/lib/Format/UnwrappedLineParser.h:182
Parameters
- clang::format::UnwrappedLineParser::LineLevel AdjustLevel = LineLevel::Remove
¶void calculateBraceTypes(
bool ExpectClassBody = false)
void calculateBraceTypes(
bool ExpectClassBody = false)
Declared at: clang/lib/Format/UnwrappedLineParser.h:207
Parameters
- bool ExpectClassBody = false
¶size_t computePPHash() const
size_t computePPHash() const
Declared at: clang/lib/Format/UnwrappedLineParser.h:223
¶void conditionalCompilationAlternative()
void conditionalCompilationAlternative()
Declared at: clang/lib/Format/UnwrappedLineParser.h:215
¶void conditionalCompilationCondition(
bool Unreachable)
void conditionalCompilationCondition(
bool Unreachable)
Declared at: clang/lib/Format/UnwrappedLineParser.h:213
Parameters
- bool Unreachable
¶void conditionalCompilationEnd()
void conditionalCompilationEnd()
Declared at: clang/lib/Format/UnwrappedLineParser.h:216
¶void conditionalCompilationStart(bool Unreachable)
void conditionalCompilationStart(bool Unreachable)
Declared at: clang/lib/Format/UnwrappedLineParser.h:214
Parameters
- bool Unreachable
¶void distributeComments(
const SmallVectorImpl<
clang::format::FormatToken*>& Comments,
const clang::format::FormatToken* NextTok)
void distributeComments(
const SmallVectorImpl<
clang::format::FormatToken*>& Comments,
const clang::format::FormatToken* NextTok)
Declared at: clang/lib/Format/UnwrappedLineParser.h:201
Parameters
- const SmallVectorImpl< clang::format::FormatToken*>& Comments
- const clang::format::FormatToken* NextTok
¶bool eof() const
bool eof() const
Declared at: clang/lib/Format/UnwrappedLineParser.h:183
¶void flushComments(bool NewlineBeforeNext)
void flushComments(bool NewlineBeforeNext)
Declared at: clang/lib/Format/UnwrappedLineParser.h:205
Parameters
- bool NewlineBeforeNext
¶void handleAttributes()
void handleAttributes()
Declared at: clang/lib/Format/UnwrappedLineParser.h:132
¶bool handleCppAttributes()
bool handleCppAttributes()
Declared at: clang/lib/Format/UnwrappedLineParser.h:133
¶bool isOnNewLine(
const clang::format::FormatToken& FormatTok)
bool isOnNewLine(
const clang::format::FormatToken& FormatTok)
Declared at: clang/lib/Format/UnwrappedLineParser.h:218
Parameters
- const clang::format::FormatToken& FormatTok
¶void keepAncestorBraces()
void keepAncestorBraces()
Declared at: clang/lib/Format/UnwrappedLineParser.h:130
¶bool mightFitOnOneLine(
clang::format::UnwrappedLine& Line,
const clang::format::FormatToken*
OpeningBrace = nullptr) const
bool mightFitOnOneLine(
clang::format::UnwrappedLine& Line,
const clang::format::FormatToken*
OpeningBrace = nullptr) const
Declared at: clang/lib/Format/UnwrappedLineParser.h:101
Parameters
- clang::format::UnwrappedLine& Line
- const clang::format::FormatToken* OpeningBrace = nullptr
¶void nextToken(int LevelDifference = 0)
void nextToken(int LevelDifference = 0)
Declared at: clang/lib/Format/UnwrappedLineParser.h:188
Parameters
- int LevelDifference = 0
¶void parse()
void parse()
Declared at: clang/lib/Format/UnwrappedLineParser.h:83
¶void parseAccessSpecifier()
void parseAccessSpecifier()
Declared at: clang/lib/Format/UnwrappedLineParser.h:145
¶clang::format::FormatToken* parseBlock(
bool MustBeDeclaration = false,
unsigned int AddLevels = 1U,
bool MunchSemi = true,
bool KeepBraces = true,
clang::format::UnwrappedLineParser::
IfStmtKind* IfKind = nullptr,
bool UnindentWhitesmithsBraces = false,
bool CanContainBracedList = true,
clang::format::TokenType NextLBracesType =
TT_Unknown)
clang::format::FormatToken* parseBlock(
bool MustBeDeclaration = false,
unsigned int AddLevels = 1U,
bool MunchSemi = true,
bool KeepBraces = true,
clang::format::UnwrappedLineParser::
IfStmtKind* IfKind = nullptr,
bool UnindentWhitesmithsBraces = false,
bool CanContainBracedList = true,
clang::format::TokenType NextLBracesType =
TT_Unknown)
Declared at: clang/lib/Format/UnwrappedLineParser.h:103
Parameters
- bool MustBeDeclaration = false
- unsigned int AddLevels = 1U
- bool MunchSemi = true
- bool KeepBraces = true
- clang::format::UnwrappedLineParser::IfStmtKind* IfKind = nullptr
- bool UnindentWhitesmithsBraces = false
- bool CanContainBracedList = true
- clang::format::TokenType NextLBracesType = TT_Unknown
¶bool parseBracedList(
bool ContinueOnSemicolons = false,
bool IsEnum = false,
tok::TokenKind ClosingBraceKind =
tok::r_brace)
bool parseBracedList(
bool ContinueOnSemicolons = false,
bool IsEnum = false,
tok::TokenKind ClosingBraceKind =
tok::r_brace)
Declared at: clang/lib/Format/UnwrappedLineParser.h:126
Parameters
- bool ContinueOnSemicolons = false
- bool IsEnum = false
- tok::TokenKind ClosingBraceKind = tok::r_brace
¶void parseCSharpAttribute()
void parseCSharpAttribute()
Declared at: clang/lib/Format/UnwrappedLineParser.h:166
¶void parseCSharpGenericTypeConstraint()
void parseCSharpGenericTypeConstraint()
Declared at: clang/lib/Format/UnwrappedLineParser.h:170
¶void parseCaseLabel()
void parseCaseLabel()
Declared at: clang/lib/Format/UnwrappedLineParser.h:140
¶void parseChildBlock(
bool CanContainBracedList = true,
clang::format::TokenType NextLBracesType =
TT_Unknown)
void parseChildBlock(
bool CanContainBracedList = true,
clang::format::TokenType NextLBracesType =
TT_Unknown)
Declared at: clang/lib/Format/UnwrappedLineParser.h:109
Parameters
- bool CanContainBracedList = true
- clang::format::TokenType NextLBracesType = TT_Unknown
¶void parseConcept()
void parseConcept()
Declared at: clang/lib/Format/UnwrappedLineParser.h:148
¶void parseConstraintExpression()
void parseConstraintExpression()
Declared at: clang/lib/Format/UnwrappedLineParser.h:152
¶void parseDoWhile()
void parseDoWhile()
Declared at: clang/lib/Format/UnwrappedLineParser.h:138
¶bool parseEnum()
bool parseEnum()
Declared at: clang/lib/Format/UnwrappedLineParser.h:146
¶void parseFile()
void parseFile()
Declared at: clang/lib/Format/UnwrappedLineParser.h:94
¶void parseForOrWhileLoop()
void parseForOrWhileLoop()
Declared at: clang/lib/Format/UnwrappedLineParser.h:137
¶clang::format::FormatToken* parseIfThenElse(
clang::format::UnwrappedLineParser::
IfStmtKind* IfKind,
bool KeepBraces = false)
clang::format::FormatToken* parseIfThenElse(
clang::format::UnwrappedLineParser::
IfStmtKind* IfKind,
bool KeepBraces = false)
Declared at: clang/lib/Format/UnwrappedLineParser.h:134
Parameters
- clang::format::UnwrappedLineParser::IfStmtKind* IfKind
- bool KeepBraces = false
¶void parseJavaEnumBody()
void parseJavaEnumBody()
Declared at: clang/lib/Format/UnwrappedLineParser.h:153
¶void parseJavaScriptEs6ImportExport()
void parseJavaScriptEs6ImportExport()
Declared at: clang/lib/Format/UnwrappedLineParser.h:164
¶void parseLabel(bool LeftAlignLabel = false)
void parseLabel(bool LeftAlignLabel = false)
Declared at: clang/lib/Format/UnwrappedLineParser.h:139
Parameters
- bool LeftAlignLabel = false
¶bool parseLevel(
const clang::format::FormatToken*
OpeningBrace = nullptr,
bool CanContainBracedList = true,
clang::format::TokenType NextLBracesType =
TT_Unknown,
clang::format::UnwrappedLineParser::
IfStmtKind* IfKind = nullptr,
clang::format::FormatToken** IfLeftBrace =
nullptr)
bool parseLevel(
const clang::format::FormatToken*
OpeningBrace = nullptr,
bool CanContainBracedList = true,
clang::format::TokenType NextLBracesType =
TT_Unknown,
clang::format::UnwrappedLineParser::
IfStmtKind* IfKind = nullptr,
clang::format::FormatToken** IfLeftBrace =
nullptr)
Declared at: clang/lib/Format/UnwrappedLineParser.h:96
Parameters
- const clang::format::FormatToken* OpeningBrace = nullptr
- bool CanContainBracedList = true
- clang::format::TokenType NextLBracesType = TT_Unknown
- clang::format::UnwrappedLineParser::IfStmtKind* IfKind = nullptr
- clang::format::FormatToken** IfLeftBrace = nullptr
¶void parseLoopBody(bool KeepBraces,
bool WrapRightBrace)
void parseLoopBody(bool KeepBraces,
bool WrapRightBrace)
Declared at: clang/lib/Format/UnwrappedLineParser.h:136
Parameters
- bool KeepBraces
- bool WrapRightBrace
¶void parseModuleImport()
void parseModuleImport()
Declared at: clang/lib/Format/UnwrappedLineParser.h:143
¶void parseNamespace()
void parseNamespace()
Declared at: clang/lib/Format/UnwrappedLineParser.h:142
¶void parseNew()
void parseNew()
Declared at: clang/lib/Format/UnwrappedLineParser.h:144
¶void parseObjCInterfaceOrImplementation()
void parseObjCInterfaceOrImplementation()
Declared at: clang/lib/Format/UnwrappedLineParser.h:162
¶void parseObjCLightweightGenerics()
void parseObjCLightweightGenerics()
Declared at: clang/lib/Format/UnwrappedLineParser.h:158
¶void parseObjCMethod()
void parseObjCMethod()
Declared at: clang/lib/Format/UnwrappedLineParser.h:159
¶bool parseObjCProtocol()
bool parseObjCProtocol()
Declared at: clang/lib/Format/UnwrappedLineParser.h:163
¶void parseObjCProtocolList()
void parseObjCProtocolList()
Declared at: clang/lib/Format/UnwrappedLineParser.h:160
¶void parseObjCUntilAtEnd()
void parseObjCUntilAtEnd()
Declared at: clang/lib/Format/UnwrappedLineParser.h:161
¶void parsePPDefine()
void parsePPDefine()
Declared at: clang/lib/Format/UnwrappedLineParser.h:112
¶void parsePPDirective()
void parsePPDirective()
Declared at: clang/lib/Format/UnwrappedLineParser.h:111
¶void parsePPElIf()
void parsePPElIf()
Declared at: clang/lib/Format/UnwrappedLineParser.h:114
¶void parsePPElse()
void parsePPElse()
Declared at: clang/lib/Format/UnwrappedLineParser.h:115
¶void parsePPEndIf()
void parsePPEndIf()
Declared at: clang/lib/Format/UnwrappedLineParser.h:116
¶void parsePPIf(bool IfDef)
void parsePPIf(bool IfDef)
Declared at: clang/lib/Format/UnwrappedLineParser.h:113
Parameters
- bool IfDef
¶void parsePPUnknown()
void parsePPUnknown()
Declared at: clang/lib/Format/UnwrappedLineParser.h:117
¶void parseParens(clang::format::TokenType
AmpAmpTokenType = TT_Unknown)
void parseParens(clang::format::TokenType
AmpAmpTokenType = TT_Unknown)
Declared at: clang/lib/Format/UnwrappedLineParser.h:128
Parameters
- clang::format::TokenType AmpAmpTokenType = TT_Unknown
¶void parseRecord(bool ParseAsExpr = false)
void parseRecord(bool ParseAsExpr = false)
Declared at: clang/lib/Format/UnwrappedLineParser.h:157
Parameters
- bool ParseAsExpr = false
¶bool parseRequires()
bool parseRequires()
Declared at: clang/lib/Format/UnwrappedLineParser.h:149
¶void parseRequiresClause(
clang::format::FormatToken* RequiresToken)
void parseRequiresClause(
clang::format::FormatToken* RequiresToken)
Declared at: clang/lib/Format/UnwrappedLineParser.h:150
Parameters
- clang::format::FormatToken* RequiresToken
¶void parseRequiresExpression(
clang::format::FormatToken* RequiresToken)
void parseRequiresExpression(
clang::format::FormatToken* RequiresToken)
Declared at: clang/lib/Format/UnwrappedLineParser.h:151
Parameters
- clang::format::FormatToken* RequiresToken
¶void parseSquare(bool LambdaIntroducer = false)
void parseSquare(bool LambdaIntroducer = false)
Declared at: clang/lib/Format/UnwrappedLineParser.h:129
Parameters
- bool LambdaIntroducer = false
¶void parseStatementMacro()
void parseStatementMacro()
Declared at: clang/lib/Format/UnwrappedLineParser.h:165
¶bool parseStructLike()
bool parseStructLike()
Declared at: clang/lib/Format/UnwrappedLineParser.h:147
¶void parseStructuralElement(
bool IsTopLevel = false,
clang::format::TokenType NextLBracesType =
TT_Unknown,
clang::format::UnwrappedLineParser::
IfStmtKind* IfKind = nullptr,
clang::format::FormatToken** IfLeftBrace =
nullptr,
bool* HasDoWhile = nullptr,
bool* HasLabel = nullptr)
void parseStructuralElement(
bool IsTopLevel = false,
clang::format::TokenType NextLBracesType =
TT_Unknown,
clang::format::UnwrappedLineParser::
IfStmtKind* IfKind = nullptr,
clang::format::FormatToken** IfLeftBrace =
nullptr,
bool* HasDoWhile = nullptr,
bool* HasLabel = nullptr)
Declared at: clang/lib/Format/UnwrappedLineParser.h:119
Parameters
- bool IsTopLevel = false
- clang::format::TokenType NextLBracesType = TT_Unknown
- clang::format::UnwrappedLineParser::IfStmtKind* IfKind = nullptr
- clang::format::FormatToken** IfLeftBrace = nullptr
- bool* HasDoWhile = nullptr
- bool* HasLabel = nullptr
¶void parseSwitch()
void parseSwitch()
Declared at: clang/lib/Format/UnwrappedLineParser.h:141
¶void parseTryCatch()
void parseTryCatch()
Declared at: clang/lib/Format/UnwrappedLineParser.h:135
¶void parseUnbracedBody(bool CheckEOF = false)
void parseUnbracedBody(bool CheckEOF = false)
Declared at: clang/lib/Format/UnwrappedLineParser.h:131
Parameters
- bool CheckEOF = false
¶bool precededByCommentOrPPDirective() const
bool precededByCommentOrPPDirective() const
Declared at: clang/lib/Format/UnwrappedLineParser.h:95
¶void pushToken(clang::format::FormatToken* Tok)
void pushToken(clang::format::FormatToken* Tok)
Declared at: clang/lib/Format/UnwrappedLineParser.h:206
Parameters
¶void readToken(int LevelDifference = 0)
void readToken(int LevelDifference = 0)
Declared at: clang/lib/Format/UnwrappedLineParser.h:189
Parameters
- int LevelDifference = 0
¶void readTokenWithJavaScriptASI()
void readTokenWithJavaScriptASI()
Declared at: clang/lib/Format/UnwrappedLineParser.h:118
¶void reset()
void reset()
Declared at: clang/lib/Format/UnwrappedLineParser.h:93
¶bool tryToParseBracedList()
bool tryToParseBracedList()
Declared at: clang/lib/Format/UnwrappedLineParser.h:125
¶bool tryToParseChildBlock()
bool tryToParseChildBlock()
Declared at: clang/lib/Format/UnwrappedLineParser.h:172
¶void tryToParseJSFunction()
void tryToParseJSFunction()
Declared at: clang/lib/Format/UnwrappedLineParser.h:175
¶bool tryToParseLambda()
bool tryToParseLambda()
Declared at: clang/lib/Format/UnwrappedLineParser.h:171
¶bool tryToParseLambdaIntroducer()
bool tryToParseLambdaIntroducer()
Declared at: clang/lib/Format/UnwrappedLineParser.h:173
¶bool tryToParsePropertyAccessor()
bool tryToParsePropertyAccessor()
Declared at: clang/lib/Format/UnwrappedLineParser.h:174
¶bool tryToParseSimpleAttribute()
bool tryToParseSimpleAttribute()
Declared at: clang/lib/Format/UnwrappedLineParser.h:176