[
https://issues.apache.org/jira/browse/LUCENE-5806?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14054255#comment-14054255
]
Jack Conradson commented on LUCENE-5806:
----------------------------------------
If you want to normalize the tokens on-the-fly you can actually write a small
java snippet right into the grammar.
An example of this would be the following which removes both the single quote
characters from a string inline. The syntax should be in one of your books for
this ;).
STRING
@after
{
setText(getText().substring(1, getText().length() - 1).replace("\\\\",
"\\").replace("\\'", "'"));
}
: '\'' STRINGCHAR* '\''
;
The other option to consider would be not skipping over whitespace but actually
inserting WS!? (where the '!' removes the WS token from the parse tree tokens)
throughout the grammar for finer control. This may be beyond the scope of this
JIRA, though, and would potentially prevent something like " doc[ 'foo' ].value
" altogether. I'm not sure whether or not this is actually allowed in
JavaScript.
> Extend expression grammar to allow advanced "variables"
> -------------------------------------------------------
>
> Key: LUCENE-5806
> URL: https://issues.apache.org/jira/browse/LUCENE-5806
> Project: Lucene - Core
> Issue Type: Bug
> Reporter: Ryan Ernst
> Attachments: LUCENE-5806.patch, LUCENE-5806.patch
>
>
> We currently allow dots in "variable" names in expressions, so that we can
> fake out object access. We should extend this to allow array access as well
> (both integer and string keys). This would allow faking out full object
> nesting through bindings.
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]