From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!news.eternal-september.org!news.eternal-september.org!feeder.eternal-september.org!news.glorb.com!news-in-01.newsfeed.easynews.com!easynews!core-easynews-01!easynews.com!en-nntp-13.dc1.easynews.com.POSTED!not-for-mail From: agent@drrob1.com Newsgroups: comp.lang.ada Subject: Re: confusing string error Message-ID: <8eouf9logko4l4ee6806hlufrjosbl9h3s@4ax.com> References: <87ha81u9r7.fsf@adaheads.sparre-andersen.dk> <3kdtf9l42gimm37vgia3eibsmr638r27ig@4ax.com> User-Agent: ForteAgent/7.20.32.1218 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@easynews.com Organization: Forte Inc. http://www.forteinc.com/apn/ X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly. Date: Sat, 15 Feb 2014 07:53:42 -0500 X-Received-Bytes: 2886 Xref: news.eternal-september.org comp.lang.ada:18573 Date: 2014-02-15T07:53:42-05:00 List-Id: On Sat, 15 Feb 2014 09:33:25 +0000, Simon Wright wrote: >agent@drrob1.com writes: > >> I was trying not to bomb the newsgroup. But it seems you want it. So >> here we go. Assume that a valid spec file exists. I included the >> relevent types I define in it in my comments, as it is in my actual >> code. > >You are the one asking the questions, we are the ones who are trying to >help. You do not make it easy; it just took me about half an hour to get >the code you supply to the state where it compiles; and I still don't >know what CAP is in > > Char.CH := CAP(Element(TKNBUF,CURPOSN)); > >so I just removed it (guessing it's supposed to convert to upper case). > >There is no problem if I enter "12345" or "abcde" or "1+2". However, if >I enter "1+" or "1+2+" I get the same index error as Adam, on > > CH2 := Element(Token.UStr,2); > >Postponing this statement to the point where we know the length is >greater than 1, I get no exceptions. > >Perhaps, for the purposes of asking the question here, you should change >Testtokenizea so that the problematic input is a constant string rather >than being read from the input. > >See for example http://stackoverflow.com/help/mcve - the 'minimal' isn't >quite so important as the 'complete', 'tested', and 'readable'. I guess this is a case of the error code does not match the error. I kept getting an error message about the character appending line. I tried GDB and stepped through, and seemed to get the same error. I don't know why, but I agree that is the error. I understand now that I knew that in Modula-2 when the token was 1 character, then CH2 would just get the null termination character for all strings. I still don't understand why stepping line by line did not show me the correct failure point. Thanks guys for your help --rob PS: CAP is a holdover from Modula-2. I am used to it, and it is defined in my spec file to renames Ada.Character.Handling.To_Upper