-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ref. eng/recordflux/RecordFlux#1749
- Loading branch information
Showing
7 changed files
with
361 additions
and
4 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
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
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,133 @@ | ||
" Keywords | ||
syntax keyword rflxKeyword with | ||
syntax keyword rflxKeyword package | ||
syntax keyword rflxKeyword is | ||
syntax keyword rflxKeyword type | ||
syntax keyword rflxKeyword range | ||
syntax keyword rflxKeyword all | ||
syntax keyword rflxKeyword some | ||
syntax keyword rflxKeyword Head | ||
syntax match rflxKeyword "'" | ||
syntax keyword rflxKeyword null | ||
syntax keyword rflxKeyword message | ||
syntax keyword rflxKeyword case | ||
syntax keyword rflxKeyword when | ||
syntax keyword rflxKeyword First | ||
syntax keyword rflxKeyword Size | ||
syntax keyword rflxKeyword Last | ||
syntax match rflxKeyword "[.]\\{2,\\}" | ||
syntax match rflxKeyword "Always_Valid" | ||
syntax keyword rflxKeyword end | ||
syntax keyword rflxKeyword Checksum | ||
syntax match rflxKeyword "Byte_Order" | ||
syntax match rflxKeyword "High_Order_First" | ||
syntax match rflxKeyword "Low_Order_First" | ||
syntax keyword rflxKeyword use | ||
syntax keyword rflxKeyword new | ||
syntax keyword rflxKeyword sequence | ||
syntax keyword rflxKeyword of | ||
syntax keyword rflxKeyword generic | ||
syntax keyword rflxKeyword function | ||
syntax keyword rflxKeyword return | ||
syntax keyword rflxKeyword Channel | ||
syntax keyword rflxKeyword Readable | ||
syntax keyword rflxKeyword Writable | ||
syntax keyword rflxKeyword session | ||
syntax keyword rflxKeyword renames | ||
syntax keyword rflxKeyword begin | ||
syntax keyword rflxKeyword state | ||
syntax keyword rflxKeyword Desc | ||
syntax keyword rflxKeyword Append | ||
syntax keyword rflxKeyword Extend | ||
syntax keyword rflxKeyword Reset | ||
syntax keyword rflxKeyword Read | ||
syntax keyword rflxKeyword Write | ||
syntax keyword rflxKeyword transition | ||
syntax keyword rflxKeyword goto | ||
syntax keyword rflxKeyword exception | ||
hi link rflxKeyword Keyword | ||
|
||
" Conditional keywords | ||
syntax keyword rflxConditional if | ||
syntax keyword rflxConditional then | ||
hi link rflxConditional Conditional | ||
|
||
" Punctuation (neovim specific). See `:h treesitter-highlight` | ||
if has('nvim-0.9') | ||
syntax match rflxPunctuation ";" | ||
syntax match rflxPunctuation "(" | ||
syntax match rflxPunctuation ")" | ||
syntax match rflxPunctuation "\[" | ||
syntax match rflxPunctuation "]" | ||
syntax match rflxPunctuation "," | ||
syntax match rflxPunctuation "[.]" | ||
syntax match rflxPunctuation ":" | ||
hi link rflxPunctuation @punctuation | ||
endif | ||
|
||
" Operators | ||
syntax match rflxOperator "=>" | ||
syntax match rflxOperator ":=" | ||
syntax match rflxOperator "+" | ||
syntax match rflxOperator "-" | ||
syntax match rflxOperator "[*]" | ||
syntax match rflxOperator "[.]\{2,}" | ||
syntax match rflxOperator "/" | ||
syntax keyword rflxOperator mod | ||
syntax match rflxOperator ":\{2,}" | ||
syntax keyword rflxOperator and | ||
syntax keyword rflxOperator or | ||
syntax keyword rflxOperator not | ||
syntax keyword rflxOperator Valid | ||
syntax match rflxOperator "Has_Data" | ||
syntax keyword rflxOperator Present | ||
syntax match rflxOperator "=" | ||
syntax match rflxOperator "/=" | ||
syntax match rflxOperator "<=" | ||
syntax match rflxOperator "<" | ||
syntax match rflxOperator ">=" | ||
syntax match rflxOperator ">" | ||
syntax keyword rflxOperator for | ||
syntax keyword rflxOperator in | ||
syntax match rflxOperator "\"" | ||
syntax match rflxOperator "not in" | ||
syntax match rflxOperator "|" | ||
syntax match rflxOperator "[*]\{2,}" | ||
syntax match rflxOperator "Valid_Checksum" | ||
hi link rflxOperator Operator | ||
|
||
" Boolean constants | ||
syntax keyword rflxBoolean True | ||
syntax keyword rflxBoolean False | ||
hi link rflxBoolean Boolean | ||
|
||
" Builtin types | ||
syntax keyword rflxType Opaque | ||
syntax keyword rflxType Boolean | ||
hi link rflxType Type | ||
|
||
" Match number literal such as `1` or in an explicit base `#16#FF#` | ||
syntax match rflxNumber "\<\d[0-9_]*\(\.\d[0-9_]*\)\=\([Ee][+-]\=\d[0-9_]*\)\=\>" | ||
syntax match rflxNumber | ||
\ "\<\d\d\=#\x[0-9A-Fa-f_]*\(\.\x[0-9A-Fa-f_]*\)\=#\([Ee][+-]\=\d[0-9_]*\)\=" | ||
hi link rflxNumber Number | ||
|
||
" TODO, FIXME, NOTE and XXX | ||
syntax keyword rflxTodo contained TODO FIXME XXX NOTE | ||
hi link rflxTodo Todo | ||
|
||
" Comments | ||
syntax region rflxComment | ||
\ oneline | ||
\ contains=rflxTodo | ||
\ start="--" | ||
\ end="$" | ||
hi link rflxComment Comment | ||
|
||
" String literals (e.g. "some text") | ||
syntax region rflxString | ||
\ oneline | ||
\ contains=rflxTodo | ||
\ start="\"" | ||
\ end="\"" | ||
hi link rflxString String |
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,24 @@ | ||
from __future__ import annotations | ||
|
||
import subprocess | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
SYNTAX_FILE = Path("rflx/ide/vim/recordflux.vim") | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"args", | ||
[ | ||
(["vim", "--not-a-term"]), | ||
(["nvim", "--headless"]), | ||
], | ||
) | ||
def test_vim_syntax_source(args: list[str]) -> None: | ||
ret = subprocess.run( | ||
[*args, "-c", f":source {SYNTAX_FILE}", "-c", ":quit"], | ||
check=False, | ||
stderr=subprocess.PIPE, | ||
) | ||
assert ret.stderr.decode() == "" |
Oops, something went wrong.