Skip to main content

MATLAB tree-sitter parser

Project description

MATLAB grammar for tree-sitter.

There are screenshots at the end of this README :)

This parser has the objective of generating a tree that is as correct as possible (but sometimes just convenient) with what MATLAB itself executes. It is not intended only for syntax highlight, but also to be used by scripts to whatever it may be needed. In fact, I wrote it because I'm a Neovim/Doom Emacs user and love having text-objects, and was really missing a text object for matrices rows/cells.

Being as correct as possible means that some things are done correctly, for example:

  • Commands are parsed the same way MATLAB does it, by treating arguments as literals, grouping them correctly and only starting comments when allowed. It should perfectly match what MATLAB does.

  • Assignment has its own token, and multiple-variable assignment is NOT an assignment to a matrix (and returning an error is the correct thing to do, as it allows the user to see that something is off with the highlight, meaning something is probably off with the code):

% (assignment (multioutput_variable (identifier) (identifier)) (identifier))
[a,b] = d

% this is WRONG:
[a;b] = d
  • Inside a matrix, 1 + 1 and 1 +1 are different things:
a = 1 + 1 % 2
a = 1 +1 %2
[1 + 1] == [2]
[1 +1]  == [1 1]

Being convenient means that sometimes the difference between what is acceptable and what is not acceptable lives in the semantics, so we can't know. In such cases I just accept semantically wrong but syntax correct things and group them in the same token (first example). I do the same when the overhead of generating a specific token would not really pay off (second example).

  • Function calls and Matrix Indexing are the same in MATLAB: A(1) can be any of them and you cannot tell them apart unless you know for sure what A is referring to. So for convenience I just generate a function_call for them and also for cell indexing A{1}. The "problem" with that is that this is a valid indexing but an invalid function call: A(:). However I don't distinguish at all and say that all of them are function_call.

  • Function definitions, when inside a class, accepts a special syntax for the name of the function, allowing it to be preceded by either get. or set., like function get.name(). I could have a method_definition that would allow that to only be valid in the class context, but I doubt that would be worth it. So any function anywhere can have those and be recognize as correct still. Given the existence of external method definition, maybe that is even the correct thing to do, since we don't know if the current file is inside a special class folder.

Installation

This parser is now the default for the following editors:

  • Emacs: Through the tree-sitter-langs package.
  • Helix: Builtin.
  • Neovim: Through the nvim-treesitter plugin.

Screenshots

