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
  • Merge requests
  • !465

Automatic Macro Refactoring (Macrofication)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/levjj/reverse-matching into master Mar 26, 2015
  • Overview 3
  • Commits 16
  • Pipelines 0
  • Changes 18

Created by: levjj

For rule macros, it is possible to automatically refactor code with macros by using the template (body of the rule macro) to match syntax and replace it with the corresponding macro invocation based on the pattern. This pull request adds support for this type of "macrofication" refactoring. In order to use this features, I added a command line flag (-r) and integrated the refactoring into the sweet.js editor. Using the editor is definitely the preferred way of refactoring as it highlights the code and let's you chose which code to replace by a macro:

letall

The macrofication option in the editor is off by default but seems to work pretty good. Limitations are some special kind of "expr" pattern classes and locally scoped macro definitions. Also, the highlighting is mutually exclusive with the expansion highlighting due to a limitation in CodeMirror. The only way around this problem would be to write some extension to CodeMirror that supports multiple syntax highlighters at the same time.

This pull request is based on the patch for supporting repeated variables: #540.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/levjj/reverse-matching