UNPKG

@imc-trading/svlangserver

Version:
1,079 lines (1,078 loc) 39.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.svcompletion_grammar = exports.svpreproc_grammar = void 0; const grammar_engine_1 = require("./grammar_engine"); const R_SIMPLE_ID = grammar_engine_1.r `[a-zA-Z_][a-zA-Z0-9_$]*`; const R_ESCAPED_ID = grammar_engine_1.r `\\\S+(?:\s|\n|\r|$)`; const R_ID = `${R_SIMPLE_ID}|${R_ESCAPED_ID}`; const T_ID = "identifier.regular.systemverilog"; const R_NUM = grammar_engine_1.r `[0-9][0-9_]*`; const T_NUM = "literal.number.systemverilog"; const R_MACRO = grammar_engine_1.r `\`(?:` + R_ID + grammar_engine_1.r `)`; const T_MACRO = "meta.macro.systemverilog"; const R_MACRO_QUOTE = grammar_engine_1.r `\'"`; const T_MACRO_QUOTE = "macro.quote.systemverilog"; const R_MACRO_ESCAPED_QUOTE = grammar_engine_1.r `\`\\"`; const T_MACRO_ESCAPED_QUOTE = "macro.escaped_quote.systemverilog"; const R_MACRO_CONCAT = grammar_engine_1.r `\`\``; const T_MACRO_CONCAT = "macro.concat.systemverilog"; const R_ESCAPED_BACKSLASH = grammar_engine_1.r `\\\\`; const T_ESCAPED_BACKSLASH = "escaped.backslash.systemverilog"; const R_ESCAPED_NEWLINE = grammar_engine_1.r `\\(?:\n|\r)`; const T_ESCAPED_NEWLINE = "escaped.new_line.systemverilog"; const R_STRING_BEGIN = grammar_engine_1.r `"`; const T_STRING_BEGIN = "string.begin.systemverilog"; const R_STRING_END = grammar_engine_1.r `"`; const T_STRING_END = "string.end.systemverilog"; const R_ESCAPED_QUOTE = grammar_engine_1.r `\\"`; const T_ESCAPED_QUOTE = "escaped.quote.systemverilog"; const R_BACKSLASH = grammar_engine_1.r `\\`; const T_BACKSLASH = "operator.backslash.systemverilog"; const R_STRING_CHARS = grammar_engine_1.r `[^"\\]+`; const T_STRING_CHARS = "string.characters.systemverilog"; const R_COMMENT_LINE = grammar_engine_1.r `//.*(?:\n|\r)`; const T_COMMENT_LINE = "comment.line.systemverilog"; const R_COMMENT_BLOCK = grammar_engine_1.r `/\*(?:.|\n|\r)*?(?:\*/|$)`; const T_COMMENT_BLOCK = "comment.block.systemverilog"; const R_PAREN_OPEN = grammar_engine_1.r `\(`; const T_PAREN_OPEN = "parantheses.open.systemverilog"; const R_PAREN_CLOSE = grammar_engine_1.r `\)`; const T_PAREN_CLOSE = "parantheses.close.systemverilog"; const R_BRACES_OPEN = grammar_engine_1.r `\{`; const T_BRACES_OPEN = "braces.open.systemverilog"; const R_BRACES_CLOSE = grammar_engine_1.r `\}`; const T_BRACES_CLOSE = "braces.close.systemverilog"; const R_BRACKET_OPEN = grammar_engine_1.r `\[`; const T_BRACKET_OPEN = "bracket.open.systemverilog"; const R_BRACKET_CLOSE = grammar_engine_1.r `\]`; const T_BRACKET_CLOSE = "bracket.close.systemverilog"; const R_WHITESPACE = grammar_engine_1.r `(?:\s|\n|\r)+`; const T_WHITESPACE = "meta.whitespace.systemverilog"; const R_OP_COMMA = grammar_engine_1.r `,`; const T_OP_COMMA = "operator.comma.systemverilog"; const R_OP_EQUAL = grammar_engine_1.r `=`; const T_OP_EQUAL = "operator.equals.systemverilog"; const R_OP_SEMICOLON = grammar_engine_1.r `;`; const T_OP_SEMICOLON = "operator.semicolon.systemverilog"; const R_OP_DOT = grammar_engine_1.r `\.`; const R_OP_STAR = grammar_engine_1.r `\*`; const R_OP_COLON = grammar_engine_1.r `:`; const R_OP_PLUS = grammar_engine_1.r `\+`; const R_OP_MINUS = grammar_engine_1.r `-`; const R_OP_HASH = grammar_engine_1.r `#`; const R_OP_TICK = grammar_engine_1.r `'`; const R_OP_DOLLAR = grammar_engine_1.r `\$`; const R_OP_OTHER = grammar_engine_1.r `[!?<>/%&|^~@\\]`; const R_OTHER_OPERATORS = `${R_OP_DOT}|${R_OP_STAR}|${R_OP_COLON}|${R_OP_PLUS}|${R_OP_MINUS}|${R_OP_HASH}|${R_OP_TICK}|${R_OP_DOLLAR}|${R_OP_OTHER}`; const T_OTHER_OPERATORS = "operator.other.systemverilog"; const R_DELTA_DELAY = grammar_engine_1.r `1step`; const T_DELTA_DELAY = "keyword.other.systemverilog"; function toIgnoreBlock(startRegExp, startTokens, endRegExp, endTokens, scopeNamePrefix, contextName) { return { patterns: [ { match: startRegExp, tokens: startTokens, push: { scopeName: `${scopeNamePrefix}.declaration.systemverilog`, patterns: [ { match: endRegExp, tokens: endTokens, pop: "" }, { include: contextName }, { include: "BaseGrammar" } ] } } ] }; } function toIgnoreStatement(startRegExp, startTokens, scopeNamePrefix) { return { patterns: [ { match: startRegExp, tokens: startTokens, push: { scopeName: `${scopeNamePrefix}.statement.systemverilog`, patterns: [ { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON], pop: "" }, { include: "BaseGrammar" } ] } } ] }; } exports.svpreproc_grammar = { Main: { scopeName: "preproc.systemverilog", patterns: [ { include: "All" } ] }, All: { patterns: [ { match: `(${R_DELTA_DELAY})`, tokens: [T_DELTA_DELAY] }, { match: `(${R_ID})`, tokens: [T_ID] }, { match: `(${R_NUM})`, tokens: [T_NUM] }, { include: "Macro" }, { include: "QuotedString" }, { include: "Comment" }, { match: `(${R_PAREN_OPEN})`, tokens: [T_PAREN_OPEN], pushScopes: ["parantheses.body.systemverilog"] }, { match: `(${R_PAREN_CLOSE})`, tokens: [T_PAREN_CLOSE], popScopes: ["parantheses.body.systemverilog"] }, { match: `(${R_BRACES_OPEN})`, tokens: [T_BRACES_OPEN], pushScopes: ["braces.body.systemverilog"] }, { match: `(${R_BRACES_CLOSE})`, tokens: [T_BRACES_CLOSE], popScopes: ["braces.body.systemverilog"] }, { match: `(${R_BRACKET_OPEN})`, tokens: [T_BRACKET_OPEN], pushScopes: ["bracket.body.systemverilog"] }, { match: `(${R_BRACKET_CLOSE})`, tokens: [T_BRACKET_CLOSE], popScopes: ["bracket.body.systemverilog"] }, { match: `(${R_WHITESPACE})`, tokens: [T_WHITESPACE] }, { include: "Operator" } ] }, Comment: { patterns: [ { match: `(${R_COMMENT_LINE})`, tokens: [T_COMMENT_LINE] }, { match: `(${R_COMMENT_BLOCK})`, tokens: [T_COMMENT_BLOCK], } ] }, Macro: { patterns: [ { match: `(${R_MACRO})`, tokens: [T_MACRO] }, { match: `(${R_MACRO_QUOTE})`, tokens: [T_MACRO_QUOTE] }, { match: `(${R_MACRO_ESCAPED_QUOTE})`, tokens: [T_MACRO_ESCAPED_QUOTE] }, { match: `(${R_MACRO_CONCAT})`, tokens: [T_MACRO_CONCAT] }, { match: `(${R_ESCAPED_BACKSLASH})`, tokens: [T_ESCAPED_BACKSLASH] }, { match: `(${R_ESCAPED_NEWLINE})`, tokens: [T_ESCAPED_NEWLINE] } ] }, Operator: { patterns: [ { match: `(${R_OP_COMMA})`, tokens: [T_OP_COMMA] }, { match: `(${R_OP_EQUAL})`, tokens: [T_OP_EQUAL] }, { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON] }, { match: `(${R_OTHER_OPERATORS})`, tokens: [T_OTHER_OPERATORS] } ] }, QuotedString: { patterns: [ { match: `(${R_STRING_BEGIN})`, tokens: [T_STRING_BEGIN], stack: { scopeName: "string.body.systemverilog", patterns: [ { match: `(${R_STRING_END})`, tokens: [T_STRING_END], pop: "", }, { match: `(${R_ESCAPED_BACKSLASH})`, tokens: [T_ESCAPED_BACKSLASH] }, { match: `(${R_ESCAPED_QUOTE})`, tokens: [T_ESCAPED_QUOTE] }, { match: `(${R_BACKSLASH})`, tokens: [T_BACKSLASH] }, { match: `(${R_STRING_CHARS})`, tokens: [T_STRING_CHARS] } ] } } ] } }; function toAssignmentExpression(scopeName, listRegExp, listTokens, listContext, endRegExp, endTokens) { return { scopeName: scopeName, patterns: [ { match: listRegExp, tokens: listTokens, pop: listContext }, { match: endRegExp, tokens: endTokens, pop: "" }, { include: "BaseGrammar" } ] }; } function toPortListBody(scopeNamePrefix, termRegExp, termTokens, contextName) { return { scopeName: `${scopeNamePrefix}.list.systemverilog`, patterns: [ { match: termRegExp, tokens: termTokens, pop: "" }, { match: `(${R_OP_EQUAL})`, tokens: [T_OP_EQUAL], pop: toAssignmentExpression(`${scopeNamePrefix}.expression.systemverilog`, `(${R_OP_COMMA})`, [T_OP_COMMA], contextName, termRegExp, termTokens) }, { match: `(${R_OP_COMMA})`, tokens: [T_OP_COMMA] }, { include: "AllAllow" }, { include: "AttributeInstance" }, { include: "Dimension" }, { include: "EnumDeclaration" }, { include: "GeneralParanthesesBlock" }, { include: "StructUnionDeclaration" }, { include: "Identifier" } ] }; } exports.svcompletion_grammar = { Main: { scopeName: "source.systemverilog", patterns: [ { include: "AttributeInstance" }, { include: "ContinuousBlock" }, { include: "EnumDeclaration" }, { include: "BeginEndBlock" }, { include: "ExportDeclaration" }, { include: "GenerateBlock" }, { include: "IgnoreBlocksStatements" }, { include: "ImportDeclaration" }, { include: "ModPortDeclaration" }, { include: "ParameterDeclaration" }, { include: "PortDeclaration" }, { include: "RoutineDeclaration" }, { include: "SequentialBlock" }, { include: "StructUnionDeclaration" }, { include: "SvContainer" }, { include: "SvPackage" }, { include: "TypeDefDeclaration" }, { include: "BaseGrammar" } ] }, AllAllow: { patterns: [ { include: "Macro" }, { include: "Comment" }, { include: "Whitespace" } ] }, AttributeInstance: { patterns: [ { // match: `(${R_PAREN_OPEN}${R_OP_STAR})`, //TBD Remove collision with "always @(*)" match: `((?<!@ *)${R_PAREN_OPEN}${R_OP_STAR})`, tokens: ["attribute.begin.systemverilog"], stack: "AttributeInstanceBody" //TBD: check if stack works properly DEBUG } ] }, AttributeInstanceBody: { scopeName: "attribute.inst.systemverilog", patterns: [ { match: `(${R_OP_STAR}${R_PAREN_CLOSE})`, tokens: ["attribute.end.systemverilog"], pop: "" }, { include: "Identifier" }, { match: `(${R_OP_EQUAL})`, tokens: [T_OP_EQUAL], pop: toAssignmentExpression("attribute.expression.systemverilog", `(${R_OP_COMMA})`, [T_OP_COMMA], "AttributeInstanceBody", `(${R_OP_STAR}${R_PAREN_CLOSE})`, ["attribute.end.systemverilog"]) }, { include: "AllAllow" } ] }, BaseGrammar: { patterns: [ { include: "AllAllow" }, { include: "AttributeInstance" }, { include: "EnumDeclaration" }, { include: "StructUnionDeclaration" }, { include: "TypeDefDeclaration" }, { include: "CaseStatement" }, { include: "CompletionItems" }, { include: "Dimension" }, { include: "GeneralBracesBlock" }, { include: "GeneralParanthesesBlock" }, { include: "QuotedString" }, { include: "SvNumber" }, { include: "SvOperators" } ] }, BeginEndBlock: { patterns: [ { match: grammar_engine_1.r `\b(begin)\b`, tokens: ["keyword.begin.systemverilog"], pushScopes: ["begin.block.systemverilog"] }, { match: grammar_engine_1.r `\b(end)\b`, tokens: ["keyword.end.systemverilog"], popScopes: ["begin.block.systemverilog"] } ] }, CaseStatement: { patterns: [ { match: grammar_engine_1.r `\b(case[xz]?|randcase)\b`, tokens: ["keyword.case.systemverilog"], pushScopes: ["case.body.systemverilog"] }, { match: grammar_engine_1.r `\b(endcase)\b`, tokens: ["keyword.endcase.systemverilog"], popScopes: ["case.body.systemverilog"] } ] }, Comment: exports.svpreproc_grammar.Comment, CompletionItems: { patterns: [ { include: "Identifier" }, { include: "SystemTask" } ] }, ContinuousBlock: { patterns: [ { match: grammar_engine_1.r `\b(assign)\b`, tokens: ["keyword.assign.systemverilog"], push: "ContinuousBlockBody" } ] }, ContinuousBlockBody: { scopeName: "continuous.block.systemverilog", patterns: [ { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON], pop: "" }, { match: `(${R_OP_EQUAL})`, tokens: [T_OP_EQUAL], pop: toAssignmentExpression("continuous.expression.systemverilog", `(${R_OP_COMMA})`, [T_OP_COMMA], "ContinuousBlockBody", `(${R_OP_SEMICOLON})`, [T_OP_SEMICOLON]) }, { include: "BaseGrammar" } ] }, Dimension: { patterns: [ { match: `(${R_BRACKET_OPEN})`, tokens: [T_BRACKET_OPEN], stack: { scopeName: "dimension.expression.systemverilog", patterns: [ { match: `(${R_BRACKET_CLOSE})`, tokens: [T_BRACKET_CLOSE], pop: "" }, { include: "BaseGrammar" } ] } } ] }, EnumDeclaration: { patterns: [ { match: grammar_engine_1.r `\b(enum)\b`, tokens: ["keyword.enum.systemverilog"], push: { scopeName: "enum.declaration.systemverilog", patterns: [ { match: `(${R_BRACES_OPEN})`, tokens: [T_BRACES_OPEN], pop: "EnumListBody", }, { include: "AllAllow" }, { include: "Identifier" }, { include: "Dimension" } ] } }, ] }, EnumListBody: { scopeName: "enum_list.body.systemverilog", patterns: [ { match: `(${R_BRACES_CLOSE})`, tokens: [T_BRACES_CLOSE], pop: "" }, { match: `(${R_OP_EQUAL})`, tokens: [T_OP_EQUAL], pop: toAssignmentExpression("enum.expression.systemverilog", `(${R_OP_COMMA})`, [T_OP_COMMA], "EnumListBody", `(${R_BRACES_CLOSE})`, [T_BRACES_CLOSE]) }, { include: "AllAllow" }, { match: `(${R_OP_COMMA})`, tokens: [T_OP_COMMA] }, { include: "Dimension" }, { include: "Identifier" } ] }, ExportDeclaration: { patterns: [ { match: grammar_engine_1.r `\b(export)\b`, tokens: ["keyword.export.systemverilog"], push: { scopeName: "export.declaration.systemverilog", patterns: [ { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON], pop: "" }, { match: `(${R_OP_STAR}${R_OP_COLON}${R_OP_COLON}${R_OP_STAR})`, tokens: ["identifier.scoped.systemverilog"], }, { match: `(${R_OP_COMMA})`, tokens: [T_OP_COMMA], }, { match: `(${R_OP_EQUAL})`, tokens: [T_OP_EQUAL] }, { include: "AllAllow" }, { include: "Identifier" }, { include: "QuotedString" }, ] } } ] }, GeneralBracesBlock: { patterns: [ { match: `(${R_BRACES_OPEN})`, tokens: [T_BRACES_OPEN], stack: { scopeName: "braces.block.systemverilog", patterns: [ { match: `(${R_BRACES_CLOSE})`, tokens: [T_BRACES_CLOSE], pop: "" }, { include: "BaseGrammar" } ] } } ] }, GeneralParanthesesBlock: { patterns: [ { match: `(${R_PAREN_OPEN})`, tokens: [T_PAREN_OPEN], stack: { scopeName: "parantheses.block.systemverilog", patterns: [ { match: `(${R_PAREN_CLOSE})`, tokens: [T_PAREN_CLOSE], pop: "" }, { include: "BaseGrammar" } ] } } ] }, GenerateBlock: { patterns: [ { match: grammar_engine_1.r `\b(generate)\b`, tokens: ["keyword.generate.systemverilog"], pushScopes: ["generate.block.systemverilog"] }, { match: grammar_engine_1.r `\b(endgenerate)\b`, tokens: ["keyword.endgenerate.systemverilog"], popScopes: ["generate.block.systemverilog"] } ] }, Identifier: { patterns: [ { match: `((?:${R_ID})${R_OP_COLON}${R_OP_COLON}(?:(?:${R_ID})(?:${R_OP_COLON}${R_OP_COLON})?)*${R_OP_STAR}?)`, tokens: ["identifier.scoped.systemverilog"] }, { match: `((?:${R_ID})${R_OP_DOT}(?:(?:${R_ID})${R_OP_DOT}?)*)`, tokens: ["identifier.hierarchical.systemverilog"] }, { match: `(${R_ID})`, tokens: [T_ID] }, ] }, IgnoreBlocksStatements: { patterns: [ { include: "IgnoreCheckerDeclaration" }, { include: "IgnoreClassDeclaration" }, { include: "IgnoreCoverGroupDeclaration" }, { include: "IgnoreDefparamStatement" }, { include: "IgnoreExternConstraintDeclaration" }, { include: "IgnoreLetStatement" }, { include: "IgnorePropertyDeclaration" }, { include: "IgnoreSequenceDeclaration" }, { include: "IgnoreSpecifyBlock" }, { include: "IgnoreSpecparamDeclaration" } ] }, IgnoreCheckerDeclaration: toIgnoreBlock(grammar_engine_1.r `\b(checker)\b`, ["keyword.checker.systemverilog"], grammar_engine_1.r `\b(endchecker)\b`, ["keyword.endchecker.systemverilog"], "checker", "IgnoreCheckerDeclaration"), IgnoreClassDeclaration: toIgnoreBlock(grammar_engine_1.r `\b(class)\b`, ["keyword.class.systemverilog"], grammar_engine_1.r `\b(endclass)\b`, ["keyword.endclass.systemverilog"], "class", "IgnoreClassDeclaration"), IgnoreCoverGroupDeclaration: toIgnoreBlock(grammar_engine_1.r `\b(covergroup)\b`, ["keyword.covergroup.systemverilog"], grammar_engine_1.r `\b(endgroup)\b`, ["keyword.endgroup.systemverilog"], "covergroup", "IgnoreCoverGroupDeclaration"), IgnoreDefparamStatement: toIgnoreStatement(grammar_engine_1.r `\b(defparam)\b`, ["keyword.defparam.systemverilog"], "defparam"), IgnoreExternConstraintDeclaration: { patterns: [ { match: grammar_engine_1.r `\b(constraint)\b`, tokens: ["keyword.constraint.systemverilog"], push: { scopeName: "constraint.declaration.systemverilog", patterns: [ { match: `(${R_BRACES_OPEN})`, tokens: [T_BRACES_OPEN], pop: { scopeName: "constraint.body.systemverilog", patterns: [ { match: `(${R_BRACES_CLOSE})`, tokens: [T_BRACES_CLOSE], pop: "" }, { include: "BaseGrammar" } ] } }, { include: "AllAllow" }, { include: "Identifier" } ] } } ] }, IgnoreLetStatement: toIgnoreStatement(grammar_engine_1.r `\b(let)\b`, ["keyword.let.systemverilog"], "let"), IgnorePropertyDeclaration: toIgnoreBlock(grammar_engine_1.r `\b(property)\b`, ["keyword.property.systemverilog"], grammar_engine_1.r `\b(endproperty)\b`, ["keyword.endproperty.systemverilog"], "property", "IgnorePropertyDeclaration"), IgnoreSequenceDeclaration: toIgnoreBlock(grammar_engine_1.r `\b(sequence)\b`, ["keyword.sequence.systemverilog"], grammar_engine_1.r `\b(endsequence)\b`, ["keyword.endsequence.systemverilog"], "sequence", "IgnoreSequenceDeclaration"), IgnoreSpecifyBlock: toIgnoreBlock(grammar_engine_1.r `\b(specify)\b`, ["keyword.specify.systemverilog"], grammar_engine_1.r `\b(endspecify)\b`, ["keyword.endspecify.systemverilog"], "specify", "IgnoreSpecifyBlock"), IgnoreSpecparamDeclaration: toIgnoreStatement(grammar_engine_1.r `\b(specparam)\b`, ["keyword.specparam.systemverilog"], "specparam"), ImportDeclaration: { patterns: [ { match: grammar_engine_1.r `\b(import)\b`, tokens: ["keyword.import.systemverilog"], push: { scopeName: "import.statement.systemverilog", patterns: [ { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON], pop: "" }, { match: `(${R_OP_COMMA})`, tokens: [T_OP_COMMA] }, { include: "AllAllow" }, { include: "Identifier" } ] } } ] }, Macro: exports.svpreproc_grammar.Macro, ModPortDeclaration: { patterns: [ { match: grammar_engine_1.r `\b(modport)\b`, tokens: ["keyword.modport.systemverilog"], push: { scopeName: "modport.declaration.systemverilog", patterns: [ { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON], pop: "" }, { include: "PortList" }, { include: "BaseGrammar" } ] } } ] }, ParameterDeclaration: { patterns: [ { match: grammar_engine_1.r `\b(parameter|localparam)\b`, tokens: ["keyword.parameter.systemverilog"], push: "ParameterDeclarationBody" } ] }, ParameterDeclarationBody: { scopeName: "parameter.declaration.systemverilog", patterns: [ { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON], pop: "", }, { match: `(${R_OP_EQUAL})`, tokens: [T_OP_EQUAL], pop: toAssignmentExpression("parameter.expression.systemverilog", `(${R_OP_COMMA})`, [T_OP_COMMA], "ParameterDeclarationBody", `(${R_OP_SEMICOLON})`, [T_OP_SEMICOLON]) }, { include: "AllAllow" }, { include: "Dimension" }, { include: "EnumDeclaration" }, { include: "GeneralParanthesesBlock" }, { include: "StructUnionDeclaration" }, { include: "Identifier" } ] }, ParameterPortList: { patterns: [ { match: `(${R_OP_HASH}${R_PAREN_OPEN})`, tokens: ["operator.hash_open_parantheses.systemverilog"], push: "ParameterPortListBody" } ] }, ParameterPortListBody: toPortListBody("parameter", `(${R_PAREN_CLOSE})`, [T_PAREN_CLOSE], "ParameterPortListBody"), PortDeclaration: { patterns: [ { match: grammar_engine_1.r `\b(input|output|inout|ref)\b`, tokens: ["keyword.port_direction.systemverilog"], push: "PortDeclarationBody" } ] }, PortDeclarationBody: toPortListBody("port_declaration", `(${R_OP_SEMICOLON})`, [T_OP_SEMICOLON], "PortDeclarationBody"), PortList: { patterns: [ { match: `((?<!#)${R_PAREN_OPEN})`, tokens: [T_PAREN_OPEN], push: "PortListBody" } ] }, PortListBody: toPortListBody("port", `(${R_PAREN_CLOSE})`, [T_PAREN_CLOSE], "PortListBody"), QuotedString: exports.svpreproc_grammar.QuotedString, RoutineDeclaration: { patterns: [ { match: grammar_engine_1.r `\b(function|task)\b`, tokens: ["keyword.routine.systemverilog"], push: { scopeName: "routine.header.systemverilog", patterns: [ { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON], pop: "" }, { include: "AllAllow" }, { include: "Dimension" }, { include: "Identifier" }, { include: "PortList" } ] } } ] }, SeqBeginEndBlock: { patterns: [ { match: grammar_engine_1.r `\b(begin)\b`, tokens: ["keyword.begin.systemverilog"], push: { scopeName: "begin.block.systemverilog", patterns: [ { match: grammar_engine_1.r `\b(end)\b`, tokens: ["keyword.end.systemverilog"], pop: "" }, { include: "SeqBeginEndBlock" }, { include: "BaseGrammar" } ] } } ] }, SeqCaseStatement: { patterns: [ { match: grammar_engine_1.r `\b(case[xz]?|randcase)\b`, tokens: ["keyword.case.systemverilog"], push: { scopeName: ["case.body.systemverilog"], patterns: [ { match: grammar_engine_1.r `\b(endcase)\b`, tokens: ["keyword.endcase.systemverilog"], pop: "" }, { include: "SeqCaseStatement" }, { include: "BaseGrammar" } ] } } ] }, SeqConditionalStatement: { patterns: [ { include: "UniquePriority" }, { match: grammar_engine_1.r `\b(if)\b`, tokens: ["keyword.if.systemverilog"], bank: { scopeName: "if.body.systemverilog", conditionalPopContext: { scopeName: "if.body.systemverilog", patterns: [ { match: `((?:(?:${R_WHITESPACE})|(?:${R_COMMENT_LINE})|(?:${R_COMMENT_BLOCK}))*)` + grammar_engine_1.r `\b(else)\b`, tokens: [T_WHITESPACE, "keyword.else.systemverilog"], pop: { scopeName: "if.body.systemverilog", patterns: [ { include: "SvStatement" } ] } } ] }, patterns: [ { include: "SvStatement" } ] } }, ] }, SequentialBlock: { patterns: [ { match: grammar_engine_1.r `\b(always|always_comb|always_ff|always_latch|initial|final)\b`, tokens: ["keyword.sequential_block.systemverilog"], bank: { scopeName: "sequential_block.body.systemverilog", patterns: [ { include: "SvStatement" } ] } } ] }, StructUnionDeclaration: { patterns: [ { match: grammar_engine_1.r `\b(struct|union)\b`, tokens: ["keyword.struct_union.systemverilog"], push: { scopeName: "struct_union.declaration.systemverilog", patterns: [ { match: `(${R_BRACES_OPEN})`, tokens: [T_BRACES_OPEN], pop: "StructUnionMemberListBody", }, { include: "AllAllow" }, { include: "Identifier" } ] } } ] }, StructUnionMemberListBody: { scopeName: "struct_union_member_list.body.systemverilog", patterns: [ { match: `(${R_BRACES_CLOSE})`, tokens: [T_BRACES_CLOSE], pop: "" }, { match: `(${R_OP_EQUAL})`, tokens: [T_OP_EQUAL], pop: toAssignmentExpression("struct_union_member.expression.systemverilog", `(${R_OP_SEMICOLON})`, [T_OP_SEMICOLON], "StructUnionMemberListBody", `(${R_BRACES_CLOSE})`, [T_BRACES_CLOSE]) }, { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON] }, { include: "AllAllow" }, { include: "Dimension" }, { include: "StructUnionDeclaration" }, { include: "EnumDeclaration" }, { include: "Identifier" } ] }, SvContainer: { patterns: [ { match: grammar_engine_1.r `\b(module|macromodule|interface|program)\b`, tokens: ["keyword.container.systemverilog"], push: { scopeName: "container.header.systemverilog", patterns: [ { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON], pop: "" }, { include: "AllAllow" }, { include: "ImportDeclaration" }, { include: "Identifier" }, { include: "ParameterPortList" }, { include: "PortList" } ] } } ] }, SvNumber: { patterns: [ { match: `(${R_NUM}(?:${R_OP_DOT}${R_NUM})?(?:s|ms|us|ns|ps|fs))`, tokens: ["literal.time.systemverilog"] }, { match: `((?:${R_NUM})?'[sS]?[bB][01xXzZ?][01xXzZ?_]*)`, tokens: ["literal.number.systemverilog"] }, { match: `((?:${R_NUM})?'[sS]?[oO][0-7xXzZ?][0-7xXzZ?_]*)`, tokens: ["literal.number.systemverilog"] }, { match: `((?:${R_NUM})?'[sS]?[dD]${R_NUM})`, tokens: ["literal.number.systemverilog"] }, { match: `((?:${R_NUM})?'[sS]?[dD][xXzZ?]_*)`, tokens: ["literal.number.systemverilog"] }, { match: `((?:${R_NUM})?'[sS]?[hH][0-9a-fA-FxXzZ?][0-9a-fA-F_xXzZ?]*)`, tokens: ["literal.number.systemverilog"] }, { match: `('[01xXzZ?])`, tokens: ["literal.number.systemverilog"] }, { match: `(${R_NUM}(?:${R_OP_DOT}${R_NUM})?(?:[eE](?:${R_OP_PLUS}|${R_OP_MINUS})?${R_NUM})?)`, tokens: ["literal.number.systemverilog"] } ] }, SvOperators: exports.svpreproc_grammar.Operator, SvPackage: { patterns: [ { match: grammar_engine_1.r `\b(package)\b`, tokens: ["keyword.package.systemverilog"], push: { scopeName: "package.header.systemverilog", patterns: [ { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON], pop: "" }, { include: "AllAllow" }, { include: "Identifier" } ] } } ] }, SvStatement: { patterns: [ { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON], pop: "" }, { include: "SeqBeginEndBlock" }, { include: "SeqCaseStatement" }, { include: "SeqConditionalStatement" }, //{ include: "LoopStatement" }, //{ include: "ParBlock" }, //{ include: "ProceduralAssertionStatement" }, //{ include: "RandSequenceStatement" }, //{ include: "ExpectPropertyStatement" }, { include: "BaseGrammar" } ] }, SystemTask: { patterns: [ { match: `(${R_OP_DOLLAR}${R_SIMPLE_ID}${R_PAREN_OPEN})`, tokens: ["system.task.systemverilog"], stack: { scopeName: "system.args.systemverilog", patterns: [ { match: `(${R_PAREN_CLOSE})`, tokens: [T_PAREN_CLOSE], pop: "", }, { include: "BaseGrammar" } ] } }, { match: `(${R_OP_DOLLAR}${R_SIMPLE_ID})`, tokens: ["system.identifier.systemverilog"] } ] }, TypeDefDeclaration: { patterns: [ { match: grammar_engine_1.r `\b(typedef)\b`, tokens: ["keyword.typedef.systemverilog"], push: { scopeName: "typedef.declaration.systemverilog", patterns: [ { match: `(${R_OP_SEMICOLON})`, tokens: [T_OP_SEMICOLON], pop: "" }, { include: "BaseGrammar" } ] } } ] }, UniquePriority: { patterns: [ { match: grammar_engine_1.r `\b(unique|priority)\b`, tokens: ["keyword.unique_priority.systemverilog"], } ] }, Whitespace: { patterns: [ { match: `(${R_WHITESPACE})`, tokens: [T_WHITESPACE] } ] } };