Skip to content

Releases: sweet-js/sweet-core

Version 3.0.1

17 Apr 02:33
Compare
Choose a tag to compare

Bug fixes

  • fix interaction between binary and postfix custom operators #680

Version 3.0.0

10 Apr 04:24
Compare
Choose a tag to compare

Breaking changes:

  • places in a macro where you used to get a Syntax you now get Term
    • ctx.next().value is a Term instead of a TermOrSyntaxWrapper
    • indexing a syntax template gets a RawSyntax instead of a Syntax
  • ctx.contextify() new method instead of .inner() method on the wrapper
  • compile now takes a path and loader instead of just the source to compile

New Features:

  • custom operators
  • helper library
  • readtables
    • internal only, not exposed to macro authors yet
  • recursive module loading
  • console/process added to syntax scope in node
  • loader API

And lot's of bug fixes.

More details in the announcement.

Version 2.2.1

05 Sep 01:40
Compare
Choose a tag to compare

Bug fixes

Version 2.2.0

22 Aug 00:29
Compare
Choose a tag to compare

New Features

Bug fixes

  • ASI bug #579
  • missing line numbers #569
  • enforce node version #563
  • error in error #573
  • expansion in blocks #568
  • various doc fixes

2.1.0

07 Aug 05:24
Compare
Choose a tag to compare

Additions

Includes #566 which allows programmatic construction of syntax objects in macros:

syntax to_str = ctx => {
  let argStr = ctx.next().value.val();
  let dummy = #`here`.get(0);

  return #`${dummy.fromString(argStr)}`;
}
let s = to_str foo
// expands to:
// let s = 'foo'

2.0.0

02 Jul 20:18
Compare
Choose a tag to compare

Breaking Changes

The macro context API has changed. Before you could call ctx.next('expr') to expand until an expression was matched but now this has been separated out into the expand method. The expand method now also understands a lot more grammar productions:

  • Statement with alias stmt
  • AssignmentExpression with alias expr
  • Expression
  • BlockStatement
  • WhileStatement
  • IfStatement
  • ForStatement
  • SwitchStatement
  • BreakStatement
  • ContinueStatement
  • DebuggerStatement
  • WithStatement
  • TryStatement
  • ThrowStatement
  • ClassDeclaration
  • FunctionDeclaration
  • LabeledStatement
  • VariableDeclarationStatement
  • ReturnStatement
  • ExpressionStatement
  • YieldExpression
  • ClassExpression
  • ArrowExpression
  • NewExpression
  • ThisExpression
  • FunctionExpression
  • IdentifierExpression
  • LiteralNumericExpression
  • LiteralInfinityExpression
  • LiteralStringExpression
  • TemplateExpression
  • LiteralBooleanExpression
  • LiteralNullExpression
  • LiteralRegExpExpression
  • ObjectExpression
  • ArrayExpression
  • UnaryExpression
  • UpdateExpression
  • BinaryExpression
  • StaticMemberExpression
  • ComputedMemberExpression
  • AssignmentExpression
  • CompoundAssignmentExpression
  • ConditionalExpression

In addition, the macro context now has a reset method that resets the iterator. The interface is now:

TransformerContext = {
  name: () -> Syntax
  next: () -> {
    done: boolean,
    value: Syntax
  }
  expand: (string) -> {
    done: boolean,
    value: Syntax
  }
  reset: () -> undefined
}

Modules and Phasing

13 Jun 01:28
Compare
Choose a tag to compare

This is the first release with support for phases!

// log.js
#lang 'sweet.js';

export function log(msg) {
  console.log(msg);
}
// main.js
import { log } from './log.js' for syntax;

syntax m = ctx => {
  log('doing some Sweet things');
  // ...
}

Phasing is currently only supported for modules with the #lang 'sweet.js' pragma.

More details in the tutorial.

1.0.2

07 May 18:15
Compare
Choose a tag to compare
v1.0.2

1.0.1 -> 1.0.2

v1.0.0

27 Mar 19:52
Compare
Choose a tag to compare
1.0.0-pre.5 -> 1.0.0

v0.7.8

27 Mar 19:37
Compare
Choose a tag to compare
bump version