First Screenshot Second Screenshot Third Screenshot

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tree_sitter_matlab-1.2.11.tar.gz (168.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

tree_sitter_matlab-1.2.11-cp314-cp314t-win_arm64.whl (82.8 kB view details)

Uploaded CPython 3.14tWindows ARM64

tree_sitter_matlab-1.2.11-cp314-cp314t-win_amd64.whl (84.2 kB view details)

Uploaded CPython 3.14tWindows x86-64

tree_sitter_matlab-1.2.11-cp314-cp314t-win32.whl (83.4 kB view details)

Uploaded CPython 3.14tWindows x86

tree_sitter_matlab-1.2.11-cp314-cp314t-musllinux_1_2_x86_64.whl (117.7 kB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

tree_sitter_matlab-1.2.11-cp314-cp314t-musllinux_1_2_aarch64.whl (123.5 kB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ ARM64

tree_sitter_matlab-1.2.11-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (125.8 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

tree_sitter_matlab-1.2.11-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (119.1 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

tree_sitter_matlab-1.2.11-cp314-cp314t-macosx_11_0_arm64.whl (86.2 kB view details)

Uploaded CPython 3.14tmacOS 11.0+ ARM64

tree_sitter_matlab-1.2.11-cp310-abi3-win_arm64.whl (80.5 kB view details)

Uploaded CPython 3.10+Windows ARM64

tree_sitter_matlab-1.2.11-cp310-abi3-win_amd64.whl (82.1 kB view details)

Uploaded CPython 3.10+Windows x86-64

tree_sitter_matlab-1.2.11-cp310-abi3-win32.whl (80.8 kB view details)

Uploaded CPython 3.10+Windows x86

tree_sitter_matlab-1.2.11-cp310-abi3-musllinux_1_2_x86_64.whl (114.9 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ x86-64

tree_sitter_matlab-1.2.11-cp310-abi3-musllinux_1_2_aarch64.whl (120.7 kB view details)

Uploaded CPython 3.10+musllinux: musl 1.2+ ARM64

tree_sitter_matlab-1.2.11-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl (123.2 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

tree_sitter_matlab-1.2.11-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl (116.3 kB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ x86-64manylinux: glibc 2.5+ x86-64

tree_sitter_matlab-1.2.11-cp310-abi3-macosx_11_0_arm64.whl (86.2 kB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

File details

Details for the file tree_sitter_matlab-1.2.11.tar.gz.

File metadata

  • Download URL: tree_sitter_matlab-1.2.11.tar.gz
  • Upload date:
  • Size: 168.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for tree_sitter_matlab-1.2.11.tar.gz
Algorithm Hash digest
SHA256 2b7b894ffad0806c217cd473e6ea4623d8b8512687983132f11107ca148ede9e
MD5 0907c4e2f003bde4b70211a3561bf379
BLAKE2b-256 dfb2db5ea3d42fc2ad734c265da910bf2bea2ab3c90b3e1c953777184700f76c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11.tar.gz:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp314-cp314t-win_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp314-cp314t-win_arm64.whl
Algorithm Hash digest
SHA256 48a06407efb5811e1e1d89d022dc891aeb4dfc34c1aaa36c4be78a2b66915107
MD5 47be9682b19b89f6872fc3ec5066e8c1
BLAKE2b-256 836530c0b85bb13832e377996ac1f7f60651ee65b6c7c5a72fbd93cac816c86a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp314-cp314t-win_arm64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp314-cp314t-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 b1452bfd09ad9ed562c15355bdcb3cd994e66f98bde1e763a1c7d37e39442c07
MD5 7b1d9dc07ffdbd45ca82fd1f122f50cf
BLAKE2b-256 9450409e9422c9cb74f45b30030708960522eb5ab92c72f043edcaee13760eca

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp314-cp314t-win_amd64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp314-cp314t-win32.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp314-cp314t-win32.whl
Algorithm Hash digest
SHA256 07041883fd4fcc599ac9e695024d066b1522843abe8bf74522149a4084fba49e
MD5 cd6c4f4e19b44ef566d4e438eb6ab000
BLAKE2b-256 7e6055ddd5ad16ddadbf9cd73ead965a464bd88561ca2472f6cc3db1b2775f00

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp314-cp314t-win32.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0fe340213d8a974446d3da8b5f35fe05887443bf51438a5efd5164a15206668e
MD5 54a81d10fd5f20f4dc807b760893ff2d
BLAKE2b-256 be531d74c71a63819f7c6b0b5dfa79af40d08d14f8fbfb2d7e7e204eb413a1ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp314-cp314t-musllinux_1_2_x86_64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp314-cp314t-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp314-cp314t-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 0e97d34756dcb175621e65161a5f110a5baae6c8e06b31b4e6d68d80c2d833c0
MD5 d65753dd3e83809388931c965f488602
BLAKE2b-256 5796b028bddfc1e1f4988454a640c3de320c993b8b570bf812cced21a0a69237

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp314-cp314t-musllinux_1_2_aarch64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 916061c2c5ad79480de3541df10fab82c92de2143de505613cac7fb175b89e1e
MD5 1389f9d28e05da1d390abaca6d0fe777
BLAKE2b-256 806232b2def04658fa35becfe63b2292280fb3928df6c774cebd23197e344752

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp314-cp314t-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 b7dd9707d483dd7853fb8770736534559d09b8aba992913039f746c98cbac7cf
MD5 883ef154b8328447da5355d766ec4402
BLAKE2b-256 d8c101cf172872d76b9e3ce45eac0a2cbc6bc9fa50554c8285af8ee127336322

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp314-cp314t-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp314-cp314t-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp314-cp314t-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f5622651c61622ddaec7addfcb969fc86baa1406141b98e855e60c571a0149e0
MD5 366f7af33fb5d42e617a9ce1ac0c8177
BLAKE2b-256 5af864aa587ac245309edd6d837697730dff7c0310463431695c79e1c1a23582

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp314-cp314t-macosx_11_0_arm64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp310-abi3-win_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp310-abi3-win_arm64.whl
Algorithm Hash digest
SHA256 7a4cfe98aa3efc5cf682a3c03f0e65c51f6619ac465696bcb4efc861c24b558c
MD5 47a7161aea431d86ab89caf1c08d2c7d
BLAKE2b-256 5dfe94801f6177cfc83601f734e77369ab5a08b4486fe930f1bf0a6ec0675364

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp310-abi3-win_arm64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp310-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 d751c98f28a7553caf0cf9d6aec4a5fc6f65f27b2d0f420710953d5535c4f641
MD5 6d9ab00c90bfa8896206e7ba7a12b389
BLAKE2b-256 d66ec7e4fad9d390c86f5efe99c97ef81532bc276ffaaa315adc61ff5d07aa6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp310-abi3-win_amd64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp310-abi3-win32.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp310-abi3-win32.whl
Algorithm Hash digest
SHA256 611439fd6eface99530d4a72e2e467da2500be705bac29f2b89b26b1801122a9
MD5 d7805c02456311d5296662590d8b1c5a
BLAKE2b-256 20d3da49eaf0d210cbf98b8e17cfae6fe3b44a1960eab8d4394e44c14bf2ccc8

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp310-abi3-win32.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp310-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp310-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 91f93598c9ca771dfd993ea40f1d01a43d2c5d2b31a1ea52282969aa1b97247d
MD5 16aa6b8d466ac1fdfa185c403bd31438
BLAKE2b-256 eec4ea97254830f08de6d24fd12f9caaf7588ee0a4ec013b3564bfc79b5e0c19

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp310-abi3-musllinux_1_2_x86_64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp310-abi3-musllinux_1_2_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp310-abi3-musllinux_1_2_aarch64.whl
Algorithm Hash digest
SHA256 39e1b5e16480804b5876aa3258afe248418979ef340bcc06b8f88ede7e2bb2c2
MD5 cadd8ce212769709824161e8c334ba31
BLAKE2b-256 059e6ec7984a95d7c973d6278e3ae80fe4db2eec85c8cd2751a3230518b7b37e

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp310-abi3-musllinux_1_2_aarch64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c9cc6aa8128d2e2b109573f54028f36a42d98c77603d4007d06e9f70ed41bc33
MD5 3a99465b2010ad4af999d4fda7ded5db
BLAKE2b-256 29bab94429258b7ac9a4637d77ede432ed6731bed326bc7b9c263d267550d43c

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
Algorithm Hash digest
SHA256 dcb842fddd54610af136cc2fc23ece3f9e264b535ce4a8a5716ee9c89ba1811a
MD5 9684123ea3acf832577a6f2a842ccd59
BLAKE2b-256 e933a2b4d42d89f28376af7c14533f58e7a18b4f9d607942ccb6f9ff886dae7b

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file tree_sitter_matlab-1.2.11-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for tree_sitter_matlab-1.2.11-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ae39dc90b3ae9cb65e293e40d8213b39ab1d5a1f357f2d614fb265f80ae3ca96
MD5 cd1a7cd2625b506ec6932f5e3ac38373
BLAKE2b-256 a623255f8767f826e723db65a20b815a9131109a84ff5ab5ad36834b55807c64

See more details on using hashes here.

Provenance

The following attestation bundles were made for tree_sitter_matlab-1.2.11-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: wheels.yml on acristoffers/tree-sitter-matlab

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page