开发者

Build, syntax-check, parse and evaluate a query

I am building a query in a textarea with different conditions selected from the html controls. Also users are open to do modification to it.

Client side: Fo开发者_开发知识库r the below list of condition:

a(1, 3) > 20
b(4, 5) < 90
c(3, 0) = 80

I form a query:

a(1, 3) > 20 and b(4, 5) < 90 or c(3, 0) = 80

On the server side this has to be parsed, lookup and call each function with arguments. (a, b and c are the functions)

I want to check for the query syntax (not sure at the client side or the server side) before processing it. For example if the user enters incorrect function / arguments or they use incorrect operators.

Appreciate your suggestions and feedback.

PS: Using python


PLY has a simple expression example that will get you most of the way there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