summaryrefslogtreecommitdiffstats
path: root/lib/Format/UnwrappedLineParser.h
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2015-05-21 12:23:34 +0000
committerManuel Klimek <klimek@google.com>2015-05-21 12:23:34 +0000
commit384ba28ba1769530821c2b4ed2016b32d9447bec (patch)
tree8b9af8aae4aceff4a0e03c28ba0ec939dee8d2f4 /lib/Format/UnwrappedLineParser.h
parent8bfeeffa350e1e32d1b487cd414d673988bd148a (diff)
clang-format: [JS] Better support for fat arrows.
Assigns a token type (TT_JsFatArrow) to => tokens, and uses that to more easily recognize and format fat arrow functions. Improves function parsing to better recognize formal parameter lists and return type declarations. Recognizes arrow functions and parse function bodies as child blocks. Patch by Martin Probst. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@237895 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/UnwrappedLineParser.h')
-rw-r--r--lib/Format/UnwrappedLineParser.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Format/UnwrappedLineParser.h b/lib/Format/UnwrappedLineParser.h
index c2fa029576..6a6e56fea0 100644
--- a/lib/Format/UnwrappedLineParser.h
+++ b/lib/Format/UnwrappedLineParser.h
@@ -107,6 +107,11 @@ private:
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();