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
  • #88
Closed
Open
Issue created Aug 27, 2013 by Administrator@rootContributor

help with macro

Created by: jlongster

I doubt this is a bug, but I'd like some help. I'm writing a macro that iterates through statements and will do stuff to them; for now, I'm just trying to get it to iterate through the statements.

macro _unroll {
    case ($stmt $rest ...) => {
        $stmt
        _unroll($rest ...)
    }
    case () => {
    }
}

macro async {
    case { $stmt ... } => {
        _unroll($stmt ...)
    }
}

async {
    var x = 5;
    var y = 5;    
}

This throws an error though:

/usr/local/lib/node_modules/sweet.js/lib/parser.js:3117
            throw e$320;
                  ^
Error: Line 112: Unexpected token ;
    at throwError (/usr/local/lib/node_modules/sweet.js/lib/parser.js:984:24)
    at throwUnexpected (/usr/local/lib/node_modules/sweet.js/lib/parser.js:1033:9)
    at expect (/usr/local/lib/node_modules/sweet.js/lib/parser.js:1038:13)
    at parsePrimaryExpression (/usr/local/lib/node_modules/sweet.js/lib/parser.js:1264:13)
    at parseLeftHandSideExpressionAllowCall (/usr/local/lib/node_modules/sweet.js/lib/parser.js:1382:56)
    at parsePostfixExpression (/usr/local/lib/node_modules/sweet.js/lib/parser.js:1414:24)
    at parseUnaryExpression (/usr/local/lib/node_modules/sweet.js/lib/parser.js:1469:16)
    at parseMultiplicativeExpression (/usr/local/lib/node_modules/sweet.js/lib/parser.js:1472:24)
    at parseAdditiveExpression (/usr/local/lib/node_modules/sweet.js/lib/parser.js:1484:24)
    at parseShiftExpression (/usr/local/lib/node_modules/sweet.js/lib/parser.js:1496:24)

What am I doing wrong?

Assignee
Assign to
Time tracking