Stephen Leake <[email protected]> writes:

> Simon Wright <[email protected]> writes:
>
>> C-c C-f says
>> int.adb:5:13: syntax error in grammar state 411; unexpected raise,
>> expecting one of (default PLUS MINUS ABS NOT NULL NEW IDENTIFIER
>> CHARACTER_LITERAL STRING_LITERAL LEFT_PAREN)
>
> But you can't put 'raise' in an expression! Which is why the Ada mode
> parser rejects it.
>
> But GNAT GPL 2014 accepts it.
>
> I'll ask on comp.lang.ada.

I got no response. And I realized it doesn't much matter; if GNAT
accepts it, Emacs Ada mode has to.

So I added it to the grammar:

relation_or_else_list
  : relation OR ELSE relation
  | relation_or_else_list OR ELSE relation
  | relation OR ELSE RAISE name WITH expression ;; GNAT GPL 2014 allows this in 
aspects
  | relation OR ELSE RAISE name ;; GNAT GPL 2014 allows this in aspects
  ;

and to the ada-wisi.el indent code. That was a little complex, involving
cleaning up other things, so I'm not sending a patch here; I'll do a
release soon (I've also changed how syntax highlight works, so it's much
more accurate).

It indents as:

   subtype Integer_String is String
   with Dynamic_Predicate => Integer'Value (Integer_String) in Integer
     or else raise Constraint_Error with "not an integer string";

   type Integer_String is new String
   with Dynamic_Predicate => Integer'Value (Integer_String) in Integer or else 
     raise Constraint_Error with "not an integer string";

That's consistent with attributes on subprograms.

Comments?

-- 
-- Stephe

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

Reply via email to