diff options
Diffstat (limited to 'lib/Format/UnwrappedLineParser.h')
-rw-r--r-- | lib/Format/UnwrappedLineParser.h | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/Format/UnwrappedLineParser.h b/lib/Format/UnwrappedLineParser.h index 3218afe..6a6e56f 100644 --- a/lib/Format/UnwrappedLineParser.h +++ b/lib/Format/UnwrappedLineParser.h @@ -65,8 +65,7 @@ public: ArrayRef<FormatToken *> Tokens, UnwrappedLineConsumer &Callback); - /// Returns true in case of a structural error. - bool parse(); + void parse(); private: void reset(); @@ -95,6 +94,7 @@ private: void parseCaseLabel(); void parseSwitch(); void parseNamespace(); + void parseNew(); void parseAccessSpecifier(); void parseEnum(); void parseJavaEnumBody(); @@ -103,16 +103,22 @@ private: void parseObjCUntilAtEnd(); void parseObjCInterfaceOrImplementation(); void parseObjCProtocol(); + void parseJavaScriptEs6ImportExport(); bool tryToParseLambda(); bool tryToParseLambdaIntroducer(); void tryToParseJSFunction(); + /// \brief Parses tokens until encountering the CloseKind token, but balances + /// tokens when encountering more OpenKind tokens. Useful for e.g. parsing a + /// curly brace delimited block that can contain nested blocks. + /// The parser must be positioned on a token of OpenKind. + void parseBalanced(tok::TokenKind OpenKind, tok::TokenKind CloseKind); void addUnwrappedLine(); bool eof() const; void nextToken(); void readToken(); void flushComments(bool NewlineBeforeNext); void pushToken(FormatToken *Tok); - void calculateBraceTypes(); + void calculateBraceTypes(bool ExpectClassBody = false); // Marks a conditional compilation edge (for example, an '#if', '#ifdef', // '#else' or merge conflict marker). If 'Unreachable' is true, assumes @@ -156,10 +162,6 @@ private: // whether we are in a compound statement or not. std::vector<bool> DeclarationScopeStack; - // Will be true if we encounter an error that leads to possibily incorrect - // indentation levels. - bool StructuralError; - const FormatStyle &Style; const AdditionalKeywords &Keywords; |