{ "fileTypes": [ "m" ], "keyEquivalent": "^~M", "name": "MATLAB", "patterns": [ { "begin": "(?x)\n(?=function\\b) # borrowed from ruby bundle\n(?<=^|\\s)(function)\\s+ # the function keyword\n(?>\\[(.*)\\])?\\t# match various different combination of output arguments\n((?>[a-zA-Z_]\\w*))?\n(?>\\s*=\\s*)?\n((?>[a-zA-Z_]\\w*(?>[?!]|=(?!>))? )) # the function name\n(?=[ \\t]*[^\\s%|#]) # make sure arguments and not a comment follow\n\\s*(\\() # the opening parenthesis for arguments", "beginCaptures": { "1": { "name": "storage.type.matlab" }, "2": { "name": "variable.parameter.output.function.matlab" }, "3": { "name": "variable.parameter.output.function.matlab" }, "4": { "name": "entity.name.function.matlab" } }, "contentName": "variable.parameter.input.function.matlab", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.parameters.matlab" } }, "name": "meta.function.with-arguments.matlab" }, { "captures": { "1": { "name": "storage.type.matlab" }, "2": { "name": "variable.parameter.output.function.matlab" }, "3": { "name": "variable.parameter.output.function.matlab" }, "4": { "name": "entity.name.function.matlab" } }, "match": "(?x)\n(?=function\\b) # borrowed from ruby bundle\n(?<=^|\\s)(function)\\s+ # the function keyword\n(?>\\[(.*)\\])? # match various different combination of output arguments\n((?>[a-zA-Z_]\\w*))?\n(?>\\s*=\\s*)?\n((?>[a-zA-Z_]\\w*(?>[?!]|=(?!>))? )) # the function name", "name": "meta.function.without-arguments.matlab" }, { "include": "#constants_override" }, { "include": "#brackets" }, { "include": "#curlybrackets" }, { "include": "#parens" }, { "include": "#string" }, { "include": "#transpose" }, { "include": "#double_quote" }, { "include": "#operators" }, { "include": "#all_matlab_keywords" }, { "include": "#all_matlab_comments" }, { "include": "#number" }, { "include": "#variable" }, { "include": "#variable_invalid" }, { "include": "#not_equal_invalid" }, { "include": "#variable_assignment" } ], "repository": { "all_matlab_comments": { "patterns": [ { "begin": "(^[ \\t]+)?(?=%%)", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.matlab" } }, "end": "(?!\\G)", "patterns": [ { "begin": "%%", "beginCaptures": { "0": { "name": "punctuation.definition.comment.matlab" } }, "end": "\\n", "name": "comment.line.double-percentage.matlab", "patterns": [ { "begin": "\\G\\s*(?![\\n\\s])", "contentName": "meta.cell.matlab", "end": "(?=\\n)" } ] } ] }, { "begin": "%\\{", "captures": { "1": { "name": "punctuation.definition.comment.matlab" } }, "end": "%\\}\\s*\\n", "name": "comment.block.percentage.matlab" }, { "begin": "(^[ \\t]+)?(?=%)", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.matlab" } }, "end": "(?!\\G)", "patterns": [ { "begin": "%", "beginCaptures": { "0": { "name": "punctuation.definition.comment.matlab" } }, "end": "\\n", "name": "comment.line.percentage.matlab" } ] } ] }, "all_matlab_keywords": { "patterns": [ { "include": "#matlab_keyword_control" }, { "include": "#matlab_keyword_operator" }, { "include": "#matlab_keyword_other" }, { "include": "#matlab_storage_type" }, { "include": "#matlab_storage_modifier" }, { "include": "#matlab_constant_language" }, { "include": "#matlab_variable_function" }, { "include": "#matlab_keyword_desktop" }, { "include": "#matlab_keyword_mathematics" }, { "include": "#matlab_keyword_analysis" }, { "include": "#matlab_storage_control" }, { "include": "#matlab_support_graphics" }, { "include": "#matlab_support_function" }, { "include": "#matlab_support_external" }, { "include": "#matlab_support_toolbox_aerospace" }, { "include": "#matlab_support_toolbox_bioinformatics" }, { "include": "#matlab_support_toolbox_communications" }, { "include": "#matlab_support_toolbox_control_systems" }, { "include": "#matlab_support_toolbox_curve_fitting" }, { "include": "#matlab_support_toolbox_data_acquisition" }, { "include": "#matlab_support_toolbox_database" }, { "include": "#matlab_support_toolbox_datafeed" }, { "include": "#matlab_support_toolbox_design" }, { "include": "#matlab_support_toolbox_excel_link" }, { "include": "#matlab_support_toolbox_filder_design_hdl_coder" }, { "include": "#matlab_support_toolbox_financial_derivatives" }, { "include": "#matlab_support_toolbox_financial" }, { "include": "#matlab_support_toolbox_fixed_income" }, { "include": "#matlab_support_toolbox_fixed_point" }, { "include": "#matlab_support_toolbox_fuzzy_logic" }, { "include": "#matlab_support_toolbox_garch" }, { "include": "#matlab_support_toolbox_genetic_algorithms" }, { "include": "#matlab_support_toolbox_image_acquisition" }, { "include": "#matlab_support_toolbox_image_processing" }, { "include": "#matlab_support_toolbox_instrument_control" }, { "include": "#matlab_support_toolbox_mapping" }, { "include": "#matlab_support_toolbox_model_predictive_control" }, { "include": "#matlab_support_toolbox_model_based_calibration" }, { "include": "#matlab_support_toolbox_neural_network" }, { "include": "#matlab_support_toolbox_opc" }, { "include": "#matlab_support_toolbox_optimization" }, { "include": "#matlab_support_toolbox_rf" }, { "include": "#matlab_support_toolbox_robust_control" }, { "include": "#matlab_support_toolbox_signal_processing" }, { "include": "#matlab_support_toolbox_spline" }, { "include": "#matlab_support_toolbox_statistics" }, { "include": "#matlab_support_toolbox_symbolic_math" }, { "include": "#matlab_support_toolbox_system_identification" }, { "include": "#matlab_support_toolbox_virtual_reality" }, { "include": "#matlab_support_toolbox_wavelet" } ] }, "allofem": { "patterns": [ { "include": "#parens" }, { "include": "#curlybrackets" }, { "include": "#end_in_parens" }, { "include": "#brackets" }, { "include": "#string" }, { "include": "#transpose" }, { "include": "#double_quote" }, { "include": "#all_matlab_keywords" }, { "include": "#all_matlab_comments" }, { "include": "#variable" }, { "include": "#variable_invalid" }, { "include": "#number" }, { "include": "#operators" } ] }, "brackets": { "begin": "\\[", "beginCaptures": { "0": { "name": "meta.brackets.matlab" } }, "contentName": "meta.brackets.matlab", "end": "\\]", "endCaptures": { "0": { "name": "meta.brackets.matlab" } }, "patterns": [ { "include": "#allofem" } ] }, "constants_override": { "comment": "The user is trying to override MATLAB constants and functions.", "match": "(^|\\;)\\s*(i|j|inf|Inf|nan|NaN|eps|end)\\s*=[^=]", "name": "meta.inappropriate.matlab" }, "curlybrackets": { "begin": "\\{", "beginCaptures": { "0": { "name": "meta.brackets.curly.matlab" } }, "contentName": "meta.brackets.curly.matlab", "end": "\\}", "endCaptures": { "0": { "name": "meta.brackets.curly.matlab" } }, "patterns": [ { "include": "#allofem" }, { "include": "#end_in_parens" } ] }, "double_quote": { "patterns": [ { "match": "\"", "name": "invalid.illegal.invalid-quote.matlab" } ] }, "end_in_parens": { "comment": "end as operator symbol", "match": "\\bend\\b", "name": "keyword.operator.symbols.matlab" }, "escaped_quote": { "patterns": [ { "match": "''", "name": "constant.character.escape.matlab" } ] }, "matlab_constant_language": { "comment": "MATLAB constants", "match": "(?|>=|<|<=|&|&&|:|\\||\\|\\||\\+|-|\\*|\\.\\*|/|\\./|\\\\|\\.\\\\|\\^|\\.\\^)\\s*", "name": "keyword.operator.symbols.matlab" }, "parens": { "begin": "\\(", "beginCaptures": { "0": { "name": "meta.parens.matlab" } }, "contentName": "meta.parens.matlab", "end": "\\)", "endCaptures": { "0": { "name": "meta.parens.matlab" } }, "patterns": [ { "include": "#allofem" }, { "include": "#end_in_parens" } ] }, "special_characters": { "comment": "Operator symbols", "match": "((\\%([\\+\\-0]?\\d{0,3}(\\.\\d{1,3})?)(c|d|e|E|f|g|G|s|((b|t)?(o|u|x|X))))|\\%\\%|\\\\(b|f|n|r|t|\\\\))", "name": "constant.character.escape.matlab" }, "string": { "begin": "((?<=(\\[|\\(|\\{|=|\\s|;|:|,))|^)'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.matlab" } }, "end": "'(?=(\\]|\\)|\\}|=|~|<|>|&|\\||-|\\+|\\*|\\.|\\^|\\||\\s|;|:|,))", "endCaptures": { "0": { "name": "punctuation.definition.string.end.matlab" } }, "name": "string.quoted.single.matlab", "patterns": [ { "include": "#escaped_quote" }, { "include": "#unescaped_quote" }, { "include": "#special_characters" } ] }, "transpose": { "match": "((\\w+)|(?<=\\])|(?<=\\)))\\.?'", "name": "keyword.operator.transpose.matlab" }, "unescaped_quote": { "patterns": [ { "match": "'(?=.)", "name": "invalid.illegal.unescaped-quote.matlab" } ] }, "variable": { "comment": "Valid variable. Added meta to disable hilightinh", "match": "\\b[a-zA-Z]\\w*\\b", "name": "meta.variable.other.valid.matlab" }, "variable_assignment": { "comment": "Incomplete variable assignment.", "match": "=\\s*\\.{0,2}\\s*;?\\s*$\\n?", "name": "invalid.illegal.incomplete-variable-assignment.matlab" }, "variable_invalid": { "comment": "No variables or function names can start with a number or an underscore.", "match": "\\b(_\\w|\\d+[_a-df-zA-DF-Z])\\w*\\b", "name": "invalid.illegal.invalid-variable-name.matlab" } }, "scopeName": "source.matlab", "uuid": "48F8858B-72FF-11D9-BFEE-000D93589AF6" }