Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync jparse one more time before freeze #1001

Merged
merged 6 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
# Major changes to the IOCCC entry toolkit


## Release 1.5.25 2024-10-09

Synced `jparse` from [jparse repo](https://github.com/xexyl/jparse/). This
includes better (additional) testing of JSON encoding/decoding ('Beware of the
<del>dragon</del> [fire
drake](https://www.glyphweb.com/arda/f/firedrakes.html)!' :-) ), a new version
string (UTF-8 version, which is now also displayed in the tools in this repo, as
it also helps identify if there is a mismatch in versions in bug reporting or
something else), amongst various other things. Should one wish to further
progress their dementia! :-) they can look at that repo's log or the
jparse/CHANGES.md file.


## Release 1.5.24 2024-10-09

Synced `jparse` from [jparse repo](https://github.com/xexyl/jparse/). This
Expand Down
8 changes: 5 additions & 3 deletions chkentry.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ static const char * const usage_msg =
" >=10\tinternal error\n"
"\n"
"%s version: %s\n"
"JSON parser version: %s";
"jparse UTF-8 version: %s\n"
"jparse library version: %s";


/*
Expand Down Expand Up @@ -119,7 +120,7 @@ usage(int exitcode, char const *prog, char const *str)
fprintf_usage(DO_NOT_EXIT, stderr, "%s\n", str);
}
fprintf_usage(exitcode, stderr, usage_msg, prog, DBG_DEFAULT, JSON_DBG_DEFAULT,
CHKENTRY_BASENAME, CHKENTRY_VERSION, JSON_PARSER_VERSION);
CHKENTRY_BASENAME, CHKENTRY_VERSION, JPARSE_UTF8_VERSION, JPARSE_LIBRARY_VERSION);
exit(exitcode); /*ooo*/
not_reached();
}
Expand Down Expand Up @@ -195,7 +196,8 @@ main(int argc, char *argv[])
break;
case 'V': /* -V - print version and exit */
print("%s version: %s\n", CHKENTRY_BASENAME, CHKENTRY_VERSION);
print("JSON parser version: %s\n", JSON_PARSER_VERSION);
print("jparse UTF-8 version: %s\n", JPARSE_UTF8_VERSION);
print("jparse library version: %s\n", JPARSE_LIBRARY_VERSION);
exit(2); /*ooo*/
not_reached();
break;
Expand Down
22 changes: 22 additions & 0 deletions jparse/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Significant changes in the JSON parser repo

## Release 1.2.1 2024-10-10

Add option `-F` to `test_jparse/jparse_test.sh` which means that files passed on
the command line should be read as actual full JSON documents, rather than JSON
blobs per line. In this case `stdin` is **NOT** read! The file `jparse.json` is
now controlled this way.

Added new function `jdecencchk()` to `json_parse.c` which `jstrencode` and
`jstrdecode` use with the `-t` option. Beware of the dragon!

Changed `JSON_PARSER_VERSION` to `JPARSE_LIBRARY_VERSION`.

The `-V` and `-h` option of all tools (compiled tools, not scripts) now show the
jparse UTF-8 version as well as the tool's version and the library version. The
string format of the library version has been changed too (it now shows:
`"jparse library version: %s"`).

Improve the way `utf8len()` works. It now returns a `size_t` and the `size_t
*bytes` was removed from it. Returns `-1` if an error occurs. This better fits
the name and purpose of the function.


## Release 1.2.0 2024-10-09

Remove `has_nul` in `struct json_string` as UTF-8 should, it is my
Expand Down
2 changes: 1 addition & 1 deletion jparse/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -1306,4 +1306,4 @@ jstrencode.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h \
util.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h ../dyn_array/dyn_array.h \
util.c util.h
verge.o: ../dbg/dbg.h ../dyn_array/../dbg/dbg.h ../dyn_array/dyn_array.h \
util.h verge.c verge.h version.h
json_utf8.h util.h verge.c verge.h version.h
12 changes: 6 additions & 6 deletions jparse/jparse.l
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@

/* Section 0: Declarations and option settings */
/*
* %option noyywrap prevents needing to link in the flex(1) library (flex(3)) which means those
* without flex can compile the code. Even if everyone had flex(1), though, under
* macOS you have to pass -ll to the compiler to link in the flex library
* whereas in other systems you have to use -lfl which would cause a lot of
* problems. Another way is to provide 'int yywrap() { return 1; }' but this is
* unnecessary.
* %option noyywrap prevents needing to link in the flex(1) library (flex(3))
* which means those without flex can compile the code. Even if everyone had
* flex(1), though, under macOS you have to pass -ll to the compiler to link in
* the flex library whereas in other systems you have to use -lfl which would
* cause a lot of problems. Another way is to provide 'int yywrap() { return 1;
* }' but this is unnecessary.
*/
%option noyywrap
/*
Expand Down
12 changes: 6 additions & 6 deletions jparse/jparse.ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -785,12 +785,12 @@ static const flex_int32_t yy_rule_can_match_eol[16] =
*/
/* Section 0: Declarations and option settings */
/*
* %option noyywrap prevents needing to link in the flex(1) library (flex(3)) which means those
* without flex can compile the code. Even if everyone had flex(1), though, under
* macOS you have to pass -ll to the compiler to link in the flex library
* whereas in other systems you have to use -lfl which would cause a lot of
* problems. Another way is to provide 'int yywrap() { return 1; }' but this is
* unnecessary.
* %option noyywrap prevents needing to link in the flex(1) library (flex(3))
* which means those without flex can compile the code. Even if everyone had
* flex(1), though, under macOS you have to pass -ll to the compiler to link in
* the flex library whereas in other systems you have to use -lfl which would
* cause a lot of problems. Another way is to provide 'int yywrap() { return 1;
* }' but this is unnecessary.
*/
/*
* we also need a few other options set:
Expand Down
2 changes: 1 addition & 1 deletion jparse/jparse.tab.ref.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ int jparse_debug = 0; /* 0 ==> verbose bison debug off, 1 ==> verbose bison debu
/*
* JSON parser library version
*/
const char *const json_parser_version = JSON_PARSER_VERSION; /* library version format: major.minor YYYY-MM-DD */
const char *const json_parser_version = JPARSE_LIBRARY_VERSION; /* library version format: major.minor YYYY-MM-DD */
const char *const jparse_version = JPARSE_VERSION; /* jparse version format: major.minor YYYY-MM-DD */


Expand Down
2 changes: 1 addition & 1 deletion jparse/jparse.y
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int jparse_debug = 0; /* 0 ==> verbose bison debug off, 1 ==> verbose bison debu
/*
* JSON parser library version
*/
const char *const json_parser_version = JSON_PARSER_VERSION; /* library version format: major.minor YYYY-MM-DD */
const char *const json_parser_version = JPARSE_LIBRARY_VERSION; /* library version format: major.minor YYYY-MM-DD */
const char *const jparse_version = JPARSE_VERSION; /* jparse version format: major.minor YYYY-MM-DD */

%}
Expand Down
9 changes: 5 additions & 4 deletions jparse/jparse_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ static const char * const usage_msg =
" >=4\tinternal error\n"
"\n"
"%s version: %s\n"
"JSON parser version: %s";
"jparse UTF-8 version: %s\n"
"jparse library version: %s";


/*
* static functions
*/
static void usage(int exitcode, char const *prog, char const *str) __attribute__((noreturn));


int
main(int argc, char **argv)
{
Expand Down Expand Up @@ -115,7 +115,8 @@ main(int argc, char **argv)
break;
case 'V': /* -V - print version and exit */
print("%s version: %s\n", JPARSE_BASENAME, JPARSE_VERSION);
print("JSON parser version: %s\n", JSON_PARSER_VERSION);
print("jparse UTF-8 version: %s\n", JPARSE_UTF8_VERSION);
print("jparse library version: %s\n", JPARSE_LIBRARY_VERSION);
exit(2); /*ooo*/
not_reached();
break;
Expand Down Expand Up @@ -224,7 +225,7 @@ usage(int exitcode, char const *prog, char const *str)
fprintf_usage(DO_NOT_EXIT, stderr, "%s\n", str);
}
fprintf_usage(exitcode, stderr, usage_msg, prog,
DBG_DEFAULT, json_verbosity_level, JPARSE_BASENAME, JPARSE_VERSION, JSON_PARSER_VERSION);
DBG_DEFAULT, json_verbosity_level, JPARSE_BASENAME, JPARSE_VERSION, JPARSE_UTF8_VERSION, JPARSE_LIBRARY_VERSION);
exit(exitcode); /*ooo*/
not_reached();
}
2 changes: 0 additions & 2 deletions jparse/jparse_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,4 @@
*/
#define JPARSE_BASENAME "jparse"



