From 865e02bd60012c6839f2cd553195a2b3fed5a3f3 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 2 Jun 2012 01:09:48 +0400 Subject: [PATCH] tripple quoted strings for groovy --- lib/ace/mode/golang.js | 3 ++ lib/ace/mode/groovy_highlight_rules.js | 40 ++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/lib/ace/mode/golang.js b/lib/ace/mode/golang.js index 1d72fa81..094d8966 100644 --- a/lib/ace/mode/golang.js +++ b/lib/ace/mode/golang.js @@ -5,10 +5,13 @@ define(function(require, exports, module) { var Tokenizer = require("../tokenizer").Tokenizer; var GolangHighlightRules = require("./golang_highlight_rules").GolangHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; + var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; + var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.$tokenizer = new Tokenizer(new GolangHighlightRules().getRules()); this.$outdent = new MatchingBraceOutdent(); + this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); diff --git a/lib/ace/mode/groovy_highlight_rules.js b/lib/ace/mode/groovy_highlight_rules.js index 64ed0ab1..6a151eca 100644 --- a/lib/ace/mode/groovy_highlight_rules.js +++ b/lib/ace/mode/groovy_highlight_rules.js @@ -73,6 +73,14 @@ var GroovyHighlightRules = function() { }, { token : "string.regexp", regex : "[/](?:(?:\\[(?:\\\\]|[^\\]])+\\])|(?:\\\\/|[^\\]/]))*[/]\\w*\\s*(?=[).,;]|$)" + }, { + token : "string", + regex : '"""', + next : "qqstring" + }, { + token : "string", + regex : "'''", + next : "qstring" }, { token : "string", // single line regex : '["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]' @@ -130,6 +138,38 @@ var GroovyHighlightRules = function() { merge : true, regex : ".+" } + ], + "qqstring" : [ + { + token : "constant.language.escape", + regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/ + }, { + token : "constant.language.escape", + regex : /\$[\w\d]+/ + }, { + token : "constant.language.escape", + regex : /\$\{[^"\}]+\}?/ + }, { + token : "string", + regex : '"{3,5}', + next : "start" + }, { + token : "string", + regex : '.+?' + } + ], + "qstring" : [ + { + token : "constant.language.escape", + regex : /\\(?:u[0-9A-Fa-f]{4}|.|$)/ + }, { + token : "string", + regex : "'{3,5}", + next : "start" + }, { + token : "string", + regex : ".+?" + } ] };