syntax
Version, currently 0.2.03 versions
- 0.2.1latestSep 28, 2019
- 0.2.0not indexedApr 9, 2020
- 0.1.0not indexedApr 9, 2020
github.com/omarroth/syntax.cr
Flexible syntax highlighter
6 stars
0 dependents
License: GPLv3
Nothing has been indexed for 0.2.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
syntax:
github: omarroth/syntax.cr
version: ~> 0.2.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.2.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
# syntax
[](https://github.com/omarroth/syntax.cr/releases)
> This is a project built with [marpa](https://github.com/omarroth/marpa).
Flexible syntax highlighter.
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
syntax:
github: omarroth/syntax.cr
```
## Usage
```crystal
require "syntax"
highlighter = Syntax::Highlighter.new
grammar = <<-'END_BNF'
# Grammar from https://metacpan.org/pod/distribution/Marpa-R2/pod/Semantics.pod
:start ::= Expression
Expression ::= Number
| '(' Expression ')' bgcolor => salmon
|| Expression '**' Expression bgcolor => red
|| Expression '*' Expression bgcolor => yellow color => black
| Expression '/' Expression bgcolor => green color => orange
|| Expression '+' Expression bgcolor => blue color => orange
| Expression '-' Expression bgcolor => cyan color => black
Number ~ [\d]+
:discard ~ whitespace
whitespace ~ [\s]+
END_BNF
input = "10 + (6 - 1 / 3) * 2"
highlighter.highlight(input, grammar)
```
## Contributing
1. Fork it (<https://github.com/omarroth/syntax.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
- [omarroth](https://github.com/omarroth) Omar Roth - 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.2.0- Tagged
- Apr 9, 2020
- Commit
4f300f22b26c- Indexed
- not yet
Dependents
No indexed shard depends on this one yet.
Repository
github.com/omarroth/syntax.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 14, 2026
- Synced
- Aug 14, 2026
- Versions
- 3