[ragel-users] Re: Bug or feature?

Carlos Antunes cmantu... at gmail.com
Sat Jul 14 21:11:08 UTC 2007


Adrian,

I just reread the thread and, for the life of me, I don't understand
why the OUT transition (not shown on the graph on the previous msg)
gets its action executed but the IN transition doesn't get the same
treatment.

You've said, and I quote you:

"Prior to version 4.0, the entering action operator actually did exactly
what you describe. If the machine's start state was final, then it also
embedded the action into the start state as a leaving action. Initially
I thought this was very intuitive, however over time I gradually took
the opinion that all operators should have a single purpose."

Now, it appears to me that you were associating the entering action
with the OUT transition when both the start and final states are the
same. I agree with you, this is not intuitive. However, what I don't
understand is why you don't associate the entering action with the IN
transition. Entering action goes with IN and leaving action goes with
OUT. No dual purpose here, or am I still missing something?

Thanks!

Carlos

On 7/14/07, Carlos Antunes <cmantu... at gmail.com> wrote:
> 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
>
>


-- 
"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



More information about the ragel-users mailing list