Skip to content

Commit

Permalink
overrides -> override, #13, #12
Browse files Browse the repository at this point in the history
  • Loading branch information
logvik committed Oct 21, 2023
1 parent 94302ac commit b9662bf
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "Tact language (for .tact file) extension to use together with Tact compiler for Visual Studio Code to develop smart contract for TON blockchain",
"publisher": "KonVik",
"icon": "icons/logo.png",
"version": "1.0.5",
"version": "1.0.6",
"keywords": [
"tact",
"blockchain",
Expand Down
4 changes: 2 additions & 2 deletions src/hoverService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ const hoverDescription = {
"description": [
"Tact compiler allows user to import files.\n",
"Example:\n",
"```\nimport \"@stdlib/jetton\";\n```",
"```\ncontract SampleJetton with Jetton {\n\\\\...\n}\n```"
"```\nimport \"@stdlib/deploy\";\n```",
"```\ncontract SampleJetton with deploy {\n\\\\...\n}\n```"
]
},
"address": {
Expand Down
112 changes: 96 additions & 16 deletions src/parser/build/parser.js

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

10 changes: 6 additions & 4 deletions src/parser/tact.pegjs
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,7 @@ PrimitiveToken = "primitive" !IdentifierPart
TraitToken = "trait" !IdentifierPart

GetToken = "get" !IdentifierPart
OverridesToken = "overrides" !IdentifierPart
OverridesToken = "override" !IdentifierPart
InlineToken = "inline" !IdentifierPart
VirtualToken = "virtual" !IdentifierPart

Expand Down Expand Up @@ -804,12 +804,14 @@ DeclarativeExpression
}

Mapping
= MappingToken __ "<" __ from:Type __ "," __ to:Type __ ">" __
= MappingToken __ "<" __ from:Type __ "as"? __ fromPrimitive:Type? __ "," __ to:Type __ "as"? __ toPrimitive:Type? __ ">" __
{
return {
type: "MappingExpression",
from: from,
to: to,
fromPrimitive: fromPrimitive != null ? fromPrimitive: "",
toPrimitive: toPrimitive != null ? toPrimitive: "",
start: location().start.offset,
end: location().end.offset
}
Expand Down Expand Up @@ -1503,7 +1505,7 @@ FunctionDeclaration
end: location().end.offset
};
}
/ modifier:((__ GetToken / __ OverridesToken / __ InlineToken / __ VirtualToken / __ MutatesToken / __ PublicToken)*)? __ FunctionToken __ fnname:FunctionName __ returns:ReturnsDeclarations __ body:FunctionBody
/ modifier:((__ GetToken / __ OverridesToken / __ InlineToken / __ VirtualToken / __ MutatesToken / __ PublicToken)*)? __ FunctionToken __ fnname:FunctionName __ returns:ReturnsDeclarations? __ body:FunctionBody
{
return {
type: "FunctionDeclaration",
Expand All @@ -1521,7 +1523,7 @@ FunctionDeclaration
end: location().end.offset
};
}
/ InitOfToken __ fnname:FunctionName __ returns:ReturnsDeclarations __ body:FunctionBody
/ InitOfToken __ fnname:FunctionName __ returns:ReturnsDeclarations? __ body:FunctionBody
{
return {
type: "FunctionDeclaration",
Expand Down
6 changes: 3 additions & 3 deletions src/prettier-plugin-tact/types/MappingExpression.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const MappingExpression = {
print: ({ path, print }: any) => //JSON.stringify(path)
print: ({ node, path, print }: any) => //JSON.stringify(path)
{
return [
'map<',
path.call(print, 'from'),
path.call(print, 'from') + (node.fromPrimitive != "" ? " as " + path.call(print, 'fromPrimitive'):""),
', ',
path.call(print, 'to'),
path.call(print, 'to') + (node.toPrimitive != "" ? " as " + path.call(print, 'toPrimitive'):""),
'>'
];
}
Expand Down
2 changes: 1 addition & 1 deletion syntaxes/tact.json
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@
"declaration-function": {
"patterns": [
{
"begin": "\\b((?:(?:public|get|extends|overrides|inline|virtual|mutates)|\\s+)*)\\s+(fun|native)\\s+(\\w+)\\b",
"begin": "\\b((?:(?:public|get|extends|override|inline|virtual|mutates)|\\s+)*)\\s+(fun|native)\\s+(\\w+)\\b",
"beginCaptures": {
"1": {
"name": "keyword.control.flow"
Expand Down

0 comments on commit b9662bf

Please sign in to comment.