From 29e19fc062a85382a561ca5d23194df79d7d522e Mon Sep 17 00:00:00 2001 From: Garen Torikian Date: Tue, 2 Oct 2012 15:05:38 -0700 Subject: [PATCH] Updates to Typescript highlighting --- demo/kitchen-sink/docs/typescript.ts | 32 +++++++++++++++++----- lib/ace/mode/typescript_highlight_rules.js | 8 +++--- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/demo/kitchen-sink/docs/typescript.ts b/demo/kitchen-sink/docs/typescript.ts index 31df9521..2f880d03 100644 --- a/demo/kitchen-sink/docs/typescript.ts +++ b/demo/kitchen-sink/docs/typescript.ts @@ -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') -button.innerText = "Say Hello" -button.onclick = function() { - alert(greeter.greet()) -} + public clear() { + this.turnContinues = false; + this.seedStoredCount = 0; + this.capturedCount = 0; + this.spaceCaptured = NoSpace; + } -document.body.appendChild(button) \ No newline at end of file + 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; + } + } +} \ No newline at end of file diff --git a/lib/ace/mode/typescript_highlight_rules.js b/lib/ace/mode/typescript_highlight_rules.js index 5065e473..030a1d44 100644 --- a/lib/ace/mode/typescript_highlight_rules.js +++ b/lib/ace/mode/typescript_highlight_rules.js @@ -52,8 +52,8 @@ var TypeScriptHighlightRules = function() { "start": [ // Match stuff like: module name {...} { - "token": ["keyword.operator.ts", "text", "variable.parameter.function.ts"], - "regex": "\\b(module)(\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)\\s*" + "token": ["keyword.operator.ts", "text", "variable.parameter.function.ts", "text"], + "regex": "\\b(module)(\\s*)([a-zA-Z0-9_?.$][\\w?.$]*)(\\s*\\{)" }, // Match stuff like: super(argument, list) { @@ -63,7 +63,7 @@ var TypeScriptHighlightRules = function() { // Match stuff like: function() {...} { "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) { @@ -72,7 +72,7 @@ var TypeScriptHighlightRules = function() { }, { "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"],