From 3b6baafe290b4184875a0322f664edf2701eb4a6 Mon Sep 17 00:00:00 2001 From: Nala Ginrut Date: Thu, 31 Jan 2013 11:21:37 +0800 Subject: [PATCH 1/6] Add: Scheme highlight rules new file: lib/ace/mode/scheme.js new file: lib/ace/mode/scheme_highlight_rules.js --- lib/ace/mode/scheme.js | 56 +++++++++++ lib/ace/mode/scheme_highlight_rules.js | 123 +++++++++++++++++++++++++ 2 files changed, 179 insertions(+) create mode 100644 lib/ace/mode/scheme.js create mode 100644 lib/ace/mode/scheme_highlight_rules.js diff --git a/lib/ace/mode/scheme.js b/lib/ace/mode/scheme.js new file mode 100644 index 00000000..fd37a576 --- /dev/null +++ b/lib/ace/mode/scheme.js @@ -0,0 +1,56 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * Contributor(s): + * + * NalaGinrut@gmail.com + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextMode = require("./text").Mode; +var Tokenizer = require("../tokenizer").Tokenizer; +var SchemeHighlightRules = require("./scheme_highlight_rules").SchemeHighlightRules; + +var Mode = function() { + var highlighter = new SchemeHighlightRules(); + + this.$tokenizer = new Tokenizer(highlighter.getRules()); +}; +oop.inherits(Mode, TextMode); + +(function() { + // Extra logic goes here. +}).call(Mode.prototype); + +exports.Mode = Mode; +}); diff --git a/lib/ace/mode/scheme_highlight_rules.js b/lib/ace/mode/scheme_highlight_rules.js new file mode 100644 index 00000000..e9a58999 --- /dev/null +++ b/lib/ace/mode/scheme_highlight_rules.js @@ -0,0 +1,123 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Distributed under the BSD license: + * + * Copyright (c) 2012, Ajax.org B.V. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Ajax.org B.V. nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * + * Contributor(s): + * + * NalaGinrut@gmail.com + * + * ***** END LICENSE BLOCK ***** */ + +define(function(require, exports, module) { +"use strict"; + +var oop = require("../lib/oop"); +var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; + +var SchemeHighlightRules = function() { + var keywordControl = "case|do|let|loop|if|else|when"; + var keywordOperator = "eq?|eqv?|equal?|and|or|not"; + var constantLanguage = "#t|#f|'()"; + var supportFunctions = "cons|car|cdr|cond|lambda|lambda*|syntax-rules|format|set!|quote|eval|append|list|list?|member?|load"; + + var keywordMapper = this.createKeywordMapper({ + "keyword.control": keywordControl, + "keyword.operator": keywordOperator, + "constant.language": constantLanguage, + "support.function": supportFunctions + }, "identifier", true); + + // regexp must not have capturing parentheses. Use (?:) instead. + // regexps are ordered -> the first match is used + + this.$rules = + { + "start": [ + { + token : "comment", + regex : ";.*$" + }, + { + "token": ["storage.type.function-type.scheme", "text", "entity.name.function.scheme"], + "regex": "(?:\\b(?:(define|define-syntax|define-macro))\\b)(\\s+)((?:\\w|\\-|\\!|\\?)*)" + }, + { + "token": ["punctuation.definition.constant.character.scheme", "constant.character.scheme"], + "regex": "(#)((?:\\w|[\\\\+-=<>'\"&#])+)" + }, + { + "token": ["punctuation.definition.variable.scheme", "variable.other.global.scheme", "punctuation.definition.variable.scheme"], + "regex": "(\\*)(\\S*)(\\*)" + }, + { + "token" : "constant.numeric", // hex + "regex" : "#[xX][0-9a-fA-F]+(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" + }, + { + "token" : "constant.numeric", // float + "regex" : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" + }, + { + "token" : keywordMapper, + "regex" : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + }, + { + "token" : "string", + "regex" : '"(?=.)', + "next" : "qqstring" + } + ], + "qqstring": [ + { + "token": "constant.character.escape.scheme", + "regex": "\\\\." + }, + { + "token" : "string", + "regex" : '[^"\\\\]+', + "merge" : true + }, { + "token" : "string", + "regex" : "\\\\$", + "next" : "qqstring", + "merge" : true + }, { + "token" : "string", + "regex" : '"|$', + "next" : "start", + "merge" : true + } + ] +} + +}; + +oop.inherits(SchemeHighlightRules, TextHighlightRules); + +exports.SchemeHighlightRules = SchemeHighlightRules; +}); From 065e1ae19c8eb8ac2b0e4b2e88ff6cf83a5eb5cc Mon Sep 17 00:00:00 2001 From: Nala Ginrut Date: Thu, 31 Jan 2013 16:12:54 +0800 Subject: [PATCH 2/6] Update Scheme mode. modified: demo/kitchen-sink/doclist.js modified: demo/kitchen-sink/modelist.js new file: lib/ace/mode/_test/tokens_scheme.json modified: lib/ace/mode/scheme_highlight_rules.js --- demo/kitchen-sink/doclist.js | 1 + demo/kitchen-sink/modelist.js | 3 +- lib/ace/mode/_test/tokens_scheme.json | 248 +++++++++++++++++++++++++ lib/ace/mode/scheme_highlight_rules.js | 2 +- 4 files changed, 252 insertions(+), 2 deletions(-) create mode 100644 lib/ace/mode/_test/tokens_scheme.json diff --git a/demo/kitchen-sink/doclist.js b/demo/kitchen-sink/doclist.js index f75e6e86..1266c620 100644 --- a/demo/kitchen-sink/doclist.js +++ b/demo/kitchen-sink/doclist.js @@ -90,6 +90,7 @@ var docs = { "docs/latex.tex": {name: "LaTeX", wrapped: true}, "docs/less.less": "LESS", "docs/lisp.lisp": "Lisp", + "docs/scheme.scheme": "Scheme", "docs/liquid.liquid": "Liquid", "docs/lua.lua": "Lua", "docs/lucene.lucene": "Lucene", diff --git a/demo/kitchen-sink/modelist.js b/demo/kitchen-sink/modelist.js index ec2ce2d6..049ac0ef 100644 --- a/demo/kitchen-sink/modelist.js +++ b/demo/kitchen-sink/modelist.js @@ -62,7 +62,8 @@ var modesByName = { jsx: ["JSX" , "jsx"], latex: ["LaTeX" , "latex|tex|ltx|bib"], less: ["LESS" , "less"], - lisp: ["Lisp" , "lisp|scm|rkt"], + lisp: ["Lisp" , "lisp"], + scheme: ["Scheme" , "scm|rkt"], liquid: ["Liquid" , "liquid"], lua: ["Lua" , "lua"], luapage: ["LuaPage" , "lp"], // http://keplerproject.github.com/cgilua/manual.html#templates diff --git a/lib/ace/mode/_test/tokens_scheme.json b/lib/ace/mode/_test/tokens_scheme.json new file mode 100644 index 00000000..da9f93e0 --- /dev/null +++ b/lib/ace/mode/_test/tokens_scheme.json @@ -0,0 +1,248 @@ +[ + "start", + ["text","("], + ["storage.type.function-type.scheme","define"], + ["text"," "], + ["entity.name.function.scheme","prompt-for-cd"], + ["text"," ()"] +],[ + "start", + ["text"," "], + ["string","\"Prompts"] +],[ + "start", + ["text"," "], + ["identifier","for"], + ["text"," "], + ["identifier","CD"], + ["text","\""] +],[ + "start", + ["text"," ("], + ["identifier","prompt"], + ["text","-"], + ["identifier","read"], + ["text"," "], + ["string","\"Title\""], + ["text"," "], + ["constant.numeric","1.53"], + ["text"," "], + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text","/"], + ["constant.numeric","4"], + ["text"," "], + ["constant.numeric","1.7"], + ["text"," "], + ["constant.numeric","1.7e0"], + ["text"," "], + ["constant.numeric","2.9E-4"], + ["text"," "], + ["constant.numeric","+42"], + ["text"," "], + ["constant.numeric","-7"], + ["text"," "], + ["punctuation.definition.constant.character.scheme","#"], + ["constant.character.scheme","b001"], + ["text"," "], + ["punctuation.definition.constant.character.scheme","#"], + ["constant.character.scheme","b001/100"], + ["text"," "], + ["punctuation.definition.constant.character.scheme","#"], + ["constant.character.scheme","o777"], + ["text"," "], + ["punctuation.definition.constant.character.scheme","#"], + ["constant.character.scheme","O777"], + ["text"," "], + ["punctuation.definition.constant.character.scheme","#"], + ["constant.character.scheme","xabc55"], + ["text"," "], + ["punctuation.definition.constant.character.scheme","#"], + ["constant.character.scheme","c"], + ["text","("], + ["constant.numeric","0"], + ["text"," "], + ["constant.numeric","-5.6"], + ["text","))"] +],[ + "start", + ["text"," ("], + ["identifier","prompt"], + ["text","-"], + ["identifier","read"], + ["text"," "], + ["string","\"Artist\""], + ["text"," &"], + ["identifier","rest"], + ["text",")"] +],[ + "start", + ["text"," ("], + ["keyword.operator","or"], + ["text"," ("], + ["identifier","parse"], + ["text","-"], + ["identifier","integer"], + ["text"," ("], + ["identifier","prompt"], + ["text","-"], + ["identifier","read"], + ["text"," "], + ["string","\"Rating\""], + ["text",") :"], + ["identifier","junk"], + ["text","-"], + ["identifier","allowed"], + ["text"," "], + ["support.function","t"], + ["text",") "], + ["constant.numeric","0"], + ["text",")"] +],[ + "start", + ["text"," ("], + ["keyword.control","if"], + ["text"," "], + ["identifier","x"], + ["text"," ("], + ["support.function","format"], + ["text"," "], + ["support.function","#t"], + ["text"," "], + ["string","\"yes\""], + ["text",") ("], + ["support.function","format"], + ["text"," "], + ["support.function","#t"], + ["text"," "], + ["string","\"no\""], + ["text"," "], + ["constant.language","#f"], + ["text",") "], + ["comment",";and here comment"] +],[ + "start", + ["text"," ) "], + ["constant.numeric","0xFFLL"], + ["text"," "], + ["constant.numeric","-23ull"] +],[ + "start", + ["text"," "], + ["comment",";; second line comment"] +],[ + "start", + ["text"," '(+ "], + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text",")"] +],[ + "start", + ["text"," ("], + ["identifier","define"], + ["text"," "], + ["punctuation.definition.variable.scheme","*"], + ["variable.other.global.scheme","lines"], + ["punctuation.definition.variable.scheme","*"], + ["text",") "], + ["comment","; list of all lines"] +],[ + "start", + ["text"," ("], + ["identifier","position"], + ["text","-"], + ["keyword.control","if"], + ["text","-"], + ["identifier","not"], + ["text"," "], + ["punctuation.definition.constant.character.scheme","#"], + ["constant.character.scheme","'sys::whitespacep"], + ["text"," "], + ["identifier","line"], + ["text"," :"], + ["identifier","start"], + ["text"," "], + ["identifier","beg"], + ["text","))"] +],[ + "start", + ["text"," ("], + ["support.function","quote"], + ["text"," ("], + ["identifier","privet"], + ["text"," "], + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text"," "], + ["constant.numeric","3"], + ["text","))"] +],[ + "start", + ["text"," '("], + ["identifier","hello"], + ["text"," "], + ["identifier","world"], + ["text",")"] +],[ + "start", + ["text"," (* "], + ["constant.numeric","5"], + ["text"," "], + ["constant.numeric","7"], + ["text",")"] +],[ + "start", + ["text"," ("], + ["constant.numeric","1"], + ["text"," "], + ["constant.numeric","2"], + ["text"," "], + ["constant.numeric","34"], + ["text"," "], + ["constant.numeric","5"], + ["text",")"] +],[ + "start", + ["text"," (:"], + ["identifier","use"], + ["text"," "], + ["string","\"aaaa\""], + ["text",")"] +],[ + "start", + ["text"," ("], + ["keyword.control","let"], + ["text"," (("], + ["identifier","x"], + ["text"," "], + ["constant.numeric","10"], + ["text",") ("], + ["identifier","y"], + ["text"," "], + ["constant.numeric","20"], + ["text","))"] +],[ + "start", + ["text"," ("], + ["identifier","display"], + ["text"," (+ "], + ["identifier","x"], + ["text"," "], + ["identifier","y"], + ["text","))"] +],[ + "start", + ["text"," ) "], + ["support.function","LAmbDa"] +],[ + "start" +],[ + "start", + ["text"," "], + ["string","\"asdad"], + ["constant.character.escape.scheme","\\0"], + ["string","eqweqe\""] +]] diff --git a/lib/ace/mode/scheme_highlight_rules.js b/lib/ace/mode/scheme_highlight_rules.js index e9a58999..489ef0a3 100644 --- a/lib/ace/mode/scheme_highlight_rules.js +++ b/lib/ace/mode/scheme_highlight_rules.js @@ -76,7 +76,7 @@ var SchemeHighlightRules = function() { }, { "token" : "constant.numeric", // hex - "regex" : "#[xX][0-9a-fA-F]+(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" + "regex" : "0[xX][0-9a-fA-F]+(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" }, { "token" : "constant.numeric", // float From 7fbd7395b3dfe89970694bde7dfbbafc2d8ef0c1 Mon Sep 17 00:00:00 2001 From: Nala Ginrut Date: Sat, 2 Feb 2013 20:05:05 +0800 Subject: [PATCH 3/6] Add scheme.scheme new file: demo/kitchen-sink/docs/scheme.scheme --- demo/kitchen-sink/docs/scheme.scheme | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 demo/kitchen-sink/docs/scheme.scheme diff --git a/demo/kitchen-sink/docs/scheme.scheme b/demo/kitchen-sink/docs/scheme.scheme new file mode 100644 index 00000000..c58ece6a --- /dev/null +++ b/demo/kitchen-sink/docs/scheme.scheme @@ -0,0 +1,24 @@ +(define (prompt-for-cd) + "Prompts + for CD" + (prompt-read "Title" 1.53 1 2/4 1.7 1.7e0 2.9E-4 +42 -7 #b001 #b001/100 #o777 #O777 #xabc55 #c(0 -5.6)) + (prompt-read "Artist") + (or (parse-integer (prompt-read "Rating") #:junk-allowed t) 0) + (if x (format #t "yes") (format #f "no") ;and here comment + ) + ;; second line comment + '(+ 1 2) + (define-sytax get-line + (syntax-rules () + ((_ x) x))) ; nonsense, just a highlight test + (position-if-not char-set:whitespace line #:start beg)) + (quote (privet 1 2 3)) + '(hello world) + (* 5 7) + (1 2 34 5) + (#:use "aaaa") + (let ((x 10) (y 20)) + (display (+ x y)) + ) + + "asdad\0eqweqe" From 67b1b25469846aac10b2e7cff0adda81830ccecf Mon Sep 17 00:00:00 2001 From: Nala Ginrut Date: Sat, 2 Feb 2013 22:30:37 +0800 Subject: [PATCH 4/6] Fixed: keyword can't be colored modified: demo/kitchen-sink/docs/scheme.scheme * fix typo modified: lib/ace/mode/scheme_highlight_rules.js * remove '() since it's hard to parse and trivious for coloring. * keyword and constant coloring fine now. --- demo/kitchen-sink/docs/scheme.scheme | 2 +- lib/ace/mode/scheme_highlight_rules.js | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/demo/kitchen-sink/docs/scheme.scheme b/demo/kitchen-sink/docs/scheme.scheme index c58ece6a..a8579b83 100644 --- a/demo/kitchen-sink/docs/scheme.scheme +++ b/demo/kitchen-sink/docs/scheme.scheme @@ -8,7 +8,7 @@ ) ;; second line comment '(+ 1 2) - (define-sytax get-line + (define-syntax get-line (syntax-rules () ((_ x) x))) ; nonsense, just a highlight test (position-if-not char-set:whitespace line #:start beg)) diff --git a/lib/ace/mode/scheme_highlight_rules.js b/lib/ace/mode/scheme_highlight_rules.js index 489ef0a3..51d8fd40 100644 --- a/lib/ace/mode/scheme_highlight_rules.js +++ b/lib/ace/mode/scheme_highlight_rules.js @@ -41,8 +41,8 @@ var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var SchemeHighlightRules = function() { var keywordControl = "case|do|let|loop|if|else|when"; - var keywordOperator = "eq?|eqv?|equal?|and|or|not"; - var constantLanguage = "#t|#f|'()"; + var keywordOperator = "eq?|eqv?|equal?|and|or|not|null?"; + var constantLanguage = "#t|#f"; var supportFunctions = "cons|car|cdr|cond|lambda|lambda*|syntax-rules|format|set!|quote|eval|append|list|list?|member?|load"; var keywordMapper = this.createKeywordMapper({ @@ -68,7 +68,7 @@ var SchemeHighlightRules = function() { }, { "token": ["punctuation.definition.constant.character.scheme", "constant.character.scheme"], - "regex": "(#)((?:\\w|[\\\\+-=<>'\"&#])+)" + "regex": "#:[^ ]+" }, { "token": ["punctuation.definition.variable.scheme", "variable.other.global.scheme", "punctuation.definition.variable.scheme"], @@ -76,15 +76,15 @@ var SchemeHighlightRules = function() { }, { "token" : "constant.numeric", // hex - "regex" : "0[xX][0-9a-fA-F]+(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" + "regex" : "#[xXoObB][0-9a-fA-F]+" }, { "token" : "constant.numeric", // float - "regex" : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(?:L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" + "regex" : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?" }, { "token" : keywordMapper, - "regex" : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" + "regex" : "[a-zA-Z_#][a-zA-Z0-9_\\?\\!\\*]*" }, { "token" : "string", From 05d65dac6ab0ee707970eec187ada11f56065b2b Mon Sep 17 00:00:00 2001 From: Nala Ginrut Date: Sun, 3 Feb 2013 21:57:54 +0800 Subject: [PATCH 5/6] Fixed keywords and constant parse bug Fixed: 'minus' shouldn't be a delimiter Fixed: '\t' shouldn't be included in keword-type --- lib/ace/mode/scheme_highlight_rules.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ace/mode/scheme_highlight_rules.js b/lib/ace/mode/scheme_highlight_rules.js index 51d8fd40..fcfa629e 100644 --- a/lib/ace/mode/scheme_highlight_rules.js +++ b/lib/ace/mode/scheme_highlight_rules.js @@ -68,7 +68,7 @@ var SchemeHighlightRules = function() { }, { "token": ["punctuation.definition.constant.character.scheme", "constant.character.scheme"], - "regex": "#:[^ ]+" + "regex": "#:\\S+" }, { "token": ["punctuation.definition.variable.scheme", "variable.other.global.scheme", "punctuation.definition.variable.scheme"], @@ -84,7 +84,7 @@ var SchemeHighlightRules = function() { }, { "token" : keywordMapper, - "regex" : "[a-zA-Z_#][a-zA-Z0-9_\\?\\!\\*]*" + "regex" : "[a-zA-Z_#][a-zA-Z0-9_\\-\\?\\!\\*]*" }, { "token" : "string", From 4bbf4e7ac004408427e16ee733f61a6814c6d6b2 Mon Sep 17 00:00:00 2001 From: nightwing Date: Wed, 6 Feb 2013 19:13:06 +0400 Subject: [PATCH 6/6] Fixed: test case for scheme --- demo/kitchen-sink/doclist.js | 2 +- .../docs/{scheme.scheme => scheme.scm} | 5 +- lib/ace/mode/_test/tokens_scheme.json | 101 ++++++------------ 3 files changed, 36 insertions(+), 72 deletions(-) rename demo/kitchen-sink/docs/{scheme.scheme => scheme.scm} (73%) diff --git a/demo/kitchen-sink/doclist.js b/demo/kitchen-sink/doclist.js index 1266c620..7cc17e3e 100644 --- a/demo/kitchen-sink/doclist.js +++ b/demo/kitchen-sink/doclist.js @@ -90,7 +90,7 @@ var docs = { "docs/latex.tex": {name: "LaTeX", wrapped: true}, "docs/less.less": "LESS", "docs/lisp.lisp": "Lisp", - "docs/scheme.scheme": "Scheme", + "docs/scheme.scm": "Scheme", "docs/liquid.liquid": "Liquid", "docs/lua.lua": "Lua", "docs/lucene.lucene": "Lucene", diff --git a/demo/kitchen-sink/docs/scheme.scheme b/demo/kitchen-sink/docs/scheme.scm similarity index 73% rename from demo/kitchen-sink/docs/scheme.scheme rename to demo/kitchen-sink/docs/scheme.scm index a8579b83..8c78359c 100644 --- a/demo/kitchen-sink/docs/scheme.scheme +++ b/demo/kitchen-sink/docs/scheme.scm @@ -3,14 +3,11 @@ for CD" (prompt-read "Title" 1.53 1 2/4 1.7 1.7e0 2.9E-4 +42 -7 #b001 #b001/100 #o777 #O777 #xabc55 #c(0 -5.6)) (prompt-read "Artist") - (or (parse-integer (prompt-read "Rating") #:junk-allowed t) 0) + (or (parse-integer (prompt-read "Rating") #:junk-allowed #t) 0) (if x (format #t "yes") (format #f "no") ;and here comment ) ;; second line comment '(+ 1 2) - (define-syntax get-line - (syntax-rules () - ((_ x) x))) ; nonsense, just a highlight test (position-if-not char-set:whitespace line #:start beg)) (quote (privet 1 2 3)) '(hello world) diff --git a/lib/ace/mode/_test/tokens_scheme.json b/lib/ace/mode/_test/tokens_scheme.json index da9f93e0..74753d14 100644 --- a/lib/ace/mode/_test/tokens_scheme.json +++ b/lib/ace/mode/_test/tokens_scheme.json @@ -1,10 +1,10 @@ -[ +[[ "start", ["text","("], ["storage.type.function-type.scheme","define"], - ["text"," "], - ["entity.name.function.scheme","prompt-for-cd"], - ["text"," ()"] + ["text"," ("], + ["identifier","prompt-for-cd"], + ["text",")"] ],[ "start", ["text"," "], @@ -19,9 +19,7 @@ ],[ "start", ["text"," ("], - ["identifier","prompt"], - ["text","-"], - ["identifier","read"], + ["identifier","prompt-read"], ["text"," "], ["string","\"Title\""], ["text"," "], @@ -43,23 +41,19 @@ ["text"," "], ["constant.numeric","-7"], ["text"," "], - ["punctuation.definition.constant.character.scheme","#"], - ["constant.character.scheme","b001"], + ["constant.numeric","#b001"], ["text"," "], - ["punctuation.definition.constant.character.scheme","#"], - ["constant.character.scheme","b001/100"], + ["constant.numeric","#b001"], + ["text","/"], + ["constant.numeric","100"], ["text"," "], - ["punctuation.definition.constant.character.scheme","#"], - ["constant.character.scheme","o777"], + ["constant.numeric","#o777"], ["text"," "], - ["punctuation.definition.constant.character.scheme","#"], - ["constant.character.scheme","O777"], + ["constant.numeric","#O777"], ["text"," "], - ["punctuation.definition.constant.character.scheme","#"], - ["constant.character.scheme","xabc55"], + ["constant.numeric","#xabc55"], ["text"," "], - ["punctuation.definition.constant.character.scheme","#"], - ["constant.character.scheme","c"], + ["identifier","#c"], ["text","("], ["constant.numeric","0"], ["text"," "], @@ -68,34 +62,24 @@ ],[ "start", ["text"," ("], - ["identifier","prompt"], - ["text","-"], - ["identifier","read"], + ["identifier","prompt-read"], ["text"," "], ["string","\"Artist\""], - ["text"," &"], - ["identifier","rest"], ["text",")"] ],[ "start", ["text"," ("], ["keyword.operator","or"], ["text"," ("], - ["identifier","parse"], - ["text","-"], - ["identifier","integer"], + ["identifier","parse-integer"], ["text"," ("], - ["identifier","prompt"], - ["text","-"], - ["identifier","read"], + ["identifier","prompt-read"], ["text"," "], ["string","\"Rating\""], - ["text",") :"], - ["identifier","junk"], - ["text","-"], - ["identifier","allowed"], + ["text",") "], + ["punctuation.definition.constant.character.scheme","#:junk-allowed"], ["text"," "], - ["support.function","t"], + ["constant.language","#t"], ["text",") "], ["constant.numeric","0"], ["text",")"] @@ -108,25 +92,20 @@ ["text"," ("], ["support.function","format"], ["text"," "], - ["support.function","#t"], + ["constant.language","#t"], ["text"," "], ["string","\"yes\""], ["text",") ("], ["support.function","format"], ["text"," "], - ["support.function","#t"], + ["constant.language","#f"], ["text"," "], ["string","\"no\""], - ["text"," "], - ["constant.language","#f"], ["text",") "], ["comment",";and here comment"] ],[ "start", - ["text"," ) "], - ["constant.numeric","0xFFLL"], - ["text"," "], - ["constant.numeric","-23ull"] + ["text"," ) "] ],[ "start", ["text"," "], @@ -141,28 +120,15 @@ ],[ "start", ["text"," ("], - ["identifier","define"], + ["identifier","position-if-not"], ["text"," "], - ["punctuation.definition.variable.scheme","*"], - ["variable.other.global.scheme","lines"], - ["punctuation.definition.variable.scheme","*"], - ["text",") "], - ["comment","; list of all lines"] -],[ - "start", - ["text"," ("], - ["identifier","position"], - ["text","-"], - ["keyword.control","if"], - ["text","-"], - ["identifier","not"], - ["text"," "], - ["punctuation.definition.constant.character.scheme","#"], - ["constant.character.scheme","'sys::whitespacep"], + ["identifier","char-set"], + ["text",":"], + ["identifier","whitespace"], ["text"," "], ["identifier","line"], - ["text"," :"], - ["identifier","start"], + ["text"," "], + ["punctuation.definition.constant.character.scheme","#:start"], ["text"," "], ["identifier","beg"], ["text","))"] @@ -206,8 +172,8 @@ ["text",")"] ],[ "start", - ["text"," (:"], - ["identifier","use"], + ["text"," ("], + ["punctuation.definition.constant.character.scheme","#:use"], ["text"," "], ["string","\"aaaa\""], ["text",")"] @@ -235,8 +201,7 @@ ["text","))"] ],[ "start", - ["text"," ) "], - ["support.function","LAmbDa"] + ["text"," ) "] ],[ "start" ],[ @@ -245,4 +210,6 @@ ["string","\"asdad"], ["constant.character.escape.scheme","\\0"], ["string","eqweqe\""] -]] +],[ + "start" +]] \ No newline at end of file