Tuesday 15 September 2015

Parse a step of an XPATH expression in JavaCC again -


A while ago I was struggling to write a JavaCC template for XPath stages so that it was both a complete step Definition and one will support the axis left with the name defined (in that case the name of the axis would be the default for the child) I got a working answer from the post and Theodore Novell.

Now I'm trying to expand the template so that the parser, apart from the previous two possibilities, it will also support using a "@" sign as a shortcut for the specialty axis.

The following snippet does not work:

  step by step (): {token t; Step step; Axis axis; Nodesta nodestas; Interpretation of expression; } {{Axis = axis. Child; } (& Lt; AT & gt; {axis = Axis.attribute;} | overview (& lt; IDENTIFIER & gt; & lt; DOUBLE_COLON & gt;) T = & lt; IDENTIFIER & gt; {axis = Axis.valueOf (T.image);} & lt; DOUBLE_COLON & gt;)? T = & lt; IDENTIFIER & gt; {Nodesta = new nodename test (T.J.G.); } {Step = new step (axis, nodeTest); } (& Lt; OPEN_PAR & gt; predicate = expression () {step.addPredicate (predicate)}} & lt; CLOSE_PAR & gt;) * {return step; }}   

Instead it emits the following warning message:

  in the option [...], build column 9 on line 162. Within are the following general prefixes of the creation of nostalgia construction and extension, one of which is: & lt; IDENTIFIER & gt; Consider using letterheads of 2 or more for nested detail.   

I have tried to set the Looked Parameter in different ways, but the only way to do this was to set it to 2 in the world level. I prefer to change it locally though.

How can I do this? And why does not the piece this question have been shown in the work?

itemprop = "text">

(& lt; at & gt; {Axis = axis.attribute;} | Lyquade ( gt; & lt; DOUBLE_COLON & gt;) T = & lt; IDENTIFIER & gt; {axis = Axis.valou (T.I.J.);} & lt ; DOUBLE_COLON | | {})

- edit -

I was wrong to answer the second question: "Why not the piece does not work" forward Given the views of that you only apply to the repatriation I am surprised that the resident does not warn you, because Lukkaid is on the last option and therefore is useless. When the parser goes to Lucad, it has already been fixed (being an identifier based on the next token) to process the inside of (...)? is another solution like this

  (Lukehead ( | IDENTIFIER & gt; & lt; DOUBLE_COLON & gt;) (& lt; AT & gt; {...} | & lt; IDENTIFIER & gt; {...} & lt; DOUBLE_COLON & gt;))?    

No comments:

Post a Comment