Re: Tree-sitter grammar for ixml

Incidentally, I made a treesit parser for RelaxNG compact syntax
recently for Emacs 29,

https://github.com/LdBeth/tree-sitter-rnc

The corresponding emacs mode resides in my config file.
https://github.com/LdBeth/InfernoEmacs/blob/master/core/rnc-ts-mode.el

Working on the tree sitter grammar is a lot similar to using IXML,
except the special handling of comment and token lexer which I
think could potentially benefit IXML.

What bothered me a little bit is indentation convention of RelaxNG
compact, I implemented it to resemble all examples in the RelaxNG
tutorial, and most of the DocBook 5 RNC grammar. There are some edge
cases about `##` documentation annotation that I don't know how
to write the indentation rule:

db.valign.enumeration =
  ## Aligned on the bottom of the region
  "bottom"
  | 
    ## Fooo
    "middle"
  |
    ## Aligned on the top of the region
    "top"

Although I guess that's caused by that fact RNC is converted from the XML
RelaxNG file.

Best wishes,
LdBeth

>>>>> In <m2wmxpd2rc.fsf@saxonica.com> 
>>>>>	Norm Tovey-Walsh <norm@saxonica.com> wrote:
> [1  <text/plain; utf-8 (quoted-printable)>]
> Hello,

> Since Emacs 29 has introduced support for tree-sitter, IĒve taken a
> keener interest :-)

> My first humble foray into a tree-sitter grammar for Invisible XML
> (which would, for example, enable accurate syntax highlighting in
> tree-sitter-aware editors) is here:

>   https://github.com/nineml/tree-sitter-ixml/

> I know almost nothing about tree-sitter, so caveat forker.

> ItĒs got a couple of actual bugs and I havenĒt been able to make it
> syntax highlight anything successfully yet, but it was an amusing
> diversion on Sunday afternoon. IĒll come back to it again when I
> understand (or understand how to understand) tree-sitter a little
> better.

> Comments, suggestions, and pull requests most welcome!

>                                         Be seeing you,
>                                           norm

> --
> Norm Tovey-Walsh
> Saxonica
> [2 signature.asc <application/pgp-signature (7bit)>]
> No public key for 831226476F0BFD3B created at 2023-08-20T12:47:51-0500 using EDDSA

Received on Tuesday, 22 August 2023 18:49:52 UTC