summaryrefslogtreecommitdiff
path: root/ast.c
Commit message (Collapse)AuthorAgeFilesLines
* treewide: replace jow@openwrt.org with jo@mein.ioJo-Philipp Wich2016-06-071-1/+1
| | | | Signed-off-by: Jo-Philipp Wich <jo@mein.io>
* Improve error reportingJo-Philipp Wich2014-06-181-11/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Keep track of the exact location the error occured in and switch the internal error description from a dynamic string buffer to an integer which either holds negative values for lexer errors or positives values for grammer violations. In case of grammer violations the "error_code" member will hold a bitfield describing the expected tokens. Also rework the error messages emitted by the cli to be more precise. Examples: $ jsonfilter -s '{}' -e '@.foo bar' Syntax error: Expecting End of file In expression @.foo bar Near here ----------^ $ jsonfilter -s '{}' -e '@.foo\bar' Syntax error: Unexpected character In expression @.foo\bar Near here ---------^ $ jsonfilter -s '{}' -e '@.foo..bar' Syntax error: Expecting Label or '*' In expression @.foo..bar Near here ----------^ Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
* Switch to sqlite3's lemon parser generator.Jo-Philipp Wich2014-06-151-0/+132
This commit drops the flex + bison code in favor to a hand-written lexer and a new grammar file in lemon syntax. The change results in a much smaller binary and easier to maintain code. Code required to build and maintain the AST has been split off into the ast.c and ast.h files. Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>