Skip to content

Commit

Permalink
Added and fixed some highlighting
Browse files Browse the repository at this point in the history
Fixed variable highlighting ( collision with forced expression mode )
Added command highlighting
Added block comments
Added some keywords
  • Loading branch information
nnnik committed May 16, 2017
1 parent ef9a78d commit 0d2f760
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/languages/autohotkey.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ Category: scripting

function(hljs) {
var BACKTICK_ESCAPE = {
begin: /`[\s\S]/
begin: '`[\\s\\S]'
};

return {
case_insensitive: true,
aliases: [ 'ahk' ],
keywords: {
keyword: 'Break Continue Else Gosub If Loop Return While',
keyword: 'Break Continue Critical Exit ExitApp Gosub Goto New OnExit Pause return SetBatchLines SetTimer Suspend Thread Throw Until ahk_id ahk_class ahk_pid ahk_exe ahk_group',
literal: 'A|0 true false NOT AND OR',
built_in: 'ComSpec Clipboard ClipboardAll ErrorLevel',
},
Expand All @@ -25,16 +26,26 @@ function(hljs) {
BACKTICK_ESCAPE,
hljs.inherit(hljs.QUOTE_STRING_MODE, {contains: [BACKTICK_ESCAPE]}),
hljs.COMMENT(';', '$', {relevance: 0}),
hljs.C_BLOCK_COMMENT_MODE,
{
className: 'number',
begin: hljs.NUMBER_RE,
relevance: 0
},
{
className: 'variable', // FIXME
begin: '%', end: '%',
illegal: '\\n',
contains: [BACKTICK_ESCAPE]
className: 'subst', // FIXED
begin: '%(?=[a-zA-Z0-9#_$@])', end: '%',
illegal: '[^a-zA-Z0-9#_$@]'
},
{
className: 'built_in',
begin: '^\\s*\\w+\\s*,'
//I don't really know if this is totally relevant
},
{
className: 'meta',
begin: '^\\s*#\w+', end:'$',
relevance: 0
},
{
className: 'symbol',
Expand Down

0 comments on commit 0d2f760

Please sign in to comment.