-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2b355c9
commit fd1081d
Showing
17 changed files
with
514 additions
and
2 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
Prism.languages.squirrel = Prism.languages.extend('clike', { | ||
'comment': [ | ||
Prism.languages.clike['comment'][0], | ||
{ | ||
pattern: /(^|[^\\:])(?:\/\/|#).*/, | ||
lookbehind: true, | ||
greedy: true | ||
} | ||
], | ||
'string': [ | ||
{ | ||
pattern: /(^|[^\\"'@])(?:@"(?:[^"]|"")*"(?!")|"(?:[^\\\r\n"]|\\.)*")/, | ||
lookbehind: true, | ||
greedy: true | ||
}, | ||
{ | ||
pattern: /(^|[^\\"'])'(?:[^\\']|\\(?:[xuU][0-9a-fA-F]{0,8}|[^]))'/, | ||
lookbehind: true, | ||
greedy: true | ||
} | ||
], | ||
|
||
'class-name': { | ||
pattern: /(\b(?:class|enum|extends|instanceof)\s+)\w+(?:\.\w+)*/, | ||
lookbehind: true, | ||
inside: { | ||
'punctuation': /\./ | ||
} | ||
}, | ||
'keyword': /\b(?:base|break|case|catch|class|clone|const|constructor|continue|default|delete|else|enum|extends|for|foreach|function|if|in|instanceof|local|null|resume|return|static|switch|this|throw|try|typeof|while|yield|__LINE__|__FILE__)\b/, | ||
|
||
'number': /\b(?:0x[0-9a-fA-F]+|\d+(?:\.(?:\d+|[eE][+-]?\d+))?)\b/, | ||
'operator': /\+\+|--|<=>|<[-<]|>>>?|&&?|\|\|?|[-+*/%!=<>]=?|[~^]|::?/, | ||
'punctuation': /[(){}\[\],;.]/ | ||
}); | ||
|
||
Prism.languages.insertBefore('squirrel', 'operator', { | ||
'attribute-punctuation': { | ||
pattern: /<\/|\/>/, | ||
alias: 'important' | ||
}, | ||
'lambda': { | ||
pattern: /@(?=\()/, | ||
alias: 'operator' | ||
} | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<h2>Full example</h2> | ||
<pre><code> // source: http://www.squirrel-lang.org/#look | ||
|
||
local table = { | ||
a = "10" | ||
subtable = { | ||
array = [1,2,3] | ||
}, | ||
[10 + 123] = "expression index" | ||
} | ||
|
||
local array=[ 1, 2, 3, { a = 10, b = "string" } ]; | ||
|
||
foreach (i,val in array) | ||
{ | ||
::print("the type of val is"+typeof val); | ||
} | ||
|
||
///////////////////////////////////////////// | ||
|
||
class Entity | ||
{ | ||
constructor(etype,entityname) | ||
{ | ||
name = entityname; | ||
type = etype; | ||
} | ||
|
||
x = 0; | ||
y = 0; | ||
z = 0; | ||
name = null; | ||
type = null; | ||
} | ||
|
||
function Entity::MoveTo(newx,newy,newz) | ||
{ | ||
x = newx; | ||
y = newy; | ||
z = newz; | ||
} | ||
|
||
class Player extends Entity { | ||
constructor(entityname) | ||
{ | ||
base.constructor("Player",entityname) | ||
} | ||
function DoDomething() | ||
{ | ||
::print("something"); | ||
} | ||
|
||
} | ||
|
||
local newplayer = Player("da playar"); | ||
|
||
newplayer.MoveTo(100,200,300);</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
class Foo </ test = "I'm a class level attribute" />{ | ||
</ test = "freakin attribute" /> //attributes of PrintTesty | ||
function PrintTesty() | ||
{ | ||
foreach(i,val in testy) | ||
{ | ||
::print("idx = "+i+" = "+val+" \n"); | ||
} | ||
} | ||
</ flippy = 10 , second = [1,2,3] /> //attributes of testy | ||
testy = null; | ||
} | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "class"], | ||
["class-name", ["Foo"]], | ||
["attribute-punctuation", "</"], | ||
" test ", | ||
["operator", "="], | ||
["string", "\"I'm a class level attribute\""], | ||
["attribute-punctuation", "/>"], | ||
["punctuation", "{"], | ||
|
||
["attribute-punctuation", "</"], | ||
" test ", | ||
["operator", "="], | ||
["string", "\"freakin attribute\""], | ||
["attribute-punctuation", "/>"], | ||
["comment", "//attributes of PrintTesty"], | ||
|
||
["keyword", "function"], | ||
["function", "PrintTesty"], | ||
["punctuation", "("], | ||
["punctuation", ")"], | ||
|
||
["punctuation", "{"], | ||
|
||
["keyword", "foreach"], | ||
["punctuation", "("], | ||
"i", | ||
["punctuation", ","], | ||
"val ", | ||
["keyword", "in"], | ||
" testy", | ||
["punctuation", ")"], | ||
|
||
["punctuation", "{"], | ||
|
||
["operator", "::"], | ||
["function", "print"], | ||
["punctuation", "("], | ||
["string", "\"idx = \""], | ||
["operator", "+"], | ||
"i", | ||
["operator", "+"], | ||
["string", "\" = \""], | ||
["operator", "+"], | ||
"val", | ||
["operator", "+"], | ||
["string", "\" \\n\""], | ||
["punctuation", ")"], | ||
["punctuation", ";"], | ||
|
||
["punctuation", "}"], | ||
|
||
["punctuation", "}"], | ||
|
||
["attribute-punctuation", "</"], | ||
" flippy ", | ||
["operator", "="], | ||
["number", "10"], | ||
["punctuation", ","], | ||
" second ", | ||
["operator", "="], | ||
["punctuation", "["], | ||
["number", "1"], | ||
["punctuation", ","], | ||
["number", "2"], | ||
["punctuation", ","], | ||
["number", "3"], | ||
["punctuation", "]"], | ||
["attribute-punctuation", "/>"], | ||
["comment", "//attributes of testy"], | ||
|
||
"\r\n testy ", | ||
["operator", "="], | ||
["keyword", "null"], | ||
["punctuation", ";"], | ||
|
||
["punctuation", "}"] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
false | ||
true | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["boolean", "false"], | ||
["boolean", "true"] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
class Foo {} | ||
class FakeNamespace.Utils.SuperClass {} | ||
class SuperFoo extends Foo {} | ||
log(b instanceof Kid); | ||
enum Stuff {} | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "class"], | ||
["class-name", ["Foo"]], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
|
||
["keyword", "class"], | ||
["class-name", [ | ||
"FakeNamespace", | ||
["punctuation", "."], | ||
"Utils", | ||
["punctuation", "."], | ||
"SuperClass" | ||
]], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
|
||
["keyword", "class"], | ||
["class-name", ["SuperFoo"]], | ||
["keyword", "extends"], | ||
["class-name", ["Foo"]], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
|
||
["function", "log"], | ||
["punctuation", "("], | ||
"b ", | ||
["keyword", "instanceof"], | ||
["class-name", ["Kid"]], | ||
["punctuation", ")"], | ||
["punctuation", ";"], | ||
|
||
["keyword", "enum"], | ||
["class-name", ["Stuff"]], | ||
["punctuation", "{"], | ||
["punctuation", "}"] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* | ||
this is | ||
a multiline comment. | ||
this lines will be ignored by the compiler | ||
*/ | ||
//this is a single line comment. this line will be ignored by the compiler | ||
# this is also a single line comment. | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["comment", "/*\r\nthis is\r\na multiline comment.\r\nthis lines will be ignored by the compiler\r\n*/"], | ||
["comment", "//this is a single line comment. this line will be ignored by the compiler"], | ||
["comment", "# this is also a single line comment."] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
function abc(a,b,c) {} | ||
function(a,b,c) {} | ||
local myexp = @(a,b) a + b; | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "function"], | ||
["function", "abc"], | ||
["punctuation", "("], | ||
"a", | ||
["punctuation", ","], | ||
"b", | ||
["punctuation", ","], | ||
"c", | ||
["punctuation", ")"], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
|
||
["keyword", "function"], | ||
["punctuation", "("], | ||
"a", | ||
["punctuation", ","], | ||
"b", | ||
["punctuation", ","], | ||
"c", | ||
["punctuation", ")"], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
|
||
["keyword", "local"], | ||
" myexp ", | ||
["operator", "="], | ||
["lambda", "@"], | ||
["punctuation", "("], | ||
"a", | ||
["punctuation", ","], | ||
"b", | ||
["punctuation", ")"], | ||
" a ", | ||
["operator", "+"], | ||
" b", | ||
["punctuation", ";"] | ||
] |
Oops, something went wrong.