I have had this thought regarding IDE support too. I've had expressions that when formatted for legibility are over 100 lines long, and adding something in the middle that changes indenting is truly painful at that point. At the moment I've got several irons in the fire already and can't possibly take that on. The current implementation (org.apache.solr.client.solrj.io.stream.expr.StreamExpressionParser) is hand coded, and not generated from a grammar. So one would probably want to correct that first so that syntax changes can be identified and adjusted in downstream syntax highlighters relatively easily. Unfortunately when I looked at this for Intellij briefly Intellij is favoring antlr, but javacc and jflex are what we tend to use in the solr codebase.
-Gus On Thu, Nov 12, 2020 at 7:02 AM ufuk yılmaz <[email protected]> wrote: > I wish something like this existed for streaming expressions. > > To have highlighting and validation in an editor would be great! > > > > Sent from Mail <https://go.microsoft.com/fwlink/?LinkId=550986> for > Windows 10 > > > > *From: *Scott Guthery <[email protected]> > *Sent: *11 November 2020 23:54 > *To: *[email protected] > *Subject: *Re: Lucene Query Parser Syntax Specification > > > > >> The source code is the de-facto specification > > > > Fair enough although it does beg the question of which parser source code, > there being no shortage of Lucene/Solr/etc. query parsers, parser releases, > and parser versions at github. Anyway, below is my de jure yacc. I think > it covers everything in the 2012 specification and rounds out the special > cases a little. > > > > Your comments are solicited and will be greatly appreciated. > > > > Cheers, Scott > > > > P.S. yacc/bison can generate parsers in programming languages other than > C including Java. > > > > query : query TOK_AND query > | query TOK_OR query > | TOK_NOT query > | '(' query ')' > | term > term: > > TOK_ALPHA | > > TOK_WILD | > TOK_ALPHA ':' TOK_ALPHA | > TOK_ALPHA ':' TOK_WILD | > TOK_ALPHA '~' | > TOK_ALPHA '~' TOK_NUM | > TOK_ALPHA '^' TOK_NUM | > TOK_ALPHA ':' TOK_ALPHA '~' | > TOK_ALPHA ':' TOK_ALPHA '~' TOK_NUM | > TOK_ALPHA ':' TOK_ALPHA '^' TOK_NUM | > '"' TOK_ALPHA TOK_ALPHA '"' '~' TOK_NUM | > TOK_ALPHA ':' '[' TOK_NUM TOK_TO TOK_NUM ']' | > TOK_ALPHA ':' '{' TOK_ALPHA TOK_TO TOK_ALPHA '}' | > '+'TOK_ALPHA | > '-'TOK_ALPHA > > > -- http://www.needhamsoftware.com (work) http://www.the111shift.com (play)
