From d5ddc6dbec686fe851de2556944c53ad3337217c Mon Sep 17 00:00:00 2001 From: sobolevn Date: Fri, 23 Sep 2022 13:08:36 +0300 Subject: [PATCH] Version 0.1.1 release --- CHANGELOG.md | 10 ++++ CONTRIBUTING.md | 12 +++++ README.md | 2 +- dist/func.es.min.js | 29 ++++++------ dist/func.min.js | 29 ++++++------ package.json | 6 +-- src/languages/func.js | 41 ++++++++++------ test/markup/func/default.expect.txt | 72 ++++++++++++++--------------- 8 files changed, 119 insertions(+), 82 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 511d572..1d19d87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,16 @@ We follow [Semantic Versions](https://semver.org/). +## Version 0.1.1 + +### Bugfixes + +- Changes `puncuation` class name to `punctuation` +- Changes `className` to `scope` +- Fixes how `const` is highlighted +- Fixes URLs from `sobolevn/` to `highlightjs/` + + ## Version 0.1.0 - Initial release diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..9c5aa07 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,12 @@ +# Contributors' Guide + +## Building `dist` folder + +To build `dist/` folder we utilize `highlight.js` standard way: +1. Copy the source +2. Symlink our project to `extra/` directory +3. Run the script + +To automate this proccess, use `bash scripts/build.sh` + +**Make sure that you run build script for each new package release**! diff --git a/README.md b/README.md index 431f2c4..afe96ff 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # `highlight.js` syntax definition for `FunC` -[![test](https://github.com/sobolevn/highlightjs-func/actions/workflows/test.yml/badge.svg?event=push)](https://github.com/sobolevn/highlightjs-func/actions/workflows/test.yml) +[![test](https://github.com/highlightjs/highlightjs-func/actions/workflows/test.yml/badge.svg?event=push)](https://github.com/highlightjs/highlightjs-func/actions/workflows/test.yml) - For more about `FunC`, see https://ton.org/docs - For more about `highlight.js`, see https://highlightjs.org/ diff --git a/dist/func.es.min.js b/dist/func.es.min.js index 680a027..afeb50b 100644 --- a/dist/func.es.min.js +++ b/dist/func.es.min.js @@ -1,20 +1,21 @@ /*! `func` grammar compiled for Highlight.js 11.6.0 */ var hljsGrammar=(()=>{"use strict" -;const e=/\"[^\n\"]+\"[Hhcusa]?/,a=/(-?(?!_)([\d_]+|0x[\d_a-fA-F]+)|0b[1_0]+)(?({name:"FunC",aliases:["func"],case_insensitive:!1,keywords:{ -keyword:["if","ifnot","else","elseif","elseifnot|10","while","do","until","repeat","return","impure","method_id","forall","asm","inline","inline_ref|10"], +;const e=/\"[^\n\"]+\"[Hhcusa]?/,n=/(-?(?!_)([\d_]+|0x[\d_a-fA-F]+)|0b[1_0]+)(?({name:"FunC",aliases:["func"],case_insensitive:!1,keywords:{ +keyword:["if","ifnot","else","elseif","elseifnot|10","while","do","until","repeat","return","impure","method_id","forall","asm","inline","inline_ref|10","const","global"], literal:["true","false"], type:["var","int","slice","tuple","cell","builder","cont","_"],built_in:[]}, -contains:[{className:"comment",begin:";;",end:/(?=\n)/},{className:"comment", -begin:"{-",end:"-}",contains:["self"]},{className:"meta",begin:/#pragma/, -end:/;/,contains:[{className:"keyword",match:/version|not-version/},{ -className:"operator",match:s.regex.either(/>=/,/<=/,/=/,/>/,/=/,/<=/,/=/,/>/,//,/>=/,/<=/,/!=/,/==/,/\^>>/,/~>>/,/>>/,/<>=/,/~>>=/,/\^>>=/,/&=/,/\^=/,/\|=/,/\^/,/=/,/~/,/\//,/%/,/-/,/\*/,/\+/,/>/,//,/>=/,/<=/,/!=/,/==/,/\^>>/,/~>>/,/>>/,/<>=/,/~>>=/,/\^>>=/,/&=/,/\^=/,/\|=/,/\^/,/=/,/~/,/\//,/%/,/-/,/\*/,/\+/,/>/,/{var e=(()=>{"use strict" -;const e=/\"[^\n\"]+\"[Hhcusa]?/,a=/(-?(?!_)([\d_]+|0x[\d_a-fA-F]+)|0b[1_0]+)(?({name:"FunC",aliases:["func"],case_insensitive:!1,keywords:{ -keyword:["if","ifnot","else","elseif","elseifnot|10","while","do","until","repeat","return","impure","method_id","forall","asm","inline","inline_ref|10"], +;const e=/\"[^\n\"]+\"[Hhcusa]?/,n=/(-?(?!_)([\d_]+|0x[\d_a-fA-F]+)|0b[1_0]+)(?({name:"FunC",aliases:["func"],case_insensitive:!1,keywords:{ +keyword:["if","ifnot","else","elseif","elseifnot|10","while","do","until","repeat","return","impure","method_id","forall","asm","inline","inline_ref|10","const","global"], literal:["true","false"], type:["var","int","slice","tuple","cell","builder","cont","_"],built_in:[]}, -contains:[{className:"comment",begin:";;",end:/(?=\n)/},{className:"comment", -begin:"{-",end:"-}",contains:["self"]},{className:"meta",begin:/#pragma/, -end:/;/,contains:[{className:"keyword",match:/version|not-version/},{ -className:"operator",match:s.regex.either(/>=/,/<=/,/=/,/>/,/=/,/<=/,/=/,/>/,//,/>=/,/<=/,/!=/,/==/,/\^>>/,/~>>/,/>>/,/<>=/,/~>>=/,/\^>>=/,/&=/,/\^=/,/\|=/,/\^/,/=/,/~/,/\//,/%/,/-/,/\*/,/\+/,/>/,//,/>=/,/<=/,/!=/,/==/,/\^>>/,/~>>/,/>>/,/<>=/,/~>>=/,/\^>>=/,/&=/,/\^=/,/\|=/,/\^/,/=/,/~/,/\//,/%/,/-/,/\*/,/\+/,/>/,/", "license": "MIT", "bugs": { - "url": "https://github.com/sobolevn/highlightjs-func/issues" + "url": "https://github.com/highlightjs/highlightjs-func/issues" }, - "homepage": "https://github.com/sobolevn/highlightjs-func#readme", + "homepage": "https://github.com/highlightjs/highlightjs-func#readme", "scripts": { "test": "mocha --reporter spec --reporter-option maxDiffSize=0" }, diff --git a/src/languages/func.js b/src/languages/func.js index 15d9354..e7539a0 100644 --- a/src/languages/func.js +++ b/src/languages/func.js @@ -27,6 +27,7 @@ export default function(hljs) { 'while', 'do', 'until', 'repeat', 'return', 'impure', 'method_id', 'forall', 'asm', 'inline', 'inline_ref|10', + 'const', 'global', ], 'literal': ['true', 'false'], 'type': ['var', 'int', 'slice', 'tuple', 'cell', 'builder', 'cont', '_'], @@ -35,9 +36,9 @@ export default function(hljs) { 'contains': [ // Comments - { 'className': 'comment', 'begin': ';;', 'end': /(?=\n)/ }, + { 'scope': 'comment', 'begin': ';;', 'end': /(?=\n)/ }, { - 'className': 'comment', + 'scope': 'comment', 'begin': '{-', 'end': '-}', 'contains': ['self'], @@ -45,41 +46,53 @@ export default function(hljs) { // Directives { - 'className': 'meta', + 'scope': 'meta', 'begin': /#pragma/, 'end': /;/, 'contains': [ - { 'className': 'keyword', 'match': /version|not-version/ }, + { 'scope': 'keyword', 'match': /version|not-version/ }, { - 'className': 'operator', + 'scope': 'operator', 'match': hljs.regex.either(/>=/, /<=/, /=/, />/, //, />=/, /<=/, /!=/, /==/, /\^>>/, /~>>/, />>/, /<#include "../"; #pragma version >=1.0.0; -global int k_const; -global tuple k_if; -const int k_int = 1; +global int k_const; +global tuple k_if; +const int k_int = 1; -() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure { - slice cs = in_msg_full.begin_parse(); - int flags = cs~load_uint(0x4_1_0); +() recv_internal(int my_balance, int msg_value, cell in_msg_full, slice in_msg_body) impure { + slice cs = in_msg_full.begin_parse(); + int flags = cs~load_uint(0x4_1_0); - if ((flags & 1) == true) { ;; ignore all bounced messages - return (); - } + if ((flags & 1) == true) { ;; ignore all bounced messages + return (); + } - slice sender_address = cs~load_msg_addr(); + slice sender_address = cs~load_msg_addr(); {- {- @@ -22,32 +22,32 @@ -} ;; Send message - var message = begin_cell() - .store_uint(0x18, 6) - .store_slice(sender_address) - .store_coins(0) - .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) - .store_slice("Hello, world!"s) - .end_cell(); + var message = begin_cell() + .store_uint(0x18, 6) + .store_slice(sender_address) + .store_coins(0) + .store_uint(0, 1 + 4 + 4 + 64 + 32 + 1 + 1) + .store_slice("Hello, world!"s) + .end_cell(); - send_raw_message(message, 64); + send_raw_message(message, 64); ;; Update counter - var cs = get_data().begin_parse(); - var counter = data~load_uint(32); - - store_data( - begin_cell() - .store_uint(counter + 1, 32) - .end_cell() - ); -} - -() recv_external(slice in_msg) impure { - throw(0xffff); -} - -int counter() method_id { - var data = get_data().begin_parse(); - return data~load_uint(32); -} + var cs = get_data().begin_parse(); + var counter = data~load_uint(32); + + store_data( + begin_cell() + .store_uint(counter + 1, 32) + .end_cell() + ); +} + +() recv_external(slice in_msg) impure { + throw(0xffff); +} + +int counter() method_id { + var data = get_data().begin_parse(); + return data~load_uint(32); +}