Skip to content

Releases: Alligator/jqawk

0.6.1

04 Dec 21:14

Choose a tag to compare

No new features are in this release, but assignment statement (a = 1, a += 1, a++) parsing and evaluation has been rewritten.

0.6.0

19 Sep 08:46

Choose a tag to compare

New Features

  • Key order is maintained when reading and writing objects (aa01981)
  • Reinstated iterating over objects as root values (88c4979)
  • Added object.pairs() (38d8719)
  • Functions can be defined anywhere, and are first-class (a942aee, 9c4f893)
  • array.sort() can take a sort function argument (a942aee)
  • Added number.format() (582adba)
  • Parsing continues after an error (27fc6d2)

Bugfixes

  • Fixed negative indexing on strings (83ff9c6)

0.5.9

15 May 16:01

Choose a tag to compare

New Features

Bugfixes

  • Fix x is function expressions (26e67dd)
  • Limit the max width in printf specifiers (6073aaa)

0.5.8

06 Jan 21:04

Choose a tag to compare

New Features

  • Added BEGINFILE and ENDFILE rules (d3b4a1e)
  • Added number.floor(), number.ceil() and number.round() methods (9b7a67e)
  • The root selector flag can be set multiple times (7debf99)
  • Newline separate JSON (jsonl) is now supported (81e9d61)
    • This means jqawk can now be used to process a stream of JSON documents in real time

0.5.6

16 Aug 00:10

Choose a tag to compare

New Features

  • Arrays can be indexed with negative numbers, to count backwards from the end of the array (06b59fa)
  • Added a new is operator for type checking (86afa55)
    • e.g. if (myValue is bool) print 'bool';
    • Valid type names are string, bool, number, array, object, function, regex and unknown
  • Added an array.sort() method (a084958)
    • If the array contains only numbers, it will be sorted numerically. If it contains anything that isn't a number, all values are converted to strings before sorting

Bugfixes

  • Implicitly creating an array containing an object now works (d0be3e4, 82d7722)
    • e.g. a[0].thing = 2 where a is not defined
  • Array literals, object literals and function calls now copy primitives by value, instead of by reference (26c0305)
  • Stop array.pop() and array.popfirst() panicking on empty arrays (b0ef491)
  • num() now returns null instead of panicking if it can't parse a number (b0ef491)
  • Stopped the cli panicking if it's run with no arguments (912ed03)

0.5.5

19 Feb 00:52

Choose a tag to compare

Breaking changes

  • int() has been replaced by num()
  • return can only appear inside a function
  • break and continue can only appear inside loops
  • There's now a max call depth of 4096

Bug fixes

Lots of bugs found by the fuzzer.

  • Arrays, objects and functions are now truthy (67907c3)
  • null on either side a comparison actually works (f894988, fa41ccb)
  • Numbers are parsed as floats instead of integers (30d279c)
  • ++ and -- operators now implicitly create objects and arrays (9785296)
  • printing an object containing a circular reference not to the root object no longer causes a stack overflow (7eb0056)
  • %v in printf now checks for missing arguments (7082bf5)

0.5.4

11 Feb 23:21

Choose a tag to compare

New features

  • Multiple files can be passed to jqawk
    • All rules except BEGIN and END will run for each file
  • null is now a keyword
    • Comparisons like $.a != null now work

Breaking changes

  • $ is no longer set in BEGIN and END rules
    • These rules now run before and after processing any JSON

0.5.3

03 Jan 16:22

Choose a tag to compare

New features

  • Arrays are implicitly created if an unknown variable is indexed with a number
  • Object chain can be implicity created
    • If a is unknown, a.b.c.d = 4 will create a and all the intervening objects
  • Added the exit statement, which immediately exits the program

0.5.2

19 Apr 21:25

Choose a tag to compare

New features

  • Added string.upper() and string.lower()
  • Added object.pluck()

Bug fixes

  • An argument count mismatch in a native function now causes a runtime error instead of a panic
  • Printing or json()-ing an object with circular references no longer panics
  • -dbg-lex shows a regex as one token, instead of a sequence of tokens

Other changes

What can appear on the left-hand side of an assignment is now restricted. The following cannot appear:

  • Literals
  • Arrays
  • Objects
  • Binary expressions, except property (a.b) and index (a[b]) expressions

0.5.1

23 Mar 10:36

Choose a tag to compare

New features

  • Jqawk can run with no input. e.g. jqawk 'BEGIN { print "hello, world" }'
  • Width specifiers in printf
  • -version flag

Bug fixes

  • A few things are now runtime errors instead of go panics:
    • Divide by zero with / and % operators
    • Parsing a number bigger than an int64
    • A single \ at the end of a string
    • An invalid regex
  • Assignment from a regex no longer panics
  • Assignment from an unknown value no longer panics