diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/source/Plugins/ExpressionParser/Go/GoParser.h | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2 |
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
Diffstat (limited to 'lldb/source/Plugins/ExpressionParser/Go/GoParser.h')
-rw-r--r-- | lldb/source/Plugins/ExpressionParser/Go/GoParser.h | 272 |
1 files changed, 126 insertions, 146 deletions
diff --git a/lldb/source/Plugins/ExpressionParser/Go/GoParser.h b/lldb/source/Plugins/ExpressionParser/Go/GoParser.h index 9ceb670..bd12855 100644 --- a/lldb/source/Plugins/ExpressionParser/Go/GoParser.h +++ b/lldb/source/Plugins/ExpressionParser/Go/GoParser.h @@ -1,4 +1,5 @@ -//===-- GoParser.h -----------------------------------------------*- C++ -*-===// +//===-- GoParser.h -----------------------------------------------*- C++ +//-*-===// // // The LLVM Compiler Infrastructure // @@ -10,155 +11,134 @@ #ifndef liblldb_GoParser_h #define liblldb_GoParser_h -#include "lldb/lldb-private.h" #include "Plugins/ExpressionParser/Go/GoAST.h" #include "Plugins/ExpressionParser/Go/GoLexer.h" +#include "lldb/lldb-private.h" -namespace lldb_private -{ -class GoParser -{ - public: - explicit GoParser(const char *src); - - GoASTStmt *Statement(); - - GoASTStmt *GoStmt(); - GoASTStmt *ReturnStmt(); - GoASTStmt *BranchStmt(); - GoASTStmt *EmptyStmt(); - GoASTStmt *ExpressionStmt(GoASTExpr *e); - GoASTStmt *IncDecStmt(GoASTExpr *e); - GoASTStmt *Assignment(GoASTExpr *e); - GoASTBlockStmt *Block(); - - GoASTExpr *MoreExpressionList(); // ["," Expression] - GoASTIdent *MoreIdentifierList(); // ["," Identifier] - - GoASTExpr *Expression(); - GoASTExpr *UnaryExpr(); - GoASTExpr *OrExpr(); - GoASTExpr *AndExpr(); - GoASTExpr *RelExpr(); - GoASTExpr *AddExpr(); - GoASTExpr *MulExpr(); - GoASTExpr *PrimaryExpr(); - GoASTExpr *Operand(); - GoASTExpr *Conversion(); - - GoASTExpr *Selector(GoASTExpr *e); - GoASTExpr *IndexOrSlice(GoASTExpr *e); - GoASTExpr *TypeAssertion(GoASTExpr *e); - GoASTExpr *Arguments(GoASTExpr *e); - - GoASTExpr *Type(); - GoASTExpr *Type2(); - GoASTExpr *ArrayOrSliceType(bool allowEllipsis); - GoASTExpr *StructType(); - GoASTExpr *FunctionType(); - GoASTExpr *InterfaceType(); - GoASTExpr *MapType(); - GoASTExpr *ChanType(); - GoASTExpr *ChanType2(); - - GoASTExpr *Name(); - GoASTExpr *QualifiedIdent(GoASTIdent *p); - GoASTIdent *Identifier(); - - GoASTField *FieldDecl(); - GoASTExpr *AnonymousFieldType(); - GoASTExpr *FieldNamesAndType(GoASTField *f); - - GoASTFieldList *Params(); - GoASTField *ParamDecl(); - GoASTExpr *ParamType(); - GoASTFuncType *Signature(); - GoASTExpr *CompositeLit(); - GoASTExpr *FunctionLit(); - GoASTExpr *Element(); - GoASTCompositeLit *LiteralValue(); - - bool - Failed() const - { - return m_failed; - } - bool - AtEOF() const - { - return m_lexer.BytesRemaining() == 0 && m_pos == m_tokens.size(); - } - - void GetError(Error &error); - - private: - class Rule; - friend class Rule; - - std::nullptr_t - syntaxerror() - { - m_failed = true; - return nullptr; +namespace lldb_private { +class GoParser { +public: + explicit GoParser(const char *src); + + GoASTStmt *Statement(); + + GoASTStmt *GoStmt(); + GoASTStmt *ReturnStmt(); + GoASTStmt *BranchStmt(); + GoASTStmt *EmptyStmt(); + GoASTStmt *ExpressionStmt(GoASTExpr *e); + GoASTStmt *IncDecStmt(GoASTExpr *e); + GoASTStmt *Assignment(GoASTExpr *e); + GoASTBlockStmt *Block(); + + GoASTExpr *MoreExpressionList(); // ["," Expression] + GoASTIdent *MoreIdentifierList(); // ["," Identifier] + + GoASTExpr *Expression(); + GoASTExpr *UnaryExpr(); + GoASTExpr *OrExpr(); + GoASTExpr *AndExpr(); + GoASTExpr *RelExpr(); + GoASTExpr *AddExpr(); + GoASTExpr *MulExpr(); + GoASTExpr *PrimaryExpr(); + GoASTExpr *Operand(); + GoASTExpr *Conversion(); + + GoASTExpr *Selector(GoASTExpr *e); + GoASTExpr *IndexOrSlice(GoASTExpr *e); + GoASTExpr *TypeAssertion(GoASTExpr *e); + GoASTExpr *Arguments(GoASTExpr *e); + + GoASTExpr *Type(); + GoASTExpr *Type2(); + GoASTExpr *ArrayOrSliceType(bool allowEllipsis); + GoASTExpr *StructType(); + GoASTExpr *FunctionType(); + GoASTExpr *InterfaceType(); + GoASTExpr *MapType(); + GoASTExpr *ChanType(); + GoASTExpr *ChanType2(); + + GoASTExpr *Name(); + GoASTExpr *QualifiedIdent(GoASTIdent *p); + GoASTIdent *Identifier(); + + GoASTField *FieldDecl(); + GoASTExpr *AnonymousFieldType(); + GoASTExpr *FieldNamesAndType(GoASTField *f); + + GoASTFieldList *Params(); + GoASTField *ParamDecl(); + GoASTExpr *ParamType(); + GoASTFuncType *Signature(); + GoASTExpr *CompositeLit(); + GoASTExpr *FunctionLit(); + GoASTExpr *Element(); + GoASTCompositeLit *LiteralValue(); + + bool Failed() const { return m_failed; } + bool AtEOF() const { + return m_lexer.BytesRemaining() == 0 && m_pos == m_tokens.size(); + } + + void GetError(Error &error); + +private: + class Rule; + friend class Rule; + + std::nullptr_t syntaxerror() { + m_failed = true; + return nullptr; + } + GoLexer::Token &next() { + if (m_pos >= m_tokens.size()) { + if (m_pos != 0 && (m_tokens.back().m_type == GoLexer::TOK_EOF || + m_tokens.back().m_type == GoLexer::TOK_INVALID)) + return m_tokens.back(); + m_pos = m_tokens.size(); + m_tokens.push_back(m_lexer.Lex()); } - GoLexer::Token & - next() - { - if (m_pos >= m_tokens.size()) - { - if (m_pos != 0 && - (m_tokens.back().m_type == GoLexer::TOK_EOF || m_tokens.back().m_type == GoLexer::TOK_INVALID)) - return m_tokens.back(); - m_pos = m_tokens.size(); - m_tokens.push_back(m_lexer.Lex()); - } - return m_tokens[m_pos++]; - } - GoLexer::TokenType - peek() - { - GoLexer::Token &tok = next(); - --m_pos; - return tok.m_type; - } - GoLexer::Token * - match(GoLexer::TokenType t) - { - GoLexer::Token &tok = next(); - if (tok.m_type == t) - return &tok; - --m_pos; - m_last_tok = t; - return nullptr; - } - GoLexer::Token * - mustMatch(GoLexer::TokenType t) - { - GoLexer::Token *tok = match(t); - if (tok) - return tok; - return syntaxerror(); - } - bool Semicolon(); - - GoASTStmt * - FinishStmt(GoASTStmt *s) - { - if (!Semicolon()) - m_failed = true; - return s; - } - - llvm::StringRef CopyString(llvm::StringRef s); - - GoLexer m_lexer; - std::vector<GoLexer::Token> m_tokens; - size_t m_pos; - llvm::StringRef m_error; - llvm::StringRef m_last; - GoLexer::TokenType m_last_tok; - llvm::StringMap<uint8_t> m_strings; - bool m_failed; + return m_tokens[m_pos++]; + } + GoLexer::TokenType peek() { + GoLexer::Token &tok = next(); + --m_pos; + return tok.m_type; + } + GoLexer::Token *match(GoLexer::TokenType t) { + GoLexer::Token &tok = next(); + if (tok.m_type == t) + return &tok; + --m_pos; + m_last_tok = t; + return nullptr; + } + GoLexer::Token *mustMatch(GoLexer::TokenType t) { + GoLexer::Token *tok = match(t); + if (tok) + return tok; + return syntaxerror(); + } + bool Semicolon(); + + GoASTStmt *FinishStmt(GoASTStmt *s) { + if (!Semicolon()) + m_failed = true; + return s; + } + + llvm::StringRef CopyString(llvm::StringRef s); + + GoLexer m_lexer; + std::vector<GoLexer::Token> m_tokens; + size_t m_pos; + llvm::StringRef m_error; + llvm::StringRef m_last; + GoLexer::TokenType m_last_tok; + llvm::StringMap<uint8_t> m_strings; + bool m_failed; }; } |