expand
Version, currently 0.14.1.33 versions
- 0.14.1.3latestMar 22, 2016
- 0.13.0.3not indexedMar 22, 2016
- 0.13.0.2not indexedMar 22, 2016
github.com/waterlink/expand.cr
Crystal tool for macro debugging. Allows one to expand macro recursively.
6 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
expand:
github: waterlink/expand.cr
version: ~> 0.14.1.3Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- Oleksii Fedorov <waterlink000@gmail.com>
Dependencies
This version declares no dependencies.
README
# expand
Crystal macro debugging tool.
## Installation
Add this to your application's `shard.yml`:
```yaml
development_dependencies:
expand:
github: waterlink/expand.cr
version: ~> 0.13.0
```
`version` should be always `~> YOUR_CRYSTAL_VERSION`. If you need to lock to
concrete version of `expand` tool: `version: YOUR_CRYSTAL_VERSION.N`, where N
is the specific version of `expand` tool, for example: `version: 0.13.0.3`.
And run `shards install`. This will download all required dependencies and
install the tool. Additionally, it installs its own binary to `./bin` directory
of your project (it is created automatically if it doesn't exist) as
`./bin/expand`.
NOTE: first build of `./bin/expand` tool will take some time and about 1 GB of
RAM, since it actually builds a crystal compiler under the hood.
## Usage
### Check the version of `expand`
```bash
$ ./bin/expand --version
0.13.0.3
```
### Expand source code of the file
Given file `example.cr`:
```crystal
macro a
"a macro"
end
macro b
a
"b macro"
end
macro c
b
a
"c macro"
end
c
```
When we run:
```bash
$ ./bin/expand /path/to/example.cr
macro a
"a macro"
end
macro b
a
"b macro"
end
macro c
b
a
"c macro"
end
"a macro"
"b macro"
"a macro"
"c macro"
```
Notice, how `c` macro call has been recursively expanded.
That is very useful to debug nested macros.
## Development
### Running tests
TODO: setup regression tests (collection of example files
and the expected expanded output).
### How version is structured?
There are 2 files controlling the version:
- `src/CRYSTAL_VERSION` - version of embedded crystal
compiler, should match user's crystal version
- `src/EXPAND_VERSION` - a single-numbered version, always
increases (even if `CRYSTAL_VERSION` changes). Required
for delivering new versions (features, bug-fixes, etc.)
for the same compiler version.
Final version of the tool is
`${CRYSTAL_VERSION}.${EXPAND_VERSION}`. That is what used in
`shard.yml`'s `version` field and as a part of git tag for a
release.
### To build expand in development
```bash
cd src
./build.sh
../../bin/expand --version
```
## Contributing
1. Fork it ( https://github.com/waterlink/expand.cr/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request
## Contributors
- [waterlink](https://github.com/waterlink) Oleksii Fedorov - creator, maintainer
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.14.1.3- Tagged
- Mar 22, 2016
- Commit
f998b3da3807- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/waterlink/expand.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 14, 2026
- Synced
- Aug 14, 2026
- Versions
- 3