Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • S sweet-core
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 62
    • Issues 62
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 4
    • Merge requests 4
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • sweet-js
  • sweet-core
  • Issues
  • #128
Closed
Open
Issue created Nov 21, 2013 by Administrator@rootContributor

Let-defined punctuator macros parse inconsistently

Created by: dfreeman

Really happy to see a fix for #125 (closed) has gone in, but now that the let-defined punctuator macro definitions will parse, it looks like there are still some cases where their application is a problem.

As defined here, ^ behaves as the identity in all three cases:

macro ^ { rule { $x } => { $x } }

var a1 = ^ 1;           // => 1
var a2 = (^ 1);         // => 1
var a3 = { key: ^ 1 };  // => { key: 1 }

Defined with let, however, an error is thrown for the second two cases:

let ^ = macro { rule { $x } => { $x } }

var a1 = ^ 1;           // => 1
var a2 = (^ 1);         // => Error: Line 4: Unexpected token ^
var a3 = { key: ^ 1 };  // => Error: Line 5: Unexpected token ^

If the macro is given a regular JS identifier for a name, everything works as expected regardless of whether let is used.

Assignee
Assign to
Time tracking