v0.3.1
This commit is contained in:
11
Tools/SpeedTest/fib.fig
Normal file
11
Tools/SpeedTest/fib.fig
Normal file
@@ -0,0 +1,11 @@
|
||||
fun fib(x:Int) -> Int
|
||||
{
|
||||
if (x <= 1)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
return fib(x-1) + fib(x-2);
|
||||
}
|
||||
|
||||
var result := fib(25);
|
||||
__fstdout_println("result: ", result);
|
||||
11
Tools/SpeedTest/fib.py
Normal file
11
Tools/SpeedTest/fib.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from time import time as tt
|
||||
|
||||
def fib(x:int) -> int:
|
||||
if x <= 1: return x;
|
||||
return fib(x-1) + fib(x-2)
|
||||
|
||||
if __name__ == '__main__':
|
||||
t0 = tt()
|
||||
result = fib(25)
|
||||
t1 = tt()
|
||||
print('cost: ',t1-t0, 'result:', result)
|
||||
24
Tools/SpeedTest/fibLoopTest.fig
Normal file
24
Tools/SpeedTest/fibLoopTest.fig
Normal file
@@ -0,0 +1,24 @@
|
||||
var callCnt:Int = 0;
|
||||
fun fib(x:Int) -> Int
|
||||
{
|
||||
callCnt = callCnt + 1;
|
||||
if (x <= 1)
|
||||
{
|
||||
return x;
|
||||
}
|
||||
return fib(x-1) + fib(x-2);
|
||||
}
|
||||
|
||||
var fibx:Int;
|
||||
__fstdout_print("input an index of fib ");
|
||||
fibx = __fvalue_int_parse(__fstdin_read());
|
||||
|
||||
var cnt:Int = 0;
|
||||
__fstdout_println("test forever");
|
||||
while (true)
|
||||
{
|
||||
cnt = cnt + 1;
|
||||
__fstdout_println("test ", cnt,",result: ", fib(fibx));
|
||||
__fstdout_println("func `fib` called ", callCnt);
|
||||
callCnt = 0;
|
||||
}
|
||||
4
Tools/VscodeExtension/fig-languague-syntax/.vscodeignore
Normal file
4
Tools/VscodeExtension/fig-languague-syntax/.vscodeignore
Normal file
@@ -0,0 +1,4 @@
|
||||
.vscode/**
|
||||
.vscode-test/**
|
||||
.gitignore
|
||||
vsc-extension-quickstart.md
|
||||
9
Tools/VscodeExtension/fig-languague-syntax/CHANGELOG.md
Normal file
9
Tools/VscodeExtension/fig-languague-syntax/CHANGELOG.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to the "fig-languague-syntax" extension will be documented in this file.
|
||||
|
||||
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
- Initial release
|
||||
3
Tools/VscodeExtension/fig-languague-syntax/README.md
Normal file
3
Tools/VscodeExtension/fig-languague-syntax/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
# fig-languague-syntax README
|
||||
|
||||
Nothing
|
||||
Binary file not shown.
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"comments": {
|
||||
"lineComment": "//",
|
||||
"blockComment": [
|
||||
"/*",
|
||||
"*/"
|
||||
]
|
||||
},
|
||||
"brackets": [
|
||||
[
|
||||
"{",
|
||||
"}"
|
||||
],
|
||||
[
|
||||
"[",
|
||||
"]"
|
||||
],
|
||||
[
|
||||
"(",
|
||||
")"
|
||||
],
|
||||
[
|
||||
"\"",
|
||||
"\""
|
||||
],
|
||||
[
|
||||
"/\"",
|
||||
"\"/"
|
||||
]
|
||||
],
|
||||
"autoClosingPairs": [
|
||||
{
|
||||
"open": "{",
|
||||
"close": "}"
|
||||
},
|
||||
{
|
||||
"open": "[",
|
||||
"close": "]"
|
||||
},
|
||||
{
|
||||
"open": "(",
|
||||
"close": ")"
|
||||
},
|
||||
{
|
||||
"open": "\"",
|
||||
"close": "\"",
|
||||
"notIn": [
|
||||
"string"
|
||||
]
|
||||
},
|
||||
{
|
||||
"open": "/\"",
|
||||
"close": "\"/"
|
||||
}
|
||||
],
|
||||
"surroundingPairs": [
|
||||
[
|
||||
"{",
|
||||
"}"
|
||||
],
|
||||
[
|
||||
"[",
|
||||
"]"
|
||||
],
|
||||
[
|
||||
"(",
|
||||
")"
|
||||
],
|
||||
[
|
||||
"\"",
|
||||
"\""
|
||||
],
|
||||
[
|
||||
"/\"",
|
||||
"\"/"
|
||||
]
|
||||
],
|
||||
"indentationRules": {
|
||||
"increaseIndentPattern": "^(?=.*(\\{|\\()|.*/\\\").*$",
|
||||
"decreaseIndentPattern": "^\\s*[}\\)]|\\s*\"/"
|
||||
}
|
||||
}
|
||||
33
Tools/VscodeExtension/fig-languague-syntax/package.json
Normal file
33
Tools/VscodeExtension/fig-languague-syntax/package.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "fig-languague-syntax",
|
||||
"displayName": "Fig Languague Syntax",
|
||||
"description": ":)",
|
||||
"version": "0.0.1",
|
||||
"engines": {
|
||||
"vscode": "^1.96.0"
|
||||
},
|
||||
"categories": [
|
||||
"Programming Languages"
|
||||
],
|
||||
"contributes": {
|
||||
"languages": [
|
||||
{
|
||||
"id": "fig",
|
||||
"extensions": [
|
||||
".fl"
|
||||
],
|
||||
"aliases": [
|
||||
"Fig"
|
||||
],
|
||||
"configuration": "./language-configuration.json"
|
||||
}
|
||||
],
|
||||
"grammars": [
|
||||
{
|
||||
"language": "fig",
|
||||
"scopeName": "source.fig",
|
||||
"path": "./syntaxes/fig.tmLanguage.json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
{
|
||||
"$schema": "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
|
||||
"name": "Fig",
|
||||
"scopeName": "source.fig",
|
||||
"fileTypes": [
|
||||
".fl"
|
||||
],
|
||||
"patterns": [
|
||||
{
|
||||
"name": "comment.line.double-slash",
|
||||
"match": "//.*"
|
||||
},
|
||||
{
|
||||
"name": "comment.block",
|
||||
"begin": "/\\*",
|
||||
"end": "\\*/",
|
||||
"captures": {
|
||||
"0": {
|
||||
"name": "comment.block.fig"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "keyword.control",
|
||||
"match": "\\b(if|else|for|while|continue|break|return|or|not)\\b"
|
||||
},
|
||||
{
|
||||
"name": "keyword.declaration",
|
||||
"match": "\\b(var|val|func|module)\\b"
|
||||
},
|
||||
{
|
||||
"name": "storage.type",
|
||||
"match": "\\b(Int32|Int64|Float|Double|Map|Bool|Null|String)\\b"
|
||||
},
|
||||
{
|
||||
"name": "entity.name.function",
|
||||
"match": "(?<=\\bfunc\\b)\\s+\\w+"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator.arrow",
|
||||
"match": "->"
|
||||
},
|
||||
{
|
||||
"name": "keyword.operator",
|
||||
"match": "[+\\-*/%&|><!]=?|&&|\\|\\||=="
|
||||
},
|
||||
{
|
||||
"name": "string.quoted.double",
|
||||
"begin": "\"",
|
||||
"end": "\"",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape",
|
||||
"match": "\\\\."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "string.quoted.multiline",
|
||||
"begin": "\\/\\\"",
|
||||
"end": "\\\"/",
|
||||
"patterns": [
|
||||
{
|
||||
"name": "constant.character.escape",
|
||||
"match": "\\\\."
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "constant.numeric.integer",
|
||||
"match": "\\b\\d+\\b"
|
||||
},
|
||||
{
|
||||
"name": "constant.numeric.float",
|
||||
"match": "\\b\\d+\\.\\d+([eE][+-]?\\d+)?[f]?\\b"
|
||||
},
|
||||
{
|
||||
"name": "punctuation.curly",
|
||||
"match": "[{}]"
|
||||
},
|
||||
{
|
||||
"name": "punctuation.parenthesis",
|
||||
"match": "[()]"
|
||||
},
|
||||
{
|
||||
"name": "punctuation.square",
|
||||
"match": "[\\[\\]]"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
# Welcome to your VS Code Extension
|
||||
|
||||
## What's in the folder
|
||||
|
||||
* This folder contains all of the files necessary for your extension.
|
||||
* `package.json` - this is the manifest file in which you declare your language support and define the location of the grammar file that has been copied into your extension.
|
||||
* `syntaxes/figlang.tmLanguage.json` - this is the Text mate grammar file that is used for tokenization.
|
||||
* `language-configuration.json` - this is the language configuration, defining the tokens that are used for comments and brackets.
|
||||
|
||||
## Get up and running straight away
|
||||
|
||||
* Make sure the language configuration settings in `language-configuration.json` are accurate.
|
||||
* Press `F5` to open a new window with your extension loaded.
|
||||
* Create a new file with a file name suffix matching your language.
|
||||
* Verify that syntax highlighting works and that the language configuration settings are working.
|
||||
|
||||
## Make changes
|
||||
|
||||
* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
|
||||
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
|
||||
|
||||
## Add more language features
|
||||
|
||||
* To add features such as IntelliSense, hovers and validators check out the VS Code extenders documentation at https://code.visualstudio.com/docs
|
||||
|
||||
## Install your extension
|
||||
|
||||
* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
|
||||
* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.
|
||||
Reference in New Issue
Block a user