From 3c6dd3556daf3dc64444772ef978a4b7082ec279 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Fri, 26 Jan 2024 17:52:26 +0100 Subject: [PATCH 1/5] Add language: `Tact` --- .gitmodules | 3 + grammars.yml | 2 + lib/linguist/languages.yml | 8 + samples/Tact/deployable_counter.tact | 20 ++ samples/Tact/jetton.tact | 339 ++++++++++++++++++ vendor/README.md | 1 + vendor/grammars/tact-vscode | 1 + .../git_submodule/tact-vscode.dep.yml | 213 +++++++++++ 8 files changed, 587 insertions(+) create mode 100644 samples/Tact/deployable_counter.tact create mode 100644 samples/Tact/jetton.tact create mode 160000 vendor/grammars/tact-vscode create mode 100644 vendor/licenses/git_submodule/tact-vscode.dep.yml diff --git a/.gitmodules b/.gitmodules index 6890f1a7dc..6f43c60e81 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1163,6 +1163,9 @@ [submodule "vendor/grammars/syntax"] path = vendor/grammars/syntax url = https://github.com/hashicorp/syntax.git +[submodule "vendor/grammars/tact-vscode"] + path = vendor/grammars/tact-vscode + url = https://github.com/tact-lang/tact-vscode.git [submodule "vendor/grammars/tcl.tmbundle"] path = vendor/grammars/tcl.tmbundle url = https://github.com/textmate/tcl.tmbundle diff --git a/grammars.yml b/grammars.yml index e9c84c6522..458d939085 100644 --- a/grammars.yml +++ b/grammars.yml @@ -1043,6 +1043,8 @@ vendor/grammars/syntax: - source.hcl - source.hcl.terraform - source.sentinel +vendor/grammars/tact-vscode: +- source.tact vendor/grammars/tcl.tmbundle: - source.tcl - text.html.tcl diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index 3441a3f316..e85d807b47 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -6970,6 +6970,14 @@ TXL: tm_scope: source.txl ace_mode: text language_id: 366 +Tact: + type: programming + color: "#48b5ff" + extensions: + - ".tact" + ace_mode: text + tm_scope: source.tact + language_id: 606708469 Talon: type: programming ace_mode: text diff --git a/samples/Tact/deployable_counter.tact b/samples/Tact/deployable_counter.tact new file mode 100644 index 0000000000..7a17e4ba7d --- /dev/null +++ b/samples/Tact/deployable_counter.tact @@ -0,0 +1,20 @@ +// this trait has to be imported +import "@stdlib/deploy"; + +// the Deployable trait adds a default receiver for the "Deploy" message +contract Counter with Deployable { + + val: Int as uint32; + + init() { + self.val = 0; + } + + receive("increment") { + self.val = self.val + 1; + } + + get fun value(): Int { + return self.val; + } +} diff --git a/samples/Tact/jetton.tact b/samples/Tact/jetton.tact new file mode 100644 index 0000000000..04b7ecdecc --- /dev/null +++ b/samples/Tact/jetton.tact @@ -0,0 +1,339 @@ +import "@stdlib/ownable"; + +message Mint { + amount: Int; + receiver: Address; +} + +contract SampleJetton with Jetton { + totalSupply: Int as coins; + owner: Address; + content: Cell; + mintable: Bool; + + max_supply: Int as coins; + + init(owner: Address, content: Cell, max_supply: Int) { + self.totalSupply = 0; + self.owner = owner; + self.mintable = true; + self.content = content; + + self.max_supply = max_supply; // Initial Setting for max_supply + } + + receive(msg: Mint) { + let ctx: Context = context(); + require(ctx.sender == self.owner, "Not Owner"); + require(self.mintable, "Can't Mint Anymore"); + self.mint(msg.receiver, msg.amount, self.owner); // (to, amount, response_destination) + } + + receive("Mint: 100") { // Public Minting + let ctx: Context = context(); + require(self.mintable, "Can't Mint Anymore"); + self.mint(ctx.sender, 100, self.owner); + } + + receive("Owner: MintClose") { + let ctx: Context = context(); + require(ctx.sender == self.owner, "Not Owner"); + self.mintable = false; + } +} + +struct JettonData { + totalSupply: Int; + mintable: Bool; + owner: Address; + content: Cell; + walletCode: Cell; +} + +// ============================================================================================================ // +@interface("org.ton.jetton.master") +trait Jetton with Ownable { + + totalSupply: Int; // Already set initially + mintable: Bool; + owner: Address; + content: Cell; + + max_supply: Int; // This is not in the TEP-74 interface + + receive(msg: TokenUpdateContent) { + self.requireOwner(); // Allow changing content only by owner + self.content = msg.content; // Update content + } + + receive(msg: TokenBurnNotification) { + self.requireWallet(msg.owner); // Check wallet + self.totalSupply = self.totalSupply - msg.amount; // Update supply + + if (msg.response_destination != null) { // Cashback + send(SendParameters{ + to: msg.response_destination!!, + value: 0, + bounce: false, + mode: SendRemainingValue + SendIgnoreErrors, + body: TokenExcesses{ + queryId: msg.queryId + }.toCell() + }); + } + } + + // @to The Address receive the Jetton token after minting + // @amount The amount of Jetton token being minted + // @response_destination The previous owner address + fun mint(to: Address, amount: Int, response_destination: Address) { + require(self.totalSupply + amount <= self.max_supply, "The total supply will be overlapping."); + self.totalSupply = self.totalSupply + amount; // Update total supply + + let winit: StateInit = self.getJettonWalletInit(to); // Create message + send(SendParameters{ + to: contractAddress(winit), + value: 0, + bounce: false, + mode: SendRemainingValue, + body: TokenTransferInternal{ + queryId: 0, + amount: amount, + from: myAddress(), + response_destination: response_destination, + forward_ton_amount: 0, + forward_payload: emptySlice() + }.toCell(), + code: winit.code, + data: winit.data + }); + } + + fun requireWallet(owner: Address) { + let ctx: Context = context(); + let winit: StateInit = self.getJettonWalletInit(owner); + require(contractAddress(winit) == ctx.sender, "Invalid sender"); + } + + virtual fun getJettonWalletInit(address: Address): StateInit { + return initOf JettonDefaultWallet(myAddress(), address); + } + + // ====== Get Methods ====== // + get fun get_jetton_data(): JettonData { + let code: Cell = self.getJettonWalletInit(myAddress()).code; + return JettonData{ + totalSupply: self.totalSupply, + mintable: self.mintable, + owner: self.owner, + content: self.content, + walletCode: code + }; + } + + get fun get_wallet_address(owner: Address): Address { + let winit: StateInit = self.getJettonWalletInit(owner); + return contractAddress(winit); + } +} +// ============================================================ // +@interface("org.ton.jetton.wallet") +contract JettonDefaultWallet { + const minTonsForStorage: Int = ton("0.01"); + const gasConsumption: Int = ton("0.01"); + + balance: Int; + owner: Address; + master: Address; + + init(master: Address, owner: Address) { + self.balance = 0; + self.owner = owner; + self.master = master; + } + + receive(msg: TokenTransfer) { // 0xf8a7ea5 + let ctx: Context = context(); // Check sender + require(ctx.sender == self.owner, "Invalid sender"); + + // Gas checks + let fwdFee: Int = ctx.readForwardFee() + ctx.readForwardFee(); + let final: Int = 2 * self.gasConsumption + self.minTonsForStorage + fwdFee; + require(ctx.value > min(final, ton("0.01")), "Invalid value!!"); + + // Update balance + self.balance = self.balance - msg.amount; + require(self.balance >= 0, "Invalid balance"); + + let init: StateInit = initOf JettonDefaultWallet(self.master, msg.destination); + let walletAddress: Address = contractAddress(init); + send(SendParameters{ + to: walletAddress, + value: 0, + mode: SendRemainingValue, + bounce: false, + body: TokenTransferInternal{ + queryId: msg.queryId, + amount: msg.amount, + from: self.owner, + response_destination: msg.response_destination, + forward_ton_amount: msg.forward_ton_amount, + forward_payload: msg.forward_payload + }.toCell(), + code: init.code, + data: init.data + }); + } + + receive(msg: TokenTransferInternal) { // 0x178d4519 + let ctx: Context = context(); + + if (ctx.sender != self.master) { + let sinit: StateInit = initOf JettonDefaultWallet(self.master, msg.from); + require(contractAddress(sinit) == ctx.sender, "Invalid sender!"); + } + + // Update balance + self.balance = self.balance + msg.amount; + require(self.balance >= 0, "Invalid balance"); + + // Get value for gas + let msgValue: Int = self.msgValue(ctx.value); + let fwdFee: Int = ctx.readForwardFee(); + msgValue = msgValue - msg.forward_ton_amount - fwdFee; + + // 0x7362d09c - notify the new owner of JettonToken that the transfer is complete + if (msg.forward_ton_amount > 0) { + send(SendParameters{ + to: self.owner, + value: msg.forward_ton_amount, + mode: SendPayGasSeparately + SendIgnoreErrors, + bounce: false, + body: TokenNotification { + queryId: msg.queryId, + amount: msg.amount, + from: msg.from, + forward_payload: msg.forward_payload + }.toCell() + }); + } + + // 0xd53276db -- Cashback to the original Sender + if (msg.response_destination != null) { + send(SendParameters { + to: msg.response_destination, + value: msgValue, + bounce: false, + body: TokenExcesses { + queryId: msg.queryId + }.toCell(), + mode: SendIgnoreErrors + }); + } + } + + receive(msg: TokenBurn) { + let ctx: Context = context(); + require(ctx.sender == self.owner, "Invalid sender"); // Check sender + + self.balance = self.balance - msg.amount; // Update balance + require(self.balance >= 0, "Invalid balance"); + + let fwdFee: Int = ctx.readForwardFee(); // Gas checks + require(ctx.value > fwdFee + 2 * self.gasConsumption + self.minTonsForStorage, "Invalid value - Burn"); + + // Burn tokens + send(SendParameters{ + to: self.master, + value: 0, + mode: SendRemainingValue, + bounce: true, + body: TokenBurnNotification{ + queryId: msg.queryId, + amount: msg.amount, + owner: self.owner, + response_destination: self.owner + }.toCell() + }); + } + + get fun msgValue(value: Int): Int { + let msgValue: Int = value; + let tonBalanceBeforeMsg: Int = myBalance() - msgValue; + let storageFee: Int = self.minTonsForStorage - min(tonBalanceBeforeMsg, self.minTonsForStorage); + msgValue = msgValue - (storageFee + self.gasConsumption); + return msgValue; + } + + bounced(src: bounced) { + self.balance = self.balance + src.amount; + } + + bounced(src: bounced) { + self.balance = self.balance + src.amount; + } + + get fun get_wallet_data(): JettonWalletData { + return JettonWalletData{ + balance: self.balance, + owner: self.owner, + master: self.master, + walletCode: (initOf JettonDefaultWallet(self.master, self.owner)).code + }; + } +} + +struct JettonWalletData { + balance: Int; + owner: Address; + master: Address; + walletCode: Cell; +} + +message(0xf8a7ea5) TokenTransfer { + queryId: Int as uint64; + amount: Int as coins; + destination: Address; + response_destination: Address; + custom_payload: Cell?; + forward_ton_amount: Int as coins; + forward_payload: Slice as remaining; // Comment Text message when Transfer the jetton +} + +message(0x178d4519) TokenTransferInternal { + queryId: Int as uint64; + amount: Int as coins; + from: Address; + response_destination: Address; + forward_ton_amount: Int as coins; + forward_payload: Slice as remaining; // Comment Text message when Transfer the jetton +} + +message(0x7362d09c) TokenNotification { + queryId: Int as uint64; + amount: Int as coins; + from: Address; + forward_payload: Slice as remaining; // Comment Text message when Transfer the jetton +} + +message(0x595f07bc) TokenBurn { + queryId: Int as uint64; + amount: Int as coins; + owner: Address; + response_destination: Address; +} + +message(0x7bdd97de) TokenBurnNotification { + queryId: Int as uint64; + amount: Int as coins; + owner: Address; + response_destination: Address?; +} + +message(0xd53276db) TokenExcesses { + queryId: Int as uint64; +} + +message TokenUpdateContent { + content: Cell; +} diff --git a/vendor/README.md b/vendor/README.md index 98d03e1c29..f8a038d240 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -548,6 +548,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting - **TSV:** [Alhadis/language-etc](https://github.com/Alhadis/language-etc) - **TSX:** [Microsoft/TypeScript-TmLanguage](https://github.com/Microsoft/TypeScript-TmLanguage) - **TXL:** [MikeHoffert/Sublime-Text-TXL-syntax](https://github.com/MikeHoffert/Sublime-Text-TXL-syntax) +- **Tact:** [tact-lang/tact-vscode](https://github.com/tact-lang/tact-vscode) - **Talon:** [mrob95/vscode-TalonScript](https://github.com/mrob95/vscode-TalonScript) - **Tcl:** [textmate/tcl.tmbundle](https://github.com/textmate/tcl.tmbundle) - **Tcsh:** [atom/language-shellscript](https://github.com/atom/language-shellscript) diff --git a/vendor/grammars/tact-vscode b/vendor/grammars/tact-vscode new file mode 160000 index 0000000000..7b3449dced --- /dev/null +++ b/vendor/grammars/tact-vscode @@ -0,0 +1 @@ +Subproject commit 7b3449dced3b69f25af98dc0ad56140c1ae88005 diff --git a/vendor/licenses/git_submodule/tact-vscode.dep.yml b/vendor/licenses/git_submodule/tact-vscode.dep.yml new file mode 100644 index 0000000000..8d98dc04b0 --- /dev/null +++ b/vendor/licenses/git_submodule/tact-vscode.dep.yml @@ -0,0 +1,213 @@ +--- +name: tact-vscode +version: 7b3449dced3b69f25af98dc0ad56140c1ae88005 +type: git_submodule +homepage: https://github.com/tact-lang/tact-vscode.git +license: apache-2.0 +licenses: +- sources: LICENSE + text: |2- + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [2023] [Steve Korshakov (ex3ndr)] + Copyright [2023] [XTON crypto wallet team] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +notices: [] + From beebdbe38ec15417db224abcf78f4d1b8b42e0a8 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Sun, 28 Jan 2024 01:37:11 +0100 Subject: [PATCH 2/5] fix: Heuristics and samples for JSON .tact format --- lib/linguist/heuristics.yml | 5 +++++ lib/linguist/languages.yml | 1 + samples/JSON/landing.tact | 1 + test/test_heuristics.rb | 7 +++++++ 4 files changed, 14 insertions(+) create mode 100644 samples/JSON/landing.tact diff --git a/lib/linguist/heuristics.yml b/lib/linguist/heuristics.yml index ef0d00ca89..1d0633d7ad 100644 --- a/lib/linguist/heuristics.yml +++ b/lib/linguist/heuristics.yml @@ -713,6 +713,11 @@ disambiguations: pattern: '^\s*(?:use\s+v6\b|\bmodule\b|\bmy\s+class\b)' - language: Turing pattern: '^\s*%[ \t]+|^\s*var\s+\w+(\s*:\s*\w+)?\s*:=\s*\w+' +- extensions: ['.tact'] + rules: + - language: JSON + pattern: '\A\s*\{\"project\"\:' + - language: Tact - extensions: ['.tag'] rules: - language: Java Server Pages diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index e85d807b47..d17c89577d 100644 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -3168,6 +3168,7 @@ JSON: - ".JSON-tmLanguage" - ".jsonl" - ".mcmeta" + - ".tact" - ".tfstate" - ".tfstate.backup" - ".topojson" diff --git a/samples/JSON/landing.tact b/samples/JSON/landing.tact new file mode 100644 index 0000000000..193d5dc9a4 --- /dev/null +++ b/samples/JSON/landing.tact @@ -0,0 +1 @@ +{"project":{"createdAt":1629543532823,"description":"","layout":{"layouts":{"VestBack":[{"index":0,"x":0,"y":0},{"index":1,"x":0.333,"y":0},{"index":2,"x":0.667,"y":0},{"index":3,"x":1,"y":0},{"index":4,"x":0,"y":0.25},{"index":5,"x":0.333,"y":0.25},{"index":6,"x":0.667,"y":0.25},{"index":7,"x":1,"y":0.25},{"index":8,"x":0,"y":0.5},{"index":9,"x":0.333,"y":0.5},{"index":10,"x":0.667,"y":0.5},{"index":11,"x":1,"y":0.5},{"index":12,"x":0,"y":0.75},{"index":13,"x":0.333,"y":0.75},{"index":14,"x":0.667,"y":0.75},{"index":15,"x":1,"y":0.75},{"index":16,"x":0,"y":1},{"index":17,"x":0.333,"y":1},{"index":18,"x":0.667,"y":1},{"index":19,"x":1,"y":1}],"VestFront":[{"index":0,"x":0,"y":0},{"index":1,"x":0.333,"y":0},{"index":2,"x":0.667,"y":0},{"index":3,"x":1,"y":0},{"index":4,"x":0,"y":0.25},{"index":5,"x":0.333,"y":0.25},{"index":6,"x":0.667,"y":0.25},{"index":7,"x":1,"y":0.25},{"index":8,"x":0,"y":0.5},{"index":9,"x":0.333,"y":0.5},{"index":10,"x":0.667,"y":0.5},{"index":11,"x":1,"y":0.5},{"index":12,"x":0,"y":0.75},{"index":13,"x":0.333,"y":0.75},{"index":14,"x":0.667,"y":0.75},{"index":15,"x":1,"y":0.75},{"index":16,"x":0,"y":1},{"index":17,"x":0.333,"y":1},{"index":18,"x":0.667,"y":1},{"index":19,"x":1,"y":1}]},"name":"Tactot","type":"Tactot"},"mediaFileDuration":3,"name":"landing","tracks":[{"effects":[{"modes":{"VestBack":{"dotMode":{"dotConnected":false,"feedback":[{"endTime":300,"playbackType":"NONE","startTime":0,"pointList":[]}]},"mode":"PATH_MODE","pathMode":{"feedback":[{"movingPattern":"CONST_SPEED","playbackType":"FADE_OUT","pointList":[{"intensity":0.7,"time":0,"x":0,"y":1},{"intensity":0.7,"time":300,"x":0,"y":0}],"visible":true},{"movingPattern":"CONST_SPEED","playbackType":"FADE_OUT","pointList":[{"intensity":0.7,"time":0,"x":0.33,"y":1},{"intensity":0.7,"time":300,"x":0.34,"y":0}],"visible":true},{"movingPattern":"CONST_SPEED","playbackType":"FADE_OUT","pointList":[{"intensity":0.7,"time":0,"x":0.67,"y":1},{"intensity":0.7,"time":300,"x":0.67,"y":0}],"visible":true},{"movingPattern":"CONST_SPEED","playbackType":"FADE_OUT","pointList":[{"intensity":0.7,"time":0,"x":1,"y":1},{"intensity":0.7,"time":300,"x":1,"y":0}],"visible":true},{"movingPattern":"CONST_SPEED","playbackType":"NONE","pointList":[{"intensity":0.7,"time":0,"x":0,"y":1},{"intensity":0.7,"time":73,"x":0.33,"y":0.76},{"intensity":0.7,"time":150,"x":0,"y":0.48},{"intensity":0.7,"time":223,"x":0.34,"y":0.25},{"intensity":0.7,"time":300,"x":0,"y":0}],"visible":true},{"movingPattern":"CONST_SPEED","playbackType":"NONE","pointList":[{"intensity":0.7,"time":0,"x":1,"y":1},{"intensity":0.7,"time":74,"x":0.67,"y":0.75},{"intensity":0.7,"time":148,"x":1,"y":0.5},{"intensity":0.7,"time":223,"x":0.66,"y":0.25},{"intensity":0.7,"time":300,"x":1,"y":0}],"visible":true}]}},"VestFront":{"dotMode":{"dotConnected":false,"feedback":[{"endTime":300,"playbackType":"NONE","startTime":0,"pointList":[]}]},"mode":"PATH_MODE","pathMode":{"feedback":[{"movingPattern":"CONST_SPEED","playbackType":"FADE_OUT","pointList":[{"intensity":0.7,"time":0,"x":0,"y":1},{"intensity":0.7,"time":300,"x":0,"y":0}],"visible":true},{"movingPattern":"CONST_SPEED","playbackType":"FADE_OUT","pointList":[{"intensity":0.7,"time":0,"x":0.33,"y":1},{"intensity":0.7,"time":300,"x":0.34,"y":0}],"visible":true},{"movingPattern":"CONST_SPEED","playbackType":"FADE_OUT","pointList":[{"intensity":0.7,"time":0,"x":0.67,"y":1},{"intensity":0.7,"time":300,"x":0.67,"y":0}],"visible":true},{"movingPattern":"CONST_SPEED","playbackType":"FADE_OUT","pointList":[{"intensity":0.7,"time":0,"x":1,"y":1},{"intensity":0.7,"time":300,"x":1,"y":0}],"visible":true},{"movingPattern":"CONST_SPEED","playbackType":"NONE","pointList":[{"intensity":0.7,"time":0,"x":0,"y":1},{"intensity":0.7,"time":73,"x":0.33,"y":0.76},{"intensity":0.7,"time":150,"x":0,"y":0.48},{"intensity":0.7,"time":223,"x":0.34,"y":0.25},{"intensity":0.7,"time":300,"x":0,"y":0}],"visible":true},{"movingPattern":"CONST_SPEED","playbackType":"NONE","pointList":[{"intensity":0.7,"time":0,"x":1,"y":1},{"intensity":0.7,"time":74,"x":0.67,"y":0.75},{"intensity":0.7,"time":148,"x":1,"y":0.5},{"intensity":0.7,"time":223,"x":0.66,"y":0.25},{"intensity":0.7,"time":300,"x":1,"y":0}],"visible":true}]}}},"name":"Effect 1","offsetTime":300,"startTime":550}],"enable":true},{"enable":true,"effects":[]}],"updatedAt":1630238182973},"durationMillis":0,"intervalMillis":20,"size":20} diff --git a/test/test_heuristics.rb b/test/test_heuristics.rb index 2193758bba..40080df71d 100755 --- a/test/test_heuristics.rb +++ b/test/test_heuristics.rb @@ -950,6 +950,13 @@ def test_t_by_heuristics }) end + def test_tact_by_heuristics + assert_heuristics({ + "Tact" => all_fixtures("Tact", "*.tact"), + "JSON" => all_fixtures("JSON", "*.tact"), + }) + end + def test_tag_by_heuristics assert_heuristics({ "Java Server Pages" => Dir.glob("#{fixtures_path}/Generic/tag/Java Server Pages/*"), From 1ef6e5e7981a3309efc7ede50163681de1f42577 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Tue, 25 Jun 2024 19:11:32 +0200 Subject: [PATCH 3/5] chore: update submodule for the latest version of grammar --- vendor/grammars/tact-vscode | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vendor/grammars/tact-vscode b/vendor/grammars/tact-vscode index 7b3449dced..fe035d1eb8 160000 --- a/vendor/grammars/tact-vscode +++ b/vendor/grammars/tact-vscode @@ -1 +1 @@ -Subproject commit 7b3449dced3b69f25af98dc0ad56140c1ae88005 +Subproject commit fe035d1eb828bcfd20f249902c6d230d0964c41f From 02c97a27a7f5df2ca38377fc20fea8d38880040c Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Fri, 27 Sep 2024 10:11:24 +0200 Subject: [PATCH 4/5] chore: correct the regex in heuristics --- lib/linguist/heuristics.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/linguist/heuristics.yml b/lib/linguist/heuristics.yml index 16b6a6d0a5..9604b022b2 100644 --- a/lib/linguist/heuristics.yml +++ b/lib/linguist/heuristics.yml @@ -756,7 +756,7 @@ disambiguations: - extensions: ['.tact'] rules: - language: JSON - pattern: '\A\s*\{\"project\"\:' + pattern: '\A\s*\{\"' - language: Tact - extensions: ['.tag'] rules: From 241eccf2810a228b0b3fd3a73122a10a9514d3d2 Mon Sep 17 00:00:00 2001 From: Novus Nota <68142933+novusnota@users.noreply.github.com> Date: Fri, 27 Sep 2024 09:03:08 +0000 Subject: [PATCH 5/5] chore: change source from `tact-vscode` to `tact-sublime` --- .gitmodules | 6 +- grammars.yml | 2 +- vendor/README.md | 2 +- vendor/grammars/tact-sublime | 1 + vendor/grammars/tact-vscode | 1 - .../git_submodule/tact-sublime.dep.yml | 33 +++ .../git_submodule/tact-vscode.dep.yml | 213 ------------------ 7 files changed, 39 insertions(+), 219 deletions(-) create mode 160000 vendor/grammars/tact-sublime delete mode 160000 vendor/grammars/tact-vscode create mode 100644 vendor/licenses/git_submodule/tact-sublime.dep.yml delete mode 100644 vendor/licenses/git_submodule/tact-vscode.dep.yml diff --git a/.gitmodules b/.gitmodules index d247643653..e4c470787b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1214,9 +1214,9 @@ [submodule "vendor/grammars/syntax-mcfunction"] path = vendor/grammars/syntax-mcfunction url = https://github.com/MinecraftCommands/syntax-mcfunction.git -[submodule "vendor/grammars/tact-vscode"] - path = vendor/grammars/tact-vscode - url = https://github.com/tact-lang/tact-vscode.git +[submodule "vendor/grammars/tact-sublime"] + path = vendor/grammars/tact-sublime + url = https://github.com/tact-lang/tact-sublime.git [submodule "vendor/grammars/tcl.tmbundle"] path = vendor/grammars/tcl.tmbundle url = https://github.com/textmate/tcl.tmbundle diff --git a/grammars.yml b/grammars.yml index cf33725fc5..2a065ed9ff 100644 --- a/grammars.yml +++ b/grammars.yml @@ -1084,7 +1084,7 @@ vendor/grammars/syntax: - source.sentinel vendor/grammars/syntax-mcfunction: - source.mcfunction -vendor/grammars/tact-vscode: +vendor/grammars/tact-sublime: - source.tact vendor/grammars/tcl.tmbundle: - source.tcl diff --git a/vendor/README.md b/vendor/README.md index f693bb49ea..b72821d610 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -573,7 +573,7 @@ This is a list of grammars that Linguist selects to provide syntax highlighting - **TSV:** [Alhadis/language-etc](https://github.com/Alhadis/language-etc) - **TSX:** [Microsoft/TypeScript-TmLanguage](https://github.com/Microsoft/TypeScript-TmLanguage) - **TXL:** [MikeHoffert/Sublime-Text-TXL-syntax](https://github.com/MikeHoffert/Sublime-Text-TXL-syntax) -- **Tact:** [tact-lang/tact-vscode](https://github.com/tact-lang/tact-vscode) +- **Tact:** [tact-lang/tact-sublime](https://github.com/tact-lang/tact-sublime) - **Talon:** [mrob95/vscode-TalonScript](https://github.com/mrob95/vscode-TalonScript) - **Tcl:** [textmate/tcl.tmbundle](https://github.com/textmate/tcl.tmbundle) - **Tcsh:** [atom/language-shellscript](https://github.com/atom/language-shellscript) diff --git a/vendor/grammars/tact-sublime b/vendor/grammars/tact-sublime new file mode 160000 index 0000000000..3b63bdf414 --- /dev/null +++ b/vendor/grammars/tact-sublime @@ -0,0 +1 @@ +Subproject commit 3b63bdf414775b9755197c5c9ca5baf82b3bafd1 diff --git a/vendor/grammars/tact-vscode b/vendor/grammars/tact-vscode deleted file mode 160000 index fe035d1eb8..0000000000 --- a/vendor/grammars/tact-vscode +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fe035d1eb828bcfd20f249902c6d230d0964c41f diff --git a/vendor/licenses/git_submodule/tact-sublime.dep.yml b/vendor/licenses/git_submodule/tact-sublime.dep.yml new file mode 100644 index 0000000000..fa3b513a0a --- /dev/null +++ b/vendor/licenses/git_submodule/tact-sublime.dep.yml @@ -0,0 +1,33 @@ +--- +name: tact-sublime +version: 3b63bdf414775b9755197c5c9ca5baf82b3bafd1 +type: git_submodule +homepage: https://github.com/tact-lang/tact-sublime.git +license: mit +licenses: +- sources: LICENSE + text: | + MIT License + + Copyright (c) 2024 Novus Nota + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in all + copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + SOFTWARE. +- sources: README.md + text: "[MIT](LICENSE) © [Novus Nota](https://github.com/novusnota)." +notices: [] diff --git a/vendor/licenses/git_submodule/tact-vscode.dep.yml b/vendor/licenses/git_submodule/tact-vscode.dep.yml deleted file mode 100644 index 8d98dc04b0..0000000000 --- a/vendor/licenses/git_submodule/tact-vscode.dep.yml +++ /dev/null @@ -1,213 +0,0 @@ ---- -name: tact-vscode -version: 7b3449dced3b69f25af98dc0ad56140c1ae88005 -type: git_submodule -homepage: https://github.com/tact-lang/tact-vscode.git -license: apache-2.0 -licenses: -- sources: LICENSE - text: |2- - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [2023] [Steve Korshakov (ex3ndr)] - Copyright [2023] [XTON crypto wallet team] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -notices: [] -