Skip to content

Commit e332ab0

Browse files
committed
Fix parsing error for large integers
The jansson library used by the new JSON support powered by libjansson fails on large integers. A few of the Exercism exercises feature large integers in the expected test data. There is an upstream issue: akheron/jansson#69 The built-in json parsing written in Emacs Lisp doesn't have that problem. Since we won't run into performance issues this is a good solution for this tool. See https://emacs.stackexchange.com/questions/76530/json-parsing-fails-json-parse-error-too-big-integer/ for more info
1 parent 0842aef commit e332ab0

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

tools/practice-exercise-generator.el

+5-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44

55
;;; Code:
66

7-
(unless (json-available-p)
8-
(error "Emacs needs to be built with JSON support"))
9-
107
(exercism//install-required-packages)
118

129
(require 'mustache)
@@ -24,7 +21,11 @@
2421

2522
(with-temp-buffer
2623
(exercism//load-canonical-data exercise-slug)
27-
(let ((canonical-data (json-parse-buffer)))
24+
(goto-char 1)
25+
(let* ((json-object-type 'hash-table)
26+
(json-key-type 'string)
27+
(canonical-data (json-read))
28+
(functions (exercism//retrieve-functions canonical-data)))
2829
;; TODO(FAP): adjust meta config - currently depends on jq
2930
(exercism//generate-solution-stubs exercise-slug canonical-data)
3031
;; TODO(FAP): generate full test implementations, not just stubs

0 commit comments

Comments
 (0)