summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCpp/AST.h
AgeCommit message (Collapse)Author
2022-02-27LanguageServers/Cpp: Make find declaration of enums workItamar
2022-02-23LibCpp: Allow qualified names in AST Declaration nodesItamar
Previously, the names of declarations where stored as a simple StringView. Because of that, we couldn't parse out-of-line function definitions, which have qualified names. For example, we couldn't parse the following snippet: ``` void MyClass::foo(){} ``` To fix this, we now store the name of a declaration with a ASTNode::Name node, which represents a qualified named.
2022-02-09LibCpp: Fix Declaration::is_member()Itamar
Previously, Declaration::is_member() was just a stub that always returned false. It now works by checking whether the parent ASTNode is a declaration of a struct or a class type.
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-08-02LibCpp: Add support for parsing function typesAli Mohammad Pur
This makes it work with types like `Function<T(U, V)>`.
2021-08-02LibCpp: Add support for parsing reference typesAli Mohammad Pur
2021-08-02LibCpp: Parse enum members with explicit valuesAli Mohammad Pur
2021-07-10LibCpp: Use fast_is<T> and verify_cast<T> to replace C-style castsItamar
Thanks to @alimpfard for suggesting this :)
2021-07-10LibCpp: Make the fields of AST node types privateItamar
Previously almost all fields were public and were directly accessed by the Parser and CppComprehensionEngine. This commit makes all fields of AST node types private. They are now accessed via getters & setters.
2021-07-04LibCpp: Add Parser::tokens_in_range(start, end)Itamar
This function returns the tokens that exist in the specified range.
2021-06-29LibCpp: Differentiate between Type and NamedTypeItamar
This adds a new ASTNode type called 'NamedType' which inherits from the Type node. Previously every Type node had a name field, but it was not logically accurate. For example, pointer types do not have a name (the pointed-to type may have one).
2021-06-29LibCpp: Support parsing enum classesItamar
2021-06-09LibCpp: Parse basic constructors and destructorsItamar
2021-06-09LibCpp: Support non-field class membersItamar
Previously, we had a special ASTNode for class members, "MemberDeclaration", which only represented fields. This commit removes MemberDeclaration and instead uses regular Declaration nodes for representing the members of a class. This means that we can now also parse methods, inner-classes, and other declarations that appear inside of a class.
2021-05-19LibCpp: Fix "NumricLiteral" => "NumericLiteral" typoItamar
2021-05-19LibCpp: Generalize ASTNode::dump() to support redirecting its outputItamar
Previously, ASTNode::dump() used outln() for output, which meant it always wrote its output to stdout. After this commit, ASTNode::dump() receives an 'output' argument (which is stdout by default). This enables writing the output to somewhere else. This will be useful for testing the LibCpp Parser with the output of ASTNode::dump.
2021-05-19LibCpp: Support 'auto' TypeItamar
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-13LibCpp: Add 'Namespace' and 'Member' declaration typesItamar
2021-04-13HackStudio+LibCpp: Include class members in LocatorItamar
2021-04-06LibCpp: Add TemplatizedNameItamar
This type represents templatized names, and replaces our previous use of 'TemplatizedType' and 'TemplatizedFunctionCall'. Also, we now parse function calls as secondary expressions.
2021-04-06LibCpp: Introduce DummyASTNodeItamar
This allows us to use pase_* methods inside match_* methods, without adding any actual AST nodes to the m_nodes list.
2021-04-06LibCpp: Parse C-Style parse expressionsItamar
2021-04-06LibCpp: Parse "arrow" operatorItamar
2021-04-06LibCpp: Parse braced initialization listItamar
2021-04-06LibCpp: Parse sizeof() expressionItamar
2021-04-06LibCpp: Parse Bitwise & Logical Or & And operatorsItamar
2021-04-06LibCpp: Parse C++ cast expressionsItamar
parse static_cast, reinterpret_cast, dynamic_cast & const_cast
2021-04-06LibCpp: Support parsing templatized function callsItamar
2021-04-06LibCpp: Support parsing '!=" operatorItamar
2021-04-06LibCpp: Add AST::NameItamar
A Name node is basically an identifier with an optional scope, e.g Core::File.
2021-04-06LibCpp: Parse templatized typesItamar
We can now parse things like Vector<int>
2021-04-06LibCpp: Parse nullptr literalItamar
2021-04-06LibCpp: Support parsing binary "==" OperatorItamar
2021-04-06LibCpp: Support parsing function qualifiersItamar
2021-03-23HackStudio+LanguageServers/Cpp: Show scope of symbols in LocatorItamar
2021-03-23LibCpp: Parse Namespace declarationItamar
Also, remove unused State::Context
2021-03-13LibCpp: Implement Parser::text_in_range using text of tokensItamar
It was previously implemented by directly iterating over the program's source.
2021-03-02LibCpp: Parse ellipsisItamar
We can now parse the printf function declaration :^)
2021-03-02LibCpp: Parse type qualifiersItamar
2021-02-27HackStudio: Support searching symbol declarations in the LocatorItamar
The Locator now keeps a cache of the declared symbol in a document. The language client updates that cache whenever it gets an update from the language server about declared symbols. This allows searching for symbol declarations in the Locator, in addition to file names. Closes #5478
2021-02-27LanguageServers/Cpp: Update client asynchronously about symbolsItamar
As a document is parsed, the language server updates the client asynchronously about symbol declarations it finds.
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-20LibCpp: Store filename in ASTNodesItamar
As part of the position information, we now also store the filename the ASTNode belongs to.
2021-02-10LanguageServers/Cpp: Autocomplete function and struct/class namesItamar
2021-02-08LibCpp: Parse If statementsItamar
2021-02-08Everywhere: Remove unnecessary headers 1/4Ben Wiederhake
Arbitrarily split up to make git bisect easier. These unnecessary #include's were found by combining an automated tool (which determined likely candidates) and some brain power (which decided whether the #include is also semantically superfluous). My favorite #include: #include "Applications/Piano/Music.h" // You can't have too much music in life!
2021-01-27LibCpp: Add the beginning of a C++ parserItamar
This parser will be used by the C++ langauge server to provide better auto-complete (& maybe also other things in the future). It is designed to be error tolerant, and keeps track of the position spans of the AST nodes, which should be useful later for incremental parsing.