metarhia / JSQL

JavaScript Query Language
https://metarhia.com
25 stars 1 forks source link

AST parsers #4

Closed DzyubSpirit closed 8 years ago

DzyubSpirit commented 8 years ago

Added examples of parsing with esprima and recast. Target is remove all && clauses that contains check for equality some field of argument object for the any literal. Also it is need to return key - value pairs that algorithm found. Esprima can parse to AST but can not create source back from changed tree. Recast can do that because it saves information about locations(row and column of start and end) in the ast that it produces.