On 04/09/08 17:08, David Baelde wrote:
> Hi,
>
> I'm the author of omlet, an indentation mode for Ocaml. I gave up
> developing and even maintaining it, and I'm looking for a good way to
> restart it from scratch.
>
> Currently, the code does some minimal (but not so trivial) parsing of
> the code before the pointer to find out how to indent a line. This was
> developed by hand and incrementally, and quickly became messy. Since
> then I have developed standalone tools that incrementally parse (correct
> regions of) code and indent it based on the yacc grammar and a few
> simple rules. This is much nicer, but seems hard to use from vim. (In
> fact I realized that it is similar to the earlier vim-dev discussion
> about on-the-fly syntax checking with an LALR parser [1]).
>
> Basically, I would need to attach parsing information to places in the
> buffer. (The info I need requires more complex parsing than what vim
> syntax support can give me.) Is there any builtin device for doing that,
> or do I have to maintain my own structure all the way through edition?
> has anything like that been done already?
>
> Cheers,
>
> David
>
> [1] http://thread.gmane.org/gmane.editors.vim.devel/19346/focus=19381
Vim syntax highlighting is pretty powerful (more than I care to delve
into throroughly), but if it is still not enough for you, I suppose you
could write your own function, set it by "setlocal
indentexpr=OcamlOmlet()" or similar in the appropriate indent/ocaml.vim
script -- and there you could use as complex processing as you cared to.
Of course, your script should still indent the code correctly after
pasting code in the middle, and it ought to be able to compute the
indent correctly when the user hits <Enter> in Insert mode.
I notice that there already exists an indent/ocaml.vim in $VIMRUNTIME,
maintained by Jean-François Yuen, Mike Leary and Markus Mottl. You might
want to look at what that script already does and/or discuss the matter
with these people (assuming they can still be reached).
Best regards,
Tony.
--
The first Great Steward, Parrafin the Climber, was employed in King
Chloroplast's kitchen as second scullery boy when the old King met a
tragic death. He apparently fell backward by accident on a dozen salad
forks. Simultaneously the true heir, his son Carotene, mysteriously
fled the city, complaining of some sort of plot and a lot of
threatening notes left on his breakfast tray. At the time, this looked
suspicious what with his father's death, and Carotene was suspected of
foul play. Then the rest of the King's relatives began to drop dead
one after the other in an odd fashion. Some were found strangled with
dishrags and some succumbed to food poisoning. A few were found
drowned in the soup vats, and one was attacked by assailants unknown
and beaten to death with a pot roast. At least three appear to have
thrown themselves backward on salad forks, perhaps in a noble gesture
of grief over the King's untimely end. Finally there was no one left
in Minas Troney who was either eligible or willing to wear the accursed
crown, and the rule of Twodor was up for grabs. The scullery slave
Parrafin bravely accepted the Stewardship of Twodor until that day when
a lineal descendant of Carotene's returns to reclaim his rightful
throne, conquer Twodor's enemies, and revamp the postal system.
-- Harvard Lampoon, "Bored of the Rings"
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---