> 
> Actually, my motivation was a lot simpler.  I wasn't sure if the regular
> expression I use to match an error being indicated by the amforth
> interpreter really covered all cases.  That expression (without the
> delimiting double quotes included below) is:
>   
>    " \?\? -\d+ \d+ \r\n> $"
> 
> Is it correct?

Yes it is.

>  I spent some time looking at the main interpreter trying
> to verify it but I don't read assembly and forth fluently enough yet to
> be sure without investing more time than I had available.

It a bit difficult indeed. The messages get printed by the
words in the prompts.asm file, coordinated in quit.asm.
The first " ?? " comes from PROMPTERROR which prints the
two numbers too. After that quit calls the PROMPTRDY which
generates the line feed and the "> ".

The two numbers are printed using . (DOT) which makes
it possible to get both positive and negative numbers.
The not-so-obvious code in quit makes sure, that the
first number is always negative and the second number
is always positive. (THROW Code resp the value of >IN).

That means that a THROW with a positive code number
does not print anything, THROWs with a negative number
trigger the error prompt as described above. The second
consequence is that the size of the input buffer into
which >IN points should never exceed 32KB.

> If the above regular expression will catch all errors explicitly
> indicated by the interpreter, then I think it would be reasonable to
> change the default behavior to *not* generate an error on output as it
> *will still generate an error* if the error regular expression matches.

As long as nobody changes QUIT and the prompt words, the regex will
work.

>   Matthias> 
> http://amforth.svn.sourceforge.net/viewvc/amforth/trunk/tools/amforth-term.py?view=log
> 
> Wonderful.  I don't really see any need for this to live outside the
> amforth repository, so if I get a chance to make further improvements
> I'll prepare patches against the code there.

Great.

Matthias

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to