summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibCpp
AgeCommit message (Collapse)Author
2021-06-09LibCpp: Add test for parsing class definitionsItamar
2021-06-09LibCpp: Parse basic constructors and destructorsItamar
2021-06-09LibCpp: Handle class access-specifiers in the ParserItamar
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-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-06-09LibCpp: Make 'bool' a Token::Type::KnownTypeItamar
2021-06-07LibWeb+LibSyntax: Implement nested syntax highlightersAli Mohammad Pur
And use them to highlight javascript in HTML source. This commit also changes how TextDocumentSpan::data is interpreted, as it used to be an opaque pointer, but everyone stuffed an enum value inside it, which made the values not unique to each highlighter; that field is now a u64 serial id. The syntax highlighters don't need to change their ways of stuffing token types into that field, but a highlighter that calls another nested highlighter needs to register the nested types for use with token pairs.
2021-06-05LibCpp: Fix off-by-one error in SyntaxHighlighterMax Wipfli
This changes the C++ SyntaxHighlighter to conform to the now-fixed rendering of syntax highlighting spans in GUI::TextEditor. Contrary to other syntax highlighters, for this one the change has been made to the SyntaxHighlighter rather than the Lexer. This is due to the fact that the Parser also uses the same Lexer. I'm soure there is some more elegant way to do this, but this patch at least unbreaks the C++ syntax highlighting.
2021-06-05LibCpp: Do not emit empty whitespace token after include statementMax Wipfli
If an include statement didn't contain whitespace between the word "include" and the '<' or '"', the lexer would previous emit an empty whitespace token. This has been changed now.
2021-06-05LibCpp: Use CharacterTypes.h and constexpr functions in LexerMax Wipfli
2021-06-05LibCpp: Use east const style in Lexer and SyntaxHighlighterMax Wipfli
2021-06-04LibCpp: Revert change to strace.cpp AST test from bf8fd4cAndreas Kling
Since the purpose of this file is just to verify the AST generated, we can leave it alone.
2021-06-03Everywhere: Remove accidental '\n' from various outln() invocationsAndreas Kling
Also convert outln(stderr, ...) to warnln(...)
2021-06-01LibCpp: Consider declarations inside a function's bodyItamar
... in FunctionDeclaration::declarations()
2021-05-22LibCpp: Add option in Preprocessor to keep #include's in processed textItamar
2021-05-22LibCpp: Make Preprocessor::handle_preprocessor_line return keywordItamar
This also moves most of the logic that was in handle_preprocessor_line into handle_preprocessor_keyword.
2021-05-22LibCpp: Modify Token::to_string() to include more informationItamar
Token::to_string() now includes not only the token's type, but also its text and span in the document.
2021-05-19LibCpp: Add regression tests for the parserItamar
For each .cpp file in the test suite data, there is a .ast file that represents the "known good" baseline of the parser result. Each .cpp file goes through the parser, and the result of invoking `ASTNode::dump()` on the root node is compared to the baseline to find regressions. We also check that there were no parser errors when parsing the .cpp files.
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: Fix match_expression()Itamar
match_expression() will now return true if there's a match for a Name node.
2021-05-19LibCpp: Support 'auto' TypeItamar
2021-05-15LibCpp: Modify parsing of a Name's scopeItamar
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-15LibCpp: Modify logic of Parser::index_of_node_atItamar
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-09LibCpp: Support Lexing escaped newlinesItamar
2021-05-09LibCpp: Rename m_definitions=>m_preprocessor_definitionsItamar
2021-05-08AK+LibCpp: Remove DEBUG_SPAM in favour of per-application definesAli Mohammad Pur
What happens if one file defines DEBUG_SPAM, and another doesn't, then we link them together and get ODR violations? -- @ADKaster
2021-05-01Everywhere: Turn #if *_DEBUG into dbgln_if/if constexprGunnar Beutner
2021-04-25LibCpp: Convert ScopeLogger to use AK:SourceLocationBrian Gianforcaro
Utilize AK::SourceLocation to get function information into the scope logger, instead of relying on pre-processor macros.
2021-04-23AK: Rename adopt() to adopt_ref()Andreas Kling
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
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-19LibCpp: Support parsing class declarationsItamar
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-06LanguageServers/Cpp: Refactor logic of find declarationItamar
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 empty for loopsItamar
2021-04-06LibCpp: Parse sizeof() expressionItamar
2021-04-06LibCpp: Handle 'struct' prefix before a typeItamar
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: Parse character literalsItamar
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