Skip to content

Commit

Permalink
Add language: Tact, and extension to JSON (#6689)
Browse files Browse the repository at this point in the history
* Add language: `Tact`

* fix: Heuristics and samples for JSON .tact format

* chore: update submodule for the latest version of grammar

* chore: correct the regex in heuristics

* chore: change source from `tact-vscode` to `tact-sublime`
  • Loading branch information
novusnota authored Nov 25, 2024
1 parent eb88732 commit 120e0e5
Show file tree
Hide file tree
Showing 11 changed files with 421 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -1217,6 +1217,9 @@
[submodule "vendor/grammars/syntax-mcfunction"]
path = vendor/grammars/syntax-mcfunction
url = https://github.com/MinecraftCommands/syntax-mcfunction.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
Expand Down
2 changes: 2 additions & 0 deletions grammars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1089,6 +1089,8 @@ vendor/grammars/syntax:
- source.sentinel
vendor/grammars/syntax-mcfunction:
- source.mcfunction
vendor/grammars/tact-sublime:
- source.tact
vendor/grammars/tcl.tmbundle:
- source.tcl
- text.html.tcl
Expand Down
5 changes: 5 additions & 0 deletions lib/linguist/heuristics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,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*\{\"'
- language: Tact
- extensions: ['.tag']
rules:
- language: Java Server Pages
Expand Down
9 changes: 9 additions & 0 deletions lib/linguist/languages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3286,6 +3286,7 @@ JSON:
- ".jsonl"
- ".mcmeta"
- ".sarif"
- ".tact"
- ".tfstate"
- ".tfstate.backup"
- ".topojson"
Expand Down Expand Up @@ -7244,6 +7245,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
Expand Down
1 change: 1 addition & 0 deletions samples/JSON/landing.tact
Original file line number Diff line number Diff line change
@@ -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}
20 changes: 20 additions & 0 deletions samples/Tact/deployable_counter.tact
Original file line number Diff line number Diff line change
@@ -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;
}
}
Loading

0 comments on commit 120e0e5

Please sign in to comment.