123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417 |
- /*!-----------------------------------------------------------------------------
- * Copyright (c) Microsoft Corporation. All rights reserved.
- * Version: 0.31.1(337587859b1c171314b40503171188b6cea6a32a)
- * Released under the MIT license
- * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
- *-----------------------------------------------------------------------------*/
- // src/basic-languages/st/st.ts
- var conf = {
- comments: {
- lineComment: "//",
- blockComment: ["(*", "*)"]
- },
- brackets: [
- ["{", "}"],
- ["[", "]"],
- ["(", ")"],
- ["var", "end_var"],
- ["var_input", "end_var"],
- ["var_output", "end_var"],
- ["var_in_out", "end_var"],
- ["var_temp", "end_var"],
- ["var_global", "end_var"],
- ["var_access", "end_var"],
- ["var_external", "end_var"],
- ["type", "end_type"],
- ["struct", "end_struct"],
- ["program", "end_program"],
- ["function", "end_function"],
- ["function_block", "end_function_block"],
- ["action", "end_action"],
- ["step", "end_step"],
- ["initial_step", "end_step"],
- ["transaction", "end_transaction"],
- ["configuration", "end_configuration"],
- ["tcp", "end_tcp"],
- ["recource", "end_recource"],
- ["channel", "end_channel"],
- ["library", "end_library"],
- ["folder", "end_folder"],
- ["binaries", "end_binaries"],
- ["includes", "end_includes"],
- ["sources", "end_sources"]
- ],
- autoClosingPairs: [
- { open: "[", close: "]" },
- { open: "{", close: "}" },
- { open: "(", close: ")" },
- { open: "/*", close: "*/" },
- { open: "'", close: "'", notIn: ["string_sq"] },
- { open: '"', close: '"', notIn: ["string_dq"] },
- { open: "var_input", close: "end_var" },
- { open: "var_output", close: "end_var" },
- { open: "var_in_out", close: "end_var" },
- { open: "var_temp", close: "end_var" },
- { open: "var_global", close: "end_var" },
- { open: "var_access", close: "end_var" },
- { open: "var_external", close: "end_var" },
- { open: "type", close: "end_type" },
- { open: "struct", close: "end_struct" },
- { open: "program", close: "end_program" },
- { open: "function", close: "end_function" },
- { open: "function_block", close: "end_function_block" },
- { open: "action", close: "end_action" },
- { open: "step", close: "end_step" },
- { open: "initial_step", close: "end_step" },
- { open: "transaction", close: "end_transaction" },
- { open: "configuration", close: "end_configuration" },
- { open: "tcp", close: "end_tcp" },
- { open: "recource", close: "end_recource" },
- { open: "channel", close: "end_channel" },
- { open: "library", close: "end_library" },
- { open: "folder", close: "end_folder" },
- { open: "binaries", close: "end_binaries" },
- { open: "includes", close: "end_includes" },
- { open: "sources", close: "end_sources" }
- ],
- surroundingPairs: [
- { open: "{", close: "}" },
- { open: "[", close: "]" },
- { open: "(", close: ")" },
- { open: '"', close: '"' },
- { open: "'", close: "'" },
- { open: "var", close: "end_var" },
- { open: "var_input", close: "end_var" },
- { open: "var_output", close: "end_var" },
- { open: "var_in_out", close: "end_var" },
- { open: "var_temp", close: "end_var" },
- { open: "var_global", close: "end_var" },
- { open: "var_access", close: "end_var" },
- { open: "var_external", close: "end_var" },
- { open: "type", close: "end_type" },
- { open: "struct", close: "end_struct" },
- { open: "program", close: "end_program" },
- { open: "function", close: "end_function" },
- { open: "function_block", close: "end_function_block" },
- { open: "action", close: "end_action" },
- { open: "step", close: "end_step" },
- { open: "initial_step", close: "end_step" },
- { open: "transaction", close: "end_transaction" },
- { open: "configuration", close: "end_configuration" },
- { open: "tcp", close: "end_tcp" },
- { open: "recource", close: "end_recource" },
- { open: "channel", close: "end_channel" },
- { open: "library", close: "end_library" },
- { open: "folder", close: "end_folder" },
- { open: "binaries", close: "end_binaries" },
- { open: "includes", close: "end_includes" },
- { open: "sources", close: "end_sources" }
- ],
- folding: {
- markers: {
- start: new RegExp("^\\s*#pragma\\s+region\\b"),
- end: new RegExp("^\\s*#pragma\\s+endregion\\b")
- }
- }
- };
- var language = {
- defaultToken: "",
- tokenPostfix: ".st",
- ignoreCase: true,
- brackets: [
- { token: "delimiter.curly", open: "{", close: "}" },
- { token: "delimiter.parenthesis", open: "(", close: ")" },
- { token: "delimiter.square", open: "[", close: "]" }
- ],
- keywords: [
- "if",
- "end_if",
- "elsif",
- "else",
- "case",
- "of",
- "to",
- "__try",
- "__catch",
- "__finally",
- "do",
- "with",
- "by",
- "while",
- "repeat",
- "end_while",
- "end_repeat",
- "end_case",
- "for",
- "end_for",
- "task",
- "retain",
- "non_retain",
- "constant",
- "with",
- "at",
- "exit",
- "return",
- "interval",
- "priority",
- "address",
- "port",
- "on_channel",
- "then",
- "iec",
- "file",
- "uses",
- "version",
- "packagetype",
- "displayname",
- "copyright",
- "summary",
- "vendor",
- "common_source",
- "from",
- "extends"
- ],
- constant: ["false", "true", "null"],
- defineKeywords: [
- "var",
- "var_input",
- "var_output",
- "var_in_out",
- "var_temp",
- "var_global",
- "var_access",
- "var_external",
- "end_var",
- "type",
- "end_type",
- "struct",
- "end_struct",
- "program",
- "end_program",
- "function",
- "end_function",
- "function_block",
- "end_function_block",
- "interface",
- "end_interface",
- "method",
- "end_method",
- "property",
- "end_property",
- "namespace",
- "end_namespace",
- "configuration",
- "end_configuration",
- "tcp",
- "end_tcp",
- "resource",
- "end_resource",
- "channel",
- "end_channel",
- "library",
- "end_library",
- "folder",
- "end_folder",
- "binaries",
- "end_binaries",
- "includes",
- "end_includes",
- "sources",
- "end_sources",
- "action",
- "end_action",
- "step",
- "initial_step",
- "end_step",
- "transaction",
- "end_transaction"
- ],
- typeKeywords: [
- "int",
- "sint",
- "dint",
- "lint",
- "usint",
- "uint",
- "udint",
- "ulint",
- "real",
- "lreal",
- "time",
- "date",
- "time_of_day",
- "date_and_time",
- "string",
- "bool",
- "byte",
- "word",
- "dword",
- "array",
- "pointer",
- "lword"
- ],
- operators: [
- "=",
- ">",
- "<",
- ":",
- ":=",
- "<=",
- ">=",
- "<>",
- "&",
- "+",
- "-",
- "*",
- "**",
- "MOD",
- "^",
- "or",
- "and",
- "not",
- "xor",
- "abs",
- "acos",
- "asin",
- "atan",
- "cos",
- "exp",
- "expt",
- "ln",
- "log",
- "sin",
- "sqrt",
- "tan",
- "sel",
- "max",
- "min",
- "limit",
- "mux",
- "shl",
- "shr",
- "rol",
- "ror",
- "indexof",
- "sizeof",
- "adr",
- "adrinst",
- "bitadr",
- "is_valid",
- "ref",
- "ref_to"
- ],
- builtinVariables: [],
- builtinFunctions: [
- "sr",
- "rs",
- "tp",
- "ton",
- "tof",
- "eq",
- "ge",
- "le",
- "lt",
- "ne",
- "round",
- "trunc",
- "ctd",
- "\u0441tu",
- "ctud",
- "r_trig",
- "f_trig",
- "move",
- "concat",
- "delete",
- "find",
- "insert",
- "left",
- "len",
- "replace",
- "right",
- "rtc"
- ],
- symbols: /[=><!~?:&|+\-*\/\^%]+/,
- escapes: /\\(?:[abfnrtv\\"']|x[0-9A-Fa-f]{1,4}|u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8})/,
- tokenizer: {
- root: [
- [/(\.\.)/, "delimiter"],
- [/\b(16#[0-9A-Fa-f\_]*)+\b/, "number.hex"],
- [/\b(2#[01\_]+)+\b/, "number.binary"],
- [/\b(8#[0-9\_]*)+\b/, "number.octal"],
- [/\b\d*\.\d+([eE][\-+]?\d+)?\b/, "number.float"],
- [/\b(L?REAL)#[0-9\_\.e]+\b/, "number.float"],
- [/\b(BYTE|(?:D|L)?WORD|U?(?:S|D|L)?INT)#[0-9\_]+\b/, "number"],
- [/\d+/, "number"],
- [/\b(T|DT|TOD)#[0-9:-_shmyd]+\b/, "tag"],
- [/\%(I|Q|M)(X|B|W|D|L)[0-9\.]+/, "tag"],
- [/\%(I|Q|M)[0-9\.]*/, "tag"],
- [/\b[A-Za-z]{1,6}#[0-9]+\b/, "tag"],
- [/\b(TO_|CTU_|CTD_|CTUD_|MUX_|SEL_)[A_Za-z]+\b/, "predefined"],
- [/\b[A_Za-z]+(_TO_)[A_Za-z]+\b/, "predefined"],
- [/[;]/, "delimiter"],
- [/[.]/, { token: "delimiter", next: "@params" }],
- [
- /[a-zA-Z_]\w*/,
- {
- cases: {
- "@operators": "operators",
- "@keywords": "keyword",
- "@typeKeywords": "type",
- "@defineKeywords": "variable",
- "@constant": "constant",
- "@builtinVariables": "predefined",
- "@builtinFunctions": "predefined",
- "@default": "identifier"
- }
- }
- ],
- { include: "@whitespace" },
- [/[{}()\[\]]/, "@brackets"],
- [/"([^"\\]|\\.)*$/, "string.invalid"],
- [/"/, { token: "string.quote", bracket: "@open", next: "@string_dq" }],
- [/'/, { token: "string.quote", bracket: "@open", next: "@string_sq" }],
- [/'[^\\']'/, "string"],
- [/(')(@escapes)(')/, ["string", "string.escape", "string"]],
- [/'/, "string.invalid"]
- ],
- params: [
- [/\b[A-Za-z0-9_]+\b(?=\()/, { token: "identifier", next: "@pop" }],
- [/\b[A-Za-z0-9_]+\b/, "variable.name", "@pop"]
- ],
- comment: [
- [/[^\/*]+/, "comment"],
- [/\/\*/, "comment", "@push"],
- ["\\*/", "comment", "@pop"],
- [/[\/*]/, "comment"]
- ],
- comment2: [
- [/[^\(*]+/, "comment"],
- [/\(\*/, "comment", "@push"],
- ["\\*\\)", "comment", "@pop"],
- [/[\(*]/, "comment"]
- ],
- whitespace: [
- [/[ \t\r\n]+/, "white"],
- [/\/\/.*$/, "comment"],
- [/\/\*/, "comment", "@comment"],
- [/\(\*/, "comment", "@comment2"]
- ],
- string_dq: [
- [/[^\\"]+/, "string"],
- [/@escapes/, "string.escape"],
- [/\\./, "string.escape.invalid"],
- [/"/, { token: "string.quote", bracket: "@close", next: "@pop" }]
- ],
- string_sq: [
- [/[^\\']+/, "string"],
- [/@escapes/, "string.escape"],
- [/\\./, "string.escape.invalid"],
- [/'/, { token: "string.quote", bracket: "@close", next: "@pop" }]
- ]
- }
- };
- export {
- conf,
- language
- };
|