Add syntax highlighting for Solidity

This commit is contained in:
Nicolai
2016-12-06 21:52:37 +01:00
parent b0813f12e6
commit c35650e51a
3 changed files with 43 additions and 1 deletions

View File

@@ -36,7 +36,7 @@ You can also check out the website for Micro at https://micro-editor.github.io.
* Micro has a built-in plugin manager to automatically install, remove, and update all your plugins
* Persistent undo
* Automatic linting and error notifications
* Syntax highlighting (for over [75 languages](runtime/syntax)!)
* Syntax highlighting (for over [90 languages](runtime/syntax)!)
* Colorscheme support
* By default, micro comes with 16, 256, and true color themes.
* True color support (set the `MICRO_TRUECOLOR` env variable to 1 to enable it)

View File

@@ -33,6 +33,7 @@ Here is a list of the files that have been converted to properly use colorscheme
* sh
* git
* tex
* solidity
# License

View File

@@ -0,0 +1,41 @@
# Solidity syntax for Micro
# Copyright (C) 2016 Nicolai Søborg
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
syntax "solidity" "\.sol$"
color preproc "\b(contract|library|pragma)\b"
color constant.number "\b[-]?([0-9]+|0x[0-9a-fA-F]+)\b"
color identifier "[a-zA-Z][_a-zA-Z0-9]*[[:space:]]*"
color statement "\b(assembly|break|continue|do|for|function|if|else|new|return|returns|while)\b"
color special "\b(\.send|throw)\b" # make sure they are very visible
color keyword "\b(anonymous|constant|indexed|payable|public|private|external|internal)\b"
color constant "\b(block(\.(blockhash|coinbase|difficulty|gaslimit|number|timestamp))?|msg(\.(data|gas|sender|value))?|now|tx(\.(gasprice|origin))?)\b"
color constant "\b(keccak256|sha3|sha256|ripemd160|ecrecover|addmod|mulmod|this|super|selfdestruct|\.balance)\b"
color constant "\b(true|false)\b"
color constant "\b(wei|szabo|finney|ether|seconds|minutes|hours|days|weeks|years)\b"
color type "\b(address|bool|mapping|string|var|int(\d*)|uint(\d*)|byte(\d*)|fixed(\d*)|ufixed(\d*))\b"
color error "\b(abstract|after|case|catch|default|final|in|inline|interface|let|match|null|of|pure|relocatable|static|switch|try|type|typeof|view)\b"
color operator "[-+/*=<>!~%?:&|]"
color comment "(^|[[:space:]])//.*"
color comment "/\*.+\*/"
color todo "TODO:?"
color constant.string ""(\\.|[^"])*"|'(\\.|[^'])*'"