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
  • #335
Closed
Open
Issue created Jun 03, 2014 by Administrator@rootContributor

repeated pattern group can't be used

Created by: jlongster

macro foo {
  rule { $($prop:ident = $val) ... } => {
    { $($prop: $val) (,) ... }
  }
}

foo bar=3 biz=2

This throws the following error. I'm pretty sure it's a bug. I'm hacking around in patterns.js to fix this, but I'm a little lost. The $prop variable seems to have 3 matches for some reason (the third being an empty array?), and $val has 2.

% ./bin/sjs test.js

/Users/james/projects/sweet.js/lib/sweet.js:101
                    throw err;
                          ^
Error: ASSERT: all non-scalars must have the same length
    at assert (/Users/james/projects/sweet.js/lib/syntax.js:17:19)
    at /Users/james/projects/sweet.js/lib/patterns.js:737:21
    at Array.reduce (native)
    at Function._.reduce._.foldl._.inject (/Users/james/projects/sweet.
js/node_modules/underscore/underscore.js:110:28)                      
    at wrapper.(anonymous function) [as reduce] (/Users/james/projects/
Assignee
Assign to
Time tracking