最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

parsing - Search expressions parser written in javascript - Stack Overflow

programmeradmin2浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论