Skip to content

Commit

Permalink
feat: Updates towards Tact version 1.2.0
Browse files Browse the repository at this point in the history
* Underscores for numeric separators
* Minor fixes of literals
  • Loading branch information
novusnota committed Feb 15, 2024
1 parent 403c6b1 commit 8e2f1e7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
17 changes: 10 additions & 7 deletions components/prism-tact.js
Expand Up @@ -61,17 +61,20 @@

'number': [
{ // hexadecimal, case-insensitive /i
pattern: /\b0x[0-9a-f]+\b/i,
pattern: /\b0x[0-9a-f](?:_?[0-9a-f])*\b/i,
},
{ // octal, case-insensitive /i
pattern: /\b0o[0-7]+\b/i,
},
{ // decimal integers
pattern: /\b\d+\b/,
pattern: /\b0o[0-7](?:_?[0-7])*\b/i,
},
{ // binary, case-insensitive /i
pattern: /\b0b[01]+\b/i,
}
pattern: /\b0b[01](?:_?[01])*\b/i,
},
{ // decimal integers, starting with 0
pattern: /\b0\d*\b/,
},
{ // other decimal integers
pattern: /\b[1-9](?:_?\d)*\b/,
},
],

'string': undefined,
Expand Down
2 changes: 1 addition & 1 deletion components/prism-tact.min.js

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

22 changes: 14 additions & 8 deletions tests/languages/tact/complete.test
Expand Up @@ -12,8 +12,8 @@ message(0x1234) MyMessage {
}

trait MyTrait {
const CONST_VAL: Int = 42 + true ? 0x1 : 0x2;
get fun traitState(): Int {
const CONST_VAL: Int = 42;
return 0;
}
}
Expand Down Expand Up @@ -98,6 +98,19 @@ contract MyContract with MyTrait, Ownable? {
["keyword", "trait"],
["class-name", "MyTrait"],
["punctuation", "{"],
["keyword", "const"],
["constant", "CONST_VAL"],
["punctuation", ":"],
["builtin", "Int"],
["operator", "="],
["number", "42"],
["operator", "+"],
["boolean", "true"],
["punctuation", "?"],
["number", "0x1"],
["punctuation", ":"],
["number", "0x2"],
["punctuation", ";"],
["keyword", "get"],
["keyword", "fun"],
["function", "traitState"],
Expand All @@ -106,13 +119,6 @@ contract MyContract with MyTrait, Ownable? {
["punctuation", ":"],
["builtin", "Int"],
["punctuation", "{"],
["keyword", "const"],
["constant", "CONST_VAL"],
["punctuation", ":"],
["builtin", "Int"],
["operator", "="],
["number", "42"],
["punctuation", ";"],
["keyword", "return"],
["number", "0"],
["punctuation", ";"],
Expand Down

0 comments on commit 8e2f1e7

Please sign in to comment.