comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: enumeration_io: get error
Date: Sun, 16 Jun 2002 02:12:43 GMT
Date: 2002-06-16T02:12:43+00:00	[thread overview]
Message-ID: <3D0BF45C.D12DE2BF@acm.org> (raw)
In-Reply-To: aega4l$152$1@wanadoo.fr

The quick answer is not to use an instantiation of Enumeration_IO to do
the input. Use Get_Line to obtain a String, then use 'Value or the
version of Get that takes the value from a String to convert the String
to a value of the enumeration type. Use a loop to handle the exception
that occurs if the String does not contain the representation of an
enumeration value.

The long answer is to carefully review the semantics of
Enumeration_IO.Get. Pay special attention to the cases in which the next
character in the input is consumed and those in which the next character
is looked at but not consumed. You will find that characters such as '*'
are looked at but not consumed, meaning the next call to Get sees the
same character. In this particular example, this causes infinite
recursion.

It is left as an exercise for the reader to figure out how to deal with
this.

-- 
Jeff Carter
"You cheesy lot of second-hand electric donkey-bottom biters."
Monty Python & the Holy Grail



  parent reply	other threads:[~2002-06-16  2:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-06-15 21:06 enumeration_io: get error Gino POLIDO
2002-06-15 22:26 ` R. Tim Coslet
2002-06-15 23:10   ` Gino POLIDO
2002-06-15 23:54 ` sk
     [not found] ` <3D0BD39B.FED8A0E4@myob.com>
2002-06-16  0:00   ` sk
2002-06-16  2:12 ` Jeffrey Carter [this message]
2002-06-16 19:59   ` sk
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox