{ "fileTypes": [ "m" ], "keyEquivalent": "^~O", "name": "Octave", "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.octave" }, "2": { "name": "variable.parameter.output.function.octave" }, "3": { "name": "variable.parameter.output.function.octave" }, "4": { "name": "entity.name.function.octave" } }, "contentName": "variable.parameter.input.function.octave", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.parameters.octave" } }, "name": "meta.function.with-arguments.octave" }, { "captures": { "1": { "name": "storage.type.octave" }, "2": { "name": "variable.parameter.output.function.octave" }, "3": { "name": "variable.parameter.output.function.octave" }, "4": { "name": "entity.name.function.octave" } }, "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.octave" }, { "include": "#constants_override" }, { "include": "#brackets" }, { "include": "#curlybrackets" }, { "include": "#parens" }, { "include": "#string" }, { "include": "#string_double" }, { "include": "#transpose" }, { "include": "#double_quote" }, { "include": "#operators" }, { "include": "#all_octave_keywords" }, { "include": "#all_octave_comments" }, { "include": "#number" }, { "include": "#variable" }, { "include": "#variable_invalid" }, { "include": "#not_equal_invalid" }, { "include": "#variable_assignment" } ], "repository": { "all_octave_comments": { "patterns": [ { "begin": "(^[ \\t]+)?(?=%%)", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.octave" } }, "end": "(?!\\G)", "patterns": [ { "begin": "%%", "beginCaptures": { "0": { "name": "punctuation.definition.comment.octave" } }, "end": "\\n", "name": "comment.line.double-percentage.octave" } ] }, { "begin": "%\\{", "captures": { "1": { "name": "punctuation.definition.comment.octave" } }, "end": "%\\}", "name": "comment.block.percentage.octave" }, { "begin": "(^[ \\t]+)?(?=%)", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.octave" } }, "end": "(?!\\G)", "patterns": [ { "begin": "%", "beginCaptures": { "0": { "name": "punctuation.definition.comment.octave" } }, "end": "\\n", "name": "comment.line.percentage.octave" } ] }, { "begin": "(^[ \\t]+)?(?=#)", "beginCaptures": { "1": { "name": "punctuation.whitespace.comment.leading.octave" } }, "end": "(?!\\G)", "patterns": [ { "begin": "#", "beginCaptures": { "0": { "name": "punctuation.definition.comment.octave" } }, "end": "\\n", "name": "comment.line.number-sign.octave" } ] } ] }, "all_octave_keywords": { "patterns": [ { "include": "#octave_keyword_control" }, { "include": "#octave_constant_language" }, { "include": "#octave_storage_control" }, { "include": "#octave_support_function" }, { "include": "#octave_support_external" } ] }, "allofem": { "patterns": [ { "include": "#parens" }, { "include": "#curlybrackets" }, { "include": "#end_in_parens" }, { "include": "#brackets" }, { "include": "#string" }, { "include": "#string_double" }, { "include": "#transpose" }, { "include": "#all_octave_keywords" }, { "include": "#all_octave_comments" }, { "include": "#variable" }, { "include": "#variable_invalid" }, { "include": "#number" }, { "include": "#operators" } ] }, "brackets": { "begin": "\\[", "beginCaptures": { "0": { "name": "meta.brackets.octave" } }, "contentName": "meta.brackets.octave", "end": "\\]", "endCaptures": { "0": { "name": "meta.brackets.octave" } }, "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.octave" }, "curlybrackets": { "begin": "\\{", "beginCaptures": { "0": { "name": "meta.brackets.curly.octave" } }, "contentName": "meta.brackets.curly.octave", "end": "\\}", "endCaptures": { "0": { "name": "meta.brackets.curly.octave" } }, "patterns": [ { "include": "#allofem" }, { "include": "#end_in_parens" } ] }, "end_in_parens": { "comment": "end as operator symbol", "match": "\\bend\\b", "name": "keyword.operator.symbols.octave" }, "escaped_quote": { "patterns": [ { "match": "''", "name": "constant.character.escape.octave" } ] }, "not_equal_invalid": { "comment": "Not equal is written ~= not !=.", "match": "\\s*!=\\s*", "name": "invalid.illegal.invalid-inequality.octave" }, "number": { "comment": "Valid numbers: 1, .1, 1.1, .1e1, 1.1e1, 1e1, 1i, 1j, 1e2j", "match": "(?<=[\\s\\-\\+\\*\\/\\\\=:\\[\\(\\{,]|^)\\d*\\.?\\d+([eE][+-]?\\d)?([0-9&&[^\\.]])*(i|j)?\\b", "name": "constant.numeric.octave" }, "octave_constant_language": { "comment": "MATLAB constants", "match": "\\b(argv|e|eps|false|F_DUPFD|F_GETFD|F_GETFL|filesep|F_SETFD|F_SETFL|i|I|inf|Inf|j|J|NA|nan|NaN|O_APPEND|O_ASYNC|O_CREAT|OCTAVE_HOME|OCTAVE_VERSION|O_EXCL|O_NONBLOCK|O_RDONLY|O_RDWR|O_SYNC|O_TRUNC|O_WRONLY|pi|program_invocation_name|program_name|P_tmpdir|realmax|realmin|SEEK_CUR|SEEK_END|SEEK_SET|SIG|stderr|stdin|stdout|true|ans|automatic_replot|beep_on_error|completion_append_char|crash_dumps_octave_core|current_script_file_name|debug_on_error|debug_on_interrupt|debug_on_warning|debug_symtab_lookups|DEFAULT_EXEC_PATH|DEFAULT_LOADPATH|default_save_format|echo_executing_commands|EDITOR|EXEC_PATH|FFTW_WISDOM_PROGRAM|fixed_point_format|gnuplot_binary|gnuplot_command_axes|gnuplot_command_end|gnuplot_command_plot|gnuplot_command_replot|gnuplot_command_splot|gnuplot_command_title|gnuplot_command_using|gnuplot_command_with|gnuplot_has_frames|history_file|history_size|ignore_function_time_stamp|IMAGEPATH|INFO_FILE|INFO_PROGRAM|__kluge_procbuf_delay__|LOADPATH|MAKEINFO_PROGRAM|max_recursion_depth|octave_core_file_format|octave_core_file_limit|octave_core_file_name|output_max_field_width|output_precision|page_output_immediately|PAGER|page_screen_output|print_answer_id_name|print_empty_dimensions|print_rhs_assign_val|PS1|PS2|PS4|save_header_format_string|save_precision|saving_history|sighup_dumps_octave_core|sigterm_dumps_octave_core|silent_functions|split_long_rows|string_fill_char|struct_levels_to_print|suppress_verbose_help_message|variables_can_hide_functions|warn_assign_as_truth_value|warn_divide_by_zero|warn_empty_list_elements|warn_fortran_indexing|warn_function_name_clash|warn_future_time_stamp|warn_imag_to_real|warn_matlab_incompatible|warn_missing_semicolon|warn_neg_dim_as_zero|warn_num_to_str|warn_precedence_change|warn_reload_forces_clear|warn_resize_on_range_error|warn_separator_insert|warn_single_quote_string|warn_str_to_num|warn_undefined_return_values|warn_variable_switch_label|whos_line_format)\\b", "name": "constant.language.octave" }, "octave_keyword_control": { "comment": "Control keywords", "match": "(?|>=|<|<=|&|&&|:|\\||\\|\\||\\+|-|\\*|\\.\\*|/|\\./|\\\\|\\.\\\\|\\^|\\.\\^|!)\\s*", "name": "keyword.operator.symbols.octave" }, "parens": { "begin": "\\(", "beginCaptures": { "0": { "name": "meta.parens.octave" } }, "contentName": "meta.parens.octave", "end": "\\)", "endCaptures": { "0": { "name": "meta.parens.octave" } }, "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.octave" }, "string": { "begin": "((?<=(\\[|\\(|\\{|=|\\s|,|;))|^)'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.octave" } }, "end": "'(?=(\\]|\\)|\\}|=|~|<|>|&|\\||-|\\+|\\*|\\.|\\^|\\||\\s|;|,))", "endCaptures": { "0": { "name": "punctuation.definition.string.end.octave" } }, "name": "string.quoted.single.octave", "patterns": [ { "include": "#escaped_quote" }, { "include": "#unescaped_quote" }, { "include": "#special_characters" } ] }, "string_double": { "begin": "((?<=(\\[|\\(|\\{|=|\\s|;|:|,))|^)\"", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.octave" } }, "end": "\"(?=(\\]|\\)|\\}|=|~|<|>|&|\\||-|\\+|\\*|\\.|\\^|\\||\\s|;|:|,))", "endCaptures": { "0": { "name": "punctuation.definition.string.end.octave" } }, "name": "string.quoted.double.octave", "patterns": [ { "include": "#escaped_quote" }, { "include": "#unescaped_quote" }, { "include": "#special_characters" } ] }, "transpose": { "match": "((\\w+)|(?<=\\])|(?<=\\)))\\.?'", "name": "keyword.operator.transpose.octave" }, "unescaped_quote": { "patterns": [ { "match": "'(?=.)", "name": "invalid.illegal.unescaped-quote.octave" } ] }, "variable": { "comment": "Valid variable.", "match": "\\b[a-zA-Z]\\w*\\b", "name": "variable.other.valid.octave" }, "variable_assignment": { "comment": "Incomplete variable assignment.", "match": "=\\s*\\.{0,2}\\s*;?\\s*$\\n?", "name": "invalid.illegal.incomplete-variable-assignment.octave" }, "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.octave" } }, "scopeName": "source.octave", "uuid": "236A240E-F4DA-45BA-905C-4046055E6247" }