#parser #incremental

tree-sitter-asm

assembly grammar for the tree-sitter parsing library

1 unstable release

0.1.0 Mar 28, 2023

#308 in Text editors

Download history 457/week @ 2023-12-11 366/week @ 2023-12-18 276/week @ 2023-12-25 354/week @ 2024-01-01 368/week @ 2024-01-08 353/week @ 2024-01-15 407/week @ 2024-01-22 449/week @ 2024-01-29 477/week @ 2024-02-05 390/week @ 2024-02-12 377/week @ 2024-02-19 424/week @ 2024-02-26 473/week @ 2024-03-04 425/week @ 2024-03-11 372/week @ 2024-03-18 282/week @ 2024-03-25

1,605 downloads per month
Used in 2 crates

MIT and maybe GPL-3.0-only

58KB
2K SLoC

C 1.5K SLoC JavaScript 58 SLoC Rust 48 SLoC // 0.1% comments Scheme 20 SLoC // 0.2% comments

tree-sitter-asm

Generic assembly grammar for tree-sitter

Usage in Neovim

Parser Installation

The nvim-treesitter plugin does not include this parser. To use it you must instead manually add it to your tree-sitter config and then install it with :TSInstall asm or by adding it to your ensure_installed list:

require('nvim-treesitter.parsers').get_parser_configs().asm = {
    install_info = {
        url = 'https://github.com/rush-rs/tree-sitter-asm.git',
        files = { 'src/parser.c' },
        branch = 'main',
    },
}

Highlighting

If you want to use this parser for highlighting, you will also have to add this repository as a plugin, for example for packer.nvim add this:

use { 'rush-rs/tree-sitter-asm' }

lib.rs:

This crate provides asm language support for the tree-sitter parsing library.

Typically, you will use the language function to add this language to a tree-sitter Parser, and then use the parser to parse some code:

let code = "";
let mut parser = tree_sitter::Parser::new();
parser.set_language(tree_sitter_asm::language()).expect("Error loading asm grammar");
let tree = parser.parse(code, None).unwrap();

Dependencies

~2.7–5.5MB
~92K SLoC