Skip to content

Commit c9c5971

Browse files
committed
some fixes to literal constant highlights
1 parent ce69ab9 commit c9c5971

File tree

3 files changed

+58
-53
lines changed

3 files changed

+58
-53
lines changed

LICENSE

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
1-
BSD 3-Clause License
2-
3-
Copyright (c) 2006, Ivan Sagalaev.
4-
All rights reserved.
5-
6-
Redistribution and use in source and binary forms, with or without
7-
modification, are permitted provided that the following conditions are met:
8-
9-
* Redistributions of source code must retain the above copyright notice, this
10-
list of conditions and the following disclaimer.
11-
12-
* Redistributions in binary form must reproduce the above copyright notice,
13-
this list of conditions and the following disclaimer in the documentation
14-
and/or other materials provided with the distribution.
15-
16-
* Neither the name of the copyright holder nor the names of its
17-
contributors may be used to endorse or promote products derived from
18-
this software without specific prior written permission.
19-
20-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29-
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1+
BSD 3-Clause License
2+
3+
Copyright (c) 2006, Ivan Sagalaev.
4+
All rights reserved.
5+
6+
Redistribution and use in source and binary forms, with or without
7+
modification, are permitted provided that the following conditions are met:
8+
9+
* Redistributions of source code must retain the above copyright notice, this
10+
list of conditions and the following disclaimer.
11+
12+
* Redistributions in binary form must reproduce the above copyright notice,
13+
this list of conditions and the following disclaimer in the documentation
14+
and/or other materials provided with the distribution.
15+
16+
* Neither the name of the copyright holder nor the names of its
17+
contributors may be used to endorse or promote products derived from
18+
this software without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

iecst.js

Lines changed: 26 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,23 @@ function hljsDefineIECST(hljs) {
2020
name: "Structured Text",
2121
case_insensitive: true,
2222
keywords: {
23-
keyword:
24-
"if then end_if elsif else case of end_case " +
25-
"to do by while repeat end_while end_repeat for end_for from " +
26-
"private public protected " +
27-
"or and not xor le ge eq ne ge lt constant return exit at retain non_retain task with until using extends implements",
28-
title:
29-
"program end_program function end_function function_block end_function_block configuration " +
30-
"end_configuration action end_action transition end_transition type end_type struct end_struct step " +
31-
"end_step initial_step namespace end_namespace channel end_channel library end_library folder end_folder resource end_resource " +
32-
"var var_global end_var var_input VAR_EXTERNAL var_out var_output var_in_out var_temp var_interval var_access var_config method end_method property end_property interface end_interface",
33-
literal: "false true null ",
34-
built_in:
35-
"array pointer int sint dint lint usint uint udint ulint real lreal time date time_of_day date_and_time dt tod string bool byte world dworld lworld ref_to any_num any_int any_string",
36-
function:
37-
"mod abs acos asin atan cos exp expt ln log sin sqrt tan sel max min limit mux shl shr rol ror indexof sizeof adr ref adrinst bitadr add mul div sub trunc move"
38-
},
23+
keywords: {
24+
keyword:
25+
"if then end_if elsif else case of end_case " +
26+
"to do by while repeat end_while end_repeat for end_for from " +
27+
"public private protected " +
28+
"or and not xor le ge eq ne ge lt constant return exit at retain non_retain task with until using extend",
29+
title:
30+
"program end_program function end_function function_block end_function_block configuration " +
31+
"end_configuration action end_action transition end_transition type end_type struct end_struct step " +
32+
"end_step initial_step namespace end_namespace channel end_channel library end_library folder end_folder resource end_resource " +
33+
"var var_global end_var var_input VAR_EXTERNAL var_out var_output var_in_out var_temp var_interval var_access var_config method end_method property end_property interface end_interface",
34+
literal: "false true null ",
35+
built_in:
36+
"array pointer int sint dint lint usint uint udint ulint real lreal time date time_of_day date_and_time dt tod wstring string bool byte word dword lword ref_to any_num any_int any_string",
37+
function:
38+
"mod abs acos asin atan cos exp expt ln log sin sqrt tan sel max min limit mux shl shr rol ror indexof sizeof adr ref adrinst bitadr add mul div sub trunc move"
39+
},
3940
contains: [
4041
{
4142
className: "string",
@@ -53,21 +54,25 @@ function hljsDefineIECST(hljs) {
5354
},
5455
{
5556
className: "symbol",
56-
begin: "(T|DT|TOD)#[0-9:-_shmyd]*"
57+
begin: "(D|T|DT|TOD)#[0-9:\\-_shmyd]*"
58+
},
59+
{
60+
className: "symbol",
61+
begin: "[a-zA-Z_]+#[a-zA-Z]*"
5762
},
5863
{
5964
className: "symbol",
60-
begin: "[A-Za-z]{1,6}#[0-9_.e]*",
65+
begin: "[A-Za-z]{1,6}#[0-9_\\.e\\-]*",
6166
relevance: 0
6267
},
6368
{
6469
className: "number",
65-
begin: "[0-9]*#[a-zA-Z0-9_]*",
70+
begin: "[0-9]+#\\-?[0-9_]*",
6671
relevance: 0
6772
},
6873
{
6974
className: "number",
70-
begin: "[a-zA-Z_]*#[a-zA-Z_]*",
75+
begin: "[a-zA-Z_]+#\\-?[0-9_]*",
7176
relevance: 0
7277
},
7378
{
@@ -83,7 +88,7 @@ function hljsDefineIECST(hljs) {
8388
hljs.C_BLOCK_COMMENT_MODE,
8489
hljs.COMMENT("\\(\\*", "\\*\\)")
8590
]
86-
};
91+
}
8792
}
8893

8994
module.exports = function(hljs) {

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "highlightjs-structured-text",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "highlight.js syntax definition for Structured Text IEC 61131-3 language",
55
"main": "iecst.js",
66
"scripts": {
@@ -20,8 +20,8 @@
2020
"CoDeSys",
2121
"PLC",
2222
"highlight.js",
23-
"highlightjs",
24-
"syntax-highlight",
23+
"highlightjs",
24+
"syntax-highlight",
2525
"syntax"
2626
],
2727
"author": "Sergey Romanov",

0 commit comments

Comments
 (0)