mkdocstrings-matlab 0.1.3__py2.py3-none-any.whl → 0.1.5__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,17 @@
1
+ from _griffe.collections import LinesCollection as _LinesCollection, ModulesCollection
2
+ from _griffe.models import Object
3
+
4
+
5
+ class LinesCollection(_LinesCollection):
6
+ pass
7
+
8
+
9
+ class ModelsCollection(ModulesCollection):
10
+ def __init__(self):
11
+ self.members: dict[str, Object] = {}
12
+
13
+ def __setitem__(self, key: str, value: Object):
14
+ self.members[key] = value
15
+
16
+ def __getitem__(self, key: str):
17
+ return self.members[key]
@@ -8,9 +8,11 @@ from griffe import Docstring, Parameters, Parameter, ParameterKind
8
8
  from pprint import pprint
9
9
 
10
10
 
11
+ import charset_normalizer
11
12
  import json
12
13
 
13
14
 
15
+ from mkdocstrings_handlers.matlab.collections import LinesCollection, ModelsCollection
14
16
  from mkdocstrings_handlers.matlab_engine import MatlabEngine, MatlabExecutionError
15
17
  from mkdocstrings_handlers.matlab.models import (
16
18
  Function,
@@ -18,23 +20,9 @@ from mkdocstrings_handlers.matlab.models import (
18
20
  Classfolder,
19
21
  Namespace,
20
22
  Property,
21
- ROOT
23
+ ROOT,
22
24
  )
23
-
24
-
25
- class _ModelsStorage:
26
- def __init__(self):
27
- self._namespace = ""
28
- self._models = {}
29
-
30
- def __getitem__(self, key):
31
- return self._models[key]
32
-
33
- def __setitem__(self, key, value):
34
- self._models[key] = value
35
-
36
- def __contains__(self, key):
37
- return key in self._models
25
+ from mkdocstrings_handlers.matlab.parser import MatlabParser
38
26
 
39
27
 
40
28
  class MatlabHandler(BaseHandler):
@@ -72,8 +60,8 @@ class MatlabHandler(BaseHandler):
72
60
  # "find_stubs_package": False,
73
61
  # "allow_inspection": True,
74
62
  "show_bases": True,
75
- "show_inheritance_diagram": False, # not implemented
76
- "show_source": False, # not implemented
63
+ "show_inheritance_diagram": False, # Insider feature
64
+ "show_source": True,
77
65
  # "preload_modules": None,
78
66
  # Heading options
79
67
  "heading_level": 2,
@@ -138,11 +126,16 @@ class MatlabHandler(BaseHandler):
138
126
 
139
127
  if paths is None:
140
128
  paths = ""
129
+ else:
130
+ config_path = Path(config_file_path).parent
131
+ full_paths = [str((config_path / path).resolve()) for path in paths]
141
132
 
142
133
  self.engine = MatlabEngine()
143
134
  self.engine.addpath(str(Path(__file__).parent / "matlab"))
144
- self.engine.matlab_startup(paths, startup_expression)
145
- self.models = _ModelsStorage()
135
+ self.engine.matlab_startup(full_paths, startup_expression)
136
+ self.models = ModelsCollection()
137
+ self.lines = LinesCollection()
138
+ self.parser = MatlabParser()
146
139
  self._locale = locale
147
140
 
148
141
  def get_templates_dir(self, handler: str | None = None) -> Path:
@@ -173,6 +166,11 @@ class MatlabHandler(BaseHandler):
173
166
  raise CollectionError(error.args[0].strip()) from error
174
167
  ast_dict = json.loads(ast_json)
175
168
 
169
+ filepath = Path(ast_dict["path"])
170
+ if filepath not in self.lines:
171
+ lines = str(charset_normalizer.from_path(filepath).best()).splitlines()
172
+ self.lines[filepath] = lines
173
+
176
174
  match ast_dict["type"]:
177
175
  case "function" | "method":
178
176
  return self.collect_function(ast_dict, final_config)
@@ -255,16 +253,38 @@ class MatlabHandler(BaseHandler):
255
253
  if ast_dict["docstring"]
256
254
  else None
257
255
  )
256
+
257
+ filepath = Path(ast_dict["path"])
258
+
259
+ if config["show_source"]:
260
+ tmObject = self.parser.parse_file(filepath)
261
+ tmClass = next(
262
+ child
263
+ for child in tmObject.children
264
+ if child.token == "meta.class.matlab"
265
+ )
266
+ else:
267
+ tmClass = None
268
+
269
+ bases = ast_dict["superclasses"] if isinstance(ast_dict["superclasses"], list) else [ast_dict["superclasses"]]
270
+ bases = [base for base in bases if base != "handle"]
271
+
258
272
  model = Class(
259
273
  ast_dict["name"],
260
274
  docstring=docstring,
261
- parent=self.get_parent(Path(ast_dict["path"]).parent),
275
+ parent=self.get_parent(filepath.parent),
262
276
  hidden=ast_dict["hidden"],
263
277
  sealed=ast_dict["sealed"],
264
278
  abstract=ast_dict["abstract"],
265
279
  enumeration=ast_dict["enumeration"],
266
280
  handle=ast_dict["handle"],
267
- filepath=Path(ast_dict["path"]),
281
+ bases=bases,
282
+ filepath=filepath,
283
+ modules_collection=self.models,
284
+ lines_collection=self.lines,
285
+ lineno=1,
286
+ endlineno=len(self.lines[filepath]),
287
+ textmate=tmClass,
268
288
  )
269
289
 
270
290
  for property_dict in ast_dict["properties"]:
@@ -296,12 +316,14 @@ class MatlabHandler(BaseHandler):
296
316
  continue
297
317
 
298
318
  method = self.collect(f"{defining_class}.{name}", config)
