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
  • #200
Closed
Open
Issue created Jan 14, 2014 by Administrator@rootContributor

Multi token names are eating tokens

Created by: natefaubion

macro -> {
  rule infix { $arg:ident | $body:expr } => {
    function($arg) { return $body }
  }
}

var a = x -> x - 1;
var b = x -> x + 2;
var c = x -> x - 3;
var a$305 = function (x$313) {
    return -1;
};
var b$307 = function (x$314) {
    return x$314 + 2;
};
var c$309 = function (x$315) {
    return -3;
};

Likewise, if I were to change it to +> it would eat the identifier for the plus fn:

macro +> {
  rule infix { $arg:ident | $body:expr } => {
    function($arg) { return $body }
  }
}

var a = x +> x - 1;
var b = x +> x + 2;
var c = x +> x - 3;
var a$305 = function (x$313) {
    return x$313 - 1;
};
var b$307 = function (x$314) {
    return +2;
};
var c$309 = function (x$315) {
    return x$315 - 3;
};
Assignee
Assign to
Time tracking