Added support for Excel formula (#2219)

This adds support for Excel's formula terms.
This commit is contained in:
Michael Schmidt 2020-03-10 14:59:46 +01:00 committed by GitHub
parent 1e3070a2ae
commit bf4f7bfa2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 422 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -307,6 +307,11 @@
"title": "Erlang",
"owner": "Golmote"
},
"excel-formula": {
"title": "Excel Formula",
"alias": ["xlsx", "xls"],
"owner": "RunDevelopment"
},
"fsharp": {
"title": "F#",
"require": "clike",

View File

@ -0,0 +1,66 @@
Prism.languages['excel-formula'] = {
'comment': {
pattern: /(\bN\(\s*)"(?:[^"]|"")*"(?=\s*\))/i,
lookbehind: true,
greedy: true
},
'string': {
pattern: /"(?:[^"]|"")*"(?!")/,
greedy: true
},
'reference': {
// https://www.ablebits.com/office-addins-blog/2015/12/08/excel-reference-another-sheet-workbook/
// Sales!B2
// 'Winter sales'!B2
// [Sales.xlsx]Jan!B2:B5
// D:\Reports\[Sales.xlsx]Jan!B2:B5
// '[Sales.xlsx]Jan sales'!B2:B5
// 'D:\Reports\[Sales.xlsx]Jan sales'!B2:B5
pattern: /(?:'[^']*'|(?:[^\s()[\]{}<>*?"';,$&]*\[[^^\s()[\]{}<>*?"']+\])?\w+)!/,
greedy: true,
alias: 'string',
inside: {
'operator': /!$/,
'punctuation': /'/,
'sheet': {
pattern: /[^[\]]+$/,
alias: 'function'
},
'file': {
pattern: /\[[^[\]]+\]$/,
inside: {
'punctuation': /[[\]]/
}
},
'path': /[\s\S]+/
}
},
'function-name': {
pattern: /[A-Z]\w*(?=\()/i,
alias: 'keyword'
},
'range': {
pattern: /\$?(?:[A-Z]+\$?\d+:\$?[A-Z]+\$?\d+|[A-Z]+:\$?[A-Z]+|\d+:\$?\d+)/i,
alias: 'property',
inside: {
'operator': /:/,
'cell': /\$?[A-Z]+\$?\d+/i,
'column': /\$?[A-Z]+/i,
'row': /\$?\d+/
}
},
'cell': {
// Excel is case insensitive, so the string "foo1" could be either a variable or a cell.
// To combat this, we match cells case insensitive, if the contain at least one "$", and case sensitive otherwise.
pattern: /[A-Z]+\d+|\$[A-Za-z]+\$?\d+|[A-Za-z]+\$\d+/,
alias: 'property'
},
'number': /(?:\b\d+(?:\.\d+)?|\B\.\d+)(?:e[+-]?\d+)?\b/i,
'boolean': /\b(?:TRUE|FALSE)\b/i,
'operator': /[-+*/^%=&,]|<[=>]?|>=?/,
'punctuation': /[[\]();{}|]/
};
Prism.languages['xlsx'] = Prism.languages['xls'] = Prism.languages['excel-formula'];

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

@ -0,0 +1 @@
Prism.languages["excel-formula"]={comment:{pattern:/(\bN\(\s*)"(?:[^"]|"")*"(?=\s*\))/i,lookbehind:!0,greedy:!0},string:{pattern:/"(?:[^"]|"")*"(?!")/,greedy:!0},reference:{pattern:/(?:'[^']*'|(?:[^\s()[\]{}<>*?"';,$&]*\[[^^\s()[\]{}<>*?"']+\])?\w+)!/,greedy:!0,alias:"string",inside:{operator:/!$/,punctuation:/'/,sheet:{pattern:/[^[\]]+$/,alias:"function"},file:{pattern:/\[[^[\]]+\]$/,inside:{punctuation:/[[\]]/}},path:/[\s\S]+/}},"function-name":{pattern:/[A-Z]\w*(?=\()/i,alias:"keyword"},range:{pattern:/\$?(?:[A-Z]+\$?\d+:\$?[A-Z]+\$?\d+|[A-Z]+:\$?[A-Z]+|\d+:\$?\d+)/i,alias:"property",inside:{operator:/:/,cell:/\$?[A-Z]+\$?\d+/i,column:/\$?[A-Z]+/i,row:/\$?\d+/}},cell:{pattern:/[A-Z]+\d+|\$[A-Za-z]+\$?\d+|[A-Za-z]+\$\d+/,alias:"property"},number:/(?:\b\d+(?:\.\d+)?|\B\.\d+)(?:e[+-]?\d+)?\b/i,boolean:/\b(?:TRUE|FALSE)\b/i,operator:/[-+*/^%=&,]|<[=>]?|>=?/,punctuation:/[[\]();{}|]/},Prism.languages.xlsx=Prism.languages.xls=Prism.languages["excel-formula"];

View File

@ -0,0 +1,10 @@
<h2>Full example</h2>
<pre><code>=SUM(G7*9)
=INT(RAND()*999)
=AVERAGE(A4:A13)+N("Average user rating")
=CONCATENATE(F4, ",", " ", G4," ",H4)
=IF($A4>500, $A4, 0)
=AND($B4>=501,$C4&lt;=500)
=SUBTOTAL(103,staff[Name])
=TRIMMEAN(staff[Salary],10%)
=SUM([Sales.xlsx]Jan!B2:B5)</code></pre>

View File

@ -154,6 +154,8 @@
"jinja2": "django",
"dns-zone": "dns-zone-file",
"dockerfile": "docker",
"xlsx": "excel-formula",
"xls": "excel-formula",
"gamemakerlanguage": "gml",
"hs": "haskell",
"tex": "latex",

View File

@ -1 +1 @@
!function(){if("undefined"!=typeof self&&self.Prism&&self.document&&document.createElement){var c={javascript:"clike",actionscript:"javascript",arduino:"cpp",aspnet:["markup","csharp"],bison:"c",c:"clike",csharp:"clike",cpp:"c",coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",django:"markup-templating",ejs:["javascript","markup-templating"],etlua:["lua","markup-templating"],erb:["ruby","markup-templating"],fsharp:"clike","firestore-security-rules":"clike",flow:"javascript",ftl:"markup-templating",glsl:"clike",gml:"clike",go:"clike",groovy:"clike",haml:"ruby",handlebars:"markup-templating",haxe:"clike",java:"clike",javadoc:["markup","java","javadoclike"],jolie:"clike",jsdoc:["javascript","javadoclike"],"js-extras":"javascript","js-templates":"javascript",jsonp:"json",json5:"json",kotlin:"clike",latte:["clike","markup-templating","php"],less:"css",lilypond:"scheme",markdown:"markup","markup-templating":"markup",n4js:"javascript",nginx:"clike",objectivec:"c",opencl:"c",parser:"markup",php:["clike","markup-templating"],phpdoc:["php","javadoclike"],"php-extras":"php",plsql:"sql",processing:"clike",protobuf:"clike",pug:["markup","javascript"],qml:"javascript",qore:"clike",jsx:["markup","javascript"],tsx:["jsx","typescript"],reason:"clike",ruby:"clike",sass:"css",scss:"css",scala:"java","shell-session":"bash",smarty:"markup-templating",solidity:"clike",soy:"markup-templating",sparql:"turtle",sqf:"clike",swift:"clike",tap:"yaml",textile:"markup",tt2:["clike","markup-templating"],twig:"markup",typescript:"javascript","t4-cs":["t4-templating","csharp"],"t4-vb":["t4-templating","visual-basic"],vala:"clike",vbnet:"basic",velocity:"markup",wiki:"markup",xeora:"markup",xquery:"markup"},l={html:"markup",xml:"markup",svg:"markup",mathml:"markup",js:"javascript",g4:"antlr4",adoc:"asciidoc",shell:"bash",rbnf:"bnf",conc:"concurnas",cs:"csharp",dotnet:"csharp",coffee:"coffeescript",jinja2:"django","dns-zone":"dns-zone-file",dockerfile:"docker",gamemakerlanguage:"gml",hs:"haskell",tex:"latex",context:"latex",ly:"lilypond",emacs:"lisp",elisp:"lisp","emacs-lisp":"lisp",md:"markdown",moon:"moonscript",n4jsd:"n4js",objectpascal:"pascal",px:"pcaxis",py:"python",robot:"robotframework",rb:"ruby",sln:"solution-file",rq:"sparql",trig:"turtle",ts:"typescript",t4:"t4-cs",vb:"visual-basic",xeoracube:"xeora",yml:"yaml"},n={},a="components/",e=Prism.util.currentScript();if(e){var t=/\bplugins\/autoloader\/prism-autoloader\.(?:min\.)js$/i,s=/[\w-]+\.(?:min\.)js$/i;if(e.hasAttribute("data-autoloader-path"))a=e.getAttribute("data-autoloader-path").trim().replace(/\/?$/,"/");else{var i=e.src;t.test(i)?a=i.replace(t,"components/"):s.test(i)&&(a=i.replace(s,"components/"))}}var p=Prism.plugins.autoloader={languages_path:a,use_minified:!0,loadLanguages:o};Prism.hooks.add("complete",function(a){a.element&&a.language&&!a.grammar&&"none"!==a.language&&function(a,e){a in l&&(a=l[a]);var t=e.getAttribute("data-dependencies"),s=e.parentElement;!t&&s&&"pre"===s.tagName.toLowerCase()&&(t=s.getAttribute("data-dependencies")),o(t=t?t.split(/\s*,\s*/g):[],function(){m(a,function(){Prism.highlightElement(e)})})}(a.language,a.element)})}function o(a,e,t){"string"==typeof a&&(a=[a]);var s=a.length,i=0,r=!1;function c(){r||++i===s&&e&&e(a)}0!==s?a.forEach(function(a){m(a,c,function(){r||(r=!0,t&&t(a))})}):e&&setTimeout(e,0)}function m(e,t,s){var i=0<=e.indexOf("!");e=e.replace("!",""),e=l[e]||e;var a=function(){var a=n[e];if(a||(a=n[e]={callbacks:[]}),a.callbacks.push({success:t,error:s}),!i&&Prism.languages[e])u(e,"success");else if(!i&&a.error)u(e,"error");else if(i||!a.loading){a.loading=!0,function(a,e,t){var s=document.createElement("script");s.src=a,s.async=!0,s.onload=function(){document.body.removeChild(s),e&&e()},s.onerror=function(){document.body.removeChild(s),t&&t()},document.body.appendChild(s)}(function(a){return p.languages_path+"prism-"+a+(p.use_minified?".min":"")+".js"}(e),function(){a.loading=!1,u(e,"success")},function(){a.loading=!1,a.error=!0,u(e,"error")})}},r=c[e];r&&r.length?o(r,a,s):a()}function u(a,e){if(n[a]){for(var t=n[a].callbacks,s=0,i=t.length;s<i;s++){var r=t[s][e];r&&setTimeout(r,0)}t.length=0}}}();
!function(){if("undefined"!=typeof self&&self.Prism&&self.document&&document.createElement){var l={javascript:"clike",actionscript:"javascript",arduino:"cpp",aspnet:["markup","csharp"],bison:"c",c:"clike",csharp:"clike",cpp:"c",coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",django:"markup-templating",ejs:["javascript","markup-templating"],etlua:["lua","markup-templating"],erb:["ruby","markup-templating"],fsharp:"clike","firestore-security-rules":"clike",flow:"javascript",ftl:"markup-templating",glsl:"clike",gml:"clike",go:"clike",groovy:"clike",haml:"ruby",handlebars:"markup-templating",haxe:"clike",java:"clike",javadoc:["markup","java","javadoclike"],jolie:"clike",jsdoc:["javascript","javadoclike"],"js-extras":"javascript","js-templates":"javascript",jsonp:"json",json5:"json",kotlin:"clike",latte:["clike","markup-templating","php"],less:"css",lilypond:"scheme",markdown:"markup","markup-templating":"markup",n4js:"javascript",nginx:"clike",objectivec:"c",opencl:"c",parser:"markup",php:["clike","markup-templating"],phpdoc:["php","javadoclike"],"php-extras":"php",plsql:"sql",processing:"clike",protobuf:"clike",pug:["markup","javascript"],qml:"javascript",qore:"clike",jsx:["markup","javascript"],tsx:["jsx","typescript"],reason:"clike",ruby:"clike",sass:"css",scss:"css",scala:"java","shell-session":"bash",smarty:"markup-templating",solidity:"clike",soy:"markup-templating",sparql:"turtle",sqf:"clike",swift:"clike",tap:"yaml",textile:"markup",tt2:["clike","markup-templating"],twig:"markup",typescript:"javascript","t4-cs":["t4-templating","csharp"],"t4-vb":["t4-templating","visual-basic"],vala:"clike",vbnet:"basic",velocity:"markup",wiki:"markup",xeora:"markup",xquery:"markup"},c={html:"markup",xml:"markup",svg:"markup",mathml:"markup",js:"javascript",g4:"antlr4",adoc:"asciidoc",shell:"bash",rbnf:"bnf",conc:"concurnas",cs:"csharp",dotnet:"csharp",coffee:"coffeescript",jinja2:"django","dns-zone":"dns-zone-file",dockerfile:"docker",xlsx:"excel-formula",xls:"excel-formula",gamemakerlanguage:"gml",hs:"haskell",tex:"latex",context:"latex",ly:"lilypond",emacs:"lisp",elisp:"lisp","emacs-lisp":"lisp",md:"markdown",moon:"moonscript",n4jsd:"n4js",objectpascal:"pascal",px:"pcaxis",py:"python",robot:"robotframework",rb:"ruby",sln:"solution-file",rq:"sparql",trig:"turtle",ts:"typescript",t4:"t4-cs",vb:"visual-basic",xeoracube:"xeora",yml:"yaml"},n={},a="components/",e=Prism.util.currentScript();if(e){var t=/\bplugins\/autoloader\/prism-autoloader\.(?:min\.)js$/i,s=/[\w-]+\.(?:min\.)js$/i;if(e.hasAttribute("data-autoloader-path"))a=e.getAttribute("data-autoloader-path").trim().replace(/\/?$/,"/");else{var i=e.src;t.test(i)?a=i.replace(t,"components/"):s.test(i)&&(a=i.replace(s,"components/"))}}var p=Prism.plugins.autoloader={languages_path:a,use_minified:!0,loadLanguages:o};Prism.hooks.add("complete",function(a){a.element&&a.language&&!a.grammar&&"none"!==a.language&&function(a,e){a in c&&(a=c[a]);var t=e.getAttribute("data-dependencies"),s=e.parentElement;!t&&s&&"pre"===s.tagName.toLowerCase()&&(t=s.getAttribute("data-dependencies")),o(t=t?t.split(/\s*,\s*/g):[],function(){m(a,function(){Prism.highlightElement(e)})})}(a.language,a.element)})}function o(a,e,t){"string"==typeof a&&(a=[a]);var s=a.length,i=0,r=!1;function l(){r||++i===s&&e&&e(a)}0!==s?a.forEach(function(a){m(a,l,function(){r||(r=!0,t&&t(a))})}):e&&setTimeout(e,0)}function m(e,t,s){var i=0<=e.indexOf("!");e=e.replace("!",""),e=c[e]||e;var a=function(){var a=n[e];if(a||(a=n[e]={callbacks:[]}),a.callbacks.push({success:t,error:s}),!i&&Prism.languages[e])u(e,"success");else if(!i&&a.error)u(e,"error");else if(i||!a.loading){a.loading=!0,function(a,e,t){var s=document.createElement("script");s.src=a,s.async=!0,s.onload=function(){document.body.removeChild(s),e&&e()},s.onerror=function(){document.body.removeChild(s),t&&t()},document.body.appendChild(s)}(function(a){return p.languages_path+"prism-"+a+(p.use_minified?".min":"")+".js"}(e),function(){a.loading=!1,u(e,"success")},function(){a.loading=!1,a.error=!0,u(e,"error")})}},r=l[e];r&&r.length?o(r,a,s):a()}function u(a,e){if(n[a]){for(var t=n[a].callbacks,s=0,i=t.length;s<i;s++){var r=t[s][e];r&&setTimeout(r,0)}t.length=0}}}();

View File

@ -57,6 +57,9 @@
"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",

View File

@ -1 +1 @@
!function(){if("undefined"!=typeof self&&self.Prism&&self.document)if(Prism.plugins.toolbar){var r={html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"Augmented BackusNaur form",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",asm6502:"6502 Assembly",aspnet:"ASP.NET (C#)",autohotkey:"AutoHotkey",autoit:"AutoIt",shell:"Bash",basic:"BASIC",bbcode:"BBcode",bnf:"BackusNaur form",rbnf:"Routing BackusNaur form",conc:"Concurnas",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cil:"CIL",coffee:"CoffeeScript",cmake:"CMake",csp:"Content-Security-Policy","css-extras":"CSS Extras",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",ebnf:"Extended BackusNaur form",ejs:"EJS",etlua:"Embedded Lua templating",erb:"ERB",fsharp:"F#","firestore-security-rules":"Firestore security rules",ftl:"FreeMarker Template Language",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",graphql:"GraphQL",hs:"Haskell",hcl:"HCL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras","js-templates":"JS Templates",json:"JSON",jsonp:"JSONP",json5:"JSON5",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",parigp:"PARI/GP",objectpascal:"Object Pascal",pcaxis:"PC-Axis",px:"PC-Axis",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powershell:"PowerShell",properties:".properties",protobuf:"Protocol Buffers",py:"Python",q:"Q (kdb+ database)",qml:"QML",jsx:"React JSX",tsx:"React TSX",renpy:"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",solidity:"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",tap:"TAP",toml:"TOML",tt2:"Template Toolkit 2",trig:"TriG",ts:"TypeScript","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)","t4-templating":"T4 templating",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",xeoracube:"XeoraCube",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var s,t=a.getAttribute("data-language")||r[e.language]||((s=e.language)?(s.substring(0,1).toUpperCase()+s.substring(1)).replace(/s(?=cript)/,"S"):s);if(t){var o=document.createElement("span");return o.textContent=t,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 l={html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",css:"CSS",clike:"C-like",js:"JavaScript",abap:"ABAP",abnf:"Augmented BackusNaur form",antlr4:"ANTLR4",g4:"ANTLR4",apacheconf:"Apache Configuration",apl:"APL",aql:"AQL",arff:"ARFF",asciidoc:"AsciiDoc",adoc:"AsciiDoc",asm6502:"6502 Assembly",aspnet:"ASP.NET (C#)",autohotkey:"AutoHotkey",autoit:"AutoIt",shell:"Bash",basic:"BASIC",bbcode:"BBcode",bnf:"BackusNaur form",rbnf:"Routing BackusNaur form",conc:"Concurnas",csharp:"C#",cs:"C#",dotnet:"C#",cpp:"C++",cil:"CIL",coffee:"CoffeeScript",cmake:"CMake",csp:"Content-Security-Policy","css-extras":"CSS Extras",django:"Django/Jinja2",jinja2:"Django/Jinja2","dns-zone-file":"DNS zone file","dns-zone":"DNS zone file",dockerfile:"Docker",ebnf:"Extended BackusNaur form",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",gcode:"G-code",gdscript:"GDScript",gedcom:"GEDCOM",glsl:"GLSL",gml:"GameMaker Language",gamemakerlanguage:"GameMaker Language",graphql:"GraphQL",hs:"Haskell",hcl:"HCL",http:"HTTP",hpkp:"HTTP Public-Key-Pins",hsts:"HTTP Strict-Transport-Security",ichigojam:"IchigoJam",inform7:"Inform 7",javadoc:"JavaDoc",javadoclike:"JavaDoc-like",javastacktrace:"Java stack trace",jq:"JQ",jsdoc:"JSDoc","js-extras":"JS Extras","js-templates":"JS Templates",json:"JSON",jsonp:"JSONP",json5:"JSON5",latex:"LaTeX",tex:"TeX",context:"ConTeXt",lilypond:"LilyPond",ly:"LilyPond",emacs:"Lisp",elisp:"Lisp","emacs-lisp":"Lisp",lolcode:"LOLCODE",md:"Markdown","markup-templating":"Markup templating",matlab:"MATLAB",mel:"MEL",moon:"MoonScript",n1ql:"N1QL",n4js:"N4JS",n4jsd:"N4JS","nand2tetris-hdl":"Nand To Tetris HDL",nasm:"NASM",neon:"NEON",nginx:"nginx",nsis:"NSIS",objectivec:"Objective-C",ocaml:"OCaml",opencl:"OpenCL",parigp:"PARI/GP",objectpascal:"Object Pascal",pcaxis:"PC-Axis",px:"PC-Axis",php:"PHP",phpdoc:"PHPDoc","php-extras":"PHP Extras",plsql:"PL/SQL",powershell:"PowerShell",properties:".properties",protobuf:"Protocol Buffers",py:"Python",q:"Q (kdb+ database)",qml:"QML",jsx:"React JSX",tsx:"React TSX",renpy:"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",solidity:"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",tap:"TAP",toml:"TOML",tt2:"Template Toolkit 2",trig:"TriG",ts:"TypeScript","t4-cs":"T4 Text Templates (C#)",t4:"T4 Text Templates (C#)","t4-vb":"T4 Text Templates (VB)","t4-templating":"T4 templating",vbnet:"VB.Net",vhdl:"VHDL",vim:"vim","visual-basic":"Visual Basic",vb:"Visual Basic",wasm:"WebAssembly",wiki:"Wiki markup",xeoracube:"XeoraCube",xojo:"Xojo (REALbasic)",xquery:"XQuery",yaml:"YAML",yml:"YAML"};Prism.plugins.toolbar.registerButton("show-language",function(e){var a=e.element.parentNode;if(a&&/pre/i.test(a.nodeName)){var s,t=a.getAttribute("data-language")||l[e.language]||((s=e.language)?(s.substring(0,1).toUpperCase()+s.substring(1)).replace(/s(?=cript)/,"S"):s);if(t){var o=document.createElement("span");return o.textContent=t,o}}})}else console.warn("Show Languages plugin loaded before Toolbar plugin.")}();

View File

@ -0,0 +1,27 @@
B1
BBB1111
$B2
B$2
$B$2
$b2
b$2
$b$2
----------------------------------------------------
[
["cell", "B1"],
["cell", "BBB1111"],
["cell", "$B2"],
["cell", "B$2"],
["cell", "$B$2"],
["cell", "$b2"],
["cell", "b$2"],
["cell", "$b$2"]
]
----------------------------------------------------
Checks for cells.

View File

@ -0,0 +1,17 @@
SUM()
FOO()
----------------------------------------------------
[
["function-name", "SUM"],
["punctuation", "("],
["punctuation", ")"],
["function-name", "FOO"],
["punctuation", "("],
["punctuation", ")"]
]
----------------------------------------------------
Checks for functions.

View File

@ -0,0 +1,37 @@
123
123e11
123e+11
123e-11
123.123
123.123e11
123.123e+11
123.123e-11
.123
.123e11
.123e+11
.123e-11
----------------------------------------------------
[
["number", "123"],
["number", "123e11"],
["number", "123e+11"],
["number", "123e-11"],
["number", "123.123"],
["number", "123.123e11"],
["number", "123.123e+11"],
["number", "123.123e-11"],
["number", ".123"],
["number", ".123e11"],
["number", ".123e+11"],
["number", ".123e-11"]
]
----------------------------------------------------
Checks for numbers.

View File

@ -0,0 +1,27 @@
+ - * / ^ %
= <> < <= > >=
&
,
----------------------------------------------------
[
["operator", "+"],
["operator", "-"],
["operator", "*"],
["operator", "/"],
["operator", "^"],
["operator", "%"],
["operator", "="],
["operator", "<>"],
["operator", "<"],
["operator", "<="],
["operator", ">"],
["operator", ">="],
["operator", "&"],
["operator", ","]
]
----------------------------------------------------
Checks for operators.

View File

@ -0,0 +1,17 @@
( ; )
{ | }
----------------------------------------------------
[
["punctuation", "("],
["punctuation", ";"],
["punctuation", ")"],
["punctuation", "{"],
["punctuation", "|"],
["punctuation", "}"]
]
----------------------------------------------------
Checks for punctuation.

View File

@ -0,0 +1,85 @@
$B$2:$B$4
$B2:B$4
B$2:$B4
B2:B4
$B:$B
$B:B
B:$B
B:B
$2:$4
$2:4
2:$4
2:4
----------------------------------------------------
[
["range", [
["cell", "$B$2"],
["operator", ":"],
["cell", "$B$4"]
]],
["range", [
["cell", "$B2"],
["operator", ":"],
["cell", "B$4"]
]],
["range", [
["cell", "B$2"],
["operator", ":"],
["cell", "$B4"]
]],
["range", [
["cell", "B2"],
["operator", ":"],
["cell", "B4"]
]],
["range", [
["column", "$B"],
["operator", ":"],
["column", "$B"]
]],
["range", [
["column", "$B"],
["operator", ":"],
["column", "B"]
]],
["range", [
["column", "B"],
["operator", ":"],
["column", "$B"]
]],
["range", [
["column", "B"],
["operator", ":"],
["column", "B"]
]],
["range", [
["row", "$2"],
["operator", ":"],
["row", "$4"]
]],
["range", [
["row", "$2"],
["operator", ":"],
["row", "4"]
]],
["range", [
["row", "2"],
["operator", ":"],
["row", "$4"]
]],
["range", [
["row", "2"],
["operator", ":"],
["row", "4"]
]]
]
----------------------------------------------------
Checks for ranges.

View File

@ -0,0 +1,104 @@
Sales!B2
'Winter sales'!B2
[Sales.xlsx]Jan!B2:B5
D:\Reports\[Sales.xlsx]Jan!B2:B5
'[Sales.xlsx]Jan sales'!B2:B5
'D:\Reports\[Sales.xlsx]Jan sales'!B2:B5
SUM([Sales.xlsx]Jan!Jan_sales)
----------------------------------------------------
[
["reference", [
["sheet", "Sales"],
["operator", "!"]
]],
["cell", "B2"],
["reference", [
["punctuation", "'"],
["sheet", "Winter sales"],
["punctuation", "'"],
["operator", "!"]
]],
["cell", "B2"],
["reference", [
["file", [
["punctuation", "["],
"Sales.xlsx",
["punctuation", "]"]
]],
["sheet", "Jan"],
["operator", "!"]
]],
["range", [
["cell", "B2"],
["operator", ":"],
["cell", "B5"]
]],
["reference", [
["path", "D:\\Reports\\"],
["file", [
["punctuation", "["],
"Sales.xlsx",
["punctuation", "]"]
]],
["sheet", "Jan"],
["operator", "!"]
]],
["range", [
["cell", "B2"],
["operator", ":"],
["cell", "B5"]
]],
["reference", [
["punctuation", "'"],
["file", [
["punctuation", "["],
"Sales.xlsx",
["punctuation", "]"]
]],
["sheet", "Jan sales"],
["punctuation", "'"],
["operator", "!"]
]],
["range", [
["cell", "B2"],
["operator", ":"],
["cell", "B5"]
]],
["reference", [
["punctuation", "'"],
["path", "D:\\Reports\\"],
["file", [
["punctuation", "["],
"Sales.xlsx",
["punctuation", "]"]
]],
["sheet", "Jan sales"],
["punctuation", "'"],
["operator", "!"]
]],
["range", [
["cell", "B2"],
["operator", ":"],
["cell", "B5"]
]],
["function-name", "SUM"],
["punctuation", "("],
["reference", [
["file", [
["punctuation", "["],
"Sales.xlsx",
["punctuation", "]"]
]],
["sheet", "Jan"],
["operator", "!"]
]],
"Jan_sales",
["punctuation", ")"]
]
----------------------------------------------------
Checks for references.

View File

@ -0,0 +1,18 @@
""
"foo"
"foo
bar"
"foo""bar"
----------------------------------------------------
[
["string", "\"\""],
["string", "\"foo\""],
["string", "\"foo\r\nbar\""],
["string", "\"foo\"\"bar\""]
]
----------------------------------------------------
Checks for strings.