Skip to content

Commit 18c67b4

Browse files
authored
Added support for PSL, PATROL Scripting Language (#2739)
1 parent bbc77d1 commit 18c67b4

18 files changed

+1018
-2
lines changed

components.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

components.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -843,6 +843,10 @@
843843
"title": "Pascaligo",
844844
"owner": "DefinitelyNotAGoat"
845845
},
846+
"psl": {
847+
"title": "PATROL Scripting Language",
848+
"owner": "bertysentry"
849+
},
846850
"pcaxis": {
847851
"title": "PC-Axis",
848852
"alias": "px",

components/prism-psl.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Prism.languages.psl = {
2+
'comment': {
3+
pattern: /#.*/,
4+
greedy: true
5+
},
6+
'string': {
7+
pattern: /"(?:\\.|[^\\"])*"/,
8+
greedy: true,
9+
inside: {
10+
'symbol': /\\[ntrbA-Z"\\]/
11+
}
12+
},
13+
'heredoc-string': {
14+
pattern: /<<<([a-zA-Z_]\w*)[\r\n](?:.*[\r\n])*?\1\b/,
15+
alias: 'string',
16+
greedy: true
17+
},
18+
'keyword': /\b(?:__multi|__single|case|default|do|else|elsif|exit|export|for|foreach|function|if|last|line|local|next|requires|return|switch|until|while|word)\b/,
19+
'constant': /\b(?:ALARM|CHART_ADD_GRAPH|CHART_DELETE_GRAPH|CHART_DESTROY|CHART_LOAD|CHART_PRINT|EOF|FALSE|False|false|NO|No|no|OFFLINE|OK|PSL_PROF_LOG|R_CHECK_HORIZ|R_CHECK_VERT|R_CLICKER|R_COLUMN|R_FRAME|R_ICON|R_LABEL|R_LABEL_CENTER|R_LIST_MULTIPLE|R_LIST_MULTIPLE_ND|R_LIST_SINGLE|R_LIST_SINGLE_ND|R_MENU|R_POPUP|R_POPUP_SCROLLED|R_RADIO_HORIZ|R_RADIO_VERT|R_ROW|R_SCALE_HORIZ|R_SCALE_VERT|R_SPINNER|R_TEXT_FIELD|R_TEXT_FIELD_LABEL|R_TOGGLE|TRIM_LEADING|TRIM_LEADING_AND_TRAILING|TRIM_REDUNDANT|TRIM_TRAILING|TRUE|True|true|VOID|WARN)\b/,
20+
'variable': /\b(?:errno|exit_status|PslDebug)\b/,
21+
'builtin': {
22+
pattern: /\b(?:acos|add_diary|annotate|annotate_get|asctime|asin|atan|atexit|ascii_to_ebcdic|batch_set|blackout|cat|ceil|chan_exists|change_state|close|code_cvt|cond_signal|cond_wait|console_type|convert_base|convert_date|convert_locale_date|cos|cosh|create|destroy_lock|dump_hist|date|destroy|difference|dget_text|dcget_text|ebcdic_to_ascii|encrypt|event_archive|event_catalog_get|event_check|event_query|event_range_manage|event_range_query|event_report|event_schedule|event_trigger|event_trigger2|execute|exists|exp|fabs|floor|fmod|full_discovery|file|fopen|ftell|fseek|grep|get_vars|getenv|get|get_chan_info|get_ranges|get_text|gethostinfo|getpid|getpname|history_get_retention|history|index|int|is_var|intersection|isnumber|internal|in_transition|join|kill|length|lines|lock|lock_info|log|loge|log10|matchline|msg_check|msg_get_format|msg_get_severity|msg_printf|msg_sprintf|ntharg|num_consoles|nthargf|nthline|nthlinef|num_bytes|print|proc_exists|process|popen|printf|pconfig|poplines|pow|PslExecute|PslFunctionCall|PslFunctionExists|PslSetOptions|random|read|readln|refresh_parameters|remote_check|remote_close|remote_event_query|remote_event_trigger|remote_file_send|remote_open|remove|replace|rindex|sec_check_priv|sec_store_get|sec_store_set|set_alarm_ranges|set_locale|share|sin|sinh|sleep|sopen|sqrt|srandom|subset|set|substr|system|sprintf|sort|subset|snmp_agent_config|_snmp_debug|snmp_agent_stop|snmp_agent_start|snmp_h_set|snmp_h_get_next|snmp_h_get|snmp_set|snmp_walk|snmp_get_next|snmp_get|snmp_config|snmp_close|snmp_open|snmp_trap_receive|snmp_trap_ignore|snmp_trap_listen|snmp_trap_send|snmp_trap_raise_std_trap|snmp_trap_register_im|splitline|strcasecmp|str_repeat|trim|tail|tan|tanh|time|tmpnam|tolower|toupper|trace_psl_process|text_domain|unlock|unique|union|unset|va_arg|va_start|write)\b/,
23+
alias: 'builtin-function'
24+
},
25+
'foreach-variable': {
26+
pattern: /(\bforeach\s+(?:(?:\w+\b|"(?:\\.|[^\\"])*")\s+){0,2})[_a-zA-Z]\w*(?=\s*\()/,
27+
lookbehind: true,
28+
greedy: true
29+
},
30+
'function': {
31+
pattern: /\b[_a-z]\w*\b(?=\s*\()/i,
32+
},
33+
'number': /\b(?:0x[0-9a-f]+|[0-9]+(?:\.[0-9]+)?)\b/i,
34+
'operator': /--|\+\+|&&=?|\|\|=?|<<=?|>>=?|[=!]~|[-+*/%&|^!=<>]=?|\.|[:?]/,
35+
'punctuation': /[(){}\[\];,]/
36+
};

components/prism-psl.min.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/prism-psl.html

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<h2>Strings</h2>
2+
<pre><code># PSL Strings are properly rendered
3+
print("Hello, World!");
4+
5+
# Escaped sequences are highlighted too
6+
print("Goodbye \H\H\H\H\H\H\H\HHello, World!\n");
7+
8+
# Multi-line strings are supported
9+
print("multi
10+
line");
11+
</code></pre>
12+
13+
<h2>Numbers</h2>
14+
<pre><code>a = 1;
15+
b = 2.5;
16+
c = 0xff;
17+
</code></pre>
18+
19+
<h2>PSL Built-in Functions</h2>
20+
<pre><code>p = nthargf(process(".*"), 1, " \t", "\n");
21+
lock("test");
22+
execute("OS", "pwd");
23+
</code></pre>
24+
25+
<h2>PSL Keywords</h2>
26+
<pre><code>foreach entry (["aaa", "bbb", "ccc"]) {
27+
if (grep("[bc]", entry)) {
28+
last;
29+
}
30+
}
31+
</code></pre>
32+
33+
<h2>PSL Constants</h2>
34+
<pre><code>set("/CLASS/inst/paramA/state", WARN);
35+
if (true) {
36+
PslDebug = -1;
37+
}
38+
output = execute("OS", "echo test");
39+
if (errno) {
40+
print(ALARM." with errno=".errno."\n");
41+
}
42+
print(trim(output, "\n\r\t ", TRIM_LEADING_AND_TRAILING));
43+
</code></pre>

plugins/show-language/prism-show-language.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@
138138
"opencl": "OpenCL",
139139
"parigp": "PARI/GP",
140140
"objectpascal": "Object Pascal",
141+
"psl": "PATROL Scripting Language",
141142
"pcaxis": "PC-Axis",
142143
"px": "PC-Axis",
143144
"peoplecode": "PeopleCode",

plugins/show-language/prism-show-language.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy