Commit graph

22 commits

Author SHA1 Message Date
asynts
70dd97c46e AK: Remove FixedArray class. 2020-09-08 14:01:21 +02:00
Muhammad Zahalqa
a68650a7b4
AK: HashTable add a constructor that allows preallocation of capacity + Use in CppLexer. (#3147)
1. Add general utility to get array number of elements.
2. Add Needed API to AK::HashTable
3. Refactor CppLexer initialization
2020-08-16 11:04:00 +02:00
Nico Weber
18e8fd333c CppLexer: Actually give raw strings type RawString
This fixes a regrettable mistake in 9ee1edae2a.
No behavior change.
2020-08-03 15:54:33 +02:00
Nico Weber
9ee1edae2a CppLexer: Support raw string literals
Handles prefixes and delimiters (`R"(text)", `u8R"f(text)f"`, ...).
2020-07-27 12:11:19 +02:00
Nico Weber
4d783338c1 CppLexer: Support L, u, u8, U prefixes on string and char literals 2020-07-27 12:11:19 +02:00
Nico Weber
34dc163441 CppLexer: Correctly highlight hex escapes in string and char literals
\x consumes all hex digits following it. (If the resulting number
then doesn't fit in the character type, the compiler emits an
error.)

\x would be much more convenient to use if it was always followed
by exactly two hex digits (with \u and \U for higher codepoints),
but that's sadly not the world we live in.
2020-07-27 12:11:04 +02:00
Nico Weber
c1b7fd644c CppLexer: Support \U escapes in addition to \u escapes 2020-07-27 12:10:46 +02:00
Nico Weber
7a1c328417 CppLexer: Add token types for "::", "::*", ".*", "->*" 2020-07-27 01:04:17 +02:00
Nico Weber
1992dbd637 CppLexer: Add token types for ".", "->" 2020-07-27 01:04:17 +02:00
Nico Weber
95113d15fe CppLexer: Add token types for "!", "!=", "~", "?", ":" 2020-07-27 01:04:17 +02:00
Nico Weber
29bc978564 CppLexer: Add token types for "^", "^=" 2020-07-27 01:04:17 +02:00
Nico Weber
c38b8d63f8 CppLexer: Add token types for "++", "--" 2020-07-27 01:04:17 +02:00
Nico Weber
598b5e4595 CppLexer: Add token types for "&", "&&", "&=", "|", "||", "|=" 2020-07-27 01:04:17 +02:00
Nico Weber
345b303262 CppLexer: Add token types for ">", ">=", ">>", ">>=" 2020-07-27 01:04:17 +02:00
Nico Weber
97c4344f33 CppLexer: Add token types for "<", "<=", "<<", "<<=", "<>" 2020-07-27 01:04:17 +02:00
Nico Weber
96d13f75cf CppLexer: Add token types for "+", "+=", "-", "-=", "=", "==", "/", "/="
Mostly so that TextEdit doesn't emit logspam when I write `int a = 4`
in a test program.
2020-07-26 19:52:26 +02:00
Nico Weber
5a36d8acb8 CppLexer: Add token type for "*=" 2020-07-26 19:52:26 +02:00
Andreas Kling
37af1d74cc LibGUI: Fix CppLexer assertion on incomplete #include statements
Thanks to @NotKyon for reporting this bug with a solid analysis.

Fixes #1488.
2020-04-04 11:00:14 +02:00
Oriko
d8a73dd979 LibGUI: Parse #include statements separately 2020-03-12 12:37:13 +01:00
Oriko
8d54e4e012 LibGUI: Highlight various number literals 2020-03-11 21:26:47 +01:00
Oriko
d58cf1a05d LibGUI: Syntax highlight string escape sequences 2020-03-11 10:16:55 +01:00
Andreas Kling
bb8e65be41 LibGUI+HackStudio: Move syntax highlighting from HackStudio to LibGUI
This patch introduces the GUI::SyntaxHighlighter class, which can be
attached to a GUI::TextEditor to provide syntax highlighting.

The C++ syntax highlighting from HackStudio becomes a new class called
GUI::CppSyntaxHighlighter. This will make it possible to get C++ syntax
highlighting in any app that uses a GUI::TextEditor. :^)

Sidenote: It does feel a bit weird having a C++ lexer in a GUI toolkit
library, and we'll probably end up moving this out to a separate place
as this functionality grows larger.
2020-02-07 20:07:15 +01:00
Renamed from DevTools/HackStudio/CppLexer.cpp (Browse further)