/*!----------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Version: 0.36.1(6c56744c3419458f0dd48864520b759d1a3a1ca8) * Released under the MIT license * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt *-----------------------------------------------------------------------------*/ // src/basic-languages/ruby/ruby.ts var conf = { comments: { lineComment: "#", blockComment: ["=begin", "=end"] }, brackets: [ ["(", ")"], ["{", "}"], ["[", "]"] ], autoClosingPairs: [ { open: "{", close: "}" }, { open: "[", close: "]" }, { open: "(", close: ")" }, { open: '"', close: '"' }, { open: "'", close: "'" } ], surroundingPairs: [ { open: "{", close: "}" }, { open: "[", close: "]" }, { open: "(", close: ")" }, { open: '"', close: '"' }, { open: "'", close: "'" } ], indentationRules: { increaseIndentPattern: new RegExp(`^\\s*((begin|class|(private|protected)\\s+def|def|else|elsif|ensure|for|if|module|rescue|unless|until|when|while|case)|([^#]*\\sdo\\b)|([^#]*=\\s*(case|if|unless)))\\b([^#\\{;]|("|'|/).*\\4)*(#.*)?$`), decreaseIndentPattern: new RegExp("^\\s*([}\\]]([,)]?\\s*(#|$)|\\.[a-zA-Z_]\\w*\\b)|(end|rescue|ensure|else|elsif|when)\\b)") } }; var language = { tokenPostfix: ".ruby", keywords: [ "__LINE__", "__ENCODING__", "__FILE__", "BEGIN", "END", "alias", "and", "begin", "break", "case", "class", "def", "defined?", "do", "else", "elsif", "end", "ensure", "for", "false", "if", "in", "module", "next", "nil", "not", "or", "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless", "until", "when", "while", "yield" ], keywordops: ["::", "..", "...", "?", ":", "=>"], builtins: [ "require", "public", "private", "include", "extend", "attr_reader", "protected", "private_class_method", "protected_class_method", "new" ], declarations: [ "module", "class", "def", "case", "do", "begin", "for", "if", "while", "until", "unless" ], linedecls: ["def", "case", "do", "begin", "for", "if", "while", "until", "unless"], operators: [ "^", "&", "|", "<=>", "==", "===", "!~", "=~", ">", ">=", "<", "<=", "<<", ">>", "+", "-", "*", "/", "%", "**", "~", "+@", "-@", "[]", "[]=", "`", "+=", "-=", "*=", "**=", "/=", "^=", "%=", "<<=", ">>=", "&=", "&&=", "||=", "|=" ], brackets: [ { open: "(", close: ")", token: "delimiter.parenthesis" }, { open: "{", close: "}", token: "delimiter.curly" }, { open: "[", close: "]", token: "delimiter.square" } ], symbols: /[=>" }], [/%([qws])(@delim)/, { token: "string.$1.delim", switchTo: "@qstring.$1.$2.$2" }], [/%r\(/, { token: "regexp.delim", switchTo: "@pregexp.(.)" }], [/%r\[/, { token: "regexp.delim", switchTo: "@pregexp.[.]" }], [/%r\{/, { token: "regexp.delim", switchTo: "@pregexp.{.}" }], [/%r" }], [/%r(@delim)/, { token: "regexp.delim", switchTo: "@pregexp.$1.$1" }], [/%(x|W|Q?)\(/, { token: "string.$1.delim", switchTo: "@qqstring.$1.(.)" }], [/%(x|W|Q?)\[/, { token: "string.$1.delim", switchTo: "@qqstring.$1.[.]" }], [/%(x|W|Q?)\{/, { token: "string.$1.delim", switchTo: "@qqstring.$1.{.}" }], [/%(x|W|Q?)" }], [/%(x|W|Q?)(@delim)/, { token: "string.$1.delim", switchTo: "@qqstring.$1.$2.$2" }], [/%([rqwsxW]|Q?)./, { token: "invalid", next: "@pop" }], [/./, { token: "invalid", next: "@pop" }] ], qstring: [ [/\\$/, "string.$S2.escape"], [/\\./, "string.$S2.escape"], [ /./, { cases: { "$#==$S4": { token: "string.$S2.delim", next: "@pop" }, "$#==$S3": { token: "string.$S2.delim", next: "@push" }, "@default": "string.$S2" } } ] ], qqstring: [[/#/, "string.$S2.escape", "@interpolated"], { include: "@qstring" }], whitespace: [ [/[ \t\r\n]+/, ""], [/^\s*=begin\b/, "comment", "@comment"], [/#.*$/, "comment"] ], comment: [ [/[^=]+/, "comment"], [/^\s*=begin\b/, "comment.invalid"], [/^\s*=end\b.*/, "comment", "@pop"], [/[=]/, "comment"] ] } }; export { conf, language };