319
+ (method.lineno, method.endlineno) = model.get_lineno_method(name)
299
320
  method.parent = model
300
321
  method._access = method_dict["access"]
301
322
  method._static = method_dict["static"]
302
323
  method._abstract = method_dict["abstract"]
303
324
  method._sealed = method_dict["sealed"]
304
325
  method._hidden = method_dict["hidden"]
326
+
305
327
  model.members[name] = method
306
328
  self.models[method.canonical_path] = method
307
329
 
@@ -340,6 +362,7 @@ class MatlabHandler(BaseHandler):
340
362
  )
341
363
  )
342
364
 
365
+ filepath = Path(ast_dict["path"])
343
366
  model = Function(
344
367
  ast_dict["name"],
345
368
  parameters=Parameters(*parameters),
@@ -350,8 +373,12 @@ class MatlabHandler(BaseHandler):
350
373
  )
351
374
  if ast_dict["docstring"]
352
375
  else None,
353
- parent=self.get_parent(Path(ast_dict["path"]).parent),
354
- filepath=Path(ast_dict["path"]),
376
+ parent=self.get_parent(filepath.parent),
377
+ filepath=filepath,
378
+ modules_collection=self.models,
379
+ lines_collection=self.lines,
380
+ lineno=1,
381
+ endlineno=len(self.lines[filepath]),
355
382
  )
356
383
 
357
384
  self.models[model.canonical_path] = model
@@ -11,7 +11,7 @@ function data = argument(object)
11
11
  data(iArg) = docstring.metadata.argument(object(iArg));
12
12
  end
13
13
  return
14
- end
14
+ end
15
15
 
16
16
  data.name = object.Name;
17
17
  data.kind = string(object.Kind);
@@ -7,7 +7,6 @@ end
7
7
 
8
8
  lines = cellstr(splitlines(doc));
9
9
 
10
-
11
10
  for iLine = numel(lines):-1:1
12
11
  line = lines{iLine};
13
12
  if ~isempty(line) && ~all(line == ' ')
@@ -18,6 +18,10 @@ arguments
18
18
  cwd (1,1) string {mustBeFolder} = pwd()
19
19
  end
20
20
 
21
+ if isempty(identifier)
22
+ docstring.exception("<empty>");
23
+ end
24
+
21
25
  cd(cwd);
22
26
 
23
27
  % Check if namespace
@@ -1,8 +1,8 @@
1
1
  from enum import Enum
2
2
  from typing import Any
3
3
  from griffe import Function as GriffeFunction, Class as GriffeClass, Module, Attribute
4
- from _griffe.exceptions import BuiltinModuleError
5
4
  from pathlib import Path
5
+ from textmate_grammar.elements import ContentElement
6
6
 
7
7
 
8
8
  class Access(Enum):
@@ -43,6 +43,7 @@ class Class(CanonicalPathMixin, PathMixin, GriffeClass):
43
43
  abstract: bool = False,
44
44
  enumeration: bool = False,
45
45
  handle: bool = False,
46
+ textmate: ContentElement | None = None,
46
47
  **kwargs: Any,
47
48
  ) -> None:
48
49
  super().__init__(*args, **kwargs)
@@ -51,6 +52,31 @@ class Class(CanonicalPathMixin, PathMixin, GriffeClass):
51
52
  self._abstract: bool = abstract
52
53
  self._enumeration: bool = enumeration
53
54
  self._handle: bool = handle
55
+ self._textmate: ContentElement | None = textmate
56
+
57
+ self._method_lineno: dict[str, tuple[int, int]] = {}
58
+ if textmate is None:
59
+ return
60
+ for block in [
61
+ block
62
+ for block in self._textmate.children
63
+ if block.token == "meta.methods.matlab"
64
+ ]:
65
+ for method in block.children:
66
+ declaration = next(
67
+ item
68
+ for item in method.children
69
+ if item.token == "meta.function.declaration.matlab"
70
+ )
71
+ name = next(
72
+ item
73
+ for item in declaration.children
74
+ if item.token == "entity.name.function.matlab"
75
+ ).content
76
+ charaters_ids = method.characters.keys()
77
+ lineno = min(charaters_ids, key=lambda p: p[0])[0]
78
+ endlino = max(charaters_ids, key=lambda p: p[0])[0] + 1
79
+ self._method_lineno[name] = (lineno, endlino)
54
80
 
55
81
  @property
56
82
  def is_private(self) -> bool:
@@ -63,6 +89,9 @@ class Class(CanonicalPathMixin, PathMixin, GriffeClass):
63
89
  else:
64
90
  return super().canonical_path
65
91
 
92
+ def get_lineno_method(self, method_name: str) -> tuple[int, int]:
93
+ return self._method_lineno.get(method_name, (self.lineno, self.endlineno))
94
+
66
95
 
67
96
  class Property(CanonicalPathMixin, Attribute):
