Hi Daiki
it is great that you are looking into this. I think the
implementation in builder is by far the one that has gotten further
and seems to work reasonably well within its known limits (e.g. it
does not yet support different "styles" like GNU or K&R). As you said
it takes the same approach of vim by using custom code and heuristics
to figure out something "good enough" near the cursor.
I think it would be a great exercise to see if the indenter interface
of builder is flexible enough to write a backend based on your SMIE
port. If that is the case I think it would be a proof that we can
start pushing things in gtksourceview and then experiment with
different implementations strategies.
Ciao,
Paolo
On Thu, May 14, 2015 at 10:45 AM, Daiki Ueno <[email protected]> wrote:
> Hello,
>
> I came across Paolo's plan on custom indenter on this bug:
> https://bugzilla.gnome.org/show_bug.cgi?id=736727#c19
> and found it interesting.
>
> If I understand well, the essence of indenter implementation is to find
> a paren-like expression, by looking at the text around the cursor.
> Apparently the current implementations in Builder and
> gedit-code-assistance are doing that with hand-crafted string matching
> rules.
>
> On the other hand, Emacs nowadays ships with a generic indentation
> engine called SMIE, which utilizes operator precedence grammar, so it
> can reliably find a matching expressions like: "if" ... "then" ... "fi"
> http://www.gnu.org/software/emacs/manual/html_node/elisp/SMIE.html#SMIE
>
> I'm thinking of using the same algorithm to make indenter
> implementations easier. What do people think?
>
> As a POC, I ported the basic part of SMIE (written in Elisp) to C:
> https://github.com/ueno/c-smie
>
> Though it is still a draft, it contains a sh-like grammar and an
> interactive demo, which you can play with.
>
> Comments appreciated.
>
> Regards,
> --
> Daiki Ueno
> _______________________________________________
> gnome-devtools mailing list
> [email protected]
> https://mail.gnome.org/mailman/listinfo/gnome-devtools
_______________________________________________
gnome-devtools mailing list
[email protected]
https://mail.gnome.org/mailman/listinfo/gnome-devtools