Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8bb759b

Browse filesBrowse files
committed
SaurScript 0.1
0 parents  commit 8bb759b
Copy full SHA for 8bb759b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

77 files changed

+7610
-0
lines changed

‎compile/helpers/delimiters.js

Copy file name to clipboard
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
const KEYWORDS = require('./keywords');
2+
3+
module.exports = {
4+
line: ["\\n", ";"],
5+
segment: [" ", "\\(", "\\)", "\\[", "\\]", "\\{", "\\}", '\\"', "\\'", ",", "`"].concat(KEYWORDS.operator),
6+
ignore: ["\n", "", null]
7+
}

‎compile/helpers/keywords.js

Copy file name to clipboard
+47Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
const TYPES = require('./types');
2+
3+
module.exports = {
4+
"comment": ["\/\/"],
5+
6+
"import": ["\\@import"],
7+
"export": ["\\@export"],
8+
"class": ["\\@class"],
9+
"endClass": ["\\@endclass"],
10+
"property": ["\\@property"],
11+
"instance": ["\\@new"],
12+
"enum": ["\\@enum"],
13+
"type": ["\\@type"],
14+
15+
"function": ["\\bfun\\b"],
16+
"return": ["\\breturn\\b"],
17+
18+
"if": ["\\bif\\b"],
19+
"elseif": ["\\belif\\b"],
20+
"else": ["\\belse\\b"],
21+
22+
"repeat": ["\\brepeat\\b"],
23+
24+
"type": TYPES.map(type => "\\b" + type + "\\b"),
25+
"setter": ["="],
26+
27+
"operator": ["\\+", "\\-", "\\*", "\\/", "\\%", ">>>"],
28+
"comparator": ["<", ">", "==", "!=", "^is$"],
29+
30+
"openParen": ["\\("],
31+
"closeParen": ["\\)"],
32+
"openBrace": ["\\["],
33+
"closeBrace": ["\\]"],
34+
"openBracket": ["\\{"],
35+
"closeBracket": ["\\}"],
36+
37+
"delimiter": [","],
38+
39+
"openCloseString": ['\\"', "\\'"],
40+
// Allow integers or decimals:
41+
"number": ["\^\[1\-9]\\d\*\(\\\.\\d\+\)\?\$"],
42+
"constant": ["\\btrue\\b", "\\bfalse\\b", "\\bnull\\b"],
43+
44+
"startJS": ["\\`"]
45+
46+
// Anything else is an ID
47+
}

‎compile/helpers/logger.js

Copy file name to clipboard
+27Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const colors = require('colors');
2+
const prettyjson = require('prettyjson');
3+
4+
class Logger {
5+
constructor() {}
6+
7+
error(message) {
8+
console.log(message.red.bold);
9+
}
10+
warning(message) {
11+
console.log(message.yellow.bold);
12+
}
13+
success(message) {
14+
console.log(message.green.bold);
15+
}
16+
log(message) {
17+
console.log(message);
18+
}
19+
info(message) {
20+
console.log(message.blue.bold);
21+
}
22+
json(obj) {
23+
console.log(prettyjson.render(obj));
24+
}
25+
}
26+
27+
module.exports = Logger;

‎compile/helpers/types.js

Copy file name to clipboard
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
let types = ["String", "Int", "Float", "Bool", "Any"];
2+
3+
let arrayTypes = [];
4+
types.forEach(type => {
5+
arrayTypes.push(`Array\\<${type}\\>`);
6+
});
7+
8+
// Add dictionary types for every combination
9+
let dictionaryTypes = [];
10+
types.forEach(key => {
11+
types.concat(arrayTypes).forEach(value => {
12+
dictionaryTypes.push(`Dictionary\\<${key}\\:${value}\\>`);
13+
});
14+
});
15+
16+
types = types.concat(arrayTypes).concat(dictionaryTypes);
17+
18+
module.exports = types;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.