Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rohanvashisht1234/rohansyntax
https://github.com/rohanvashisht1234/rohansyntax
Last synced: 13 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/rohanvashisht1234/rohansyntax
- Owner: RohanVashisht1234
- License: other
- Created: 2024-04-05T22:13:55.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-04-06T09:10:48.000Z (9 months ago)
- Last Synced: 2024-10-31T03:08:40.981Z (2 months ago)
- Language: Python
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Introducing Lite-syntax
**The easiet way to create syntax highlighters for lite-xl.**
### Suppose you have to make a syntax highlighter for clojure.
- Create a syntax.yaml file and put data inside it like this:
```yaml
name: Clojure
file: ["%.clojure$"]comment: "//.*"
block-comment: []
patterns:
- pattern: [";;.*"]
type: ["comment"]- pattern: [";.*"]
type: ["comment"]- pattern: ['#"', '"', '\\']
type: ["string"]- pattern: ["-?0x%x+"]
type: ["number"]- pattern: ["[!%#%$%%&*+./%<=>%?@\\%^|%-~:]"]
type: ["operator"]- pattern: ["[%a_'][%w_']*"]
type: ["normal"]keywords:
- def
- defn
- str
- fn
- printlnkeywords2:
- require
- "true"
- "false"literal:
- nil
- int
```- Now, run the compiler.py file on it and it will generate this:
```lua
-- Generated using https://github.com/RohanVashisht1234/rohansyntax
-- mod-version:3
local syntax = require "core.syntax"
syntax.add {
name = "Clojure",
block_comment = {},
files = {
"%.clojure$",
},
patterns = {
{ pattern = {';;.*'}, type = {'comment'} },
{ pattern = {';.*'}, type = {'comment'} },
{ pattern = {'#"', '"', '\\\\'}, type = {'string'} },
{ pattern = {'-?0x%x+'}, type = {'number'} },
{ pattern = {'[!%#%$%%&*+./%<=>%?@\\%^|%-~:]'}, type = {'operator'} },
{ pattern = {"[%a_'][%w_']*"}, type = {'normal'} },
},
symbols = {
['def'] = 'keyword',
['defn'] = 'keyword',
['str'] = 'keyword',
['fn'] = 'keyword',
['println'] = 'keyword',
['require'] = 'keyword2',
['true'] = 'keyword2',
['false'] = 'keyword2',
['nil'] = 'literal',
['int'] = 'literal',
},
}
```- Isn't that easy?
## Contribution:
- Feel free to open a pr or an issues.## License:
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007