1
0
mirror of https://github.com/alecthomas/chroma.git synced 2025-02-03 13:01:47 +02:00

fix: C++ comments after #include

Fixes #841
This commit is contained in:
Alec Thomas 2023-09-09 13:07:35 +10:00
parent 40542a6255
commit c4527e8d5c
7 changed files with 426 additions and 421 deletions

View File

@ -13,11 +13,11 @@ tokentype_string.go: types.go
go generate
chromad:
rm -f chromad
rm -rf build
esbuild --bundle cmd/chromad/static/index.js --minify --outfile=cmd/chromad/static/index.min.js
esbuild --bundle cmd/chromad/static/index.css --minify --outfile=cmd/chromad/static/index.min.css
(export CGOENABLED=0 ; cd ./cmd/chromad && go build -ldflags="-X 'main.version=$(VERSION)'" -o ../../chromad .)
(export CGOENABLED=0 ; cd ./cmd/chromad && go build -ldflags="-X 'main.version=$(VERSION)'" -o ../../build/chromad .)
upload: chromad
scp chromad root@swapoff.org: && \
upload: build/chromad
scp build/chromad root@swapoff.org: && \
ssh root@swapoff.org 'install -m755 ./chromad /srv/http/swapoff.org/bin && service chromad restart'

1
bin/.svu-1.11.0.pkg Symbolic link
View File

@ -0,0 +1 @@
hermit

1
bin/svu Symbolic link
View File

@ -0,0 +1 @@
.svu-1.11.0.pkg

View File

@ -84,7 +84,7 @@
</rule>
</state>
<state name="macro">
<rule pattern="(include)(\s*(?:/[*].*?[*]/\s*)?)([^\n]+)">
<rule pattern="(include)(\s+)(&quot;[^&quot;]+?&quot;|&lt;[^&gt;]+?&gt;)">
<bygroups>
<token type="CommentPreproc"/>
<token type="Text"/>

View File

@ -1,5 +1,5 @@
#include "a"
#include <b>
#include "a" // comment
#include <b> // comment
[[nodiscard]] void foo() noexcept;
void foo();

View File

@ -2,10 +2,13 @@
{"type":"CommentPreproc","value":"#include"},
{"type":"Text","value":" "},
{"type":"CommentPreprocFile","value":"\"a\""},
{"type":"CommentPreproc","value":"\n#include"},
{"type":"CommentPreproc","value":" "},
{"type":"CommentSingle","value":"// comment\n"},
{"type":"CommentPreproc","value":"#include"},
{"type":"Text","value":" "},
{"type":"CommentPreprocFile","value":"\u003cb\u003e"},
{"type":"CommentPreproc","value":"\n"},
{"type":"CommentPreproc","value":" "},
{"type":"CommentSingle","value":"// comment\n"},
{"type":"Text","value":"\n"},
{"type":"NameAttribute","value":"[[nodiscard]]"},
{"type":"Text","value":" "},