From: agent@drrob1.com
Subject: Re: confusing string error
Date: Sat, 15 Feb 2014 07:53:42 -0500
Date: 2014-02-15T07:53:42-05:00 [thread overview]
Message-ID: <8eouf9logko4l4ee6806hlufrjosbl9h3s@4ax.com> (raw)
In-Reply-To: lyy51c3el6.fsf@pushface.org
On Sat, 15 Feb 2014 09:33:25 +0000, Simon Wright <simon@pushface.org>
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
next prev parent reply other threads:[~2014-02-15 12:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-14 12:38 confusing string error agent
2014-02-14 13:03 ` Jacob Sparre Andersen
2014-02-15 0:46 ` agent
2014-02-15 1:50 ` adambeneschan
2014-02-15 8:41 ` Simon Wright
2014-02-15 1:57 ` adambeneschan
2014-02-15 9:33 ` Simon Wright
2014-02-15 12:53 ` agent [this message]
2014-02-15 16:58 ` adambeneschan
2014-02-15 18:29 ` Simon Wright
2014-02-17 12:57 ` agent
2014-02-15 13:15 ` agent
2014-02-15 17:56 ` Jeffrey Carter
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox