From: Gavin Kistner Date: 2005-06-23T11:55:52+09:00 Subject: Re: Creating a new Syntax tokenizer >> 3) How do I keep track of state during successive calls to #step? >> I tried an instance variable, but that doesn't seem to exist >> across calls. >> > > Instance variables should work--I use them successfully in the Ruby > tokenizer, for instance. Feel free to contact me off-list and I can > help troubleshoot this if it isn't working for you. Hrm, I'll have to try it again sometime. Perhaps I screwed up when I tried it. >> Following is my terrible, broken attempt at the basics of what I'm >> after. Am I totally misunderstanding how to use Syntax? > > Without actually trying to run it, I'd say you've got the idea. > This is an interesting use of Syntax--given that Syntax was > intended for use as a highlighter, I wouldn't have thought to use > it as a more general purpose parser, but it can definitely be used > for that. Clever! :) Thanks for the help in your response. As noted in my OWLScratch post, after thinking about the problem more and more, I decided that I wanted a more state-based solution than Syntax seemed to surround, but I want to thank you very much for the library, as the concepts in it really helped me in my thinking (and introduced me to StringScanner - what a gem!).