-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
119 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,6 @@ jobs: | |
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v4 | ||
- uses: pre-commit/[email protected].0 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- uses: pre-commit/[email protected].1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
if has('autocmd') | ||
augroup bif | ||
autocmd BufNewFile,BufRead *.bif setfiletype bif | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
" Vim syntax file | ||
" Language: Bif (https://github.com/zeek/bifcl) | ||
|
||
if exists('b:current_syntax') | ||
unlet b:current_syntax | ||
endif | ||
|
||
" Inherit Zeek syntax | ||
runtime! syntax/zeek.vim | ||
|
||
" This file overrides Zeek syntax. | ||
let s:current_syntax=b:current_syntax | ||
unlet b:current_syntax | ||
|
||
syntax include @bif_cpp syntax/cpp.vim | ||
syntax region bifCppBlock matchgroup=bifCppDelim start=/%\+{/ end=/%\+}/ contains=@bif_cpp,bifTok fold | ||
syntax match bifCppDelim /\(%(\|%)\)/ fold | ||
|
||
" Allow `bifTok` in general `bifCppBlock`, but also explicit in `cParen`. | ||
syntax region bifTok start="@" end="@" excludenl containedin=cParen | ||
|
||
highlight default link bifTok Macro | ||
highlight default link bifCppDelim Delimiter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
" This test cases and requires installation of the Vader testing | ||
" framework, https://github.com/junegunn/vader.vim. After installing the plugin | ||
" tests in the current buffer can be executed with `:Vader`. To execute all | ||
" tests run e.g., `:Vader test/*`. | ||
|
||
Given bif (C++ block delimiters): | ||
%{ %} | ||
%%{ %%} | ||
Execute: | ||
AssertEqual SyntaxAt(1, 1), "bifCppDelim" | ||
AssertEqual SyntaxAt(1, 4), "bifCppDelim" | ||
AssertEqual SyntaxAt(2, 1), "bifCppDelim" | ||
AssertEqual SyntaxAt(2, 5), "bifCppDelim" | ||
|
||
Given bif (Zeek arg delimiters): | ||
%( %) | ||
Execute: | ||
AssertEqual SyntaxAt(1, 1), "bifCppDelim" | ||
AssertEqual SyntaxAt(1, 4), "bifCppDelim" | ||
|
||
Given bif (special tokens): | ||
function foo%(...%): string %{ @ARG@; %} | ||
function foo%(...%): string %{ printf("%s", @ARG@[1]); %} | ||
Execute: | ||
AssertEqual SyntaxAt(1, 33), "bifTok" | ||
AssertEqual SyntaxAt(2, 45), "bifTok" | ||
|
||
Given bif (C++ body): | ||
function foo%(...%): string %{ 123; %} | ||
function foo%(...%): string %%{ 123; %%} | ||
Execute: | ||
AssertEqual SyntaxAt(1, 33), "cppNumber" | ||
AssertEqual SyntaxAt(2, 34), "cppNumber" |
File renamed without changes.