home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.ada
- Path: sparky!uunet!seas.gwu.edu!mfeldman
- From: mfeldman@seas.gwu.edu (Michael Feldman)
- Subject: Re: Case errors
- Message-ID: <1992Sep5.155434.19738@seas.gwu.edu>
- Sender: news@seas.gwu.edu
- Organization: George Washington University
- References: <tp923021.715674752@ash>
- Date: Sat, 5 Sep 1992 15:54:34 GMT
- Lines: 45
-
- In article <tp923021.715674752@ash> tp923021@ash.canberra.edu.au (Ben Elliston) writes:
-
- [stuff deleted]
- >
- >"Incomplete case in middle of range"
- >
- >The portion of code generating this error is:
-
- It's not clear what Symbol's type is. If it is Character, then you need
- a WHEN OTHERS choice to absorb uninteresting values of Symbol. An Ada
- CASE statement requires all values of the selector variable to be covered
- by choices.
- >
- >CASE Symbol IS
- > WHEN "(" | "[" | "{" => Push(Symbol,S); -- Push the symbol onto stack
- > WHEN ")" | "]" | "}" =>
- Also, you have a syntax error here: the double quotes (string quotes)
- must be single quotes (character quotes).
-
- > IF Empty(S) THEN -- The stack is empty?
- > Valid := False;
- > ELSIF Match(Top(S),Symbol) THEN -- The closing symbol matches
- > -- the opening symbol on the stack
- > Pop(S);
- > ELSE
- > Valid := False;
- > END IF;
- > Text_IO.Get(Item => Symbol);
- >END CASE;
- >
- Mike Feldman
- ------------------------------------------------------------------------
- Michael B. Feldman
- co-chair, SIGAda Education Committee
-
- Professor, Dept. of Electrical Engineering and Computer Science
- School of Engineering and Applied Science
- The George Washington University
- Washington, DC 20052 USA
- (202) 994-5253 (voice)
- (202) 994-5296 (fax)
- mfeldman@seas.gwu.edu (Internet)
-
- "Americans wants the fruits of patience -- and they want them now."
- ------------------------------------------------------------------------
-