Add AutoHotKey/AutoIT syntax highglight fixes #886

This commit is contained in:
nightwing 2013-04-06 14:58:47 +04:00
commit 743aad3ad4
7 changed files with 477 additions and 1 deletions

View file

@ -138,6 +138,7 @@ var docs = {
"docs/c9search.c9search_results": "C9 Search Results",
"docs/actionscript.as": "ActionScript",
"docs/autohotkey.ahk": "AutoHotKey",
"docs/erlang/erl": "Erlang",
"docs/forth.frt": "Forth",
"docs/haskell.hs": "Haskell",

View file

@ -0,0 +1,35 @@
#NoEnv
SetBatchLines -1
CoordMode Mouse, Screen
OnExit GuiClose
zoom := 9
computeSize(){
global as_x
as_x := Round(ws_x/zoom/2 - 0.5)
if (zoom>1) {
pix := Round(zoom)
} ele {
pix := 1
}
ToolTip Message %as_x% %zoom% %ws_x% %hws_x%
}
hdc_frame := DllCall("GetDC", UInt, MagnifierID)
; comment
DrawCross(byRef x="", rX,rY,z, dc){
;specify the style, thickness and color of the cross lines
h_pen := DllCall( "gdi32.dll\CreatePen", Int, 0, Int, 1, UInt, 0x0000FF)
}
;Ctrl ^; Shift +; Win #; Alt !
^NumPadAdd::
^WheelUp::
^;:: ;comment
If(zoom < ws_x and ( A_ThisHotKey = "^WheelUp" or A_ThisHotKey ="^NumPadAdd") )
zoom *= 1.189207115 ; sqrt(sqrt(2))
Gosub,setZoom
return

View file

@ -108,6 +108,7 @@ var modesByName = {
abap: ["ABAP" , "abap"],
actionscript: ["ActionScript" ,"as"],
autohotkey: ["AutoHotKey" , "ahk"],
erlang: ["Erlang" ,"erl|hrl"],
forth: ["Forth", ,"frt|fs|ldr"],
haskell: ["Haskell", "hs"],

View file

@ -0,0 +1,261 @@
[[
"start",
["punctuation.ahk","#"],
["keyword.command.ahk","NoEnv"]
],[
"start",
["keyword.command.ahk","SetBatchLines"],
["text"," "],
["constant.numeric","-1"]
],[
"start"
],[
"start",
["keyword.command.ahk","CoordMode"],
["text"," "],
["variable.parameter","Mouse"],
["punctuation.ahk",","],
["text"," "],
["variable.parameter","Screen"]
],[
"start",
["keyword.command.ahk","OnExit"],
["text"," "],
["variable.parameter","GuiClose"]
],[
"start"
],[
"start",
["text","zoom "],
["keyword.operator.ahk",":="],
["text"," 9"]
],[
"start"
],[
"start",
["text","computeSize"],
["punctuation.ahk","(){"]
],[
"start",
["text","\t"],
["keyword.control.ahk","global"],
["text"," as_x"]
],[
"start",
["text","\tas_x "],
["keyword.operator.ahk",":="],
["text"," "],
["support.function.ahk","Round"],
["punctuation.ahk","("],
["text","ws_x"],
["keyword.operator.ahk","/"],
["text","zoom"],
["keyword.operator.ahk","/"],
["text","2 "],
["keyword.operator.ahk","-"],
["text"," 0.5"],
["punctuation.ahk",")"]
],[
"start",
["text","\t"],
["keyword.control.ahk","if"],
["text"," "],
["punctuation.ahk","("],
["text","zoom"],
["keyword.operator.ahk",">"],
["text","1"],
["punctuation.ahk",")"],
["text"," "],
["punctuation.ahk","{"]
],[
"start",
["text","\t\tpix "],
["keyword.operator.ahk",":="],
["text"," "],
["support.function.ahk","Round"],
["punctuation.ahk","("],
["text","zoom"],
["punctuation.ahk",")"]
],[
"start",
["text","\t"],
["punctuation.ahk","}"],
["text"," ele "],
["punctuation.ahk","{"]
],[
"start",
["text","\t\tpix "],
["keyword.operator.ahk",":="],
["text"," 1"]
],[
"start",
["text","\t"],
["punctuation.ahk","}"]
],[
"start",
["text"," "],
["keyword.command.ahk","ToolTip"],
["text"," Message "],
["punctuation.ahk","%"],
["text","as_x"],
["punctuation.ahk","%"],
["text"," "],
["punctuation.ahk","%"],
["text","zoom"],
["punctuation.ahk","%"],
["text"," "],
["punctuation.ahk","%"],
["text","ws_x"],
["punctuation.ahk","%"],
["text"," "],
["punctuation.ahk","%"],
["text","hws_x"],
["punctuation.ahk","%"],
["text"," "]
],[
"start",
["punctuation.ahk","}"]
],[
"start"
],[
"start",
["text","hdc_frame "],
["keyword.operator.ahk",":="],
["text"," "],
["support.function.ahk","DllCall"],
["punctuation.ahk","("],
["punctuation.quote.double","\""],
["string.quoted.ahk","GetDC"],
["punctuation.quote.double","\""],
["punctuation.ahk",","],
["text"," UInt"],
["punctuation.ahk",","],
["text"," MagnifierID"],
["punctuation.ahk",")"]
],[
"start"
],[
"start",
["comment.line.ahk","; comment"]
],[
"start",
["text","DrawCross"],
["punctuation.ahk","("],
["keyword.control.ahk","byRef"],
["text"," x"],
["keyword.operator.ahk","="],
["punctuation.quote.double","\""],
["punctuation.quote.double","\""],
["punctuation.ahk",","],
["text"," rX"],
["punctuation.ahk",","],
["text","rY"],
["punctuation.ahk",","],
["text","z"],
["punctuation.ahk",","],
["text"," dc"],
["punctuation.ahk","){"]
],[
"start",
["text"," "],
["comment.line.ahk"," ;specify the style, thickness and color of the cross lines"]
],[
"start",
["text"," h_pen "],
["keyword.operator.ahk",":="],
["text"," "],
["support.function.ahk","DllCall"],
["punctuation.ahk","("],
["text"," "],
["punctuation.quote.double","\""],
["string.quoted.ahk","gdi32.dll\\CreatePen"],
["punctuation.quote.double","\""],
["punctuation.ahk",","],
["text"," "],
["constant.language","Int"],
["punctuation.ahk",","],
["text"," 0"],
["punctuation.ahk",","],
["text"," "],
["constant.language","Int"],
["punctuation.ahk",","],
["text"," 1"],
["punctuation.ahk",","],
["text"," UInt"],
["punctuation.ahk",","],
["text"," 0x0000FF"],
["punctuation.ahk",")"]
],[
"start",
["punctuation.ahk","}"]
],[
"start"
],[
"start",
["comment.line.ahk",";Ctrl ^; Shift +; Win #; Alt !"]
],[
"start",
["text","^"],
["support.constant.ahk","NumPadAdd"],
["keyword.operator.ahk","::"]
],[
"start",
["text","^"],
["support.constant.ahk","WheelUp"],
["keyword.operator.ahk","::"],
["text"," "]
],[
"start",
["text","^;"],
["keyword.operator.ahk","::"],
["text"," "],
["comment.line.ahk"," ;comment"]
],[
"start",
["text"," "],
["keyword.control.ahk","If"],
["punctuation.ahk","("],
["text","zoom "],
["keyword.operator.ahk","<"],
["text"," ws_x "],
["variable.parameter","and"],
["text"," "],
["punctuation.ahk","("],
["text"," "],
["variable.predefined.ahk","A_ThisHotKey"],
["text"," "],
["keyword.operator.ahk","="],
["text"," "],
["punctuation.quote.double","\""],
["string.quoted.ahk","^WheelUp"],
["punctuation.quote.double","\""],
["text"," "],
["variable.parameter","or"],
["text"," "],
["variable.predefined.ahk","A_ThisHotKey"],
["text"," "],
["keyword.operator.ahk","="],
["punctuation.quote.double","\""],
["string.quoted.ahk","^NumPadAdd"],
["punctuation.quote.double","\""],
["punctuation.ahk",")"],
["text"," "],
["punctuation.ahk",")"]
],[
"start",
["text","\t\tzoom "],
["keyword.operator.ahk","*="],
["text"," 1.189207115 "],
["comment.line.ahk"," ; sqrt(sqrt(2))"]
],[
"start",
["text","\t"],
["keyword.command.ahk","Gosub"],
["punctuation.ahk",","],
["text","setZoom"]
],[
"start",
["keyword.control.ahk","return"]
],[
"start"
]]

View file

@ -0,0 +1,64 @@
/* ***** 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):
*
*
*
* ***** END LICENSE BLOCK ***** */
/*
THIS FILE WAS AUTOGENERATED BY mode.tmpl.js
*/
define(function(require, exports, module) {
"use strict";
var oop = require("../lib/oop");
var TextMode = require("./text").Mode;
var Tokenizer = require("../tokenizer").Tokenizer;
var AutoHotKeyHighlightRules = require("./autohotkey_highlight_rules").AutoHotKeyHighlightRules;
// TODO: pick appropriate fold mode
var FoldMode = require("./folding/cstyle").FoldMode;
var Mode = function() {
var highlighter = new AutoHotKeyHighlightRules();
this.foldingRules = new FoldMode();
this.$tokenizer = new Tokenizer(highlighter.getRules());
};
oop.inherits(Mode, TextMode);
(function() {
this.lineCommentStart = "/\\*";
this.blockComment = {start: "/*", end: "*/"};
// Extra logic goes here.
}).call(Mode.prototype);
exports.Mode = Mode;
});

File diff suppressed because one or more lines are too long

View file

@ -178,9 +178,16 @@ var TextHighlightRules = function() {
i--;
toInsert = null
}
if (rule.keywordMap) {
rule.token = this.createKeywordMapper(
rule.keywordMap, rule.defaultToken || "text", rule.caseInsensitive
);
delete rule.defaultToken;
}
}
};
Object.keys(rules).forEach(processState);
Object.keys(rules).forEach(processState, this);
};
this.createKeywordMapper = function(map, defaultToken, ignoreCase, splitChar) {