#endif /* INCLUDE_JPARSE_MAIN_H */
10 changes: 6 additions & 4 deletions jparse/jsemtblgen.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,9 @@ static const char * const usage_msg =
" 3\t\tcommand line error\n"
" >=10\tinternal error\n"
"\n"
"jsemtblgen version: %s"
"JSON parser version: %s\n";
"jsemtblgen version: %s\n"
"jparse UTF-8 version: %s\n"
"jparse library version: %s";


/*
Expand Down Expand Up @@ -302,7 +303,8 @@ main(int argc, char **argv)
break;
case 'V': /* -V - print version and exit */
print("%s version: %s\n", JSEMTBLGEN_BASENAME, JSEMTBLGEN_VERSION);
print("JSON parser version: %s", JSON_PARSER_VERSION);
print("jparse UTF-8 version: %s\n", JPARSE_UTF8_VERSION);
print("jparse library version: %s\n", JPARSE_LIBRARY_VERSION);
exit(2); /*ooo*/
not_reached();
break;
Expand Down Expand Up @@ -1525,7 +1527,7 @@ usage(int exitcode, char const *prog, char const *str)
fprintf_usage(DO_NOT_EXIT, stderr, "%s\n", str);
}
fprintf_usage(exitcode, stderr, usage_msg, prog,
DBG_DEFAULT, json_verbosity_level, JSEMTBLGEN_VERSION, JSON_PARSER_VERSION);
DBG_DEFAULT, json_verbosity_level, JSEMTBLGEN_VERSION, JPARSE_UTF8_VERSION, JPARSE_LIBRARY_VERSION);
exit(exitcode); /*ooo*/
not_reached();
}
Loading