Skip to content

Commit

Permalink
Make D syntax highlighting better
Browse files Browse the repository at this point in the history
  • Loading branch information
jart committed Nov 5, 2024
1 parent 3d0b56f commit 0068a37
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion llamafile/highlight.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ Highlight *Highlight::create(const std::string_view &lang) {
return new HighlightSwift;

if (lang == "d")
return new HighlightC(is_keyword_d);
return new HighlightC(is_keyword_d, nullptr, nullptr, is_keyword_d_constant);

if (lang == "r")
return new HighlightR;
Expand Down
1 change: 1 addition & 0 deletions llamafile/highlight.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ is_keyword_f is_keyword_swift_type;
is_keyword_f is_keyword_swift_builtin;
is_keyword_f is_keyword_swift_constant;
is_keyword_f is_keyword_d;
is_keyword_f is_keyword_d_constant;
is_keyword_f is_keyword_zig;
is_keyword_f is_keyword_zig_type;
is_keyword_f is_keyword_zig_builtin;
Expand Down
3 changes: 0 additions & 3 deletions llamafile/is_keyword_d.gperf
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ else
enum
export
extern
false
final
finally
float
Expand Down Expand Up @@ -78,7 +77,6 @@ mixin
module
new
nothrow
null
out
override
package
Expand All @@ -101,7 +99,6 @@ synchronized
template
this
throw
true
try
typeid
typeof
Expand Down
18 changes: 18 additions & 0 deletions llamafile/is_keyword_d_constant.gperf
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
%{
#include <string.h>
%}
%pic
%compare-strncmp
%language=ANSI-C
%readonly-tables
%define lookup-function-name is_keyword_d_constant
%%
__FILE_FULL_PATH__
__FILE__
__FUNCTION__
__LINE__
__MODULE__
__PRETTY_FUNCTION__
false
null
true

0 comments on commit 0068a37

Please sign in to comment.