mirror of
https://github.com/alecthomas/chroma.git
synced 2025-02-09 13:23:51 +02:00
Support SystemVerilog DPI and DPI-C import statements
Ref: Section "35.5.4 Import declarations" from SystemVerilog standard IEEE 1800-2017.
This commit is contained in:
parent
e10834d052
commit
c67f8fee79
@ -18,6 +18,7 @@ var Systemverilog = internal.Register(MustNewLexer(
|
||||
"root": {
|
||||
{"^\\s*`define", CommentPreproc, Push("macro")},
|
||||
{`^(\s*)(package)(\s+)`, ByGroups(Text, KeywordNamespace, Text), nil},
|
||||
{`^(\s*)(import)(\s+)("DPI(?:-C)?")(\s+)`, ByGroups(Text, KeywordNamespace, Text, LiteralString, Text), nil},
|
||||
{`^(\s*)(import)(\s+)`, ByGroups(Text, KeywordNamespace, Text), Push("import")},
|
||||
{`\n`, Text, nil},
|
||||
{`\s+`, Text, nil},
|
||||
|
11
lexers/testdata/systemverilog.actual
vendored
Normal file
11
lexers/testdata/systemverilog.actual
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
// Comment
|
||||
|
||||
program top;
|
||||
|
||||
import "DPI-C" hello=task hello();
|
||||
|
||||
initial begin
|
||||
hello();
|
||||
end
|
||||
|
||||
endprogram : top
|
35
lexers/testdata/systemverilog.expected
vendored
Normal file
35
lexers/testdata/systemverilog.expected
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
[
|
||||
{"type":"CommentSingle","value":"// Comment\n"},
|
||||
{"type":"Text","value":"\n"},
|
||||
{"type":"Keyword","value":"program"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"top"},
|
||||
{"type":"Punctuation","value":";"},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"KeywordNamespace","value":"import"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"LiteralString","value":"\"DPI-C\""},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"hello"},
|
||||
{"type":"Operator","value":"="},
|
||||
{"type":"Keyword","value":"task"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"hello"},
|
||||
{"type":"Punctuation","value":"();"},
|
||||
{"type":"Text","value":"\n\n "},
|
||||
{"type":"Keyword","value":"initial"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Keyword","value":"begin"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Name","value":"hello"},
|
||||
{"type":"Punctuation","value":"();"},
|
||||
{"type":"Text","value":"\n "},
|
||||
{"type":"Keyword","value":"end"},
|
||||
{"type":"Text","value":"\n\n"},
|
||||
{"type":"Keyword","value":"endprogram"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Operator","value":":"},
|
||||
{"type":"Text","value":" "},
|
||||
{"type":"Name","value":"top"},
|
||||
{"type":"Text","value":"\n"}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user