[ragel-users] Re: Bug or feature?

Carlos Antunes cmantu... at gmail.com
Sat Jul 14 20:54:12 UTC 2007


Adrian,

Let me start by saying that I was wrong when I said that the optional
machine is bypassed. You are right, there is a state which is both the
start and finish and that state is always transitioned to. Attahed,
you'll find the image that convinced me of that. I'm going to reread
that thread to see if I "get it". To be honest with you, I am still
confused so expect additional questions from me. I hope you don't
kind! :)

Thanks!

Carlos

On 7/14/07, Adrian Thurston <thurs... at cs.queensu.ca> wrote:
> Carlos,
>
> The leaving action is run because the machine accepts the zero-length
> word at the time that it is embedded. That is, the start state is also
> final. When you 'pass over' a machine that accepts the zero-length word
> you are always passing through the start state which is also final. And
> so you are 'leaving' it.
>
> But entering actions are always associated with transitions inside the
> machine. This is how you can leave a machine you have never 'entered.'
>
> It's true, the wording of things doesn't perfectly match the semantics,
> and they used to match better (see the thread), but to me the current
> state of things seems the best way to go. The semantics of the operators
> are simple and easy to define.
>
> If you make a habit of factoring out zero-length machines then you can
> avoid this problem.
>
> word = char+ >enter %leave;
> opt_word = word?;
>
> -Adrian
>
> Carlos Antunes wrote:
> > Adrian,
> >
> > Ok, read the thread and that message specifically. I still don't get
> > why a machine that doesn't get entered gets to be exited. If a
> > transition goes around, not through, the machine, why would the exit
> > action of that machine be called? After all, that optional machine
> > final state may never be transitioned to, right? How come it can be
> > transitioned from, then?
> >
> > Thanks!
> >
> > Carlos
> >
> > On 7/14/07, Adrian Thurston <thurs... at cs.queensu.ca> wrote:
> >> Hi Carlos,
> >>
> >> See this thread:
> >>
> >> http://groups.google.com/group/ragel-users/browse_thread/thread/9509ab83d7f022f1/
> >>
> >> And in particular this message:
> >>
> >> http://groups.google.com/group/ragel-users/msg/79546a93494e6773
> >>
> >> -Adrian
> >>
> >> Carlos Antunes wrote:
> >>> Adrian,
> >>>
> >>> I have the following construct:
> >>>
> >>> password = password_char**
> >>>                >{ capture_start(capid_password, p); }
> >>>                %{ capture_stop(capid_password, p); };
> >>>
> >>> When I feed a string that doesn't match "password", "capture_stop" is
> >>> immediately called but not "capture_start". I would expect that either
> >>> both or none are called (I prefer both). What say you?
> >>>
> >>> Thanks!
> >>>
> >>> Carlos
> >>>
> >>
> >>
> >
> >
>
>
>


-- 
"We hold [...] that all men are created equal; that they are
endowed [...] with certain inalienable rights; that among
these are life, liberty, and the pursuit of happiness"
        -- Thomas Jefferson
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graph-dot[1].png
Type: image/png
Size: 868 bytes
Desc: not available
URL: <http://www.colm.net/pipermail/ragel-users/attachments/20070714/032e3704/attachment-0001.png>


More information about the ragel-users mailing list