Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [wtp-incubator-dev] XQuery tokenizer question about: endExprSingle()

Hi Gabriel,

great I'm glad that somebody is finally taking a look at this quite complex piece of code! There is definitively place for improvement there.

Regarding your question, endExprSingle() is not called. ExprSingle in the 'return' part of a case clause can only terminate (if I'm not wrong) by the 'default' or 'case' keywords. This rule handles that:


// ExprSingle delimiters for case _expression_
<TS_ENDPRIMARY, TS_SINGLETYPEQMOREND, TS_ENDAXISSTEP, TS_OPTSTEPEXPR, TS_ENDEXPRSINGLE,TS_ENDVARREF> {
"case" { pushState(TS_ENDTSSEQUENCETYPE); yybegin(TS_ENDCASEKW); return KW_CASE; }
"default" { yybegin(TS_ENDTSDEFAULTKW); return KW_DEFAULT; }
}

As you can see, in this case endExprSingle() is not called. That might be a mistake as it makes the code less consistent and more confusing (or maybe wrong).

Does it make sens now?

Lionel

Inactive hide details for Gabriel Petrovay ---08/07/2010 04:51:01 AM---Hi Lionel, I looked a little into the jflex grammar. I dGabriel Petrovay ---08/07/2010 04:51:01 AM---Hi Lionel, I looked a little into the jflex grammar. I don't get it why there is

From:Gabriel Petrovay <gabipetrovay@xxxxxxxxx>
To:WTP Incubator Dev list <wtp-incubator-dev@xxxxxxxxxxx>
Date:08/07/2010 04:51 AM
Subject:[wtp-incubator-dev] XQuery tokenizer question about: endExprSingle()



Hi Lionel,

I looked a little into the jflex grammar. I don't get it why there is
a difference between the if _expression_ and the typeswitch. Why doesn't
typeswitch appear with the endExprSingle() because the "case" clause
also contains an ExprSingle on the last position. According to the
endExprSingle() function description this case falls into: "continue
parsing the same outer _expression_ single. Only the sub-_expression_ type
is popped from the state stack". So I was expecting to see a case like
for the IFTHENEXPR state:

switch (context) {
 ...
 case IFTHENEXPR
...

If your answer is "because the case clause of the typeswitch
_expression_ does not have a state on it's own because:
<TS_ENDTSSEQUENCETYPE> "return" { [pushState(????????);]
yybegin(TS_EXPRSINGLE); return KW_RETURN; }
does not push any"  then my question is "why isn't such a state pushed?"

One line above in the jflex file there is this comment: "// No need to
push continuation state because it's done earlier." Maybe this plays a
role in this?


Thanks a lot! Just trying to understand!

Gabriel


--
MSc Gabriel Petrovay
Mobile: +41(0)787978034
www.28msec.com
_______________________________________________
wtp-incubator-dev mailing list
wtp-incubator-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/wtp-incubator-dev

GIF image


Back to the top