Skip to content

Latest commit

 

History

History
49 lines (33 loc) · 2.18 KB

File metadata and controls

49 lines (33 loc) · 2.18 KB

FASTHTML

Coverage Status CI

FASTHTML is a recently created project that integrates with Moose and leverages the Tree-Sitter parser to analyze HTML files in Pharo.

Features

FASTHTML relies on:

  • FAST, to ensure compatibility with Moose.
  • Pharo-Tree-Sitter, implemented in Pharo via the FFI protocol to efficiently parse HTML files. It is also used to do incremental parsing.

FASTHTML metamodel is defined in a way where nodes align with those generated by Tree-Sitter.

Installation

To load FASTHTML in Pharo, execute the following in a Moose image:

Metacello new  
  baseline: 'FASTHTML';  
  repository: 'github://Evref-BL/FAST-HTML:main';  
  load.

Usage

To use it, please ensure that you have installed the corresponding libraries for Tree Sitter on your machine, to ensure parsing succeeds. Normally, this has been automated for different operating systems. But for more details, you can have a look at this blog-post.

To use it in Pharo, you can check example below:

res := FASTHTMLImporter new parse: '<p>
    <button disabled>Click Me!</button>
  </p>'. 

NB

The project is updated starting October 1 2026. It works on Moose 12+ (despite making the ci runs only for Moose 13, and this is because one of the tests is using a slot that is not defined in Moose 12, which makes the tests fail). The metamodel is complete following the description of tree sitter html original repo.

If you think an update is recommended or new feature is requested ... Your contribution is more than welcome. Happy coding with Pharo and HTML :)