From 6b41f9d6ca3fde5c8b02c9b4edf0807a3bc85690 Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Wed, 5 Apr 2017 16:34:24 +0200 Subject: [PATCH 01/13] Added support for jboss-cli --- AUTHORS.en.txt | 1 + AUTHORS.ru.txt | 1 + src/languages/jboss-cli.js | 59 +++++++++++++++++++++++++++++++ test/detect/jboss-cli/default.txt | 18 ++++++++++ 4 files changed, 79 insertions(+) create mode 100644 src/languages/jboss-cli.js create mode 100644 test/detect/jboss-cli/default.txt diff --git a/AUTHORS.en.txt b/AUTHORS.en.txt index 971eb32284..99c39a9168 100644 --- a/AUTHORS.en.txt +++ b/AUTHORS.en.txt @@ -244,3 +244,4 @@ Contributors: - Andres Täht - Rene Saarsoo - Jordi Petit +- Raphaël Parrëe diff --git a/AUTHORS.ru.txt b/AUTHORS.ru.txt index c748490678..7121afc6d4 100644 --- a/AUTHORS.ru.txt +++ b/AUTHORS.ru.txt @@ -244,3 +244,4 @@ URL: https://highlightjs.org/ - Андрес Тахт - Рене Саарсо - Джорди Петит +- Рафаэль Паре diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js new file mode 100644 index 0000000000..3b0cdef9f1 --- /dev/null +++ b/src/languages/jboss-cli.js @@ -0,0 +1,59 @@ +/* + Language: jboss-cli + Author: Raphaël Parrëe + Description: language definition jboss cli + Category: config + */ + +function(hljs) { + var PARAMS = [{ + className: "attribute", + begin: /[\w-]+\s?=/, + starts: { + + ends: /$/, + className: "string" + } + }]; + + return { + aliases: ['wildfly-cli'], + case_insensitive: false, + keywords: { + keyword: 'alias batch cd clear command connect connection-factory connection-info data-source deploy ' + + 'deployment-info deployment-overlay echo echo-dmr help history if jdbc-driver-info jms-queue jms-topic ls ' + + ' patch pwd quit read-attribute read-operation reload rollout-plan run-batch set shutdown try unalias ' + + 'undeploy unset version xa-data-source', // module + literal: 'true false' + }, + contains: [ + hljs.HASH_COMMENT_MODE, + hljs.QUOTE_STRING_MODE, + { + className: 'params', + begin: "--", + end: "$" + + }, + { + className: 'function', + begin: /:\w+/ + + }, + { + className: 'symbol', + begin: /\B(\/[\w-/=]+)+/ + + }, + { + className: 'params', + begin: /\(/, + end: /\)/, + excludeBegin: true, + excludeEnd: true, + contains: PARAMS + } + + ] + } +} diff --git a/test/detect/jboss-cli/default.txt b/test/detect/jboss-cli/default.txt new file mode 100644 index 0000000000..1efe677758 --- /dev/null +++ b/test/detect/jboss-cli/default.txt @@ -0,0 +1,18 @@ +# some comment + +deploy /path/to/DEPLOYMENT.war --all-server-groups + +/subsystem=security/security-domain=demo-realm:add() + +/subsystem=security/security-domain=demo-realm/authentication=classic:add + +/subsystem=security/security-domain=demo-realm/authentication=classic/login-module=UsersRoles:add( \ + code=UsersRoles, \ + flag=required, \ + module-options= { \ + usersProperties=auth/demo-users.properties, \ + rolesProperties =auth/demo-roles.properties, \ + hashAlgorithm= MD5, \ + hashCharset="UTF-8" \ + } \ +) From dff1461f5286618eedfb2ed00a259106bfb43cd7 Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Wed, 5 Apr 2017 17:15:19 +0200 Subject: [PATCH 02/13] fixed jboss-cli getting detected where xml should have been detected --- src/languages/jboss-cli.js | 19 ++++++++++++------- test/detect/jboss-cli/default.txt | 6 ++++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js index 3b0cdef9f1..9500c3ffdd 100644 --- a/src/languages/jboss-cli.js +++ b/src/languages/jboss-cli.js @@ -13,7 +13,8 @@ function(hljs) { ends: /$/, className: "string" - } + }, + relevance: 1 }]; return { @@ -21,8 +22,8 @@ function(hljs) { case_insensitive: false, keywords: { keyword: 'alias batch cd clear command connect connection-factory connection-info data-source deploy ' + - 'deployment-info deployment-overlay echo echo-dmr help history if jdbc-driver-info jms-queue jms-topic ls ' + - ' patch pwd quit read-attribute read-operation reload rollout-plan run-batch set shutdown try unalias ' + + 'deployment-info deployment-overlay echo echo-dmr help history if jdbc-driver-info jms-queue|20 jms-topic|20 ls ' + + 'patch pwd quit read-attribute read-operation reload rollout-plan run-batch set shutdown try unalias ' + 'undeploy unset version xa-data-source', // module literal: 'true false' }, @@ -32,17 +33,20 @@ function(hljs) { { className: 'params', begin: "--", - end: "$" + end: "$", + relevance: 1 }, { className: 'function', - begin: /:\w+/ + begin: /:\w+/, + relevance: 0 }, { className: 'symbol', - begin: /\B(\/[\w-/=]+)+/ + begin: /\B(\/[\w-/=]+)+/, + relevance: 1 }, { @@ -51,7 +55,8 @@ function(hljs) { end: /\)/, excludeBegin: true, excludeEnd: true, - contains: PARAMS + contains: PARAMS, + relevance: 0 } ] diff --git a/test/detect/jboss-cli/default.txt b/test/detect/jboss-cli/default.txt index 1efe677758..a6d9ae90b2 100644 --- a/test/detect/jboss-cli/default.txt +++ b/test/detect/jboss-cli/default.txt @@ -1,6 +1,8 @@ -# some comment +jms-queue add --queue-address=myQueue --entries=queue/myQueue -deploy /path/to/DEPLOYMENT.war --all-server-groups +deploy /path/to/file.war + +/system-property=prop1:add(value=value1) /subsystem=security/security-domain=demo-realm:add() From fd4b0bd4f5f730719563f11ead02b038286f24a2 Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Wed, 5 Apr 2017 18:44:11 +0200 Subject: [PATCH 03/13] fixed an regex error that blocked the browser when compressing --- src/languages/jboss-cli.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js index 9500c3ffdd..ec237228c2 100644 --- a/src/languages/jboss-cli.js +++ b/src/languages/jboss-cli.js @@ -5,7 +5,7 @@ Category: config */ -function(hljs) { +function (hljs) { var PARAMS = [{ className: "attribute", begin: /[\w-]+\s?=/, @@ -45,9 +45,8 @@ function(hljs) { }, { className: 'symbol', - begin: /\B(\/[\w-/=]+)+/, + begin: /\B(\/[\w\-\/=]+)+/, relevance: 1 - }, { className: 'params', From 34001341925aa0b992bec4d64b865f5e03fe16bb Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Wed, 5 Apr 2017 19:11:34 +0200 Subject: [PATCH 04/13] [jboss-cli] fixed the lexemes value to include a hyphen --- src/languages/jboss-cli.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js index ec237228c2..d4f0243186 100644 --- a/src/languages/jboss-cli.js +++ b/src/languages/jboss-cli.js @@ -20,6 +20,7 @@ function (hljs) { return { aliases: ['wildfly-cli'], case_insensitive: false, + lexemes: '[a-z\-]+', keywords: { keyword: 'alias batch cd clear command connect connection-factory connection-info data-source deploy ' + 'deployment-info deployment-overlay echo echo-dmr help history if jdbc-driver-info jms-queue|20 jms-topic|20 ls ' + From a98e593d4a7699eb664c1132b4cc07c0a5c60453 Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Thu, 6 Apr 2017 06:30:23 +0200 Subject: [PATCH 05/13] [jboss-cli] restructured code + included dots in path names --- src/languages/jboss-cli.js | 59 ++++++++++++++++--------------- test/detect/jboss-cli/default.txt | 2 ++ 2 files changed, 33 insertions(+), 28 deletions(-) diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js index d4f0243186..81c3ed5e17 100644 --- a/src/languages/jboss-cli.js +++ b/src/languages/jboss-cli.js @@ -17,6 +17,33 @@ function (hljs) { relevance: 1 }]; + var OPERATION = { + className: 'function', + begin: /:\w+/, + relevance: 0 + + }; + var PATH = { + className: 'symbol', + begin: /\B(\/[\w\-.\/=]+)+/, + relevance: 1 + }; + var PARAMS = { + className: 'params', + begin: /\(/, + end: /\)/, + excludeBegin: true, + excludeEnd: true, + contains: PARAMS, + relevance: 0 + }; + var COMMAND_PARAMS = { + className: 'params', + begin: "--", + end: "$", + relevance: 1 + + }; return { aliases: ['wildfly-cli'], case_insensitive: false, @@ -31,34 +58,10 @@ function (hljs) { contains: [ hljs.HASH_COMMENT_MODE, hljs.QUOTE_STRING_MODE, - { - className: 'params', - begin: "--", - end: "$", - relevance: 1 - - }, - { - className: 'function', - begin: /:\w+/, - relevance: 0 - - }, - { - className: 'symbol', - begin: /\B(\/[\w\-\/=]+)+/, - relevance: 1 - }, - { - className: 'params', - begin: /\(/, - end: /\)/, - excludeBegin: true, - excludeEnd: true, - contains: PARAMS, - relevance: 0 - } - + COMMAND_PARAMS, + OPERATION, + PATH, + PARAMS ] } } diff --git a/test/detect/jboss-cli/default.txt b/test/detect/jboss-cli/default.txt index a6d9ae90b2..a9b183a432 100644 --- a/test/detect/jboss-cli/default.txt +++ b/test/detect/jboss-cli/default.txt @@ -6,6 +6,8 @@ deploy /path/to/file.war /subsystem=security/security-domain=demo-realm:add() +/extension=org.jboss.as.modcluster:add + /subsystem=security/security-domain=demo-realm/authentication=classic:add /subsystem=security/security-domain=demo-realm/authentication=classic/login-module=UsersRoles:add( \ From 7e1637c242f91519729f9d6ca1ac75b2f6a783f8 Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Thu, 6 Apr 2017 06:31:59 +0200 Subject: [PATCH 06/13] [jboss-cli] restructured code + included dots in path names --- src/languages/jboss-cli.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js index 81c3ed5e17..a3e6135b22 100644 --- a/src/languages/jboss-cli.js +++ b/src/languages/jboss-cli.js @@ -28,7 +28,7 @@ function (hljs) { begin: /\B(\/[\w\-.\/=]+)+/, relevance: 1 }; - var PARAMS = { + var PARAMSBLOCK = { className: 'params', begin: /\(/, end: /\)/, @@ -61,7 +61,7 @@ function (hljs) { COMMAND_PARAMS, OPERATION, PATH, - PARAMS + PARAMSBLOCK ] } } From 8991cf508b1b1552fa1c5e24f12dbca9978372e8 Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Thu, 6 Apr 2017 06:54:26 +0200 Subject: [PATCH 07/13] [jboss-cli] added option paths may start with a dot --- src/languages/jboss-cli.js | 2 +- test/detect/jboss-cli/default.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js index a3e6135b22..b4d8a6b715 100644 --- a/src/languages/jboss-cli.js +++ b/src/languages/jboss-cli.js @@ -25,7 +25,7 @@ function (hljs) { }; var PATH = { className: 'symbol', - begin: /\B(\/[\w\-.\/=]+)+/, + begin: /\B(([\/.])[\w\-.\/=]+)+/, relevance: 1 }; var PARAMSBLOCK = { diff --git a/test/detect/jboss-cli/default.txt b/test/detect/jboss-cli/default.txt index a9b183a432..5f8992e4d9 100644 --- a/test/detect/jboss-cli/default.txt +++ b/test/detect/jboss-cli/default.txt @@ -8,6 +8,8 @@ deploy /path/to/file.war /extension=org.jboss.as.modcluster:add +./foo=bar:remove + /subsystem=security/security-domain=demo-realm/authentication=classic:add /subsystem=security/security-domain=demo-realm/authentication=classic/login-module=UsersRoles:add( \ From 2e627d24adaa535b67966129e2ea9e823ea69873 Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Sat, 8 Apr 2017 08:14:01 +0200 Subject: [PATCH 08/13] [jboss-cli] exclude equal sign from params + allow hyphen in ops names --- src/languages/jboss-cli.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js index b4d8a6b715..69edc0f373 100644 --- a/src/languages/jboss-cli.js +++ b/src/languages/jboss-cli.js @@ -8,18 +8,19 @@ function (hljs) { var PARAMS = [{ className: "attribute", - begin: /[\w-]+\s?=/, + begin: /[\w-]+\s?/, + ends: "=", + excludeEnd: true, starts: { - ends: /$/, className: "string" }, - relevance: 1 + relevance: -1 }]; var OPERATION = { className: 'function', - begin: /:\w+/, + begin: /:[\w\-.]+/, relevance: 0 }; From 7bb04ccc9460af4c0edf5785f3a1d2e3b6fed03c Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Sat, 8 Apr 2017 09:13:31 +0200 Subject: [PATCH 09/13] [jboss-cli] fixed default values + wrong "end" --- src/languages/jboss-cli.js | 12 +++--------- test/detect/jboss-cli/default.txt | 2 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js index 69edc0f373..daa0a30a60 100644 --- a/src/languages/jboss-cli.js +++ b/src/languages/jboss-cli.js @@ -9,10 +9,10 @@ function (hljs) { var PARAMS = [{ className: "attribute", begin: /[\w-]+\s?/, - ends: "=", + end: "=", excludeEnd: true, starts: { - ends: /$/, + end: /$/, className: "string" }, relevance: -1 @@ -33,21 +33,15 @@ function (hljs) { className: 'params', begin: /\(/, end: /\)/, - excludeBegin: true, - excludeEnd: true, contains: PARAMS, relevance: 0 }; var COMMAND_PARAMS = { className: 'params', - begin: "--", - end: "$", - relevance: 1 - + begin: /--[\w\-=\/]+/, }; return { aliases: ['wildfly-cli'], - case_insensitive: false, lexemes: '[a-z\-]+', keywords: { keyword: 'alias batch cd clear command connect connection-factory connection-info data-source deploy ' + diff --git a/test/detect/jboss-cli/default.txt b/test/detect/jboss-cli/default.txt index 5f8992e4d9..5df733fe54 100644 --- a/test/detect/jboss-cli/default.txt +++ b/test/detect/jboss-cli/default.txt @@ -4,7 +4,7 @@ deploy /path/to/file.war /system-property=prop1:add(value=value1) -/subsystem=security/security-domain=demo-realm:add() + /extension=org.jboss.as.modcluster:add From aed7b00d275701c2aebef9282f5ecdf80fd146a9 Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Sat, 8 Apr 2017 11:11:33 +0200 Subject: [PATCH 10/13] [jboss-cli] fixed rendering problems with params --- src/languages/jboss-cli.js | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js index daa0a30a60..c9644b9073 100644 --- a/src/languages/jboss-cli.js +++ b/src/languages/jboss-cli.js @@ -6,36 +6,29 @@ */ function (hljs) { - var PARAMS = [{ + var PARAM = { className: "attribute", - begin: /[\w-]+\s?/, - end: "=", + begin: /[\w-]+ *=/, excludeEnd: true, - starts: { - end: /$/, - className: "string" - }, relevance: -1 - }]; - + }; + var PARAMSBLOCK = { + className: 'params', + begin: /\(/, + end: /\)/, + contains: [PARAM], + relevance : 0 + }; var OPERATION = { className: 'function', begin: /:[\w\-.]+/, relevance: 0 - }; var PATH = { className: 'symbol', begin: /\B(([\/.])[\w\-.\/=]+)+/, relevance: 1 }; - var PARAMSBLOCK = { - className: 'params', - begin: /\(/, - end: /\)/, - contains: PARAMS, - relevance: 0 - }; var COMMAND_PARAMS = { className: 'params', begin: /--[\w\-=\/]+/, From 81df3b30004425783ea216dc06deeb0ad7e512ff Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Sat, 8 Apr 2017 11:28:09 +0200 Subject: [PATCH 11/13] [jboss-cli] missed a newly introduced default relevance --- src/languages/jboss-cli.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js index c9644b9073..76895ed41a 100644 --- a/src/languages/jboss-cli.js +++ b/src/languages/jboss-cli.js @@ -22,12 +22,11 @@ function (hljs) { var OPERATION = { className: 'function', begin: /:[\w\-.]+/, - relevance: 0 + : 0 }; var PATH = { className: 'symbol', begin: /\B(([\/.])[\w\-.\/=]+)+/, - relevance: 1 }; var COMMAND_PARAMS = { className: 'params', From 0cc54de9ee9e9b4eb8f97f62ed8052ef0477329d Mon Sep 17 00:00:00 2001 From: Raphael Parree Date: Sat, 8 Apr 2017 11:55:51 +0200 Subject: [PATCH 12/13] [jboss-cli] prev commit: cut/pasted word from src to commit message --- src/languages/jboss-cli.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js index 76895ed41a..1ed949ed91 100644 --- a/src/languages/jboss-cli.js +++ b/src/languages/jboss-cli.js @@ -22,7 +22,7 @@ function (hljs) { var OPERATION = { className: 'function', begin: /:[\w\-.]+/, - : 0 + relevance: 0 }; var PATH = { className: 'symbol', From b21ab7d39bccaba9b5d5effc349e02b0b5812af3 Mon Sep 17 00:00:00 2001 From: Ivan Sagalaev Date: Sun, 9 Apr 2017 17:25:28 -0700 Subject: [PATCH 13/13] Tweaks to jboss-cli - "attribute" redefined to not include the final `=` and renamed to "attr" for consistency - "symbol" renamed to "string" (seems a better fit) --- src/languages/jboss-cli.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/languages/jboss-cli.js b/src/languages/jboss-cli.js index 1ed949ed91..cae5184c39 100644 --- a/src/languages/jboss-cli.js +++ b/src/languages/jboss-cli.js @@ -7,10 +7,9 @@ function (hljs) { var PARAM = { - className: "attribute", - begin: /[\w-]+ *=/, - excludeEnd: true, - relevance: -1 + begin: /[\w-]+ *=/, returnBegin: true, + relevance: 0, + contains: [{className: 'attr', begin: /[\w-]+/}] }; var PARAMSBLOCK = { className: 'params', @@ -25,7 +24,7 @@ function (hljs) { relevance: 0 }; var PATH = { - className: 'symbol', + className: 'string', begin: /\B(([\/.])[\w\-.\/=]+)+/, }; var COMMAND_PARAMS = {