{ "name": "LTspice Symbol", "scopeName": "source.ltspice.symbol", "patterns": [ { "include": "#main" } ], "repository": { "attr": { "name": "meta.attribute.ltspice.symbol", "begin": "^\\s*(SYMATTR)(?=\\s|$)", "end": "$", "patterns": [ { "match": "\\G\\s+(\\S+)", "captures": { "1": { "name": "entity.attribute.name.ltspice.symbol" } } }, { "name": "string.unquoted.attribute.value.ltspice.symbol", "match": ".+" } ], "beginCaptures": { "1": { "name": "storage.type.var.attribute.ltspice.symbol" } } }, "main": { "patterns": [ { "include": "#version" }, { "include": "#symbolType" }, { "include": "#shapes" }, { "include": "#window" }, { "include": "#pinAttr" }, { "include": "#pin" }, { "include": "#attr" }, { "include": "#text" } ] }, "number": { "patterns": [ { "name": "constant.numeric.float.real.decimal.ltspice.symbol", "match": "[-+]?[0-9]+\\.[0-9]+" }, { "name": "constant.numeric.integer.int.decimal.ltspice.symbol", "match": "[-+]?[0-9]+" } ] }, "pin": { "name": "meta.pin.ltspice.symbol", "begin": "^\\s*(PIN)(?=\\s|$)", "end": "$", "patterns": [ { "include": "#number" }, { "name": "constant.language.pin-alignment.ltspice.symbol", "match": "\\w+" } ], "beginCaptures": { "1": { "name": "keyword.control.pin.ltspice.symbol" } } }, "pinAttr": { "name": "meta.pin.attribute.ltspice.symbol", "begin": "^\\s*(PINATTR)(?=\\s|$)", "end": "$", "patterns": [ { "match": "\\G\\s+(SpiceOrder)\\s+(\\d+)", "patterns": [ { "include": "#number" } ], "captures": { "1": { "name": "entity.pin.attribute.name.ltspice.symbol" }, "2": { "patterns": [ { "include": "#number" } ] } } }, { "match": "\\G\\s+(\\S+)", "captures": { "1": { "name": "entity.attribute.name.ltspice.symbol" } } }, { "match": "(\\[)([^\\]]+)(\\])", "captures": { "1": { "name": "punctuation.definition.brace.square.bracket.begin.ltspice.symbol" }, "2": { "patterns": [ { "name": "punctuation.delimiter.separator.colon.key-value.ltspice.symbol", "match": ":" }, { "include": "#number" } ] }, "3": { "name": "punctuation.definition.brace.square.bracket.begin.ltspice.symbol" } } }, { "name": "string.unquoted.attribute.value.ltspice.symbol", "match": "[^\\s\\[]+" } ], "beginCaptures": { "1": { "name": "storage.type.var.attribute.ltspice.symbol" } } }, "shapes": { "name": "meta.shape.${1:/downcase}.ltspice.symbol", "begin": "^\\s*(ARC|LINE|CIRCLE|RECTANGLE)(?=\\s|$)", "end": "$", "patterns": [ { "name": "variable.parameter.type.ltspice.symbol", "match": "\\G\\s*(?!\\d)(\\w+)" }, { "include": "#number" } ], "beginCaptures": { "1": { "name": "storage.type.var.shape.ltspice.symbol" } } }, "symbolType": { "name": "meta.symbol-type.ltspice.symbol", "begin": "^\\s*(SymbolType)(?=\\s|$)", "end": "$", "patterns": [ { "name": "constant.language.symbol-type.ltspice.symbol", "match": "[A-Za-z_$]+" } ], "beginCaptures": { "1": { "name": "keyword.control.symbol-type.ltspice.symbol" } } }, "text": { "name": "meta.text.ltspice.symbol", "begin": "^\\s*(TEXT)(?=\\s|$)", "end": "$", "patterns": [ { "name": "meta.function-call.arguments.ltspice.symbol", "match": "(?x) \\G\n\\s+ ([-\\d.]+) # X\n\\s+ ([-\\d.]+) # Y\n\\s+ ([-\\w$]+) # Alignment\n\\s+ ([-\\d.]+) # Text-size", "captures": { "1": { "name": "meta.vector.x-axis.ltspice.symbol", "patterns": [ { "include": "#number" } ] }, "2": { "name": "meta.vector.y-axis.ltspice.symbol", "patterns": [ { "include": "#number" } ] }, "3": { "name": "constant.language.text-alignment.ltspice.symbol" }, "4": { "name": "meta.text-size.ltspice.symbol", "patterns": [ { "include": "#number" } ] } } }, { "name": "string.unquoted.text.ltspice.symbol", "match": ".+" } ], "beginCaptures": { "1": { "name": "storage.type.var.text.ltspice.symbol" } } }, "version": { "name": "meta.version.ltspice.symbol", "begin": "^\\s*(Version)(?=\\s|$)", "end": "$", "patterns": [ { "include": "#number" } ], "beginCaptures": { "1": { "name": "keyword.control.file-version.ltspice.symbol" } } }, "window": { "name": "meta.window.ltspice.symbol", "begin": "^\\s*(WINDOW)(?=\\s|$)", "end": "$", "patterns": [ { "name": "meta.function-call.arguments.ltspice.symbol", "match": "\\G((?:\\s+[-\\d.]+){3})\\s+(\\w+)\\s+([-\\d.]+)", "captures": { "1": { "patterns": [ { "include": "#number" } ] }, "2": { "name": "constant.language.window-alignment.ltspice.symbol" }, "3": { "patterns": [ { "include": "#number" } ] } } } ], "beginCaptures": { "1": { "name": "keyword.control.window.ltspice.symbol" } } } } }