#tree-sitter #pascal #delphi

tree-sitter-pascal

Pascal grammar for the tree-sitter parsing library

1 unstable release

0.10.0 Feb 19, 2025

#1185 in Parser implementations

Download history 253/week @ 2025-02-18 26/week @ 2025-02-25 95/week @ 2025-03-04 71/week @ 2025-03-11 337/week @ 2025-03-18 169/week @ 2025-03-25 174/week @ 2025-04-01 215/week @ 2025-04-08

907 downloads per month

MIT license

3.5MB
131K SLoC

C 130K SLoC JavaScript 1K SLoC // 0.1% comments Scheme 257 SLoC // 0.2% comments Rust 27 SLoC // 0.3% comments

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

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

let code = r#"
"#;
let mut parser = tree_sitter::Parser::new();
let language = tree_sitter_pascal::LANGUAGE;
parser
    .set_language(&language.into())
    .expect("Error loading Pascal parser");
let tree = parser.parse(code, None).unwrap();
assert!(!tree.root_node().has_error());

tree-sitter-pascal

Grammar for Pascal and its dialects Delphi and Freepascal.

Supported language features

  • Classes, records, interfaces, class helpers
  • Nested declarations
  • Variant records
  • Generics (Delphi- & FPC flavored)
  • Anonymous procedures & functions
  • Inline assember (but no highlighting)
  • Extended RTTI attributes
  • FPC PasCocoa extensions

Tree-sitter features:

  • Syntax highlighting
  • Scopes

Screenshots

(using nvim-treesitter)

Dependencies