Merge pull request #1005 from ajaxorg/mode/typescript
Some updates to typescript
This commit is contained in:
commit
eae66e4fc2
2 changed files with 29 additions and 11 deletions
|
|
@ -43,12 +43,30 @@ module Sayings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var greeter = new Sayings.Greeter("world");
|
module Mankala {
|
||||||
|
export class Features {
|
||||||
|
public turnContinues = false;
|
||||||
|
public seedStoredCount = 0;
|
||||||
|
public capturedCount = 0;
|
||||||
|
public spaceCaptured = NoSpace;
|
||||||
|
|
||||||
var button = document.createElement('button')
|
public clear() {
|
||||||
button.innerText = "Say Hello"
|
this.turnContinues = false;
|
||||||
button.onclick = function() {
|
this.seedStoredCount = 0;
|
||||||
alert(greeter.greet())
|
this.capturedCount = 0;
|
||||||
}
|
this.spaceCaptured = NoSpace;
|
||||||
|
}
|
||||||
|
|
||||||
document.body.appendChild(button)
|
public toString() {
|
||||||
|
var stringBuilder = "";
|
||||||
|
if (this.turnContinues) {
|
||||||
|
stringBuilder += " turn continues,";
|
||||||
|
}
|
||||||
|
stringBuilder += " stores " + this.seedStoredCount;
|
||||||
|
if (this.capturedCount > 0) {
|
||||||
|
stringBuilder += " captures " + this.capturedCount + " from space " + this.spaceCaptured;
|
||||||
|
}
|
||||||
|
return stringBuilder;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -50,8 +50,8 @@ var TypeScriptHighlightRules = function() {
|
||||||
var tsRules = [
|
var tsRules = [
|
||||||
// Match stuff like: module name {...}
|
// Match stuff like: module name {...}
|
||||||
{
|
{
|
||||||
"token": ["keyword.operator.ts", "text", "variable.parameter.function.ts"],
|
"token": ["keyword.operator.ts", "text", "variable.parameter.function.ts", "text"],
|
||||||
"regex": "\\b(module)(\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)\\s*"
|
"regex": "\\b(module)(\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)(\\s*\\{)"
|
||||||
},
|
},
|
||||||
// Match stuff like: super(argument, list)
|
// Match stuff like: super(argument, list)
|
||||||
{
|
{
|
||||||
|
|
@ -61,7 +61,7 @@ var TypeScriptHighlightRules = function() {
|
||||||
// Match stuff like: function() {...}
|
// Match stuff like: function() {...}
|
||||||
{
|
{
|
||||||
"token": ["entity.name.function.ts","paren.lparen", "paren.rparen"],
|
"token": ["entity.name.function.ts","paren.lparen", "paren.rparen"],
|
||||||
"regex": "([a-zA-Z_?.$][\\w?.$]*)(\\()(\\))(?:\\s*\\{)"
|
"regex": "([a-zA-Z_?.$][\\w?.$]*)(\\()(\\))"
|
||||||
},
|
},
|
||||||
// Match stuff like: (function: return type)
|
// Match stuff like: (function: return type)
|
||||||
{
|
{
|
||||||
|
|
@ -70,7 +70,7 @@ var TypeScriptHighlightRules = function() {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"token": ["keyword.operator.ts"],
|
"token": ["keyword.operator.ts"],
|
||||||
"regex": "(?:\\b(constructor|declare|interface|as|AS)\\b)"
|
"regex": "(?:\\b(constructor|declare|interface|as|AS|public|private|class|extends|export|super)\\b)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"token": ["storage.type.variable.ts"],
|
"token": ["storage.type.variable.ts"],
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue