Last active
May 18, 2018 04:01
-
-
Save wararyo/a9d589939a1246518e2e8bcfc423cebe to your computer and use it in GitHub Desktop.
Sublime Syntax for Sunaba
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%YAML 1.2 | |
--- | |
# See http://www.sublimetext.com/docs/3/syntax.html | |
name: Sunaba | |
file_extensions: | |
- sunaba | |
- snb | |
- sunaba.txt | |
- snb.txt | |
scope: source.sunaba | |
variables: | |
identifier_continue: '[[:alnum:]_]' | |
identifier: '\b[[:alpha:]_]{{identifier_continue}}*\b' | |
contexts: | |
prototype: | |
- include: comments | |
main: | |
- include: keywords | |
- include: numbers | |
- include: operators | |
- match: '(?<!def ){{identifier}}(?= ?\()(?! ?\(.*\) ?とは)' | |
scope: meta.qualified-name.sunaba variable.function.sunaba | |
- match: '^{{identifier}}(?= ?\(.*\) ?とは)' | |
scope: source.sunaba meta.function.sunaba entity.name.function.sunaba meta.generic-name.sunaba | |
- match: '^def\b' | |
scope: source.sunaba meta.function.sunaba storage.type.function.sunaba | |
- match: '\bとは$' | |
scope: source.sunaba meta.function.sunaba storage.type.function.sunaba | |
- match: '(?<=def ){{identifier}}(?= ?\()' | |
scope: source.sunaba meta.function.sunaba entity.name.function.sunaba meta.generic-name.sunaba | |
- match: '\b(const|定数)\b' | |
scope: source.sunaba meta.qualified-name.sunaba support.type.sunaba | |
- match: '(memory|メモリ)(?=\[.+\])' | |
scope: source.sunaba meta.function-call.sunaba meta.qualified-name.sunaba variable.function.sunaba | |
- match: '\b{{identifier}}(?=\[.+\])' | |
scope: source.sunaba meta.function-call.sunaba meta.qualified-name.sunaba variable.function.sunaba | |
keywords: | |
- match: '\b(if|while|なら|なかぎり)\b' | |
scope: keyword.control.sunaba | |
- match: '\b(import)\b' | |
scope: source.sunaba meta.statement.import.sunaba keyword.control.import.sunaba | |
operators: | |
- match: ->|→ | |
scope: source.sunaba keyword.operator.assignment.sunaba | |
- match: <\=|>\=|\=(?!\=)|<|>|\!\=|≧|≦ | |
scope: keyword.operator.comparison.sunaba | |
- match: \+|\-|\*|/ | |
scope: keyword.operator.arithmetic.sunaba | |
- match: \=\= | |
scope: source.sunaba keyword.operator.comparison.sunaba invalid.illegal.name.sunaba | |
numbers: | |
- match: '\b(-)?[0-9.]+\b' | |
scope: constant.numeric.sunaba | |
comments: | |
- match: ^/\* =(\s*.*?)\s*= \*/$\n? | |
scope: comment.block.sunaba | |
captures: | |
1: meta.toc-list.banner.block.sunaba | |
- match: /\* | |
scope: punctuation.definition.sunabaomment.sunaba | |
push: | |
- meta_scope: comment.block.sunaba | |
- match: \*/ | |
scope: punctuation.definition.sunabaomment.sunaba | |
pop: true | |
- match: \*/(?!\*) | |
scope: invalid.illegal.stray-comment-end.sunaba | |
- match: '#' | |
scope: punctuation.definition.comment.subana | |
push: | |
# This is an anonymous context push for brevity. | |
- meta_scope: comment.line.double-slash.subana | |
- match: $\n? | |
pop: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How to Install
C:\Users\{user}\AppData\Roaming\Sublime Text 3\Packages\User
(Mac)~/Library/Application Support/Sublime Text 3/Packages/User
*.sunaba
or*.sunaba.txt