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 36c5d03
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
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
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 36c5d03

Please sign in to comment.