68
97
  def __init__(
@@ -137,7 +166,7 @@ class _Root(Namespace):
137
166
 
138
167
  def __repr__(self) -> str:
139
168
  return "MATLABROOT"
140
-
169
+
141
170
 
142
171
  ROOT = _Root()
143
172
 
@@ -145,7 +174,3 @@ ROOT = _Root()
145
174
  class Classfolder(Class):
146
175
  def __repr__(self) -> str:
147
176
  return f"Classfolder({self.path!r})"
148
-
149
-
150
-
151
-
@@ -0,0 +1,31 @@
1
+ from textmate_grammar.parsers.base import LanguageParser
2
+ from pathlib import Path
3
+
4
+
5
+ import logging
6
+ import yaml
7
+
8
+
9
+ logging.getLogger("textmate_grammar").setLevel(logging.ERROR)
10
+
11
+
12
+ class MatlabParser(LanguageParser):
13
+ """
14
+ Represents a grammar for the MATLAB language.
15
+ """
16
+
17
+ def __init__(self, **kwargs):
18
+ """
19
+ Initializes a new instance of the MatlabGrammar class.
20
+
21
+ Args:
22
+ remove_line_continuations (bool, optional): Whether to remove line continuations. Defaults to False.
23
+ """
24
+
25
+ with open(Path(__file__).parent / "resources" / "grammar.yml") as file:
26
+ try:
27
+ grammar = yaml.load(file.read(), Loader=yaml.CLoader)
28
+ except ImportError:
29
+ grammar = yaml.load(file.read(), Loader=yaml.Loader)
30
+
31
+ super().__init__(grammar, **kwargs)
@@ -0,0 +1,566 @@
1
+ fileTypes:
2
+ - m
3
+ keyEquivalent: ^~M
4
+ name: MATLAB minimal
5
+ patterns:
6
+ - comment: 'Rules are split into groups so #command_dual can be excluded in things
7
+ like (), {}, []'
8
+ include: '#rules_before_command_dual'
9
+ - include: '#command_dual'
10
+ - include: '#rules_after_command_dual'
11
+ repository:
12
+ blocks:
13
+ patterns:
14
+ - begin: \s*(?<=^|[\s,;])(for)\b
15
+ beginCaptures:
16
+ '1':
17
+ name: keyword.control.for.matlab
18
+ end: \s*(?<=^|[\s,;])(end)\b
19
+ endCaptures:
20
+ '1':
21
+ name: keyword.control.end.for.matlab
22
+ name: meta.for.matlab
23
+ patterns:
24
+ - begin: \G(?!$)
25
+ end: (?<!\.{3})(?:(?=([,;])(?![^(]*\)))|$)
26
+ name: meta.for.declaration.matlab
27
+ patterns:
28
+ - include: $self
29
+ - include: $self
30
+ - begin: \s*(?<=^|[\s,;])(if)\b
31
+ beginCaptures:
32
+ '1':
33
+ name: keyword.control.if.matlab
34
+ end: \s*(?<=^|[\s,;])(end)\b
35
+ endCaptures:
36
+ '1':
37
+ name: keyword.control.end.if.matlab
38
+ '2':
39
+ patterns:
40
+ - include: $self
41
+ name: meta.if.matlab
42
+ patterns:
43
+ - begin: \G(?!$)
44
+ end: (?<!\.{3})(?:(?=([,;])(?![^(]*\)))|$)
45
+ name: meta.if.declaration.matlab
46
+ patterns:
47
+ - include: $self
48
+ - captures:
49
+ '1':
50
+ name: keyword.control.elseif.matlab
51
+ match: (?:\s*)(?<=^|[\s,;])(elseif)\b
52
+ name: meta.elseif.matlab
53
+ patterns:
54
+ - begin: \G(?!$)
55
+ end: (?<!\.{3})(?:(?=([,;])(?![^(]*\)))|$)
56
+ name: meta.elseif.declaration.matlab
57
+ patterns:
58
+ - include: $self
59
+ - captures:
60
+ '1':
61
+ name: keyword.control.else.matlab
62
+ end: ^
63
+ match: (?:\s*)(?<=^|[\s,;])(else)\b
64
+ name: meta.else.matlab
65
+ - include: $self
66
+ - begin: \s*(?<=^|[\s,;])(parfor)\b
67
+ beginCaptures:
68
+ '1':
69
+ name: keyword.control.for.matlab
70
+ end: \s*(?<=^|[\s,;])(end)\b
71
+ endCaptures:
72
+ '1':
73
+ name: keyword.control.end.for.matlab
74
+ name: meta.for.parallel.matlab
75
+ patterns:
76
+ - begin: \G(?!$)
77
+ end: (?<!\.{3})(?:(?=([,;])(?![^(]*\)))|$)
78
+ name: meta.for.parallel.declaration.matlab
79
+ patterns:
80
+ - include: $self
81
+ - include: $self
82
+ - begin: \s*(?<=^|[\s,;])(spmd)\b
83
+ beginCaptures:
84
+ '1':
85
+ name: keyword.control.repeat.parallel.matlab
86
+ end: \s*(?<=^|[\s,;])(end)\b
87
+ endCaptures:
88
+ '1':
89
+ name: keyword.control.end.repeat.parallel.matlab
90
+ name: meta.repeat.parallel.matlab
91
+ patterns:
92
+ - begin: \G(?!$)
93
+ end: (?<!\.{3})(?:(?=([,;])(?![^(]*\)))|$)
94
+ name: meta.repeat.parallel.declaration.matlab
95
+ patterns:
96
+ - include: $self
97
+ - include: $self
98
+ - begin: \s*(?<=^|[\s,;])(switch)\s+([a-zA-Z0-9][a-zA-Z0-9_]*)
99
+ beginCaptures:
100
+ '1':
101
+ name: keyword.control.switch.matlab
102
+ '2':
103
+ name: variable.other.constant.matlab
104
+ end: \s*(?<=^|[\s,;])(end)\b
105
+ endCaptures:
106
+ '1':
107
+ name: keyword.control.end.switch.matlab
108
+ name: meta.switch.matlab
109
+ patterns:
110
+ - captures:
111
+ '2':
112
+ name: keyword.control.switch.case.matlab
113
+ '3':
114
+ begin: \G(?!$)
115
+ end: (?<!\.{3})(?:(?=([,;])(?![^(]*\)))|$)
116
+ name: meta.case.declaration.matlab
117
+ patterns:
118
+ - include: $self
119
+ match: (\s*)(?<=^|[\s,;])(case)\b(.*?)(?<!\.{3})(?:(?=([,;])(?![^(]*\)))|$)
120
+ name: meta.case.matlab
121
+ - captures:
122
+ '2':
123
+ name: keyword.control.switch.otherwise.matlab
124
+ '3':
125
+ patterns:
126
+ - include: $self
127
+ match: (\s*)(?<=^|[\s,;])(otherwise)\b
128
+ name: meta.otherwise.matlab
129
+ - include: $self
130
+ - begin: \s*(?<=^|[\s,;])(try)\b
131
+ beginCaptures:
132
+ '1':
133
+ name: keyword.control.try.matlab
134
+ end: \s*(?<=^|[\s,;])(end)\b
135
+ endCaptures:
136
+ '1':
137
+ name: keyword.control.end.try.matlab
138
+ name: meta.try.matlab
139
+ patterns:
140
+ - captures:
141
+ '2':
142
+ name: keyword.control.catch.matlab
143
+ '3':
144
+ name: variable.other.constant.matlab
145
+ match: (\s*)(?<=^|[\s,;])(catch)\b\s*(\w+)?
146
+ name: meta.catch.matlab
147
+ - include: $self
148
+ - begin: \s*(?<=^|[\s,;])(while)\b
149
+ beginCaptures:
150
+ '1':
151
+ name: keyword.control.while.matlab
152
+ end: \s*(?<=^|[\s,;])(end)\b
153
+ endCaptures:
154
+ '1':
155
+ name: keyword.control.end.while.matlab
156
+ name: meta.while.matlab
157
+ patterns:
158
+ - begin: \G
159
+ end: (?<!\.{3})(?:(?=([,;])(?![^(]*\)))|$)
160
+ endCaptures:
161
+ '1':
162
+ include: $self
163
+ name: meta.while.declaration.matlab
164
+ - include: $self
165
+ classdef:
166
+ comment: Class definition
167
+ patterns:
168
+ - begin: "(?x)\n\t\t\t\t\t\t\t^\\s* \t\t\t\t\t\t\t# Leading whitespace\n\t\t\
169
+ \t\t\t\t\t(classdef)\n\t\t\t\t\t\t\t\\s*\n\t\t\t\t\t"
170
+ beginCaptures:
171
+ '1':
172
+ name: storage.type.class.matlab
173
+ end: \s*(?<=^|[\s,;])(end)\b
174
+ endCaptures:
175
+ '1':
176
+ name: storage.type.class.end.matlab
177
+ name: meta.class.matlab
178
+ patterns:
179
+ - begin: \G
180
+ end: (?<!\.{3})(?=\n)
181
+ name: meta.class.declaration.matlab
182
+ patterns:
183
+ - begin: \G(\([^)]*\))?\s*
184
+ beginCaptures:
185
+ '1':
186
+ comment: Optional attributes
187
+ patterns:
188
+ - match: (?<=\s)\(
189
+ name: punctuation.section.parens.begin.matlab
190
+ - match: \)\z
191
+ name: punctuation.section.parens.end.matlab
192
+ - match: ','
193
+ name: punctuation.separator.modifier.comma.matlab
194
+ - match: '[a-zA-Z][a-zA-Z0-9_]*'
195
+ name: storage.modifier.class.matlab
196
+ - begin: (=)\s*
197
+ beginCaptures:
198
+ '1':
199
+ name: keyword.operator.assignment.matlab
200
+ end: (?=\)|,)
201
+ patterns:
202
+ - match: true|false
203
+ name: constant.language.boolean.matlab
204
+ - include: '#string'
205
+ - include: '#comments'
206
+ - include: '#line_continuation'
207
+ end: (?<!\.{3})(?=\s*%|\n)
208
+ patterns:
209
+ - begin: \G\s*([a-zA-Z][a-zA-Z0-9_]*)
210
+ beginCaptures:
211
+ '1':
212
+ comment: Class name
213
+ name: entity.name.type.class.matlab
214
+ end: (?<!\.{3})(?=\n)
215
+ patterns:
216
+ - comment: Optional inheritance operator
217
+ match: <
218
+ name: punctuation.separator.lt.inheritance.matlab
219
+ - begin: (?<!\.)\b(?=[a-zA-Z])
220
+ comment: Inherited class
221
+ end: (?<=[a-zA-Z0-9_])(?!\.)
222
+ name: meta.inherited-class.matlab
223
+ patterns:
224
+ - match: (?<=[\s.<])[a-zA-Z][a-zA-Z0-9_]*(?=\s|$)
225
+ name: entity.other.inherited-class.matlab
226
+ - match: '[a-zA-Z][a-zA-Z0-9_]*'
227
+ name: entity.name.namespace.matlab
228
+ - match: \.
229
+ name: punctuation.accessor.dot.matlab
230
+ - comment: Multiple superclass operator
231
+ match: '&'
232
+ name: keyword.operator.type.matlab
233
+ - include: '#comments'
234
+ - include: '#line_continuation'
235
+ - include: '#comments'
236
+ - include: '#line_continuation'
237
+ - begin: "(?x)\n\t\t\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t# Leading whitespace\n\
238
+ \t\t\t\t\t\t\t\t\t(properties)\\b([^%]*)\n\t\t\t\t\t\t\t\t\t\\s*\n\t\t\t\
239
+ \t\t\t\t\t\t(\t\t\t\t\t\t\t\t\t# Optional attributes\n\t\t\t\t\t\t\t\t\t\
240
+ \t\\( [^)]* \\)\n\t\t\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t\t\t\\s*($|(?=%))\n\
241
+ \t\t\t\t\t\t\t"
242
+ beginCaptures:
243
+ '2':
244
+ name: keyword.control.properties.matlab
245
+ '3':
246
+ patterns:
247
+ - match: '[a-zA-Z][a-zA-Z0-9_]*'
248
+ name: storage.modifier.properties.matlab
249
+ - begin: (=)\s*
250
+ beginCaptures:
251
+ '1':
252
+ name: keyword.operator.assignment.matlab
253
+ end: ',|(?=\))'
254
+ patterns:
255
+ - match: true|false
256
+ name: constant.language.boolean.matlab
257
+ - match: public|protected|private
258
+ name: storage.modifier.access.matlab
259
+ end: \s*(?<=^|[\s,;])(end)\b
260
+ endCaptures:
261
+ '1':
262
+ name: keyword.control.end.properties.matlab
263
+ name: meta.properties.matlab
264
+ patterns:
265
+ - include: $self
266
+ - begin: "(?x)\n\t\t\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t# Leading whitespace\n\
267
+ \t\t\t\t\t\t\t\t\t(methods)\\b([^%]*)\n\t\t\t\t\t\t\t\t\t\\s*\n\t\t\t\t\t\
268
+ \t\t\t\t(\t\t\t\t\t\t\t\t\t# Optional attributes\n\t\t\t\t\t\t\t\t\t\t\\\
269
+ ( [^)]* \\)\n\t\t\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t\t\t\\s*($|(?=%))\n\t\t\
270
+ \t\t\t\t\t"
271
+ beginCaptures:
272
+ '2':
273
+ name: keyword.control.methods.matlab
274
+ '3':
275
+ patterns:
276
+ - match: '[a-zA-Z][a-zA-Z0-9_]*'
277
+ name: storage.modifier.methods.matlab
278
+ - begin: =\s*
279
+ end: ',|(?=\))'
280
+ patterns:
281
+ - match: true|false
282
+ name: constant.language.boolean.matlab
283
+ - match: public|protected|private
284
+ name: storage.modifier.access.matlab
285
+ end: \s*(?<=^|[\s,;])(end)\b
286
+ endCaptures:
287
+ '1':
288
+ name: keyword.control.end.methods.matlab
289
+ name: meta.methods.matlab
290
+ patterns:
291
+ - include: $self
292
+ - begin: "(?x)\n\t\t\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t# Leading whitespace\n\
293
+ \t\t\t\t\t\t\t\t\t(events)\\b([^%]*)\n\t\t\t\t\t\t\t\t\t\\s*\n\t\t\t\t\t\
294
+ \t\t\t\t(\t\t\t\t\t\t\t\t\t# Optional attributes\n\t\t\t\t\t\t\t\t\t\t\\\
295
+ ( [^)]* \\)\n\t\t\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t\t\t\\s*($|(?=%))\n\t\t\
296
+ \t\t\t\t\t"
297
+ beginCaptures:
298
+ '2':
299
+ name: keyword.control.events.matlab
300
+ '3':
301
+ patterns:
302
+ - match: '[a-zA-Z][a-zA-Z0-9_]*'
303
+ name: variable.parameter.events.matlab
304
+ - begin: =\s*
305
+ end: ',|(?=\))'
306
+ patterns:
307
+ - match: true|false
308
+ name: constant.language.boolean.matlab
309
+ - match: public|protected|private
310
+ name: storage.modifier.access.matlab
311
+ end: \s*(?<=^|[\s,;])(end)\b
312
+ endCaptures:
313
+ '1':
314
+ name: keyword.control.end.events.matlab
315
+ name: meta.events.matlab
316
+ patterns:
317
+ - captures:
318
+ '1':
319
+ name: entity.name.type.event.matlab
320
+ match: (?:^\s*|,\s*)([a-zA-Z0-9_]+)
321
+ name: meta.assignment.definition.event.matlab
322
+ - include: $self
323
+ - begin: "(?x)\n\t\t\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t# Leading whitespace\n\
324
+ \t\t\t\t\t\t\t\t\t(enumeration)\\b([^%]*)\n\t\t\t\t\t\t\t\t\t\\s*($|(?=%))\n\
325
+ \t\t\t\t\t\t\t"
326
+ beginCaptures:
327
+ '2':
328
+ name: keyword.control.enum.matlab
329
+ end: \s*(?<=^|[\s,;])(end)\b
330
+ endCaptures:
331
+ '1':
332
+ name: keyword.control.end.enum.matlab
333
+ name: meta.enum.matlab
334
+ patterns:
335
+ - captures:
336
+ '1':
337
+ name: variable.other.enummember.matlab
338
+ match: (?:^\s*|,\s*)([a-zA-Z0-9_]+)
339
+ name: meta.assignment.definition.enummember.matlab
340
+ - match: ','
341
+ name: punctuation.separator.comma.matlab
342
+ - include: '#comments'
343
+ - include: '#comments'
344
+ command_dual:
345
+ captures:
346
+ '2':
347
+ name: entity.name.function.command.matlab
348
+ patterns:
349
+ - comment: Embed MATLAB into command syntax to allow keyword grammar injection.
350
+ include: $self
351
+ '4':
352
+ name: string.unquoted.matlab
353
+ patterns:
354
+ - include: '#string_quoted_single'
355
+ comment: "\t\t\t\t\t 1 \t\t\t\t 2\t\t3 \t\t\t\t 4\t\t\t\t\t\t\t\t\t\t\t\t\
356
+ \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t "
357
+ match: (?<=^|[^.]\n|;|,|=)([^\S\n]*)(?# A> )(\b\w+\b)([^\S\n]+)(?# B> )((?!(\+|-|\*|\.\*|\/|\.\/|\\|\.\\|\^|\.\^|==|~=|&|&&|\||\|\||=|:|>|>=|<|<=|\.{3})[^\S\n]?)[^\s({=;%][^\n;%]*)
358
+ name: meta.function-call.command.matlab
359
+ comment_block:
360
+ begin: (^[\s]*)(%\{)[^\S\n]*+\n
361
+ beginCaptures:
362
+ '1':
363
+ name: punctuation.whitespace.comment.leading.matlab
364
+ '2':
365
+ name: punctuation.definition.comment.begin.matlab
366
+ end: (^[\s]*)(%\})[^\S\n]*+(?:\n|$)
367
+ endCaptures:
368
+ '1':
369
+ name: punctuation.whitespace.comment.leading.matlab
370
+ '2':
371
+ name: punctuation.definition.comment.end.matlab
372
+ name: comment.block.percentage.matlab
373
+ patterns:
374
+ - include: '#comment_block'
375
+ - match: ^[^\n]*\n
376
+ comments:
377
+ patterns:
378
+ - begin: (^[ \t]+)?(?=%%\s)
379
+ beginCaptures:
380
+ '1':
381
+ name: punctuation.whitespace.comment.leading.matlab
382
+ comment: Section comment
383
+ end: \Z
384
+ patterns:
385
+ - begin: '%%'
386
+ beginCaptures:
387
+ '0':
388
+ name: punctuation.definition.comment.matlab
389
+ end: \n
390
+ name: comment.line.double-percentage.matlab
391
+ patterns:
392
+ - begin: \G[^\S\n]*(?![\n\s])
393
+ beginCaptures:
394
+ '0':
395
+ name: punctuation.whitespace.comment.leading.matlab
396
+ contentName: entity.name.section.matlab
397
+ end: (?=\n)
398
+ - include: '#comment_block'
399
+ - begin: (^[ \t]+)?(?=%)
400
+ beginCaptures:
401
+ '1':
402
+ name: punctuation.whitespace.comment.leading.matlab
403
+ comment: Inline comment
404
+ end: \Z
405
+ patterns:
406
+ - begin: '%'
407
+ beginCaptures:
408
+ '0':
409
+ name: punctuation.definition.comment.matlab
410
+ end: \Z
411
+ name: comment.line.percentage.matlab
412
+ function:
413
+ patterns:
414
+ - begin: "(?x)\n\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t\t\t\t# Leading whitespace\n\
415
+ \t\t\t\t\t\t\t(function)\n\t\t\t\t\t\t\t\\s+\n\t\t\t\t\t"
416
+ beginCaptures:
417
+ '2':
418
+ name: storage.type.function.matlab
419
+ comment: Function definition
420
+ end: \s*(?<=^|[\s,;])(end)\b(\s*\n)?
421
+ endCaptures:
422
+ '1':
423
+ name: storage.type.function.end.matlab
424
+ name: meta.function.matlab
425
+ patterns:
426
+ - begin: \G
427
+ end: (?<=\))|(?>(?<!\.{3}.*)\n)
428
+ name: meta.function.declaration.matlab
429
+ patterns:
430
+ - begin: \G(?=[^\(]*?(?:=|\[|\.{3}))
431
+ comment: Function output
432
+ contentName: meta.assignment.variable.output.matlab
433
+ end: \s*(=)\s*
434
+ endCaptures:
435
+ '1':
436
+ name: keyword.operator.assignment.matlab
437
+ patterns:
438
+ - match: \G\[
439
+ name: punctuation.section.assignment.group.begin.matlab
440
+ - captures:
441
+ '1':
442
+ name: punctuation.section.assignment.group.end.matlab
443
+ match: (\])\s*
444
+ - match: '[a-zA-Z][a-zA-Z0-9_]*'
445
+ name: variable.parameter.output.matlab
446
+ - match: ','
447
+ name: punctuation.separator.parameter.comma.matlab
448
+ - include: '#line_continuation'
449
+ - include: '#comments'
450
+ - comment: Function name
451
+ match: '[a-zA-Z][a-zA-Z0-9_]*(?>\.[a-zA-Z0-9_]+)*'
452
+ name: entity.name.function.matlab
453
+ patterns:
454
+ - match: \.
455
+ name: punctuation.accessor.dot.matlab
456
+ - include: '#line_continuation'
457
+ - begin: \s*\(
458
+ beginCaptures:
459
+ '0':
460
+ name: punctuation.definition.parameters.begin.matlab
461
+ comment: Function arguments
462
+ end: \)
463
+ endCaptures:
464
+ '0':
465
+ name: punctuation.definition.parameters.end.matlab
466
+ name: meta.parameters.matlab
467
+ patterns:
468
+ - match: '[a-zA-Z][a-zA-Z0-9_]*'
469
+ name: variable.parameter.input.matlab
470
+ - match: '~'
471
+ name: variable.language.anonymous.matlab
472
+ - match: ','
473
+ name: punctuation.separator.parameter.comma.matlab
474
+ - include: '#comments'
475
+ - include: '#line_continuation'
476
+ - include: '#line_continuation'
477
+ - include: '#comments'
478
+ - begin: "(?x)\n\t\t\t\t\t\t\t\t\t(^\\s*)\t\t\t\t\t\t\t\t# Leading whitespace\n\
479
+ \t\t\t\t\t\t\t\t\t(arguments)\\b([^%]*)\n\t\t\t\t\t\t\t\t\t\\s*\n\t\t\t\t\
480
+ \t\t\t\t\t(\t\t\t\t\t\t\t\t\t# Optional attributes\n\t\t\t\t\t\t\t\t\t\t\
481
+ \\( [^)]* \\)\n\t\t\t\t\t\t\t\t\t)?\n\t\t\t\t\t\t\t\t\t\\s*($|(?=%))\n\t\
482
+ \t\t\t\t\t\t\t"
483
+ end: \s*(?<=^|[\s,;])(end)\b
484
+ endCaptures:
485
+ '1':
486
+ name: keyword.control.end.arguments.matlab
487
+ name: meta.arguments.matlab
488
+ patterns:
489
+ - comment: Class property name-value arguments
490
+ match: (?<=\w)\.\?(?=\w)
491
+ name: keyword.operator.other.matlab
492
+ - include: $self
493
+ - include: $self
494
+ line_continuation:
495
+ captures:
496
+ '1':
497
+ name: punctuation.separator.continuation.line.matlab
498
+ '2':
499
+ name: comment.continuation.line.matlab
500
+ comment: Line continuations
501
+ match: (\.{3})(.*)$
502
+ name: meta.continuation.line.matlab
503
+ rules_after_command_dual:
504
+ patterns:
505
+ - include: '#string'
506
+ - include: '#line_continuation'
507
+ - include: '#comments'
508
+ rules_before_command_dual:
509
+ patterns:
510
+ - include: '#classdef'
511
+ - include: '#function'
512
+ - include: '#blocks'
513
+ shell_string:
514
+ captures:
515
+ '1':
516
+ name: meta.interpolation.shell.matlab
517
+ '2':
518
+ name: punctuation.section.interpolation.begin.matlab
519
+ '3':
520
+ name: source.shell.embedded.matlab
521
+ patterns:
522
+ - include: source.shell
523
+ comment: Shell command
524
+ match: ^\s*((!)(.*)$\n?)
525
+ string:
526
+ patterns:
527
+ - include: '#shell_string'
528
+ - include: '#string_quoted_single'
529
+ - include: '#string_quoted_double'
530
+ string_quoted_double:
531
+ begin: ((?<=(\[|\(|\{|=|\s|;|:|,|~|<|>|&|\||-|\+|\*|\/|\\|\.|\^))|^)"
532
+ beginCaptures:
533
+ '0':
534
+ name: punctuation.definition.string.begin.matlab
535
+ comment: String literal (double-quoted)
536
+ end: '"(?=(\[|\(|\{|\]|\)|\}|=|~|<|>|&|\||-|\+|\*|\/|\\|\.|\^|\||\s|;|:|,)|$)'
537
+ endCaptures:
538
+ '0':
539
+ name: punctuation.definition.string.end.matlab
540
+ name: string.quoted.double.matlab
541
+ patterns:
542
+ - match: '""'
543
+ name: constant.character.escape.matlab
544
+ - match: '"(?=.)'
545
+ name: invalid.illegal.unescaped-quote.matlab
546
+ string_quoted_single:
547
+ begin: ((?<=(\[|\(|\{|=|\s|;|:|,|~|<|>|&|\||-|\+|\*|/|\\|\.|\^))|^)'
548
+ beginCaptures:
549
+ '0':
550
+ name: punctuation.definition.string.begin.matlab
551
+ comment: Character vector literal (single-quoted)
552
+ end: '''(?=(\[|\(|\{|\]|\)|\}|=|~|<|>|&|\||-|\+|\*|/|\\|\.|\^|\s|;|:|,)|$)'
553
+ endCaptures:
554
+ '0':
555
+ name: punctuation.definition.string.end.matlab
556
+ name: string.quoted.single.matlab
557
+ patterns:
558
+ - match: ''''''
559
+ name: constant.character.escape.matlab
560
+ - match: '''(?=.)'
561
+ name: invalid.illegal.unescaped-quote.matlab
562
+ - comment: Operator symbols
563
+ match: ((\%([\+\-0]?\d{0,3}(\.\d{1,3})?)(c|d|e|E|f|g|i|G|s|((b|t)?(o|u|x|X))))|\%\%|\\(b|f|n|r|t|\\))
564
+ name: constant.character.escape.matlab
565
+ scopeName: source.matlab.minimal
566
+ uuid: e1aee587-e622-4ace-9c88-d4b94de0b168
@@ -1,15 +1,17 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: mkdocstrings-matlab
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary: Add your description here
5
- Author-email: Mark Hu <mark.hu@asml.com>
5
+ Author-email: Mark Hu <watermarkhu@gmail.com>
6
6
  License-File: LICENSE
7
+ Requires-Dist: charset-normalizer>=3.3.2
7
8
  Requires-Dist: griffe>=1.2.0
8
9
  Requires-Dist: markdown>=3.7
9
10
  Requires-Dist: mkdocs-material>=9.5.33
10
11
  Requires-Dist: mkdocs>=1.6.0
11
12
  Requires-Dist: mkdocstrings>=0.25.2
12
13
  Requires-Dist: mkdocstrings[python]>=0.18
14
+ Requires-Dist: textmate-grammar-python>=0.6.1
13
15
  Description-Content-Type: text/markdown
14
16
 
15
17
  # mkdocstrings-matlab
@@ -1,25 +1,28 @@
1
1
  mkdocstrings_handlers/matlab/__init__.py,sha256=laA2bEP5rxdIWBLmfLiKKu7ChZ_HzCe-VeRvxmUTqww,128
2
- mkdocstrings_handlers/matlab/handler.py,sha256=078JkZgLNGIbTmGGhzQfKWjPLdw79Jf1d9Vj_hG6rgY,15721
3
- mkdocstrings_handlers/matlab/models.py,sha256=9oK-ZmpQuU2cU2wX8wlaK540BB9LazzaCtTmnnnIDyo,4428
2
+ mkdocstrings_handlers/matlab/collections.py,sha256=oiDK4nwIUXroIPxw6Cu13WcBxmCyAHjPn7naaW_Yhjs,445
3
+ mkdocstrings_handlers/matlab/handler.py,sha256=WPfsvlGTZcAYgep6rpRjESPJdXU2QbVm31cf5v9ob0c,16959
4
+ mkdocstrings_handlers/matlab/models.py,sha256=n1l1Gr5Wq7nsrsP4PSePGfnGcln0NI-zSrkijGJBf80,5644
5
+ mkdocstrings_handlers/matlab/parser.py,sha256=bA3KRNnYjSewqyJI8OmLKATk3AZOq9-28UQg0L6f9os,843
4
6
  mkdocstrings_handlers/matlab/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
7
  mkdocstrings_handlers/matlab/matlab/matlab_startup.m,sha256=rGXiR8fI2GW7yWmHxgzE5Un66n5ws3ogYnMvS2oWO8U,464
6
8
  mkdocstrings_handlers/matlab/matlab/+docstring/exception.m,sha256=sj2ycqMpknn_OG5A5X_b5e4WcAoR2oPoqNnDEHJsi7c,222
7
- mkdocstrings_handlers/matlab/matlab/+docstring/resolve.m,sha256=ZHHz6ujW1godzDcGtC3p0SsVARv-roseUh85e2eTBrE,2736
9
+ mkdocstrings_handlers/matlab/matlab/+docstring/resolve.m,sha256=GZ7-NC79CVBVHjNJNublosAsGNhLy8dX4uyT4cznl4U,2800
8
10
  mkdocstrings_handlers/matlab/matlab/+docstring/+case/builtin.m,sha256=IioiokiaLnsi_6VXraaGdU2AgjCNApYhgVEmp2Lg1eA,245
9
11
  mkdocstrings_handlers/matlab/matlab/+docstring/+case/class.m,sha256=kVQxUEk8iOfHK2_NnN0HjHVhFnPgUqsf9PzyKC93y0g,276
10
12
  mkdocstrings_handlers/matlab/matlab/+docstring/+case/func.m,sha256=QneDYSICtXqdPNq8sYNieirXUisuDKRM9rxPx-0osDU,137
11
13
  mkdocstrings_handlers/matlab/matlab/+docstring/+case/method.m,sha256=Bw8Mb96OP7-AnbGnvRMySOIbYSTtEC1BGBnqHMEIhsM,165
12
14
  mkdocstrings_handlers/matlab/matlab/+docstring/+case/namespace.m,sha256=ZpYrgZHLIdGvgg3F6210gDTska9YyASn63ZVYkBq41A,667
13
- mkdocstrings_handlers/matlab/matlab/+docstring/+metadata/argument.m,sha256=i4lDOdGj35PahqX4HsSghibbcOlNRJ17R1N05IMi0Yg,1904
15
+ mkdocstrings_handlers/matlab/matlab/+docstring/+metadata/argument.m,sha256=yE1sywrr6Q0YjEkPkdBTjjkLeUrPv0jV-degM_EE_iE,1905
14
16
  mkdocstrings_handlers/matlab/matlab/+docstring/+metadata/class.m,sha256=n7qDJACSybOGjrQJPR8EzoMxkw2WOPMvPflvshkLz3Q,1673
15
17
  mkdocstrings_handlers/matlab/matlab/+docstring/+metadata/func.m,sha256=k1gz4kjEQX5DCIfzCs1lee5jjAL4fg6A7LnwcUF8kRE,424
16
18
  mkdocstrings_handlers/matlab/matlab/+docstring/+metadata/namespace.m,sha256=kMzfAoWIpMXH76rrkyUqauJSRIaylsfnu0Cds4pYnJc,481
17
19
  mkdocstrings_handlers/matlab/matlab/+docstring/+metadata/property.m,sha256=rH3cHz66ZG9sUvDU2fhlyASSB_yp0SiHlbpB44fcFiY,1560
18
20
  mkdocstrings_handlers/matlab/matlab/+docstring/+metadata/script.m,sha256=pmuazWBqlugNEEojfQFkAg1ioErizoiEZ9RcFXecCP4,329
19
- mkdocstrings_handlers/matlab/matlab/+docstring/+utils/dedent.m,sha256=r02mWQkRP9uuoEl-f-02h1-ja17a_29LTeyJvK-kazI,669
21
+ mkdocstrings_handlers/matlab/matlab/+docstring/+utils/dedent.m,sha256=IsqIZKyaBUeDihtxJOgIcCcV0Ju8Lv4oG-w4f7Iiu2s,668
20
22
  mkdocstrings_handlers/matlab/matlab/+docstring/+utils/get_namespace_path.m,sha256=4NlQ7-RjqIFZAn6P-9JzCrm2FvfGRKiM2M_leINj9i4,835
21
23
  mkdocstrings_handlers/matlab/matlab/+docstring/+utils/parse_doc.m,sha256=iFNpbnOr9FAv-3Zn8ksJHIthXAB7XKYVfH2NGFinzHs,499
22
- mkdocstrings_matlab-0.1.3.dist-info/METADATA,sha256=kU1-tCUxvcT9qjHjlxLj1Y1EKlEbGi2H8ctPRUbaUjQ,457
23
- mkdocstrings_matlab-0.1.3.dist-info/WHEEL,sha256=fl6v0VwpzfGBVsGtkAkhILUlJxROXbA3HvRL6Fe3140,105
24
- mkdocstrings_matlab-0.1.3.dist-info/licenses/LICENSE,sha256=14xA0OIYNpfmdeuq8-Yyqg7-3IJ4qhu3BJhknent-cY,1069
25
- mkdocstrings_matlab-0.1.3.dist-info/RECORD,,
24
+ mkdocstrings_handlers/matlab/resources/grammar.yml,sha256=GLI4xdATiB70bzRscXOVwMlw0YFlA-3GJzuzqWeBKJU,19511
25
+ mkdocstrings_matlab-0.1.5.dist-info/METADATA,sha256=KBhx1cJar_HMRP4xPomOvIBl_7Y-pITgSuLU0_Ra_rE,549
26
+ mkdocstrings_matlab-0.1.5.dist-info/WHEEL,sha256=fl6v0VwpzfGBVsGtkAkhILUlJxROXbA3HvRL6Fe3140,105
27
+ mkdocstrings_matlab-0.1.5.dist-info/licenses/LICENSE,sha256=14xA0OIYNpfmdeuq8-Yyqg7-3IJ4qhu3BJhknent-cY,1069
28
+ mkdocstrings_matlab-0.1.5.dist-info/RECORD,,