Re: Tree-sitter grammar for ixml

LdBeth <andpuke@foxmail.com> writes:
> 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.

It’s very common, generally, for tools that parse things to have a lexer
to make the tokens and a parser to parse them. For iXML, the trouble is,
I think, that you’d need to either have a fixed set of lexing rules or a
language for defining lexing rules. The former would invariably be
problematic for some scenarios and the latter would make iXML that much
more complicated.

> 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.

Maybe. Or maybe I just didn’nt hit “tab” in all the right places. The
standard emacs mode for RELAX NG produces

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

which is probably what I *meant* to have in that file. Sorry for the
confusion!

                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh
Saxonica

Received on Wednesday, 23 August 2023 05:18:49 UTC