admin管理员组

文章数量:1330566

I am developing an html/javascript app which allows users to search in a local database. I would like to support very advanced search queries like: abc | "def ghi" !jkl

I need to parse this kind of plex expressions in order to build the corresponding SQL query.

So, what I am looking for is a flexible parser written in javascript and it should let me define my expression grammar.

I am developing an html/javascript app which allows users to search in a local database. I would like to support very advanced search queries like: abc | "def ghi" !jkl

I need to parse this kind of plex expressions in order to build the corresponding SQL query.

So, what I am looking for is a flexible parser written in javascript and it should let me define my expression grammar.

Share Improve this question asked Mar 8, 2011 at 16:36 aartilesaartiles 1,4894 gold badges16 silver badges31 bronze badges 3
  • Check out the Sizzle source sizzlejs., might find some useful stuff in there. – Loktar Commented Mar 8, 2011 at 16:38
  • 1 Are your users going to be technically savvy enough to understand this syntax? or would you be better off with "regular" keywords or a specialized form/wizard? – scunliffe Commented Mar 8, 2011 at 16:40
  • I need to support the sphinx extended syntax since this is what I support on the online version sphinxsearch./docs/current.html#extended-syntax – aartiles Commented Mar 8, 2011 at 23:49
Add a ment  | 

2 Answers 2

Reset to default 7

pegJS : http://pegjs.majda.cz/ should also do the trick.

Jison is a JavaScript parser generator, written in JavaScript.

And yes, it is really flexible and lets you define your own grammar.

本文标签: parsingSearch expressions parser written in javascriptStack Overflow