Commit graph

36 commits

Author SHA1 Message Date
Itamar
7de6c1489b LibCpp: Parse basic constructors and destructors 2021-06-09 22:26:46 +02:00
Itamar
dcdb0c7035 LibCpp: Support non-field class members
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-06-09 22:26:46 +02:00
Itamar
fbf796cd9f LibCpp: Fix "NumricLiteral" => "NumericLiteral" typo 2021-05-19 23:19:07 +02:00
Itamar
402483ec1f LibCpp: Generalize ASTNode::dump() to support redirecting its output
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-19 23:19:07 +02:00
Itamar
f28d944122 LibCpp: Support 'auto' Type 2021-05-19 23:19:07 +02:00
Brian Gianforcaro
1682f0b760 Everything: Move to SPDX license identifiers in all files.
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-22 11:22:27 +02:00
Itamar
b87791cada LibCpp: Add 'Namespace' and 'Member' declaration types 2021-04-13 15:16:27 +02:00
Itamar
c6c83bd80e HackStudio+LibCpp: Include class members in Locator 2021-04-13 15:16:27 +02:00
Itamar
9e2e36724d LibCpp: Add TemplatizedName
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-06 21:51:58 +02:00
Itamar
e16036b9cc LibCpp: Introduce DummyASTNode
This allows us to use pase_* methods inside match_* methods,
without adding any actual AST nodes to the m_nodes list.
2021-04-06 21:51:58 +02:00
Itamar
aa717e6a62 LibCpp: Parse C-Style parse expressions 2021-04-06 21:51:58 +02:00
Itamar
ec2c54ee2e LibCpp: Parse "arrow" operator 2021-04-06 21:51:58 +02:00
Itamar
44833f1621 LibCpp: Parse braced initialization list 2021-04-06 21:51:58 +02:00
Itamar
fc503b1368 LibCpp: Parse sizeof() expression 2021-04-06 21:51:58 +02:00
Itamar
575d6a8ee1 LibCpp: Parse Bitwise & Logical Or & And operators 2021-04-06 21:51:58 +02:00
Itamar
8962581c9c LibCpp: Parse C++ cast expressions
parse static_cast, reinterpret_cast, dynamic_cast & const_cast
2021-04-06 21:51:58 +02:00
Itamar
646aaa111b LibCpp: Support parsing templatized function calls 2021-04-06 21:51:58 +02:00
Itamar
fe4122bbae LibCpp: Support parsing '!=" operator 2021-04-06 21:51:58 +02:00
Itamar
3295609aea LibCpp: Add AST::Name
A Name node is basically an identifier with an optional scope,
e.g Core::File.
2021-04-06 21:51:58 +02:00
Itamar
29b6915db9 LibCpp: Parse templatized types
We can now parse things like Vector<int>
2021-04-06 21:51:58 +02:00
Itamar
9954a1837f LibCpp: Parse nullptr literal 2021-04-06 21:51:58 +02:00
Itamar
cbb49f26d9 LibCpp: Support parsing binary "==" Operator 2021-04-06 21:51:58 +02:00
Itamar
1f9f6ea9d6 LibCpp: Support parsing function qualifiers 2021-04-06 21:51:58 +02:00
Itamar
84e34d76d8 HackStudio+LanguageServers/Cpp: Show scope of symbols in Locator 2021-03-23 18:32:39 +01:00
Itamar
b5cab861e3 LibCpp: Parse Namespace declaration
Also, remove unused State::Context
2021-03-23 18:32:39 +01:00
Itamar
8a102fe3ec LibCpp: Implement Parser::text_in_range using text of tokens
It was previously implemented by directly iterating over the program's
source.
2021-03-13 10:17:02 +01:00
Itamar
1d3b5dabc3 LibCpp: Parse ellipsis
We can now parse the printf function declaration :^)
2021-03-02 12:50:37 +01:00
Itamar
5a7abb8363 LibCpp: Parse type qualifiers 2021-03-02 12:50:37 +01:00
Itamar
54bc9114b3 HackStudio: Support searching symbol declarations in the Locator
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-27 16:37:35 +01:00
Itamar
a94b5376bc LanguageServers/Cpp: Update client asynchronously about symbols
As a document is parsed, the language server updates the client
asynchronously about symbol declarations it finds.
2021-02-27 16:37:35 +01:00
Andreas Kling
5d180d1f99 Everywhere: Rename ASSERT => VERIFY
(...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-23 20:56:54 +01:00
Itamar
d3ff82ba80 LibCpp: Store filename in ASTNodes
As part of the position information, we now also store the filename the
ASTNode belongs to.
2021-02-20 15:53:37 +01:00
Itamar
64c80f6ea4 LanguageServers/Cpp: Autocomplete function and struct/class names 2021-02-10 23:09:40 +01:00
Itamar
8ed65d7b48 LibCpp: Parse If statements 2021-02-08 23:10:38 +01:00
Ben Wiederhake
c9bb887c55 Everywhere: Remove unnecessary headers 1/4
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-02-08 18:03:57 +01:00
Itamar
c96b6987c4 LibCpp: Add the beginning of a C++ parser
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.
2021-01-27 21:10:57 +01:00