Skip to content

Commit

Permalink
ligo: adding support for ligolang, http://ligolang.org
Browse files Browse the repository at this point in the history
  • Loading branch information
Brice Aldrich committed Jun 21, 2019
1 parent f571cfc commit 50990d3
Show file tree
Hide file tree
Showing 16 changed files with 257 additions and 14 deletions.
2 changes: 1 addition & 1 deletion components.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,14 @@
"require": "css",
"owner": "Golmote"
},
"ligo": {
"title": "Ligo",
"owner": "DefinitelyNotAGoat",
"alias": "objectligo",
"aliasTitles": {
"objectligo": "Object Ligo"
}
},
"liquid": {
"title": "Liquid",
"owner": "cinhtau"
Expand Down
64 changes: 64 additions & 0 deletions components/prism-ligo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// LIGO lang is a layer 2 smart contract language for the tezos blockchain

Prism.languages.ligo = {
'comment': [
/\(\*[\s\S]+?\*\)/,
/\/\/.*/
],
'string': [
{
pattern: /(?:'(?:''|[^'\r\n])*'|#[&$%]?[a-f\d]+)+|\^[a-z]/i,
greedy: true
},
{
pattern: /(?:"(?:""|[^"\r\n])*"|#[&$%]?[a-f\d]+)+|\^[a-z]/i,
greedy: true
},
],
'keyword': [
{
// Turbo Pascal
pattern: /(^|[^&])\b(?:if|while|for|return|nil|remove|from|else|then|skip|with|is|function|var|const|type|end|begin|block)\b/i,
lookbehind: true
},
{
// Free Pascal
pattern: /(^|[^&])\b(?:True|False)\b/i,
lookbehind: true
},
],
'builtin': {
pattern: /(^|[^&])\b(?:int|unit|string|nat|map)\b/i,
lookbehind: true
},
'function': {
pattern: /(?!with\b)\b\w+ ?(?=\()/i,
lookbehind: true
},
'variable': [
{
pattern: /\w+ ?(?=\:\=)/i,
lookbehind: true
},
{
pattern: /\w+ ?(?=\:)/i,
lookbehind: true
},
],
'class-name': {
pattern: /\w+ ?(?= is ?)/i,
lookbehind: true
},
'number': [
// Hexadecimal, octal and binary
/(?:[&%]\d+|\$[a-f\d]+)/i,
// Decimal
/\b\d+(?:\.\d+)?(?:e[+-]?\d+)?/i
],
'operator': [
/\.\.|\*\*|:=|<[<=>]?|>[>=]?|[+\-*\/]=?|[@^=]/i,
],
'punctuation': /\(\.|\.\)|[()\[\]:;,.]/
};

Prism.languages.objectligo = Prism.languages.ligo;
1 change: 1 addition & 0 deletions components/prism-ligo.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 30 additions & 11 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions plugins/autoloader/prism-autoloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
"hs": "haskell",
"tex": "latex",
"context": "latex",
"objectligo": "ligo",
"emacs": "lisp",
"elisp": "lisp",
"emacs-lisp": "lisp",
Expand Down
2 changes: 1 addition & 1 deletion plugins/autoloader/prism-autoloader.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions plugins/show-language/prism-show-language.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"latex": "LaTeX",
"tex": "TeX",
"context": "ConTeXt",
"objectligo": "Object Ligo",
"emacs": "Lisp",
"elisp": "Lisp",
"emacs-lisp": "Lisp",
Expand Down
Loading

0 comments on commit 50990d3

Please sign in to comment.