{ "name": "SystemVerilog", "file_extensions": [ "sv", "v", "svh", "vh" ], "scope": "source.systemverilog", "variables": { "id": "[A-Za-z_][A-Za-z_0-9]*" }, "contexts": { "main": [ { "match": "\\s*\\b(local\\s+|protected\\s+)?\\s*\\b(function)\\b(\\s+automatic)?", "captures": { "1": "keyword.control.systemverilog", "2": "keyword.control.systemverilog", "3": "keyword.control.systemverilog" }, "push": [ { "meta_scope": "meta.function.systemverilog" }, { "match": ";", "pop": true }, { "match": "\\b(?:({{id}})(::))?({{id}}\\s+)?(?:({{id}})(::))?({{id}}*)\\s*(?=\\(|;)", "captures": { "1": "support.type.scope.systemverilog", "2": "keyword.operator.scope.systemverilog", "3": "storage.type.systemverilog", "4": "support.type.scope.systemverilog", "5": "keyword.operator.scope.systemverilog", "6": "entity.name.function.systemverilog" } }, { "match": "\\(", "set": [ { "meta_scope": "meta.function.port.systemverilog" }, { "match": "\\)\\s*;", "pop": true }, { "include": "port-dir" }, { "match": "\\s*\\b(?:({{id}})(::))?({{id}})\\s+({{id}})", "captures": { "1": "support.type.scope.systemverilog", "2": "keyword.operator.scope.systemverilog", "3": "storage.type.systemverilog" } }, { "include": "base-grammar" } ] }, { "include": "base-grammar" } ] }, { "match": "\\s*\\b(?:(local|protected)\\s+)?\\s*\\b(task)\\s+(automatic)?", "captures": { "1": "keyword.control.systemverilog", "2": "keyword.control.systemverilog", "3": "keyword.control.systemverilog" }, "push": [ { "meta_scope": "meta.task.systemverilog" }, { "match": ";", "pop": true }, { "match": "\\s*\\b({{id}})\\b", "captures": { "1": "entity.name.function.systemverilog" } }, { "match": "\\(", "set": [ { "meta_scope": "meta.task.port.systemverilog" }, { "match": "\\)\\s*;", "pop": true }, { "include": "port-dir" }, { "match": "\\s*\\b(?:\\b(virtual)\\s+)?(?:({{id}})(::))?({{id}})\\s+({{id}})", "captures": { "1": "keyword.other.systemverilog", "2": "support.type.scope.systemverilog", "3": "keyword.operator.scope.systemverilog", "4": "storage.type.systemverilog" } }, { "include": "base-grammar" } ] } ] }, { "match": "\\s*\\b(typedef)\\b", "captures": { "1": "keyword.control.systemverilog" }, "set": [ "typedef_symbol", "typedef_decl" ] }, { "match": "\\s*\\b(nettype)\\s+({{id}})\\s+({{id}})(\\s+(with)\\s+({{id}}))?", "captures": { "1": "keyword.control.systemverilog", "2": "storage.type.systemverilog", "3": "entity.name.type.systemverilog", "5": "keyword.control.systemverilog", "6": "support.function.resolve.systemverilog" } }, { "match": "\\s*(module)\\s+\\b({{id}})\\b", "captures": { "1": "keyword.control.systemverilog", "2": "entity.name.type.module.systemverilog" }, "push": [ { "meta_scope": "meta.module.systemverilog" }, { "match": ";", "captures": { "1": "entity.name.function.systemverilog" }, "pop": true }, { "match": "\\s*\\bimport\\b", "scope": "keyword.control.systemverilog", "push": [ { "match": ";", "pop": true }, { "match": "\\b({{id}})(::)", "captures": { "1": "support.type.scope.systemverilog", "2": "keyword.operator.scope.systemverilog" } }, { "match": "\\*", "scope": "keyword.operator.systemverilog" } ] }, { "include": "port-dir" }, { "match": "\\s*(parameter)", "scope": "keyword.other.systemverilog" }, { "include": "base-grammar" }, { "include": "ifmodport" } ] }, { "match": "\\b(sequence)\\s+({{id}})", "scope": "meta.sequence.systemverilog", "captures": { "1": "keyword.control.systemverilog", "2": "entity.name.function.systemverilog" } }, { "match": "\\b(bind)\\s+((`\\w+)|([a-zA-Z_][a-zA-Z0-9_\\.]*))\\b", "captures": { "1": "keyword.control.systemverilog", "3": "constant.other.define.systemverilog" } }, { "match": "\\s*\\b(begin)\\b\\s*(:)\\s*({{id}})\\b", "scope": "meta.definition.systemverilog", "captures": { "0": "meta.section.begin.systemverilog", "1": "keyword.other.block.systemverilog", "2": "keyword.operator.systemverilog", "3": "entity.name.section.systemverilog" } }, { "match": "\\s*\\b(fork)\\b\\s*(:)\\s*({{id}})\\b", "scope": "meta.definition.systemverilog", "captures": { "0": "meta.section.fork.systemverilog", "1": "keyword.control.systemverilog", "2": "keyword.operator.systemverilog", "3": "entity.name.section.systemverilog" } }, { "match": "\\b(property)\\s+(\\w+)", "captures": { "1": "keyword.sva.systemverilog", "2": "entity.name.sva.systemverilog" } }, { "match": "\\b(\\w+)\\s*(:)\\s*(assert)\\b", "captures": { "1": "entity.name.sva.systemverilog", "2": "keyword.operator.systemverilog", "3": "keyword.sva.systemverilog" } }, { "match": "\\s*(//)\\s*(psl)\\s+((\\w+)\\s*(:))?\\s*(default|assert|assume)", "captures": { "0": "meta.psl.systemverilog", "1": "comment.line.double-slash.systemverilog", "2": "keyword.psl.systemverilog", "4": "entity.psl.name.systemverilog", "5": "keyword.operator.systemverilog", "6": "keyword.psl.systemverilog" }, "push": [ { "meta_scope": "meta.psl.systemverilog" }, { "match": ";", "pop": true }, { "match": "\\b(never|always|default|clock|within|rose|fell|stable|until|before|next|eventually|abort|posedge)\\b", "scope": "keyword.psl.systemverilog" }, { "include": "operators" }, { "include": "functions" }, { "include": "constants" } ] }, { "match": "\\s*(/\\*)\\s*(psl)", "captures": { "0": "meta.psl.systemverilog", "1": "comment.block.systemverilog", "2": "keyword.psl.systemverilog" }, "push": [ { "meta_scope": "meta.psl.systemverilog" }, { "match": "(\\*/)", "captures": { "1": "comment.block.systemverilog" }, "pop": true }, { "match": "^\\s*((\\w+)\\s*(:))?\\s*(default|assert|assume)", "captures": { "0": "meta.psl.systemverilog", "2": "entity.psl.name.systemverilog", "3": "keyword.operator.systemverilog", "4": "keyword.psl.systemverilog" } }, { "match": "\\b(property)\\s+(\\w+)", "captures": { "1": "keyword.psl.systemverilog", "2": "entity.psl.name.systemverilog" } }, { "match": "\\b(never|always|default|clock|within|rose|fell|stable|until|before|next|eventually|abort|posedge|negedge)\\b", "scope": "keyword.psl.systemverilog" }, { "include": "operators" }, { "include": "functions" }, { "include": "constants" } ] }, { "match": "\\s*\\b(automatic|cell|config|deassign|defparam|design|disable|edge|endconfig|endgenerate|endspecify|endtable|generate|genvar|ifnone|incdir|instance|liblist|library|macromodule|negedge|noshowcancelled|posedge|pulsestyle_onevent|pulsestyle_ondetect|scalared|showcancelled|specify|specparam|table|use|vectored)\\b", "captures": { "1": "keyword.other.systemverilog" } }, { "match": "\\s*\\b(initial|always|begin|fork|wait|force|release|assign|always_comb|always_ff|always_latch|forever|repeat|while|for|if|iff|else|case|casex|casez|default|endcase|return|break|continue|do|foreach|with|inside|dist|clocking|cover|coverpoint|property|bins|binsof|illegal_bins|ignore_bins|randcase|modport|matches|solve|assert|assume|before|expect|cross|ref|first_match|srandom|struct|packed|final|alias|tagged|extern|throughout|timeprecision|timeunit|priority|type|union|uwire|wait_order|triggered|randsequence|import|export|context|pure|intersect|wildcard|within|new|typedef|enum|this|super|forkjoin|unique|unique0|priority)\\b", "captures": { "1": "keyword.control.systemverilog" } }, { "match": "\\s*\\b(end)\\b(\\s*(:)\\s*(\\w+))?", "captures": { "1": "keyword.other.block.systemverilog", "3": "keyword.operator.systemverilog", "4": "entity.label.systemverilog" } }, { "match": "\\s*\\b(endtask|endmodule|endfunction|endprimitive|endclass|endpackage|endsequence|endprogram|endclocking|endproperty|endgroup|endinterface|join|join_any|join_none)\\b(\\s*(:)\\s*(\\w+))?", "scope": "meta.object.end.systemverilog", "captures": { "1": "keyword.control.systemverilog", "3": "keyword.operator.systemverilog", "4": "entity.label.systemverilog" } }, { "match": "\\b(std)\\b::", "scope": "support.class.systemverilog" }, { "match": "^\\s*(`define)\\s+({{id}})", "scope": "meta.define.systemverilog", "captures": { "1": "constant.other.preprocessor.systemverilog", "2": "entity.name.type.define.systemverilog" } }, { "include": "comments" }, { "match": "\\s*(primitive|package|constraint|interface|covergroup|program)\\s+\\b({{id}})\\b", "scope": "meta.definition.systemverilog", "captures": { "1": "keyword.control.systemverilog", "2": "entity.name.type.class.systemverilog" } }, { "match": "(({{id}})\\s*(:))?\\s*(coverpoint|cross)\\s+([A-Za-z_][A-Za-z_0-9\\.]*)", "scope": "meta.definition.systemverilog", "captures": { "2": "entity.name.type.class.systemverilog", "3": "keyword.operator.other.systemverilog", "4": "keyword.control.systemverilog" } }, { "match": "\\s*\\b(virtual\\s+)?(class)\\s+\\b({{id}})\\b", "scope": "meta.definition.class.systemverilog", "captures": { "1": "keyword.control.systemverilog", "2": "keyword.control.systemverilog", "3": "entity.name.type.class.systemverilog" } }, { "match": "\\b(extends)\\s+(?:({{id}})(::))?({{id}})\\b", "scope": "meta.definition.systemverilog", "captures": { "1": "keyword.control.systemverilog", "2": "support.type.scope.systemverilog", "3": "keyword.operator.scope.systemverilog", "4": "entity.other.inherited-class.systemverilog" } }, { "include": "all-types" }, { "include": "operators" }, { "include": "port-dir" }, { "match": "\\b(and|nand|nor|or|xor|xnor|buf|not|bufif[01]|notif[01]|r?[npc]mos|tran|r?tranif[01]|pullup|pulldown)\\b", "scope": "support.type.systemverilog" }, { "include": "strings" }, { "match": "\\$\\b({{id}})\\b", "scope": "support.function.systemverilog" }, { "match": "\\b({{id}})(')(?=\\()", "scope": "meta.cast.systemverilog", "captures": { "1": "storage.type.systemverilog", "2": "keyword.operator.cast.systemverilog" } }, { "match": "^\\s*(localparam|parameter)\\s+([A-Z_][A-Z0-9_]*)\\b\\s*(?=(=))", "scope": "meta.param.systemverilog", "captures": { "1": "keyword.other.systemverilog", "2": "constant.other.systemverilog" } }, { "match": "^\\s*(localparam|parameter)\\s+({{id}})\\b\\s*(?=(=))", "scope": "meta.param.systemverilog", "captures": { "1": "keyword.other.systemverilog" } }, { "match": "^\\s*(static\\s+)?(local\\s+|protected\\s+|localparam\\s+|parameter\\s+)?(const\\s+|virtual\\s+)?(rand\\s+|randc\\s+)?(?:(var|wire)\\s+)?(({{id}})(::))?({{id}}\\b)?\\s*(?=(#\\s*\\([\\w,\\:#\\(\\)]+\\)\\s*)?(\\s*\\[.*?\\]\\s*)*{{id}}(\\s*\\[.*?\\]\\s*)*\\s*(;|,|=|'\\{))", "scope": "meta.userdefined.systemverilog", "captures": { "1": "keyword.other.systemverilog", "2": "keyword.other.systemverilog", "3": "keyword.other.systemverilog", "4": "storage.type.rand.systemverilog", "5": "storage.type.net.systemverilog", "7": "support.type.scope.systemverilog", "8": "keyword.operator.scope.systemverilog", "9": "storage.type.userdefined.systemverilog" } }, { "match": "\\s*\\b(option)\\.", "captures": { "1": "keyword.cover.systemverilog" } }, { "match": "\\s*\\b(static|local|const|protected|virtual|localparam|parameter)\\b", "captures": { "1": "keyword.other.systemverilog" } }, { "match": "\\s*\\b(rand|randc)\\b", "scope": "storage.type.rand.systemverilog" }, { "match": "^(\\s*(bind)\\s+((`\\w+)|([a-zA-Z_][\\w\\.]*)))?\\s*({{id}})\\s*(?=#[^#])", "captures": { "2": "keyword.control.systemverilog", "4": "constant.other.define.systemverilog", "6": "storage.type.module.systemverilog" }, "push": [ { "meta_scope": "meta.module.inst.param.systemverilog" }, { "match": ";|(?==|:)", "pop": true }, { "match": "\\(", "push": [ { "include": "module-binding" }, { "include": "module-param" }, { "include": "storage-scope-systemverilog" }, { "include": "comments" }, { "include": "operators" }, { "include": "constants" }, { "include": "strings" }, { "match": "\\)", "pop": true } ] }, { "match": "\\#", "scope": "keyword.operator.param.systemverilog" }, { "include": "comments" }, { "match": "\\b({{id}})\\b(?=\\s*(\\(|$))", "scope": "entity.name.type.module.systemverilog" } ] }, { "match": "\\b({{id}})\\s+(?!intersect\\b|and\\b|or\\b|throughout\\b|within\\b)({{id}})\\s*(\\[(\\d+)(\\:(\\d+))?\\])?\\s*(\\(|$)", "captures": { "1": "storage.type.module.systemverilog", "2": "entity.name.type.module.systemverilog", "4": "constant.numeric.systemverilog", "6": "constant.numeric.systemverilog" }, "push": [ { "meta_scope": "meta.module.inst.systemverilog" }, { "match": ";", "pop": true }, { "include": "module-binding" }, { "include": "storage-scope-systemverilog" }, { "include": "comments" }, { "include": "strings" }, { "include": "operators" }, { "include": "constants" } ] }, { "match": "\\s*(=|<|>)", "scope": "keyword.operator.comparison.systemverilog" }, { "match": "(=)", "scope": "keyword.operator.assignment.systemverilog" }, { "match": "(\\-|\\+|\\*|\\/|<<|>>|%)", "scope": "keyword.operator.arithmetic.systemverilog" }, { "match": "(!|&&|\\|\\||\\bor\\b)", "scope": "keyword.operator.logical.systemverilog" }, { "match": "(&|\\||\\^|~)", "scope": "keyword.operator.bitwise.systemverilog" }, { "match": "(\\{|'\\{|})", "scope": "keyword.operator.array.systemverilog" }, { "match": "(\\?|:)", "scope": "keyword.operator.ternary.systemverilog" }, { "match": "(#|@)", "scope": "keyword.operator.other.systemverilog" } ], "port-dir": [ { "match": "\\s*\\b(output|input|inout|ref)\\s+(?:(var|wire)\\s+)?(?:({{id}})(::))?({{id}})?\\s+(?=\\[[\\w\\*\\(\\)\\/><\\:\\-\\+`\\$\\s]*\\]\\s+[a-zA-Z_][a-zA-Z0-9_\\s]*)", "captures": { "1": "support.type.systemverilog", "2": "storage.type.net.systemverilog", "3": "support.type.scope.systemverilog", "4": "keyword.operator.scope.systemverilog", "5": "storage.type.interface.systemverilog" } }, { "match": "\\s*\\b(output|input|inout|ref)\\s+(?:(var|wire)\\s+)?(?:({{id}})(::))?({{id}})?\\s+(?=[a-zA-Z_][a-zA-Z0-9_\\s]*)", "captures": { "1": "support.type.systemverilog", "2": "storage.type.net.systemverilog", "3": "support.type.scope.systemverilog", "4": "keyword.operator.scope.systemverilog", "5": "storage.type.interface.systemverilog" } }, { "match": "\\s*\\b(output|input|inout|ref)\\b", "scope": "support.type.systemverilog" }, { "match": "\\$\\b({{id}})\\b", "scope": "support.function.systemverilog" } ], "storage-modifier-systemverilog": [ { "match": "\\b(signed|unsigned|small|medium|large|supply[01]|strong[01]|pull[01]|weak[01]|highz[01])\\b", "scope": "storage.modifier.systemverilog" } ], "storage-scope-systemverilog": [ { "match": "\\b({{id}})(::)", "scope": "meta.scope.systemverilog", "captures": { "1": "support.type.scope.systemverilog", "2": "keyword.operator.scope.systemverilog" } } ], "storage-type-systemverilog": [ { "match": "\\s*\\b(tri|tri[01]|supply[01]|wand|triand|wor|trior|trireg|reg|integer|int|longint|shortint|logic|bit|byte|shortreal|chandle|string|time|realtime|real|process|void|event|semaphore|mailbox)\\b", "scope": "storage.type.systemverilog" }, { "match": "\\s*\\b(uvm_transaction|uvm_component|uvm_monitor|uvm_driver|uvm_test|uvm_env|uvm_object|uvm_agent|uvm_sequence_base|uvm_sequence|uvm_sequence_item|uvm_sequence_state|uvm_sequencer|uvm_sequencer_base|uvm_component_registry|uvm_analysis_imp|uvm_analysis_port|uvm_analysis_export|uvm_config_db|uvm_active_passive_enum|uvm_phase|uvm_verbosity|uvm_tlm_analysis_fifo|uvm_tlm_fifo|uvm_report_server|uvm_objection|uvm_recorder|uvm_domain|uvm_reg_field|uvm_reg|uvm_reg_block|uvm_bitstream_t|uvm_radix_enum|uvm_printer|uvm_packer|uvm_comparer|uvm_scope_stack)\\b", "scope": "storage.type.uvm.systemverilog" } ], "strings": [ { "match": "\"", "captures": { "0": "punctuation.definition.string.begin.systemverilog" }, "push": [ { "meta_scope": "string.quoted.double.systemverilog" }, { "match": "\"", "captures": { "0": "punctuation.definition.string.end.systemverilog" }, "pop": true }, { "match": "\\\\.", "scope": "constant.character.escape.systemverilog" }, { "match": "(?x)%\n(\\d+\\$)? # field (argument #)\n[#0\\- +']* # flags\n[,;:_]? # separator character (AltiVec)\n((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)? # length modifier\n[bdiouxXhHDOUeEfFgGaACcSspnmt%] # conversion type\n", "scope": "constant.other.placeholder.systemverilog" }, { "match": "%", "scope": "invalid.illegal.placeholder.systemverilog" } ] } ], "struct_decl": [ { "match": "\\s*(\\bstruct\\b|\\bunion\\b|`\\w+)\\s*(packed)?\\s*", "captures": { "1": "keyword.control.systemverilog", "2": "keyword.control.systemverilog" }, "set": [ { "match": "\\bpacked\\b", "scope": "keyword.control.systemverilog" }, { "meta_scope": "meta.struct.anonymous.systemverilog" }, { "match": "}", "scope": "keyword.operator.other.systemverilog", "pop": true }, { "include": "base-grammar" } ] } ], "typedef_decl": [ { "include": "struct_decl" }, { "include": "comments" }, { "match": "\\b(virtual|interface)\\b", "scope": "keyword.control.systemverilog" }, { "match": "\\bclass\\b", "scope": "keyword.control.systemverilog", "pop": true }, { "match": "\\benum\\b", "scope": "keyword.control.systemverilog", "set": [ { "meta_scope": "meta.typedef_decl.enum" }, { "match": "\\b{{id}}\\b", "scope": "storage.type.systemverilog", "set": [ { "meta_scope": "meta.typedef_decl.enum.list" }, { "match": "}", "scope": "keyword.operator.other.systemverilog", "pop": true }, { "include": "base-grammar" } ] }, { "match": "{", "scope": "keyword.operator.other.systemverilog", "set": [ { "match": "}", "scope": "keyword.operator.other.systemverilog", "pop": true }, { "include": "comments" }, { "include": "constants" }, { "include": "operators" }, { "include": "strings" } ] } ] }, { "match": "\\b{{id}}\\b", "scope": "storage.type.systemverilog", "pop": true } ], "typedef_symbol": [ { "meta_scope": "meta.typedef_symbol" }, { "match": ";", "pop": true }, { "match": "\\[", "push": [ { "meta_scope": "inside_bracket" }, { "match": "\\]", "pop": true }, { "include": "comments" }, { "include": "constants" }, { "include": "operators" }, { "include": "strings" } ] }, { "include": "module-param" }, { "match": "\\b(signed|unsigned)\\b", "scope": "storage.modifier.systemverilog" }, { "match": "\\b({{id}})\\b", "scope": "entity.name.type.systemverilog", "pop": true }, { "match": "\\s*\\b(typedef)\\b", "captures": { "1": "keyword.control.systemverilog" }, "set": [ "typedef_symbol", "typedef_decl" ] } ] } }