1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00
This commit is contained in:
Stephen Dolan
2013-05-05 22:59:46 +01:00
parent a49402c53a
commit c1748fa633
2 changed files with 9 additions and 6 deletions

View File

@@ -53,11 +53,9 @@ static void run_jq_tests() {
tests++;
struct bytecode* bc = jq_compile(buf);
if (!bc) {invalid++; continue;}
#if JQ_DEBUG
printf("Disassembly:\n");
dump_disassembly(2, bc);
printf("\n");
#endif
fgets(buf, sizeof(buf), testdata);
jv input = jv_parse(buf);
if (!jv_is_valid(input)){ invalid++; continue; }

13
main.c
View File

@@ -57,6 +57,9 @@ enum {
NO_COLOUR_OUTPUT = 128,
FROM_FILE = 256,
/* debugging only */
DUMP_DISASM = 2048,
};
static int options = 0;
static struct bytecode* bc;
@@ -180,6 +183,8 @@ int main(int argc, char* argv[]) {
options |= PROVIDE_NULL;
} else if (isoption(argv[i], 'f', "from-file")) {
options |= FROM_FILE;
} else if (isoption(argv[i], 0, "debug-dump-disasm")) {
options |= DUMP_DISASM;
} else if (isoption(argv[i], 'h', "help")) {
usage();
} else if (isoption(argv[i], 'V', "version")) {
@@ -213,10 +218,10 @@ int main(int argc, char* argv[]) {
}
if (!bc) return 1;
#if JQ_DEBUG
dump_disassembly(0, bc);
printf("\n");
#endif
if (options & DUMP_DISASM) {
dump_disassembly(0, bc);
printf("\n");
}
if (options & PROVIDE_NULL) {
process(jv_null());