Added support for PSL, PATROL Scripting Language (#2739)

This commit is contained in:
Bertrand Martin 2021-01-27 21:13:03 +01:00 committed by GitHub
parent bbc77d19e1
commit 18c67b4904
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 1018 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -843,6 +843,10 @@
"title": "Pascaligo",
"owner": "DefinitelyNotAGoat"
},
"psl": {
"title": "PATROL Scripting Language",
"owner": "bertysentry"
},
"pcaxis": {
"title": "PC-Axis",
"alias": "px",

36
components/prism-psl.js Normal file
View File

@ -0,0 +1,36 @@
Prism.languages.psl = {
'comment': {
pattern: /#.*/,
greedy: true
},
'string': {
pattern: /"(?:\\.|[^\\"])*"/,
greedy: true,
inside: {
'symbol': /\\[ntrbA-Z"\\]/
}
},
'heredoc-string': {
pattern: /<<<([a-zA-Z_]\w*)[\r\n](?:.*[\r\n])*?\1\b/,
alias: 'string',
greedy: true
},
'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/,
'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/,
'variable': /\b(?:errno|exit_status|PslDebug)\b/,
'builtin': {
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/,
alias: 'builtin-function'
},
'foreach-variable': {
pattern: /(\bforeach\s+(?:(?:\w+\b|"(?:\\.|[^\\"])*")\s+){0,2})[_a-zA-Z]\w*(?=\s*\()/,
lookbehind: true,
greedy: true
},
'function': {
pattern: /\b[_a-z]\w*\b(?=\s*\()/i,
},
'number': /\b(?:0x[0-9a-f]+|[0-9]+(?:\.[0-9]+)?)\b/i,
'operator': /--|\+\+|&&=?|\|\|=?|<<=?|>>=?|[=!]~|[-+*/%&|^!=<>]=?|\.|[:?]/,
'punctuation': /[(){}\[\];,]/
};

1
components/prism-psl.min.js vendored Normal file
View File

@ -0,0 +1 @@
Prism.languages.psl={comment:{pattern:/#.*/,greedy:!0},string:{pattern:/"(?:\\.|[^\\"])*"/,greedy:!0,inside:{symbol:/\\[ntrbA-Z"\\]/}},"heredoc-string":{pattern:/<<<([a-zA-Z_]\w*)[\r\n](?:.*[\r\n])*?\1\b/,alias:"string",greedy:!0},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/,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/,variable:/\b(?:errno|exit_status|PslDebug)\b/,builtin:{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/,alias:"builtin-function"},"foreach-variable":{pattern:/(\bforeach\s+(?:(?:\w+\b|"(?:\\.|[^\\"])*")\s+){0,2})[_a-zA-Z]\w*(?=\s*\()/,lookbehind:!0,greedy:!0},function:{pattern:/\b[_a-z]\w*\b(?=\s*\()/i},number:/\b(?:0x[0-9a-f]+|[0-9]+(?:\.[0-9]+)?)\b/i,operator:/--|\+\+|&&=?|\|\|=?|<<=?|>>=?|[=!]~|[-+*/%&|^!=<>]=?|\.|[:?]/,punctuation:/[(){}\[\];,]/};

43
examples/prism-psl.html Normal file
View File

@ -0,0 +1,43 @@
<h2>Strings</h2>
<pre><code># PSL Strings are properly rendered
print("Hello, World!");
# Escaped sequences are highlighted too
print("Goodbye \H\H\H\H\H\H\H\HHello, World!\n");
# Multi-line strings are supported
print("multi
line");
</code></pre>
<h2>Numbers</h2>
<pre><code>a = 1;
b = 2.5;
c = 0xff;
</code></pre>
<h2>PSL Built-in Functions</h2>
<pre><code>p = nthargf(process(".*"), 1, " \t", "\n");
lock("test");
execute("OS", "pwd");
</code></pre>
<h2>PSL Keywords</h2>
<pre><code>foreach entry (["aaa", "bbb", "ccc"]) {
if (grep("[bc]", entry)) {
last;
}
}
</code></pre>
<h2>PSL Constants</h2>
<pre><code>set("/CLASS/inst/paramA/state", WARN);
if (true) {
PslDebug = -1;
}
output = execute("OS", "echo test");
if (errno) {
print(ALARM." with errno=".errno."\n");
}
print(trim(output, "\n\r\t ", TRIM_LEADING_AND_TRAILING));
</code></pre>

View File

@ -138,6 +138,7 @@
"opencl": "OpenCL",
"parigp": "PARI/GP",
"objectpascal": "Object Pascal",
"psl": "PATROL Scripting Language",
"pcaxis": "PC-Axis",
"px": "PC-Axis",
"peoplecode": "PeopleCode",

View File

@ -1 +1 @@
!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var r={none:"Plain text",html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cil:"CIL",cmake:"CMake",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",dataweave:"DataWeave",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",dot:"DOT (Graphviz)",gv:"DOT (Graphviz)",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",graphql:"GraphQL",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",kts:"Kotlin Script",kt:"Kotlin",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",parigp:"PARI/GP",objectpascal:"Object Pascal",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",promql:"PromQL",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",iecst:"Structured Text (IEC 61131-3)","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",uri:"URI",url:"URL",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var t,s=a.getAttribute("data-language")||r[e.language]||((t=e.language)?(t.substring(0,1).toUpperCase()+t.substring(1)).replace(/s(?=cript)/,"S"):t);if(s){var o=document.createElement("span");return o.textContent=s,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}();
!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var r={none:"Plain text",html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",rss:"RSS",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"ABNF",al:"AL",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",aspnet:"ASP.NET (C#)",asm6502:"6502 Assembly",autohotkey:"AutoHotkey",autoit:"AutoIt",basic:"BASIC",bbcode:"BBcode",bnf:"BNF",rbnf:"RBNF",bsl:"BSL (1C:Enterprise)",oscript:"OneScript",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cil:"CIL",cmake:"CMake",coffee:"CoffeeScript",conc:"Concurnas",csp:"Content-Security-Policy","css-extras":"CSS Extras",dataweave:"DataWeave",dax:"DAX",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",dot:"DOT (Graphviz)",gv:"DOT (Graphviz)",ebnf:"EBNF",editorconfig:"EditorConfig",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB","excel-formula":"Excel Formula",xlsx:"Excel Formula",xls:"Excel Formula",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",graphql:"GraphQL",hs:"Haskell",hcl:"HCL",hlsl:"HLSL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam",ignore:".ignore",gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras",json:"JSON",webmanifest:"Web App Manifest",json5:"JSON5",jsonp:"JSONP",jsstacktrace:"JS stack trace","js-templates":"JS Templates",kts:"Kotlin Script",kt:"Kotlin",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",llvm:"LLVM IR",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",mongodb:"MongoDB",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",naniscript:"Naninovel Script",nani:"Naninovel Script",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",objc:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",parigp:"PARI/GP",objectpascal:"Object Pascal",psl:"PATROL Scripting Language",pcaxis:"PC-Axis",px:"PC-Axis",peoplecode:"PeopleCode",pcode:"PeopleCode",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powerquery:"PowerQuery",pq:"PowerQuery",mscript:"PowerQuery",powershell:"PowerShell",promql:"PromQL",properties:".properties",protobuf:"Protocol Buffers",purebasic:"PureBasic",pbfasm:"PureBasic",purs:"PureScript",py:"Python",q:"Q (kdb+ database)",qml:"QML",rkt:"Racket",jsx:"React JSX",tsx:"React TSX",renpy:"Ren'py",rpy:"Ren'py",rest:"reST (reStructuredText)",robotframework:"Robot Framework",robot:"Robot Framework",rb:"Ruby",sas:"SAS",sass:"Sass (Sass)",scss:"Sass (Scss)","shell-session":"Shell session","sh-session":"Shell session",shellsession:"Shell session",sml:"SML",smlnj:"SML/NJ",solidity:"Solidity (Ethereum)",sol:"Solidity (Ethereum)","solution-file":"Solution file",sln:"Solution file",soy:"Soy (Closure Template)",sparql:"SPARQL",rq:"SPARQL","splunk-spl":"Splunk SPL",sqf:"SQF: Status Quo Function (Arma 3)",sql:"SQL",iecst:"Structured Text (IEC 61131-3)","t4-templating":"T4 templating","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)",tap:"TAP",tt2:"Template Toolkit 2",toml:"TOML",trig:"TriG",ts:"TypeScript",tsconfig:"TSConfig",uscript:"UnrealScript",uc:"UnrealScript",uri:"URI",url:"URL",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vba:"VBA",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",xeoracube:"XeoraCube","xml-doc":"XML doc (.net)",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML",yang:"YANG"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var t,s=a.getAttribute("data-language")||r[e.language]||((t=e.language)?(t.substring(0,1).toUpperCase()+t.substring(1)).replace(/s(?=cript)/,"S"):t);if(s){var o=document.createElement("span");return o.textContent=s,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}();

View File

@ -0,0 +1,369 @@
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
----------------------------------------------------
[
["builtin", "acos"],
["builtin", "add_diary"],
["builtin", "annotate"],
["builtin", "annotate_get"],
["builtin", "asctime"],
["builtin", "asin"],
["builtin", "atan"],
["builtin", "atexit"],
["builtin", "ascii_to_ebcdic"],
["builtin", "batch_set"],
["builtin", "blackout"],
["builtin", "cat"],
["builtin", "ceil"],
["builtin", "chan_exists"],
["builtin", "change_state"],
["builtin", "close"],
["builtin", "code_cvt"],
["builtin", "cond_signal"],
["builtin", "cond_wait"],
["builtin", "console_type"],
["builtin", "convert_base"],
["builtin", "convert_date"],
["builtin", "convert_locale_date"],
["builtin", "cos"],
["builtin", "cosh"],
["builtin", "create"],
["builtin", "destroy_lock"],
["builtin", "dump_hist"],
["builtin", "date"],
["builtin", "destroy"],
["builtin", "difference"],
["builtin", "dget_text"],
["builtin", "dcget_text"],
["builtin", "ebcdic_to_ascii"],
["builtin", "encrypt"],
["builtin", "event_archive"],
["builtin", "event_catalog_get"],
["builtin", "event_check"],
["builtin", "event_query"],
["builtin", "event_range_manage"],
["builtin", "event_range_query"],
["builtin", "event_report"],
["builtin", "event_schedule"],
["builtin", "event_trigger"],
["builtin", "event_trigger2"],
["builtin", "execute"],
["builtin", "exists"],
["builtin", "exp"],
["builtin", "fabs"],
["builtin", "floor"],
["builtin", "fmod"],
["builtin", "full_discovery"],
["builtin", "file"],
["builtin", "fopen"],
["builtin", "ftell"],
["builtin", "fseek"],
["builtin", "grep"],
["builtin", "get_vars"],
["builtin", "getenv"],
["builtin", "get"],
["builtin", "get_chan_info"],
["builtin", "get_ranges"],
["builtin", "get_text"],
["builtin", "gethostinfo"],
["builtin", "getpid"],
["builtin", "getpname"],
["builtin", "history_get_retention"],
["builtin", "history"],
["builtin", "index"],
["builtin", "int"],
["builtin", "is_var"],
["builtin", "intersection"],
["builtin", "isnumber"],
["builtin", "internal"],
["builtin", "in_transition"],
["builtin", "join"],
["builtin", "kill"],
["builtin", "length"],
["builtin", "lines"],
["builtin", "lock"],
["builtin", "lock_info"],
["builtin", "log"],
["builtin", "loge"],
["builtin", "log10"],
["builtin", "matchline"],
["builtin", "msg_check"],
["builtin", "msg_get_format"],
["builtin", "msg_get_severity"],
["builtin", "msg_printf"],
["builtin", "msg_sprintf"],
["builtin", "ntharg"],
["builtin", "num_consoles"],
["builtin", "nthargf"],
["builtin", "nthline"],
["builtin", "nthlinef"],
["builtin", "num_bytes"],
["builtin", "print"],
["builtin", "proc_exists"],
["builtin", "process"],
["builtin", "popen"],
["builtin", "printf"],
["builtin", "pconfig"],
["builtin", "poplines"],
["builtin", "pow"],
["builtin", "PslExecute"],
["builtin", "PslFunctionCall"],
["builtin", "PslFunctionExists"],
["builtin", "PslSetOptions"],
["builtin", "random"],
["builtin", "read"],
["builtin", "readln"],
["builtin", "refresh_parameters"],
["builtin", "remote_check"],
["builtin", "remote_close"],
["builtin", "remote_event_query"],
["builtin", "remote_event_trigger"],
["builtin", "remote_file_send"],
["builtin", "remote_open"],
["builtin", "remove"],
["builtin", "replace"],
["builtin", "rindex"],
["builtin", "sec_check_priv"],
["builtin", "sec_store_get"],
["builtin", "sec_store_set"],
["builtin", "set_alarm_ranges"],
["builtin", "set_locale"],
["builtin", "share"],
["builtin", "sin"],
["builtin", "sinh"],
["builtin", "sleep"],
["builtin", "sopen"],
["builtin", "sqrt"],
["builtin", "srandom"],
["builtin", "subset"],
["builtin", "set"],
["builtin", "substr"],
["builtin", "system"],
["builtin", "sprintf"],
["builtin", "sort"],
["builtin", "subset"],
["builtin", "snmp_agent_config"],
["builtin", "_snmp_debug"],
["builtin", "snmp_agent_stop"],
["builtin", "snmp_agent_start"],
["builtin", "snmp_h_set"],
["builtin", "snmp_h_get_next"],
["builtin", "snmp_h_get"],
["builtin", "snmp_set"],
["builtin", "snmp_walk"],
["builtin", "snmp_get_next"],
["builtin", "snmp_get"],
["builtin", "snmp_config"],
["builtin", "snmp_close"],
["builtin", "snmp_open"],
["builtin", "snmp_trap_receive"],
["builtin", "snmp_trap_ignore"],
["builtin", "snmp_trap_listen"],
["builtin", "snmp_trap_send"],
["builtin", "snmp_trap_raise_std_trap"],
["builtin", "snmp_trap_register_im"],
["builtin", "splitline"],
["builtin", "strcasecmp"],
["builtin", "str_repeat"],
["builtin", "trim"],
["builtin", "tail"],
["builtin", "tan"],
["builtin", "tanh"],
["builtin", "time"],
["builtin", "tmpnam"],
["builtin", "tolower"],
["builtin", "toupper"],
["builtin", "trace_psl_process"],
["builtin", "text_domain"],
["builtin", "unlock"],
["builtin", "unique"],
["builtin", "union"],
["builtin", "unset"],
["builtin", "va_arg"],
["builtin", "va_start"],
["builtin", "write"]
]
----------------------------------------------------
Test for PSL built-in functions

View File

@ -0,0 +1,23 @@
# Comment
# This is not a "string"
# This is not a <<<HERE_DOC document HERE_DOC
### Comment
"string # with hash"#comment
# Indented comment
# Tab-indented comment
----------------------------------------------------
[
["comment", "# Comment"],
["comment", "# This is not a \"string\""],
["comment", "# This is not a <<<HERE_DOC document HERE_DOC"],
["comment", "### Comment"],
["string", ["\"string # with hash\""]], ["comment", "#comment"],
["comment", "# Indented comment"],
["comment", "# Tab-indented comment"]
]
----------------------------------------------------
Test for comments

View File

@ -0,0 +1,107 @@
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
----------------------------------------------------
[
["constant", "ALARM"],
["constant", "CHART_ADD_GRAPH"],
["constant", "CHART_DELETE_GRAPH"],
["constant", "CHART_DESTROY"],
["constant", "CHART_LOAD"],
["constant", "CHART_PRINT"],
["constant", "EOF"],
["constant", "FALSE"],
["constant", "False"],
["constant", "false"],
["constant", "NO"],
["constant", "No"],
["constant", "no"],
["constant", "OFFLINE"],
["constant", "OK"],
["constant", "PSL_PROF_LOG"],
["constant", "R_CHECK_HORIZ"],
["constant", "R_CHECK_VERT"],
["constant", "R_CLICKER"],
["constant", "R_COLUMN"],
["constant", "R_FRAME"],
["constant", "R_ICON"],
["constant", "R_LABEL"],
["constant", "R_LABEL_CENTER"],
["constant", "R_LIST_MULTIPLE"],
["constant", "R_LIST_MULTIPLE_ND"],
["constant", "R_LIST_SINGLE"],
["constant", "R_LIST_SINGLE_ND"],
["constant", "R_MENU"],
["constant", "R_POPUP"],
["constant", "R_POPUP_SCROLLED"],
["constant", "R_RADIO_HORIZ"],
["constant", "R_RADIO_VERT"],
["constant", "R_ROW"],
["constant", "R_SCALE_HORIZ"],
["constant", "R_SCALE_VERT"],
["constant", "R_SPINNER"],
["constant", "R_TEXT_FIELD"],
["constant", "R_TEXT_FIELD_LABEL"],
["constant", "R_TOGGLE"],
["constant", "TRIM_LEADING"],
["constant", "TRIM_LEADING_AND_TRAILING"],
["constant", "TRIM_REDUNDANT"],
["constant", "TRIM_TRAILING"],
["constant", "TRUE"],
["constant", "True"],
["constant", "true"],
["constant", "VOID"],
["constant", "WARN"]
]
----------------------------------------------------
Test for constants

View File

@ -0,0 +1,37 @@
function test() { return "a"; }
foreach __single ";" entry (["a;b;c"]) { test(); }
----------------------------------------------------
[
["keyword", "function"],
["function", "test"],
["punctuation", "("],
["punctuation", ")"],
["punctuation", "{"],
["keyword", "return"],
["string", ["\"a\""]],
["punctuation", ";"],
["punctuation", "}"],
["keyword", "foreach"],
["keyword", "__single"],
["string", ["\";\""]],
["foreach-variable", "entry"],
["punctuation", "("],
["punctuation", "["],
["string", ["\"a;b;c\""]],
["punctuation", "]"],
["punctuation", ")"],
["punctuation", "{"],
["function", "test"],
["punctuation", "("],
["punctuation", ")"],
["punctuation", ";"],
["punctuation", "}"]
]
----------------------------------------------------
Test for user-defind functions... and the foreach statement!
(lookalike, but different)

View File

@ -0,0 +1,21 @@
<<<ABC_1
Text "not a string"
# not a comment "not a string"
ABC_1;
<<<ABC_2
2nd here_doc \n\t
ABC_2;
----------------------------------------------------
[
["heredoc-string", "<<<ABC_1\r\nText \"not a string\"\r\n# not a comment \"not a string\"\r\nABC_1"],
["punctuation", ";"],
["heredoc-string", "<<<ABC_2\r\n2nd here_doc \\n\\t\r\nABC_2"], ["punctuation", ";"]
]
----------------------------------------------------
Test for "here_documents"

View File

@ -0,0 +1,55 @@
__multi
__single
case
default
do
else
elsif
exit
export
for
foreach
function
if
last
line
local
next
requires
return
switch
until
while
word
----------------------------------------------------
[
["keyword", "__multi"],
["keyword", "__single"],
["keyword", "case"],
["keyword", "default"],
["keyword", "do"],
["keyword", "else"],
["keyword", "elsif"],
["keyword", "exit"],
["keyword", "export"],
["keyword", "for"],
["keyword", "foreach"],
["keyword", "function"],
["keyword", "if"],
["keyword", "last"],
["keyword", "line"],
["keyword", "local"],
["keyword", "next"],
["keyword", "requires"],
["keyword", "return"],
["keyword", "switch"],
["keyword", "until"],
["keyword", "while"],
["keyword", "word"]
]
----------------------------------------------------
Test for keywords

View File

@ -0,0 +1,23 @@
1
1.3
1.0
01.2
0xF0
0xbcde0
0XA390
----------------------------------------------------
[
["number", "1"],
["number", "1.3"],
["number", "1.0"],
["number", "01.2"],
["number", "0xF0"],
["number", "0xbcde0"],
["number", "0XA390"]
]
----------------------------------------------------
Test for numbers

View File

@ -0,0 +1,189 @@
1=2
1+=2
1-=2
1<<=2
1>>=2
1^=2
1*=2
1/=2
1%=2
1|=2
1&=2
1||2
1&&2
1|2
1^2
1&2
1!=2
1==2
1=~2
1!~2
1<2
1<=2
1>2
1>=2
1<<2
1>>2
1+2
1*2
1/2
1%2
"a"."b"
1-2
!1
1++2
1--2
1?2:3
----------------------------------------------------
[
["number", "1"],
["operator", "="],
["number", "2"],
["number", "1"],
["operator", "+="],
["number", "2"],
["number", "1"],
["operator", "-="],
["number", "2"],
["number", "1"],
["operator", "<<="],
["number", "2"],
["number", "1"],
["operator", ">>="],
["number", "2"],
["number", "1"],
["operator", "^="],
["number", "2"],
["number", "1"],
["operator", "*="],
["number", "2"],
["number", "1"],
["operator", "/="],
["number", "2"],
["number", "1"],
["operator", "%="],
["number", "2"],
["number", "1"],
["operator", "|="],
["number", "2"],
["number", "1"],
["operator", "&="],
["number", "2"],
["number", "1"],
["operator", "||"],
["number", "2"],
["number", "1"],
["operator", "&&"],
["number", "2"],
["number", "1"],
["operator", "|"],
["number", "2"],
["number", "1"],
["operator", "^"],
["number", "2"],
["number", "1"],
["operator", "&"],
["number", "2"],
["number", "1"],
["operator", "!="],
["number", "2"],
["number", "1"],
["operator", "=="],
["number", "2"],
["number", "1"],
["operator", "=~"],
["number", "2"],
["number", "1"],
["operator", "!~"],
["number", "2"],
["number", "1"],
["operator", "<"],
["number", "2"],
["number", "1"],
["operator", "<="],
["number", "2"],
["number", "1"],
["operator", ">"],
["number", "2"],
["number", "1"],
["operator", ">="],
["number", "2"],
["number", "1"],
["operator", "<<"],
["number", "2"],
["number", "1"],
["operator", ">>"],
["number", "2"],
["number", "1"],
["operator", "+"],
["number", "2"],
["number", "1"],
["operator", "*"],
["number", "2"],
["number", "1"],
["operator", "/"],
["number", "2"],
["number", "1"],
["operator", "%"],
["number", "2"],
["string", ["\"a\""]],
["operator", "."],
["string", ["\"b\""]],
["number", "1"],
["operator", "-"],
["number", "2"],
["operator", "!"],
["number", "1"],
["number", "1"],
["operator", "++"],
["number", "2"],
["number", "1"],
["operator", "--"],
["number", "2"],
["number", "1"],
["operator", "?"],
["number", "2"],
["operator", ":"],
["number", "3"]
]
----------------------------------------------------
Test for oper1tors

View File

@ -0,0 +1,60 @@
function test(limit) {
for (i = 0 ; i < limit ; i++) {
s = s + i; # s has not been initialized!
}
print(s."\n");
}
----------------------------------------------------
[
["keyword", "function"],
["function", "test"],
["punctuation", "("],
"limit",
["punctuation", ")"],
["punctuation", "{"],
["keyword", "for"],
["punctuation", "("],
"i ",
["operator", "="],
["number", "0"],
["punctuation", ";"],
" i ",
["operator", "<"],
" limit ",
["punctuation", ";"],
" i",
["operator", "++"],
["punctuation", ")"],
["punctuation", "{"],
"\r\n\t\ts ",
["operator", "="],
" s ",
["operator", "+"],
" i",
["punctuation", ";"],
["comment", "# s has not been initialized!"],
["punctuation", "}"],
["builtin", "print"],
["punctuation", "("],
"s",
["operator", "."],
["string", [
"\"",
["symbol", "\\n"],
"\""
]],
["punctuation", ")"],
["punctuation", ";"],
["punctuation", "}"]
]
----------------------------------------------------
General test for the most common PSL statements, all mixed together

View File

@ -0,0 +1,32 @@
"abc"
"a \"bc\""
"a\nbc"
"a\invalid"
"foo # not a comment"
"multi
line string"
----------------------------------------------------
[
["string", ["\"abc\""]],
["string", [
"\"a ",
["symbol", "\\\""],
"bc",
["symbol", "\\\""],
"\""
]],
["string", [
"\"a",
["symbol", "\\n"],
"bc\""
]],
["string", ["\"a\\invalid\""]],
["string", ["\"foo # not a comment\""]],
["string", ["\"multi\r\nline string\""]]
]
----------------------------------------------------
Test for strings

View File

@ -0,0 +1,15 @@
errno
exit_status
PslDebug
----------------------------------------------------
[
["variable", "errno"],
["variable", "exit_status"],
["variable", "PslDebug"]
]
----------------------------------------------------
Test for variables