Re: Handling rejection

2015-02-09 Thread Thomas Weigert
Thank you all for helping. Putting Jeff and Ron's insights together I was able to come up with a simple solution. I know exactly where in the input string my replacement text is. So I need not inject anything, I can just go there and recognize that text only as my ruby slippers, and then continue

Re: Handling rejection

2015-02-09 Thread Jeffrey Kegler
Still having Internet troubles. Two notes: First, the text associated with a lexeme does *NOT* have to be its value, if you use the lexeme_read() method to read it. That's how you can do the Ruby Slippers, for example. Second, the text is fixed, but you can change how you move around in it -- y

Re: Handling rejection

2015-02-09 Thread Ron Savage
On Tuesday, 10 February 2015 14:24:56 UTC+11, Thomas Weigert wrote: > > Thanks, Ron. > > I see how the Ruby Slippers can work if you know ahead of time what the > text will be that we need to insert into the input, so we can "secret it > away" before calling read. I guess I could get this to work

Re: Handling rejection

2015-02-09 Thread Ruslan Shvedov
I'd suggest 2 code examples: one for parsing preprocessor statements [1] and another for parsing length-prefixed format with prediction and completion events [2] -- is show how to use lexeme_read() with pos() and resume(). Hope this helps. [1] https://gist.github.com/rns/3b2f48477fc23d0ab0f7 [2]

Re: Handling rejection

2015-02-09 Thread Thomas Weigert
Thanks, Ron. I see how the Ruby Slippers can work if you know ahead of time what the text will be that we need to insert into the input, so we can "secret it away" before calling read. I guess I could get this to work by prescanning the input for all the text strings, then putting them all into

Re: Handling rejection

2015-02-09 Thread Ron Savage
> > I think this strategy would be completely infeasible for a real grammar. > Perhaps you meant that for the grammar you have to contend with, but I still disagree. There are 2 courses of action here too (which is always better than having 1 or none): 1: Extend the original grammar so Marpa

Re: Handling rejection

2015-02-09 Thread Ron Savage
On Tuesday, 10 February 2015 13:35:31 UTC+11, Thomas Weigert wrote: > > Ron, > > please see below > > I guess in the end it comes back to what Jeff said earlier. He implied > that one cannot simply change the content of the input string. > No, you can't change it, but using the Ruby Slippers

Re: Handling rejection

2015-02-09 Thread Thomas Weigert
Ron, please see below I guess in the end it comes back to what Jeff said earlier. He implied that one cannot simply change the content of the input string. I guess that maybe somehow the recognizing is happening in the C code and that the input is copied into C space and the position info

Re: Handling rejection

2015-02-09 Thread Ron Savage
On Tuesday, 10 February 2015 13:08:28 UTC+11, Thomas Weigert wrote: > > Maybe some more here: > > In the R.pod it further says: "The virtual input stream is a series of > input strings. An input string is a substring of the physical input stream. > By default the virtual input stream consists of

Re: Handling rejection

2015-02-09 Thread Ron Savage
On Tuesday, 10 February 2015 12:57:47 UTC+11, Thomas Weigert wrote: > > Thank you for this tip. Indeed, this was an assumption that I was making. > I got the idea from the R.pod: > > "The resume() method uses a new input string to scan the physical input > stream that was specified to the read()

Re: Handling rejection

2015-02-09 Thread Thomas Weigert
Maybe some more here: In the R.pod it further says: "The virtual input stream is a series of input strings. An input string is a substring of the physical input stream. By default the virtual input stream consists of exactly one input string, one which begins at location 0 in the physical input

Re: Handling rejection

2015-02-09 Thread Thomas Weigert
Thank you for this tip. Indeed, this was an assumption that I was making. I got the idea from the R.pod: "The resume() method uses a new input string to scan the physical input stream that was specified to the read() method. resume()'s input string may be specified explicitly or implicitly. By

Re: Handling rejection

2015-02-09 Thread Jeffrey Kegler
A quick response. [ I'm having Internet connectivity problems. ] The input string passed to read is copied into the bowels of Marpa in a digested form. On my first quick reading, it's looking like you are relying on changes to the original string being seen by Marpa. This does not happen. On

Handling rejection

2015-02-09 Thread Thomas Weigert
No, this is not about relationship troubles. I am struggling to work with rejection events. I am trying to deal with constructs like preprocessing statements or meaningful comments in programming languages. These (i) can go anywhere in the grammar and (ii) need to be propagated into the parse t