Commit Graph

10 Commits

Author SHA1 Message Date
Ali Mohammad Pur
ba4db899d4 LibSyntax+Userland: Make LibSyntax not depend on LibGUI
This moves some stuff around to make LibGUI depend on LibSyntax instead
of the other way around, as not every application that wishes to do
syntax highlighting is necessarily a LibGUI (or even a GUI) application.
2023-08-29 07:57:39 -04:00
Sam Atkins
406a7ea577 LibSyntax+Libraries: Replace TextStyle with Gfx::TextAttributes
Rather than creating a TextStyle struct, and then copying its fields
over to a TextAttributes, let's just create a TextAttributes to start
with. This also simplifies the syntax highlighting code by letting us
define underlines along with the other text styling.
2023-03-15 14:55:49 +01:00
Sam Atkins
6d8f046fd0 LibGfx+Userland: Make TextAttributes::underline_style optional
Rather than having a style AND a field saying whether to use the style,
just make the style Optional.
2023-03-15 14:55:49 +01:00
Andreas Kling
a504ac3e2a Everywhere: Rename equals_ignoring_case => equals_ignoring_ascii_case
Let's make it clear that these functions deal with ASCII case only.
2023-03-10 13:15:44 +01:00
Sam Atkins
676d75603b LibCMake+LibSyntax: Add a CMakeCache.txt syntax highlighter 2023-03-08 14:21:37 +00:00
Sam Atkins
bb07d678ac LibCMake: Add a lexer for CMakeCache.txt
This is a totally different syntax than for regular CMake files, and
also is undocumented and subject to change, but it's also nice and
simple. :^)
2023-03-08 14:21:37 +00:00
Sam Atkins
822164a686 LibCMake: Add folding regions to syntax highlighter
This creates folding regions for blocks defined by the following:
- if/elseif/else/endif
- foreach/endforeach
- while/endwhile
- macro/endmacro
- function/endfunction

Since there is no guarantee that each keyword will have a matching
partner, we do our best by looking for the most recent possible start
token matching the current end token. If we find one, we link to it and
drop all the other start-tokens that happened in between. For example,
we would define a folding region for this invalid file like so:

[-] if(TRUE)
 │      while()
 └─ endif()
2023-03-05 16:54:10 +01:00
Sam Atkins
631927470a LibCMake: Treat block, endblock and return as control keywords
I missed these before because they weren't mentioned on the language
description page of the CMake manual.
2023-03-05 16:54:10 +01:00
Sam Atkins
9f9ea8ccb5 LibCMake+LibSyntax: Add a CMake syntax highlighter 2023-03-04 05:43:43 -07:00
Sam Atkins
3d8cc2257f LibCMake: Introduce a CMake lexer 2023-03-04 05:43:43 -07:00