"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.svpreproc_grammar = void 0;
const grammar_engine_1 = require("./grammar_engine");
const idRegExp = grammar_engine_1.r `[a-zA-Z_][0-9a-zA-Z_$]*|\\\S+(?:\s|\n|\r|$)`;
exports.svpreproc_grammar = {
    Main: {
        scopeName: "preproc.systemverilog",
        patterns: [
            { include: "All" }
        ]
    },
    All: {
        patterns: [
            {
                match: grammar_engine_1.r `(,)`,
                tokens: ["operator.comma.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(=)`,
                tokens: ["operator.equals.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(` + idRegExp + grammar_engine_1.r `)`,
                tokens: ["identifier.regular.systemverilog"]
            },
            {
                match: grammar_engine_1.r `([0-9]+)`,
                tokens: ["literal.number.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\`(?:` + idRegExp + grammar_engine_1.r `))`,
                tokens: ["meta.macro.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\'")`,
                tokens: ["macro.quote.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\`\\")`,
                tokens: ["macro.escaped_quote.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\`\`)`,
                tokens: ["macro.concat.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\\\\)`,
                tokens: ["escaped.backslash.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\\(?:\n|\r))`,
                tokens: ["escaped.new_line.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(")`,
                tokens: ["string.begin.systemverilog"],
                push: {
                    scopeName: "string.body.systemverilog",
                    patterns: [
                        {
                            match: grammar_engine_1.r `(")`,
                            tokens: ["string.end.systemverilog"],
                            pop: "",
                        },
                        {
                            match: grammar_engine_1.r `(\\\\)`,
                            tokens: ["escaped.backslash.systemverilog"]
                        },
                        {
                            match: grammar_engine_1.r `(\\")`,
                            tokens: ["escaped.quote.systemverilog"]
                        },
                        {
                            match: grammar_engine_1.r `(\\)`,
                            tokens: ["regular.backslash.systemverilog"]
                        },
                        {
                            match: grammar_engine_1.r `([^"\\]+)`,
                            tokens: ["string.characters.systemverilog"]
                        }
                    ]
                }
            },
            {
                match: grammar_engine_1.r `(//.*(?:\n|\r))`,
                tokens: ["comment.line.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(/\*(?:.|\n|\r)*?(?:\*/|$))`,
                tokens: ["comment.block.systemverilog"],
            },
            {
                match: grammar_engine_1.r `(\()`,
                tokens: ["parantheses.open.systemverilog"],
                pushScopes: ["parantheses.body.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\))`,
                tokens: ["parantheses.close.systemverilog"],
                popScopes: ["parantheses.body.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\{)`,
                tokens: ["braces.open.systemverilog"],
                pushScopes: ["braces.body.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\})`,
                tokens: ["braces.close.systemverilog"],
                popScopes: ["braces.body.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\[)`,
                tokens: ["bracket.open.systemverilog"],
                pushScopes: ["bracket.body.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\])`,
                tokens: ["bracket.close.systemverilog"],
                popScopes: ["bracket.body.systemverilog"]
            },
            {
                match: grammar_engine_1.r `((?:\s|\n|\r)+)`,
                tokens: ["meta.whitespace.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(===|!==|==|!=|<=|>=|<<|>>|<|>)`,
                tokens: ["operator.comparison.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(->[>]?)`,
                tokens: ["operator.trigger.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(:=|:/)`,
                tokens: ["operator.constraint.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\-\-|\+\+|\-|\+|\*|\/|%)`,
                tokens: ["operator.arithmetic.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(!|&&|\|\|)`,
                tokens: ["operator.logical.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(&|\||\^|~)`,
                tokens: ["operator.bitwise.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\?|:)`,
                tokens: ["operator.ternary.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(#)(1step)`,
                tokens: ["operator.delay.systemverilog", "keyword.other.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(##|#|@|\.|')`,
                tokens: ["operator.other.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(;)`,
                tokens: ["operator.semicolon.systemverilog"]
            },
            {
                match: grammar_engine_1.r `(\\)`,
                tokens: ["operator.backslash.systemverilog"]
            }
        ]
    }
};
