Georg Bauhaus <[email protected]> writes:

> Am 27.09.2013 um 14:14 schrieb Stephen Leake:
>
>> procedure {designator} [formal_part]
>> is
>>   [declarative_item]...
>> begin
>>   {statement}...
>> [exception_part]
>> end [designator];
>> 
>> Now when I type a name into the first {designator}, it is automagically
>> copied to the second. Very nice.
>> 
>> Maybe we can add that mechanism to skeleton?
>> 
>> In addition, each of the bracketed items (called "placeholders") has
>> comment syntax, 

I guess they don't have comment syntax - so much for my memory :).

>> so the parser ignores them. Which means this particular template is
>> illegal syntax, which is one motivation for allowing almost
>> everything (not keywords) to be empty. (this template is accepted by
>> the SMIE parser, sigh).
>
> The "{designator}" as a name was really easy to fix.  My local Wisi parser
> now accepts it and indentation works properly. If now

Excellent!

I am continuously amazed at how easy it is to hack ada-grammar.wy
compared to ada-smie.el :).

> 1) '[' can introduce a comment, and ']' terminate the same,
> 2) ellipsis_opt is added,
>
> then we'd be done allowing ELSE syntax, since none of the above tokens
> are Ada. Correct? 

not quite; see below for ellipsis handling - "..." means "repeating".

> Will the parser handle three dots, perhaps by way of a
> special case, or by hacking the lexer? 

There's a mechanism for sequences of punctuation characters; no
different than "=>".

> Alternatively, couldn't a
> trailing '_' be used as a substitute for "..." in ELSE mode? 

That would involve hacking Else, which I don't want to do (at least, not
until I'm done playing with skeleton).

Besides, "..." is far better as a UI for this than "_".

> Similar to '[', '_' may not start any Ada token.
>
> This syntax could also be used with skeleton.el, or anything else, I
> think.

Yes. 

And if the wisi parser adds a text-property 'placeholder, we could have a
before-change-function that deletes the placeholder first, just like
Else. 

That function could check for ..., and move point to before the
placeholder instead of deleting it, so it remains for another insert.


I've pushed a revision with a first draft of ada-skel.el, implementing
the token expansion I discussed. It only has 'case' and 'declare'
tokens, but they work, and the parser accepts them. I changed
ada-grammar.wy to allow empty sequence_of_statments and
discrete_choice_list (easy!).

I don't think skeletons for 'array' and 'procedure' are useful; the user
has to provide most of the text in the minibuffer, and the skeleton only
adds a few characters. It's easier to type all of it directly in the buffer.

So I will selectively copy skeletons from ada-mode 4.01.

I'll try adding placeholders to these skeletons as above. That will make it
clearer that the syntax is illegal and needs to be finished.

And we can implement "goto-next-placeholder"! cool.

I ran all the tests without byte-compiling. That goes a lot slower,
because it has to process ada-grammar-wy.el each time. But it finds a
different set of cl macros that need to be fixed; very confusing!

-- 
-- Stephe

_______________________________________________
Emacs-ada-mode mailing list
[email protected]
http://host114.hostmonster.com/mailman/listinfo/emacs-ada-mode_stephe-leake.org

Reply via email to