Skip to content

v0.3.1

Latest
Compare
Choose a tag to compare
@fstirlitz fstirlitz released this 03 Jun 15:15
· 11 commits to master since this release

This is mostly a maintenance release addressing mistakes made while releasing version 0.3.0. You are encouraged to use this release as a complete drop-in substitute for 0.3.0 and pretend the latter was never made.

A belated changelog

BREAKING CHANGES

  • String literal nodes will by default no longer contain the raw, unescaped contents of the represented string. This feature was never very reliable in previous versions, so I consider it barely a regression at all. To be able to interpret string contents, you need to use the encodingMode option that specifies how 16-bit code units of the JavaScript strings that constitute the input to luaparse correspond to bytes of the actual Lua source code.
  • The inParens field of some syntax nodes has been removed. It was never documented or intended to be a stable interface, but was relied on some outside packages nevertheless. Future release may add back an indication that an expression was parenthesised; follow issue #79 for mode details.

New features since 0.2.1:

  • Luaparse now allows specifying the Lua version targetted by the parsed code, via the luaVersion option; this is useful when the code uses constructs that are parsed differently between versions. Support for versions 5.1, 5.2, 5.3 and the LuaJIT dialect of 5.1/5.2 (issue #92, PR #57, PR #97) have been added.
  • Luaparse now allows identifiers to contain characters outside the ASCII range. This is an experimental feature and may change in future releases in backwards-incompatible ways; it must be explicitly enabled by the extendedIdentifiers option. (issue #53)
  • The onLocalDeclaration callback has been added, invoked when a new variable binding is added to the current scope. (PR #38)

Bugs fixed since 0.2.1:

  • Locations of long string literals have been corrected. (issue #36, PR #37)
  • PrefixExpression location ranges have been corrected. (issue #47, issue #48)
  • Newlines between and an opening parenthesis are detected as errors in Lua 5.1 mode. (issue #55)
  • Locations of multiline literals containing consecutive EOL characters have been fixed. (issue #58)
  • Break statements that appear outside loops are now detected as errors. (issue #70)
  • Unterminated string literals are now detected as errors. (issue #45, issue #73)
  • Vararg expressions outside vararg functions (and blocks) now generate parse errors. (issue #74)
  • The CLI tool will now report errors generated during parsing. (issue #80)

Changes made specifically in 0.3.1:

  • The type of exception thrown by luaparse at parsing errors has been exposed as luaparse.SyntaxError. This is currently the same object as the engine’s built-in SyntaxError, but a future breaking release may make it no longer the case. (see also issue #67) Users are encouraged to use the instanceof operator against the exported object and not the built-in one.
  • The annotated source code generated by docco has been removed. (This is merely a documentation change, and thus non-breaking.)
  • Support for the Bower package manager has been dropped. (Since this isn’t a change to the library interface itself, I consider this non-breaking as well.)