Skip to content

Releases: ReFreezed/DumbLuaParser

Version 2.3

23 Jun 18:15
Compare
Choose a tag to compare

Changes since 2.2

Version 2.2

02 Jun 20:39
Compare
Choose a tag to compare

Changes since 2.1

  • Added function isStatement().
  • Fixed updateReferences() not always updating all references properly (which sometimes broke minify()).
  • Fixed backslashes in string literals not being outputted as \\.
  • LuaJIT: Fixed validateTree() reporting 64-bit integers as invalid literal values.

Version 2.1

03 Sep 15:38
Compare
Choose a tag to compare

Changes

  • Added functions: parseExpression(), valueToAst(), validateTree(), isExpression(), newNodeFast().
  • Added AST node fields: AstNode.pretty, AstNode.prefix, AstNode.suffix.
  • tokenize(): Added option to keep whitespace tokens (which is a new token type).
  • toLua(): Added nodeCallback argument.
  • toLua(): Outputting less parentheses around some binary expressions.
  • toLua(): Fixed invalid output of immediately invoked function expressions and similar expressions.
  • toLua(): Fixed "." not always being always being considered when inserting spaces (e.g. for x .. ...).
  • TableField.key is now optional if TableField.generatedKey is true.
  • Fixed _ENV getting minified in Lua 5.2+.
  • Fixed parsing error for chunks ending in return statements without values.

Version 2.0

19 Jun 13:07
Compare
Choose a tag to compare

This version is not compatible with earlier versions!

Changes

Major Changes

  • Added support for Lua 5.4 and LuaJIT.
  • Added functions: simplify(), optimize(), minify().
  • Tokens are now represented by individual tables. Token streams are now simple arrays of tokens.
  • Changed AstIdentifier.declaration to point to the declared identifier instead of the parent declaration/function/for loop.
  • Changed AstLabel.name and AstGoto.name to be strings instead of identifiers.
  • Removed AstFunction.vararg. (Any vararg parameter is now at the end of AstFunction.parameters.)
  • Parsing and tokenizing functions no longer print anything on error - they only return the message (which now includes more information).
  • toLua() no longer prints anything on error - instead it returns the message.

Added

  • Added support for binary number notation 0b1101001 (from LuaJIT).
  • Added special parsing rules for n/0.
  • Added AST functions: cloneNode(), cloneTree(), traverseTreeReverse(), getChild(), setChild(), addChild(), removeChild().
  • Added token functions: concatTokens(), newToken().
  • Added function formatMessage().
  • Added AST node fields: AstVararg.declaration, AstGoto.label, AstIdentifier.attribute.
  • Added more common fields to AST nodes.
  • Added argument leavesFirst to traverseTree().
  • Added argument attributeName to newNode("identifier").
  • Added argument updateTopNodePosition to updateReferences().
  • Added parser settings: printIds, printLocations, indentation, constantNameReplacementStringMaxLength.
  • Added parser constants: INT_SIZE, MAX_INT, MIN_INT.
  • Added internal fallback parser for string values so features added in later Lua versions are supported in all versions.
  • LuaJIT: Support numeral suffixes LL, ULL and i.

Changed

  • break statements are allowed in the middle of blocks (according to Lua 5.2).
  • -0 is no longer normalized to 0 in Lua 5.2 and earlier (except by simplify()) to match Lua's behavior.
  • newNode("label") and newNode("goto") now require a labelName argument.
  • Renamed parse(path) function variant to parseFile().
  • The path argument for parse(luaString) function variant is now optional.
  • Renamed tokenizeString() to tokenize() (to follow the same naming scheme as parse() and parseFile()).
  • toLua(): Improved string literal output.
  • toLua(): Integers gets outputted as integers (as opposed to floats with scientific notation) in more cases.
  • Updated "malformed number" error detection.
  • Parsing: Improved location information for blocks and functions.
  • Whitespace is no longer trimmed from comment tokens.
  • Improved error messages.

Removed

  • Removed functions: newTokenStream() (use {} instead), insertToken() (use table.insert() instead), removeToken() (use table.remove() instead).

Fixed

  • Fixed toLua() outputting expressions like - -x as --x.
  • Fixed print functions printing unprintable/"bad" characters in strings.
  • Fixed the location in a syntax error message.
  • Fixed questionable handling of newlines in single-line comment tokens.

Repository

Version 1.2.1

01 Jun 14:40
Compare
Choose a tag to compare

Changes:

  • Fixed lookups and calls that shouldn't parse, like "":sub().

Version 1.2

12 May 22:57
Compare
Choose a tag to compare

Changes:

  • Added parser.updateReferences().
  • Changed arguments for parser.traverseTree() and the callback.
  • Fixed parsing of consecutive unary operations.