Itamar
fd851ec5c9
LibCpp: Handle class access-specifiers in the Parser
...
We can now handle access-specifier tags (for example 'private:') when
parsing class declarations.
We currently only consume these tags on move on. We'll need to add some
logic that accounts for the access level of symbols down the road.
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
0c9db38e8f
LibCpp: Modify Token::to_string() to include more information
...
Token::to_string() now includes not only the token's type, but also its
text and span in the document.
2021-05-22 15:52:11 +02:00
Itamar
ef95ddcbfa
LibCpp: Fix match_expression()
...
match_expression() will now return true if there's a match for a Name
node.
2021-05-19 23:19:07 +02:00
Itamar
f28d944122
LibCpp: Support 'auto' Type
2021-05-19 23:19:07 +02:00
Itamar
0e51aea781
LibCpp: Modify parsing of a Name's scope
...
A Name node can now have a non-empty scope and a null name.
For example, "AK::" has a non-empty scope and a null name component.
2021-05-15 23:28:50 +02:00
Itamar
84e41c4565
LibCpp: Modify logic of Parser::index_of_node_at
...
After this commit, Parser::index_of_node_at will prefer to return nodes
with greater indices.
Since the parsing logic ensures that child nodes come after parent
nodes, this change makes this function return child nodes when possible.
2021-05-15 23:28:50 +02:00
Itamar
5c42dc854d
LibCpp: Rename m_definitions=>m_preprocessor_definitions
2021-05-09 20:58:27 +02:00
Ali Mohammad Pur
62af7c4bdf
AK+LibCpp: Remove DEBUG_SPAM in favour of per-application defines
...
What happens if one file defines DEBUG_SPAM, and another doesn't,
then we link them together and get ODR violations? -- @ADKaster
2021-05-08 22:14:39 +02:00
Gunnar Beutner
6cf59b6ae9
Everywhere: Turn #if *_DEBUG into dbgln_if/if constexpr
2021-05-01 21:25:06 +02:00
Brian Gianforcaro
7a73f11005
LibCpp: Convert ScopeLogger to use AK:SourceLocation
...
Utilize AK::SourceLocation to get function information into
the scope logger, instead of relying on pre-processor macros.
2021-04-25 09:32:03 +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
4831dc0e30
LibCpp: Support parsing class declarations
2021-04-19 21:48:42 +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
510b5073de
LanguageServers/Cpp: Refactor logic of find declaration
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
d482b3fd60
LibCpp: Parse empty for loops
2021-04-06 21:51:58 +02:00
Itamar
fc503b1368
LibCpp: Parse sizeof() expression
2021-04-06 21:51:58 +02:00
Itamar
8bcf5daf3f
LibCpp: Handle 'struct' prefix before a type
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
68e9a05472
LibCpp: Parse character literals
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
ee35fc0da3
LibCpp: Support parsing empty return statements
2021-04-06 21:51:58 +02:00
Itamar
0babb39cae
LibCpp: Parse variable declarations in global scope
2021-04-06 21:51:58 +02:00
Itamar
b5cab861e3
LibCpp: Parse Namespace declaration
...
Also, remove unused State::Context
2021-03-23 18:32:39 +01:00
Linus Groh
6c8185151e
LibCpp: Return empty TranslationUnit from Parser::parse() if no tokens exist
...
Fixes #5704 .
Fixes #5825 .
Fixes #5827 .
2021-03-16 18:59:19 +01:00
Itamar
8688259ed9
LanguageServers/Cpp: Support jumping to declaration of preprocessor
...
.. definitions.
2021-03-13 10:17:02 +01:00
Itamar
5b22f6f45a
LibCpp: Parser no longer holds the program's source
...
After we moved to storing the text of each token in the token itself,
we no longer have to store the source of the program in the Parser.
This makes more sense because the parser should deal with tokens, not
with raw source code.
2021-03-13 10:17:02 +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
97f2cd596b
LibCpp: Remove node_span_size, add index_of_node_at
2021-03-13 10:17:02 +01:00
Itamar
26d9485562
LibCpp: Store the text of a token as a StringView member
2021-03-13 10:17:02 +01:00
Itamar
5cd1c69b96
LibCpp: Access Cpp::Token members via getter functions
2021-03-13 10:17:02 +01:00
Itamar
3658c4c567
LibCpp: Replace defined preprocessor values when parsing
2021-03-13 10:17:02 +01:00
Andreas Kling
ef1e5db1d0
Everywhere: Remove klog(), dbg() and purge all LogStream usage :^)
...
Good-bye LogStream. Long live AK::Format!
2021-03-12 17:29:37 +01:00
Itamar
1d3b5dabc3
LibCpp: Parse ellipsis
...
We can now parse the printf function declaration :^)
2021-03-02 12:50:37 +01:00
Itamar
5c79297b2c
LibCpp: Consume attribute specification when parsing
...
Consume __atribute__(...), without actually parsing its content.
2021-03-02 12:50:37 +01:00
Itamar
5a7abb8363
LibCpp: Parse type qualifiers
2021-03-02 12:50:37 +01:00
AnotherTest
857cdee0d0
AK: Make dbgln_if() avoid evaluating the arguments when disabled
...
Naturally, this makes the `enabled` flag on dbgln() obsolete.
2021-02-24 13:07:28 +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