home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / lang / ada / 2543 < prev    next >
Encoding:
Text File  |  1992-09-07  |  1.8 KB  |  57 lines

  1. Newsgroups: comp.lang.ada
  2. Path: sparky!uunet!seas.gwu.edu!mfeldman
  3. From: mfeldman@seas.gwu.edu (Michael Feldman)
  4. Subject: Re: Case errors
  5. Message-ID: <1992Sep5.155434.19738@seas.gwu.edu>
  6. Sender: news@seas.gwu.edu
  7. Organization: George Washington University
  8. References: <tp923021.715674752@ash>
  9. Date: Sat, 5 Sep 1992 15:54:34 GMT
  10. Lines: 45
  11.  
  12. In article <tp923021.715674752@ash> tp923021@ash.canberra.edu.au (Ben Elliston) writes:
  13.  
  14. [stuff deleted]
  15. >
  16. >"Incomplete case in middle of range"
  17. >
  18. >The portion of code generating this error is:
  19.  
  20. It's not clear what Symbol's type is. If it is Character, then you need 
  21. a WHEN OTHERS choice to absorb uninteresting values of Symbol. An Ada
  22. CASE statement requires all values of the selector variable to be covered
  23. by choices.
  24. >
  25. >CASE Symbol IS
  26. >  WHEN "(" | "[" | "{" => Push(Symbol,S);  -- Push the symbol onto stack
  27. >  WHEN ")" | "]" | "}" => 
  28. Also, you have a syntax error here: the double quotes (string quotes)
  29. must be single quotes (character quotes).
  30.  
  31. >    IF Empty(S) THEN -- The stack is empty?
  32. >      Valid := False;
  33. >    ELSIF Match(Top(S),Symbol) THEN  -- The closing symbol matches
  34. >                                     -- the opening symbol on the stack
  35. >      Pop(S);
  36. >    ELSE
  37. >      Valid := False;
  38. >    END IF;
  39. >  Text_IO.Get(Item => Symbol);
  40. >END CASE;
  41. >
  42. Mike Feldman
  43. ------------------------------------------------------------------------
  44. Michael B. Feldman
  45. co-chair, SIGAda Education Committee
  46.  
  47. Professor, Dept. of Electrical Engineering and Computer Science
  48. School of Engineering and Applied Science
  49. The George Washington University
  50. Washington, DC 20052 USA
  51. (202) 994-5253 (voice)
  52. (202) 994-5296 (fax)
  53. mfeldman@seas.gwu.edu (Internet)
  54.  
  55. "Americans wants the fruits of patience -- and they want them now."
  56. ------------------------------------------------------------------------
  57.