diff --git a/.gitignore b/.gitignore index 05bb2024..51105a24 100644 --- a/.gitignore +++ b/.gitignore @@ -25,4 +25,3 @@ dist-ssr package/readme.md package/LICENSE -package/src/grammars diff --git a/package/index.html b/package/index.html index a58f6a58..af9b33fd 100644 --- a/package/index.html +++ b/package/index.html @@ -76,7 +76,7 @@

Web component

- +
diff --git a/package/package.json b/package/package.json index e68639c7..2f3d5783 100644 --- a/package/package.json +++ b/package/package.json @@ -1,12 +1,14 @@ { "name": "prism-code-editor", - "version": "2.4.1", + "version": "3.0.0", "type": "module", "description": "Lightweight, extensible code editor component for the web using Prism", "main": "./dist/index.js", "types": "./dist/index.d.ts", "exports": { ".": "./dist/index.js", + "./prism": "./dist/prism/index.js", + "./prism/utils": "./dist/prism/utils/index.js", "./guides": "./dist/extensions/guides.js", "./web-component": "./dist/webComponent.js", "./copy-button": "./dist/extensions/copyButton/index.js", @@ -14,14 +16,15 @@ "./code-folding.css": "./dist/folding.css", "./scrollbar.css": "./dist/scrollbar.css", "./setups": "./dist/setups/index.js", - "./utils": "./dist/utils.js", + "./utils": "./dist/utils/index.js", "./layout.css": "./dist/layout.css", "./rtl-layout.css": "./dist/rtl-layout.css", "./themes/*.css": "./dist/themes/*.css", "./themes": "./dist/themes/index.js", "./languages": "./dist/languages/index.js", "./languages/*": "./dist/languages/*.js", - "./grammars/*": "./dist/grammars/*.js", + "./prism/languages": "./dist/prism/languages/index.js", + "./prism/languages/*": "./dist/prism/languages/*.js", "./match-brackets": "./dist/extensions/matchBrackets/index.js", "./highlight-brackets": "./dist/extensions/matchBrackets/highlight.js", "./match-tags": "./dist/extensions/matchTags.js", @@ -44,20 +47,35 @@ "dist/*" ], "scripts": { - "dev": "node scripts/buildLangs.cjs && vite", - "build": "node scripts/buildLangs.cjs && tsc && vite build && node scripts/build.mjs", + "dev": "vite", + "build": "tsc && vite build && node scripts/build.mjs", "preview": "vite preview", + "regex-coverage": "mocha src/prism/tests/coverage.js", + "test": "mocha src/prism/tests/*.js", + "test:core": "mocha src/prism/tests/core-tests.js", + "test:identifiers": "mocha src/prism/tests/identifier-test.js", + "test:languages": "mocha src/prism/tests/run.js", + "test:patterns": "mocha src/prism/tests/pattern-tests.js", "prepublish": "tsc && vite build && node scripts/build.mjs" }, "devDependencies": { - "prismjs": "^1.29.0", + "@types/chai": "^4.3.11", + "@types/mocha": "^10.0.6", + "@types/node": "^20.11.0", + "@types/yargs": "^17.0.32", + "chai": "^5.0.0", + "magic-string": "^0.30.5", + "mocha": "^10.2.0", + "prettier": "2.7.1", + "refa": "0.9.1", + "regexp-ast-analysis": "0.2.4", + "regexpp": "^3.2.0", + "scslre": "0.1.6", "typedoc": "^0.25.1", "typescript": "^5.0.2", - "vite": "^5.0.7", - "vite-plugin-dts": "^2.3.0" - }, - "dependencies": { - "@types/prismjs": "^1.26.2" + "vite": "^5.0.12", + "vite-plugin-dts": "^2.3.0", + "yargs": "^17.7.2" }, "keywords": [ "editor", @@ -76,11 +94,6 @@ "sideEffects": [ "*.css", "./dist/languages/*", - "./dist/grammars/*" - ], - "pnpm": { - "patchedDependencies": { - "prismjs@1.29.0": "patches/prismjs@1.29.0.patch" - } - } + "./dist/prism/languages/*" + ] } diff --git a/package/patches/prismjs@1.29.0.patch b/package/patches/prismjs@1.29.0.patch deleted file mode 100644 index dcd13242..00000000 --- a/package/patches/prismjs@1.29.0.patch +++ /dev/null @@ -1,11138 +0,0 @@ -diff --git a/components/prism-abnf.js b/components/prism-abnf.js -index 4b8fcab79520e0e5ab66bd22a13f689239770aba..bb4fb61cf7c05ddd867f452bf99951984e5a39a6 100644 ---- a/components/prism-abnf.js -+++ b/components/prism-abnf.js -@@ -33,7 +33,7 @@ - } - }, - 'core-rule': { -- pattern: RegExp('(?:(^|[^<\\w-])' + coreRules + '|<' + coreRules + '>)(?![\\w-])', 'i'), -+ pattern: RegExp(`(?:(^|[^<\\w-])${coreRules}|<${coreRules}>)(?![\\w-])`, 'i'), - lookbehind: true, - alias: ['rule', 'constant'], - inside: { -diff --git a/components/prism-actionscript.js b/components/prism-actionscript.js -index 72a4d232be40ec459b2bb7000aa3cd5d2badd514..fdbf97fd522389aef65cf119118b328846dfdca8 100644 ---- a/components/prism-actionscript.js -+++ b/components/prism-actionscript.js -@@ -1,19 +1,18 @@ --Prism.languages.actionscript = Prism.languages.extend('javascript', { -+var actionscript = Prism.languages.actionscript = Prism.languages.extend('javascript', { - 'keyword': /\b(?:as|break|case|catch|class|const|default|delete|do|dynamic|each|else|extends|final|finally|for|function|get|if|implements|import|in|include|instanceof|interface|internal|is|namespace|native|new|null|override|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|use|var|void|while|with)\b/, - 'operator': /\+\+|--|(?:[+\-*\/%^]|&&?|\|\|?|<>?>?|[!=]=?)=?|[~?@]/ - }); --Prism.languages.actionscript['class-name'].alias = 'function'; -+actionscript['class-name'].alias = 'function'; - - // doesn't work with AS because AS is too complex --delete Prism.languages.actionscript['parameter']; --delete Prism.languages.actionscript['literal-property']; -+delete actionscript['parameter']; -+delete actionscript['literal-property']; -+ -+Prism.languages.insertBefore('actionscript', 'string', { -+ 'xml': { -+ pattern: /(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/, -+ lookbehind: true, -+ inside: 'markup' -+ } -+}); - --if (Prism.languages.markup) { -- Prism.languages.insertBefore('actionscript', 'string', { -- 'xml': { -- pattern: /(^|[^.])<\/?\w+(?:\s+[^\s>\/=]+=("|')(?:\\[\s\S]|(?!\2)[^\\])*\2)*\s*\/?>/, -- lookbehind: true, -- inside: Prism.languages.markup -- } -- }); --} -diff --git a/components/prism-ada.js b/components/prism-ada.js -index a537f39b0ad8f80c73acc0c5e42ba2627ba26a10..081288e74a8995ce6aa54856b5a17474d254c574 100644 ---- a/components/prism-ada.js -+++ b/components/prism-ada.js -@@ -1,14 +1,7 @@ - Prism.languages.ada = { - 'comment': /--.*/, - 'string': /"(?:""|[^"\r\f\n])*"/, -- 'number': [ -- { -- pattern: /\b\d(?:_?\d)*#[\dA-F](?:_?[\dA-F])*(?:\.[\dA-F](?:_?[\dA-F])*)?#(?:E[+-]?\d(?:_?\d)*)?/i -- }, -- { -- pattern: /\b\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:E[+-]?\d(?:_?\d)*)?\b/i -- } -- ], -+ 'number': /\b\d(?:_?\d)*(?:#[\dA-F](?:_?[\dA-F])*(?:\.[\dA-F](?:_?[\dA-F])*)?#|(?:\.\d(?:_?\d)*)?)(?:E[+-]?\d(?:_?\d)*)?\b/i, - 'attribute': { - pattern: /\b'\w+/, - alias: 'attr-name' -diff --git a/components/prism-antlr4.js b/components/prism-antlr4.js -index d5c446b1f36d63c7fc47ea1d4e435033c0daa93a..654088c0ead2a2ff0adb3e0e983fde77558cb6dc 100644 ---- a/components/prism-antlr4.js -+++ b/components/prism-antlr4.js -@@ -22,12 +22,8 @@ Prism.languages.antlr4 = { - pattern: /\{(?:[^{}]|\{(?:[^{}]|\{(?:[^{}]|\{[^{}]*\})*\})*\})*\}/, - greedy: true, - inside: { -- 'content': { -- // this might be C, C++, Python, Java, C#, or any other language ANTLR4 compiles to -- pattern: /(\{)[\s\S]+(?=\})/, -- lookbehind: true -- }, -- 'punctuation': /[{}]/ -+ 'content': /(?!^)[\s\S]+(?=.)/, -+ 'punctuation': /./ - } - }, - 'command': { -diff --git a/components/prism-apex.js b/components/prism-apex.js -index dbb7f0dcd6d369f547376fa976efbec1e4bad363..91f7abce02266949983d91df2476ed5ea6ccf42c 100644 ---- a/components/prism-apex.js -+++ b/components/prism-apex.js -@@ -3,11 +3,10 @@ - var keywords = /\b(?:(?:after|before)(?=\s+[a-z])|abstract|activate|and|any|array|as|asc|autonomous|begin|bigdecimal|blob|boolean|break|bulk|by|byte|case|cast|catch|char|class|collect|commit|const|continue|currency|date|datetime|decimal|default|delete|desc|do|double|else|end|enum|exception|exit|export|extends|final|finally|float|for|from|get(?=\s*[{};])|global|goto|group|having|hint|if|implements|import|in|inner|insert|instanceof|int|integer|interface|into|join|like|limit|list|long|loop|map|merge|new|not|null|nulls|number|object|of|on|or|outer|override|package|parallel|pragma|private|protected|public|retrieve|return|rollback|select|set|short|sObject|sort|static|string|super|switch|synchronized|system|testmethod|then|this|throw|time|transaction|transient|trigger|try|undelete|update|upsert|using|virtual|void|webservice|when|where|while|(?:inherited|with|without)\s+sharing)\b/i; - - var className = /\b(?:(?=[a-z_]\w*\s*[<\[])|(?!))[A-Z_]\w*(?:\s*\.\s*[A-Z_]\w*)*\b(?:\s*(?:\[\s*\]|<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>))*/.source -- .replace(//g, function () { return keywords.source; }); -+ .replace(//g, keywords.source); - /** @param {string} pattern */ -- function insertClassName(pattern) { -- return RegExp(pattern.replace(//g, function () { return className; }), 'i'); -- } -+ var insertClassName = pattern => -+ RegExp(pattern.replace(//g, className), 'i'); - - var classNameInside = { - 'keyword': keywords, -@@ -22,7 +21,7 @@ - lookbehind: true, - greedy: true, - alias: 'language-sql', -- inside: Prism.languages.sql -+ inside: 'sql' - }, - - 'annotation': { -diff --git a/components/prism-applescript.js b/components/prism-applescript.js -index 3d688b4a8da2c05d927db68387f906f4753bdd13..14c44b00ba38be767c8c0c0ab80271f0f477a93a 100644 ---- a/components/prism-applescript.js -+++ b/components/prism-applescript.js -@@ -1,10 +1,6 @@ - Prism.languages.applescript = { -- 'comment': [ -- // Allow one level of nesting -- /\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/, -- /--.+/, -- /#.+/ -- ], -+ // Allow one level of nesting -+ 'comment': /#.+|--.+|\(\*(?:\(\*(?:[^*]|\*(?!\)))*\*\)|(?!\(\*)[\s\S])*?\*\)/, - 'string': /"(?:\\.|[^"\\\r\n])*"/, - 'number': /(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e-?\d+)?\b/i, - 'operator': [ -diff --git a/components/prism-arturo.js b/components/prism-arturo.js -index d09b5e27ef5ce7151fcaa69515289354534b719e..ef702423195d1863c5cd71bc6d26e9c32e4d4086 100644 ---- a/components/prism-arturo.js -+++ b/components/prism-arturo.js -@@ -3,21 +3,18 @@ - * @param {string} lang - * @param {string} pattern - */ -- var createLanguageString = function (lang, pattern) { -- return { -- pattern: RegExp(/\{!/.source + '(?:' + (pattern || lang) + ')' + /$[\s\S]*\}/.source, 'm'), -- greedy: true, -- inside: { -- 'embedded': { -- pattern: /(^\{!\w+\b)[\s\S]+(?=\}$)/, -- lookbehind: true, -- alias: 'language-' + lang, -- inside: Prism.languages[lang] -- }, -- 'string': /[\s\S]+/ -- } -- }; -- }; -+ var createLanguageString = (lang, pattern = lang) => ({ -+ pattern: RegExp(`\\{!(?:${pattern})$[\\s\\S]*\\}`, 'mg'), -+ greedy: true, -+ inside: { -+ 'string': /^.+|.$/, -+ 'embedded': { -+ pattern: /[\s\S]+/, -+ alias: 'language-' + lang, -+ inside: lang -+ }, -+ } -+ }); - - Prism.languages.arturo = { - 'comment': { -@@ -31,9 +28,7 @@ - greedy: true - }, - -- 'number': { -- pattern: /\b\d+(?:\.\d+(?:\.\d+(?:-[\w+-]+)?)?)?\b/, -- }, -+ 'number': /\b\d+(?:\.\d+(?:\.\d+(?:-[\w+-]+)?)?)?\b/, - - 'string': { - pattern: /"(?:[^"\\\r\n]|\\.)*"/, -@@ -92,13 +87,9 @@ - - 'punctuation': /[()[\],]/, - -- 'symbol': { -- pattern: /<:|-:|ø|@|#|\+|\||\*|\$|---|-|%|\/|\.\.|\^|~|=|<|>|\\/ -- }, -+ 'symbol': /<:|-:|ø|@|#|\+|\||\*|\$|---|-|%|\/|\.\.|\^|~|=|<|>|\\/, - -- 'boolean': { -- pattern: /\b(?:false|maybe|true)\b/ -- } -+ 'boolean': /\b(?:false|maybe|true)\b/ - }; - - Prism.languages.art = Prism.languages['arturo']; -diff --git a/components/prism-asciidoc.js b/components/prism-asciidoc.js -index b639a1756e712bf23037a255307b6af52316778e..5fbfbf524fdd453c41194e46e034f00a21030726 100644 ---- a/components/prism-asciidoc.js -+++ b/components/prism-asciidoc.js -@@ -200,11 +200,10 @@ - - // Allow some nesting. There is no recursion though, so cloning should not be needed. - -- function copyFromAsciiDoc(keys) { -+ var copyFromAsciiDoc = keys => { - keys = keys.split(' '); - -- var o = {}; -- for (var i = 0, l = keys.length; i < l; i++) { -+ for (var i = 0, o = {}, l = keys.length; i < l; i++) { - o[keys[i]] = asciidoc[keys[i]]; - } - return o; -@@ -222,13 +221,5 @@ - - asciidoc['title'].inside.rest = copyFromAsciiDoc('macro inline replacement entity'); - -- -- // Plugin to make entity title show the real entity, idea by Roman Komarov -- Prism.hooks.add('wrap', function (env) { -- if (env.type === 'entity') { -- env.attributes['title'] = env.content.replace(/&/, '&'); -- } -- }); -- -- Prism.languages.adoc = Prism.languages.asciidoc; -+ Prism.languages.adoc = asciidoc; - }(Prism)); -diff --git a/components/prism-aspnet.js b/components/prism-aspnet.js -index 1b1348c5d15b9b872f8fa051ff50bfd7b575d19a..5104718fd6ae5c3021a13a4a5df9b3d2d415094f 100644 ---- a/components/prism-aspnet.js -+++ b/components/prism-aspnet.js -@@ -1,14 +1,15 @@ --Prism.languages.aspnet = Prism.languages.extend('markup', { -+var pageDirectiveInside = { -+ 'page-directive': { -+ pattern: /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i, -+ alias: 'tag' -+ } -+} -+ -+var aspnet = Prism.languages.aspnet = Prism.languages.extend('markup', { - 'page-directive': { - pattern: /<%\s*@.*%>/, - alias: 'tag', -- inside: { -- 'page-directive': { -- pattern: /<%\s*@\s*(?:Assembly|Control|Implements|Import|Master(?:Type)?|OutputCache|Page|PreviousPageType|Reference|Register)?|%>/i, -- alias: 'tag' -- }, -- rest: Prism.languages.markup.tag.inside -- } -+ inside: pageDirectiveInside - }, - 'directive': { - pattern: /<%.*%>/, -@@ -18,17 +19,25 @@ Prism.languages.aspnet = Prism.languages.extend('markup', { - pattern: /<%\s*?[$=%#:]{0,2}|%>/, - alias: 'tag' - }, -- rest: Prism.languages.csharp -+ rest: 'csharp' - } - } - }); -+ -+var brackets = aspnet['markup-bracket']; -+var tag = aspnet.tag; -+delete aspnet['markup-bracket']; -+ -+aspnet['markup-bracket'] = brackets; -+pageDirectiveInside.rest = tag.inside; -+ - // Regexp copied from prism-markup, with a negative look-ahead added --Prism.languages.aspnet.tag.pattern = /<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/; -+tag.pattern = /<(?!%)\/?[^\s>\/]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|[^\s'">=]+))?)*\s*\/?>/; - - // match directives of attribute value foo="<% Bar %>" - Prism.languages.insertBefore('inside', 'punctuation', { -- 'directive': Prism.languages.aspnet['directive'] --}, Prism.languages.aspnet.tag.inside['attr-value']); -+ 'directive': aspnet['directive'] -+}, tag.inside['attr-value']); - - Prism.languages.insertBefore('aspnet', 'comment', { - 'asp-comment': { -@@ -38,11 +47,11 @@ Prism.languages.insertBefore('aspnet', 'comment', { - }); - - // script runat="server" contains csharp, not javascript --Prism.languages.insertBefore('aspnet', Prism.languages.javascript ? 'script' : 'tag', { -+Prism.languages.insertBefore('aspnet', aspnet.script ? 'script' : 'tag', { - 'asp-script': { - pattern: /(]*>)[\s\S]*?(?=<\/script>)/i, - lookbehind: true, - alias: ['asp', 'script'], -- inside: Prism.languages.csharp || {} -+ inside: 'csharp' - } - }); -diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js -index 2400eb93bd2ac6ef7b2634dc69667c19eb0cd425..7817ce6c25fe9c24bca665944ff69bce206a0119 100644 ---- a/components/prism-avisynth.js -+++ b/components/prism-avisynth.js -@@ -1,108 +1,22 @@ - // http://avisynth.nl/index.php/The_full_AviSynth_grammar - (function (Prism) { - -- function replace(pattern, replacements) { -- return pattern.replace(/<<(\d+)>>/g, function (m, index) { -- return replacements[+index]; -- }); -- } -- -- function re(pattern, replacements, flags) { -- return RegExp(replace(pattern, replacements), flags || ''); -- } -- -- var types = /bool|clip|float|int|string|val/.source; -- var internals = [ -- // bools -- /is(?:bool|clip|float|int|string)|defined|(?:(?:internal)?function|var)?exists?/.source, -- // control -- /apply|assert|default|eval|import|nop|select|undefined/.source, -- // global -- /opt_(?:allowfloataudio|avipadscanlines|dwchannelmask|enable_(?:b64a|planartopackedrgb|v210|y3_10_10|y3_10_16)|usewaveextensible|vdubplanarhack)|set(?:cachemode|maxcpu|memorymax|planarlegacyalignment|workingdir)/.source, -- // conv -- /hex(?:value)?|value/.source, -- // numeric -- /abs|ceil|continued(?:denominator|numerator)?|exp|floor|fmod|frac|log(?:10)?|max|min|muldiv|pi|pow|rand|round|sign|spline|sqrt/.source, -- // trig -- /a?sinh?|a?cosh?|a?tan[2h]?/.source, -- // bit -- /(?:bit(?:and|not|x?or|[lr]?shift[aslu]?|sh[lr]|sa[lr]|[lr]rotatel?|ro[rl]|te?st|set(?:count)?|cl(?:ea)?r|ch(?:an)?ge?))/.source, -- // runtime -- /average(?:[bgr]|chroma[uv]|luma)|(?:[rgb]|chroma[uv]|luma|rgb|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)?|[yuvrgb]plane(?:median|min|max|minmaxdifference)/.source, -- // script -- /getprocessinfo|logmsg|script(?:dir(?:utf8)?|file(?:utf8)?|name(?:utf8)?)|setlogparams/.source, -- // string -- /chr|(?:fill|find|left|mid|replace|rev|right)str|format|[lu]case|ord|str(?:cmpi?|fromutf8|len|toutf8)|time|trim(?:all|left|right)/.source, -- // version -- /isversionorgreater|version(?:number|string)/.source, -- // helper -- /buildpixeltype|colorspacenametopixeltype/.source, -- // avsplus -- /addautoloaddir|on(?:cpu|cuda)|prefetch|setfiltermtmode/.source -- ].join('|'); -- var properties = [ -- // content -- /has(?:audio|video)/.source, -- // resolution -- /height|width/.source, -- // framerate -- /frame(?:count|rate)|framerate(?:denominator|numerator)/.source, -- // interlacing -- /getparity|is(?:field|frame)based/.source, -- // color format -- /bitspercomponent|componentsize|hasalpha|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:va?|y2))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|numcomponents|pixeltype/.source, -- // audio -- /audio(?:bits|channels|duration|length(?:[fs]|hi|lo)?|rate)|isaudio(?:float|int)/.source -- ].join('|'); -- var filters = [ -- // source -- /avi(?:file)?source|directshowsource|image(?:reader|source|sourceanim)|opendmlsource|segmented(?:avisource|directshowsource)|wavsource/.source, -- // color -- /coloryuv|convertbacktoyuy2|convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:411|420|422|444)|YUY2)|fixluminance|gr[ae]yscale|invert|levels|limiter|mergea?rgb|merge(?:chroma|luma)|rgbadjust|show(?:alpha|blue|green|red)|swapuv|tweak|[uv]toy8?|ytouv/.source, -- // overlay -- /(?:colorkey|reset)mask|layer|mask(?:hs)?|merge|overlay|subtract/.source, -- // geometry -- /addborders|(?:bicubic|bilinear|blackman|gauss|lanczos4|lanczos|point|sinc|spline(?:16|36|64))resize|crop(?:bottom)?|flip(?:horizontal|vertical)|(?:horizontal|vertical)?reduceby2|letterbox|skewrows|turn(?:180|left|right)/.source, -- // pixel -- /blur|fixbrokenchromaupsampling|generalconvolution|(?:spatial|temporal)soften|sharpen/.source, -- // timeline -- /trim|(?:un)?alignedsplice|(?:assume|assumescaled|change|convert)FPS|(?:delete|duplicate)frame|dissolve|fade(?:in|io|out)[02]?|freezeframe|interleave|loop|reverse|select(?:even|odd|(?:range)?every)/.source, -- // interlace -- /assume[bt]ff|assume(?:field|frame)based|bob|complementparity|doubleweave|peculiarblend|pulldown|separate(?:columns|fields|rows)|swapfields|weave(?:columns|rows)?/.source, -- // audio -- /amplify(?:db)?|assumesamplerate|audiodub(?:ex)?|audiotrim|convertaudioto(?:(?:8|16|24|32)bit|float)|converttomono|delayaudio|ensurevbrmp3sync|get(?:left|right)?channel|kill(?:audio|video)|mergechannels|mixaudio|monotostereo|normalize|resampleaudio|ssrc|supereq|timestretch/.source, -- // conditional -- /animate|applyrange|conditional(?:filter|reader|select)|frameevaluate|scriptclip|tcp(?:server|source)|writefile(?:end|if|start)?/.source, -- // export -- /imagewriter/.source, -- // debug -- /blackness|blankclip|colorbars(?:hd)?|compare|dumpfiltergraph|echo|histogram|info|messageclip|preroll|setgraphanalysis|show(?:framenumber|smpte|time)|showfiveversions|stack(?:horizontal|vertical)|subtitle|tone|version/.source -- ].join('|'); -- var allinternals = [internals, properties, filters].join('|'); -+ var replace = (pattern, replacements) => -+ pattern.replace(/<<(\d+)>>/g, (m, index) => -+ replacements[+index] -+ ); - -- Prism.languages.avisynth = { -- 'comment': [ -- { -- // Matches [* *] nestable block comments, but only supports 1 level of nested comments -- // /\[\*(?:[^\[*]|\[(?!\*)|\*(?!\])|)*\*\]/ -- pattern: /(^|[^\\])\[\*(?:[^\[*]|\[(?!\*)|\*(?!\])|\[\*(?:[^\[*]|\[(?!\*)|\*(?!\]))*\*\])*\*\]/, -- lookbehind: true, -- greedy: true -- }, -- { -- // Matches /* */ block comments -- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, -- lookbehind: true, -- greedy: true -- }, -- { -- // Matches # comments -- pattern: /(^|[^\\$])#.*/, -- lookbehind: true, -- greedy: true -- } -- ], -+ var re = (pattern, replacements, flags = '') => -+ RegExp(replace(pattern, replacements), flags); -+ -+ var types = 'bool|clip|float|int|string|val'; -+ var allinternals = 'is(?:bool|clip|float|int|string)|defined|(?:(?:internal)?function|var)?exists?|apply|assert|default|eval|import|nop|select|undefined|opt_(?:allowfloataudio|avipadscanlines|dwchannelmask|enable_(?:b64a|planartopackedrgb|v210|y3_10_10|y3_10_16)|usewaveextensible|vdubplanarhack)|set(?:cachemode|maxcpu|memorymax|planarlegacyalignment|workingdir)|hex(?:value)?|value|abs|ceil|continued(?:denominator|numerator)?|exp|floor|fmod|frac|log(?:10)?|max|min|muldiv|pi|pow|rand|round|sign|spline|sqrt|a?sinh?|a?cosh?|a?tan[2h]?|(?:bit(?:and|not|x?or|[lr]?shift[aslu]?|sh[lr]|sa[lr]|[lr]rotatel?|ro[rl]|te?st|set(?:count)?|cl(?:ea)?r|ch(?:an)?ge?))|average(?:[bgr]|chroma[uv]|luma)|(?:[rgb]|chroma[uv]|luma|rgb|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)?|[yuvrgb]plane(?:median|min|max|minmaxdifference)|getprocessinfo|logmsg|script(?:dir(?:utf8)?|file(?:utf8)?|name(?:utf8)?)|setlogparams|chr|(?:fill|find|left|mid|replace|rev|right)str|format|[lu]case|ord|str(?:cmpi?|fromutf8|len|toutf8)|time|trim(?:all|left|right)|isversionorgreater|version(?:number|string)|buildpixeltype|colorspacenametopixeltype|addautoloaddir|on(?:cpu|cuda)|prefetch|setfiltermtmode|has(?:audio|video)|height|width|frame(?:count|rate(?:denominator|numerator)?)|getparity|is(?:field|frame)based|bitspercomponent|componentsize|hasalpha|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:va?|y2))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|numcomponents|pixeltype|audio(?:bits|channels|duration|length(?:[fs]|hi|lo)?|rate)|isaudio(?:float|int)|avi(?:file)?source|directshowsource|image(?:reader|source|sourceanim)|opendmlsource|segmented(?:avisource|directshowsource)|wavsource|coloryuv|convertbacktoyuy2|convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:411|420|422|444)|YUY2)|fixluminance|gr[ae]yscale|invert|levels|limiter|mergea?rgb|merge(?:chroma|luma)|rgbadjust|show(?:alpha|blue|green|red)|swapuv|tweak|[uv]toy8?|ytouv|(?:colorkey|reset)mask|layer|mask(?:hs)?|merge|overlay|subtract|addborders|(?:bicubic|bilinear|blackman|gauss|lanczos4|lanczos|point|sinc|spline(?:16|36|64))resize|crop(?:bottom)?|flip(?:horizontal|vertical)|(?:horizontal|vertical)?reduceby2|letterbox|skewrows|turn(?:180|left|right)|blur|fixbrokenchromaupsampling|generalconvolution|(?:spatial|temporal)soften|sharpen|trim|(?:un)?alignedsplice|(?:assume|assumescaled|change|convert)FPS|(?:delete|duplicate)frame|dissolve|fade(?:in|io|out)[02]?|freezeframe|interleave|loop|reverse|select(?:even|odd|(?:range)?every)|assume[bt]ff|assume(?:field|frame)based|bob|complementparity|doubleweave|peculiarblend|pulldown|separate(?:columns|fields|rows)|swapfields|weave(?:columns|rows)?|amplify(?:db)?|assumesamplerate|audiodub(?:ex)?|audiotrim|convertaudioto(?:(?:8|16|24|32)bit|float)|converttomono|delayaudio|ensurevbrmp3sync|get(?:left|right)?channel|kill(?:audio|video)|mergechannels|mixaudio|monotostereo|normalize|resampleaudio|ssrc|supereq|timestretch|animate|applyrange|conditional(?:filter|reader|select)|frameevaluate|scriptclip|tcp(?:server|source)|writefile(?:end|if|start)?|imagewriter|blackness|blankclip|colorbars(?:hd)?|compare|dumpfiltergraph|echo|histogram|info|messageclip|preroll|setgraphanalysis|show(?:framenumber|smpte|time)|showfiveversions|stack(?:horizontal|vertical)|subtitle|tone|version'; - -+ Prism.languages.avisynth = { -+ 'comment': { -+ pattern: /#.*|\/\*[\s\S]*?(?:\*\/|$)|\[\*(?:[^\[*]|\[(?!\*)|\*(?!\])|\[\*(?:[^\[*]|\[(?!\*)|\*(?!\]))*\*\])*\*\]/, -+ greedy: true -+ }, - // Handle before strings because optional arguments are surrounded by double quotes - 'argument': { - pattern: re(/\b(?:<<0>>)\s+("?)\w+\1/.source, [types], 'i'), -diff --git a/components/prism-bash.js b/components/prism-bash.js -index 6d2e3815c2b589d8dc0bbb94e14a840e227e5a31..30213f9a8e93169db39b703c5d2c7a4496459ff2 100644 ---- a/components/prism-bash.js -+++ b/components/prism-bash.js -@@ -9,7 +9,6 @@ - pattern: /(^(["']?)\w+\2)[ \t]+\S.*/, - lookbehind: true, - alias: 'punctuation', // this looks reasonably well in all themes -- inside: null // see below - }; - - var insideString = { -@@ -67,7 +66,7 @@ - 'entity': /\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/ - }; - -- Prism.languages.bash = { -+ var bash = commandAfterHeredoc.inside = Prism.languages.sh = Prism.languages.shell = Prism.languages.bash = { - 'shebang': { - pattern: /^#!\s*\/.*/, - alias: 'important' -@@ -205,10 +204,9 @@ - } - }; - -- commandAfterHeredoc.inside = Prism.languages.bash; -- - /* Patterns in command substitution. */ -- var toBeCopied = [ -+ var inside = insideString.variable[1].inside; -+ [ - 'comment', - 'function-name', - 'for-or-select', -@@ -224,12 +222,6 @@ - 'operator', - 'punctuation', - 'number' -- ]; -- var inside = insideString.variable[1].inside; -- for (var i = 0; i < toBeCopied.length; i++) { -- inside[toBeCopied[i]] = Prism.languages.bash[toBeCopied[i]]; -- } -+ ].forEach(copied => inside[copied] = bash[copied]) - -- Prism.languages.sh = Prism.languages.bash; -- Prism.languages.shell = Prism.languages.bash; - }(Prism)); -diff --git a/components/prism-bicep.js b/components/prism-bicep.js -index 7220f2916a1f8170662eec162c36fc34c6354058..0b428ae7129f11744dbeb4d7473763636ab04efd 100644 ---- a/components/prism-bicep.js -+++ b/components/prism-bicep.js -@@ -1,20 +1,9 @@ - // based loosely upon: https://github.com/Azure/bicep/blob/main/src/textmate/bicep.tmlanguage - Prism.languages.bicep = { -- 'comment': [ -- { -- // multiline comments eg /* ASDF */ -- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, -- lookbehind: true, -- greedy: true -- }, -- { -- // singleline comments eg // ASDF -- pattern: /(^|[^\\:])\/\/.*/, -- lookbehind: true, -- greedy: true -- } -- ], -- -+ 'comment': { -+ pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/, -+ greedy: true -+ }, - 'property': [ - { - pattern: /([\r\n][ \t]*)[a-z_]\w*(?=[ \t]*:)/i, -@@ -45,11 +34,11 @@ Prism.languages.bicep = { - 'interpolation': { - pattern: /\$\{[^{}\r\n]*\}/, - inside: { -+ 'punctuation': /^\$\{|\}$/, - 'expression': { -- pattern: /(^\$\{)[\s\S]+(?=\}$)/, -- lookbehind: true -+ pattern: /[\s\S]+/, -+ inside: 'bicep' - }, -- 'punctuation': /^\$\{|\}$/, - } - }, - 'string': /[\s\S]+/ -@@ -73,5 +62,3 @@ Prism.languages.bicep = { - 'operator': /--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/, - 'punctuation': /[{}[\];(),.:]/, - }; -- --Prism.languages.bicep['interpolated-string'].inside['interpolation'].inside['expression'].inside = Prism.languages.bicep; -diff --git a/components/prism-bnf.js b/components/prism-bnf.js -index dfbe3973a81f0fe56c4c60f3e615db48bf535294..795b6e16c511e824f98fbb461e2bb7561db33408 100644 ---- a/components/prism-bnf.js -+++ b/components/prism-bnf.js -@@ -1,7 +1,5 @@ - Prism.languages.bnf = { -- 'string': { -- pattern: /"[^\r\n"]*"|'[^\r\n']*'/ -- }, -+ 'string': /"[^\r\n"]*"|'[^\r\n']*'/, - 'definition': { - pattern: /<[^<>\r\n\t]+>(?=\s*::=)/, - alias: ['rule', 'keyword'], -diff --git a/components/prism-brightscript.js b/components/prism-brightscript.js -index a75e55bf08c99fbde37894d4b60edbf3cc3ac6d8..1d4b30eb4bb815767eb3ee770d2997f0073f5b63 100644 ---- a/components/prism-brightscript.js -+++ b/components/prism-brightscript.js -@@ -1,4 +1,8 @@ --Prism.languages.brightscript = { -+var expression = { -+ pattern: /[\s\S]+/ -+} -+ -+expression.inside = Prism.languages.brightscript = { - 'comment': /(?:\brem|').*/i, - 'directive-statement': { - pattern: /(^[\t ]*)#(?:const|else(?:[\t ]+if)?|end[\t ]+if|error|if).*/im, -@@ -13,10 +17,7 @@ Prism.languages.brightscript = { - pattern: /^#(?:const|else(?:[\t ]+if)?|end[\t ]+if|error|if)/, - alias: 'keyword' - }, -- 'expression': { -- pattern: /[\s\S]+/, -- inside: null // see below -- } -+ 'expression': expression - } - }, - 'property': { -@@ -40,5 +41,3 @@ Prism.languages.brightscript = { - 'punctuation': /[.,;()[\]{}]/, - 'constant': /\b(?:LINE_NUM)\b/i - }; -- --Prism.languages.brightscript['directive-statement'].inside.expression.inside = Prism.languages.brightscript; -diff --git a/components/prism-c.js b/components/prism-c.js -index 58ed906eca54798798bb08331cd6481847b8d2fe..72ff1febdfec848879bd214ffbea32ce027626bf 100644 ---- a/components/prism-c.js -+++ b/components/prism-c.js -@@ -1,6 +1,6 @@ --Prism.languages.c = Prism.languages.extend('clike', { -+var c = Prism.languages.c = Prism.languages.extend('clike', { - 'comment': { -- pattern: /\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/, -+ pattern: /\/\/(?:[^\r\n\\]|\\\r?\n?)*|\/\*[\s\S]*?(?:\*\/|$)/, - greedy: true - }, - 'string': { -@@ -41,10 +41,10 @@ Prism.languages.insertBefore('c', 'string', { - pattern: /^(#\s*include\s*)<[^>]+>/, - lookbehind: true - }, -- Prism.languages.c['string'] -+ c['string'] - ], -- 'char': Prism.languages.c['char'], -- 'comment': Prism.languages.c['comment'], -+ 'char': c['char'], -+ 'comment': c['comment'], - 'macro-name': [ - { - pattern: /(^#\s*define\s+)\w+\b(?!\()/i, -@@ -66,7 +66,7 @@ Prism.languages.insertBefore('c', 'string', { - 'punctuation': /##|\\(?=[\r\n])/, - 'expression': { - pattern: /\S[\s\S]*/, -- inside: Prism.languages.c -+ inside: c - } - } - } -@@ -77,4 +77,4 @@ Prism.languages.insertBefore('c', 'function', { - 'constant': /\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/ - }); - --delete Prism.languages.c['boolean']; -+delete c['boolean']; -diff --git a/components/prism-cfscript.js b/components/prism-cfscript.js -index 7f0cd974371b29444b5b59d3211fe677a8713550..3f23374ffe4bb49666c37ea9a46cf3ddd1889030 100644 ---- a/components/prism-cfscript.js -+++ b/components/prism-cfscript.js -@@ -1,9 +1,8 @@ - // https://cfdocs.org/script --Prism.languages.cfscript = Prism.languages.extend('clike', { -+Prism.languages.cfc = Prism.languages.cfscript = Prism.languages.extend('clike', { - 'comment': [ - { -- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, -- lookbehind: true, -+ pattern: /\/\*[\s\S]*?(?:\*\/|$)/, - inside: { - 'annotation': { - pattern: /(?:^|[^.])@[\w\.]+/, -@@ -12,8 +11,7 @@ Prism.languages.cfscript = Prism.languages.extend('clike', { - } - }, - { -- pattern: /(^|[^\\:])\/\/.*/, -- lookbehind: true, -+ pattern: /\/\/.*/, - greedy: true - } - ], -@@ -35,10 +33,9 @@ Prism.languages.cfscript = Prism.languages.extend('clike', { - Prism.languages.insertBefore('cfscript', 'keyword', { - // This must be declared before keyword because we use "function" inside the lookahead - 'function-variable': { -- pattern: /[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/, -+ pattern: /(?!\d)(?:(?!\s)[$\w\xA0-\uFFFF])+(?=\s*[=:]\s*(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\d)(?:(?!\s)[$\w\xA0-\uFFFF])+)\s*=>))/, - alias: 'function' - } - }); - --delete Prism.languages.cfscript['class-name']; --Prism.languages.cfc = Prism.languages['cfscript']; -+delete Prism.languages.cfc['class-name']; -diff --git a/components/prism-chaiscript.js b/components/prism-chaiscript.js -index abfd1b15fae0accb9fdc63044d0de3c394b822dd..5cf117e90598213decb9b1c8d4bd86b9a57273ff 100644 ---- a/components/prism-chaiscript.js -+++ b/components/prism-chaiscript.js -@@ -44,12 +44,12 @@ Prism.languages.insertBefore('chaiscript', 'string', { - lookbehind: true, - inside: { - 'interpolation-expression': { -- pattern: /(^\$\{)[\s\S]+(?=\}$)/, -+ pattern: /(..)[\s\S]+(?=.)/, - lookbehind: true, - inside: Prism.languages.chaiscript - }, - 'interpolation-punctuation': { -- pattern: /^\$\{|\}$/, -+ pattern: /.+/, - alias: 'punctuation' - } - } -diff --git a/components/prism-clike.js b/components/prism-clike.js -index 8c5d96a194166bb146a8c820631022e5f8d12d7e..a25fc75613d8c6f3e448f16d10c610200f113599 100644 ---- a/components/prism-clike.js -+++ b/components/prism-clike.js -@@ -1,16 +1,8 @@ - Prism.languages.clike = { -- 'comment': [ -- { -- pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, -- lookbehind: true, -- greedy: true -- }, -- { -- pattern: /(^|[^\\:])\/\/.*/, -- lookbehind: true, -- greedy: true -- } -- ], -+ 'comment': { -+ pattern: /\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/, -+ greedy: true -+ }, - 'string': { - pattern: /(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/, - greedy: true -diff --git a/components/prism-coffeescript.js b/components/prism-coffeescript.js -index 72fe0b8ba6e019b4e9854fbbe7a74c354ee6b09f..913b1d9ee22028aecd981db528f214f70a1e095e 100644 ---- a/components/prism-coffeescript.js -+++ b/components/prism-coffeescript.js -@@ -7,7 +7,7 @@ - alias: 'variable' - }; - -- Prism.languages.coffeescript = Prism.languages.extend('javascript', { -+ var coffee = Prism.languages.coffee = Prism.languages.coffeescript = Prism.languages.extend('js', { - 'comment': comment, - 'string': [ - -@@ -61,7 +61,7 @@ - 'script': { - pattern: /[\s\S]+/, - alias: 'language-javascript', -- inside: Prism.languages.javascript -+ inside: 'js' - } - } - }, -@@ -90,7 +90,6 @@ - 'property': /(?!\d)\w+(?=\s*:(?!:))/ - }); - -- delete Prism.languages.coffeescript['template-string']; -+ delete coffee['template-string']; - -- Prism.languages.coffee = Prism.languages.coffeescript; - }(Prism)); -diff --git a/components/prism-concurnas.js b/components/prism-concurnas.js -index 476d0b49adf7bb250d3418bd3f86ea8f686653d3..9629dfeae4ec76ba2ba45b5551d85541932a62c0 100644 ---- a/components/prism-concurnas.js -+++ b/components/prism-concurnas.js -@@ -1,16 +1,39 @@ --Prism.languages.concurnas = { -+Prism.languages.conc = Prism.languages.concurnas = { - 'comment': { -- pattern: /(^|[^\\])(?:\/\*[\s\S]*?(?:\*\/|$)|\/\/.*)/, -- lookbehind: true, -+ pattern: /(?:\/\*[\s\S]*?(?:\*\/|$)|\/\/.*)/, - greedy: true - }, -+ 'regex-literal': { -+ pattern: /\br("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, -+ greedy: true, -+ inside: { -+ 'interpolation': { -+ pattern: /((?:^|[^\\])(?:\\{2})*)\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/, -+ lookbehind: true, -+ inside: 'conc' -+ }, -+ 'regex': /[\s\S]+/ -+ } -+ }, -+ 'string-literal': { -+ pattern: /(?:\B|\bs)("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, -+ greedy: true, -+ inside: { -+ 'interpolation': { -+ pattern: /((?:^|[^\\])(?:\\{2})*)\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/, -+ lookbehind: true, -+ inside: 'conc' -+ }, -+ 'string': /[\s\S]+/ -+ } -+ }, - 'langext': { - pattern: /\b\w+\s*\|\|[\s\S]+?\|\|/, - greedy: true, - inside: { - 'class-name': /^\w+/, - 'string': { -- pattern: /(^\s*\|\|)[\s\S]+(?=\|\|$)/, -+ pattern: /(^\s*..)[\s\S]+(?=..)/, - lookbehind: true - }, - 'punctuation': /\|\|/ -@@ -30,32 +53,3 @@ Prism.languages.concurnas = { - alias: 'builtin' - } - }; -- --Prism.languages.insertBefore('concurnas', 'langext', { -- 'regex-literal': { -- pattern: /\br("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, -- greedy: true, -- inside: { -- 'interpolation': { -- pattern: /((?:^|[^\\])(?:\\{2})*)\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/, -- lookbehind: true, -- inside: Prism.languages.concurnas -- }, -- 'regex': /[\s\S]+/ -- } -- }, -- 'string-literal': { -- pattern: /(?:\B|\bs)("|')(?:\\.|(?!\1)[^\\\r\n])*\1/, -- greedy: true, -- inside: { -- 'interpolation': { -- pattern: /((?:^|[^\\])(?:\\{2})*)\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/, -- lookbehind: true, -- inside: Prism.languages.concurnas -- }, -- 'string': /[\s\S]+/ -- } -- } --}); -- --Prism.languages.conc = Prism.languages.concurnas; -diff --git a/components/prism-cooklang.js b/components/prism-cooklang.js -index cb49ed1260c48f7ecedb5b9148ba40e8901eef3d..c92992555b7efdccb38ab88f99a21432d8d11ee5 100644 ---- a/components/prism-cooklang.js -+++ b/components/prism-cooklang.js -@@ -58,18 +58,10 @@ - } - }, - 'cookware-group': { // #...{...}, #... -- pattern: new RegExp('#(?:' -- + multi_token -- + '|' -- + single_token_suffix -- + ')' -- ), -+ pattern: RegExp(`#(?:${multi_token}|${single_token_suffix})`), - inside: { - 'cookware': { -- pattern: new RegExp('(^#)(?:' -- + multi_token_infix -- + ')' -- ), -+ pattern: RegExp(`(^#)(?:${multi_token_infix})`), - lookbehind: true, - alias: 'variable', - }, -@@ -78,29 +70,22 @@ - alias: 'keyword', - }, - 'quantity-group': { -- pattern: new RegExp(/\{[^{}@#]*\}/), -+ pattern: /\{[^{}@#]*\}/, - inside: { -+ 'punctuation': /[{}]/, - 'quantity': { -- pattern: new RegExp(/(^\{)/.source + multi_token_infix), -- lookbehind: true, -+ pattern: /[\s\S]+/, - alias: 'number', - }, -- 'punctuation': /[{}]/, - } - } - }, - }, - 'ingredient-group': { // @...{...}, @... -- pattern: new RegExp('@(?:' -- + multi_token -- + '|' -- + single_token_suffix -- + ')'), -+ pattern: RegExp(`@(?:${multi_token}|${single_token_suffix})`), - inside: { - 'ingredient': { -- pattern: new RegExp('(^@)(?:' -- + multi_token_infix -- + ')'), -+ pattern: RegExp(`(^@)(?:${multi_token_infix})`), - lookbehind: true, - alias: 'variable', - }, -@@ -125,7 +110,7 @@ - inside: { - 'punctuation': /[{}]/, - 'unit': { -- pattern: new RegExp(/(%\s*)/.source + timer_units + /\b/.source), -+ pattern: RegExp('(%\\s*)' + timer_units + '\\b'), - lookbehind: true, - alias: 'symbol', - }, -diff --git a/components/prism-coq.js b/components/prism-coq.js -index 663ed9a5fa5f11880612c1d588bdc2aa46c2d875..1b58b674cb250bc560b57aec543bc9522c72fd2b 100644 ---- a/components/prism-coq.js -+++ b/components/prism-coq.js -@@ -4,7 +4,7 @@ - - var commentSource = /\(\*(?:[^(*]|\((?!\*)|\*(?!\))|)*\*\)/.source; - for (var i = 0; i < 2; i++) { -- commentSource = commentSource.replace(//g, function () { return commentSource; }); -+ commentSource = commentSource.replace(//g, commentSource); - } - commentSource = commentSource.replace(//g, '[]'); - -@@ -18,7 +18,7 @@ - { - pattern: RegExp( - /#\[(?:[^\[\]("]|"(?:[^"]|"")*"(?!")|\((?!\*)|)*\]/.source -- .replace(//g, function () { return commentSource; }) -+ .replace(//g, commentSource) - ), - greedy: true, - alias: 'attr-name', -diff --git a/components/prism-core.js b/components/prism-core.js -index 1259f23e07c9c4e62f32a7705e9fbb7d52c8c060..cc257784b4548d84ed73caef498e1500ff68c577 100644 ---- a/components/prism-core.js -+++ b/components/prism-core.js -@@ -1,13 +1,3 @@ --/// -- --var _self = (typeof window !== 'undefined') -- ? window // if in browser -- : ( -- (typeof WorkerGlobalScope !== 'undefined' && self instanceof WorkerGlobalScope) -- ? self // if in worker -- : {} // if in node js -- ); -- - /** - * Prism: Lightweight, robust, elegant syntax highlighting - * -@@ -16,62 +6,42 @@ var _self = (typeof window !== 'undefined') - * @namespace - * @public - */ --var Prism = (function (_self) { -- -- // Private helper vars -- var lang = /(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i; -- var uniqueId = 0; -+export default (() => { - - // The grammar object for plaintext - var plainTextGrammar = {}; - -+ var hooks = {}; - -- var _ = { -- /** -- * By default, Prism will attempt to highlight all code elements (by calling {@link Prism.highlightAll}) on the -- * current page after the page finished loading. This might be a problem if e.g. you wanted to asynchronously load -- * additional languages or plugins yourself. -- * -- * By setting this value to `true`, Prism will not automatically highlight all code elements on the page. -- * -- * You obviously have to change this value before the automatic highlighting started. To do this, you can add an -- * empty Prism object into the global scope before loading the Prism script like this: -- * -- * ```js -- * window.Prism = window.Prism || {}; -- * Prism.manual = true; -- * // add a new + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["script"]], + ["punctuation", ">"] + ]], + ["script", [ + ["language-javascript", [ + ["django", [ + ["delimiter", "{%"], + ["tag", "if"], + ["variable", "foo"], + ["delimiter", "%}"] + ]], + + ["keyword", "var"], + " foo ", + ["operator", "="], + ["django", [ + ["delimiter", "{{"], + ["variable", "bar"], + ["delimiter", "}}"] + ]], + ["punctuation", ";"], + + ["django", [ + ["delimiter", "{%"], + ["tag", "endif"], + ["delimiter", "%}"] + ]] + ]] + ]], + ["tag", [ + ["punctuation", ""] + ]] +] + +---------------------------------------------------- + +Checks for Django/Jinja2 code inside + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["script"]], + ["punctuation", ">"] + ]], + ["script", [ + ["language-javascript", [ + ["keyword", "let"], + " str ", + ["operator", "="], + ["template-string", [ + ["template-punctuation", "`"], + ["string", "\n\t\t\n\t"], + ["template-punctuation", "`"] + ]], + ["punctuation", ";"] + ]] + ]], + ["tag", [ + ["punctuation", ""] + ]] +] + +---------------------------------------------------- + +Checks for Javascript usage inside Markup, using + + + +'; +]]> +"foo" + + + + + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["script"]], + ["attr-name", ["type"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "text/javascript", + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + ["script", [ + ["language-javascript", [ + ["function", ["foo"]], + ["punctuation", "("], + ["punctuation", ")"] + ]] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["script"]], + ["punctuation", ">"] + ]], + ["script", [ + ["language-javascript", [ + ["string", "\"foo bar\""] + ]] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["script"]], + ["attr-name", ["type"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "application/javascript", + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + ["script", [ + ["language-javascript", [ + ["keyword", "var"], + " a ", + ["operator", "="], + ["number", "0"], + ["punctuation", ";"] + ]], + ["included-cdata", [ + ["cdata", "'"], + ["punctuation", ";"] + ]], + ["cdata", "]]>"] + ]], + ["language-javascript", [ + ["string", "\"foo\""] + ]] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["foo"]], + ["attr-name", ["onclick"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["language-javascript", [ + ["keyword", "this"], + ["punctuation", "."], + ["property-access", ["textContent"]], + ["operator", "="], + ["string", "'Clicked!'"] + ]], + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["foo"]], + ["attr-name", ["mouseover"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "this.textContent='Over!'", + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]] +] + +---------------------------------------------------- + +Checks for Javascript usage inside Markup, using + + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["script"]], + ["attr-name", ["runat"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "server", + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + ["asp-script", [ + ["preprocessor", [ + "#", + ["directive", "pragma"] + ]] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["script"]], + ["punctuation", ">"] + ]], + ["script", [ + ["language-javascript", [ + ["regex", [ + ["regex-delimiter", "/"], + ["regex-source", "foo"], + ["regex-delimiter", "/"] + ]] + ]] + ]], + ["tag", [ + ["punctuation", ""] + ]] +] + +---------------------------------------------------- + +Checks for scripts containing C# code. +Also checks that those don't break normal JS scripts. +Note: Markup is loaded before Javascript so that scripts are added into grammar. diff --git a/package/src/prism/tests/languages/markup+php/issue1582.test b/package/src/prism/tests/languages/markup+php/issue1582.test new file mode 100644 index 00000000..a3eb213a --- /dev/null +++ b/package/src/prism/tests/languages/markup+php/issue1582.test @@ -0,0 +1,23 @@ +'; + echo PHP_EOL; + +---------------------------------------------------- + +[ + ["php", [ + ["delimiter", "'"], + ["punctuation", ";"], + ["keyword", "echo"], + ["constant", "PHP_EOL"], + ["punctuation", ";"] + ]] +] + +---------------------------------------------------- + +Checks for PHP closing tags '?>' inside of strings. +See #1582 for details. diff --git a/package/src/prism/tests/languages/markup+php/php_in_markup_feature.test b/package/src/prism/tests/languages/markup+php/php_in_markup_feature.test new file mode 100644 index 00000000..75644ae9 --- /dev/null +++ b/package/src/prism/tests/languages/markup+php/php_in_markup_feature.test @@ -0,0 +1,118 @@ +
+
+
+
+
+___PHP1______PHP2___ + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["php", [ + ["delimiter", ""] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["php", [ + ["delimiter", ""] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["php", [ + ["delimiter", ""] + ]], + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["php", [ + ["delimiter", ""] + ]], + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["php", [ + ["delimiter", ""] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + "\n___PHP1___", + ["php", [ + ["delimiter", ""] + ]], + "___PHP2___ ", + ["php", [ + ["delimiter", ""] + ]] +] + +---------------------------------------------------- + +Checks for PHP inside Markup. diff --git a/package/src/prism/tests/languages/markup+php/php_with_closing_tag_in_markup_feature.test b/package/src/prism/tests/languages/markup+php/php_with_closing_tag_in_markup_feature.test new file mode 100644 index 00000000..203db905 --- /dev/null +++ b/package/src/prism/tests/languages/markup+php/php_with_closing_tag_in_markup_feature.test @@ -0,0 +1,44 @@ +' + "?>"; /* ?> */ + echo PHP_EOL; + // */ + // ?> + + + +---------------------------------------------------- + +[ + ["php", [ + ["delimiter", "'"], + ["operator", "+"], + ["string", ["\"?>\""]], + ["punctuation", ";"], + ["comment", "/* ?> */"], + ["keyword", "echo"], + ["constant", "PHP_EOL"], + ["punctuation", ";"], + ["comment", "// */"], + ["comment", "// "], + ["delimiter", "?>"] + ]], + + ["php", [ + ["delimiter", ""] + ]] +] + +---------------------------------------------------- + +Checks for PHP closing tags '?>' inside of strings and comments. diff --git a/package/src/prism/tests/languages/markup+pug/markup_feature.test b/package/src/prism/tests/languages/markup+pug/markup_feature.test new file mode 100644 index 00000000..c6d4497c --- /dev/null +++ b/package/src/prism/tests/languages/markup+pug/markup_feature.test @@ -0,0 +1,25 @@ +
+ + +---------------------------------------------------- + +[ + ["markup", [ + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]] + ]], + ["markup", [ + ["tag", [ + ["punctuation", "<"], + ["tag", ["span"]], + ["punctuation", ">"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for Markup inside Jade. diff --git a/package/src/prism/tests/languages/markup+tt2/tt2_in_markup_feature.test b/package/src/prism/tests/languages/markup+tt2/tt2_in_markup_feature.test new file mode 100644 index 00000000..d8e469ec --- /dev/null +++ b/package/src/prism/tests/languages/markup+tt2/tt2_in_markup_feature.test @@ -0,0 +1,76 @@ +
[% foo.bar.baz %]
+
[%- foo.bar.baz %]
+
[% foo.bar.baz -%]
+
[%- foo.bar.baz -%]
+ +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["tt2", [ + ["delimiter", "[%"], + ["variable", "foo.bar.baz"], + ["delimiter", "%]"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["tt2", [ + ["delimiter", "[%-"], + ["variable", "foo.bar.baz"], + ["delimiter", "%]"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["tt2", [ + ["delimiter", "[%"], + ["variable", "foo.bar.baz"], + ["delimiter", "-%]"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["tt2", [ + ["delimiter", "[%-"], + ["variable", "foo.bar.baz"], + ["delimiter", "-%]"] + ]], + ["tag", [ + ["punctuation", ""] + ]] +] + +---------------------------------------------------- + +Checks for Template Toolkit 2 inside Markup. diff --git a/package/src/prism/tests/languages/markup/cdata_feature.test b/package/src/prism/tests/languages/markup/cdata_feature.test new file mode 100644 index 00000000..76272cf6 --- /dev/null +++ b/package/src/prism/tests/languages/markup/cdata_feature.test @@ -0,0 +1,15 @@ + + + +---------------------------------------------------- + +[ + ["cdata", ""], + ["cdata", ""] +] + +---------------------------------------------------- + +Checks for CDATA sections, single-line and multi-line. \ No newline at end of file diff --git a/package/src/prism/tests/languages/markup/comment_feature.test b/package/src/prism/tests/languages/markup/comment_feature.test new file mode 100644 index 00000000..041cd570 --- /dev/null +++ b/package/src/prism/tests/languages/markup/comment_feature.test @@ -0,0 +1,16 @@ + + + + +---------------------------------------------------- + +[ + ["comment", ""], + ["comment", ""], + ["comment", ""] +] + +---------------------------------------------------- + +Checks for empty comment, single-line comment and multi-line comment. \ No newline at end of file diff --git a/package/src/prism/tests/languages/markup/doctype_feature.test b/package/src/prism/tests/languages/markup/doctype_feature.test new file mode 100644 index 00000000..e0a63b57 --- /dev/null +++ b/package/src/prism/tests/languages/markup/doctype_feature.test @@ -0,0 +1,101 @@ + + + + + +]> + + + +]> + +---------------------------------------------------- + +[ + ["doctype", [ + ["punctuation", ""] + ]], + + ["doctype", [ + ["punctuation", ""] + ]], + + ["doctype", [ + ["punctuation", ""] + ]], + + ["doctype", [ + ["punctuation", ""] + ]], + + ["doctype", [ + ["punctuation", ""] + ]] + ]], + ["punctuation", "]"], + ["punctuation", ">"] + ]], + + ["doctype", [ + ["punctuation", ""] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["!ELEMENT"]], + ["attr-name", ["subject"]], + ["attr-name", ["(#PCDATA)"]], + ["punctuation", ">"] + ]], + ["comment", ""] + ]], + ["punctuation", "]"], + ["punctuation", ">"] + ]] +] + +---------------------------------------------------- + +Checks for different doctypes, single-line and multi-line. diff --git a/package/src/prism/tests/languages/markup/entity_feature.html.test b/package/src/prism/tests/languages/markup/entity_feature.html.test new file mode 100644 index 00000000..e4240e8e --- /dev/null +++ b/package/src/prism/tests/languages/markup/entity_feature.html.test @@ -0,0 +1,17 @@ +& +ϑ +A +A +⛵ + +---------------------------------------------------- + +&amp; +&thetasym; +&#65; +&#x41; +&#x26f5; + +---------------------------------------------------- + +Checks for HTML/XML character entity references. diff --git a/package/src/prism/tests/languages/markup/issue3441.test b/package/src/prism/tests/languages/markup/issue3441.test new file mode 100644 index 00000000..6e22904d --- /dev/null +++ b/package/src/prism/tests/languages/markup/issue3441.test @@ -0,0 +1,23 @@ + + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["google-chart"]], + ["attr-name", ["data"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "'"], + "[[\"Month\", \"Days\"], [\"Jan\", 31]]", + ["punctuation", "'"] + ]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", ""] + ]] +] diff --git a/package/src/prism/tests/languages/markup/issue585.test b/package/src/prism/tests/languages/markup/issue585.test new file mode 100644 index 00000000..d20af151 --- /dev/null +++ b/package/src/prism/tests/languages/markup/issue585.test @@ -0,0 +1,55 @@ +foo + +baz + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["Läufer"]], + ["punctuation", ">"] + ]], + "foo", + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["tag"]], + ["attr-name", ["läufer"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "läufer", + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", [ + ["namespace", "läufer:"], + "tag" + ]], + ["punctuation", ">"] + ]], + "baz", + ["tag", [ + ["punctuation", ""] + ]] +] + +---------------------------------------------------- + +Checks for tags, attributes and namespaces containing unicode characters. +See #585 for details. diff --git a/package/src/prism/tests/languages/markup/issue888.test b/package/src/prism/tests/languages/markup/issue888.test new file mode 100644 index 00000000..e901a575 --- /dev/null +++ b/package/src/prism/tests/languages/markup/issue888.test @@ -0,0 +1,16 @@ + + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["android.support.v7.widget.CardView"]], + ["punctuation", ">"] + ]] +] + +---------------------------------------------------- + +Checks for tag names containing dots. +See #888 for details. diff --git a/package/src/prism/tests/languages/markup/prolog_feature.test b/package/src/prism/tests/languages/markup/prolog_feature.test new file mode 100644 index 00000000..8cb4d7c3 --- /dev/null +++ b/package/src/prism/tests/languages/markup/prolog_feature.test @@ -0,0 +1,16 @@ + + + + +---------------------------------------------------- + +[ + ["prolog", ""], + ["prolog", ""], + ["prolog", ""] +] + +---------------------------------------------------- + +Checks for different XML prologs, single-line and multi-line. \ No newline at end of file diff --git a/package/src/prism/tests/languages/markup/tag_attribute_feature.test b/package/src/prism/tests/languages/markup/tag_attribute_feature.test new file mode 100644 index 00000000..a4a223af --- /dev/null +++ b/package/src/prism/tests/languages/markup/tag_attribute_feature.test @@ -0,0 +1,99 @@ +
+
+
+
+
+
+ +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "test", + ["punctuation", "\""] + ]], + ["attr-name", ["foo"]], + ["attr-name", ["bar"]], + ["attr-equals", "="], + ["attr-value", ["baz"]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["foo"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "'"], + "bar", + ["punctuation", "'"] + ]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "foo\nbar\nbaz", + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", [ + ["namespace", "foo:"], + "bar" + ]], + ["attr-equals", "="], + ["attr-value", ["42"]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["foo"]], + ["attr-equals", "="], + ["attr-value", ["42"]], + ["attr-name", ["bar"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "42", + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["foo"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "=\\", + ["punctuation", "\""] + ]], + ["attr-name", ["bar"]], + ["attr-equals", "="], + ["attr-value", ["baz"]], + ["punctuation", "/>"] + ]] +] + +---------------------------------------------------- + +Checks for single-quoted, double-quoted and unquoted attributes, attributes without value and +namespaced attributes. diff --git a/package/src/prism/tests/languages/markup/tag_feature.test b/package/src/prism/tests/languages/markup/tag_feature.test new file mode 100644 index 00000000..c41a55b4 --- /dev/null +++ b/package/src/prism/tests/languages/markup/tag_feature.test @@ -0,0 +1,67 @@ +

+
dummy
+
+ +
"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + "dummy", + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", [ + ["namespace", "foo:"], + "bar" + ]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + "\n= > < <= +:== :!= :>= :> :< :<= + +? : += +# + +a’ a` a' + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "^"], + + ["operator", ":+"], + ["operator", ":-"], + ["operator", ":*"], + ["operator", ":/"], + ["operator", ":^"], + + ["operator", "++"], + ["operator", "--"], + + ["operator", "\\"], ["operator", "::"], ["operator", ".."], + ["operator", ":|"], ["operator", "|"], ["operator", ":&"], ["operator", "&"], + ["operator", "!"], ["operator", "&&"], ["operator", "||"], + + ["operator", "=="], + ["operator", "!="], + ["operator", ">="], + ["operator", ">"], + ["operator", "<"], + ["operator", "<="], + + ["operator", ":=="], + ["operator", ":!="], + ["operator", ":>="], + ["operator", ":>"], + ["operator", ":<"], + ["operator", ":<="], + + ["operator", "?"], ["operator", ":"], + ["operator", "="], + ["operator", "#"], + + "\n\na", + ["operator", "’"], + " a", + ["operator", "`"], + " a", + ["operator", "'"] +] diff --git a/package/src/prism/tests/languages/mata/punctuation_feature.test b/package/src/prism/tests/languages/mata/punctuation_feature.test new file mode 100644 index 00000000..2556653d --- /dev/null +++ b/package/src/prism/tests/languages/mata/punctuation_feature.test @@ -0,0 +1,20 @@ +( ) [ ] { } +, ; + +t.n1 + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["punctuation", ","], + ["punctuation", ";"], + + "\n\nt", ["punctuation", "."], "n1" +] diff --git a/package/src/prism/tests/languages/mata/string_feature.test b/package/src/prism/tests/languages/mata/string_feature.test new file mode 100644 index 00000000..f728666d --- /dev/null +++ b/package/src/prism/tests/languages/mata/string_feature.test @@ -0,0 +1,21 @@ +"" +‘""’ +"foo" +‘"also a string"’ +‘"The "factor" of a matrix"’ + +// technically not correct, but commonly used on the web +`"Hamlet said "To be, or not to be.""' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "‘\"\"’"], + ["string", "\"foo\""], + ["string", "‘\"also a string\"’"], + ["string", "‘\"The \"factor\" of a matrix\"’"], + + ["comment", "// technically not correct, but commonly used on the web"], + ["string", "`\"Hamlet said \"To be, or not to be.\"\"'"] +] diff --git a/package/src/prism/tests/languages/mata/type_feature.test b/package/src/prism/tests/languages/mata/type_feature.test new file mode 100644 index 00000000..1126ed8c --- /dev/null +++ b/package/src/prism/tests/languages/mata/type_feature.test @@ -0,0 +1,102 @@ +void +transmorphic matrix +real matrix +complex matrix +string matrix +pointer matrix +transmorphic rowvector +real rowvector +complex rowvector +string rowvector +pointer rowvector +transmorphic colvector +real colvector +complex colvector +string colvector +pointer colvector +transmorphic vector +real vector +complex vector +string vector +pointer vector +transmorphic scalar +real scalar +complex scalar +string scalar +pointer scalar + +pointer(real matrix) scalar example(real scalar n) +real scalar neat(pointer(real scalar function) p) +struct mystruct scalar y +class rotated_coord scalar b + +---------------------------------------------------- + +[ + ["type", [ + ["keyword", "void"] + ]], + ["type", ["transmorphic matrix"]], + ["type", ["real matrix"]], + ["type", ["complex matrix"]], + ["type", ["string matrix"]], + ["type", ["pointer matrix"]], + ["type", ["transmorphic rowvector"]], + ["type", ["real rowvector"]], + ["type", ["complex rowvector"]], + ["type", ["string rowvector"]], + ["type", ["pointer rowvector"]], + ["type", ["transmorphic colvector"]], + ["type", ["real colvector"]], + ["type", ["complex colvector"]], + ["type", ["string colvector"]], + ["type", ["pointer colvector"]], + ["type", ["transmorphic vector"]], + ["type", ["real vector"]], + ["type", ["complex vector"]], + ["type", ["string vector"]], + ["type", ["pointer vector"]], + ["type", ["transmorphic scalar"]], + ["type", ["real scalar"]], + ["type", ["complex scalar"]], + ["type", ["string scalar"]], + ["type", ["pointer scalar"]], + + ["type", [ + "pointer", + ["punctuation", "("], + "real matrix", + ["punctuation", ")"], + " scalar" + ]], + ["function", "example"], + ["punctuation", "("], + ["type", ["real scalar"]], + " n", + ["punctuation", ")"], + + ["type", ["real scalar"]], + ["function", "neat"], + ["punctuation", "("], + ["type", [ + "pointer", + ["punctuation", "("], + "real scalar ", + ["keyword", "function"], + ["punctuation", ")"] + ]], + " p", + ["punctuation", ")"], + + ["type", [ + ["keyword", "struct"], + " mystruct scalar" + ]], + " y\n", + + ["type", [ + ["keyword", "class"], + " rotated_coord scalar" + ]], + " b" +] diff --git a/package/src/prism/tests/languages/matlab/comment_feature.test b/package/src/prism/tests/languages/matlab/comment_feature.test new file mode 100644 index 00000000..a9820c58 --- /dev/null +++ b/package/src/prism/tests/languages/matlab/comment_feature.test @@ -0,0 +1,20 @@ +% foobar +%{}% +%{ foo +bar }% +% 'test' +%{ 'test' }% + +---------------------------------------------------- + +[ + ["comment", "% foobar"], + ["comment", "%{}%"], + ["comment", "%{ foo\nbar }%"], + ["comment", "% 'test'"], + ["comment", "%{ 'test' }%"] +] + +---------------------------------------------------- + +Checks for single-line and multi-line comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/matlab/function_feature.test b/package/src/prism/tests/languages/matlab/function_feature.test new file mode 100644 index 00000000..253cda05 --- /dev/null +++ b/package/src/prism/tests/languages/matlab/function_feature.test @@ -0,0 +1,13 @@ +foo() +foo_42() + +---------------------------------------------------- + +[ + ["function", "foo"], ["punctuation", "("], ["punctuation", ")"], + ["function", "foo_42"], ["punctuation", "("], ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/matlab/keyword_feature.test b/package/src/prism/tests/languages/matlab/keyword_feature.test new file mode 100644 index 00000000..0f290734 --- /dev/null +++ b/package/src/prism/tests/languages/matlab/keyword_feature.test @@ -0,0 +1,21 @@ +break case catch continue +else elseif end for +function if inf NaN +otherwise parfor pause +pi return switch +try while + +---------------------------------------------------- + +[ + ["keyword", "break"], ["keyword", "case"], ["keyword", "catch"], ["keyword", "continue"], + ["keyword", "else"], ["keyword", "elseif"], ["keyword", "end"], ["keyword", "for"], + ["keyword", "function"], ["keyword", "if"], ["keyword", "inf"], ["keyword", "NaN"], + ["keyword", "otherwise"], ["keyword", "parfor"], ["keyword", "pause"], + ["keyword", "pi"], ["keyword", "return"], ["keyword", "switch"], + ["keyword", "try"], ["keyword", "while"] +] + +---------------------------------------------------- + +Checks for all keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/matlab/number_feature.test b/package/src/prism/tests/languages/matlab/number_feature.test new file mode 100644 index 00000000..5f2124dd --- /dev/null +++ b/package/src/prism/tests/languages/matlab/number_feature.test @@ -0,0 +1,27 @@ +42 +3.14159 +2.1e2 +3.2E+4 +0.1e-5 +3i +2j +i +j + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "2.1e2"], + ["number", "3.2E+4"], + ["number", "0.1e-5"], + ["number", "3i"], + ["number", "2j"], + ["number", "i"], + ["number", "j"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/matlab/operator_feature.test b/package/src/prism/tests/languages/matlab/operator_feature.test new file mode 100644 index 00000000..5cc93bce --- /dev/null +++ b/package/src/prism/tests/languages/matlab/operator_feature.test @@ -0,0 +1,29 @@ +.' .^ +.* ./ .\ +@ ^ : ++ - ~ +* / \ +< <= > >= +== ~= +& && +| || +A' + +---------------------------------------------------- + +[ + ["operator", ".'"], ["operator", ".^"], + ["operator", ".*"], ["operator", "./"], ["operator", ".\\"], + ["operator", "@"], ["operator", "^"], ["operator", ":"], + ["operator", "+"], ["operator", "-"], ["operator", "~"], + ["operator", "*"], ["operator", "/"], ["operator", "\\"], + ["operator", "<"], ["operator", "<="], ["operator", ">"], ["operator", ">="], + ["operator", "=="], ["operator", "~="], + ["operator", "&"], ["operator", "&&"], + ["operator", "|"], ["operator", "||"], + "\nA", ["operator", "'"] +] + +---------------------------------------------------- + +Checks for all operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/matlab/string_feature.test b/package/src/prism/tests/languages/matlab/string_feature.test new file mode 100644 index 00000000..45dfa8f0 --- /dev/null +++ b/package/src/prism/tests/languages/matlab/string_feature.test @@ -0,0 +1,15 @@ +'' +'foo''bar' +'%s' + +---------------------------------------------------- + +[ + ["string", "''"], + ["string", "'foo''bar'"], + ["string", "'%s'"] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/maxscript/boolean_feature.test b/package/src/prism/tests/languages/maxscript/boolean_feature.test new file mode 100644 index 00000000..4d678006 --- /dev/null +++ b/package/src/prism/tests/languages/maxscript/boolean_feature.test @@ -0,0 +1,11 @@ +true; +false; + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["punctuation", ";"], + ["boolean", "false"], + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/maxscript/color_feature.test b/package/src/prism/tests/languages/maxscript/color_feature.test new file mode 100644 index 00000000..f2fad5ff --- /dev/null +++ b/package/src/prism/tests/languages/maxscript/color_feature.test @@ -0,0 +1,23 @@ +black +blue +brown +gray +green +orange +red +white +yellow + +---------------------------------------------------- + +[ + ["color", "black"], + ["color", "blue"], + ["color", "brown"], + ["color", "gray"], + ["color", "green"], + ["color", "orange"], + ["color", "red"], + ["color", "white"], + ["color", "yellow"] +] diff --git a/package/src/prism/tests/languages/maxscript/comment_feature.test b/package/src/prism/tests/languages/maxscript/comment_feature.test new file mode 100644 index 00000000..3b59233b --- /dev/null +++ b/package/src/prism/tests/languages/maxscript/comment_feature.test @@ -0,0 +1,29 @@ +/* this is a long comment +blah blah +print "debug 1" -- code commented out +more comments +*/ + +for i in 1 to 10 do(/* messageBox "in loop"; */frabulate i ) + +-- comment + +---------------------------------------------------- + +[ + ["comment", "/* this is a long comment\nblah blah\nprint \"debug 1\" -- code commented out\nmore comments\n*/"], + + ["keyword", "for"], + " i ", + ["keyword", "in"], + ["number", "1"], + ["keyword", "to"], + ["number", "10"], + ["keyword", "do"], + ["punctuation", "("], + ["comment", "/* messageBox \"in loop\"; */"], + "frabulate i ", + ["punctuation", ")"], + + ["comment", "-- comment"] +] diff --git a/package/src/prism/tests/languages/maxscript/constant_feature.test b/package/src/prism/tests/languages/maxscript/constant_feature.test new file mode 100644 index 00000000..fc5a9c9a --- /dev/null +++ b/package/src/prism/tests/languages/maxscript/constant_feature.test @@ -0,0 +1,15 @@ +dontcollect +ok +silentValue +undefined +unsupplied + +---------------------------------------------------- + +[ + ["constant", "dontcollect"], + ["constant", "ok"], + ["constant", "silentValue"], + ["constant", "undefined"], + ["constant", "unsupplied"] +] diff --git a/package/src/prism/tests/languages/maxscript/function_feature.test b/package/src/prism/tests/languages/maxscript/function_feature.test new file mode 100644 index 00000000..46814919 --- /dev/null +++ b/package/src/prism/tests/languages/maxscript/function_feature.test @@ -0,0 +1,152 @@ +function my_add a b = a + b + +fn factorial n = if n <= 0 then 1 else n * factorial (n - 1) + +mapped function rand_color x = + x.wireColor = random (color 0 0 0) (color 255 255 255) + +fn starfield count extent:[200,200,200] pos:[0,0,0] = + ( + -- something + ) + +fn saddle x y = sin x * sin y + +print "build math mesh" +in_name = getOpenFileName() +val.x=random -100 100 +append vert_array (readValue in_file) +while not eof f do +on pressme pressed do print "Pressed!" + +---------------------------------------------------- + +[ + ["keyword", "function"], + ["function-definition", "my_add"], + " a b ", + ["operator", "="], + " a ", + ["operator", "+"], + " b\n\n", + + ["keyword", "fn"], + ["function-definition", "factorial"], + " n ", + ["operator", "="], + ["keyword", "if"], + " n ", + ["operator", "<="], + ["number", "0"], + ["keyword", "then"], + ["number", "1"], + ["keyword", "else"], + " n ", + ["operator", "*"], + ["function-call", "factorial"], + ["punctuation", "("], + "n ", + ["operator", "-"], + ["number", "1"], + ["punctuation", ")"], + + ["keyword", "mapped"], + ["keyword", "function"], + ["function-definition", "rand_color"], + " x ", + ["operator", "="], + + "\n x", + ["punctuation", "."], + "wireColor ", + ["operator", "="], + ["function-call", "random"], + ["punctuation", "("], + ["function-call", "color"], + ["number", "0"], + ["number", "0"], + ["number", "0"], + ["punctuation", ")"], + ["punctuation", "("], + ["function-call", "color"], + ["number", "255"], + ["number", "255"], + ["number", "255"], + ["punctuation", ")"], + + ["keyword", "fn"], + ["function-definition", "starfield"], + " count ", + ["argument", "extent"], + ["punctuation", ":"], + ["punctuation", "["], + ["number", "200"], + ["punctuation", ","], + ["number", "200"], + ["punctuation", ","], + ["number", "200"], + ["punctuation", "]"], + ["argument", "pos"], + ["punctuation", ":"], + ["punctuation", "["], + ["number", "0"], + ["punctuation", ","], + ["number", "0"], + ["punctuation", ","], + ["number", "0"], + ["punctuation", "]"], + ["operator", "="], + + ["punctuation", "("], + + ["comment", "-- something"], + + ["punctuation", ")"], + + ["keyword", "fn"], + ["function-definition", "saddle"], + " x y ", + ["operator", "="], + ["function-call", "sin"], + " x ", + ["operator", "*"], + ["function-call", "sin"], + " y\n\n", + + ["function-call", "print"], + ["string", "\"build math mesh\""], + + "\nin_name ", + ["operator", "="], + ["function-call", "getOpenFileName"], + ["punctuation", "("], + ["punctuation", ")"], + + "\nval", + ["punctuation", "."], + "x", + ["operator", "="], + ["function-call", "random"], + ["operator", "-"], + ["number", "100"], + ["number", "100"], + + ["function-call", "append"], + " vert_array ", + ["punctuation", "("], + ["function-call", "readValue"], + " in_file", + ["punctuation", ")"], + + ["keyword", "while"], + ["keyword", "not"], + ["function-call", "eof"], + " f ", + ["keyword", "do"], + + ["keyword", "on"], + " pressme pressed ", + ["keyword", "do"], + ["function-call", "print"], + ["string", "\"Pressed!\""] +] diff --git a/package/src/prism/tests/languages/maxscript/keyword_feature.test b/package/src/prism/tests/languages/maxscript/keyword_feature.test new file mode 100644 index 00000000..200aac37 --- /dev/null +++ b/package/src/prism/tests/languages/maxscript/keyword_feature.test @@ -0,0 +1,105 @@ +about; +and; +animate; +as; +at; +attributes; +by; +case; +catch; +collect; +continue; +coordsys; +do; +else; +exit; +fn; +for; +from; +function; +global; +if; +in; +local; +macroscript; +mapped; +max; +not; +of; +off; +on; +or; +parameters; +persistent; +plugin; +rcmenu; +return; +rollout; +set; +struct; +then; +throw; +to; +tool; +try; +undo; +utility; +when; +where; +while; +with; + +---------------------------------------------------- + +[ + ["keyword", "about"], ["punctuation", ";"], + ["keyword", "and"], ["punctuation", ";"], + ["keyword", "animate"], ["punctuation", ";"], + ["keyword", "as"], ["punctuation", ";"], + ["keyword", "at"], ["punctuation", ";"], + ["keyword", "attributes"], ["punctuation", ";"], + ["keyword", "by"], ["punctuation", ";"], + ["keyword", "case"], ["punctuation", ";"], + ["keyword", "catch"], ["punctuation", ";"], + ["keyword", "collect"], ["punctuation", ";"], + ["keyword", "continue"], ["punctuation", ";"], + ["keyword", "coordsys"], ["punctuation", ";"], + ["keyword", "do"], ["punctuation", ";"], + ["keyword", "else"], ["punctuation", ";"], + ["keyword", "exit"], ["punctuation", ";"], + ["keyword", "fn"], ["punctuation", ";"], + ["keyword", "for"], ["punctuation", ";"], + ["keyword", "from"], ["punctuation", ";"], + ["keyword", "function"], ["punctuation", ";"], + ["keyword", "global"], ["punctuation", ";"], + ["keyword", "if"], ["punctuation", ";"], + ["keyword", "in"], ["punctuation", ";"], + ["keyword", "local"], ["punctuation", ";"], + ["keyword", "macroscript"], ["punctuation", ";"], + ["keyword", "mapped"], ["punctuation", ";"], + ["keyword", "max"], ["punctuation", ";"], + ["keyword", "not"], ["punctuation", ";"], + ["keyword", "of"], ["punctuation", ";"], + ["keyword", "off"], ["punctuation", ";"], + ["keyword", "on"], ["punctuation", ";"], + ["keyword", "or"], ["punctuation", ";"], + ["keyword", "parameters"], ["punctuation", ";"], + ["keyword", "persistent"], ["punctuation", ";"], + ["keyword", "plugin"], ["punctuation", ";"], + ["keyword", "rcmenu"], ["punctuation", ";"], + ["keyword", "return"], ["punctuation", ";"], + ["keyword", "rollout"], ["punctuation", ";"], + ["keyword", "set"], ["punctuation", ";"], + ["keyword", "struct"], ["punctuation", ";"], + ["keyword", "then"], ["punctuation", ";"], + ["keyword", "throw"], ["punctuation", ";"], + ["keyword", "to"], ["punctuation", ";"], + ["keyword", "tool"], ["punctuation", ";"], + ["keyword", "try"], ["punctuation", ";"], + ["keyword", "undo"], ["punctuation", ";"], + ["keyword", "utility"], ["punctuation", ";"], + ["keyword", "when"], ["punctuation", ";"], + ["keyword", "where"], ["punctuation", ";"], + ["keyword", "while"], ["punctuation", ";"], + ["keyword", "with"], ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/maxscript/number_feature.test b/package/src/prism/tests/languages/maxscript/number_feature.test new file mode 100644 index 00000000..c01246e6 --- /dev/null +++ b/package/src/prism/tests/languages/maxscript/number_feature.test @@ -0,0 +1,23 @@ +123 +123.45 +-0.00345 +1.0e-6 +0x0E +.1 + +e +pi + +---------------------------------------------------- + +[ + ["number", "123"], + ["number", "123.45"], + ["operator", "-"], ["number", "0.00345"], + ["number", "1.0e-6"], + ["number", "0x0E"], + ["number", ".1"], + + ["number", "e"], + ["number", "pi"] +] diff --git a/package/src/prism/tests/languages/maxscript/operator_feature.test b/package/src/prism/tests/languages/maxscript/operator_feature.test new file mode 100644 index 00000000..e09006ec --- /dev/null +++ b/package/src/prism/tests/languages/maxscript/operator_feature.test @@ -0,0 +1,32 @@ ++ - * / ++= -= *= /= + += +== != < <= > >= + +^ & # + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + + ["operator", "="], + + ["operator", "=="], + ["operator", "!="], + ["operator", "<"], + ["operator", "<="], + ["operator", ">"], + ["operator", ">="], + + ["operator", "^"], ["operator", "&"], ["operator", "#"] +] diff --git a/package/src/prism/tests/languages/maxscript/path_feature.test b/package/src/prism/tests/languages/maxscript/path_feature.test new file mode 100644 index 00000000..b89fd985 --- /dev/null +++ b/package/src/prism/tests/languages/maxscript/path_feature.test @@ -0,0 +1,89 @@ +$box01 -- object named 'box01' +$torso/left_up_arm/left_low_arm -- hierarchy path name +$*box* -- all objects with 'box' in +-- the name +$torso/* -- all the direct children of +-- $torso +$helpers/d* -- all helper objects whose name starts with 'd' + +$dummy/head/neck +$dummy/* +$neck* +$box0? +$dummy/*/* +$dummy/.../box* +$dummy...* +$*box*.position += [10, 10, 0] + +$.pos = [0,0,0] +hide $ +rotate $ 35 z_axis + +$'a silly name!!' +$'what the \*' +bodyPart=$'Bip01 L UpperArm' +bodyPart=$Bip01_L_UpperArm + +---------------------------------------------------- + +[ + ["path", "$box01"], + ["comment", "-- object named 'box01'"], + ["path", "$torso/left_up_arm/left_low_arm"], + ["comment", "-- hierarchy path name"], + ["path", "$*box*"], + ["comment", "-- all objects with 'box' in"], + ["comment", "-- the name"], + ["path", "$torso/*"], + ["comment", "-- all the direct children of"], + ["comment", "-- $torso"], + ["path", "$helpers/d*"], + ["comment", "-- all helper objects whose name starts with 'd'"], + + ["path", "$dummy/head/neck"], + + ["path", "$dummy/*"], + + ["path", "$neck*"], + + ["path", "$box0?"], + + ["path", "$dummy/*/*"], + + ["path", "$dummy/.../box*"], + + ["path", "$dummy...*"], + + ["path", "$*box*.position"], + ["operator", "+="], + ["punctuation", "["], + ["number", "10"], + ["punctuation", ","], + ["number", "10"], + ["punctuation", ","], + ["number", "0"], + ["punctuation", "]"], + + ["path", "$.pos"], + ["operator", "="], + ["punctuation", "["], + ["number", "0"], + ["punctuation", ","], + ["number", "0"], + ["punctuation", ","], + ["number", "0"], + ["punctuation", "]"], + + ["function-call", "hide"], + ["path", "$"], + + ["function-call", "rotate"], + ["path", "$"], + ["number", "35"], + " z_axis\n\n", + + ["path", "$'a silly name!!'"], + ["path", "$'what the \\*'"], + "\nbodyPart", ["operator", "="], ["path", "$'Bip01 L UpperArm'"], + "\nbodyPart", ["operator", "="], ["path", "$Bip01_L_UpperArm"] +] diff --git a/package/src/prism/tests/languages/maxscript/punctuation_feature.test b/package/src/prism/tests/languages/maxscript/punctuation_feature.test new file mode 100644 index 00000000..136dc906 --- /dev/null +++ b/package/src/prism/tests/languages/maxscript/punctuation_feature.test @@ -0,0 +1,25 @@ +( ) [ ] { } +. : , ; +#( +\ + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["punctuation", "."], + ["punctuation", ":"], + ["punctuation", ","], + ["punctuation", ";"], + + ["punctuation", "#"], + ["punctuation", "("], + + ["punctuation", "\\"] +] diff --git a/package/src/prism/tests/languages/maxscript/string_feature.test b/package/src/prism/tests/languages/maxscript/string_feature.test new file mode 100644 index 00000000..bc57fa9d --- /dev/null +++ b/package/src/prism/tests/languages/maxscript/string_feature.test @@ -0,0 +1,17 @@ +"" +"foo should be quoted like this: \"foo\" and a new line: \n" +"Twas brillig and the slithy tobes +did gyre and gimbol in the wabe +or something like that..." +"g:\\3dsmax25\\scenes" +@"g:\temp\newfolder\render" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foo should be quoted like this: \\\"foo\\\" and a new line: \\n\""], + ["string", "\"Twas brillig and the slithy tobes\ndid gyre and gimbol in the wabe\nor something like that...\""], + ["string", "\"g:\\\\3dsmax25\\\\scenes\""], + ["string", "@\"g:\\temp\\newfolder\\render\""] +] diff --git a/package/src/prism/tests/languages/maxscript/time_feature.test b/package/src/prism/tests/languages/maxscript/time_feature.test new file mode 100644 index 00000000..0405771f --- /dev/null +++ b/package/src/prism/tests/languages/maxscript/time_feature.test @@ -0,0 +1,21 @@ +2.5s +1m15s +2m30s5f2t +125f +18.25f +1f20t +2:10.0 +0:0.29 + +---------------------------------------------------- + +[ + ["time", "2.5s"], + ["time", "1m15s"], + ["time", "2m30s5f2t"], + ["time", "125f"], + ["time", "18.25f"], + ["time", "1f20t"], + ["time", "2:10.0"], + ["time", "0:0.29"] +] diff --git a/package/src/prism/tests/languages/mel/code_feature.test b/package/src/prism/tests/languages/mel/code_feature.test new file mode 100644 index 00000000..08dfd04e --- /dev/null +++ b/package/src/prism/tests/languages/mel/code_feature.test @@ -0,0 +1,41 @@ +`ls -selection` + +$shaders = `listConnections -source true -type shadingEngine +$listOfShapes[$whichShape]`; + +---------------------------------------------------- + +[ + ["code", [ + ["delimiter", "`"], + ["statement", [ + ["function", "ls"], + ["flag", "-selection"] + ]], + ["delimiter", "`"] + ]], + + ["variable", "$shaders"], + ["operator", "="], + ["code", [ + ["delimiter", "`"], + ["statement", [ + ["function", "listConnections"], + ["flag", "-source"], + " true ", + ["flag", "-type"], + " shadingEngine\n", + + ["variable", "$listOfShapes"], + ["punctuation", "["], + ["variable", "$whichShape"], + ["punctuation", "]"] + ]], + ["delimiter", "`"] + ]], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for code. diff --git a/package/src/prism/tests/languages/mel/comment_feature.test b/package/src/prism/tests/languages/mel/comment_feature.test new file mode 100644 index 00000000..c35df326 --- /dev/null +++ b/package/src/prism/tests/languages/mel/comment_feature.test @@ -0,0 +1,17 @@ +// +// Foobar +/* +comment +*/ + +---------------------------------------------------- + +[ + ["comment", "//"], + ["comment", "// Foobar"], + ["comment", "/*\ncomment\n*/"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/mel/flag_feature.test b/package/src/prism/tests/languages/mel/flag_feature.test new file mode 100644 index 00000000..c9509b2d --- /dev/null +++ b/package/src/prism/tests/languages/mel/flag_feature.test @@ -0,0 +1,15 @@ +-d +-foo +-foo42 + +---------------------------------------------------- + +[ + ["flag", "-d"], + ["flag", "-foo"], + ["flag", "-foo42"] +] + +---------------------------------------------------- + +Checks for flags. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mel/function_feature.test b/package/src/prism/tests/languages/mel/function_feature.test new file mode 100644 index 00000000..35670a77 --- /dev/null +++ b/package/src/prism/tests/languages/mel/function_feature.test @@ -0,0 +1,133 @@ +foobar() +foo_bar_42() +foo.bar() + +proc animatedDuplication () +global proc VL_doit( ) + +print("Semicolons separate"); print(" different statements."); + +float $frame = `currentTime -q`; +string $timeFormat = `currentUnit -query -time`; +currentUnit -time sec; +float $time = `currentTime -q`; +currentUnit -time $timeFormat; + +persp.translateX = 23.2; + +PolySelectConvert 3; +setParent ..; +duplicate; + +---------------------------------------------------- + +[ + ["function", "foobar"], + ["punctuation", "("], + ["punctuation", ")"], + + ["function", "foo_bar_42"], + ["punctuation", "("], + ["punctuation", ")"], + + "\nfoo", + ["punctuation", "."], + ["function", "bar"], + ["punctuation", "("], + ["punctuation", ")"], + + ["keyword", "proc"], + ["function", "animatedDuplication"], + ["punctuation", "("], + ["punctuation", ")"], + + ["keyword", "global"], + ["keyword", "proc"], + ["function", "VL_doit"], + ["punctuation", "("], + ["punctuation", ")"], + + ["function", "print"], + ["punctuation", "("], + ["string", "\"Semicolons separate\""], + ["punctuation", ")"], + ["punctuation", ";"], + ["function", "print"], + ["punctuation", "("], + ["string", "\" different statements.\""], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "float"], + ["variable", "$frame"], + ["operator", "="], + ["code", [ + ["delimiter", "`"], + ["statement", [ + ["function", "currentTime"], + ["flag", "-q"] + ]], + ["delimiter", "`"] + ]], + ["punctuation", ";"], + + ["keyword", "string"], + ["variable", "$timeFormat"], + ["operator", "="], + ["code", [ + ["delimiter", "`"], + ["statement", [ + ["function", "currentUnit"], + ["flag", "-query"], + ["flag", "-time"] + ]], + ["delimiter", "`"] + ]], + ["punctuation", ";"], + + ["function", "currentUnit"], + ["flag", "-time"], + " sec", + ["punctuation", ";"], + + ["keyword", "float"], + ["variable", "$time"], + ["operator", "="], + ["code", [ + ["delimiter", "`"], + ["statement", [ + ["function", "currentTime"], + ["flag", "-q"] + ]], + ["delimiter", "`"] + ]], + ["punctuation", ";"], + + ["function", "currentUnit"], + ["flag", "-time"], + ["variable", "$timeFormat"], + ["punctuation", ";"], + + "\n\npersp", + ["punctuation", "."], + "translateX ", + ["operator", "="], + ["number", "23.2"], + ["punctuation", ";"], + + ["function", "PolySelectConvert"], + ["number", "3"], + ["punctuation", ";"], + + ["function", "setParent"], + ["punctuation", "."], + ["punctuation", "."], + ["punctuation", ";"], + + ["function", "duplicate"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for functions. diff --git a/package/src/prism/tests/languages/mel/keyword_feature.test b/package/src/prism/tests/languages/mel/keyword_feature.test new file mode 100644 index 00000000..b2da9d98 --- /dev/null +++ b/package/src/prism/tests/languages/mel/keyword_feature.test @@ -0,0 +1,47 @@ +break +case +continue +default +do +else +float +for +global +if +in +int +matrix +proc +return +string +switch +vector +while + +---------------------------------------------------- + +[ + ["keyword", "break"], + ["keyword", "case"], + ["keyword", "continue"], + ["keyword", "default"], + ["keyword", "do"], + ["keyword", "else"], + ["keyword", "float"], + ["keyword", "for"], + ["keyword", "global"], + ["keyword", "if"], + ["keyword", "in"], + ["keyword", "int"], + ["keyword", "matrix"], + ["keyword", "proc"], + ["keyword", "return"], + ["keyword", "string"], + ["keyword", "switch"], + ["keyword", "vector"], + ["keyword", "while"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mel/number_feature.test b/package/src/prism/tests/languages/mel/number_feature.test new file mode 100644 index 00000000..70b47e0b --- /dev/null +++ b/package/src/prism/tests/languages/mel/number_feature.test @@ -0,0 +1,15 @@ +0xBadFace +42 +3.14159 + +---------------------------------------------------- + +[ + ["number", "0xBadFace"], + ["number", "42"], + ["number", "3.14159"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mel/operator_feature.test b/package/src/prism/tests/languages/mel/operator_feature.test new file mode 100644 index 00000000..942da826 --- /dev/null +++ b/package/src/prism/tests/languages/mel/operator_feature.test @@ -0,0 +1,33 @@ ++ ++ += +- -- -= +* *= +/ /= +! != += == +&& +|| +< <= +> >= +% +^ + +---------------------------------------------------- + +[ + ["operator", "+"], ["operator", "++"], ["operator", "+="], + ["operator", "-"], ["operator", "--"], ["operator", "-="], + ["operator", "*"], ["operator", "*="], + ["operator", "/"], ["operator", "/="], + ["operator", "!"], ["operator", "!="], + ["operator", "="], ["operator", "=="], + ["operator", "&&"], + ["operator", "||"], + ["operator", "<"], ["operator", "<="], + ["operator", ">"], ["operator", ">="], + ["operator", "%"], + ["operator", "^"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mel/punctuation_feature.test b/package/src/prism/tests/languages/mel/punctuation_feature.test new file mode 100644 index 00000000..ffe11aff --- /dev/null +++ b/package/src/prism/tests/languages/mel/punctuation_feature.test @@ -0,0 +1,25 @@ +( ) { } [ ] +. ; . +? : +<< >> + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + + ["punctuation", "."], + ["punctuation", ";"], + ["punctuation", "."], + + ["punctuation", "?"], + ["punctuation", ":"], + + ["tensor-punctuation", "<<"], + ["tensor-punctuation", ">>"] +] diff --git a/package/src/prism/tests/languages/mel/string_feature.test b/package/src/prism/tests/languages/mel/string_feature.test new file mode 100644 index 00000000..b3c6ec95 --- /dev/null +++ b/package/src/prism/tests/languages/mel/string_feature.test @@ -0,0 +1,13 @@ +"" +"fo\"obar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mel/variable_feature.test b/package/src/prism/tests/languages/mel/variable_feature.test new file mode 100644 index 00000000..50d3c223 --- /dev/null +++ b/package/src/prism/tests/languages/mel/variable_feature.test @@ -0,0 +1,15 @@ +$x +$foo42 +$Foo_Bar_42 + +---------------------------------------------------- + +[ + ["variable", "$x"], + ["variable", "$foo42"], + ["variable", "$Foo_Bar_42"] +] + +---------------------------------------------------- + +Checks for variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mermaid/arrow_feature.test b/package/src/prism/tests/languages/mermaid/arrow_feature.test new file mode 100644 index 00000000..6205a313 --- /dev/null +++ b/package/src/prism/tests/languages/mermaid/arrow_feature.test @@ -0,0 +1,125 @@ +%% flow chart + +--- ---- ----- +--> ---> ----> +<-- <--- <---- +=== ==== ===== +==> ===> ====> +<== <=== <==== +-.- -..- -...- +-.-> -..-> -...-> +<-.- <-..- <-...- +--x ---x ----x +--x -.-x -..-x +x-- x--- x---- +x-- x-.- x-..- +--o ---o ----o +--o -.-o -..-o +o-- o--- o---- +o-- o-.- o-..- + +<--> <----> <-..-> <====> +x--x x----x x-..-x x====x +o--o o----o o-..-o o====o + +%% sequence diagram + +-> --> ->> -->> +<- <-- <<- <<-- +-x --x -) --) +x- x-- (- (-- + +%% class diagram + +<|-- *-- o-- <-- <.. <|.. +--|> --* --o --> ..> ..|> +-- .. + +%% ER diagram + +|o--o| |o..o| +||--|| ||..|| +}o--o{ }o..o{ +}|--|{ }|..|{ + +|o--o| |o..o| +||--o{ ||..o{ +}o--|{ }o..|{ +}|--|| }|..|| + +---------------------------------------------------- + +[ + ["comment", "%% flow chart"], + + ["arrow", "---"], ["arrow", "----"], ["arrow", "-----"], + ["arrow", "-->"], ["arrow", "--->"], ["arrow", "---->"], + ["arrow", "<--"], ["arrow", "<---"], ["arrow", "<----"], + ["arrow", "==="], ["arrow", "===="], ["arrow", "====="], + ["arrow", "==>"], ["arrow", "===>"], ["arrow", "====>"], + ["arrow", "<=="], ["arrow", "<==="], ["arrow", "<===="], + ["arrow", "-.-"], ["arrow", "-..-"], ["arrow", "-...-"], + ["arrow", "-.->"], ["arrow", "-..->"], ["arrow", "-...->"], + ["arrow", "<-.-"], ["arrow", "<-..-"], ["arrow", "<-...-"], + ["arrow", "--x"], ["arrow", "---x"], ["arrow", "----x"], + ["arrow", "--x"], ["arrow", "-.-x"], ["arrow", "-..-x"], + ["arrow", "x--"], ["arrow", "x---"], ["arrow", "x----"], + ["arrow", "x--"], ["arrow", "x-.-"], ["arrow", "x-..-"], + ["arrow", "--o"], ["arrow", "---o"], ["arrow", "----o"], + ["arrow", "--o"], ["arrow", "-.-o"], ["arrow", "-..-o"], + ["arrow", "o--"], ["arrow", "o---"], ["arrow", "o----"], + ["arrow", "o--"], ["arrow", "o-.-"], ["arrow", "o-..-"], + + ["arrow", "<-->"], + ["arrow", "<---->"], + ["arrow", "<-..->"], + ["arrow", "<====>"], + + ["arrow", "x--x"], + ["arrow", "x----x"], + ["arrow", "x-..-x"], + ["arrow", "x====x"], + + ["arrow", "o--o"], + ["arrow", "o----o"], + ["arrow", "o-..-o"], + ["arrow", "o====o"], + + ["comment", "%% sequence diagram"], + + ["arrow", "->"], ["arrow", "-->"], ["arrow", "->>"], ["arrow", "-->>"], + ["arrow", "<-"], ["arrow", "<--"], ["arrow", "<<-"], ["arrow", "<<--"], + ["arrow", "-x"], ["arrow", "--x"], ["arrow", "-)"], ["arrow", "--)"], + ["arrow", "x-"], ["arrow", "x--"], ["arrow", "(-"], ["arrow", "(--"], + + ["comment", "%% class diagram"], + + ["arrow", "<|--"], + ["arrow", "*--"], + ["arrow", "o--"], + ["arrow", "<--"], + ["arrow", "<.."], + ["arrow", "<|.."], + + ["arrow", "--|>"], + ["arrow", "--*"], + ["arrow", "--o"], + ["arrow", "-->"], + ["arrow", "..>"], + ["arrow", "..|>"], + + ["arrow", "--"], + ["arrow", ".."], + + ["comment", "%% ER diagram"], + + ["arrow", "|o--o|"], ["arrow", "|o..o|"], + ["arrow", "||--||"], ["arrow", "||..||"], + ["arrow", "}o--o{"], ["arrow", "}o..o{"], + ["arrow", "}|--|{"], ["arrow", "}|..|{"], + + ["arrow", "|o--o|"], ["arrow", "|o..o|"], + ["arrow", "||--o{"], ["arrow", "||..o{"], + ["arrow", "}o--|{"], ["arrow", "}o..|{"], + ["arrow", "}|--||"], ["arrow", "}|..||"] +] diff --git a/package/src/prism/tests/languages/mermaid/comment_feature.test b/package/src/prism/tests/languages/mermaid/comment_feature.test new file mode 100644 index 00000000..90b8493f --- /dev/null +++ b/package/src/prism/tests/languages/mermaid/comment_feature.test @@ -0,0 +1,7 @@ +%% comment + +---------------------------------------------------- + +[ + ["comment", "%% comment"] +] diff --git a/package/src/prism/tests/languages/mermaid/full_classdiagram.test b/package/src/prism/tests/languages/mermaid/full_classdiagram.test new file mode 100644 index 00000000..ba89cfe2 --- /dev/null +++ b/package/src/prism/tests/languages/mermaid/full_classdiagram.test @@ -0,0 +1,656 @@ +classDiagram + Animal <|-- Duck + Animal <|-- Fish + Animal <|-- Zebra + Animal : +int age + Animal : +String gender + Animal: +isMammal() + Animal: +mate() + class Duck{ + +String beakColor + +swim() + +quack() + } + class Fish{ + -int sizeInFeet + -canEat() + } + class Zebra{ + +bool is_wild + +run() + } + +classDiagram + class BankAccount + BankAccount : +String owner + BankAccount : +Bigdecimal balance + BankAccount : +deposit(amount) + BankAccount : +withdrawl(amount) + +classDiagram + class Animal + Vehicle <|-- Car + +class BankAccount + BankAccount : +String owner + BankAccount : +BigDecimal balance + BankAccount : +deposit(amount) + BankAccount : +withdrawal(amount) + +class BankAccount{ + +String owner + +BigDecimal balance + +deposit(amount) + +withdrawl(amount) +} + +class BankAccount{ + +String owner + +BigDecimal balance + +deposit(amount) bool + +withdrawl(amount) int +} + +classDiagram +class Square~Shape~{ + int id + List~int~ position + setPoints(List~int~ points) + getPoints() List~int~ +} + +Square : -List~string~ messages +Square : +setMessages(List~string~ messages) +Square : +getMessages() List~string~ + +classDiagram +classA <|-- classB +classC *-- classD +classE o-- classF +classG <-- classH +classI -- classJ +classK <.. classL +classM <|.. classN +classO .. classP + +classDiagram +classA --|> classB : Inheritance +classC --* classD : Composition +classE --o classF : Aggregation +classG --> classH : Association +classI -- classJ : Link(Solid) +classK ..> classL : Dependency +classM ..|> classN : Realization +classO .. classP : Link(Dashed) + +classDiagram +classA <|-- classB : implements +classC *-- classD : composition +classE o-- classF : association + +classDiagram + Customer "1" --> "*" Ticket + Student "1" --> "1..*" Course + Galaxy --> "many" Star : Contains + +classDiagram +class Shape +<> Shape + +classDiagram +class Shape{ + <> + noOfVertices + draw() +} +class Color{ + <> + RED + BLUE + GREEN + WHITE + BLACK +} + +classDiagram +%% This whole line is a comment classDiagram class Shape <> +class Shape{ + <> + noOfVertices + draw() +} + +classDiagram + direction RL + class Student { + -idCard : IdCard + } + class IdCard{ + -id : int + -name : string + } + class Bike{ + -id : int + -name : string + } + Student "1" --o "1" IdCard : carries + Student "1" --o "1" Bike : rides + +action className "reference" "tooltip" +click className call callback() "tooltip" +click className href "url" "tooltip" + +classDiagram +class Shape +link Shape "http://www.github.com" "This is a tooltip for a link" +class Shape2 +click Shape2 href "http://www.github.com" "This is a tooltip for a link" + +classDiagram +class Shape +callback Shape "callbackFunction" "This is a tooltip for a callback" +class Shape2 +click Shape2 call callbackFunction() "This is a tooltip for a callback" + +classDiagram +Animal <|-- Duck +Animal <|-- Fish +Animal <|-- Zebra +Animal : +int age +Animal : +String gender +Animal: +isMammal() +Animal: +mate() +class Duck{ + +String beakColor + +swim() + +quack() + } +class Fish{ + -int sizeInFeet + -canEat() + } +class Zebra{ + +bool is_wild + +run() + } + + callback Duck callback "Tooltip" + link Zebra "http://www.github.com" "This is a link" + +classDiagram + class Animal:::cssClass + +classDiagram + class Animal:::cssClass { + -int sizeInFeet + -canEat() + } + +---------------------------------------------------- + +[ + ["keyword", "classDiagram"], + + "\n Animal ", + ["arrow", "<|--"], + " Duck\n Animal ", + ["arrow", "<|--"], + " Fish\n Animal ", + ["arrow", "<|--"], + " Zebra\n Animal ", + ["operator", ":"], + " +int age\n Animal ", + ["operator", ":"], + " +String gender\n Animal", + ["operator", ":"], + " +isMammal", + ["punctuation", "("], + ["punctuation", ")"], + + "\n Animal", + ["operator", ":"], + " +mate", + ["punctuation", "("], + ["punctuation", ")"], + + ["keyword", "class"], + " Duck", + ["punctuation", "{"], + + "\n +String beakColor\n +swim", + ["punctuation", "("], + ["punctuation", ")"], + + "\n +quack", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["keyword", "class"], + " Fish", + ["punctuation", "{"], + + "\n -int sizeInFeet\n -canEat", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["keyword", "class"], + " Zebra", + ["punctuation", "{"], + + "\n +bool is_wild\n +run", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["keyword", "classDiagram"], + + ["keyword", "class"], + " BankAccount\n BankAccount ", + ["operator", ":"], + " +String owner\n BankAccount ", + ["operator", ":"], + " +Bigdecimal balance\n BankAccount ", + ["operator", ":"], + " +deposit", + ["text", "(amount)"], + + "\n BankAccount ", + ["operator", ":"], + " +withdrawl", + ["text", "(amount)"], + + ["keyword", "classDiagram"], + + ["keyword", "class"], + " Animal\n Vehicle ", + ["arrow", "<|--"], + " Car\n\n", + + ["keyword", "class"], + " BankAccount\n BankAccount ", + ["operator", ":"], + " +String owner\n BankAccount ", + ["operator", ":"], + " +BigDecimal balance\n BankAccount ", + ["operator", ":"], + " +deposit", + ["text", "(amount)"], + + "\n BankAccount ", + ["operator", ":"], + " +withdrawal", + ["text", "(amount)"], + + ["keyword", "class"], + " BankAccount", + ["punctuation", "{"], + + "\n +String owner\n +BigDecimal balance\n +deposit", + ["text", "(amount)"], + + "\n +withdrawl", + ["text", "(amount)"], + + ["punctuation", "}"], + + ["keyword", "class"], + " BankAccount", + ["punctuation", "{"], + + "\n +String owner\n +BigDecimal balance\n +deposit", + ["text", "(amount)"], + " bool\n +withdrawl", + ["text", "(amount)"], + " int\n", + + ["punctuation", "}"], + + ["keyword", "classDiagram"], + + ["keyword", "class"], + " Square~Shape~", + ["punctuation", "{"], + + "\n int id\n List~int~ position\n setPoints", + ["text", "(List~int~ points)"], + + "\n getPoints", + ["punctuation", "("], + ["punctuation", ")"], + " List~int~\n", + + ["punctuation", "}"], + + "\n\nSquare ", + ["operator", ":"], + " -List~string~ messages\nSquare ", + ["operator", ":"], + " +setMessages", + ["text", "(List~string~ messages)"], + + "\nSquare ", + ["operator", ":"], + " +getMessages", + ["punctuation", "("], + ["punctuation", ")"], + " List~string~\n\n", + + ["keyword", "classDiagram"], + + "\nclassA ", + ["arrow", "<|--"], + " classB\nclassC ", + ["arrow", "*--"], + " classD\nclassE ", + ["arrow", "o--"], + " classF\nclassG ", + ["arrow", "<--"], + " classH\nclassI ", + ["arrow", "--"], + " classJ\nclassK ", + ["arrow", "<.."], + " classL\nclassM ", + ["arrow", "<|.."], + " classN\nclassO ", + ["arrow", ".."], + " classP\n\n", + + ["keyword", "classDiagram"], + + "\nclassA ", + ["arrow", "--|>"], + " classB ", + ["operator", ":"], + " Inheritance\nclassC ", + ["arrow", "--*"], + " classD ", + ["operator", ":"], + " Composition\nclassE ", + ["arrow", "--o"], + " classF ", + ["operator", ":"], + " Aggregation\nclassG ", + ["arrow", "-->"], + " classH ", + ["operator", ":"], + " Association\nclassI ", + ["arrow", "--"], + " classJ ", + ["operator", ":"], + " Link", + ["text", "(Solid)"], + + "\nclassK ", + ["arrow", "..>"], + " classL ", + ["operator", ":"], + " Dependency\nclassM ", + ["arrow", "..|>"], + " classN ", + ["operator", ":"], + " Realization\nclassO ", + ["arrow", ".."], + " classP ", + ["operator", ":"], + " Link", + ["text", "(Dashed)"], + + ["keyword", "classDiagram"], + + "\nclassA ", + ["arrow", "<|--"], + " classB ", + ["operator", ":"], + " implements\nclassC ", + ["arrow", "*--"], + " classD ", + ["operator", ":"], + " composition\nclassE ", + ["arrow", "o--"], + " classF ", + ["operator", ":"], + " association\n\n", + + ["keyword", "classDiagram"], + + "\n Customer ", + ["string", "\"1\""], + ["arrow", "-->"], + ["string", "\"*\""], + " Ticket\n Student ", + ["string", "\"1\""], + ["arrow", "-->"], + ["string", "\"1..*\""], + " Course\n Galaxy ", + ["arrow", "-->"], + ["string", "\"many\""], + " Star ", + ["operator", ":"], + " Contains\n\n", + + ["keyword", "classDiagram"], + ["keyword", "class"], " Shape\n", + ["annotation", "<>"], " Shape\n\n", + + ["keyword", "classDiagram"], + ["keyword", "class"], + " Shape", + ["punctuation", "{"], + ["annotation", "<>"], + "\n noOfVertices\n draw", + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "}"], + ["keyword", "class"], + " Color", + ["punctuation", "{"], + ["annotation", "<>"], + "\n RED\n BLUE\n GREEN\n WHITE\n BLACK\n", + ["punctuation", "}"], + + ["keyword", "classDiagram"], + ["comment", "%% This whole line is a comment classDiagram class Shape <>"], + ["keyword", "class"], + " Shape", + ["punctuation", "{"], + ["annotation", "<>"], + "\n noOfVertices\n draw", + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "}"], + + ["keyword", "classDiagram"], + + ["keyword", "direction"], + " RL\n ", + + ["keyword", "class"], + " Student ", + ["punctuation", "{"], + + "\n -idCard ", + ["operator", ":"], + " IdCard\n ", + + ["punctuation", "}"], + + ["keyword", "class"], + " IdCard", + ["punctuation", "{"], + + "\n -id ", + ["operator", ":"], + " int\n -name ", + ["operator", ":"], + " string\n ", + + ["punctuation", "}"], + + ["keyword", "class"], + " Bike", + ["punctuation", "{"], + + "\n -id ", + ["operator", ":"], + " int\n -name ", + ["operator", ":"], + " string\n ", + + ["punctuation", "}"], + + "\n Student ", + ["string", "\"1\""], + ["arrow", "--o"], + ["string", "\"1\""], + " IdCard ", + ["operator", ":"], + " carries\n Student ", + ["string", "\"1\""], + ["arrow", "--o"], + ["string", "\"1\""], + " Bike ", + ["operator", ":"], + " rides\n\n", + + ["keyword", "action"], + " className ", + ["string", "\"reference\""], + ["string", "\"tooltip\""], + + ["keyword", "click"], + " className call callback", + ["punctuation", "("], + ["punctuation", ")"], + ["string", "\"tooltip\""], + + ["keyword", "click"], + " className href ", + ["string", "\"url\""], + ["string", "\"tooltip\""], + + ["keyword", "classDiagram"], + + ["keyword", "class"], + " Shape\n", + + ["keyword", "link"], + " Shape ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a tooltip for a link\""], + + ["keyword", "class"], + " Shape2\n", + + ["keyword", "click"], + " Shape2 href ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a tooltip for a link\""], + + ["keyword", "classDiagram"], + + ["keyword", "class"], + " Shape\n", + + ["keyword", "callback"], + " Shape ", + ["string", "\"callbackFunction\""], + ["string", "\"This is a tooltip for a callback\""], + + ["keyword", "class"], + " Shape2\n", + + ["keyword", "click"], + " Shape2 call callbackFunction", + ["punctuation", "("], + ["punctuation", ")"], + ["string", "\"This is a tooltip for a callback\""], + + ["keyword", "classDiagram"], + + "\nAnimal ", + ["arrow", "<|--"], + " Duck\nAnimal ", + ["arrow", "<|--"], + " Fish\nAnimal ", + ["arrow", "<|--"], + " Zebra\nAnimal ", + ["operator", ":"], + " +int age\nAnimal ", + ["operator", ":"], + " +String gender\nAnimal", + ["operator", ":"], + " +isMammal", + ["punctuation", "("], + ["punctuation", ")"], + + "\nAnimal", + ["operator", ":"], + " +mate", + ["punctuation", "("], + ["punctuation", ")"], + + ["keyword", "class"], + " Duck", + ["punctuation", "{"], + + "\n +String beakColor\n +swim", + ["punctuation", "("], + ["punctuation", ")"], + + "\n +quack", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["keyword", "class"], + " Fish", + ["punctuation", "{"], + + "\n -int sizeInFeet\n -canEat", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["keyword", "class"], + " Zebra", + ["punctuation", "{"], + + "\n +bool is_wild\n +run", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["keyword", "callback"], + " Duck callback ", + ["string", "\"Tooltip\""], + + ["keyword", "link"], + " Zebra ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a link\""], + + ["keyword", "classDiagram"], + ["keyword", "class"], " Animal", ["operator", ":::"], "cssClass\n\n", + + ["keyword", "classDiagram"], + + ["keyword", "class"], + " Animal", + ["operator", ":::"], + "cssClass ", + ["punctuation", "{"], + + "\n -int sizeInFeet\n -canEat", + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/mermaid/full_erdiagram.test b/package/src/prism/tests/languages/mermaid/full_erdiagram.test new file mode 100644 index 00000000..0e9df45a --- /dev/null +++ b/package/src/prism/tests/languages/mermaid/full_erdiagram.test @@ -0,0 +1,168 @@ +erDiagram + CUSTOMER ||--o{ ORDER : places + ORDER ||--|{ LINE-ITEM : contains + CUSTOMER }|..|{ DELIVERY-ADDRESS : uses + +erDiagram + CUSTOMER ||--o{ ORDER : places + CUSTOMER { + string name + string custNumber + string sector + } + ORDER ||--|{ LINE-ITEM : contains + ORDER { + int orderNumber + string deliveryAddress + } + LINE-ITEM { + string productCode + int quantity + float pricePerUnit + } + +PROPERTY ||--|{ ROOM : contains + +CAR ||--o{ NAMED-DRIVER : allows + PERSON ||--o{ NAMED-DRIVER : is + +erDiagram + CAR ||--o{ NAMED-DRIVER : allows + CAR { + string registrationNumber + string make + string model + } + PERSON ||--o{ NAMED-DRIVER : is + PERSON { + string firstName + string lastName + int age + } + +erDiagram + CAR ||--o{ NAMED-DRIVER : allows + CAR { + string registrationNumber + string make + string model + } + PERSON ||--o{ NAMED-DRIVER : is + PERSON { + string firstName + string lastName + int age + } + +---------------------------------------------------- + +[ + ["keyword", "erDiagram"], + + "\n CUSTOMER ", + ["arrow", "||--o{"], + " ORDER ", + ["operator", ":"], + " places\n ORDER ", + ["arrow", "||--|{"], + " LINE-ITEM ", + ["operator", ":"], + " contains\n CUSTOMER ", + ["arrow", "}|..|{"], + " DELIVERY-ADDRESS ", + ["operator", ":"], + " uses\n\n", + + ["keyword", "erDiagram"], + + "\n CUSTOMER ", + ["arrow", "||--o{"], + " ORDER ", + ["operator", ":"], + " places\n CUSTOMER ", + ["punctuation", "{"], + + "\n string name\n string custNumber\n string sector\n ", + + ["punctuation", "}"], + + "\n ORDER ", + ["arrow", "||--|{"], + " LINE-ITEM ", + ["operator", ":"], + " contains\n ORDER ", + ["punctuation", "{"], + + "\n int orderNumber\n string deliveryAddress\n ", + + ["punctuation", "}"], + + "\n LINE-ITEM ", + ["punctuation", "{"], + + "\n string productCode\n int quantity\n float pricePerUnit\n ", + + ["punctuation", "}"], + + "\n\nPROPERTY ", + ["arrow", "||--|{"], + " ROOM ", + ["operator", ":"], + " contains\n\nCAR ", + ["arrow", "||--o{"], + " NAMED-DRIVER ", + ["operator", ":"], + " allows\n PERSON ", + ["arrow", "||--o{"], + " NAMED-DRIVER ", + ["operator", ":"], + " is\n\n", + + ["keyword", "erDiagram"], + + "\n CAR ", + ["arrow", "||--o{"], + " NAMED-DRIVER ", + ["operator", ":"], + " allows\n CAR ", + ["punctuation", "{"], + + "\n string registrationNumber\n string make\n string model\n ", + + ["punctuation", "}"], + + "\n PERSON ", + ["arrow", "||--o{"], + " NAMED-DRIVER ", + ["operator", ":"], + " is\n PERSON ", + ["punctuation", "{"], + + "\n string firstName\n string lastName\n int age\n ", + + ["punctuation", "}"], + + ["keyword", "erDiagram"], + + "\n CAR ", + ["arrow", "||--o{"], + " NAMED-DRIVER ", + ["operator", ":"], + " allows\n CAR ", + ["punctuation", "{"], + + "\n string registrationNumber\n string make\n string model\n ", + + ["punctuation", "}"], + + "\n PERSON ", + ["arrow", "||--o{"], + " NAMED-DRIVER ", + ["operator", ":"], + " is\n PERSON ", + ["punctuation", "{"], + + "\n string firstName\n string lastName\n int age\n ", + + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/mermaid/full_flowchart.test b/package/src/prism/tests/languages/mermaid/full_flowchart.test new file mode 100644 index 00000000..af96686e --- /dev/null +++ b/package/src/prism/tests/languages/mermaid/full_flowchart.test @@ -0,0 +1,930 @@ +flowchart LR + id + +flowchart LR + id1[This is the text in the box] + +flowchart TD + Start --> Stop + +flowchart LR + Start --> Stop + +flowchart LR + id1(This is the text in the box) + +flowchart LR + id1([This is the text in the box]) + +flowchart LR + id1[[This is the text in the box]] + +flowchart LR + id1[(Database)] + +flowchart LR + id1((This is the text in the circle)) + +flowchart LR + id1>This is the text in the box] + +flowchart LR + id1{This is the text in the box} + +flowchart LR + id1{{This is the text in the box}} + +flowchart TD + id1[/This is the text in the box/] + +flowchart TD + id1[\This is the text in the box\] + +flowchart TD + A[/Christmas\] + +flowchart TD + B[\Go shopping/] + +flowchart LR + A-->B + +flowchart LR + A --- B + +flowchart LR + A-- This is the text! ---B + +flowchart LR + A---|This is the text|B + +flowchart LR + A-->|text|B + +flowchart LR + A-- text -->B + +flowchart LR; + A-.->B; + +flowchart LR + A-. text .-> B + +flowchart LR + A ==> B + +flowchart LR + A == text ==> B + +flowchart LR + A -- text --> B -- text2 --> C + +flowchart LR + a --> b & c--> d + +flowchart TB + A & B--> C & D + +flowchart TB + A --> C + A --> D + B --> C + B --> D + +flowchart LR + A --o B + B --x C + +flowchart LR + A o--o B + B <--> C + C x--x D + +flowchart TD + A[Start] --> B{Is it?}; + B -->|Yes| C[OK]; + C --> D[Rethink]; + D --> B; + B ---->|No| E[End]; + +flowchart TD + A[Start] --> B{Is it?}; + B -- Yes --> C[OK]; + C --> D[Rethink]; + D --> B; + B -- No ----> E[End]; + +flowchart LR + id1["This is the (text) in the box"] + +flowchart LR + A["A double quote:#quot;"] -->B["A dec char:#9829;"] + +subgraph title + graph definition +end + +flowchart TB + c1-->a2 + subgraph one + a1-->a2 + end + subgraph two + b1-->b2 + end + subgraph three + c1-->c2 + end + +flowchart TB + c1-->a2 + subgraph ide1 [one] + a1-->a2 + end + +flowchart TB + c1-->a2 + subgraph one + a1-->a2 + end + subgraph two + b1-->b2 + end + subgraph three + c1-->c2 + end + one --> two + three --> two + two --> c2 + +flowchart LR + subgraph TOP + direction TB + subgraph B1 + direction RL + i1 -->f1 + end + subgraph B2 + direction BT + i2 -->f2 + end + end + A --> TOP --> B + B1 --> B2 + +click nodeId callback +click nodeId call callback() + +flowchart LR; + A-->B; + B-->C; + C-->D; + click A callback "Tooltip for a callback" + click B "http://www.github.com" "This is a tooltip for a link" + click A call callback() "Tooltip for a callback" + click B href "http://www.github.com" "This is a tooltip for a link" + +flowchart LR; + A-->B; + B-->C; + C-->D; + D-->E; + click A "http://www.github.com" _blank + click B "http://www.github.com" "Open this in a new tab" _blank + click C href "http://www.github.com" _blank + click D href "http://www.github.com" "Open this in a new tab" _blank + +flowchart LR +%% this is a comment A -- text --> B{node} + A -- text --> B -- text2 --> C + +linkStyle 3 stroke:#ff3,stroke-width:4px,color:red; + +flowchart LR + id1(Start)-->id2(Stop) + style id1 fill:#f9f,stroke:#333,stroke-width:4px + style id2 fill:#bbf,stroke:#f66,stroke-width:2px,color:#fff,stroke-dasharray: 5 5 + +classDef className fill:#f9f,stroke:#333,stroke-width:4px; + +class nodeId1 className; + +class nodeId1,nodeId2 className; + +flowchart LR + A:::someclass --> B + classDef someclass fill:#f96; + +flowchart LR; + A-->B[AAABBB]; + B-->D; + class A cssClass; + +classDef default fill:#f9f,stroke:#333,stroke-width:4px; + +flowchart TD + B["fa:fa-twitter for peace"] + B-->C[fa:fa-ban forbidden] + B-->D(fa:fa-spinner); + B-->E(A fa:fa-camera-retro perhaps?); + +flowchart LR + A[Hard edge] -->|Link text| B(Round edge) + B --> C{Decision} + C -->|One| D[Result one] + C -->|Two| E[Result two] + + flowchart LR; + A-->B; + B-->C; + C-->D; + click A callback "Tooltip" + click B "http://www.github.com" "This is a link" + click C call callback() "Tooltip" + click D href "http://www.github.com" "This is a link" + +---------------------------------------------------- + +[ + ["keyword", "flowchart"], " LR\n id\n\n", + + ["keyword", "flowchart"], + " LR\n id1", + ["text", "[This is the text in the box]"], + + ["keyword", "flowchart"], + " TD\n Start ", + ["arrow", "-->"], + " Stop\n\n", + + ["keyword", "flowchart"], + " LR\n Start ", + ["arrow", "-->"], + " Stop\n\n", + + ["keyword", "flowchart"], + " LR\n id1", + ["text", "(This is the text in the box)"], + + ["keyword", "flowchart"], + " LR\n id1", + ["text", "([This is the text in the box])"], + + ["keyword", "flowchart"], + " LR\n id1", + ["text", "[[This is the text in the box]]"], + + ["keyword", "flowchart"], " LR\n id1", ["text", "[(Database)]"], + + ["keyword", "flowchart"], + " LR\n id1", + ["text", "((This is the text in the circle))"], + + ["keyword", "flowchart"], + " LR\n id1", + ["text", ">This is the text in the box]"], + + ["keyword", "flowchart"], + " LR\n id1", + ["text", "{This is the text in the box}"], + + ["keyword", "flowchart"], + " LR\n id1", + ["text", "{{This is the text in the box}}"], + + ["keyword", "flowchart"], + " TD\n id1", + ["text", "[/This is the text in the box/]"], + + ["keyword", "flowchart"], + " TD\n id1", + ["text", "[\\This is the text in the box\\]"], + + ["keyword", "flowchart"], " TD\n A", ["text", "[/Christmas\\]"], + + ["keyword", "flowchart"], " TD\n B", ["text", "[\\Go shopping/]"], + + ["keyword", "flowchart"], " LR\n A", ["arrow", "-->"], "B\n\n", + + ["keyword", "flowchart"], " LR\n A ", ["arrow", "---"], " B\n\n", + + ["keyword", "flowchart"], + " LR\n A", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "This is the text!"], + ["arrow", "---"] + ]], + "B\n\n", + + ["keyword", "flowchart"], + " LR\n A", + ["arrow", "---"], + ["label", "|This is the text|"], + "B\n\n", + + ["keyword", "flowchart"], + " LR\n A", + ["arrow", "-->"], + ["label", "|text|"], + "B\n\n", + + ["keyword", "flowchart"], + " LR\n A", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "text"], + ["arrow", "-->"] + ]], + "B\n\n", + + ["keyword", "flowchart"], " LR", ["punctuation", ";"], + "\n A", ["arrow", "-.->"], "B", ["punctuation", ";"], + + ["keyword", "flowchart"], + " LR\n A", + ["inter-arrow-label", [ + ["arrow-head", "-."], + ["label", "text"], + ["arrow", ".->"] + ]], + " B\n\n", + + ["keyword", "flowchart"], " LR\n A ", ["arrow", "==>"], " B\n\n", + + ["keyword", "flowchart"], + " LR\n A ", + ["inter-arrow-label", [ + ["arrow-head", "=="], + ["label", "text"], + ["arrow", "==>"] + ]], + " B\n\n", + + ["keyword", "flowchart"], + " LR\n A ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "text"], + ["arrow", "-->"] + ]], + " B ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "text2"], + ["arrow", "-->"] + ]], + " C\n\n", + + ["keyword", "flowchart"], + " LR\n a ", + ["arrow", "-->"], + " b ", + ["operator", "&"], + " c", + ["arrow", "-->"], + " d\n\n", + + ["keyword", "flowchart"], + " TB\n A ", + ["operator", "&"], + " B", + ["arrow", "-->"], + " C ", + ["operator", "&"], + " D\n\n", + + ["keyword", "flowchart"], + " TB\n A ", + ["arrow", "-->"], + " C\n A ", + ["arrow", "-->"], + " D\n B ", + ["arrow", "-->"], + " C\n B ", + ["arrow", "-->"], + " D\n\n", + + ["keyword", "flowchart"], + " LR\n A ", + ["arrow", "--o"], + " B\n B ", + ["arrow", "--x"], + " C\n\n", + + ["keyword", "flowchart"], + " LR\n A ", + ["arrow", "o--o"], + " B\n B ", + ["arrow", "<-->"], + " C\n C ", + ["arrow", "x--x"], + " D\n\n", + + ["keyword", "flowchart"], + " TD\n A", + ["text", "[Start]"], + ["arrow", "-->"], + " B", + ["text", "{Is it?}"], + ["punctuation", ";"], + + "\n B ", + ["arrow", "-->"], + ["label", "|Yes|"], + " C", + ["text", "[OK]"], + ["punctuation", ";"], + + "\n C ", + ["arrow", "-->"], + " D", + ["text", "[Rethink]"], + ["punctuation", ";"], + + "\n D ", + ["arrow", "-->"], + " B", + ["punctuation", ";"], + + "\n B ", + ["arrow", "---->"], + ["label", "|No|"], + " E", + ["text", "[End]"], + ["punctuation", ";"], + + ["keyword", "flowchart"], + " TD\n A", + ["text", "[Start]"], + ["arrow", "-->"], + " B", + ["text", "{Is it?}"], + ["punctuation", ";"], + + "\n B ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "Yes"], + ["arrow", "-->"] + ]], + " C", + ["text", "[OK]"], + ["punctuation", ";"], + + "\n C ", + ["arrow", "-->"], + " D", + ["text", "[Rethink]"], + ["punctuation", ";"], + + "\n D ", + ["arrow", "-->"], + " B", + ["punctuation", ";"], + + "\n B ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "No"], + ["arrow", "---->"] + ]], + " E", + ["text", "[End]"], + ["punctuation", ";"], + + ["keyword", "flowchart"], + " LR\n id1", + ["text", "[\"This is the (text) in the box\"]"], + + ["keyword", "flowchart"], + " LR\n A", + ["text", "[\"A double quote:#quot;\"]"], + ["arrow", "-->"], + "B", + ["text", "[\"A dec char:#9829;\"]"], + + ["keyword", "subgraph"], " title\n ", + ["keyword", "graph"], " definition\n", + ["keyword", "end"], + + ["keyword", "flowchart"], " TB\n c1", ["arrow", "-->"], "a2\n ", + ["keyword", "subgraph"], " one\n a1", ["arrow", "-->"], "a2\n ", + ["keyword", "end"], + ["keyword", "subgraph"], " two\n b1", ["arrow", "-->"], "b2\n ", + ["keyword", "end"], + ["keyword", "subgraph"], " three\n c1", ["arrow", "-->"], "c2\n ", + ["keyword", "end"], + + ["keyword", "flowchart"], " TB\n c1", ["arrow", "-->"], "a2\n ", + ["keyword", "subgraph"], " ide1 ", ["text", "[one]"], + "\n a1", ["arrow", "-->"], "a2\n ", + ["keyword", "end"], + + ["keyword", "flowchart"], + " TB\n c1", + ["arrow", "-->"], + "a2\n ", + + ["keyword", "subgraph"], + " one\n a1", + ["arrow", "-->"], + "a2\n ", + + ["keyword", "end"], + + ["keyword", "subgraph"], + " two\n b1", + ["arrow", "-->"], + "b2\n ", + + ["keyword", "end"], + + ["keyword", "subgraph"], + " three\n c1", + ["arrow", "-->"], + "c2\n ", + + ["keyword", "end"], + + "\n one ", + ["arrow", "-->"], + " two\n three ", + ["arrow", "-->"], + " two\n two ", + ["arrow", "-->"], + " c2\n\n", + + ["keyword", "flowchart"], + " LR\n ", + + ["keyword", "subgraph"], + " TOP\n ", + + ["keyword", "direction"], + " TB\n ", + + ["keyword", "subgraph"], + " B1\n ", + + ["keyword", "direction"], + " RL\n i1 ", + ["arrow", "-->"], + "f1\n ", + + ["keyword", "end"], + + ["keyword", "subgraph"], + " B2\n ", + + ["keyword", "direction"], + " BT\n i2 ", + ["arrow", "-->"], + "f2\n ", + + ["keyword", "end"], + + ["keyword", "end"], + + "\n A ", + ["arrow", "-->"], + " TOP ", + ["arrow", "-->"], + " B\n B1 ", + ["arrow", "-->"], + " B2\n\n", + + ["keyword", "click"], + " nodeId callback\n", + + ["keyword", "click"], + " nodeId call callback", + ["punctuation", "("], + ["punctuation", ")"], + + ["keyword", "flowchart"], + " LR", + ["punctuation", ";"], + + "\n A", + ["arrow", "-->"], + "B", + ["punctuation", ";"], + + "\n B", + ["arrow", "-->"], + "C", + ["punctuation", ";"], + + "\n C", + ["arrow", "-->"], + "D", + ["punctuation", ";"], + + ["keyword", "click"], + " A callback ", + ["string", "\"Tooltip for a callback\""], + + ["keyword", "click"], + " B ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a tooltip for a link\""], + + ["keyword", "click"], + " A call callback", + ["punctuation", "("], + ["punctuation", ")"], + ["string", "\"Tooltip for a callback\""], + + ["keyword", "click"], + " B href ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a tooltip for a link\""], + + ["keyword", "flowchart"], + " LR", + ["punctuation", ";"], + + "\n A", + ["arrow", "-->"], + "B", + ["punctuation", ";"], + + "\n B", + ["arrow", "-->"], + "C", + ["punctuation", ";"], + + "\n C", + ["arrow", "-->"], + "D", + ["punctuation", ";"], + + "\n D", + ["arrow", "-->"], + "E", + ["punctuation", ";"], + + ["keyword", "click"], + " A ", + ["string", "\"http://www.github.com\""], + " _blank\n ", + + ["keyword", "click"], + " B ", + ["string", "\"http://www.github.com\""], + ["string", "\"Open this in a new tab\""], + " _blank\n ", + + ["keyword", "click"], + " C href ", + ["string", "\"http://www.github.com\""], + " _blank\n ", + + ["keyword", "click"], + " D href ", + ["string", "\"http://www.github.com\""], + ["string", "\"Open this in a new tab\""], + " _blank\n\n", + + ["keyword", "flowchart"], + " LR\n", + + ["comment", "%% this is a comment A -- text --> B{node}"], + + "\n A ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "text"], + ["arrow", "-->"] + ]], + " B ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "text2"], + ["arrow", "-->"] + ]], + " C\n\n", + + ["keyword", "linkStyle"], + " 3 ", + ["style", [ + ["property", "stroke"], + ["operator", ":"], + "#ff3", + ["punctuation", ","], + ["property", "stroke-width"], + ["operator", ":"], + "4px", + ["punctuation", ","], + ["property", "color"], + ["operator", ":"], + "red" + ]], + ["punctuation", ";"], + + ["keyword", "flowchart"], + " LR\n id1", + ["text", "(Start)"], + ["arrow", "-->"], + "id2", + ["text", "(Stop)"], + + ["keyword", "style"], + " id1 ", + ["style", [ + ["property", "fill"], + ["operator", ":"], + "#f9f", + ["punctuation", ","], + ["property", "stroke"], + ["operator", ":"], + "#333", + ["punctuation", ","], + ["property", "stroke-width"], + ["operator", ":"], + "4px" + ]], + + ["keyword", "style"], + " id2 ", + ["style", [ + ["property", "fill"], + ["operator", ":"], + "#bbf", + ["punctuation", ","], + ["property", "stroke"], + ["operator", ":"], + "#f66", + ["punctuation", ","], + ["property", "stroke-width"], + ["operator", ":"], + "2px", + ["punctuation", ","], + ["property", "color"], + ["operator", ":"], + "#fff", + ["punctuation", ","], + ["property", "stroke-dasharray"], + ["operator", ":"], + " 5 5" + ]], + + ["keyword", "classDef"], + " className ", + ["style", [ + ["property", "fill"], + ["operator", ":"], + "#f9f", + ["punctuation", ","], + ["property", "stroke"], + ["operator", ":"], + "#333", + ["punctuation", ","], + ["property", "stroke-width"], + ["operator", ":"], + "4px" + ]], + ["punctuation", ";"], + + ["keyword", "class"], " nodeId1 className", ["punctuation", ";"], + + ["keyword", "class"], " nodeId1,nodeId2 className", ["punctuation", ";"], + + ["keyword", "flowchart"], + " LR\n A", + ["operator", ":::"], + "someclass ", + ["arrow", "-->"], + " B\n ", + + ["keyword", "classDef"], + " someclass ", + ["style", [ + ["property", "fill"], + ["operator", ":"], + "#f96" + ]], + ["punctuation", ";"], + + ["keyword", "flowchart"], + " LR", + ["punctuation", ";"], + + "\n A", + ["arrow", "-->"], + "B", + ["text", "[AAABBB]"], + ["punctuation", ";"], + + "\n B", + ["arrow", "-->"], + "D", + ["punctuation", ";"], + + ["keyword", "class"], + " A cssClass", + ["punctuation", ";"], + + ["keyword", "classDef"], + " default ", + ["style", [ + ["property", "fill"], + ["operator", ":"], + "#f9f", + ["punctuation", ","], + ["property", "stroke"], + ["operator", ":"], + "#333", + ["punctuation", ","], + ["property", "stroke-width"], + ["operator", ":"], + "4px" + ]], + ["punctuation", ";"], + + ["keyword", "flowchart"], + " TD\n B", + ["text", "[\"fa:fa-twitter for peace\"]"], + + "\n B", + ["arrow", "-->"], + "C", + ["text", "[fa:fa-ban forbidden]"], + + "\n B", + ["arrow", "-->"], + "D", + ["text", "(fa:fa-spinner)"], + ["punctuation", ";"], + + "\n B", + ["arrow", "-->"], + "E", + ["text", "(A fa:fa-camera-retro perhaps?)"], + ["punctuation", ";"], + + ["keyword", "flowchart"], + " LR\n A", + ["text", "[Hard edge]"], + ["arrow", "-->"], + ["label", "|Link text|"], + " B", + ["text", "(Round edge)"], + + "\n B ", + ["arrow", "-->"], + " C", + ["text", "{Decision}"], + + "\n C ", + ["arrow", "-->"], + ["label", "|One|"], + " D", + ["text", "[Result one]"], + + "\n C ", + ["arrow", "-->"], + ["label", "|Two|"], + " E", + ["text", "[Result two]"], + + ["keyword", "flowchart"], + " LR", + ["punctuation", ";"], + + "\n A", + ["arrow", "-->"], + "B", + ["punctuation", ";"], + + "\n B", + ["arrow", "-->"], + "C", + ["punctuation", ";"], + + "\n C", + ["arrow", "-->"], + "D", + ["punctuation", ";"], + + ["keyword", "click"], + " A callback ", + ["string", "\"Tooltip\""], + + ["keyword", "click"], + " B ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a link\""], + + ["keyword", "click"], + " C call callback", + ["punctuation", "("], + ["punctuation", ")"], + ["string", "\"Tooltip\""], + + ["keyword", "click"], + " D href ", + ["string", "\"http://www.github.com\""], + ["string", "\"This is a link\""] +] diff --git a/package/src/prism/tests/languages/mermaid/full_sequencediagram.test b/package/src/prism/tests/languages/mermaid/full_sequencediagram.test new file mode 100644 index 00000000..6b79ba85 --- /dev/null +++ b/package/src/prism/tests/languages/mermaid/full_sequencediagram.test @@ -0,0 +1,389 @@ +sequenceDiagram + Alice->>John: Hello John, how are you? + John-->>Alice: Great! + Alice-)John: See you later! + +sequenceDiagram + participant John + participant Alice + Alice->>John: Hello John, how are you? + John-->>Alice: Great! + +sequenceDiagram + participant A as Alice + participant J as John + A->>J: Hello John, how are you? + J->>A: Great! + +[Actor][Arrow][Actor]:Message text + +sequenceDiagram + Alice->>John: Hello John, how are you? + activate John + John-->>Alice: Great! + deactivate John + +sequenceDiagram + Alice->>+John: Hello John, how are you? + John-->>-Alice: Great! + +sequenceDiagram + Alice->>+John: Hello John, how are you? + Alice->>+John: John, can you hear me? + John-->>-Alice: Hi Alice, I can hear you! + John-->>-Alice: I feel great! + +sequenceDiagram + participant John + Note right of John: Text in note + +sequenceDiagram + Alice->John: Hello John, how are you? + Note over Alice,John: A typical interaction + +loop Loop text +... statements ... +end + +sequenceDiagram + Alice->John: Hello John, how are you? + loop Every minute + John-->Alice: Great! + end + +alt Describing text +... statements ... +else +... statements ... +end + +opt Describing text +... statements ... +end + +sequenceDiagram + Alice->>Bob: Hello Bob, how are you? + alt is sick + Bob->>Alice: Not so good :( + else is well + Bob->>Alice: Feeling fresh like a daisy + end + opt Extra response + Bob->>Alice: Thanks for asking + end + +par [Action 1] +... statements ... +and [Action 2] +... statements ... +and [Action N] +... statements ... +end + +rect rgb(0, 255, 0) +... content ... +end + +rect rgba(0, 0, 255, .1) +... content ... +end + +sequenceDiagram + Alice->>John: Hello John, how are you? + %% this is a comment + John-->>Alice: Great! + +sequenceDiagram + A->>B: I #9829; you! + B->>A: I #9829; you #infin; times more! + +sequenceDiagram + autonumber + Alice->>John: Hello John, how are you? + loop Healthcheck + John->>John: Fight against hypochondria + end + Note right of John: Rational thoughts! + John-->>Alice: Great! + John->>Bob: How about you? + Bob-->>John: Jolly good! + +---------------------------------------------------- + +[ + ["keyword", "sequenceDiagram"], + + "\n Alice", + ["arrow", "->>"], + "John", + ["operator", ":"], + " Hello John, how are you?\n John", + ["arrow", "-->>"], + "Alice", + ["operator", ":"], + " Great!\n Alice", + ["arrow", "-)"], + "John", + ["operator", ":"], + " See you later!\n\n", + + ["keyword", "sequenceDiagram"], + + ["keyword", "participant"], + " John\n ", + + ["keyword", "participant"], + " Alice\n Alice", + ["arrow", "->>"], + "John", + ["operator", ":"], + " Hello John, how are you?\n John", + ["arrow", "-->>"], + "Alice", + ["operator", ":"], + " Great!\n\n", + + ["keyword", "sequenceDiagram"], + + ["keyword", "participant"], + " A as Alice\n ", + + ["keyword", "participant"], + " J as John\n A", + ["arrow", "->>"], + "J", + ["operator", ":"], + " Hello John, how are you?\n J", + ["arrow", "->>"], + "A", + ["operator", ":"], + " Great!\n\n", + + ["text", "[Actor]"], + ["text", "[Arrow]"], + ["text", "[Actor]"], + ["operator", ":"], + "Message text\n\n", + + ["keyword", "sequenceDiagram"], + + "\n Alice", + ["arrow", "->>"], + "John", + ["operator", ":"], + " Hello John, how are you?\n ", + + ["keyword", "activate"], + " John\n John", + ["arrow", "-->>"], + "Alice", + ["operator", ":"], + " Great!\n ", + + ["keyword", "deactivate"], + " John\n\n", + + ["keyword", "sequenceDiagram"], + + "\n Alice", + ["arrow", "->>"], + "+John", + ["operator", ":"], + " Hello John, how are you?\n John", + ["arrow", "-->>"], + "-Alice", + ["operator", ":"], + " Great!\n\n", + + ["keyword", "sequenceDiagram"], + + "\n Alice", + ["arrow", "->>"], + "+John", + ["operator", ":"], + " Hello John, how are you?\n Alice", + ["arrow", "->>"], + "+John", + ["operator", ":"], + " John, can you hear me?\n John", + ["arrow", "-->>"], + "-Alice", + ["operator", ":"], + " Hi Alice, I can hear you!\n John", + ["arrow", "-->>"], + "-Alice", + ["operator", ":"], + " I feel great!\n\n", + + ["keyword", "sequenceDiagram"], + + ["keyword", "participant"], + " John\n ", + + ["keyword", "Note right of"], + " John", + ["operator", ":"], + " Text in note\n\n", + + ["keyword", "sequenceDiagram"], + + "\n Alice", + ["arrow", "->"], + "John", + ["operator", ":"], + " Hello John, how are you?\n ", + + ["keyword", "Note over"], + " Alice,John", + ["operator", ":"], + " A typical interaction\n\n", + + ["keyword", "loop"], " Loop text\n... statements ...\n", + ["keyword", "end"], + + ["keyword", "sequenceDiagram"], + + "\n Alice", + ["arrow", "->"], + "John", + ["operator", ":"], + " Hello John, how are you?\n ", + + ["keyword", "loop"], + " Every minute\n John", + ["arrow", "-->"], + "Alice", + ["operator", ":"], + " Great!\n ", + + ["keyword", "end"], + + ["keyword", "alt"], " Describing text\n... statements ...\n", + ["keyword", "else"], + "\n... statements ...\n", + ["keyword", "end"], + + ["keyword", "opt"], " Describing text\n... statements ...\n", + ["keyword", "end"], + + ["keyword", "sequenceDiagram"], + + "\n Alice", + ["arrow", "->>"], + "Bob", + ["operator", ":"], + " Hello Bob, how are you?\n ", + + ["keyword", "alt"], + " is sick\n Bob", + ["arrow", "->>"], + "Alice", + ["operator", ":"], + " Not so good ", + ["operator", ":"], + ["punctuation", "("], + + ["keyword", "else"], + " is well\n Bob", + ["arrow", "->>"], + "Alice", + ["operator", ":"], + " Feeling fresh like a daisy\n ", + + ["keyword", "end"], + + ["keyword", "opt"], + " Extra response\n Bob", + ["arrow", "->>"], + "Alice", + ["operator", ":"], + " Thanks for asking\n ", + + ["keyword", "end"], + + ["keyword", "par"], ["text", "[Action 1]"], + "\n... statements ...\n", + ["keyword", "and"], ["text", "[Action 2]"], + "\n... statements ...\n", + ["keyword", "and"], ["text", "[Action N]"], + "\n... statements ...\n", + ["keyword", "end"], + + ["keyword", "rect"], " rgb", ["text", "(0, 255, 0)"], + "\n... content ...\n", + ["keyword", "end"], + + ["keyword", "rect"], " rgba", ["text", "(0, 0, 255, .1)"], + "\n... content ...\n", + ["keyword", "end"], + + ["keyword", "sequenceDiagram"], + + "\n Alice", + ["arrow", "->>"], + "John", + ["operator", ":"], + " Hello John, how are you?\n ", + + ["comment", "%% this is a comment"], + + "\n John", + ["arrow", "-->>"], + "Alice", + ["operator", ":"], + " Great!\n\n", + + ["keyword", "sequenceDiagram"], + + "\n A", + ["arrow", "->>"], + "B", + ["operator", ":"], + " I ", + ["entity", "#9829;"], + " you!\n B", + ["arrow", "->>"], + "A", + ["operator", ":"], + " I ", + ["entity", "#9829;"], + " you ", + ["entity", "#infin;"], + " times more!\n\n", + + ["keyword", "sequenceDiagram"], + + ["keyword", "autonumber"], + + "\n Alice", + ["arrow", "->>"], + "John", + ["operator", ":"], + " Hello John, how are you?\n ", + + ["keyword", "loop"], + " Healthcheck\n John", + ["arrow", "->>"], + "John", + ["operator", ":"], + " Fight against hypochondria\n ", + + ["keyword", "end"], + + ["keyword", "Note right of"], + " John", + ["operator", ":"], + " Rational thoughts!\n John", + ["arrow", "-->>"], + "Alice", + ["operator", ":"], + " Great!\n John", + ["arrow", "->>"], + "Bob", + ["operator", ":"], + " How about you?\n Bob", + ["arrow", "-->>"], + "John", + ["operator", ":"], + " Jolly good!" +] diff --git a/package/src/prism/tests/languages/mermaid/full_statediagram.test b/package/src/prism/tests/languages/mermaid/full_statediagram.test new file mode 100644 index 00000000..7aed289f --- /dev/null +++ b/package/src/prism/tests/languages/mermaid/full_statediagram.test @@ -0,0 +1,430 @@ +stateDiagram-v2 + [*] --> Still + Still --> [*] + + Still --> Moving + Moving --> Still + Moving --> Crash + Crash --> [*] + +stateDiagram-v2 + s1 --> s2 + +stateDiagram-v2 + s1 --> s2: A transition + +stateDiagram-v2 + [*] --> s1 + s1 --> [*] + +stateDiagram-v2 + [*] --> First + state First { + [*] --> second + second --> [*] + } + +stateDiagram-v2 + [*] --> First + + state First { + [*] --> Second + + state Second { + [*] --> second + second --> Third + + state Third { + [*] --> third + third --> [*] + } + } + } + +stateDiagram-v2 + [*] --> First + First --> Second + First --> Third + + state First { + [*] --> fir + fir --> [*] + } + state Second { + [*] --> sec + sec --> [*] + } + state Third { + [*] --> thi + thi --> [*] + } + +stateDiagram-v2 + state if_state <> + [*] --> IsPositive + IsPositive --> if_state + if_state --> False: if n < 0 + if_state --> True : if n >= 0 + +stateDiagram-v2 + state fork_state <> + [*] --> fork_state + fork_state --> State2 + fork_state --> State3 + + state join_state <> + State2 --> join_state + State3 --> join_state + join_state --> State4 + State4 --> [*] + +stateDiagram-v2 + State1: The state with a note + note right of State1 + Important information! You can write + notes. + end note + State1 --> State2 + note left of State2 : This is the note to the left. + +stateDiagram-v2 + [*] --> Active + + state Active { + [*] --> NumLockOff + NumLockOff --> NumLockOn : EvNumLockPressed + NumLockOn --> NumLockOff : EvNumLockPressed + -- + [*] --> CapsLockOff + CapsLockOff --> CapsLockOn : EvCapsLockPressed + CapsLockOn --> CapsLockOff : EvCapsLockPressed + -- + [*] --> ScrollLockOff + ScrollLockOff --> ScrollLockOn : EvScrollLockPressed + ScrollLockOn --> ScrollLockOff : EvScrollLockPressed + } + +stateDiagram + direction LR + [*] --> A + A --> B + B --> C + state B { + direction LR + a --> b + } + B --> D + +stateDiagram-v2 + [*] --> Still + Still --> [*] +%% this is a comment + Still --> Moving + Moving --> Still %% another comment + Moving --> Crash + Crash --> [*] + +---------------------------------------------------- + +[ + ["keyword", "stateDiagram-v2"], + + ["text", "[*]"], + ["arrow", "-->"], + " Still\n Still ", + ["arrow", "-->"], + ["text", "[*]"], + + "\n\n Still ", + ["arrow", "-->"], + " Moving\n Moving ", + ["arrow", "-->"], + " Still\n Moving ", + ["arrow", "-->"], + " Crash\n Crash ", + ["arrow", "-->"], + ["text", "[*]"], + + ["keyword", "stateDiagram-v2"], + "\n s1 ", ["arrow", "-->"], " s2\n\n", + + ["keyword", "stateDiagram-v2"], + + "\n s1 ", + ["arrow", "-->"], + " s2", + ["operator", ":"], + " A transition\n\n", + + ["keyword", "stateDiagram-v2"], + + ["text", "[*]"], + ["arrow", "-->"], + " s1\n s1 ", + ["arrow", "-->"], + ["text", "[*]"], + + ["keyword", "stateDiagram-v2"], + + ["text", "[*]"], + ["arrow", "-->"], + " First\n ", + + ["keyword", "state"], + " First ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " second\n second ", + ["arrow", "-->"], + ["text", "[*]"], + + ["punctuation", "}"], + + ["keyword", "stateDiagram-v2"], + ["text", "[*]"], ["arrow", "-->"], " First\n\n ", + + ["keyword", "state"], " First ", ["punctuation", "{"], + ["text", "[*]"], ["arrow", "-->"], " Second\n\n ", + + ["keyword", "state"], + " Second ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " second\n second ", + ["arrow", "-->"], + " Third\n\n ", + + ["keyword", "state"], + " Third ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " third\n third ", + ["arrow", "-->"], + ["text", "[*]"], + + ["punctuation", "}"], + + ["punctuation", "}"], + + ["punctuation", "}"], + + ["keyword", "stateDiagram-v2"], + + ["text", "[*]"], + ["arrow", "-->"], + " First\n First ", + ["arrow", "-->"], + " Second\n First ", + ["arrow", "-->"], + " Third\n\n ", + + ["keyword", "state"], + " First ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " fir\n fir ", + ["arrow", "-->"], + ["text", "[*]"], + + ["punctuation", "}"], + + ["keyword", "state"], + " Second ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " sec\n sec ", + ["arrow", "-->"], + ["text", "[*]"], + + ["punctuation", "}"], + + ["keyword", "state"], + " Third ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " thi\n thi ", + ["arrow", "-->"], + ["text", "[*]"], + + ["punctuation", "}"], + + ["keyword", "stateDiagram-v2"], + + ["keyword", "state"], + " if_state ", + ["annotation", "<>"], + + ["text", "[*]"], + ["arrow", "-->"], + " IsPositive\n IsPositive ", + ["arrow", "-->"], + " if_state\n if_state ", + ["arrow", "-->"], + " False", + ["operator", ":"], + " if n < 0\n if_state ", + ["arrow", "-->"], + " True ", + ["operator", ":"], + " if n >= 0\n\n", + + ["keyword", "stateDiagram-v2"], + + ["keyword", "state"], + " fork_state ", + ["annotation", "<>"], + + ["text", "[*]"], + ["arrow", "-->"], + " fork_state\n fork_state ", + ["arrow", "-->"], + " State2\n fork_state ", + ["arrow", "-->"], + " State3\n\n ", + + ["keyword", "state"], + " join_state ", + ["annotation", "<>"], + + "\n State2 ", + ["arrow", "-->"], + " join_state\n State3 ", + ["arrow", "-->"], + " join_state\n join_state ", + ["arrow", "-->"], + " State4\n State4 ", + ["arrow", "-->"], + ["text", "[*]"], + + ["keyword", "stateDiagram-v2"], + + "\n State1", + ["operator", ":"], + " The state with a note\n ", + + ["keyword", "note right of"], + " State1\n Important information! You can write\n notes.\n ", + + ["keyword", "end note"], + + "\n State1 ", + ["arrow", "-->"], + " State2\n ", + + ["keyword", "note left of"], + " State2 ", + ["operator", ":"], + " This is the note to the left.\n\n", + + ["keyword", "stateDiagram-v2"], + ["text", "[*]"], ["arrow", "-->"], " Active\n\n ", + + ["keyword", "state"], + " Active ", + ["punctuation", "{"], + + ["text", "[*]"], + ["arrow", "-->"], + " NumLockOff\n NumLockOff ", + ["arrow", "-->"], + " NumLockOn ", + ["operator", ":"], + " EvNumLockPressed\n NumLockOn ", + ["arrow", "-->"], + " NumLockOff ", + ["operator", ":"], + " EvNumLockPressed\n ", + + ["arrow", "--"], + + ["text", "[*]"], + ["arrow", "-->"], + " CapsLockOff\n CapsLockOff ", + ["arrow", "-->"], + " CapsLockOn ", + ["operator", ":"], + " EvCapsLockPressed\n CapsLockOn ", + ["arrow", "-->"], + " CapsLockOff ", + ["operator", ":"], + " EvCapsLockPressed\n ", + + ["arrow", "--"], + + ["text", "[*]"], + ["arrow", "-->"], + " ScrollLockOff\n ScrollLockOff ", + ["arrow", "-->"], + " ScrollLockOn ", + ["operator", ":"], + " EvScrollLockPressed\n ScrollLockOn ", + ["arrow", "-->"], + " ScrollLockOff ", + ["operator", ":"], + " EvScrollLockPressed\n ", + + ["punctuation", "}"], + + ["keyword", "stateDiagram"], + + ["keyword", "direction"], + " LR\n ", + + ["text", "[*]"], + ["arrow", "-->"], + " A\n A ", + ["arrow", "-->"], + " B\n B ", + ["arrow", "-->"], + " C\n ", + + ["keyword", "state"], + " B ", + ["punctuation", "{"], + + ["keyword", "direction"], + " LR\n a ", + ["arrow", "-->"], + " b\n ", + + ["punctuation", "}"], + + "\n B ", + ["arrow", "-->"], + " D\n\n", + + ["keyword", "stateDiagram-v2"], + + ["text", "[*]"], + ["arrow", "-->"], + " Still\n Still ", + ["arrow", "-->"], + ["text", "[*]"], + + ["comment", "%% this is a comment"], + + "\n Still ", + ["arrow", "-->"], + " Moving\n Moving ", + ["arrow", "-->"], + " Still ", + ["comment", "%% another comment"], + + "\n Moving ", + ["arrow", "-->"], + " Crash\n Crash ", + ["arrow", "-->"], + ["text", "[*]"] +] diff --git a/package/src/prism/tests/languages/mermaid/inter-arrow-label_feature.test b/package/src/prism/tests/languages/mermaid/inter-arrow-label_feature.test new file mode 100644 index 00000000..40e8a33c --- /dev/null +++ b/package/src/prism/tests/languages/mermaid/inter-arrow-label_feature.test @@ -0,0 +1,62 @@ +A -.s .- C +A -. s .- C +A -. "asdasd" .- C +A -- "asdasd" --> C +A -- "asdasd" --> C +A -- "asdasd" .- C +A -- "asdasd" === C +A -- "asdasd" ==> C + +---------------------------------------------------- + +[ + "A ", + ["inter-arrow-label", [ + ["arrow-head", "-."], + ["label", "s"], + ["arrow", ".-"] + ]], + " C\nA ", + ["inter-arrow-label", [ + ["arrow-head", "-."], + ["label", "s"], + ["arrow", ".-"] + ]], + " C\nA ", + ["inter-arrow-label", [ + ["arrow-head", "-."], + ["label", "\"asdasd\""], + ["arrow", ".-"] + ]], + " C\nA ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "\"asdasd\""], + ["arrow", "-->"] + ]], + " C\nA ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "\"asdasd\""], + ["arrow", "-->"] + ]], + " C\nA ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "\"asdasd\""], + ["arrow", ".-"] + ]], + " C\nA ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "\"asdasd\""], + ["arrow", "==="] + ]], + " C\nA ", + ["inter-arrow-label", [ + ["arrow-head", "--"], + ["label", "\"asdasd\""], + ["arrow", "==>"] + ]], + " C" +] diff --git a/package/src/prism/tests/languages/mermaid/operator_feature.test b/package/src/prism/tests/languages/mermaid/operator_feature.test new file mode 100644 index 00000000..b48efb94 --- /dev/null +++ b/package/src/prism/tests/languages/mermaid/operator_feature.test @@ -0,0 +1,11 @@ +A & B + +: ::: + +---------------------------------------------------- + +[ + "A ", ["operator", "&"], " B\n\n", + + ["operator", ":"], ["operator", ":::"] +] diff --git a/package/src/prism/tests/languages/metafont/boolean_feature.test b/package/src/prism/tests/languages/metafont/boolean_feature.test new file mode 100644 index 00000000..496578fe --- /dev/null +++ b/package/src/prism/tests/languages/metafont/boolean_feature.test @@ -0,0 +1,12 @@ +true false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/metafont/command_feature.test b/package/src/prism/tests/languages/metafont/command_feature.test new file mode 100644 index 00000000..c130fef0 --- /dev/null +++ b/package/src/prism/tests/languages/metafont/command_feature.test @@ -0,0 +1,68 @@ +addto +batchmode +charlist cull +display +errhelp errmessage errorstopmode everyjob extensible +fontdimen +headerbyte +inner interim +let ligtable +message +newinternal nonstopmode numspecial +openwindow outer +randomseed +save scrollmode show showdependencies showstats showtoken showvariable shipout special + +---------------------------------------------------- + +[ + ["command", "addto"], + + ["command", "batchmode"], + + ["command", "charlist"], + ["command", "cull"], + + ["command", "display"], + + ["command", "errhelp"], + ["command", "errmessage"], + ["command", "errorstopmode"], + ["command", "everyjob"], + ["command", "extensible"], + + ["command", "fontdimen"], + + ["command", "headerbyte"], + + ["command", "inner"], + ["command", "interim"], + + ["command", "let"], + ["command", "ligtable"], + + ["command", "message"], + + ["command", "newinternal"], + ["command", "nonstopmode"], + ["command", "numspecial"], + + ["command", "openwindow"], + ["command", "outer"], + + ["command", "randomseed"], + + ["command", "save"], + ["command", "scrollmode"], + ["command", "show"], + ["command", "showdependencies"], + ["command", "showstats"], + ["command", "showtoken"], + ["command", "showvariable"], + ["command", "shipout"], + ["command", "special"] +] + +---------------------------------------------------- + +Checks for commands. \ No newline at end of file diff --git a/package/src/prism/tests/languages/metafont/constant_feature.test b/package/src/prism/tests/languages/metafont/constant_feature.test new file mode 100644 index 00000000..9085a2fb --- /dev/null +++ b/package/src/prism/tests/languages/metafont/constant_feature.test @@ -0,0 +1,97 @@ +% Length constants +bp cc cm dd in mm pc pt + +% Pair constants +down left origin right up + +% Numeric constants +eps epsilon infinity _ % _ is -1, as per Knuth: "internal constant to make macros unreadable but shorter" + +% Path constants +fullcircle halfcircle quartercircle unitsquare + +% Pen constant +nullpen penrazor penspeck pensquare penstroke + +% Picture constants +blankpicture nullpicture unitpixel + +% String constant +ditto + +% Transform constant +identity + +% Other constants +proof relax smoke \ \\ ??? + +---------------------------------------------------- + +[ + ["comment", "% Length constants"], + + ["constant", "bp"], + ["constant", "cc"], + ["constant", "cm"], + ["constant", "dd"], + ["constant", "in"], + ["constant", "mm"], + ["constant", "pc"], + ["constant", "pt"], + + ["comment", "% Pair constants"], + + ["constant", "down"], + ["constant", "left"], + ["constant", "origin"], + ["constant", "right"], + ["constant", "up"], + + ["comment", "% Numeric constants"], + + ["constant", "eps"], + ["constant", "epsilon"], + ["constant", "infinity"], + ["constant", "_"], + ["comment", "% _ is -1, as per Knuth: \"internal constant to make macros unreadable but shorter\""], + + ["comment", "% Path constants"], + + ["constant", "fullcircle"], + ["constant", "halfcircle"], + ["constant", "quartercircle"], + ["constant", "unitsquare"], + + ["comment", "% Pen constant"], + + ["constant", "nullpen"], + ["constant", "penrazor"], + ["constant", "penspeck"], + ["constant", "pensquare"], + ["constant", "penstroke"], + + ["comment", "% Picture constants"], + + ["constant", "blankpicture"], + ["constant", "nullpicture"], + ["constant", "unitpixel"], + + ["comment", "% String constant"], + ["constant", "ditto"], + + ["comment", "% Transform constant"], + ["constant", "identity"], + + ["comment", "% Other constants"], + + ["constant", "proof"], + ["constant", "relax"], + ["constant", "smoke"], + ["constant", "\\"], + ["constant", "\\\\"], + ["constant", "???"] +] + +---------------------------------------------------- + +Checks for constants best not to be redefined. \ No newline at end of file diff --git a/package/src/prism/tests/languages/metafont/internal_quantity_feature.test b/package/src/prism/tests/languages/metafont/internal_quantity_feature.test new file mode 100644 index 00000000..301ab8cd --- /dev/null +++ b/package/src/prism/tests/languages/metafont/internal_quantity_feature.test @@ -0,0 +1,96 @@ +autorounding +boundarychar +charcode chardp chardx chardy charext charht charic charwd +day designsize +fillin fontmaking +granularity +hppp +month +pausing proofing +showstopping smoothing +time tracingcapsules tracingchoices tracingcommands tracingedges tracingequations tracingmacros tracingonline tracingoutput tracingpens tracingrestores tracingspecs tracingstats tracingtitles turningcheck +vppp +warningcheck +xoffset +year yoffset + +% From PlainMETAFONT +blacker currentwindow displaying join_radius o_correction pen_bot pen_lft pen_rt pen_top pixels_per_inch tolerance + +---------------------------------------------------- + +[ + ["quantity", "autorounding"], + + ["quantity", "boundarychar"], + + ["quantity", "charcode"], + ["quantity", "chardp"], + ["quantity", "chardx"], + ["quantity", "chardy"], + ["quantity", "charext"], + ["quantity", "charht"], + ["quantity", "charic"], + ["quantity", "charwd"], + + ["quantity", "day"], + ["quantity", "designsize"], + + ["quantity", "fillin"], + ["quantity", "fontmaking"], + + ["quantity", "granularity"], + + ["quantity", "hppp"], + + ["quantity", "month"], + + ["quantity", "pausing"], + ["quantity", "proofing"], + + ["quantity", "showstopping"], + ["quantity", "smoothing"], + + ["quantity", "time"], + ["quantity", "tracingcapsules"], + ["quantity", "tracingchoices"], + ["quantity", "tracingcommands"], + ["quantity", "tracingedges"], + ["quantity", "tracingequations"], + ["quantity", "tracingmacros"], + ["quantity", "tracingonline"], + ["quantity", "tracingoutput"], + ["quantity", "tracingpens"], + ["quantity", "tracingrestores"], + ["quantity", "tracingspecs"], + ["quantity", "tracingstats"], + ["quantity", "tracingtitles"], + ["quantity", "turningcheck"], + + ["quantity", "vppp"], + + ["quantity", "warningcheck"], + + ["quantity", "xoffset"], + + ["quantity", "year"], + ["quantity", "yoffset"], + + ["comment", "% From PlainMETAFONT"], + + ["quantity", "blacker"], + ["quantity", "currentwindow"], + ["quantity", "displaying"], + ["quantity", "join_radius"], + ["quantity", "o_correction"], + ["quantity", "pen_bot"], + ["quantity", "pen_lft"], + ["quantity", "pen_rt"], + ["quantity", "pen_top"], + ["quantity", "pixels_per_inch"], + ["quantity", "tolerance"] +] + +---------------------------------------------------- + +Checks for internal quantities. \ No newline at end of file diff --git a/package/src/prism/tests/languages/metafont/keywords_feature.test b/package/src/prism/tests/languages/metafont/keywords_feature.test new file mode 100644 index 00000000..11e33b2f --- /dev/null +++ b/package/src/prism/tests/languages/metafont/keywords_feature.test @@ -0,0 +1,104 @@ +also at atleast +begingroup +charexists contour controls curl cycle +def delimiters doublepath dropping dump +else elseif end enddef endfor endgroup endinput exitif exitunless expandafter +fi for forever forsuffixes from +if input inwindow +keeping kern +of +primarydef +quote +readstring +scaled scantokens secondarydef shifted skipto slanted step +tension tertiarydef to transformed +until +vardef +withpen withweight +xscaled +yscaled +zscaled + +---------------------------------------------------- + +[ + ["keyword", "also"], + ["keyword", "at"], + ["keyword", "atleast"], + + ["keyword", "begingroup"], + + ["keyword", "charexists"], + ["keyword", "contour"], + ["keyword", "controls"], + ["keyword", "curl"], + ["keyword", "cycle"], + + ["keyword", "def"], + ["keyword", "delimiters"], + ["keyword", "doublepath"], + ["keyword", "dropping"], + ["keyword", "dump"], + + ["keyword", "else"], + ["keyword", "elseif"], + ["keyword", "end"], + ["keyword", "enddef"], + ["keyword", "endfor"], + ["keyword", "endgroup"], + ["keyword", "endinput"], + ["keyword", "exitif"], + ["keyword", "exitunless"], + ["keyword", "expandafter"], + + ["keyword", "fi"], + ["keyword", "for"], + ["keyword", "forever"], + ["keyword", "forsuffixes"], + ["keyword", "from"], + + ["keyword", "if"], + ["keyword", "input"], + ["keyword", "inwindow"], + + ["keyword", "keeping"], + ["keyword", "kern"], + + ["keyword", "of"], + + ["keyword", "primarydef"], + + ["keyword", "quote"], + + ["keyword", "readstring"], + + ["keyword", "scaled"], + ["keyword", "scantokens"], + ["keyword", "secondarydef"], + ["keyword", "shifted"], + ["keyword", "skipto"], + ["keyword", "slanted"], + ["keyword", "step"], + + ["keyword", "tension"], + ["keyword", "tertiarydef"], + ["keyword", "to"], + ["keyword", "transformed"], + + ["keyword", "until"], + + ["keyword", "vardef"], + + ["keyword", "withpen"], + ["keyword", "withweight"], + + ["keyword", "xscaled"], + + ["keyword", "yscaled"], + + ["keyword", "zscaled"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/metafont/macro_feature.test b/package/src/prism/tests/languages/metafont/macro_feature.test new file mode 100644 index 00000000..6953e77a --- /dev/null +++ b/package/src/prism/tests/languages/metafont/macro_feature.test @@ -0,0 +1,30 @@ +beginchar cullit decr define_pixels div draw downto endchar fill flex incr max min mod mode_setup penlabels penpos shipit showit upto + +---------------------------------------------------- + +[ + ["macro", "beginchar"], + ["macro", "cullit"], + ["macro", "decr"], + ["macro", "define_pixels"], + ["macro", "div"], + ["macro", "draw"], + ["macro", "downto"], + ["macro", "endchar"], + ["macro", "fill"], + ["macro", "flex"], + ["macro", "incr"], + ["macro", "max"], + ["macro", "min"], + ["macro", "mod"], + ["macro", "mode_setup"], + ["macro", "penlabels"], + ["macro", "penpos"], + ["macro", "shipit"], + ["macro", "showit"], + ["macro", "upto"] +] + +---------------------------------------------------- + +Checks for a few important macros. \ No newline at end of file diff --git a/package/src/prism/tests/languages/metafont/number_feature.test b/package/src/prism/tests/languages/metafont/number_feature.test new file mode 100644 index 00000000..c9fbb0d9 --- /dev/null +++ b/package/src/prism/tests/languages/metafont/number_feature.test @@ -0,0 +1,15 @@ +42 +3.14 +.34 + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14"], + ["number", ".34"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/metafont/operator_feature.test b/package/src/prism/tests/languages/metafont/operator_feature.test new file mode 100644 index 00000000..05986eff --- /dev/null +++ b/package/src/prism/tests/languages/metafont/operator_feature.test @@ -0,0 +1,83 @@ +: := + +% Boolean operators +and or not <> + +% Numeric operators +< <= >= > = <> +* ** / + - ++ +-+ + +% Path operators +& .. ... -- --- + +% String operators +& < <= >= > = <> + +% Ligature operators +=: :: |=: |=:> =:| =:|> |=:| |=:|> |=:|>> ||: + +---------------------------------------------------- + +[ + ["operator", ":"], + ["operator", ":="], + + ["comment", "% Boolean operators"], + + ["operator", "and"], + ["operator", "or"], + ["operator", "not"], + ["operator", "<>"], + + ["comment", "% Numeric operators"], + + ["operator", "<"], + ["operator", "<="], + ["operator", ">="], + ["operator", ">"], + ["operator", "="], + ["operator", "<>"], + + ["operator", "*"], + ["operator", "**"], + ["operator", "/"], + ["operator", "+"], + ["operator", "-"], + ["operator", "++"], + ["operator", "+-+"], + + ["comment", "% Path operators"], + + ["operator", "&"], + ["operator", ".."], + ["operator", "..."], + ["operator", "--"], + ["operator", "---"], + + ["comment", "% String operators"], + + ["operator", "&"], + ["operator", "<"], + ["operator", "<="], + ["operator", ">="], + ["operator", ">"], + ["operator", "="], + ["operator", "<>"], + + ["comment", "% Ligature operators"], + + ["operator", "=:"], + ["operator", "::"], + ["operator", "|=:"], + ["operator", "|=:>"], + ["operator", "=:|"], + ["operator", "=:|>"], + ["operator", "|=:|"], + ["operator", "|=:|>"], + ["operator", "|=:|>>"], + ["operator", "||:"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/metafont/ponctuation_feature.test b/package/src/prism/tests/languages/metafont/ponctuation_feature.test new file mode 100644 index 00000000..bc0b78ed --- /dev/null +++ b/package/src/prism/tests/languages/metafont/ponctuation_feature.test @@ -0,0 +1,25 @@ +{ } + +% Loners +,;() +[] + +---------------------------------------------------- + +[ + ["punctuation", "{"], ["punctuation", "}"], + + ["comment", "% Loners"], + + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "["], + ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for punctuation and delimiters. \ No newline at end of file diff --git a/package/src/prism/tests/languages/metafont/primitive_feature.test b/package/src/prism/tests/languages/metafont/primitive_feature.test new file mode 100644 index 00000000..bc412340 --- /dev/null +++ b/package/src/prism/tests/languages/metafont/primitive_feature.test @@ -0,0 +1,70 @@ +ASCII +angle +char cosd +decimal directiontime +floor +hex +intersectiontimes +jobname +known +length +makepath makepen mexp mlog +normaldeviate +oct odd +pencircle penoffset point postcontrol precontrol +reverse rotated +sind sqrt str subpath substring +totalweight turningnumber +uniformdeviate unknown +xpart xxpart xypart +ypart yxpart yypart + +---------------------------------------------------- + +[ + ["builtin", "ASCII"], + ["builtin", "angle"], + ["builtin", "char"], + ["builtin", "cosd"], + ["builtin", "decimal"], + ["builtin", "directiontime"], + ["builtin", "floor"], + ["builtin", "hex"], + ["builtin", "intersectiontimes"], + ["builtin", "jobname"], + ["builtin", "known"], + ["builtin", "length"], + ["builtin", "makepath"], + ["builtin", "makepen"], + ["builtin", "mexp"], + ["builtin", "mlog"], + ["builtin", "normaldeviate"], + ["builtin", "oct"], + ["builtin", "odd"], + ["builtin", "pencircle"], + ["builtin", "penoffset"], + ["builtin", "point"], + ["builtin", "postcontrol"], + ["builtin", "precontrol"], + ["builtin", "reverse"], + ["builtin", "rotated"], + ["builtin", "sind"], + ["builtin", "sqrt"], + ["builtin", "str"], + ["builtin", "subpath"], + ["builtin", "substring"], + ["builtin", "totalweight"], + ["builtin", "turningnumber"], + ["builtin", "uniformdeviate"], + ["builtin", "unknown"], + ["builtin", "xpart"], + ["builtin", "xxpart"], + ["builtin", "xypart"], + ["builtin", "ypart"], + ["builtin", "yxpart"], + ["builtin", "yypart"] +] + +---------------------------------------------------- + +Checks for primitive METAFONT operations. \ No newline at end of file diff --git a/package/src/prism/tests/languages/metafont/string_and_comment_feature.test b/package/src/prism/tests/languages/metafont/string_and_comment_feature.test new file mode 100644 index 00000000..9e57b245 --- /dev/null +++ b/package/src/prism/tests/languages/metafont/string_and_comment_feature.test @@ -0,0 +1,21 @@ +% +% comment +"" +"string" +"text%noncomment" +%"not string" + +---------------------------------------------------- + +[ + ["comment", "%"], + ["comment", "% comment"], + ["string", "\"\""], + ["string", "\"string\""], + ["string", "\"text%noncomment\""], + ["comment", "%\"not string\""] +] + +---------------------------------------------------- + +Checks for strings and comments without mangling. \ No newline at end of file diff --git a/package/src/prism/tests/languages/metafont/type_feature.test b/package/src/prism/tests/languages/metafont/type_feature.test new file mode 100644 index 00000000..89d45198 --- /dev/null +++ b/package/src/prism/tests/languages/metafont/type_feature.test @@ -0,0 +1,43 @@ +% Variable type +boolean +numeric +pair +path +pen +picture +string +transform + +% Argument type +expr +primary +secondary +suffix +tertiary +text + +---------------------------------------------------- + +[ + ["comment", "% Variable type"], + ["type", "boolean"], + ["type", "numeric"], + ["type", "pair"], + ["type", "path"], + ["type", "pen"], + ["type", "picture"], + ["type", "string"], + ["type", "transform"], + + ["comment", "% Argument type"], + ["type", "expr"], + ["type", "primary"], + ["type", "secondary"], + ["type", "suffix"], + ["type", "tertiary"], + ["type", "text"] +] + +---------------------------------------------------- + +Checks for typing keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/metafont/variable_feature.test b/package/src/prism/tests/languages/metafont/variable_feature.test new file mode 100644 index 00000000..79af5da3 --- /dev/null +++ b/package/src/prism/tests/languages/metafont/variable_feature.test @@ -0,0 +1,53 @@ +% Special variables +#@ @ @# +whatever + +% Chardimen variables +d h w + +% Position variables +x y z + +% Output variables +aspect_ratio localfont mag mode screen_cols screen_rows + +% Other variables +currentpen currentpicture currenttransform +extra_beginchar extra_endchar extra_setup + +---------------------------------------------------- + +[ + ["comment", "% Special variables"], + ["variable", "#@"], ["variable", "@"], ["variable", "@#"], + ["variable", "whatever"], + + ["comment", "% Chardimen variables"], + ["variable", "d"], ["variable", "h"], ["variable", "w"], + + ["comment", "% Position variables"], + ["variable", "x"], ["variable", "y"], ["variable", "z"], + + ["comment", "% Output variables"], + + ["variable", "aspect_ratio"], + ["variable", "localfont"], + ["variable", "mag"], + ["variable", "mode"], + ["variable", "screen_cols"], + ["variable", "screen_rows"], + + ["comment", "% Other variables"], + + ["variable", "currentpen"], + ["variable", "currentpicture"], + ["variable", "currenttransform"], + + ["variable", "extra_beginchar"], + ["variable", "extra_endchar"], + ["variable", "extra_setup"] +] + +---------------------------------------------------- + +Checks for important variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mizar/comment_feature.test b/package/src/prism/tests/languages/mizar/comment_feature.test new file mode 100644 index 00000000..7a465c1e --- /dev/null +++ b/package/src/prism/tests/languages/mizar/comment_feature.test @@ -0,0 +1,11 @@ +:: Foobar + +---------------------------------------------------- + +[ + ["comment", ":: Foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mizar/keyword_feature.test b/package/src/prism/tests/languages/mizar/keyword_feature.test new file mode 100644 index 00000000..01656f1e --- /dev/null +++ b/package/src/prism/tests/languages/mizar/keyword_feature.test @@ -0,0 +1,245 @@ +@proof +according +aggregate +all +and +antonym +are +as +associativity +assume +asymmetry +attr +be +begin +being +by +canceled +case +cases +cluster +clusters +coherence +commutativity +compatibility +connectedness +consider +consistency +constructors +contradiction +correctness +def +deffunc +define +definition +definitions +defpred +do +does +equals +end +environ +ex +exactly +existence +for +from +func +given +hence +hereby +holds +idempotence +identity +if +iff +implies +involutiveness +irreflexivity +is +it +let +means +mode +non +not +notation +notations +now +of +or +otherwise +over +per +pred +prefix +projectivity +proof +provided +qua +reconsider +redefine +reduce +reducibility +reflexivity +registration +registrations +requirements +reserve +sch +scheme +schemes +section +selector +set +sethood +st +struct +such +suppose +symmetry +synonym +take +that +the +then +theorem +theorems +thesis +thus +to +transitivity +uniqueness +vocabulary +vocabularies +when +where +with +wrt + +---------------------------------------------------- + +[ + ["keyword", "@proof"], + ["keyword", "according"], + ["keyword", "aggregate"], + ["keyword", "all"], + ["keyword", "and"], + ["keyword", "antonym"], + ["keyword", "are"], + ["keyword", "as"], + ["keyword", "associativity"], + ["keyword", "assume"], + ["keyword", "asymmetry"], + ["keyword", "attr"], + ["keyword", "be"], + ["keyword", "begin"], + ["keyword", "being"], + ["keyword", "by"], + ["keyword", "canceled"], + ["keyword", "case"], + ["keyword", "cases"], + ["keyword", "cluster"], + ["keyword", "clusters"], + ["keyword", "coherence"], + ["keyword", "commutativity"], + ["keyword", "compatibility"], + ["keyword", "connectedness"], + ["keyword", "consider"], + ["keyword", "consistency"], + ["keyword", "constructors"], + ["keyword", "contradiction"], + ["keyword", "correctness"], + ["keyword", "def"], + ["keyword", "deffunc"], + ["keyword", "define"], + ["keyword", "definition"], + ["keyword", "definitions"], + ["keyword", "defpred"], + ["keyword", "do"], + ["keyword", "does"], + ["keyword", "equals"], + ["keyword", "end"], + ["keyword", "environ"], + ["keyword", "ex"], + ["keyword", "exactly"], + ["keyword", "existence"], + ["keyword", "for"], + ["keyword", "from"], + ["keyword", "func"], + ["keyword", "given"], + ["keyword", "hence"], + ["keyword", "hereby"], + ["keyword", "holds"], + ["keyword", "idempotence"], + ["keyword", "identity"], + ["keyword", "if"], + ["keyword", "iff"], + ["keyword", "implies"], + ["keyword", "involutiveness"], + ["keyword", "irreflexivity"], + ["keyword", "is"], + ["keyword", "it"], + ["keyword", "let"], + ["keyword", "means"], + ["keyword", "mode"], + ["keyword", "non"], + ["keyword", "not"], + ["keyword", "notation"], + ["keyword", "notations"], + ["keyword", "now"], + ["keyword", "of"], + ["keyword", "or"], + ["keyword", "otherwise"], + ["keyword", "over"], + ["keyword", "per"], + ["keyword", "pred"], + ["keyword", "prefix"], + ["keyword", "projectivity"], + ["keyword", "proof"], + ["keyword", "provided"], + ["keyword", "qua"], + ["keyword", "reconsider"], + ["keyword", "redefine"], + ["keyword", "reduce"], + ["keyword", "reducibility"], + ["keyword", "reflexivity"], + ["keyword", "registration"], + ["keyword", "registrations"], + ["keyword", "requirements"], + ["keyword", "reserve"], + ["keyword", "sch"], + ["keyword", "scheme"], + ["keyword", "schemes"], + ["keyword", "section"], + ["keyword", "selector"], + ["keyword", "set"], + ["keyword", "sethood"], + ["keyword", "st"], + ["keyword", "struct"], + ["keyword", "such"], + ["keyword", "suppose"], + ["keyword", "symmetry"], + ["keyword", "synonym"], + ["keyword", "take"], + ["keyword", "that"], + ["keyword", "the"], + ["keyword", "then"], + ["keyword", "theorem"], + ["keyword", "theorems"], + ["keyword", "thesis"], + ["keyword", "thus"], + ["keyword", "to"], + ["keyword", "transitivity"], + ["keyword", "uniqueness"], + ["keyword", "vocabulary"], + ["keyword", "vocabularies"], + ["keyword", "when"], + ["keyword", "where"], + ["keyword", "with"], + ["keyword", "wrt"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mizar/number_feature.test b/package/src/prism/tests/languages/mizar/number_feature.test new file mode 100644 index 00000000..5c5c8bb7 --- /dev/null +++ b/package/src/prism/tests/languages/mizar/number_feature.test @@ -0,0 +1,15 @@ +0 +-2 +42 + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "-2"], + ["number", "42"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mizar/operator_feature.test b/package/src/prism/tests/languages/mizar/operator_feature.test new file mode 100644 index 00000000..814428d2 --- /dev/null +++ b/package/src/prism/tests/languages/mizar/operator_feature.test @@ -0,0 +1,17 @@ +... +-> +& += .= + +---------------------------------------------------- + +[ + ["operator", "..."], + ["operator", "->"], + ["operator", "&"], + ["operator", "="], ["operator", ".="] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mizar/parameter_feature.test b/package/src/prism/tests/languages/mizar/parameter_feature.test new file mode 100644 index 00000000..844f09d5 --- /dev/null +++ b/package/src/prism/tests/languages/mizar/parameter_feature.test @@ -0,0 +1,17 @@ +$1 $2 $3 +$4 $5 $6 +$6 $7 $9 +$10 + +---------------------------------------------------- + +[ + ["parameter", "$1"], ["parameter", "$2"], ["parameter", "$3"], + ["parameter", "$4"], ["parameter", "$5"], ["parameter", "$6"], + ["parameter", "$6"], ["parameter", "$7"], ["parameter", "$9"], + ["parameter", "$10"] +] + +---------------------------------------------------- + +Checks for parameters. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mizar/variable_feature.test b/package/src/prism/tests/languages/mizar/variable_feature.test new file mode 100644 index 00000000..238d1af1 --- /dev/null +++ b/package/src/prism/tests/languages/mizar/variable_feature.test @@ -0,0 +1,17 @@ +P: +CQC_THE1: +PRE_FF: +NAT_1: + +---------------------------------------------------- + +[ + ["variable", "P"], ["punctuation", ":"], + ["variable", "CQC_THE1"], ["punctuation", ":"], + ["variable", "PRE_FF"], ["punctuation", ":"], + ["variable", "NAT_1"], ["punctuation", ":"] +] + +---------------------------------------------------- + +Checks for variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/mongodb/document_feature.test b/package/src/prism/tests/languages/mongodb/document_feature.test new file mode 100644 index 00000000..6d5c5fff --- /dev/null +++ b/package/src/prism/tests/languages/mongodb/document_feature.test @@ -0,0 +1,206 @@ +{ + '_id': ObjectId('5ec72ffe00316be87cab3927'), + 'code': Code('function () { return 22; }'), + 'binary': BinData(1, '232sa3d323sd232a32sda3s2d3a2s1d23s21d3sa'), + 'dbref': DBRef('namespace', ObjectId('5ec72f4200316be87cab3926'), 'db'), + 'timestamp': Timestamp(0, 0), + 'long': NumberLong(9223372036854775807), + 'decimal': NumberDecimal('1000.55'), + 'integer': 100, + 'maxkey': MaxKey(), + 'minkey': MinKey(), + 'isodate': ISODate('2012-01-01T00:00:00.000Z'), + 'regexp': RegExp('prism(js)?', 'i'), + 'string': 'Hello World', + 'numberArray': [1, 2, 3], + 'stringArray': ['1','2','3'], + 'randomKey': null, + 'object': { 'a': 1, 'b': 2 }, + 'max_key2': MaxKey(), + 'number': 1234, + 'invalid-key': 123, + noQuotesKey: 'value', +} + +---------------------------------------------------- + +[ + ["punctuation", "{"], + + ["string-property", "'_id'"], + ["operator", ":"], + ["builtin", "ObjectId"], + ["punctuation", "("], + ["string", ["'5ec72ffe00316be87cab3927'"]], + ["punctuation", ")"], + ["punctuation", ","], + + ["string-property", "'code'"], + ["operator", ":"], + ["builtin", "Code"], + ["punctuation", "("], + ["string", ["'function () { return 22; }'"]], + ["punctuation", ")"], + ["punctuation", ","], + + ["string-property", "'binary'"], + ["operator", ":"], + ["builtin", "BinData"], + ["punctuation", "("], + ["number", "1"], + ["punctuation", ","], + ["string", ["'232sa3d323sd232a32sda3s2d3a2s1d23s21d3sa'"]], + ["punctuation", ")"], + ["punctuation", ","], + + ["string-property", "'dbref'"], + ["operator", ":"], + ["builtin", "DBRef"], + ["punctuation", "("], + ["string", ["'namespace'"]], + ["punctuation", ","], + ["builtin", "ObjectId"], + ["punctuation", "("], + ["string", ["'5ec72f4200316be87cab3926'"]], + ["punctuation", ")"], + ["punctuation", ","], + ["string", ["'db'"]], + ["punctuation", ")"], + ["punctuation", ","], + + ["string-property", "'timestamp'"], + ["operator", ":"], + ["builtin", "Timestamp"], + ["punctuation", "("], + ["number", "0"], + ["punctuation", ","], + ["number", "0"], + ["punctuation", ")"], + ["punctuation", ","], + + ["string-property", "'long'"], + ["operator", ":"], + ["builtin", "NumberLong"], + ["punctuation", "("], + ["number", "9223372036854775807"], + ["punctuation", ")"], + ["punctuation", ","], + + ["string-property", "'decimal'"], + ["operator", ":"], + ["builtin", "NumberDecimal"], + ["punctuation", "("], + ["string", ["'1000.55'"]], + ["punctuation", ")"], + ["punctuation", ","], + + ["string-property", "'integer'"], + ["operator", ":"], + ["number", "100"], + ["punctuation", ","], + + ["string-property", "'maxkey'"], + ["operator", ":"], + ["builtin", "MaxKey"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ","], + + ["string-property", "'minkey'"], + ["operator", ":"], + ["builtin", "MinKey"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ","], + + ["string-property", "'isodate'"], + ["operator", ":"], + ["builtin", "ISODate"], + ["punctuation", "("], + ["string", ["'2012-01-01T00:00:00.000Z'"]], + ["punctuation", ")"], + ["punctuation", ","], + + ["string-property", "'regexp'"], + ["operator", ":"], + ["builtin", "RegExp"], + ["punctuation", "("], + ["string", ["'prism(js)?'"]], + ["punctuation", ","], + ["string", ["'i'"]], + ["punctuation", ")"], + ["punctuation", ","], + + ["string-property", "'string'"], + ["operator", ":"], + ["string", ["'Hello World'"]], + ["punctuation", ","], + + ["string-property", "'numberArray'"], + ["operator", ":"], + ["punctuation", "["], + ["number", "1"], + ["punctuation", ","], + ["number", "2"], + ["punctuation", ","], + ["number", "3"], + ["punctuation", "]"], + ["punctuation", ","], + + ["string-property", "'stringArray'"], + ["operator", ":"], + ["punctuation", "["], + ["string", ["'1'"]], + ["punctuation", ","], + ["string", ["'2'"]], + ["punctuation", ","], + ["string", ["'3'"]], + ["punctuation", "]"], + ["punctuation", ","], + + ["string-property", "'randomKey'"], + ["operator", ":"], + ["keyword", "null"], + ["punctuation", ","], + + ["string-property", "'object'"], + ["operator", ":"], + ["punctuation", "{"], + ["string-property", "'a'"], + ["operator", ":"], + ["number", "1"], + ["punctuation", ","], + ["string-property", "'b'"], + ["operator", ":"], + ["number", "2"], + ["punctuation", "}"], + ["punctuation", ","], + + ["string-property", "'max_key2'"], + ["operator", ":"], + ["builtin", "MaxKey"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ","], + + ["string-property", "'number'"], + ["operator", ":"], + ["number", "1234"], + ["punctuation", ","], + + ["string-property", "'invalid-key'"], + ["operator", ":"], + ["number", "123"], + ["punctuation", ","], + + ["property", ["noQuotesKey"]], + ["operator", ":"], + ["string", ["'value'"]], + ["punctuation", ","], + + ["punctuation", "}"] +] + +---------------------------------------------------- + +Common document. diff --git a/package/src/prism/tests/languages/mongodb/functions_feature.test b/package/src/prism/tests/languages/mongodb/functions_feature.test new file mode 100644 index 00000000..e3ccaaaa --- /dev/null +++ b/package/src/prism/tests/languages/mongodb/functions_feature.test @@ -0,0 +1,61 @@ +ObjectId() +ObjectId () +Code() +BinData() +DBRef() +Timestamp() +NumberLong() +NumberDecimal() +MaxKey() +MinKey() +RegExp() +ISODate() +UUID() + +---------------------------------------------------- + +[ + ["builtin", "ObjectId"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "ObjectId"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "Code"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "BinData"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "DBRef"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "Timestamp"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "NumberLong"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "NumberDecimal"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "MaxKey"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "MinKey"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "RegExp"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "ISODate"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "UUID"], + ["punctuation", "("], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for built-in functions. diff --git a/package/src/prism/tests/languages/mongodb/operations_feature.test b/package/src/prism/tests/languages/mongodb/operations_feature.test new file mode 100644 index 00000000..057a6873 --- /dev/null +++ b/package/src/prism/tests/languages/mongodb/operations_feature.test @@ -0,0 +1,1823 @@ +{ + $eq: {}, + $gt: {}, + $gte: {}, + $in: {}, + $lt: {}, + $lte: {}, + $ne: {}, + $nin: {}, + $and: {}, + $not: {}, + $nor: {}, + $or: {}, + $exists: {}, + $type: {}, + $expr: {}, + $jsonSchema: {}, + $mod: {}, + $regex: {}, + $text: {}, + $where: {}, + $geoIntersects: {}, + $geoWithin: {}, + $near: {}, + $nearSphere: {}, + $all: {}, + $elemMatch: {}, + $size: {}, + $bitsAllClear: {}, + $bitsAllSet: {}, + $bitsAnyClear: {}, + $bitsAnySet: {}, + $comment: {}, + $elemMatch: {}, + $meta: {}, + $slice: {}, + $currentDate: {}, + $inc: {}, + $min: {}, + $max: {}, + $mul: {}, + $rename: {}, + $set: {}, + $setOnInsert: {}, + $unset: {}, + $addToSet: {}, + $pop: {}, + $pull: {}, + $push: {}, + $pullAll: {}, + $each: {}, + $position: {}, + $slice: {}, + $sort: {}, + $bit: {}, + $addFields: {}, + $bucket: {}, + $bucketAuto: {}, + $collStats: {}, + $count: {}, + $currentOp: {}, + $facet: {}, + $geoNear: {}, + $graphLookup: {}, + $group: {}, + $indexStats: {}, + $limit: {}, + $listLocalSessions: {}, + $listSessions: {}, + $lookup: {}, + $match: {}, + $merge: {}, + $out: {}, + $planCacheStats: {}, + $project: {}, + $redact: {}, + $replaceRoot: {}, + $replaceWith: {}, + $sample: {}, + $set: {}, + $skip: {}, + $sort: {}, + $sortByCount: {}, + $unionWith: {}, + $unset: {}, + $unwind: {}, + $abs: {}, + $accumulator: {}, + $acos: {}, + $acosh: {}, + $add: {}, + $addToSet: {}, + $allElementsTrue: {}, + $and: {}, + $anyElementTrue: {}, + $arrayElemAt: {}, + $arrayToObject: {}, + $asin: {}, + $asinh: {}, + $atan: {}, + $atan2: {}, + $atanh: {}, + $avg: {}, + $binarySize: {}, + $bsonSize: {}, + $ceil: {}, + $cmp: {}, + $concat: {}, + $concatArrays: {}, + $cond: {}, + $convert: {}, + $cos: {}, + $dateFromParts: {}, + $dateToParts: {}, + $dateFromString: {}, + $dateToString: {}, + $dayOfMonth: {}, + $dayOfWeek: {}, + $dayOfYear: {}, + $degreesToRadians: {}, + $divide: {}, + $eq: {}, + $exp: {}, + $filter: {}, + $first: {}, + $floor: {}, + $function: {}, + $gt: {}, + $gte: {}, + $hour: {}, + $ifNull: {}, + $in: {}, + $indexOfArray: {}, + $indexOfBytes: {}, + $indexOfCP: {}, + $isArray: {}, + $isNumber: {}, + $isoDayOfWeek: {}, + $isoWeek: {}, + $isoWeekYear: {}, + $last: {}, + $last: {}, + $let: {}, + $literal: {}, + $ln: {}, + $log: {}, + $log10: {}, + $lt: {}, + $lte: {}, + $ltrim: {}, + $map: {}, + $max: {}, + $mergeObjects: {}, + $meta: {}, + $min: {}, + $millisecond: {}, + $minute: {}, + $mod: {}, + $month: {}, + $multiply: {}, + $ne: {}, + $not: {}, + $objectToArray: {}, + $or: {}, + $pow: {}, + $push: {}, + $radiansToDegrees: {}, + $range: {}, + $reduce: {}, + $regexFind: {}, + $regexFindAll: {}, + $regexMatch: {}, + $replaceOne: {}, + $replaceAll: {}, + $reverseArray: {}, + $round: {}, + $rtrim: {}, + $second: {}, + $setDifference: {}, + $setEquals: {}, + $setIntersection: {}, + $setIsSubset: {}, + $setUnion: {}, + $size: {}, + $sin: {}, + $slice: {}, + $split: {}, + $sqrt: {}, + $stdDevPop: {}, + $stdDevSamp: {}, + $strcasecmp: {}, + $strLenBytes: {}, + $strLenCP: {}, + $substr: {}, + $substrBytes: {}, + $substrCP: {}, + $subtract: {}, + $sum: {}, + $switch: {}, + $tan: {}, + $toBool: {}, + $toDate: {}, + $toDecimal: {}, + $toDouble: {}, + $toInt: {}, + $toLong: {}, + $toObjectId: {}, + $toString: {}, + $toLower: {}, + $toUpper: {}, + $trim: {}, + $trunc: {}, + $type: {}, + $week: {}, + $year: {}, + $zip: {}, + $comment: {}, + $explain: {}, + $hint: {}, + $max: {}, + $maxTimeMS: {}, + $min: {}, + $orderby: {}, + $query: {}, + $returnKey: {}, + $showDiskLoc: {}, + $natural: {}, +} + +---------------------------------------------------- + +[ + ["punctuation", "{"], + ["property", [ + ["keyword", "$eq"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$gt"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$gte"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$in"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$lt"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$lte"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$ne"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$nin"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$and"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$not"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$nor"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$or"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$exists"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$type"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$expr"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$jsonSchema"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$mod"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$regex"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$text"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$where"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$geoIntersects"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$geoWithin"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$near"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$nearSphere"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$all"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$elemMatch"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$size"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$bitsAllClear"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$bitsAllSet"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$bitsAnyClear"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$bitsAnySet"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$comment"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$elemMatch"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$meta"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$slice"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$currentDate"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$inc"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$min"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$max"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$mul"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$rename"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$set"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$setOnInsert"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$unset"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$addToSet"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$pop"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$pull"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$push"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$pullAll"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$each"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$position"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$slice"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$sort"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$bit"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$addFields"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$bucket"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$bucketAuto"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$collStats"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$count"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$currentOp"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$facet"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$geoNear"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$graphLookup"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$group"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$indexStats"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$limit"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$listLocalSessions"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$listSessions"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$lookup"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$match"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$merge"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$out"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$planCacheStats"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$project"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$redact"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$replaceRoot"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$replaceWith"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$sample"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$set"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$skip"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$sort"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$sortByCount"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$unionWith"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$unset"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$unwind"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$abs"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$accumulator"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$acos"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$acosh"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$add"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$addToSet"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$allElementsTrue"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$and"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$anyElementTrue"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$arrayElemAt"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$arrayToObject"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$asin"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$asinh"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$atan"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$atan2"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$atanh"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$avg"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$binarySize"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$bsonSize"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$ceil"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$cmp"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$concat"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$concatArrays"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$cond"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$convert"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$cos"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$dateFromParts"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$dateToParts"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$dateFromString"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$dateToString"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$dayOfMonth"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$dayOfWeek"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$dayOfYear"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$degreesToRadians"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$divide"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$eq"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$exp"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$filter"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$first"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$floor"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$function"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$gt"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$gte"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$hour"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$ifNull"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$in"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$indexOfArray"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$indexOfBytes"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$indexOfCP"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$isArray"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$isNumber"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$isoDayOfWeek"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$isoWeek"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$isoWeekYear"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$last"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$last"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$let"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$literal"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$ln"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$log"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$log10"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$lt"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$lte"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$ltrim"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$map"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$max"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$mergeObjects"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$meta"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$min"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$millisecond"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$minute"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$mod"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$month"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$multiply"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$ne"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$not"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$objectToArray"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$or"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$pow"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$push"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$radiansToDegrees"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$range"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$reduce"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$regexFind"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$regexFindAll"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$regexMatch"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$replaceOne"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$replaceAll"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$reverseArray"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$round"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$rtrim"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$second"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$setDifference"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$setEquals"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$setIntersection"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$setIsSubset"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$setUnion"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$size"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$sin"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$slice"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$split"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$sqrt"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$stdDevPop"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$stdDevSamp"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$strcasecmp"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$strLenBytes"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$strLenCP"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$substr"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$substrBytes"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$substrCP"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$subtract"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$sum"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$switch"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$tan"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$toBool"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$toDate"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$toDecimal"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$toDouble"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$toInt"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$toLong"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$toObjectId"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$toString"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$toLower"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$toUpper"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$trim"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$trunc"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$type"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$week"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$year"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$zip"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$comment"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$explain"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$hint"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$max"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$maxTimeMS"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$min"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$orderby"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$query"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$returnKey"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$showDiskLoc"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", [ + ["keyword", "$natural"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["punctuation", "}"] +] + + + +---------------------------------------------------- + +Checks for operations. diff --git a/package/src/prism/tests/languages/mongodb/query_feature.test b/package/src/prism/tests/languages/mongodb/query_feature.test new file mode 100644 index 00000000..b3dc120c --- /dev/null +++ b/package/src/prism/tests/languages/mongodb/query_feature.test @@ -0,0 +1,65 @@ +db.users.find({ + _id: { $nin: ObjectId('5ec72ffe00316be87cab3927') }, + age: { $gte: 18, $lte: 99 }, + field: { $exists: true } +}) + +---------------------------------------------------- + +[ + "db", + ["punctuation", "."], + ["property-access", ["users"]], + ["punctuation", "."], + ["function", ["find"]], + ["punctuation", "("], + ["punctuation", "{"], + + ["property", ["_id"]], + ["operator", ":"], + ["punctuation", "{"], + ["property", [ + ["keyword", "$nin"] + ]], + ["operator", ":"], + ["builtin", "ObjectId"], + ["punctuation", "("], + ["string", ["'5ec72ffe00316be87cab3927'"]], + ["punctuation", ")"], + ["punctuation", "}"], + ["punctuation", ","], + + ["property", ["age"]], + ["operator", ":"], + ["punctuation", "{"], + ["property", [ + ["keyword", "$gte"] + ]], + ["operator", ":"], + ["number", "18"], + ["punctuation", ","], + ["property", [ + ["keyword", "$lte"] + ]], + ["operator", ":"], + ["number", "99"], + ["punctuation", "}"], + ["punctuation", ","], + + ["property", ["field"]], + ["operator", ":"], + ["punctuation", "{"], + ["property", [ + ["keyword", "$exists"] + ]], + ["operator", ":"], + ["boolean", "true"], + ["punctuation", "}"], + + ["punctuation", "}"], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Common query. diff --git a/package/src/prism/tests/languages/mongodb/string_url_and_ip_feature.test b/package/src/prism/tests/languages/mongodb/string_url_and_ip_feature.test new file mode 100644 index 00000000..a4003c0e --- /dev/null +++ b/package/src/prism/tests/languages/mongodb/string_url_and_ip_feature.test @@ -0,0 +1,33 @@ +{ + field1: 'Here is url: http://prismjs.com/' + field2: 'Here is ip: 192.168.0.1' +} + +---------------------------------------------------- + +[ + ["punctuation", "{"], + ["property", [ + "field1" + ]], + ["operator", ":"], + ["string", [ + "'Here is url: ", + ["url", "http://prismjs.com/"], + "'" + ]], + ["property", [ + "field2" + ]], + ["operator", ":"], + ["string", [ + "'Here is ip: ", + ["entity", "192.168.0.1"], + "'" + ]], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for URL and IP highlighting inside string. diff --git a/package/src/prism/tests/languages/mongodb/update_feature.test b/package/src/prism/tests/languages/mongodb/update_feature.test new file mode 100644 index 00000000..7d625ab9 --- /dev/null +++ b/package/src/prism/tests/languages/mongodb/update_feature.test @@ -0,0 +1,78 @@ +db.users.updateOne( + { + _id: ObjectId('5ec72ffe00316be87cab3927') + }, + { + $set: { age: 30 }, + $inc: { updateCount: 1 }, + $push: { updateDates: new Date() } + } +) + +---------------------------------------------------- + +[ + "db", + ["punctuation", "."], + ["property-access", ["users"]], + ["punctuation", "."], + ["function", ["updateOne"]], + ["punctuation", "("], + + ["punctuation", "{"], + + ["property", ["_id"]], + ["operator", ":"], + ["builtin", "ObjectId"], + ["punctuation", "("], + ["string", ["'5ec72ffe00316be87cab3927'"]], + ["punctuation", ")"], + + ["punctuation", "}"], + ["punctuation", ","], + + ["punctuation", "{"], + + ["property", [ + ["keyword", "$set"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["property", ["age"]], + ["operator", ":"], + ["number", "30"], + ["punctuation", "}"], + ["punctuation", ","], + + ["property", [ + ["keyword", "$inc"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["property", ["updateCount"]], + ["operator", ":"], + ["number", "1"], + ["punctuation", "}"], + ["punctuation", ","], + + ["property", [ + ["keyword", "$push"] + ]], + ["operator", ":"], + ["punctuation", "{"], + ["property", ["updateDates"]], + ["operator", ":"], + ["keyword", "new"], + ["class-name", ["Date"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "}"], + + ["punctuation", "}"], + + ["punctuation", ")"] +] + +---------------------------------------------------- + +Common update. diff --git a/package/src/prism/tests/languages/monkey/comment_feature.test b/package/src/prism/tests/languages/monkey/comment_feature.test new file mode 100644 index 00000000..efe384e4 --- /dev/null +++ b/package/src/prism/tests/languages/monkey/comment_feature.test @@ -0,0 +1,21 @@ +' Foobar +#Rem Foo +Bar 'Baz +#End +' This "is" a comment +#Rem +This "is" a comment +#End + +---------------------------------------------------- + +[ + ["comment", "' Foobar"], + ["comment", "#Rem Foo\nBar 'Baz\n#End"], + ["comment", "' This \"is\" a comment"], + ["comment", "#Rem\nThis \"is\" a comment\n#End"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/monkey/function_feature.test b/package/src/prism/tests/languages/monkey/function_feature.test new file mode 100644 index 00000000..8d138142 --- /dev/null +++ b/package/src/prism/tests/languages/monkey/function_feature.test @@ -0,0 +1,13 @@ +foobar() +Foo_Bar_42() + +---------------------------------------------------- + +[ + ["function", "foobar"], ["punctuation", "("], ["punctuation", ")"], + ["function", "Foo_Bar_42"], ["punctuation", "("], ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/monkey/keyword_feature.test b/package/src/prism/tests/languages/monkey/keyword_feature.test new file mode 100644 index 00000000..73baffcd --- /dev/null +++ b/package/src/prism/tests/languages/monkey/keyword_feature.test @@ -0,0 +1,125 @@ +Void +Strict +Public +Private +Property +Bool +Int +Float +String +Array +Object +Continue +Exit +Import +Extern +New +Self +Super +Try +Catch +Eachin +True +False +Extends +Abstract +Final +Select +Case +Default +Const +Local +Global +Field +Method +Function +Class +End +If +Then +Else +ElseIf +EndIf +While +Wend +Repeat +Until +Forever +For +To +Step +Next +Return +Module +Interface +Implements +Inline +Throw +Null + +---------------------------------------------------- + +[ + ["keyword", "Void"], + ["keyword", "Strict"], + ["keyword", "Public"], + ["keyword", "Private"], + ["keyword", "Property"], + ["keyword", "Bool"], + ["keyword", "Int"], + ["keyword", "Float"], + ["keyword", "String"], + ["keyword", "Array"], + ["keyword", "Object"], + ["keyword", "Continue"], + ["keyword", "Exit"], + ["keyword", "Import"], + ["keyword", "Extern"], + ["keyword", "New"], + ["keyword", "Self"], + ["keyword", "Super"], + ["keyword", "Try"], + ["keyword", "Catch"], + ["keyword", "Eachin"], + ["keyword", "True"], + ["keyword", "False"], + ["keyword", "Extends"], + ["keyword", "Abstract"], + ["keyword", "Final"], + ["keyword", "Select"], + ["keyword", "Case"], + ["keyword", "Default"], + ["keyword", "Const"], + ["keyword", "Local"], + ["keyword", "Global"], + ["keyword", "Field"], + ["keyword", "Method"], + ["keyword", "Function"], + ["keyword", "Class"], + ["keyword", "End"], + ["keyword", "If"], + ["keyword", "Then"], + ["keyword", "Else"], + ["keyword", "ElseIf"], + ["keyword", "EndIf"], + ["keyword", "While"], + ["keyword", "Wend"], + ["keyword", "Repeat"], + ["keyword", "Until"], + ["keyword", "Forever"], + ["keyword", "For"], + ["keyword", "To"], + ["keyword", "Step"], + ["keyword", "Next"], + ["keyword", "Return"], + ["keyword", "Module"], + ["keyword", "Interface"], + ["keyword", "Implements"], + ["keyword", "Inline"], + ["keyword", "Throw"], + ["keyword", "Null"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/monkey/number_feature.test b/package/src/prism/tests/languages/monkey/number_feature.test new file mode 100644 index 00000000..46064fbc --- /dev/null +++ b/package/src/prism/tests/languages/monkey/number_feature.test @@ -0,0 +1,19 @@ +0 +42 +3.14159 +.5 +$BadFace + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "42"], + ["number", "3.14159"], + ["number", ".5"], + ["number", "$BadFace"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/monkey/operator_feature.test b/package/src/prism/tests/languages/monkey/operator_feature.test new file mode 100644 index 00000000..54dc3dc0 --- /dev/null +++ b/package/src/prism/tests/languages/monkey/operator_feature.test @@ -0,0 +1,41 @@ +.. +< <> <= +> >= += +:= ++ += +- -= +* *= +/ /= +& &= +~ ~= +| |= +Mod Mod= +Shl Shl= +Shr Shr= +And Not Or + +---------------------------------------------------- + +[ + ["operator", ".."], + ["operator", "<"], ["operator", "<>"], ["operator", "<="], + ["operator", ">"], ["operator", ">="], + ["operator", "="], + ["operator", ":="], + ["operator", "+"], ["operator", "+="], + ["operator", "-"], ["operator", "-="], + ["operator", "*"], ["operator", "*="], + ["operator", "/"], ["operator", "/="], + ["operator", "&"], ["operator", "&="], + ["operator", "~"], ["operator", "~="], + ["operator", "|"], ["operator", "|="], + ["operator", "Mod"], ["operator", "Mod="], + ["operator", "Shl"], ["operator", "Shl="], + ["operator", "Shr"], ["operator", "Shr="], + ["operator", "And"], ["operator", "Not"], ["operator", "Or"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/monkey/preprocessor_feature.test b/package/src/prism/tests/languages/monkey/preprocessor_feature.test new file mode 100644 index 00000000..28746649 --- /dev/null +++ b/package/src/prism/tests/languages/monkey/preprocessor_feature.test @@ -0,0 +1,15 @@ +#If HOST +#ElseIf +#Else + +---------------------------------------------------- + +[ + ["preprocessor", "#If HOST"], + ["preprocessor", "#ElseIf"], + ["preprocessor", "#Else"] +] + +---------------------------------------------------- + +Checks for preprocessor directives. \ No newline at end of file diff --git a/package/src/prism/tests/languages/monkey/string_feature.test b/package/src/prism/tests/languages/monkey/string_feature.test new file mode 100644 index 00000000..4c00970e --- /dev/null +++ b/package/src/prism/tests/languages/monkey/string_feature.test @@ -0,0 +1,13 @@ +"" +"Foo ~qBar~q" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"Foo ~qBar~q\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/monkey/type-char_feature.test b/package/src/prism/tests/languages/monkey/type-char_feature.test new file mode 100644 index 00000000..af6e0b17 --- /dev/null +++ b/package/src/prism/tests/languages/monkey/type-char_feature.test @@ -0,0 +1,17 @@ +foo? +bar% +baz# +foobar$ + +---------------------------------------------------- + +[ + "foo", ["type-char", "?"], + "\nbar", ["type-char", "%"], + "\nbaz", ["type-char", "#"], + "\nfoobar", ["type-char", "$"] +] + +---------------------------------------------------- + +Checks for type chars. \ No newline at end of file diff --git a/package/src/prism/tests/languages/moonscript/boolean_feature.test b/package/src/prism/tests/languages/moonscript/boolean_feature.test new file mode 100644 index 00000000..ca34f181 --- /dev/null +++ b/package/src/prism/tests/languages/moonscript/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/moonscript/class-name_feature.test b/package/src/prism/tests/languages/moonscript/class-name_feature.test new file mode 100644 index 00000000..4e00e888 --- /dev/null +++ b/package/src/prism/tests/languages/moonscript/class-name_feature.test @@ -0,0 +1,42 @@ +class Foo extends Bar + new: (@foo)=> + +with MyClass 'baz' + .foo = "bazz" + + +-- any name starting with a capital letter is considered a class +func Foo Bar + +---------------------------------------------------- + +[ + ["keyword", "class"], + ["class-name", "Foo"], + ["keyword", "extends"], + ["class-name", "Bar"], + ["property", "new"], + ["operator", ":"], + ["punctuation", "("], + ["variable", "@foo"], + ["punctuation", ")"], + ["operator", "=>"], + ["keyword", "with"], + ["class-name", "MyClass"], + ["string", "'baz'"], + ["punctuation", "."], + "foo ", + ["operator", "="], + ["string", [ + "\"bazz\"" + ]], + + ["comment", "-- any name starting with a capital letter is considered a class"], + "\nfunc ", + ["class-name", "Foo"], + ["class-name", "Bar"] +] + +---------------------------------------------------- + +Checks for class names. diff --git a/package/src/prism/tests/languages/moonscript/comment_feature.test b/package/src/prism/tests/languages/moonscript/comment_feature.test new file mode 100644 index 00000000..55f1c3f3 --- /dev/null +++ b/package/src/prism/tests/languages/moonscript/comment_feature.test @@ -0,0 +1,11 @@ +-- I'm a comment + +---------------------------------------------------- + +[ + ["comment", "-- I'm a comment"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/moonscript/function_feature.test b/package/src/prism/tests/languages/moonscript/function_feature.test new file mode 100644 index 00000000..697ac714 --- /dev/null +++ b/package/src/prism/tests/languages/moonscript/function_feature.test @@ -0,0 +1,715 @@ +_G +_VERSION +assert +collectgarbage +coroutine.create +coroutine.resume +coroutine.running +coroutine.status +coroutine.wrap +coroutine.yield +debug.debug +debug.getfenv +debug.gethook +debug.getinfo +debug.getlocal +debug.getmetatable +debug.getregistry +debug.getupvalue +debug.setfenv +debug.sethook +debug.setlocal +debug.setmetatable +debug.setupvalue +debug.traceback +dofile +error +getfenv +getmetatable +io.close +io.flush +io.input +io.lines +io.open +io.output +io.popen +io.read +io.stderr +io.stdin +io.stdout +io.tmpfile +io.type +io.write +ipairs +load +loadfile +loadstring +math.abs +math.acos +math.asin +math.atan +math.atan2 +math.ceil +math.cos +math.cosh +math.deg +math.exp +math.floor +math.fmod +math.frexp +math.ldexp +math.log +math.log10 +math.max +math.min +math.modf +math.pi +math.pow +math.rad +math.random +math.randomseed +math.sin +math.sinh +math.sqrt +math.tan +math.tanh +module +next +os.clock +os.date +os.difftime +os.execute +os.exit +os.getenv +os.remove +os.rename +os.setlocale +os.time +os.tmpname +package.cpath +package.loaded +package.loadlib +package.path +package.preload +package.seeall +pairs +pcall +print +rawequal +rawget +rawset +require +select +setfenv +setmetatable +string.byte +string.char +string.dump +string.find +string.format +string.gmatch +string.gsub +string.len +string.lower +string.match +string.rep +string.reverse +string.sub +string.upper +table.concat +table.insert +table.maxn +table.remove +table.sort +tonumber +tostring +type +unpack +xpcall + +---------------------------------------------------- + +[ + ["function", [ + "_G" + ]], + ["function", [ + "_VERSION" + ]], + ["function", [ + "assert" + ]], + ["function", [ + "collectgarbage" + ]], + ["function", [ + "coroutine", + ["punctuation", "."], + "create" + ]], + ["function", [ + "coroutine", + ["punctuation", "."], + "resume" + ]], + ["function", [ + "coroutine", + ["punctuation", "."], + "running" + ]], + ["function", [ + "coroutine", + ["punctuation", "."], + "status" + ]], + ["function", [ + "coroutine", + ["punctuation", "."], + "wrap" + ]], + ["function", [ + "coroutine", + ["punctuation", "."], + "yield" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "debug" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "getfenv" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "gethook" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "getinfo" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "getlocal" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "getmetatable" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "getregistry" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "getupvalue" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "setfenv" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "sethook" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "setlocal" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "setmetatable" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "setupvalue" + ]], + ["function", [ + "debug", + ["punctuation", "."], + "traceback" + ]], + ["function", [ + "dofile" + ]], + ["function", [ + "error" + ]], + ["function", [ + "getfenv" + ]], + ["function", [ + "getmetatable" + ]], + ["function", [ + "io", + ["punctuation", "."], + "close" + ]], + ["function", [ + "io", + ["punctuation", "."], + "flush" + ]], + ["function", [ + "io", + ["punctuation", "."], + "input" + ]], + ["function", [ + "io", + ["punctuation", "."], + "lines" + ]], + ["function", [ + "io", + ["punctuation", "."], + "open" + ]], + ["function", [ + "io", + ["punctuation", "."], + "output" + ]], + ["function", [ + "io", + ["punctuation", "."], + "popen" + ]], + ["function", [ + "io", + ["punctuation", "."], + "read" + ]], + ["function", [ + "io", + ["punctuation", "."], + "stderr" + ]], + ["function", [ + "io", + ["punctuation", "."], + "stdin" + ]], + ["function", [ + "io", + ["punctuation", "."], + "stdout" + ]], + ["function", [ + "io", + ["punctuation", "."], + "tmpfile" + ]], + ["function", [ + "io", + ["punctuation", "."], + "type" + ]], + ["function", [ + "io", + ["punctuation", "."], + "write" + ]], + ["function", [ + "ipairs" + ]], + ["function", [ + "load" + ]], + ["function", [ + "loadfile" + ]], + ["function", [ + "loadstring" + ]], + ["function", [ + "math", + ["punctuation", "."], + "abs" + ]], + ["function", [ + "math", + ["punctuation", "."], + "acos" + ]], + ["function", [ + "math", + ["punctuation", "."], + "asin" + ]], + ["function", [ + "math", + ["punctuation", "."], + "atan" + ]], + ["function", [ + "math", + ["punctuation", "."], + "atan2" + ]], + ["function", [ + "math", + ["punctuation", "."], + "ceil" + ]], + ["function", [ + "math", + ["punctuation", "."], + "cos" + ]], + ["function", [ + "math", + ["punctuation", "."], + "cosh" + ]], + ["function", [ + "math", + ["punctuation", "."], + "deg" + ]], + ["function", [ + "math", + ["punctuation", "."], + "exp" + ]], + ["function", [ + "math", + ["punctuation", "."], + "floor" + ]], + ["function", [ + "math", + ["punctuation", "."], + "fmod" + ]], + ["function", [ + "math", + ["punctuation", "."], + "frexp" + ]], + ["function", [ + "math", + ["punctuation", "."], + "ldexp" + ]], + ["function", [ + "math", + ["punctuation", "."], + "log" + ]], + ["function", [ + "math", + ["punctuation", "."], + "log10" + ]], + ["function", [ + "math", + ["punctuation", "."], + "max" + ]], + ["function", [ + "math", + ["punctuation", "."], + "min" + ]], + ["function", [ + "math", + ["punctuation", "."], + "modf" + ]], + ["function", [ + "math", + ["punctuation", "."], + "pi" + ]], + ["function", [ + "math", + ["punctuation", "."], + "pow" + ]], + ["function", [ + "math", + ["punctuation", "."], + "rad" + ]], + ["function", [ + "math", + ["punctuation", "."], + "random" + ]], + ["function", [ + "math", + ["punctuation", "."], + "randomseed" + ]], + ["function", [ + "math", + ["punctuation", "."], + "sin" + ]], + ["function", [ + "math", + ["punctuation", "."], + "sinh" + ]], + ["function", [ + "math", + ["punctuation", "."], + "sqrt" + ]], + ["function", [ + "math", + ["punctuation", "."], + "tan" + ]], + ["function", [ + "math", + ["punctuation", "."], + "tanh" + ]], + ["function", [ + "module" + ]], + ["function", [ + "next" + ]], + ["function", [ + "os", + ["punctuation", "."], + "clock" + ]], + ["function", [ + "os", + ["punctuation", "."], + "date" + ]], + ["function", [ + "os", + ["punctuation", "."], + "difftime" + ]], + ["function", [ + "os", + ["punctuation", "."], + "execute" + ]], + ["function", [ + "os", + ["punctuation", "."], + "exit" + ]], + ["function", [ + "os", + ["punctuation", "."], + "getenv" + ]], + ["function", [ + "os", + ["punctuation", "."], + "remove" + ]], + ["function", [ + "os", + ["punctuation", "."], + "rename" + ]], + ["function", [ + "os", + ["punctuation", "."], + "setlocale" + ]], + ["function", [ + "os", + ["punctuation", "."], + "time" + ]], + ["function", [ + "os", + ["punctuation", "."], + "tmpname" + ]], + ["function", [ + "package", + ["punctuation", "."], + "cpath" + ]], + ["function", [ + "package", + ["punctuation", "."], + "loaded" + ]], + ["function", [ + "package", + ["punctuation", "."], + "loadlib" + ]], + ["function", [ + "package", + ["punctuation", "."], + "path" + ]], + ["function", [ + "package", + ["punctuation", "."], + "preload" + ]], + ["function", [ + "package", + ["punctuation", "."], + "seeall" + ]], + ["function", [ + "pairs" + ]], + ["function", [ + "pcall" + ]], + ["function", [ + "print" + ]], + ["function", [ + "rawequal" + ]], + ["function", [ + "rawget" + ]], + ["function", [ + "rawset" + ]], + ["function", [ + "require" + ]], + ["function", [ + "select" + ]], + ["function", [ + "setfenv" + ]], + ["function", [ + "setmetatable" + ]], + ["function", [ + "string", + ["punctuation", "."], + "byte" + ]], + ["function", [ + "string", + ["punctuation", "."], + "char" + ]], + ["function", [ + "string", + ["punctuation", "."], + "dump" + ]], + ["function", [ + "string", + ["punctuation", "."], + "find" + ]], + ["function", [ + "string", + ["punctuation", "."], + "format" + ]], + ["function", [ + "string", + ["punctuation", "."], + "gmatch" + ]], + ["function", [ + "string", + ["punctuation", "."], + "gsub" + ]], + ["function", [ + "string", + ["punctuation", "."], + "len" + ]], + ["function", [ + "string", + ["punctuation", "."], + "lower" + ]], + ["function", [ + "string", + ["punctuation", "."], + "match" + ]], + ["function", [ + "string", + ["punctuation", "."], + "rep" + ]], + ["function", [ + "string", + ["punctuation", "."], + "reverse" + ]], + ["function", [ + "string", + ["punctuation", "."], + "sub" + ]], + ["function", [ + "string", + ["punctuation", "."], + "upper" + ]], + ["function", [ + "table", + ["punctuation", "."], + "concat" + ]], + ["function", [ + "table", + ["punctuation", "."], + "insert" + ]], + ["function", [ + "table", + ["punctuation", "."], + "maxn" + ]], + ["function", [ + "table", + ["punctuation", "."], + "remove" + ]], + ["function", [ + "table", + ["punctuation", "."], + "sort" + ]], + ["function", [ + "tonumber" + ]], + ["function", [ + "tostring" + ]], + ["function", [ + "type" + ]], + ["function", [ + "unpack" + ]], + ["function", [ + "xpcall" + ]] +] diff --git a/package/src/prism/tests/languages/moonscript/keyword_feature.test b/package/src/prism/tests/languages/moonscript/keyword_feature.test new file mode 100644 index 00000000..cad66b48 --- /dev/null +++ b/package/src/prism/tests/languages/moonscript/keyword_feature.test @@ -0,0 +1,57 @@ +class +continue +do +else +elseif +export +extends +for +from +if +import +in +local +nil +return +self +super +switch +then +unless +using +when +while +with + +---------------------------------------------------- + +[ + ["keyword", "class"], + ["keyword", "continue"], + ["keyword", "do"], + ["keyword", "else"], + ["keyword", "elseif"], + ["keyword", "export"], + ["keyword", "extends"], + ["keyword", "for"], + ["keyword", "from"], + ["keyword", "if"], + ["keyword", "import"], + ["keyword", "in"], + ["keyword", "local"], + ["keyword", "nil"], + ["keyword", "return"], + ["keyword", "self"], + ["keyword", "super"], + ["keyword", "switch"], + ["keyword", "then"], + ["keyword", "unless"], + ["keyword", "using"], + ["keyword", "when"], + ["keyword", "while"], + ["keyword", "with"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/moonscript/number_feature.test b/package/src/prism/tests/languages/moonscript/number_feature.test new file mode 100644 index 00000000..61733060 --- /dev/null +++ b/package/src/prism/tests/languages/moonscript/number_feature.test @@ -0,0 +1,48 @@ +121 +121.2323 +121.2323e-1 +121.2323e13434 +2323E34 +0x12323 + +0xfF2323 +0xabcdef +0xABCDEF + +.2323 +.2323e-1 +.2323e13434 + +1LL +1ULL +9332LL +9332 +0x2aLL +0x2aULL + +---------------------------------------------------- + +[ + ["number", "121"], + ["number", "121.2323"], + ["number", "121.2323e-1"], + ["number", "121.2323e13434"], + ["number", "2323E34"], + ["number", "0x12323"], + ["number", "0xfF2323"], + ["number", "0xabcdef"], + ["number", "0xABCDEF"], + ["number", ".2323"], + ["number", ".2323e-1"], + ["number", ".2323e13434"], + ["number", "1LL"], + ["number", "1ULL"], + ["number", "9332LL"], + ["number", "9332"], + ["number", "0x2aLL"], + ["number", "0x2aULL"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/moonscript/operator_feature.test b/package/src/prism/tests/languages/moonscript/operator_feature.test new file mode 100644 index 00000000..ebb852a4 --- /dev/null +++ b/package/src/prism/tests/languages/moonscript/operator_feature.test @@ -0,0 +1,56 @@ ++ - * / % .. ++= -= *= /= %= ..= + +> >= < <= == != ~= + += : ... ^ # ! +-> => + +and or not +and= or= + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + ["operator", ".."], + + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + ["operator", "%="], + ["operator", "..="], + + ["operator", ">"], + ["operator", ">="], + ["operator", "<"], + ["operator", "<="], + ["operator", "=="], + ["operator", "!="], + ["operator", "~="], + + ["operator", "="], + ["operator", ":"], + ["operator", "..."], + ["operator", "^"], + ["operator", "#"], + ["operator", "!"], + + ["operator", "->"], + ["operator", "=>"], + + ["operator", "and"], + ["operator", "or"], + ["operator", "not"], + ["operator", "and="], + ["operator", "or="] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/moonscript/property_feature.test b/package/src/prism/tests/languages/moonscript/property_feature.test new file mode 100644 index 00000000..d426b612 --- /dev/null +++ b/package/src/prism/tests/languages/moonscript/property_feature.test @@ -0,0 +1,96 @@ +collection = + height: 32434 + hats: {"tophat", "bball", "bowler"} + +my_function dance: "Tango", partner: "none" +y = type: "dog", legs: 4, tails: 1 + +hair = "golden" +height = 200 +person = { :hair, :height, shoe_size: 40 } +print_table :hair, :height + +---------------------------------------------------- + +[ + "collection ", + ["operator", "="], + ["property", "height"], + ["operator", ":"], + ["number", "32434"], + ["property", "hats"], + ["operator", ":"], + ["punctuation", "{"], + ["string", [ + "\"tophat\"" + ]], + ["punctuation", ","], + ["string", [ + "\"bball\"" + ]], + ["punctuation", ","], + ["string", [ + "\"bowler\"" + ]], + ["punctuation", "}"], + + "\n\nmy_function ", + ["property", "dance"], + ["operator", ":"], + ["string", [ + "\"Tango\"" + ]], + ["punctuation", ","], + ["property", "partner"], + ["operator", ":"], + ["string", [ + "\"none\"" + ]], + "\ny ", + ["operator", "="], + ["property", "type"], + ["operator", ":"], + ["string", [ + "\"dog\"" + ]], + ["punctuation", ","], + ["property", "legs"], + ["operator", ":"], + ["number", "4"], + ["punctuation", ","], + ["property", "tails"], + ["operator", ":"], + ["number", "1"], + + "\n\nhair ", + ["operator", "="], + ["string", [ + "\"golden\"" + ]], + "\nheight ", + ["operator", "="], + ["number", "200"], + "\nperson ", + ["operator", "="], + ["punctuation", "{"], + ["operator", ":"], + ["property", "hair"], + ["punctuation", ","], + ["operator", ":"], + ["property", "height"], + ["punctuation", ","], + ["property", "shoe_size"], + ["operator", ":"], + ["number", "40"], + ["punctuation", "}"], + "\nprint_table ", + ["operator", ":"], + ["property", "hair"], + ["punctuation", ","], + ["operator", ":"], + ["property", "height"] +] + +---------------------------------------------------- + +Checks for properties. diff --git a/package/src/prism/tests/languages/moonscript/punctuation_feature.test b/package/src/prism/tests/languages/moonscript/punctuation_feature.test new file mode 100644 index 00000000..5d897bc4 --- /dev/null +++ b/package/src/prism/tests/languages/moonscript/punctuation_feature.test @@ -0,0 +1,21 @@ +. , \ +() [] {} + +---------------------------------------------------- + +[ + ["punctuation", "."], + ["punctuation", ","], + ["punctuation", "\\"], + + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for punctuation. diff --git a/package/src/prism/tests/languages/moonscript/string_feature.test b/package/src/prism/tests/languages/moonscript/string_feature.test new file mode 100644 index 00000000..164c0cff --- /dev/null +++ b/package/src/prism/tests/languages/moonscript/string_feature.test @@ -0,0 +1,51 @@ +"" +"MoonScript +has multiline strings" + +"Hello, I am #{@name}!" + +'' +'foo +bar' +' #{no interpolation here} ' + +[==[ + +moon + +]==] +[[(.-\)[^\]+$]] + +---------------------------------------------------- + +[ + ["string", [ + "\"\"" + ]], + ["string", [ + "\"MoonScript\nhas multiline strings\"" + ]], + + ["string", [ + "\"Hello, I am ", + ["interpolation", [ + ["interpolation-punctuation", "#{"], + ["moonscript", [ + ["variable", "@name"] + ]], + ["interpolation-punctuation", "}"] + ]], + "!\"" + ]], + + ["string", "''"], + ["string", "'foo\nbar'"], + ["string", "' #{no interpolation here} '"], + + ["string", "[==[\n\nmoon\n\n]==]"], + ["string", "[[(.-\\)[^\\]+$]]"] +] + +---------------------------------------------------- + +Checks for strings and string interpolation. diff --git a/package/src/prism/tests/languages/moonscript/variable_feature.test b/package/src/prism/tests/languages/moonscript/variable_feature.test new file mode 100644 index 00000000..f472716f --- /dev/null +++ b/package/src/prism/tests/languages/moonscript/variable_feature.test @@ -0,0 +1,15 @@ +@ @@ +@var @@var + +---------------------------------------------------- + +[ + ["variable", "@"], + ["variable", "@@"], + ["variable", "@var"], + ["variable", "@@var"] +] + +---------------------------------------------------- + +Checks for variables. diff --git a/package/src/prism/tests/languages/n1ql/boolean_feature.test b/package/src/prism/tests/languages/n1ql/boolean_feature.test new file mode 100644 index 00000000..f3372be3 --- /dev/null +++ b/package/src/prism/tests/languages/n1ql/boolean_feature.test @@ -0,0 +1,14 @@ +TRUE +FALSE + + +---------------------------------------------------- + +[ + ["boolean", "TRUE"], + ["boolean", "FALSE"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/n1ql/comment_feature.test b/package/src/prism/tests/languages/n1ql/comment_feature.test new file mode 100644 index 00000000..e1b05a0c --- /dev/null +++ b/package/src/prism/tests/languages/n1ql/comment_feature.test @@ -0,0 +1,18 @@ +/**/ +/* foo +bar */ + +-- comment + +---------------------------------------------------- + +[ + ["comment", "/**/"], + ["comment", "/* foo\nbar */"], + + ["comment", "-- comment"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/n1ql/function_feature.test b/package/src/prism/tests/languages/n1ql/function_feature.test new file mode 100644 index 00000000..00b5d12f --- /dev/null +++ b/package/src/prism/tests/languages/n1ql/function_feature.test @@ -0,0 +1,359 @@ +ABS( +ACOS( +ARRAY_AGG( +ARRAY_APPEND( +ARRAY_AVG( +ARRAY_CONCAT( +ARRAY_CONTAINS( +ARRAY_COUNT( +ARRAY_DISTINCT( +ARRAY_FLATTEN( +ARRAY_IFNULL( +ARRAY_INSERT( +ARRAY_INTERSECT( +ARRAY_LENGTH( +ARRAY_MAX( +ARRAY_MIN( +ARRAY_POSITION( +ARRAY_PREPEND( +ARRAY_PUT( +ARRAY_RANGE( +ARRAY_REMOVE( +ARRAY_REPEAT( +ARRAY_REPLACE( +ARRAY_REVERSE( +ARRAY_SORT( +ARRAY_STAR( +ARRAY_SUM( +ARRAY_SYMDIFF( +ARRAY_SYMDIFFN( +ARRAY_UNION( +ASIN( +ATAN( +ATAN2( +AVG( +BASE64( +BASE64_DECODE( +BASE64_ENCODE( +BITAND( +BITCLEAR( +BITNOT( +BITOR( +BITSET( +BITSHIFT( +BITTEST( +BITXOR( +CEIL( +CLOCK_LOCAL( +CLOCK_MILLIS( +CLOCK_STR( +CLOCK_TZ( +CLOCK_UTC( +CONTAINS( +CONTAINS_TOKEN( +CONTAINS_TOKEN_LIKE( +CONTAINS_TOKEN_REGEXP( +COS( +COUNT( +CURL( +DATE_ADD_MILLIS( +DATE_ADD_STR( +DATE_DIFF_MILLIS( +DATE_DIFF_STR( +DATE_FORMAT_STR( +DATE_PART_MILLIS( +DATE_PART_STR( +DATE_RANGE_MILLIS( +DATE_RANGE_STR( +DATE_TRUNC_MILLIS( +DATE_TRUNC_STR( +DECODE_JSON( +DEGREES( +DURATION_TO_STR( +E( +ENCODED_SIZE( +ENCODE_JSON( +EXP( +FLOOR( +GREATEST( +HAS_TOKEN( +IFINF( +IFMISSING( +IFMISSINGORNULL( +IFNAN( +IFNANORINF( +IFNULL( +INITCAP( +ISARRAY( +ISATOM( +ISBOOLEAN( +ISNUMBER( +ISOBJECT( +ISSTRING( +IsBitSET( +LEAST( +LENGTH( +LN( +LOG( +LOWER( +LTRIM( +MAX( +META( +MILLIS( +MILLIS_TO_LOCAL( +MILLIS_TO_STR( +MILLIS_TO_TZ( +MILLIS_TO_UTC( +MILLIS_TO_ZONE_NAME( +MIN( +MISSINGIF( +NANIF( +NEGINFIF( +NOW_LOCAL( +NOW_MILLIS( +NOW_STR( +NOW_TZ( +NOW_UTC( +NULLIF( +OBJECT_ADD( +OBJECT_CONCAT( +OBJECT_INNER_PAIRS( +OBJECT_INNER_VALUES( +OBJECT_LENGTH( +OBJECT_NAMES( +OBJECT_PAIRS( +OBJECT_PUT( +OBJECT_REMOVE( +OBJECT_RENAME( +OBJECT_REPLACE( +OBJECT_UNWRAP( +OBJECT_VALUES( +PAIRS( +PI( +POLY_LENGTH( +POSINFIF( +POSITION( +POWER( +RADIANS( +RANDOM( +REGEXP_CONTAINS( +REGEXP_LIKE( +REGEXP_POSITION( +REGEXP_REPLACE( +REPEAT( +REPLACE( +REVERSE( +ROUND( +RTRIM( +SIGN( +SIN( +SPLIT( +SQRT( +STR_TO_DURATION( +STR_TO_MILLIS( +STR_TO_TZ( +STR_TO_UTC( +STR_TO_ZONE_NAME( +SUBSTR( +SUFFIXES( +SUM( +TAN( +TITLE( +TOARRAY( +TOATOM( +TOBOOLEAN( +TOKENS( +TOKENS( +TONUMBER( +TOOBJECT( +TOSTRING( +TRIM( +TRUNC( +TYPE( +UPPER( +WEEKDAY_MILLIS( +WEEKDAY_STR( + +---------------------------------------------------- + +[ + ["function", "ABS"], ["punctuation", "("], + ["function", "ACOS"], ["punctuation", "("], + ["function", "ARRAY_AGG"], ["punctuation", "("], + ["function", "ARRAY_APPEND"], ["punctuation", "("], + ["function", "ARRAY_AVG"], ["punctuation", "("], + ["function", "ARRAY_CONCAT"], ["punctuation", "("], + ["function", "ARRAY_CONTAINS"], ["punctuation", "("], + ["function", "ARRAY_COUNT"], ["punctuation", "("], + ["function", "ARRAY_DISTINCT"], ["punctuation", "("], + ["function", "ARRAY_FLATTEN"], ["punctuation", "("], + ["function", "ARRAY_IFNULL"], ["punctuation", "("], + ["function", "ARRAY_INSERT"], ["punctuation", "("], + ["function", "ARRAY_INTERSECT"], ["punctuation", "("], + ["function", "ARRAY_LENGTH"], ["punctuation", "("], + ["function", "ARRAY_MAX"], ["punctuation", "("], + ["function", "ARRAY_MIN"], ["punctuation", "("], + ["function", "ARRAY_POSITION"], ["punctuation", "("], + ["function", "ARRAY_PREPEND"], ["punctuation", "("], + ["function", "ARRAY_PUT"], ["punctuation", "("], + ["function", "ARRAY_RANGE"], ["punctuation", "("], + ["function", "ARRAY_REMOVE"], ["punctuation", "("], + ["function", "ARRAY_REPEAT"], ["punctuation", "("], + ["function", "ARRAY_REPLACE"], ["punctuation", "("], + ["function", "ARRAY_REVERSE"], ["punctuation", "("], + ["function", "ARRAY_SORT"], ["punctuation", "("], + ["function", "ARRAY_STAR"], ["punctuation", "("], + ["function", "ARRAY_SUM"], ["punctuation", "("], + ["function", "ARRAY_SYMDIFF"], ["punctuation", "("], + ["function", "ARRAY_SYMDIFFN"], ["punctuation", "("], + ["function", "ARRAY_UNION"], ["punctuation", "("], + ["function", "ASIN"], ["punctuation", "("], + ["function", "ATAN"], ["punctuation", "("], + ["function", "ATAN2"], ["punctuation", "("], + ["function", "AVG"], ["punctuation", "("], + ["function", "BASE64"], ["punctuation", "("], + ["function", "BASE64_DECODE"], ["punctuation", "("], + ["function", "BASE64_ENCODE"], ["punctuation", "("], + ["function", "BITAND"], ["punctuation", "("], + ["function", "BITCLEAR"], ["punctuation", "("], + ["function", "BITNOT"], ["punctuation", "("], + ["function", "BITOR"], ["punctuation", "("], + ["function", "BITSET"], ["punctuation", "("], + ["function", "BITSHIFT"], ["punctuation", "("], + ["function", "BITTEST"], ["punctuation", "("], + ["function", "BITXOR"], ["punctuation", "("], + ["function", "CEIL"], ["punctuation", "("], + ["function", "CLOCK_LOCAL"], ["punctuation", "("], + ["function", "CLOCK_MILLIS"], ["punctuation", "("], + ["function", "CLOCK_STR"], ["punctuation", "("], + ["function", "CLOCK_TZ"], ["punctuation", "("], + ["function", "CLOCK_UTC"], ["punctuation", "("], + ["function", "CONTAINS"], ["punctuation", "("], + ["function", "CONTAINS_TOKEN"], ["punctuation", "("], + ["function", "CONTAINS_TOKEN_LIKE"], ["punctuation", "("], + ["function", "CONTAINS_TOKEN_REGEXP"], ["punctuation", "("], + ["function", "COS"], ["punctuation", "("], + ["function", "COUNT"], ["punctuation", "("], + ["function", "CURL"], ["punctuation", "("], + ["function", "DATE_ADD_MILLIS"], ["punctuation", "("], + ["function", "DATE_ADD_STR"], ["punctuation", "("], + ["function", "DATE_DIFF_MILLIS"], ["punctuation", "("], + ["function", "DATE_DIFF_STR"], ["punctuation", "("], + ["function", "DATE_FORMAT_STR"], ["punctuation", "("], + ["function", "DATE_PART_MILLIS"], ["punctuation", "("], + ["function", "DATE_PART_STR"], ["punctuation", "("], + ["function", "DATE_RANGE_MILLIS"], ["punctuation", "("], + ["function", "DATE_RANGE_STR"], ["punctuation", "("], + ["function", "DATE_TRUNC_MILLIS"], ["punctuation", "("], + ["function", "DATE_TRUNC_STR"], ["punctuation", "("], + ["function", "DECODE_JSON"], ["punctuation", "("], + ["function", "DEGREES"], ["punctuation", "("], + ["function", "DURATION_TO_STR"], ["punctuation", "("], + ["function", "E"], ["punctuation", "("], + ["function", "ENCODED_SIZE"], ["punctuation", "("], + ["function", "ENCODE_JSON"], ["punctuation", "("], + ["function", "EXP"], ["punctuation", "("], + ["function", "FLOOR"], ["punctuation", "("], + ["function", "GREATEST"], ["punctuation", "("], + ["function", "HAS_TOKEN"], ["punctuation", "("], + ["function", "IFINF"], ["punctuation", "("], + ["function", "IFMISSING"], ["punctuation", "("], + ["function", "IFMISSINGORNULL"], ["punctuation", "("], + ["function", "IFNAN"], ["punctuation", "("], + ["function", "IFNANORINF"], ["punctuation", "("], + ["function", "IFNULL"], ["punctuation", "("], + ["function", "INITCAP"], ["punctuation", "("], + ["function", "ISARRAY"], ["punctuation", "("], + ["function", "ISATOM"], ["punctuation", "("], + ["function", "ISBOOLEAN"], ["punctuation", "("], + ["function", "ISNUMBER"], ["punctuation", "("], + ["function", "ISOBJECT"], ["punctuation", "("], + ["function", "ISSTRING"], ["punctuation", "("], + ["function", "IsBitSET"], ["punctuation", "("], + ["function", "LEAST"], ["punctuation", "("], + ["function", "LENGTH"], ["punctuation", "("], + ["function", "LN"], ["punctuation", "("], + ["function", "LOG"], ["punctuation", "("], + ["function", "LOWER"], ["punctuation", "("], + ["function", "LTRIM"], ["punctuation", "("], + ["function", "MAX"], ["punctuation", "("], + ["function", "META"], ["punctuation", "("], + ["function", "MILLIS"], ["punctuation", "("], + ["function", "MILLIS_TO_LOCAL"], ["punctuation", "("], + ["function", "MILLIS_TO_STR"], ["punctuation", "("], + ["function", "MILLIS_TO_TZ"], ["punctuation", "("], + ["function", "MILLIS_TO_UTC"], ["punctuation", "("], + ["function", "MILLIS_TO_ZONE_NAME"], ["punctuation", "("], + ["function", "MIN"], ["punctuation", "("], + ["function", "MISSINGIF"], ["punctuation", "("], + ["function", "NANIF"], ["punctuation", "("], + ["function", "NEGINFIF"], ["punctuation", "("], + ["function", "NOW_LOCAL"], ["punctuation", "("], + ["function", "NOW_MILLIS"], ["punctuation", "("], + ["function", "NOW_STR"], ["punctuation", "("], + ["function", "NOW_TZ"], ["punctuation", "("], + ["function", "NOW_UTC"], ["punctuation", "("], + ["function", "NULLIF"], ["punctuation", "("], + ["function", "OBJECT_ADD"], ["punctuation", "("], + ["function", "OBJECT_CONCAT"], ["punctuation", "("], + ["function", "OBJECT_INNER_PAIRS"], ["punctuation", "("], + ["function", "OBJECT_INNER_VALUES"], ["punctuation", "("], + ["function", "OBJECT_LENGTH"], ["punctuation", "("], + ["function", "OBJECT_NAMES"], ["punctuation", "("], + ["function", "OBJECT_PAIRS"], ["punctuation", "("], + ["function", "OBJECT_PUT"], ["punctuation", "("], + ["function", "OBJECT_REMOVE"], ["punctuation", "("], + ["function", "OBJECT_RENAME"], ["punctuation", "("], + ["function", "OBJECT_REPLACE"], ["punctuation", "("], + ["function", "OBJECT_UNWRAP"], ["punctuation", "("], + ["function", "OBJECT_VALUES"], ["punctuation", "("], + ["function", "PAIRS"], ["punctuation", "("], + ["function", "PI"], ["punctuation", "("], + ["function", "POLY_LENGTH"], ["punctuation", "("], + ["function", "POSINFIF"], ["punctuation", "("], + ["function", "POSITION"], ["punctuation", "("], + ["function", "POWER"], ["punctuation", "("], + ["function", "RADIANS"], ["punctuation", "("], + ["function", "RANDOM"], ["punctuation", "("], + ["function", "REGEXP_CONTAINS"], ["punctuation", "("], + ["function", "REGEXP_LIKE"], ["punctuation", "("], + ["function", "REGEXP_POSITION"], ["punctuation", "("], + ["function", "REGEXP_REPLACE"], ["punctuation", "("], + ["function", "REPEAT"], ["punctuation", "("], + ["function", "REPLACE"], ["punctuation", "("], + ["function", "REVERSE"], ["punctuation", "("], + ["function", "ROUND"], ["punctuation", "("], + ["function", "RTRIM"], ["punctuation", "("], + ["function", "SIGN"], ["punctuation", "("], + ["function", "SIN"], ["punctuation", "("], + ["function", "SPLIT"], ["punctuation", "("], + ["function", "SQRT"], ["punctuation", "("], + ["function", "STR_TO_DURATION"], ["punctuation", "("], + ["function", "STR_TO_MILLIS"], ["punctuation", "("], + ["function", "STR_TO_TZ"], ["punctuation", "("], + ["function", "STR_TO_UTC"], ["punctuation", "("], + ["function", "STR_TO_ZONE_NAME"], ["punctuation", "("], + ["function", "SUBSTR"], ["punctuation", "("], + ["function", "SUFFIXES"], ["punctuation", "("], + ["function", "SUM"], ["punctuation", "("], + ["function", "TAN"], ["punctuation", "("], + ["function", "TITLE"], ["punctuation", "("], + ["function", "TOARRAY"], ["punctuation", "("], + ["function", "TOATOM"], ["punctuation", "("], + ["function", "TOBOOLEAN"], ["punctuation", "("], + ["function", "TOKENS"], ["punctuation", "("], + ["function", "TOKENS"], ["punctuation", "("], + ["function", "TONUMBER"], ["punctuation", "("], + ["function", "TOOBJECT"], ["punctuation", "("], + ["function", "TOSTRING"], ["punctuation", "("], + ["function", "TRIM"], ["punctuation", "("], + ["function", "TRUNC"], ["punctuation", "("], + ["function", "TYPE"], ["punctuation", "("], + ["function", "UPPER"], ["punctuation", "("], + ["function", "WEEKDAY_MILLIS"], ["punctuation", "("], + ["function", "WEEKDAY_STR"], ["punctuation", "("] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/n1ql/identifier_feature.test b/package/src/prism/tests/languages/n1ql/identifier_feature.test new file mode 100644 index 00000000..0bbb3bcb --- /dev/null +++ b/package/src/prism/tests/languages/n1ql/identifier_feature.test @@ -0,0 +1,19 @@ +`` +`foo` +`foo bar` +`foo +bar` + + +---------------------------------------------------- + +[ + ["identifier", "``"], + ["identifier", "`foo`"], + ["identifier", "`foo bar`"], + ["identifier", "`foo\nbar`"] +] + +---------------------------------------------------- + +Checks for escaped identifiers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/n1ql/keyword_feature.test b/package/src/prism/tests/languages/n1ql/keyword_feature.test new file mode 100644 index 00000000..787f76aa --- /dev/null +++ b/package/src/prism/tests/languages/n1ql/keyword_feature.test @@ -0,0 +1,379 @@ +ADVISE +ALL +ALTER +ANALYZE +AS +ASC +AT +BEGIN +BINARY +BOOLEAN +BREAK +BUCKET +BUILD +BY +CALL +CAST +CLUSTER +COLLATE +COLLECTION +COMMIT +COMMITTED +CONNECT +CONTINUE +CORRELATE +CORRELATED +COVER +CREATE +CURRENT +DATABASE +DATASET +DATASTORE +DECLARE +DECREMENT +DELETE +DERIVED +DESC +DESCRIBE +DISTINCT +DO +DROP +EACH +ELEMENT +EXCEPT +EXCLUDE +EXECUTE +EXPLAIN +FETCH +FILTER +FLATTEN +FLUSH +FOLLOWING +FOR +FORCE +FROM +FTS +FUNCTION +GOLANG +GRANT +GROUP +GROUPS +GSI +HASH +HAVING +IF +IGNORE +ILIKE +INCLUDE +INCREMENT +INDEX +INFER +INLINE +INNER +INSERT +INTERSECT +INTO +IS +ISOLATION +JAVASCRIPT +JOIN +KEY +KEYS +KEYSPACE +KNOWN +LANGUAGE +LAST +LEFT +LET +LETTING +LEVEL +LIMIT +LSM +MAP +MAPPING +MATCHED +MATERIALIZED +MERGE +MINUS +MISSING +NAMESPACE +NEST +NL +NO +NTH_VALUE +NULL +NULLS +NUMBER +OBJECT +OFFSET +ON +OPTION +OPTIONS +ORDER +OTHERS +OUTER +OVER +PARSE +PARTITION +PASSWORD +PATH +POOL +PRECEDING +PREPARE +PRIMARY +PRIVATE +PRIVILEGE +PROBE +PROCEDURE +PUBLIC +RANGE +RAW +REALM +REDUCE +RENAME +RESPECT +RETURN +RETURNING +REVOKE +RIGHT +ROLE +ROLLBACK +ROW +ROWS +SATISFIES +SAVEPOINT +SCHEMA +SCOPE +SELECT +SELF +SEMI +SET +SHOW +SOME +START +STATISTICS +STRING +SYSTEM +TIES +TO +TRAN +TRANSACTION +TRIGGER +TRUNCATE +UNBOUNDED +UNDER +UNION +UNIQUE +UNKNOWN +UNNEST +UNSET +UPDATE +UPSERT +USE +USER +USING +VALIDATE +VALUE +VALUES +VIA +VIEW +WHERE +WHILE +WINDOW +WITH +WORK +XOR + +---------------------------------------------------- + +[ + ["keyword", "ADVISE"], + ["keyword", "ALL"], + ["keyword", "ALTER"], + ["keyword", "ANALYZE"], + ["keyword", "AS"], + ["keyword", "ASC"], + ["keyword", "AT"], + ["keyword", "BEGIN"], + ["keyword", "BINARY"], + ["keyword", "BOOLEAN"], + ["keyword", "BREAK"], + ["keyword", "BUCKET"], + ["keyword", "BUILD"], + ["keyword", "BY"], + ["keyword", "CALL"], + ["keyword", "CAST"], + ["keyword", "CLUSTER"], + ["keyword", "COLLATE"], + ["keyword", "COLLECTION"], + ["keyword", "COMMIT"], + ["keyword", "COMMITTED"], + ["keyword", "CONNECT"], + ["keyword", "CONTINUE"], + ["keyword", "CORRELATE"], + ["keyword", "CORRELATED"], + ["keyword", "COVER"], + ["keyword", "CREATE"], + ["keyword", "CURRENT"], + ["keyword", "DATABASE"], + ["keyword", "DATASET"], + ["keyword", "DATASTORE"], + ["keyword", "DECLARE"], + ["keyword", "DECREMENT"], + ["keyword", "DELETE"], + ["keyword", "DERIVED"], + ["keyword", "DESC"], + ["keyword", "DESCRIBE"], + ["keyword", "DISTINCT"], + ["keyword", "DO"], + ["keyword", "DROP"], + ["keyword", "EACH"], + ["keyword", "ELEMENT"], + ["keyword", "EXCEPT"], + ["keyword", "EXCLUDE"], + ["keyword", "EXECUTE"], + ["keyword", "EXPLAIN"], + ["keyword", "FETCH"], + ["keyword", "FILTER"], + ["keyword", "FLATTEN"], + ["keyword", "FLUSH"], + ["keyword", "FOLLOWING"], + ["keyword", "FOR"], + ["keyword", "FORCE"], + ["keyword", "FROM"], + ["keyword", "FTS"], + ["keyword", "FUNCTION"], + ["keyword", "GOLANG"], + ["keyword", "GRANT"], + ["keyword", "GROUP"], + ["keyword", "GROUPS"], + ["keyword", "GSI"], + ["keyword", "HASH"], + ["keyword", "HAVING"], + ["keyword", "IF"], + ["keyword", "IGNORE"], + ["keyword", "ILIKE"], + ["keyword", "INCLUDE"], + ["keyword", "INCREMENT"], + ["keyword", "INDEX"], + ["keyword", "INFER"], + ["keyword", "INLINE"], + ["keyword", "INNER"], + ["keyword", "INSERT"], + ["keyword", "INTERSECT"], + ["keyword", "INTO"], + ["keyword", "IS"], + ["keyword", "ISOLATION"], + ["keyword", "JAVASCRIPT"], + ["keyword", "JOIN"], + ["keyword", "KEY"], + ["keyword", "KEYS"], + ["keyword", "KEYSPACE"], + ["keyword", "KNOWN"], + ["keyword", "LANGUAGE"], + ["keyword", "LAST"], + ["keyword", "LEFT"], + ["keyword", "LET"], + ["keyword", "LETTING"], + ["keyword", "LEVEL"], + ["keyword", "LIMIT"], + ["keyword", "LSM"], + ["keyword", "MAP"], + ["keyword", "MAPPING"], + ["keyword", "MATCHED"], + ["keyword", "MATERIALIZED"], + ["keyword", "MERGE"], + ["keyword", "MINUS"], + ["keyword", "MISSING"], + ["keyword", "NAMESPACE"], + ["keyword", "NEST"], + ["keyword", "NL"], + ["keyword", "NO"], + ["keyword", "NTH_VALUE"], + ["keyword", "NULL"], + ["keyword", "NULLS"], + ["keyword", "NUMBER"], + ["keyword", "OBJECT"], + ["keyword", "OFFSET"], + ["keyword", "ON"], + ["keyword", "OPTION"], + ["keyword", "OPTIONS"], + ["keyword", "ORDER"], + ["keyword", "OTHERS"], + ["keyword", "OUTER"], + ["keyword", "OVER"], + ["keyword", "PARSE"], + ["keyword", "PARTITION"], + ["keyword", "PASSWORD"], + ["keyword", "PATH"], + ["keyword", "POOL"], + ["keyword", "PRECEDING"], + ["keyword", "PREPARE"], + ["keyword", "PRIMARY"], + ["keyword", "PRIVATE"], + ["keyword", "PRIVILEGE"], + ["keyword", "PROBE"], + ["keyword", "PROCEDURE"], + ["keyword", "PUBLIC"], + ["keyword", "RANGE"], + ["keyword", "RAW"], + ["keyword", "REALM"], + ["keyword", "REDUCE"], + ["keyword", "RENAME"], + ["keyword", "RESPECT"], + ["keyword", "RETURN"], + ["keyword", "RETURNING"], + ["keyword", "REVOKE"], + ["keyword", "RIGHT"], + ["keyword", "ROLE"], + ["keyword", "ROLLBACK"], + ["keyword", "ROW"], + ["keyword", "ROWS"], + ["keyword", "SATISFIES"], + ["keyword", "SAVEPOINT"], + ["keyword", "SCHEMA"], + ["keyword", "SCOPE"], + ["keyword", "SELECT"], + ["keyword", "SELF"], + ["keyword", "SEMI"], + ["keyword", "SET"], + ["keyword", "SHOW"], + ["keyword", "SOME"], + ["keyword", "START"], + ["keyword", "STATISTICS"], + ["keyword", "STRING"], + ["keyword", "SYSTEM"], + ["keyword", "TIES"], + ["keyword", "TO"], + ["keyword", "TRAN"], + ["keyword", "TRANSACTION"], + ["keyword", "TRIGGER"], + ["keyword", "TRUNCATE"], + ["keyword", "UNBOUNDED"], + ["keyword", "UNDER"], + ["keyword", "UNION"], + ["keyword", "UNIQUE"], + ["keyword", "UNKNOWN"], + ["keyword", "UNNEST"], + ["keyword", "UNSET"], + ["keyword", "UPDATE"], + ["keyword", "UPSERT"], + ["keyword", "USE"], + ["keyword", "USER"], + ["keyword", "USING"], + ["keyword", "VALIDATE"], + ["keyword", "VALUE"], + ["keyword", "VALUES"], + ["keyword", "VIA"], + ["keyword", "VIEW"], + ["keyword", "WHERE"], + ["keyword", "WHILE"], + ["keyword", "WINDOW"], + ["keyword", "WITH"], + ["keyword", "WORK"], + ["keyword", "XOR"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/n1ql/number_feature.test b/package/src/prism/tests/languages/n1ql/number_feature.test new file mode 100644 index 00000000..9ff7deca --- /dev/null +++ b/package/src/prism/tests/languages/n1ql/number_feature.test @@ -0,0 +1,19 @@ +42 +0.154 +3.1E+7 +.02e2 +2. + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "0.154"], + ["number", "3.1E+7"], + ["number", ".02e2"], + ["number", "2."] +] + +---------------------------------------------------- + +Checks for integers, decimal and e-notation numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/n1ql/operator_feature.test b/package/src/prism/tests/languages/n1ql/operator_feature.test new file mode 100644 index 00000000..86fd5925 --- /dev/null +++ b/package/src/prism/tests/languages/n1ql/operator_feature.test @@ -0,0 +1,56 @@ ++ - * / += % || +!= +< <= <> +> >= + +AND +ANY +ARRAY +BETWEEN +CASE +ELSE +END +EVERY +EXISTS +FIRST +IN +LIKE +NOT +OR +THEN +VALUED +WHEN +WITHIN + +---------------------------------------------------- + +[ + ["operator", "+"], ["operator", "-"], ["operator", "*"], ["operator", "/"], + ["operator", "="], ["operator", "%"], ["operator", "||"], + ["operator", "!="], + ["operator", "<"], ["operator", "<="], ["operator", "<>"], + ["operator", ">"], ["operator", ">="], + ["operator", "AND"], + ["operator", "ANY"], + ["operator", "ARRAY"], + ["operator", "BETWEEN"], + ["operator", "CASE"], + ["operator", "ELSE"], + ["operator", "END"], + ["operator", "EVERY"], + ["operator", "EXISTS"], + ["operator", "FIRST"], + ["operator", "IN"], + ["operator", "LIKE"], + ["operator", "NOT"], + ["operator", "OR"], + ["operator", "THEN"], + ["operator", "VALUED"], + ["operator", "WHEN"], + ["operator", "WITHIN"] +] + +---------------------------------------------------- + +Checks for all operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/n1ql/parameter_feature.test b/package/src/prism/tests/languages/n1ql/parameter_feature.test new file mode 100644 index 00000000..8810b654 --- /dev/null +++ b/package/src/prism/tests/languages/n1ql/parameter_feature.test @@ -0,0 +1,13 @@ +$1 +$named_parameter + +---------------------------------------------------- + +[ + ["parameter", "$1"], + ["parameter", "$named_parameter"] +] + +---------------------------------------------------- + +Checks for parameters. diff --git a/package/src/prism/tests/languages/n1ql/string_feature.test b/package/src/prism/tests/languages/n1ql/string_feature.test new file mode 100644 index 00000000..023d4695 --- /dev/null +++ b/package/src/prism/tests/languages/n1ql/string_feature.test @@ -0,0 +1,27 @@ +"" +"fo\"obar" +"foo +bar" +'' +'fo\'obar' +'foo +bar' +'foo''s bar' +"foo's ""bar""" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""], + ["string", "\"foo\nbar\""], + ["string", "''"], + ["string", "'fo\\'obar'"], + ["string", "'foo\nbar'"], + ["string", "'foo''s bar'"], + ["string", "\"foo's \"\"bar\"\"\""] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/n4js/annotation_feature.test b/package/src/prism/tests/languages/n4js/annotation_feature.test new file mode 100644 index 00000000..a52ed530 --- /dev/null +++ b/package/src/prism/tests/languages/n4js/annotation_feature.test @@ -0,0 +1,53 @@ +@Inject +@Internal +@Undefined +@StringBased +@Final +@GenerateInjector +@WithParentInjector +@Spec +@Override +@Promisifiable +@Promisify +@This +@N4JS +@IgnoreImplementation +@Global +@ProvidedByRuntime +@TestAPI +@Polyfill +@StaticPolyfill +@StaticPolyfillAware +@StaticPolyfillModule +@Transient + +---------------------------------------------------- + +[ + ["annotation", "@Inject"], + ["annotation", "@Internal"], + ["annotation", "@Undefined"], + ["annotation", "@StringBased"], + ["annotation", "@Final"], + ["annotation", "@GenerateInjector"], + ["annotation", "@WithParentInjector"], + ["annotation", "@Spec"], + ["annotation", "@Override"], + ["annotation", "@Promisifiable"], + ["annotation", "@Promisify"], + ["annotation", "@This"], + ["annotation", "@N4JS"], + ["annotation", "@IgnoreImplementation"], + ["annotation", "@Global"], + ["annotation", "@ProvidedByRuntime"], + ["annotation", "@TestAPI"], + ["annotation", "@Polyfill"], + ["annotation", "@StaticPolyfill"], + ["annotation", "@StaticPolyfillAware"], + ["annotation", "@StaticPolyfillModule"], + ["annotation", "@Transient"] +] + +---------------------------------------------------- + +Test for annotations. diff --git a/package/src/prism/tests/languages/n4js/keyword_feature.test b/package/src/prism/tests/languages/n4js/keyword_feature.test new file mode 100644 index 00000000..6d2fc5a8 --- /dev/null +++ b/package/src/prism/tests/languages/n4js/keyword_feature.test @@ -0,0 +1,121 @@ +any +Array +boolean +break +case +catch +class; +const +constructor +continue +debugger +declare +default +delete +do +else +enum +export +extends; +false +finally +for +from +function +get +if +implements; +import +in +instanceof; +interface; +let +module +new; +null +number +package +private +protected +public +return +set +static +string +super +switch +this +throw +true +try +typeof +var +void +while +with +yield + +---------------------------------------------------- + +[ + ["keyword", "any"], + ["keyword", "Array"], + ["keyword", "boolean"], + ["keyword", "break"], + ["keyword", "case"], + ["keyword", "catch"], + ["keyword", "class"], ["punctuation", ";"], + ["keyword", "const"], + ["keyword", "constructor"], + ["keyword", "continue"], + ["keyword", "debugger"], + ["keyword", "declare"], + ["keyword", "default"], + ["keyword", "delete"], + ["keyword", "do"], + ["keyword", "else"], + ["keyword", "enum"], + ["keyword", "export"], + ["keyword", "extends"], ["punctuation", ";"], + ["keyword", "false"], + ["keyword", "finally"], + ["keyword", "for"], + ["keyword", "from"], + ["keyword", "function"], + ["keyword", "get"], + ["keyword", "if"], + ["keyword", "implements"], ["punctuation", ";"], + ["keyword", "import"], + ["keyword", "in"], + ["keyword", "instanceof"], ["punctuation", ";"], + ["keyword", "interface"], ["punctuation", ";"], + ["keyword", "let"], + ["keyword", "module"], + ["keyword", "new"], ["punctuation", ";"], + ["keyword", "null"], + ["keyword", "number"], + ["keyword", "package"], + ["keyword", "private"], + ["keyword", "protected"], + ["keyword", "public"], + ["keyword", "return"], + ["keyword", "set"], + ["keyword", "static"], + ["keyword", "string"], + ["keyword", "super"], + ["keyword", "switch"], + ["keyword", "this"], + ["keyword", "throw"], + ["keyword", "true"], + ["keyword", "try"], + ["keyword", "typeof"], + ["keyword", "var"], + ["keyword", "void"], + ["keyword", "while"], + ["keyword", "with"], + ["keyword", "yield"] +] + +---------------------------------------------------- + +Tests N4JS keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nand2tetris-hdl/boolean_feature.test b/package/src/prism/tests/languages/nand2tetris-hdl/boolean_feature.test new file mode 100644 index 00000000..ca34f181 --- /dev/null +++ b/package/src/prism/tests/languages/nand2tetris-hdl/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/nand2tetris-hdl/comment_feature.test b/package/src/prism/tests/languages/nand2tetris-hdl/comment_feature.test new file mode 100644 index 00000000..4dc5ac74 --- /dev/null +++ b/package/src/prism/tests/languages/nand2tetris-hdl/comment_feature.test @@ -0,0 +1,20 @@ +// foobar +/**/ +/* foo +bar */ +/* + * foobar + */ + +---------------------------------------------------- + +[ + ["comment", "// foobar"], + ["comment", "/**/"], + ["comment", "/* foo\nbar */"], + ["comment", "/*\n * foobar\n */"] +] + +---------------------------------------------------- + +Checks for single-line and multi-line comments. diff --git a/package/src/prism/tests/languages/nand2tetris-hdl/function_feature.test b/package/src/prism/tests/languages/nand2tetris-hdl/function_feature.test new file mode 100644 index 00000000..e9c34619 --- /dev/null +++ b/package/src/prism/tests/languages/nand2tetris-hdl/function_feature.test @@ -0,0 +1,23 @@ +And() +not() +mux16() + +---------------------------------------------------- + +[ + ["function", "And"], + ["punctuation", "("], + ["punctuation", ")"], + + ["function", "not"], + ["punctuation", "("], + ["punctuation", ")"], + + ["function", "mux16"], + ["punctuation", "("], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for functions. diff --git a/package/src/prism/tests/languages/nand2tetris-hdl/keyword_feature.test b/package/src/prism/tests/languages/nand2tetris-hdl/keyword_feature.test new file mode 100644 index 00000000..cfb535f4 --- /dev/null +++ b/package/src/prism/tests/languages/nand2tetris-hdl/keyword_feature.test @@ -0,0 +1,21 @@ +CHIP +IN +OUT +PARTS +BUILTIN +CLOCKED + +---------------------------------------------------- + +[ + ["keyword", "CHIP"], + ["keyword", "IN"], + ["keyword", "OUT"], + ["keyword", "PARTS"], + ["keyword", "BUILTIN"], + ["keyword", "CLOCKED"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/nand2tetris-hdl/number_feature.test b/package/src/prism/tests/languages/nand2tetris-hdl/number_feature.test new file mode 100644 index 00000000..9bd4b609 --- /dev/null +++ b/package/src/prism/tests/languages/nand2tetris-hdl/number_feature.test @@ -0,0 +1,15 @@ +0 +16 +32 + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "16"], + ["number", "32"] +] + +---------------------------------------------------- + +Checks for integer numbers. diff --git a/package/src/prism/tests/languages/nand2tetris-hdl/operator_feature.test b/package/src/prism/tests/languages/nand2tetris-hdl/operator_feature.test new file mode 100644 index 00000000..fac11603 --- /dev/null +++ b/package/src/prism/tests/languages/nand2tetris-hdl/operator_feature.test @@ -0,0 +1,13 @@ += +.. + +---------------------------------------------------- + +[ + ["operator", "="], + ["operator", ".."] +] + +---------------------------------------------------- + +Checks for all operators. diff --git a/package/src/prism/tests/languages/nand2tetris-hdl/punctuation_feature.test b/package/src/prism/tests/languages/nand2tetris-hdl/punctuation_feature.test new file mode 100644 index 00000000..3cc82beb --- /dev/null +++ b/package/src/prism/tests/languages/nand2tetris-hdl/punctuation_feature.test @@ -0,0 +1,23 @@ +( ) +{ } +[ ] +, +; +: + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", ":"] +] +---------------------------------------------------- + +Checks for punctuation. diff --git a/package/src/prism/tests/languages/naniscript/command_feature.test b/package/src/prism/tests/languages/naniscript/command_feature.test new file mode 100644 index 00000000..e852afb4 --- /dev/null +++ b/package/src/prism/tests/languages/naniscript/command_feature.test @@ -0,0 +1,207 @@ +@ +@ cmdWithWhiteSpaceBefore +@cmdWithTrailingSemicolon: +@paramlessCmd + @cmdWithNoParamsAndWhitespaceBefore + @cmdWithNoParamsAndTabBefore + @cmdWithNoParamsAndTabAndSpacesBefore + @cmdWithNoParamsWrappedInWhitespaces +@cmdWithNoParamWithTrailingSpace +@cmdWithNoParamWithMultipleTrailingSpaces +@cmdWithNoParamWithTrailingTab +@cmdWithNoParamWithTrailingTabAndSpaces +@cmdWithPositiveIntParam 1 +@cmdWithNegativeIntParam -1 +@cmdWithPositiveFloatParamAndNoFraction 1. +@cmdWithPositiveFloatParamAndFraction 1.10 +@cmdWithPositiveHegativeFloatParamAndNoFraction -1. +@cmdWithPositiveHegativeFloatParamAndFraction -1.10 +@cmdWithBoolParamAndPositive true +@cmdWithBoolParamAndNegative false +@cmdWithStringParam hello$co\:mma"d" +@cmdWithQuotedStringNamelessParameter "hello grizzly" +@cmdWithQuotedStringNamelessParameterWithEscapedQuotesInTheValue "hello \"grizzly\"" +@set choice="moe" +@command hello.grizzly +@command one,two,three +@command 1,2,3 +@command true,false,true +@command hi:grizzly +@command hi:1 +@command hi:true +@command 1 in:forest danger:true +@char 1 pos:0.25,-0.75 look:right + +---------------------------------------------------- + +[ + "@\n@ cmdWithWhiteSpaceBefore\n@cmdWithTrailingSemicolon:\n", + ["command", [ + ["command-name", "@paramlessCmd"] + ]], + ["command", [ + ["command-name", "@cmdWithNoParamsAndWhitespaceBefore"] + ]], + ["command", [ + ["command-name", "@cmdWithNoParamsAndTabBefore"] + ]], + ["command", [ + ["command-name", "@cmdWithNoParamsAndTabAndSpacesBefore"] + ]], + ["command", [ + ["command-name", "@cmdWithNoParamsWrappedInWhitespaces"] + ]], + ["command", [ + ["command-name", "@cmdWithNoParamWithTrailingSpace"] + ]], + ["command", [ + ["command-name", "@cmdWithNoParamWithMultipleTrailingSpaces"] + ]], + ["command", [ + ["command-name", "@cmdWithNoParamWithTrailingTab"] + ]], + ["command", [ + ["command-name", "@cmdWithNoParamWithTrailingTabAndSpaces"] + ]], + ["command", [ + ["command-name", "@cmdWithPositiveIntParam"], + ["command-params", [ + ["command-param-value", "1"] + ]] + ]], + ["command", [ + ["command-name", "@cmdWithNegativeIntParam"], + ["command-params", [ + ["command-param-value", "-1"] + ]] + ]], + ["command", [ + ["command-name", "@cmdWithPositiveFloatParamAndNoFraction"], + ["command-params", [ + ["command-param-value", "1."] + ]] + ]], + ["command", [ + ["command-name", "@cmdWithPositiveFloatParamAndFraction"], + ["command-params", [ + ["command-param-value", "1.10"] + ]] + ]], + ["command", [ + ["command-name", "@cmdWithPositiveHegativeFloatParamAndNoFraction"], + ["command-params", [ + ["command-param-value", "-1."] + ]] + ]], + ["command", [ + ["command-name", "@cmdWithPositiveHegativeFloatParamAndFraction"], + ["command-params", [ + ["command-param-value", "-1.10"] + ]] + ]], + ["command", [ + ["command-name", "@cmdWithBoolParamAndPositive"], + ["command-params", [ + ["command-param-value", "true"] + ]] + ]], + ["command", [ + ["command-name", "@cmdWithBoolParamAndNegative"], + ["command-params", [ + ["command-param-value", "false"] + ]] + ]], + ["command", [ + ["command-name", "@cmdWithStringParam"], + ["command-params", [ + ["command-param-value", "hello$co\\:mma\"d\""] + ]] + ]], + ["command", [ + ["command-name", "@cmdWithQuotedStringNamelessParameter"], + ["command-params", [ + ["quoted-string", "\"hello grizzly\""] + ]] + ]], + ["command", [ + ["command-name", "@cmdWithQuotedStringNamelessParameterWithEscapedQuotesInTheValue"], + ["command-params", [ + ["quoted-string", "\"hello \\\"grizzly\\\"\""] + ]] + ]], + ["command", [ + ["command-name", "@set"], + ["command-params", [ + ["command-param-value", "choice=\"moe\""] + ]] + ]], + ["command", [ + ["command-name", "@command"], + ["command-params", [ + ["command-param-value", "hello.grizzly"] + ]] + ]], + ["command", [ + ["command-name", "@command"], + ["command-params", [ + ["command-param-value", "one,two,three"] + ]] + ]], + ["command", [ + ["command-name", "@command"], + ["command-params", [ + ["command-param-value", "1,2,3"] + ]] + ]], + ["command", [ + ["command-name", "@command"], + ["command-params", [ + ["command-param-value", "true,false,true"] + ]] + ]], + ["command", [ + ["command-name", "@command"], + ["command-params", [ + ["command-param-id", "hi:"], + ["command-param-value", "grizzly"] + ]] + ]], + ["command", [ + ["command-name", "@command"], + ["command-params", [ + ["command-param-id", "hi:"], + ["command-param-value", "1"] + ]] + ]], + ["command", [ + ["command-name", "@command"], + ["command-params", [ + ["command-param-id", "hi:"], + ["command-param-value", "true"] + ]] + ]], + ["command", [ + ["command-name", "@command"], + ["command-params", [ + ["command-param-value", "1"], + ["command-param-id", "in:"], + ["command-param-value", "forest"], + ["command-param-id", "danger:"], + ["command-param-value", "true"] + ]] + ]], + ["command", [ + ["command-name", "@char"], + ["command-params", [ + ["command-param-value", "1"], + ["command-param-id", "pos:"], + ["command-param-value", "0.25,-0.75"], + ["command-param-id", "look:"], + ["command-param-value", "right"] + ]] + ]] +] + +---------------------------------------------------- + +Command tests. diff --git a/package/src/prism/tests/languages/naniscript/comment_feature.test b/package/src/prism/tests/languages/naniscript/comment_feature.test new file mode 100644 index 00000000..86aef801 --- /dev/null +++ b/package/src/prism/tests/languages/naniscript/comment_feature.test @@ -0,0 +1,17 @@ +; +; comment +\:; invalid comment + +---------------------------------------------------- + +[ + ["comment", ";"], + ["comment", "; comment"], + ["generic-text", [ + "\\:; invalid comment" + ]] +] + +---------------------------------------------------- + +Comment tests. diff --git a/package/src/prism/tests/languages/naniscript/define_feature.test b/package/src/prism/tests/languages/naniscript/define_feature.test new file mode 100644 index 00000000..4cc39b43 --- /dev/null +++ b/package/src/prism/tests/languages/naniscript/define_feature.test @@ -0,0 +1,17 @@ +> +>DefineKey define _ + 3h f[29 j] value * + +---------------------------------------------------- + +[ + ">\n", + ["define", [ + ">", + ["key", "DefineKey"], + ["value", "define _ + 3h f[29 j] value *"] + ]] +] + +---------------------------------------------------- + +Define tests. diff --git a/package/src/prism/tests/languages/naniscript/expression_feature.test b/package/src/prism/tests/languages/naniscript/expression_feature.test new file mode 100644 index 00000000..140f921c --- /dev/null +++ b/package/src/prism/tests/languages/naniscript/expression_feature.test @@ -0,0 +1,91 @@ +{} +{ Abs(a, d) + 12 - 1 / -230.0 + "Lol ipsum" } +Expressions inside a generic text line: Loreim ipsu,{ Abs(a, d) + 12 - 1 / -230.0 + "Lol ipsum" } doler sit amen {¯\_(ツ)_/¯}. +@ExpressionInsteadOfNamelessParameterValue {x > 0} +@ExpressionBlendedWithNamelessParameterValue sdf{x > 0}df +@ExpressionsInsideNamedParameterValueWrappedInQuotes text:"{a} < {b}" +@ExpressionsBlendedWithNamedParameterValue param:32r2f,df{x > 0},d.{Abs(0) + 12.24 > 0}ff +@ExpressionsInsteadOfNamelessParameterAndQuotedParameter {remark} if:remark=="Saying \\"Stop { "the" } car\\" was a mistake." + +---------------------------------------------------- + +[ + ["generic-text", [ + ["expression", "{}"] + ]], + ["generic-text", [ + ["expression", "{ Abs(a, d) + 12 - 1 / -230.0 + \"Lol ipsum\" }"] + ]], + ["generic-text", [ + "Expressions inside a generic text line: Loreim ipsu,", + ["expression", "{ Abs(a, d) + 12 - 1 / -230.0 + \"Lol ipsum\" }"], + " doler sit amen ", + ["expression", "{¯\\_(ツ)_/¯}"], + "." + ]], + ["command", [ + ["command-name", "@ExpressionInsteadOfNamelessParameterValue"], + ["expression", "{x > 0}"] + ]], + ["command", [ + ["command-name", "@ExpressionBlendedWithNamelessParameterValue"], + ["command-params", [ + ["command-param-value", "sdf"] + ]], + ["expression", "{x > 0}"], + ["command-params", [ + ["command-param-value", "df"] + ]] + ]], + ["command", [ + ["command-name", "@ExpressionsInsideNamedParameterValueWrappedInQuotes"], + ["command-params", [ + ["command-param-id", "text:"], + ["command-param-value", "\""] + ]], + ["expression", "{a}"], + ["command-params", [ + ["command-param-value", "<"] + ]], + ["expression", "{b}"], + ["command-params", [ + ["command-param-value", "\""] + ]] + ]], + ["command", [ + ["command-name", "@ExpressionsBlendedWithNamedParameterValue"], + ["command-params", [ + ["command-param-id", "param:"], + ["command-param-value", "32r2f,df"] + ]], + ["expression", "{x > 0}"], + ["command-params", [ + ["command-param-value", ",d."] + ]], + ["expression", "{Abs(0) + 12.24 > 0}"], + ["command-params", [ + ["command-param-value", "ff"] + ]] + ]], + ["command", [ + ["command-name", "@ExpressionsInsteadOfNamelessParameterAndQuotedParameter"], + ["expression", "{remark}"], + ["command-params", [ + ["command-param-id", "if:"], + ["command-param-value", "remark=="], + ["quoted-string", "\"Saying \\\\\""], + ["command-param-value", "Stop"] + ]], + ["expression", "{ \"the\" }"], + ["command-params", [ + ["command-param-value", "car\\\\\""], + ["command-param-value", "was"], + ["command-param-value", "a"], + ["command-param-value", "mistake.\""] + ]] + ]] +] + +---------------------------------------------------- + +Expressions tests. diff --git a/package/src/prism/tests/languages/naniscript/label_feature.test b/package/src/prism/tests/languages/naniscript/label_feature.test new file mode 100644 index 00000000..9ed2f7de --- /dev/null +++ b/package/src/prism/tests/languages/naniscript/label_feature.test @@ -0,0 +1,24 @@ +# +# Section1 +#Section2 +# Section4 +# SectionWithMultipleTabsBefore +## Section3 +# Section with multiple words + # Section with + # Section with tab + +---------------------------------------------------- + +[ + "#\n", + ["label", "# Section1"], + ["label", "#Section2"], + ["label", "# Section4"], + ["label", "#\t\t\tSectionWithMultipleTabsBefore"], + "\n## Section3\n# Section with multiple words\n\t# Section with\n\t# Section with tab" +] + +---------------------------------------------------- + +Label tests. diff --git a/package/src/prism/tests/languages/naniscript/mixed_content_feature.test b/package/src/prism/tests/languages/naniscript/mixed_content_feature.test new file mode 100644 index 00000000..15479a3f --- /dev/null +++ b/package/src/prism/tests/languages/naniscript/mixed_content_feature.test @@ -0,0 +1,93 @@ +Generic text with inlined commands[i] example[command 1 danger:true] more text here [act danger:false true:false] + +@action1ForTwoLinesWithCommands +@action2ForTwoLinesWithCommands + +@commandAndGenericTextOnNewLine +Massa ut elementum. + +@commandWithParameterAndGenericTextOnNewLine WideParam +Integer + +Escaped braces inside generic text\{abu\}nt @ >ip#s;um< @ \[sdff j9dj\] + +UnclosedExpression{ab{cndum dui dolor tincidu{nt [s[fa]sdf [ +"Integer: a = {a} malesuada a + b = {a + b}", Random(a, b) = {Random(a, b)}, Random("foo", "bar", "foobar") = {Random("foo", "bar", "foobar")},} +# +> +@ + +---------------------------------------------------- + +[ + ["generic-text", [ + "Generic text with inlined commands", + ["inline-command", [ + ["start-stop-char", "["], + ["command-param-name", "i"], + ["start-stop-char", "]"] + ]], + " example", + ["inline-command", [ + ["start-stop-char", "["], + ["command-param-name", "command"], + ["command-params", [ + ["command-param-value", "1"], + ["command-param-id", "danger:"], + ["command-param-value", "true"] + ]], + ["start-stop-char", "]"] + ]], + " more text here ", + ["inline-command", [ + ["start-stop-char", "["], + ["command-param-name", "act"], + ["command-params", [ + ["command-param-id", "danger:"], + ["command-param-value", "false"], + ["command-param-id", "true:"], + ["command-param-value", "false"] + ]], + ["start-stop-char", "]"] + ]] + ]], + + ["command", [ + ["command-name", "@action1ForTwoLinesWithCommands"] + ]], + ["command", [ + ["command-name", "@action2ForTwoLinesWithCommands"] + ]], + + ["command", [ + ["command-name", "@commandAndGenericTextOnNewLine"] + ]], + ["generic-text", ["Massa ut elementum."]], + + ["command", [ + ["command-name", "@commandWithParameterAndGenericTextOnNewLine"], + ["command-params", [ + ["command-param-value", "WideParam"] + ]] + ]], + ["generic-text", ["Integer"]], + + ["generic-text", [ + "Escaped braces inside generic text", + ["escaped-char", "\\{"], + "abu", + ["escaped-char", "\\}"], + "nt @ >ip#s;um< @ ", + ["escaped-char", "\\["], + "sdff j9dj", + ["escaped-char", "\\]"] + ]], + + ["bad-line", "UnclosedExpression{ab{cndum dui dolor tincidu{nt [s[fa]sdf ["], + ["bad-line", "\"Integer: a = {a} malesuada a + b = {a + b}\", Random(a, b) = {Random(a, b)}, Random(\"foo\", \"bar\", \"foobar\") = {Random(\"foo\", \"bar\", \"foobar\")},}"], + "\n#\n>\n@" +] + +---------------------------------------------------- + +Mixed tests of Generic Text, Commands, Inline Commands. diff --git a/package/src/prism/tests/languages/nasm/comment_feature.test b/package/src/prism/tests/languages/nasm/comment_feature.test new file mode 100644 index 00000000..fc265909 --- /dev/null +++ b/package/src/prism/tests/languages/nasm/comment_feature.test @@ -0,0 +1,13 @@ +; +; foo + +---------------------------------------------------- + +[ + ["comment", ";"], + ["comment", "; foo"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nasm/keyword_feature.test b/package/src/prism/tests/languages/nasm/keyword_feature.test new file mode 100644 index 00000000..4b4a1ca0 --- /dev/null +++ b/package/src/prism/tests/languages/nasm/keyword_feature.test @@ -0,0 +1,30 @@ +BITS 16 BITS 32 BITS 64 +[BITS 16] [BITS 32] [BITS 64] + +section Foo.bar +section foobar: + +extern _printf +global _main + +CPU 8086 +FLOAT DAZ +DEFAULT REL + +---------------------------------------------------- + +[ + ["keyword", "BITS 16"], ["keyword", "BITS 32"], ["keyword", "BITS 64"], + ["keyword", "[BITS 16]"], ["keyword", "[BITS 32]"], ["keyword", "[BITS 64]"], + ["keyword", "section Foo.bar"], + ["keyword", "section foobar:"], + ["keyword", "extern _printf"], + ["keyword", "global _main"], + ["keyword", "CPU 8086"], + ["keyword", "FLOAT DAZ"], + ["keyword", "DEFAULT REL"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nasm/label_feature.test b/package/src/prism/tests/languages/nasm/label_feature.test new file mode 100644 index 00000000..a5d49f82 --- /dev/null +++ b/package/src/prism/tests/languages/nasm/label_feature.test @@ -0,0 +1,15 @@ +foo42: +.foo: +..@foo: + +---------------------------------------------------- + +[ + ["label", "foo42:"], + ["label", ".foo:"], + ["label", "..@foo:"] +] + +---------------------------------------------------- + +Checks for labels. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nasm/number_feature.test b/package/src/prism/tests/languages/nasm/number_feature.test new file mode 100644 index 00000000..cf8334a4 --- /dev/null +++ b/package/src/prism/tests/languages/nasm/number_feature.test @@ -0,0 +1,97 @@ +0xBadFace +0x4f.ab +0x4p2 +0x2.ap-8 +0x1p+1 + +0hBadFace +0h4f.ab +0h4p2 +0h2.ap-8 +0h1p+1 +42fh +4ab2x + +$4 +$2a4f + +0o75 +0q75 +75o +75q + +0b0101 +0y0101 +0101b +0101y + +0d42 +0t42 +42 +3.14159 +4.2e4 +2e-1 +3.1e+2 +42d +3.14159d +4.2e4d +2e-1d +3.1e+2d +42t +3.14159t +4.2e4t +2e-1t +3.1e+2t + +---------------------------------------------------- + +[ + ["number", "0xBadFace"], + ["number", "0x4f.ab"], + ["number", "0x4p2"], + ["number", "0x2.ap-8"], + ["number", "0x1p+1"], + + ["number", "0hBadFace"], + ["number", "0h4f.ab"], + ["number", "0h4p2"], + ["number", "0h2.ap-8"], + ["number", "0h1p+1"], + ["number", "42fh"], + ["number", "4ab2x"], + + ["number", "$4"], + ["number", "$2a4f"], + + ["number", "0o75"], + ["number", "0q75"], + ["number", "75o"], + ["number", "75q"], + + ["number", "0b0101"], + ["number", "0y0101"], + ["number", "0101b"], + ["number", "0101y"], + + ["number", "0d42"], + ["number", "0t42"], + ["number", "42"], + ["number", "3.14159"], + ["number", "4.2e4"], + ["number", "2e-1"], + ["number", "3.1e+2"], + ["number", "42d"], + ["number", "3.14159d"], + ["number", "4.2e4d"], + ["number", "2e-1d"], + ["number", "3.1e+2d"], + ["number", "42t"], + ["number", "3.14159t"], + ["number", "4.2e4t"], + ["number", "2e-1t"], + ["number", "3.1e+2t"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nasm/operator_feature.test b/package/src/prism/tests/languages/nasm/operator_feature.test new file mode 100644 index 00000000..9c503326 --- /dev/null +++ b/package/src/prism/tests/languages/nasm/operator_feature.test @@ -0,0 +1,17 @@ +[ ] +* + - / +% < > = +& | $ ! + +---------------------------------------------------- + +[ + ["operator", "["], ["operator", "]"], + ["operator", "*"], ["operator", "+"], ["operator", "-"], ["operator", "/"], + ["operator", "%"], ["operator", "<"], ["operator", ">"], ["operator", "="], + ["operator", "&"], ["operator", "|"], ["operator", "$"], ["operator", "!"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nasm/register_feature.test b/package/src/prism/tests/languages/nasm/register_feature.test new file mode 100644 index 00000000..babc0f88 --- /dev/null +++ b/package/src/prism/tests/languages/nasm/register_feature.test @@ -0,0 +1,43 @@ +st0 st1 +xmm1 xmm2 +ymm1 ymm2 +zmm1 zmm2 +cr1 dr1 tr1 +r1 r42 +r1b r1w r1d +ax bx cx dx +eax ebx ecx edx +rax rbx rcx rdx +ah bh ch dh +al bl cl dl +bp sp si di +ebp esp esi edi +rbp rsp rsi rdi +cs ds es +fs gs ss + +---------------------------------------------------- + +[ + ["register", "st0"], ["register", "st1"], + ["register", "xmm1"], ["register", "xmm2"], + ["register", "ymm1"], ["register", "ymm2"], + ["register", "zmm1"], ["register", "zmm2"], + ["register", "cr1"], ["register", "dr1"], ["register", "tr1"], + ["register", "r1"], ["register", "r42"], + ["register", "r1b"], ["register", "r1w"], ["register", "r1d"], + ["register", "ax"], ["register", "bx"], ["register", "cx"], ["register", "dx"], + ["register", "eax"], ["register", "ebx"], ["register", "ecx"], ["register", "edx"], + ["register", "rax"], ["register", "rbx"], ["register", "rcx"], ["register", "rdx"], + ["register", "ah"], ["register", "bh"], ["register", "ch"], ["register", "dh"], + ["register", "al"], ["register", "bl"], ["register", "cl"], ["register", "dl"], + ["register", "bp"], ["register", "sp"], ["register", "si"], ["register", "di"], + ["register", "ebp"], ["register", "esp"], ["register", "esi"], ["register", "edi"], + ["register", "rbp"], ["register", "rsp"], ["register", "rsi"], ["register", "rdi"], + ["register", "cs"], ["register", "ds"], ["register", "es"], + ["register", "fs"], ["register", "gs"], ["register", "ss"] +] + +---------------------------------------------------- + +Checks for registers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nasm/string_feature.test b/package/src/prism/tests/languages/nasm/string_feature.test new file mode 100644 index 00000000..f60998cd --- /dev/null +++ b/package/src/prism/tests/languages/nasm/string_feature.test @@ -0,0 +1,21 @@ +"" +"fo\"o" +'' +'fo\'o' +`` +`fo\`o` + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"o\""], + ["string", "''"], + ["string", "'fo\\'o'"], + ["string", "``"], + ["string", "`fo\\`o`"] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/neon/boolean_feature.test b/package/src/prism/tests/languages/neon/boolean_feature.test new file mode 100644 index 00000000..50e89d3a --- /dev/null +++ b/package/src/prism/tests/languages/neon/boolean_feature.test @@ -0,0 +1,21 @@ +foo: true +bar: false +alt: [yes, no, YES, NO, TRUE, FALSE] + +---------------------------------------------------- + +[ + ["key", "foo"], ["punctuation", ":"], + ["boolean", "true"], + ["key", "bar"], ["punctuation", ":"], + ["boolean", "false"], + ["key", "alt"], ["punctuation", ":"], ["punctuation", "["], + ["boolean", "yes"], ["punctuation", ","], ["boolean", "no"], ["punctuation", ","], ["boolean", "YES"], ["punctuation", ","], ["boolean", "NO"], ["punctuation", ","], ["boolean", "TRUE"], ["punctuation", ","], ["boolean", "FALSE"], + ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for booleans. + + diff --git a/package/src/prism/tests/languages/neon/comment_feature.test b/package/src/prism/tests/languages/neon/comment_feature.test new file mode 100644 index 00000000..710014b8 --- /dev/null +++ b/package/src/prism/tests/languages/neon/comment_feature.test @@ -0,0 +1,13 @@ +# +# foobar + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/neon/composite.test b/package/src/prism/tests/languages/neon/composite.test new file mode 100644 index 00000000..ce0ec92e --- /dev/null +++ b/package/src/prism/tests/languages/neon/composite.test @@ -0,0 +1,25 @@ +phones: {home: 555-6528,work: 555-7334 } + +children: # this is a comment + - -50.5 + +entity: Column(type=int, nulls=yes) + +---------------------------------------------------- + +[ + ["key", "phones"], ["punctuation", ":"], ["punctuation", "{"], + ["key", "home"], ["punctuation", ":"], + ["literal", "555-6528"], ["punctuation", ","], + ["key", "work"], ["punctuation", ":"], + ["literal", "555-7334"], ["punctuation", "}"], + ["key", "children"], ["punctuation", ":"], + ["comment", "# this is a comment"], + ["punctuation", "-"], ["number", "-50.5"], + ["key", "entity"], ["punctuation", ":"], + ["literal", "Column"], ["punctuation", "("], ["key", "type"], ["punctuation", "="], ["literal", "int"], ["punctuation", ","], ["key", "nulls"], ["punctuation", "="], ["boolean", "yes"], ["punctuation", ")"] +] + +---------------------------------------------------- + +Overall test diff --git a/package/src/prism/tests/languages/neon/datetime_feature.test b/package/src/prism/tests/languages/neon/datetime_feature.test new file mode 100644 index 00000000..09ef7aa3 --- /dev/null +++ b/package/src/prism/tests/languages/neon/datetime_feature.test @@ -0,0 +1,26 @@ +canonical: 2001-12-15T02:59:43.1Z +iso8601: 2001-12-14t21:59:43.10-05:00 +spaced: 2001-12-14 21:59:43.10 -5 +date: 2002-12-14 +short: 2002-1-1 +alt: 2016-06-03 19:00:00 +0200 + +---------------------------------------------------- + +[ + ["key", "canonical"], ["punctuation", ":"], + ["datetime", "2001-12-15T02:59:43.1Z"], + ["key", "iso8601"], ["punctuation", ":"], + ["datetime", "2001-12-14t21:59:43.10-05:00"], + ["key", "spaced"], ["punctuation", ":"], + ["datetime", "2001-12-14 21:59:43.10 -5"], + ["key", "date"], ["punctuation", ":"], + ["datetime", "2002-12-14"], + ["key", "short"], ["punctuation", ":"], + ["datetime", "2002-1-1"], + ["key", "alt"], ["punctuation", ":"], ["datetime", "2016-06-03 19:00:00 +0200"] +] + +---------------------------------------------------- + +Checks for dates and datetimes. \ No newline at end of file diff --git a/package/src/prism/tests/languages/neon/json_feature.test b/package/src/prism/tests/languages/neon/json_feature.test new file mode 100644 index 00000000..1f2dc9fa --- /dev/null +++ b/package/src/prism/tests/languages/neon/json_feature.test @@ -0,0 +1,39 @@ +[ + [true,false, null], +{ + "A": "/*", + "B": "B", + "foo": 1, + "b\"ar":{"bar":1}, + "baz":"\"" +}, + [0, 123, 3.14159, 5.0e8, 0.2E+2, 47e-5], + [ + "" , "foo\"bar\"baz", "\u2642\\ " + ] +] + +---------------------------------------------------- + +[ + ["punctuation", "["], + ["punctuation", "["], ["boolean", "true"], ["punctuation", ","], ["boolean", "false"], ["punctuation", ","], ["null", "null"], ["punctuation", "]"], ["punctuation", ","], + ["punctuation", "{"], + ["string", "\"A\""], ["punctuation", ":"], ["string", "\"/*\""], ["punctuation", ","], + ["string", "\"B\""], ["punctuation", ":"], ["string", "\"B\""], ["punctuation", ","], + ["string", "\"foo\""], ["punctuation", ":"], ["number", "1"], ["punctuation", ","], + ["string", "\"b\\\"ar\""], ["punctuation", ":"],["punctuation", "{"], ["string", "\"bar\""], ["punctuation", ":"], ["number", "1"], ["punctuation", "}"], ["punctuation", ","], + ["string", "\"baz\""], ["punctuation", ":"], ["string", "\"\\\"\""], + ["punctuation", "}"], ["punctuation", ","], + ["punctuation", "["], + ["number", "0"], ["punctuation", ","], ["number", "123"], ["punctuation", ","], ["number", "3.14159"], ["punctuation", ","], ["number", "5.0e8"], ["punctuation", ","], ["number", "0.2E+2"], ["punctuation", ","], ["number", "47e-5"], + ["punctuation", "]"], ["punctuation", ","], + ["punctuation", "["], + ["string", "\"\""], ["punctuation", ","], ["string", "\"foo\\\"bar\\\"baz\""], ["punctuation", ","], ["string", "\"\\u2642\\\\ \""], ["punctuation", "]"], + ["punctuation", "]"] +] + + +---------------------------------------------------- + +Checks for JSON superset. diff --git a/package/src/prism/tests/languages/neon/key_feature.test b/package/src/prism/tests/languages/neon/key_feature.test new file mode 100644 index 00000000..0dd12cd3 --- /dev/null +++ b/package/src/prism/tests/languages/neon/key_feature.test @@ -0,0 +1,17 @@ +foo: 4 +FooBar : 5 +alt=6 +alt2 = 7 + +---------------------------------------------------- + +[ + ["key", "foo"], ["punctuation", ":"], ["number", "4"], + ["key", "FooBar"], ["punctuation", ":"], ["number", "5"], + ["key", "alt"], ["punctuation", "="], ["number", "6"], + ["key", "alt2"], ["punctuation", "="], ["number", "7"] +] + +---------------------------------------------------- + +Checks for keys. \ No newline at end of file diff --git a/package/src/prism/tests/languages/neon/literal_feature.test b/package/src/prism/tests/languages/neon/literal_feature.test new file mode 100644 index 00000000..b15eb522 --- /dev/null +++ b/package/src/prism/tests/languages/neon/literal_feature.test @@ -0,0 +1,15 @@ +foo: hello:abc +bar: @test\x\b + +---------------------------------------------------- + +[ + ["key", "foo"], ["punctuation", ":"], + ["literal","hello:abc"], + ["key", "bar"], ["punctuation", ":"], + ["literal","@test\\x\\b"] +] + +---------------------------------------------------- + +Checks for literals. diff --git a/package/src/prism/tests/languages/neon/null_feature.test b/package/src/prism/tests/languages/neon/null_feature.test new file mode 100644 index 00000000..ce31ecc9 --- /dev/null +++ b/package/src/prism/tests/languages/neon/null_feature.test @@ -0,0 +1,12 @@ +foo: null + +---------------------------------------------------- + +[ + ["key", "foo"], ["punctuation", ":"], + ["null", "null"] +] + +---------------------------------------------------- + +Checks for null. \ No newline at end of file diff --git a/package/src/prism/tests/languages/neon/number_feature.test b/package/src/prism/tests/languages/neon/number_feature.test new file mode 100644 index 00000000..45c17fa1 --- /dev/null +++ b/package/src/prism/tests/languages/neon/number_feature.test @@ -0,0 +1,36 @@ +foo: 0xBadFace +bar: 0o754 +baz: 42 +foo: 3.14159 +bar: 4e8 +baz: 3.1E-7 +foo: 0.4e+2 +bar: -0xFF +baz: +0o123 + +---------------------------------------------------- + +[ + ["key", "foo"], ["punctuation", ":"], + ["number", "0xBadFace"], + ["key", "bar"], ["punctuation", ":"], + ["number", "0o754"], + ["key", "baz"], ["punctuation", ":"], + ["number", "42"], + ["key", "foo"], ["punctuation", ":"], + ["number", "3.14159"], + ["key", "bar"], ["punctuation", ":"], + ["number", "4e8"], + ["key", "baz"], ["punctuation", ":"], + ["number", "3.1E-7"], + ["key", "foo"], ["punctuation", ":"], + ["number", "0.4e+2"], + ["key", "bar"], ["punctuation", ":"], + ["number", "-0xFF"], + ["key", "baz"], ["punctuation", ":"], + ["number", "+0o123"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/neon/string_feature.test b/package/src/prism/tests/languages/neon/string_feature.test new file mode 100644 index 00000000..dd7d2d89 --- /dev/null +++ b/package/src/prism/tests/languages/neon/string_feature.test @@ -0,0 +1,38 @@ +foo: "" +bar: "fo\"obar" +foo: '' +foo: "foo" # bar +bar: 'bar' # foo +multi: ''' + one line + second line + third line +''' +multi: """ + one line + second line + third line +""" + +---------------------------------------------------- + +[ + ["key", "foo"], ["punctuation", ":"], + ["string", "\"\""], + ["key", "bar"], ["punctuation", ":"], + ["string", "\"fo\\\"obar\""], + ["key", "foo"], ["punctuation", ":"], + ["string", "''"], + ["key", "foo"], ["punctuation", ":"], + ["string", "\"foo\""], ["comment", "# bar"], + ["key", "bar"], ["punctuation", ":"], + ["string", "'bar'"], ["comment", "# foo"], + ["key", "multi"], ["punctuation", ":"], + ["string", "'''\n\tone line\n\tsecond line\n\tthird line\n'''"], + ["key", "multi"], ["punctuation", ":"], + ["string", "\"\"\"\n\tone line\n\tsecond line\n\tthird line\n\"\"\""] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/nevod/comment_feature.test b/package/src/prism/tests/languages/nevod/comment_feature.test new file mode 100644 index 00000000..7bc339b1 --- /dev/null +++ b/package/src/prism/tests/languages/nevod/comment_feature.test @@ -0,0 +1,20 @@ +/* Comment */ +/* Multi-line +comment */ +/**/ +// +// Single-line comment + +---------------------------------------------------- + +[ + ["comment", "/* Comment */"], + ["comment", "/* Multi-line\ncomment */"], + ["comment", "/**/"], + ["comment", "//"], + ["comment", "// Single-line comment"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nevod/full_feature.test b/package/src/prism/tests/languages/nevod/full_feature.test new file mode 100644 index 00000000..ba0dbbf0 --- /dev/null +++ b/package/src/prism/tests/languages/nevod/full_feature.test @@ -0,0 +1,280 @@ +@namespace Basic +{ + @search @pattern Url(Domain, Path, Query, Anchor) = + Method + Domain:Url.Domain + ?Port + ?Path:Url.Path + + ?Query:Url.Query + ?Anchor:Url.Anchor + @where { + Method = {'http', 'https' , 'ftp', 'mailto', 'file', 'data', + 'irc'} + '://'; + Domain = Word + [1+ '.' + Word + [0+ {Word, '_', '-'}]]; + Port = ':' + Num; + Path = ?'/' + [0+ {Word, '/', '_', '+', '-', '%', '.'}]; + + Query = '?' + ?(Param + [0+ '&' + Param]) + @where + { + Param = Identifier + '=' + Identifier + @where + { + Identifier = {Alpha, AlphaNum, '_'} + [0+ {Word, '_'}]; + }; + }; + + Anchor(Value) = '#' + Value:{Word}; + }; +} + +---------------------------------------------------- + +[ + ["keyword", "@namespace"], + ["namespace", "Basic"], + + ["operator", "{"], + + ["keyword", "@search"], + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "Url"], + ["fields", [ + ["punctuation", "("], + ["field-name", "Domain"], + ["punctuation", ","], + ["field-name", "Path"], + ["punctuation", ","], + ["field-name", "Query"], + ["punctuation", ","], + ["field-name", "Anchor"], + ["punctuation", ")"] + ]] + ]], + ["operator", "="], + + ["name", "Method"], + ["operator", "+"], + ["field-capture", [ + ["field-name", "Domain"], + ["colon", ":"] + ]], + ["name", "Url.Domain"], + ["operator", "+"], + ["operator", "?"], + ["name", "Port"], + ["operator", "+"], + ["operator", "?"], + ["field-capture", [ + ["field-name", "Path"], + ["colon", ":"] + ]], + ["name", "Url.Path"], + ["operator", "+"], + + ["operator", "?"], + ["field-capture", [ + ["field-name", "Query"], + ["colon", ":"] + ]], + ["name", "Url.Query"], + ["operator", "+"], + ["operator", "?"], + ["field-capture", [ + ["field-name", "Anchor"], + ["colon", ":"] + ]], + ["name", "Url.Anchor"], + + ["keyword", "@where"], + ["operator", "{"], + + ["pattern", [ + ["pattern-name", "Method"] + ]], + ["operator", "="], + ["operator", "{"], + ["string", ["'http'"]], + ["punctuation", ","], + ["string", ["'https'"]], + ["punctuation", ","], + ["string", ["'ftp'"]], + ["punctuation", ","], + ["string", ["'mailto'"]], + ["punctuation", ","], + ["string", ["'file'"]], + ["punctuation", ","], + ["string", ["'data'"]], + ["punctuation", ","], + + ["string", ["'irc'"]], + ["operator", "}"], + ["operator", "+"], + ["string", ["'://'"]], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "Domain"] + ]], + ["operator", "="], + ["standard-pattern", [ + ["standard-pattern-name", "Word"] + ]], + ["operator", "+"], + ["operator", "["], + ["quantifier", "1+"], + ["string", ["'.'"]], + ["operator", "+"], + ["standard-pattern", [ + ["standard-pattern-name", "Word"] + ]], + ["operator", "+"], + ["operator", "["], + ["quantifier", "0+"], + ["operator", "{"], + ["standard-pattern", [ + ["standard-pattern-name", "Word"] + ]], + ["punctuation", ","], + ["string", ["'_'"]], + ["punctuation", ","], + ["string", ["'-'"]], + ["operator", "}"], + ["operator", "]"], + ["operator", "]"], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "Port"] + ]], + ["operator", "="], + ["string", ["':'"]], + ["operator", "+"], + ["standard-pattern", [ + ["standard-pattern-name", "Num"] + ]], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "Path"] + ]], + ["operator", "="], + ["operator", "?"], + ["string", ["'/'"]], + ["operator", "+"], + ["operator", "["], + ["quantifier", "0+"], + ["operator", "{"], + ["standard-pattern", [ + ["standard-pattern-name", "Word"] + ]], + ["punctuation", ","], + ["string", ["'/'"]], + ["punctuation", ","], + ["string", ["'_'"]], + ["punctuation", ","], + ["string", ["'+'"]], + ["punctuation", ","], + ["string", ["'-'"]], + ["punctuation", ","], + ["string", ["'%'"]], + ["punctuation", ","], + ["string", ["'.'"]], + ["operator", "}"], + ["operator", "]"], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "Query"] + ]], + ["operator", "="], + ["string", ["'?'"]], + ["operator", "+"], + ["operator", "?"], + ["punctuation", "("], + ["name", "Param"], + ["operator", "+"], + ["operator", "["], + ["quantifier", "0+"], + ["string", ["'&'"]], + ["operator", "+"], + ["name", "Param"], + ["operator", "]"], + ["punctuation", ")"], + + ["keyword", "@where"], + + ["operator", "{"], + + ["pattern", [ + ["pattern-name", "Param"] + ]], + ["operator", "="], + ["name", "Identifier"], + ["operator", "+"], + ["string", ["'='"]], + ["operator", "+"], + ["name", "Identifier"], + + ["keyword", "@where"], + + ["operator", "{"], + + ["pattern", [ + ["pattern-name", "Identifier"] + ]], + ["operator", "="], + ["operator", "{"], + ["standard-pattern", [ + ["standard-pattern-name", "Alpha"] + ]], + ["punctuation", ","], + ["standard-pattern", [ + ["standard-pattern-name", "AlphaNum"] + ]], + ["punctuation", ","], + ["string", ["'_'"]], + ["operator", "}"], + ["operator", "+"], + ["operator", "["], + ["quantifier", "0+"], + ["operator", "{"], + ["standard-pattern", [ + ["standard-pattern-name", "Word"] + ]], + ["punctuation", ","], + ["string", ["'_'"]], + ["operator", "}"], + ["operator", "]"], + ["punctuation", ";"], + + ["operator", "}"], + ["punctuation", ";"], + + ["operator", "}"], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "Anchor"], + ["fields", [ + ["punctuation", "("], + ["field-name", "Value"], + ["punctuation", ")"] + ]] + ]], + ["operator", "="], + ["string", ["'#'"]], + ["operator", "+"], + ["field-capture", [ + ["field-name", "Value"], + ["colon", ":"] + ]], + ["operator", "{"], + ["standard-pattern", [ + ["standard-pattern-name", "Word"] + ]], + ["operator", "}"], + ["punctuation", ";"], + + ["operator", "}"], + ["punctuation", ";"], + + ["operator", "}"] +] diff --git a/package/src/prism/tests/languages/nevod/keyword_feature.test b/package/src/prism/tests/languages/nevod/keyword_feature.test new file mode 100644 index 00000000..a38ce975 --- /dev/null +++ b/package/src/prism/tests/languages/nevod/keyword_feature.test @@ -0,0 +1,15 @@ +@require @namespace @pattern @search +@inside @outside @having +@where + +---------------------------------------------------- + +[ + ["keyword", "@require"], ["keyword", "@namespace"], ["keyword", "@pattern"], ["keyword", "@search"], + ["keyword", "@inside"], ["keyword", "@outside"], ["keyword", "@having"], + ["keyword", "@where"] +] + +---------------------------------------------------- + +Checks for all keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nevod/operator_feature.test b/package/src/prism/tests/languages/nevod/operator_feature.test new file mode 100644 index 00000000..0014757b --- /dev/null +++ b/package/src/prism/tests/languages/nevod/operator_feature.test @@ -0,0 +1,25 @@ +( , ) ; ++ _ +.. ... +[ 0-5 ] +& +~ +? +{} + +---------------------------------------------------- + +[ + ["punctuation", "("], ["punctuation", ","], ["punctuation", ")"], ["punctuation", ";"], + ["operator", "+"], ["operator", "_"], + ["operator", ".."], ["operator", "..."], + ["operator", "["], ["quantifier", "0-5"], ["operator", "]"], + ["operator", "&"], + ["operator", "~"], + ["operator", "?"], + ["operator", "{"], ["operator", "}"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nevod/package_feature.test b/package/src/prism/tests/languages/nevod/package_feature.test new file mode 100644 index 00000000..bc6b83b3 --- /dev/null +++ b/package/src/prism/tests/languages/nevod/package_feature.test @@ -0,0 +1,79 @@ +@namespace Basic +{ + @search @pattern GUID = Word(8) + [3 '-' + Word(4)] + '-' + Word(12); +} + +@require "GUID.np"; + +@namespace Basic +{ + @search @pattern GUID-in-Braces = '{' + GUID + '}'; +} + +---------------------------------------------------- + +[ + ["keyword", "@namespace"], + ["namespace", "Basic"], + + ["operator", "{"], + + ["keyword", "@search"], + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "GUID"] + ]], + ["operator", "="], + ["standard-pattern", [ + ["standard-pattern-name", "Word"], + ["punctuation", "("], + ["quantifier", "8"], + ["punctuation", ")"] + ]], + ["operator", "+"], + ["operator", "["], + ["quantifier", "3"], + ["string", ["'-'"]], + ["operator", "+"], + ["standard-pattern", [ + ["standard-pattern-name", "Word"], + ["punctuation", "("], + ["quantifier", "4"], + ["punctuation", ")"] + ]], + ["operator", "]"], + ["operator", "+"], + ["string", ["'-'"]], + ["operator", "+"], + ["standard-pattern", [ + ["standard-pattern-name", "Word"], + ["punctuation", "("], + ["quantifier", "12"], + ["punctuation", ")"] + ]], + ["punctuation", ";"], + + ["operator", "}"], + + ["keyword", "@require"], ["string", ["\"GUID.np\""]], ["punctuation", ";"], + + ["keyword", "@namespace"], + ["namespace", "Basic"], + + ["operator", "{"], + + ["keyword", "@search"], + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "GUID-in-Braces"] + ]], + ["operator", "="], + ["string", ["'{'"]], + ["operator", "+"], + ["name", "GUID"], + ["operator", "+"], + ["string", ["'}'"]], + ["punctuation", ";"], + + ["operator", "}"] +] diff --git a/package/src/prism/tests/languages/nevod/pattern_feature.test b/package/src/prism/tests/languages/nevod/pattern_feature.test new file mode 100644 index 00000000..91d3924d --- /dev/null +++ b/package/src/prism/tests/languages/nevod/pattern_feature.test @@ -0,0 +1,282 @@ +P = "text"; +P = Alpha; +P2 = P1; P1 = Word; +P = A + B; +P = {A, B}; +P = [1+ A]; + +#P = "text"; + +@pattern P = Alpha; +@search @pattern P = Alpha; +@pattern P = W @where { @pattern W = Word; }; +@pattern #P = W + S @where { @pattern #W = Word; @pattern S = Space; }; + +#P(X, Y) = X: A ... Y: B; +#P(X) = A .. X .. B; +#P1(X, Y) = P2(X: Q, Y: S); +#P(X) = X: Word ... X; +#P(X, Y) = {X: Punct + X, Y: Symbol + Y}; + +---------------------------------------------------- + +[ + ["pattern", [ + ["pattern-name", "P"] + ]], + ["operator", "="], + ["string", ["\"text\""]], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "P"] + ]], + ["operator", "="], + ["standard-pattern", [ + ["standard-pattern-name", "Alpha"] + ]], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "P2"] + ]], + ["operator", "="], + ["name", "P1"], + ["punctuation", ";"], + ["pattern", [ + ["pattern-name", "P1"] + ]], + ["operator", "="], + ["standard-pattern", [ + ["standard-pattern-name", "Word"] + ]], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "P"] + ]], + ["operator", "="], + ["name", "A"], + ["operator", "+"], + ["name", "B"], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "P"] + ]], + ["operator", "="], + ["operator", "{"], + ["name", "A"], + ["punctuation", ","], + ["name", "B"], + ["operator", "}"], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "P"] + ]], + ["operator", "="], + ["operator", "["], + ["quantifier", "1+"], + ["name", "A"], + ["operator", "]"], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "#P"] + ]], + ["operator", "="], + ["string", ["\"text\""]], + ["punctuation", ";"], + + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "P"] + ]], + ["operator", "="], + ["standard-pattern", [ + ["standard-pattern-name", "Alpha"] + ]], + ["punctuation", ";"], + + ["keyword", "@search"], + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "P"] + ]], + ["operator", "="], + ["standard-pattern", [ + ["standard-pattern-name", "Alpha"] + ]], + ["punctuation", ";"], + + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "P"] + ]], + ["operator", "="], + ["name", "W"], + ["keyword", "@where"], + ["operator", "{"], + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "W"] + ]], + ["operator", "="], + ["standard-pattern", [ + ["standard-pattern-name", "Word"] + ]], + ["punctuation", ";"], + ["operator", "}"], + ["punctuation", ";"], + + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "#P"] + ]], + ["operator", "="], + ["name", "W"], + ["operator", "+"], + ["name", "S"], + ["keyword", "@where"], + ["operator", "{"], + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "#W"] + ]], + ["operator", "="], + ["standard-pattern", [ + ["standard-pattern-name", "Word"] + ]], + ["punctuation", ";"], + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "S"] + ]], + ["operator", "="], + ["standard-pattern", [ + ["standard-pattern-name", "Space"] + ]], + ["punctuation", ";"], + ["operator", "}"], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "#P"], + ["fields", [ + ["punctuation", "("], + ["field-name", "X"], + ["punctuation", ","], + ["field-name", "Y"], + ["punctuation", ")"] + ]] + ]], + ["operator", "="], + ["field-capture", [ + ["field-name", "X"], + ["colon", ":"] + ]], + ["name", "A"], + ["operator", "..."], + ["field-capture", [ + ["field-name", "Y"], + ["colon", ":"] + ]], + ["name", "B"], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "#P"], + ["fields", [ + ["punctuation", "("], + ["field-name", "X"], + ["punctuation", ")"] + ]] + ]], + ["operator", "="], + ["name", "A"], + ["operator", ".."], + ["name", "X"], + ["operator", ".."], + ["name", "B"], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "#P1"], + ["fields", [ + ["punctuation", "("], + ["field-name", "X"], + ["punctuation", ","], + ["field-name", "Y"], + ["punctuation", ")"] + ]] + ]], + ["operator", "="], + ["name", "P2"], + ["punctuation", "("], + ["field-capture", [ + ["field-name", "X"], + ["colon", ":"], + ["field-name", "Q"], + ", ", + ["field-name", "Y"], + ["colon", ":"], + ["field-name", "S"] + ]], + ["punctuation", ")"], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "#P"], + ["fields", [ + ["punctuation", "("], + ["field-name", "X"], + ["punctuation", ")"] + ]] + ]], + ["operator", "="], + ["field-capture", [ + ["field-name", "X"], + ["colon", ":"] + ]], + ["standard-pattern", [ + ["standard-pattern-name", "Word"] + ]], + ["operator", "..."], + ["name", "X"], + ["punctuation", ";"], + + ["pattern", [ + ["pattern-name", "#P"], + ["fields", [ + ["punctuation", "("], + ["field-name", "X"], + ["punctuation", ","], + ["field-name", "Y"], + ["punctuation", ")"] + ]] + ]], + ["operator", "="], + ["operator", "{"], + ["field-capture", [ + ["field-name", "X"], + ["colon", ":"] + ]], + ["standard-pattern", [ + ["standard-pattern-name", "Punct"] + ]], + ["operator", "+"], + ["name", "X"], + ["punctuation", ","], + ["field-capture", [ + ["field-name", "Y"], + ["colon", ":"] + ]], + ["standard-pattern", [ + ["standard-pattern-name", "Symbol"] + ]], + ["operator", "+"], + ["name", "Y"], + ["operator", "}"], + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/nevod/search_feature.test b/package/src/prism/tests/languages/nevod/search_feature.test new file mode 100644 index 00000000..c3dcf452 --- /dev/null +++ b/package/src/prism/tests/languages/nevod/search_feature.test @@ -0,0 +1,95 @@ +@namespace Basic +{ + @search @pattern GUID-in-Braces = '{' + GUID + '}'; +} + +@search Basic.GUID; +@search Basic.GUID-in-Braces; + +@namespace Basic +{ + @pattern GUID-in-Braces = '{' + GUID + '}'; +} + +@require "GUID.np"; + +@search Basic.*; + +@namespace Basic +{ + @pattern GUID-in-Braces = '{' + GUID + '}'; +} + +---------------------------------------------------- + +[ + ["keyword", "@namespace"], + ["namespace", "Basic"], + + ["operator", "{"], + + ["keyword", "@search"], + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "GUID-in-Braces"] + ]], + ["operator", "="], + ["string", ["'{'"]], + ["operator", "+"], + ["name", "GUID"], + ["operator", "+"], + ["string", ["'}'"]], + ["punctuation", ";"], + + ["operator", "}"], + + ["keyword", "@search"], + ["search", "Basic.GUID"], + ["punctuation", ";"], + + ["keyword", "@search"], + ["search", "Basic.GUID-in-Braces"], + ["punctuation", ";"], + + ["keyword", "@namespace"], + ["namespace", "Basic"], + + ["operator", "{"], + + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "GUID-in-Braces"] + ]], + ["operator", "="], + ["string", ["'{'"]], + ["operator", "+"], + ["name", "GUID"], + ["operator", "+"], + ["string", ["'}'"]], + ["punctuation", ";"], + + ["operator", "}"], + + ["keyword", "@require"], ["string", ["\"GUID.np\""]], ["punctuation", ";"], + + ["keyword", "@search"], ["search", "Basic.*"], ["punctuation", ";"], + + ["keyword", "@namespace"], + ["namespace", "Basic"], + + ["operator", "{"], + + ["keyword", "@pattern"], + ["pattern", [ + ["pattern-name", "GUID-in-Braces"] + ]], + ["operator", "="], + ["string", ["'{'"]], + ["operator", "+"], + ["name", "GUID"], + ["operator", "+"], + ["string", ["'}'"]], + ["punctuation", ";"], + + ["operator", "}"] +] diff --git a/package/src/prism/tests/languages/nevod/string_feature.test b/package/src/prism/tests/languages/nevod/string_feature.test new file mode 100644 index 00000000..9ad7e65d --- /dev/null +++ b/package/src/prism/tests/languages/nevod/string_feature.test @@ -0,0 +1,27 @@ +"text in double quotes" +"" +'text in single quotes' +'case-sensitive text'! +'text ''Nevod'' in quotes' +"text ""Nevod"" in double quotes" +'text prefix'* +'case-sensitive text prefix'!* +'' + +---------------------------------------------------- + +[ + ["string", ["\"text in double quotes\""]], + ["string", ["\"\""]], + ["string", ["'text in single quotes'"]], + ["string", ["'case-sensitive text'", ["string-attrs", "!"]]], + ["string", ["'text ''Nevod'' in quotes'"]], + ["string", ["\"text \"\"Nevod\"\" in double quotes\""]], + ["string", ["'text prefix'", ["string-attrs", "*"]]], + ["string", ["'case-sensitive text prefix'", ["string-attrs", "!*"]]], + ["string", ["''"]] +] + +---------------------------------------------------- + +Checks for various text strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nginx/boolean_feature.test b/package/src/prism/tests/languages/nginx/boolean_feature.test new file mode 100644 index 00000000..42d3e9c5 --- /dev/null +++ b/package/src/prism/tests/languages/nginx/boolean_feature.test @@ -0,0 +1,25 @@ +ssi on; +sendfile off; +tcp_nopush on; + +---------------------------------------------------- + +[ + ["directive", [ + ["keyword", "ssi"], + ["boolean", "on"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "sendfile"], + ["boolean", "off"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "tcp_nopush"], + ["boolean", "on"] + ]], + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/nginx/comment_feature.test b/package/src/prism/tests/languages/nginx/comment_feature.test new file mode 100644 index 00000000..7d6047a7 --- /dev/null +++ b/package/src/prism/tests/languages/nginx/comment_feature.test @@ -0,0 +1,153 @@ +# +# Foobar + +http {# This must be recognized as a comment +} + +events # A comment +{ + worker_connections 512; +} + +# A comment + +http# This is not a comment. There is no space +{ + server {# A comment + listen 80;# A comment + + location = "/example1" # This is a comment. There is a space + {# This is a comment after "{". No spaces required + return 200 "Hello, world!";# This is a comment after ";". No spaces required + }# This is a comment after "}". No spaces required + + location = /example2 # This is a comment. There is a space + {} + + location = "/example3"# This is not a comment. There is no space + {} + + location = /example4# This is not a comment. There is no space + {} + }# A comment +} + +location = "/example"# This is NOT a comment. There is no space +{} + +location = /example# This is NOT a comment. There is no space +{} + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# Foobar"], + + ["directive", [ + ["keyword", "http"] + ]], + ["punctuation", "{"], + ["comment", "# This must be recognized as a comment"], + + ["punctuation", "}"], + + ["directive", [ + ["keyword", "events"], + ["comment", "# A comment"] + ]], + + ["punctuation", "{"], + + ["directive", [ + ["keyword", "worker_connections"], + ["number", "512"] + ]], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["comment", "# A comment"], + + ["directive", [ + ["keyword", "http#"], + " This is not a comment. There is no space" + ]], + + ["punctuation", "{"], + + ["directive", [ + ["keyword", "server"] + ]], + ["punctuation", "{"], + ["comment", "# A comment"], + + ["directive", [ + ["keyword", "listen"], + ["number", "80"] + ]], + ["punctuation", ";"], + ["comment", "# A comment"], + + ["directive", [ + ["keyword", "location"], + " = ", + ["string", ["\"/example1\""]], + ["comment", "# This is a comment. There is a space"] + ]], + + ["punctuation", "{"], + ["comment", "# This is a comment after \"{\". No spaces required"], + + ["directive", [ + ["keyword", "return"], + ["number", "200"], + ["string", ["\"Hello, world!\""]] + ]], + ["punctuation", ";"], + ["comment", "# This is a comment after \";\". No spaces required"], + + ["punctuation", "}"], + ["comment", "# This is a comment after \"}\". No spaces required"], + + ["directive", [ + ["keyword", "location"], + " = /example2 ", + ["comment", "# This is a comment. There is a space"] + ]], + ["punctuation", "{"], ["punctuation", "}"], + + ["directive", [ + ["keyword", "location"], + " = ", + ["string", ["\"/example3\""]], + "# This is not a comment. There is no space" + ]], + ["punctuation", "{"], ["punctuation", "}"], + + ["directive", [ + ["keyword", "location"], + " = /example4# This is not a comment. There is no space" + ]], + ["punctuation", "{"], ["punctuation", "}"], + ["punctuation", "}"], ["comment", "# A comment"], + ["punctuation", "}"], + + ["directive", [ + ["keyword", "location"], + " = ", + ["string", ["\"/example\""]], + "# This is NOT a comment. There is no space" + ]], + ["punctuation", "{"], ["punctuation", "}"], + + ["directive", [ + ["keyword", "location"], + " = /example# This is NOT a comment. There is no space" + ]], + ["punctuation", "{"], ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/nginx/directive_feature.test b/package/src/prism/tests/languages/nginx/directive_feature.test new file mode 100644 index 00000000..ddd0303e --- /dev/null +++ b/package/src/prism/tests/languages/nginx/directive_feature.test @@ -0,0 +1,186 @@ +name parameter1; +name "parameter1"; +name parameter1 parameter2; +name parameter1 "parameter2"; +name "parameter1" parameter2; +name para\;meter1; +name "para;meter1"; +name "para\;meter1"; +internal; +internal ; + +# A multiline parameter +name "para + +meter1"; + +name { + name parameter1 'parameter2' \; par#ameter3; + name parameter1 \" 'he"llo' par#ameter2; + name parameter1; name parameter1; + name parameter1 \{ 'hello'; + name { + internal; + name parameter1 parameter2; + } +} + +name "#foo"; name; #bar +name " #foo"; #bar +name ';oh no' parameter; + +---------------------------------------------------- + +[ + ["directive", [ + ["keyword", "name"], + " parameter1" + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"], + ["string", ["\"parameter1\""]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"], + " parameter1 parameter2" + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"], + " parameter1 ", + ["string", ["\"parameter2\""]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"], + ["string", ["\"parameter1\""]], + " parameter2" + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"], + " para\\;meter1" + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"], + ["string", ["\"para;meter1\""]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"], + ["string", ["\"para\\;meter1\""]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "internal"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "internal"] + ]], + ["punctuation", ";"], + + ["comment", "# A multiline parameter"], + + ["directive", [ + ["keyword", "name"], + ["string", ["\"para\n\nmeter1\""]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"] + ]], + ["punctuation", "{"], + + ["directive", [ + ["keyword", "name"], + " parameter1 ", + ["string", ["'parameter2'"]], + " \\; par#ameter3" + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"], + " parameter1 \\\" ", + ["string", ["'he\"llo'"]], + " par#ameter2" + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"], + " parameter1" + ]], + ["punctuation", ";"], + ["directive", [ + ["keyword", "name"], + " parameter1" + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"], + " parameter1 \\{ ", + ["string", ["'hello'"]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"] + ]], + ["punctuation", "{"], + + ["directive", [ + ["keyword", "internal"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "name"], + " parameter1 parameter2" + ]], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["punctuation", "}"], + + ["directive", [ + ["keyword", "name"], + ["string", ["\"#foo\""]] + ]], + ["punctuation", ";"], + ["directive", [ + ["keyword", "name"] + ]], + ["punctuation", ";"], + ["comment", "#bar"], + + ["directive", [ + ["keyword", "name"], + ["string", ["\" #foo\""]] + ]], + ["punctuation", ";"], + ["comment", "#bar"], + + ["directive", [ + ["keyword", "name"], + ["string", ["';oh no'"]], + " parameter" + ]], + ["punctuation", ";"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/nginx/number_feature.test b/package/src/prism/tests/languages/nginx/number_feature.test new file mode 100644 index 00000000..572d05fc --- /dev/null +++ b/package/src/prism/tests/languages/nginx/number_feature.test @@ -0,0 +1,78 @@ +worker_connections 4096; +expires 30d; + +client_max_body_size 10m; +client_body_buffer_size 128k; +proxy_connect_timeout 90; +proxy_send_timeout 90; +proxy_read_timeout 90; +proxy_buffers 32 4k; + +keepalive_timeout 75 20; +return 404; + +---------------------------------------------------- + +[ + ["directive", [ + ["keyword", "worker_connections"], + ["number", "4096"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "expires"], + ["number", "30d"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "client_max_body_size"], + ["number", "10m"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "client_body_buffer_size"], + ["number", "128k"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "proxy_connect_timeout"], + ["number", "90"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "proxy_send_timeout"], + ["number", "90"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "proxy_read_timeout"], + ["number", "90"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "proxy_buffers"], + ["number", "32"], + ["number", "4k"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "keepalive_timeout"], + ["number", "75"], + ["number", "20"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "return"], + ["number", "404"] + ]], + ["punctuation", ";"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/nginx/string_feature.test b/package/src/prism/tests/languages/nginx/string_feature.test new file mode 100644 index 00000000..3d16dafa --- /dev/null +++ b/package/src/prism/tests/languages/nginx/string_feature.test @@ -0,0 +1,116 @@ +foo ""; +foo ''; +foo "foo +bar"; +foo 'foo +bar'; + +foo " \" \' \\ \r \n \t"; +foo ' \" \' \\ \r \n \t'; + +foo "$foo"; +foo "${foo}bar"; +foo "$arg_;"; + +# not escaped +foo "\$foo"; + +---------------------------------------------------- + +[ + ["directive", [ + ["keyword", "foo"], + ["string", ["\"\""]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "foo"], + ["string", ["''"]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "foo"], + ["string", ["\"foo\nbar\""]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "foo"], + ["string", ["'foo\nbar'"]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "foo"], + ["string", [ + "\" ", + ["escape", "\\\""], + ["escape", "\\'"], + ["escape", "\\\\"], + ["escape", "\\r"], + ["escape", "\\n"], + ["escape", "\\t"], + "\"" + ]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "foo"], + ["string", [ + "' ", + ["escape", "\\\""], + ["escape", "\\'"], + ["escape", "\\\\"], + ["escape", "\\r"], + ["escape", "\\n"], + ["escape", "\\t"], + "'" + ]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "foo"], + ["string", [ + "\"", + ["variable", "$foo"], + "\"" + ]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "foo"], + ["string", [ + "\"", + ["variable", "${foo}"], + "bar\"" + ]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "foo"], + ["string", [ + "\"", + ["variable", "$arg_;"], + "\"" + ]] + ]], + ["punctuation", ";"], + + ["comment", "# not escaped"], + + ["directive", [ + ["keyword", "foo"], + ["string", [ + "\"\\", + ["variable", "$foo"], + "\"" + ]] + ]], + ["punctuation", ";"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/nginx/variable_feature.test b/package/src/prism/tests/languages/nginx/variable_feature.test new file mode 100644 index 00000000..418a388e --- /dev/null +++ b/package/src/prism/tests/languages/nginx/variable_feature.test @@ -0,0 +1,151 @@ +foo $host; +foo $geoip_city_country_code3 +set $0 foo; +set $_ foo; +set $arg_? foo; + +# real example + +log_format main '$remote_addr - $remote_user [$time_local] ' + '"$request" $status $bytes_sent ' + '"$http_referer" "$http_user_agent" ' + '"$gzip_ratio"'; + +location / { + ssi on; + set $inc $request_uri; + if (!-f $request_filename) { + rewrite ^ /index.html last; + } + if (!-f $document_root$inc.html) { + return 404; + } +} + +---------------------------------------------------- + +[ + ["directive", [ + ["keyword", "foo"], + ["variable", "$host"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "foo"], ["variable", "$geoip_city_country_code3"], + "\nset ", ["variable", "$0"], " foo" + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "set"], + ["variable", "$_"], + " foo" + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "set"], + ["variable", "$arg_?"], + " foo" + ]], + ["punctuation", ";"], + + ["comment", "# real example"], + + ["directive", [ + ["keyword", "log_format"], + " main ", + ["string", [ + "'", + ["variable", "$remote_addr"], + " - ", + ["variable", "$remote_user"], + " [", + ["variable", "$time_local]"], + " '" + ]], + + ["string", [ + "'\"", + ["variable", "$request"], + "\" ", + ["variable", "$status"], + ["variable", "$bytes_sent"], + " '" + ]], + + ["string", [ + "'\"", + ["variable", "$http_referer"], + "\" \"", + ["variable", "$http_user_agent"], + "\" '" + ]], + + ["string", [ + "'\"", + ["variable", "$gzip_ratio"], + "\"'" + ]] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "location"], + " /" + ]], + ["punctuation", "{"], + + ["directive", [ + ["keyword", "ssi"], + ["boolean", "on"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "set"], + ["variable", "$inc"], + ["variable", "$request_uri"] + ]], + ["punctuation", ";"], + + ["directive", [ + ["keyword", "if"], + " (!-f ", + ["variable", "$request_filename"], + ")" + ]], + ["punctuation", "{"], + + ["directive", [ + ["keyword", "rewrite"], + " ^ /index.html last" + ]], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["directive", [ + ["keyword", "if"], + " (!-f ", + ["variable", "$document_root"], + ["variable", "$inc"], + ".html)" + ]], + ["punctuation", "{"], + + ["directive", [ + ["keyword", "return"], + ["number", "404"] + ]], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for variables. diff --git a/package/src/prism/tests/languages/nim/char_feature.test b/package/src/prism/tests/languages/nim/char_feature.test new file mode 100644 index 00000000..c2ec9c8e --- /dev/null +++ b/package/src/prism/tests/languages/nim/char_feature.test @@ -0,0 +1,9 @@ +'\'' +'\xFC' + +---------------------------------------------------- + +[ + ["char", "'\\''"], + ["char", "'\\xFC'"] +] diff --git a/package/src/prism/tests/languages/nim/comment_feature.test b/package/src/prism/tests/languages/nim/comment_feature.test new file mode 100644 index 00000000..37dc9f91 --- /dev/null +++ b/package/src/prism/tests/languages/nim/comment_feature.test @@ -0,0 +1,13 @@ +# +# Foobar + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# Foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nim/function_feature.test b/package/src/prism/tests/languages/nim/function_feature.test new file mode 100644 index 00000000..1a43bc30 --- /dev/null +++ b/package/src/prism/tests/languages/nim/function_feature.test @@ -0,0 +1,27 @@ +fo\x9ao( +class*( +takeV[T]( +`$`( + +---------------------------------------------------- + +[ + ["function", ["fo\\x9ao"]], + ["punctuation", "("], + + ["function", [ + "class", + ["operator", "*"] + ]], + ["punctuation", "("], + + ["function", ["takeV[T]"]], + ["punctuation", "("], + + ["function", ["`$`"]], + ["punctuation", "("] +] + +---------------------------------------------------- + +Checks for functions. diff --git a/package/src/prism/tests/languages/nim/identifier_feature.test b/package/src/prism/tests/languages/nim/identifier_feature.test new file mode 100644 index 00000000..d547eb88 --- /dev/null +++ b/package/src/prism/tests/languages/nim/identifier_feature.test @@ -0,0 +1,14 @@ +var `var` = 42 + +---------------------------------------------------- + +[ + ["keyword", "var"], + ["identifier", [ + ["punctuation", "`"], + "var", + ["punctuation", "`"] + ]], + ["operator", "="], + ["number", "42"] +] diff --git a/package/src/prism/tests/languages/nim/keyword_feature.test b/package/src/prism/tests/languages/nim/keyword_feature.test new file mode 100644 index 00000000..22923edf --- /dev/null +++ b/package/src/prism/tests/languages/nim/keyword_feature.test @@ -0,0 +1,123 @@ +addr +as +asm +atomic +bind +block +break +case +cast +concept +const +continue +converter +defer +discard +distinct +do +elif +else +end +enum +except +export +finally +for +from +func +generic +if +import +include +interface +iterator +let +macro +method +mixin +nil +object +out +proc +ptr +raise +ref +return +static +template +try +tuple +type +using +var +when +while +with +without +yield + +---------------------------------------------------- + +[ + ["keyword", "addr"], + ["keyword", "as"], + ["keyword", "asm"], + ["keyword", "atomic"], + ["keyword", "bind"], + ["keyword", "block"], + ["keyword", "break"], + ["keyword", "case"], + ["keyword", "cast"], + ["keyword", "concept"], + ["keyword", "const"], + ["keyword", "continue"], + ["keyword", "converter"], + ["keyword", "defer"], + ["keyword", "discard"], + ["keyword", "distinct"], + ["keyword", "do"], + ["keyword", "elif"], + ["keyword", "else"], + ["keyword", "end"], + ["keyword", "enum"], + ["keyword", "except"], + ["keyword", "export"], + ["keyword", "finally"], + ["keyword", "for"], + ["keyword", "from"], + ["keyword", "func"], + ["keyword", "generic"], + ["keyword", "if"], + ["keyword", "import"], + ["keyword", "include"], + ["keyword", "interface"], + ["keyword", "iterator"], + ["keyword", "let"], + ["keyword", "macro"], + ["keyword", "method"], + ["keyword", "mixin"], + ["keyword", "nil"], + ["keyword", "object"], + ["keyword", "out"], + ["keyword", "proc"], + ["keyword", "ptr"], + ["keyword", "raise"], + ["keyword", "ref"], + ["keyword", "return"], + ["keyword", "static"], + ["keyword", "template"], + ["keyword", "try"], + ["keyword", "tuple"], + ["keyword", "type"], + ["keyword", "using"], + ["keyword", "var"], + ["keyword", "when"], + ["keyword", "while"], + ["keyword", "with"], + ["keyword", "without"], + ["keyword", "yield"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nim/number_feature.test b/package/src/prism/tests/languages/nim/number_feature.test new file mode 100644 index 00000000..e8d62384 --- /dev/null +++ b/package/src/prism/tests/languages/nim/number_feature.test @@ -0,0 +1,31 @@ +0xBad_Face +0o754_173 +0B1111_0000 +42_000 +3.14_15_9 +3E7 +0.5e-84_741 +9.8e+54 +9000'u +2'i16 +2i16 +0xfe'f32 + +---------------------------------------------------- + +[ + ["number", "0xBad_Face"], + ["number", "0o754_173"], + ["number", "0B1111_0000"], + ["number", "42_000"], + ["number", "3.14_15_9"], + ["number", "3E7"], + ["number", "0.5e-84_741"], + ["number", "9.8e+54"], + ["number", "9000'u"], + ["number", "2'i16"], + ["number", "2i16"], + ["number", "0xfe'f32"] +] + +---------------------------------------------------- diff --git a/package/src/prism/tests/languages/nim/operator_feature.test b/package/src/prism/tests/languages/nim/operator_feature.test new file mode 100644 index 00000000..ed246b7b --- /dev/null +++ b/package/src/prism/tests/languages/nim/operator_feature.test @@ -0,0 +1,39 @@ += + - +* / +< > +@ $ ~ +& % | +! ? ^ +: \ +.. . + ++*<> + +and div of or +in is isnot mod +not notin +shl shr xor + +---------------------------------------------------- + +[ + ["operator", "="], ["operator", "+"], ["operator", "-"], + ["operator", "*"], ["operator", "/"], + ["operator", "<"], ["operator", ">"], + ["operator", "@"], ["operator", "$"], ["operator", "~"], + ["operator", "&"], ["operator", "%"], ["operator", "|"], + ["operator", "!"], ["operator", "?"], ["operator", "^"], + ["operator", ":"], ["operator", "\\"], + ["operator", ".."], ["operator", "."], + + ["operator", "+*<>"], + + ["operator", "and"], ["operator", "div"], ["operator", "of"], ["operator", "or"], + ["operator", "in"], ["operator", "is"], ["operator", "isnot"], ["operator", "mod"], + ["operator", "not"], ["operator", "notin"], + ["operator", "shl"], ["operator", "shr"], ["operator", "xor"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nim/string_feature.test b/package/src/prism/tests/languages/nim/string_feature.test new file mode 100644 index 00000000..929e6993 --- /dev/null +++ b/package/src/prism/tests/languages/nim/string_feature.test @@ -0,0 +1,38 @@ +"" +"Fo\"obar" + +"""""" +"""Fo"o +bar""" + +R"Raw ""string" + +r"Raw +""string" + +fo\x8Fo"Foobar" + +bar"""Foo +bar""" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"Fo\\\"obar\""], + + ["string", "\"\"\"\"\"\""], + ["string", "\"\"\"Fo\"o\nbar\"\"\""], + + ["string", "R\"Raw \"\"string\""], + + ["string", "r\"Raw\n\"\"string\""], + + ["string", "fo\\x8Fo\"Foobar\""], + + ["string", "bar\"\"\"Foo\nbar\"\"\""] +] + +---------------------------------------------------- + +Checks for strings and character literals. diff --git a/package/src/prism/tests/languages/nix/antiquotation_feature.test b/package/src/prism/tests/languages/nix/antiquotation_feature.test new file mode 100644 index 00000000..21464c16 --- /dev/null +++ b/package/src/prism/tests/languages/nix/antiquotation_feature.test @@ -0,0 +1,14 @@ +${42} + +---------------------------------------------------- + +[ + ["antiquotation", "$"], + ["punctuation", "{"], + ["number", "42"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for antiquotations outside of strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nix/boolean_feature.test b/package/src/prism/tests/languages/nix/boolean_feature.test new file mode 100644 index 00000000..a40f8d95 --- /dev/null +++ b/package/src/prism/tests/languages/nix/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nix/comment_feature.test b/package/src/prism/tests/languages/nix/comment_feature.test new file mode 100644 index 00000000..831f955e --- /dev/null +++ b/package/src/prism/tests/languages/nix/comment_feature.test @@ -0,0 +1,18 @@ +# +# foobar +/**/ +/* foo +bar */ + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# foobar"], + ["comment", "/**/"], + ["comment", "/* foo\nbar */"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nix/function_feature.test b/package/src/prism/tests/languages/nix/function_feature.test new file mode 100644 index 00000000..fcb29452 --- /dev/null +++ b/package/src/prism/tests/languages/nix/function_feature.test @@ -0,0 +1,133 @@ +abort +add +all +any +attrNames +attrValues +baseNameOf +compareVersions +concatLists +currentSystem +deepSeq +derivation +dirOf +div +elem +elemAt +fetchurl +fetchTarball +filter +filterSource +fromJSON +genList +getAttr +getEnv +hasAttr +hashString +head +import +intersectAttrs +isAttrs +isBool +isFunction +isInt +isList +isNull +isString +length +lessThan +listToAttrs +map +mul +parseDrvName +pathExists +readDir +readFile +removeAttrs +replaceStrings +seq +sort +stringLength +sub +substring +tail +throw +toFile +toJSON +toPath +toString +toXML +trace +typeOf +foldl' + +---------------------------------------------------- + +[ + ["function", "abort"], + ["function", "add"], + ["function", "all"], + ["function", "any"], + ["function", "attrNames"], + ["function", "attrValues"], + ["function", "baseNameOf"], + ["function", "compareVersions"], + ["function", "concatLists"], + ["function", "currentSystem"], + ["function", "deepSeq"], + ["function", "derivation"], + ["function", "dirOf"], + ["function", "div"], + ["function", "elem"], + ["function", "elemAt"], + ["function", "fetchurl"], + ["function", "fetchTarball"], + ["function", "filter"], + ["function", "filterSource"], + ["function", "fromJSON"], + ["function", "genList"], + ["function", "getAttr"], + ["function", "getEnv"], + ["function", "hasAttr"], + ["function", "hashString"], + ["function", "head"], + ["function", "import"], + ["function", "intersectAttrs"], + ["function", "isAttrs"], + ["function", "isBool"], + ["function", "isFunction"], + ["function", "isInt"], + ["function", "isList"], + ["function", "isNull"], + ["function", "isString"], + ["function", "length"], + ["function", "lessThan"], + ["function", "listToAttrs"], + ["function", "map"], + ["function", "mul"], + ["function", "parseDrvName"], + ["function", "pathExists"], + ["function", "readDir"], + ["function", "readFile"], + ["function", "removeAttrs"], + ["function", "replaceStrings"], + ["function", "seq"], + ["function", "sort"], + ["function", "stringLength"], + ["function", "sub"], + ["function", "substring"], + ["function", "tail"], + ["function", "throw"], + ["function", "toFile"], + ["function", "toJSON"], + ["function", "toPath"], + ["function", "toString"], + ["function", "toXML"], + ["function", "trace"], + ["function", "typeOf"], + ["function", "foldl'"] +] + +---------------------------------------------------- + +Checks for built-in functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nix/keyword_feature.test b/package/src/prism/tests/languages/nix/keyword_feature.test new file mode 100644 index 00000000..5de3d282 --- /dev/null +++ b/package/src/prism/tests/languages/nix/keyword_feature.test @@ -0,0 +1,15 @@ +assert builtins else if +in inherit let null +or then with + +---------------------------------------------------- + +[ + ["keyword", "assert"], ["keyword", "builtins"], ["keyword", "else"], ["keyword", "if"], + ["keyword", "in"], ["keyword", "inherit"], ["keyword", "let"], ["keyword", "null"], + ["keyword", "or"], ["keyword", "then"], ["keyword", "with"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nix/number_feature.test b/package/src/prism/tests/languages/nix/number_feature.test new file mode 100644 index 00000000..a21ea253 --- /dev/null +++ b/package/src/prism/tests/languages/nix/number_feature.test @@ -0,0 +1,15 @@ +0 +42 +120457 + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "42"], + ["number", "120457"] +] + +---------------------------------------------------- + +Checks for integers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nix/operator_feature.test b/package/src/prism/tests/languages/nix/operator_feature.test new file mode 100644 index 00000000..0b9d24c8 --- /dev/null +++ b/package/src/prism/tests/languages/nix/operator_feature.test @@ -0,0 +1,25 @@ += == +! != +< <= +> >= ++ ++ +- -> +|| && // +? @ + +---------------------------------------------------- + +[ + ["operator", "="], ["operator", "=="], + ["operator", "!"], ["operator", "!="], + ["operator", "<"], ["operator", "<="], + ["operator", ">"], ["operator", ">="], + ["operator", "+"], ["operator", "++"], + ["operator", "-"], ["operator", "->"], + ["operator", "||"], ["operator", "&&"], ["operator", "//"], + ["operator", "?"], ["operator", "@"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nix/string_feature.test b/package/src/prism/tests/languages/nix/string_feature.test new file mode 100644 index 00000000..61cd9252 --- /dev/null +++ b/package/src/prism/tests/languages/nix/string_feature.test @@ -0,0 +1,56 @@ +"" +"foo\"b\\ar" +"f''o'o'\"bar" +"foo +bar" +"foo ${ 42 } baz" +"foo \${ 42 } baz" + +'''' +'' +foo +bar +'' +'' +f'oo'''ba'r +foo ${ 42 } baz +foo ''${ 42 } baz +'' + +---------------------------------------------------- + +[ + ["string", ["\"\""]], + ["string", ["\"foo\\\"b\\\\ar\""]], + ["string", ["\"f''o'o'\\\"bar\""]], + ["string", ["\"foo\nbar\""]], + ["string", [ + "\"foo ", + ["interpolation", [ + ["antiquotation", "$"], + ["punctuation", "{"], + ["number", "42"], + ["punctuation", "}"] + ]], + " baz\"" + ]], + ["string", ["\"foo \\${ 42 } baz\""]], + + ["string", ["''''"]], + ["string", ["''\nfoo\nbar\n''"]], + ["string", [ + "''\nf'oo'''ba'r\nfoo ", + ["interpolation", [ + ["antiquotation", "$"], + ["punctuation", "{"], + ["number", "42"], + ["punctuation", "}"] + ]], + " baz\nfoo ''${ 42 } baz\n''" + ]] +] + +---------------------------------------------------- + +Checks for strings and string interpolation. +Also checks that escaped interpolations are not interpreted. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nix/url_feature.test b/package/src/prism/tests/languages/nix/url_feature.test new file mode 100644 index 00000000..4ce3c640 --- /dev/null +++ b/package/src/prism/tests/languages/nix/url_feature.test @@ -0,0 +1,21 @@ +http://example.org/foo.tar.bz2 +ftp://ftp.nluug.nl/pub/gnu/hello/hello-2.1.1.tar.gz + +/bin/sh +./builder.sh +~/foo.bar + +---------------------------------------------------- + +[ + ["url", "http://example.org/foo.tar.bz2"], + ["url", "ftp://ftp.nluug.nl/pub/gnu/hello/hello-2.1.1.tar.gz"], + + ["url", "/bin/sh"], + ["url", "./builder.sh"], + ["url", "~/foo.bar"] +] + +---------------------------------------------------- + +Checks for URLs and paths. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nsis/comment_feature.test b/package/src/prism/tests/languages/nsis/comment_feature.test new file mode 100644 index 00000000..eceb476f --- /dev/null +++ b/package/src/prism/tests/languages/nsis/comment_feature.test @@ -0,0 +1,18 @@ +/* foo */ +/* foo +bar */ +# foo +; bar + +---------------------------------------------------- + +[ + ["comment", "/* foo */"], + ["comment", "/* foo\nbar */"], + ["comment", "# foo"], + ["comment", "; bar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nsis/constant_feature.test b/package/src/prism/tests/languages/nsis/constant_feature.test new file mode 100644 index 00000000..b46de58a --- /dev/null +++ b/package/src/prism/tests/languages/nsis/constant_feature.test @@ -0,0 +1,27 @@ +$(myLicenseData) +$(^Name) +$(!Name) +${LANG_ENGLISH} +${AtLeastWin8.1} +${nsArray_Copy} +${xml::CreateNode} +${^EXAMPLE} +${!defineifexist} + +---------------------------------------------------- + +[ + ["constant", "$(myLicenseData)"], + ["constant", "$(^Name)"], + ["constant", "$(!Name)"], + ["constant", "${LANG_ENGLISH}"], + ["constant", "${AtLeastWin8.1}"], + ["constant", "${nsArray_Copy}"], + ["constant", "${xml::CreateNode}"], + ["constant", "${^EXAMPLE}"], + ["constant", "${!defineifexist}"] +] + +---------------------------------------------------- + +Checks for constants. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nsis/important_feature.test b/package/src/prism/tests/languages/nsis/important_feature.test new file mode 100644 index 00000000..fd58807b --- /dev/null +++ b/package/src/prism/tests/languages/nsis/important_feature.test @@ -0,0 +1,75 @@ +!addincludedir +!addplugindir +!appendfile +!cd +!define +!delfile +!echo +!else +!endif +!error +!execute +!finalize +!getdllversion +!gettlbversion +!ifdef +!ifmacrodef +!ifmacrondef +!ifndef +!if +!include +!insertmacro +!macroend +!macro +!makensis +!packhdr +!pragma +!searchparse +!searchreplace +!system +!tempfile +!undef +!verbose +!warning + +---------------------------------------------------- + +[ + ["important", "!addincludedir"], + ["important", "!addplugindir"], + ["important", "!appendfile"], + ["important", "!cd"], + ["important", "!define"], + ["important", "!delfile"], + ["important", "!echo"], + ["important", "!else"], + ["important", "!endif"], + ["important", "!error"], + ["important", "!execute"], + ["important", "!finalize"], + ["important", "!getdllversion"], + ["important", "!gettlbversion"], + ["important", "!ifdef"], + ["important", "!ifmacrodef"], + ["important", "!ifmacrondef"], + ["important", "!ifndef"], + ["important", "!if"], + ["important", "!include"], + ["important", "!insertmacro"], + ["important", "!macroend"], + ["important", "!macro"], + ["important", "!makensis"], + ["important", "!packhdr"], + ["important", "!pragma"], + ["important", "!searchparse"], + ["important", "!searchreplace"], + ["important", "!system"], + ["important", "!tempfile"], + ["important", "!undef"], + ["important", "!verbose"], + ["important", "!warning"] +] + +---------------------------------------------------- + +Checks for compiler instructions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nsis/keyword_feature.test b/package/src/prism/tests/languages/nsis/keyword_feature.test new file mode 100644 index 00000000..88d8fe75 --- /dev/null +++ b/package/src/prism/tests/languages/nsis/keyword_feature.test @@ -0,0 +1,465 @@ +Abort +AddBrandingImage +AddSize +AdvSplash +AllowRootDirInstall +AllowSkipFiles +AutoCloseWindow +Banner +BGFont +BGGradient +BGImage +BrandingText +BringToFront +Call +CallInstDLL +Caption +ChangeUI +CheckBitmap +ClearErrors +CompletedText +ComponentText +CopyFiles +CRCCheck +CreateDirectory +CreateFont +CreateShortCut +Delete +DeleteINISec +DeleteINIStr +DeleteRegKey +DeleteRegValue +DetailPrint +DetailsButtonText +Dialer +DirText +DirVar +DirVerify +EnableWindow +EnumRegKey +EnumRegValue +Exch +Exec +ExecShell +ExecWait +ExecShellWait +ExpandEnvStrings +File +FileBufSize +FileClose +FileErrorText +FileOpen +FileRead +FileReadByte +FileReadUTF16LE +FileReadWord +FileSeek +FileWrite +FileWriteByte +FileWriteUTF16LE +FileWriteWord +FindClose +FindFirst +FindNext +FindWindow +FlushINI +GetCurInstType +GetCurrentAddress +GetDlgItem +GetDLLVersion +GetDLLVersionLocal +GetErrorLevel +GetFileTime +GetFileTimeLocal +GetFullPathName +GetFunction +GetFunctionAddress +GetFunctionEnd +GetInstDirError +GetKnownFolderPath +GetLabelAddress +GetTempFileName +GetWinVer +Goto +HideWindow +Icon +IfAbort +IfErrors +IfFileExists +IfRebootFlag +IfRtlLanguage +IfShellVarContextAll +IfSilent +InitPluginsDir +InstallButtonText +InstallColors +InstallDir +InstallDirRegKey +InstProgressFlags +InstType +InstTypeGetText +InstTypeSetText +Int64Cmp +Int64CmpU +Int64Fmt +IntCmp +IntCmpU +IntFmt +IntOp +IntPtrCmp +IntPtrCmpU +IntPtrOp +IsWindow +LangDLL +LangString +LicenseBkColor +LicenseData +LicenseForceSelection +LicenseLangString +LicenseText +LoadLanguageFile +LockWindow +LogSet +LogText +ManifestDPIAware +ManifestSupportedOS +Math +MessageBox +MiscButtonText +Name +Nop +nsDialogs +nsExec +NSISdl +OutFile +Page +PageCallbacks +PEDllCharacteristics +PESubsysVer +Pop +Push +Quit +ReadEnvStr +ReadINIStr +ReadRegDWORD +ReadRegStr +Reboot +RegDLL +Rename +RequestExecutionLevel +ReserveFile +Return +RMDir +SearchPath +Section +SectionEnd +SectionGetFlags +SectionGetInstTypes +SectionGetSize +SectionGetText +SectionGroup +SectionIn +SectionSetFlags +SectionSetInstTypes +SectionSetSize +SectionSetText +SendMessage +SetAutoClose +SetBrandingImage +SetCompress +SetCompressor +SetCompressorDictSize +SetCtlColors +SetCurInstType +SetDatablockOptimize +SetDateSave +SetDetailsPrint +SetDetailsView +SetErrorLevel +SetErrors +SetFileAttributes +SetFont +SetOutPath +SetOverwrite +SetPluginUnload +SetRebootFlag +SetRegView +SetShellVarContext +SetSilent +ShowInstDetails +ShowUninstDetails +ShowWindow +SilentInstall +SilentUnInstall +Sleep +SpaceTexts +Splash +StartMenu +StrCmp +StrCmpS +StrCpy +StrLen +SubCaption +System +Target +Unicode +UninstallButtonText +UninstallCaption +UninstallIcon +UninstallSubCaption +UninstallText +UninstPage +UnRegDLL +UserInfo +Var +VIAddVersionKey +VIFileVersion +VIProductVersion +VPatch +WindowIcon +WriteINIStr +WriteRegBin +WriteRegDWORD +WriteRegExpandStr +WriteRegMultiStr +WriteRegNone +WriteRegStr +WriteUninstaller +XPStyle + +---------------------------------------------------- + +[ + ["keyword", "Abort"], + ["keyword", "AddBrandingImage"], + ["keyword", "AddSize"], + ["keyword", "AdvSplash"], + ["keyword", "AllowRootDirInstall"], + ["keyword", "AllowSkipFiles"], + ["keyword", "AutoCloseWindow"], + ["keyword", "Banner"], + ["keyword", "BGFont"], + ["keyword", "BGGradient"], + ["keyword", "BGImage"], + ["keyword", "BrandingText"], + ["keyword", "BringToFront"], + ["keyword", "Call"], + ["keyword", "CallInstDLL"], + ["keyword", "Caption"], + ["keyword", "ChangeUI"], + ["keyword", "CheckBitmap"], + ["keyword", "ClearErrors"], + ["keyword", "CompletedText"], + ["keyword", "ComponentText"], + ["keyword", "CopyFiles"], + ["keyword", "CRCCheck"], + ["keyword", "CreateDirectory"], + ["keyword", "CreateFont"], + ["keyword", "CreateShortCut"], + ["keyword", "Delete"], + ["keyword", "DeleteINISec"], + ["keyword", "DeleteINIStr"], + ["keyword", "DeleteRegKey"], + ["keyword", "DeleteRegValue"], + ["keyword", "DetailPrint"], + ["keyword", "DetailsButtonText"], + ["keyword", "Dialer"], + ["keyword", "DirText"], + ["keyword", "DirVar"], + ["keyword", "DirVerify"], + ["keyword", "EnableWindow"], + ["keyword", "EnumRegKey"], + ["keyword", "EnumRegValue"], + ["keyword", "Exch"], + ["keyword", "Exec"], + ["keyword", "ExecShell"], + ["keyword", "ExecWait"], + ["keyword", "ExecShellWait"], + ["keyword", "ExpandEnvStrings"], + ["keyword", "File"], + ["keyword", "FileBufSize"], + ["keyword", "FileClose"], + ["keyword", "FileErrorText"], + ["keyword", "FileOpen"], + ["keyword", "FileRead"], + ["keyword", "FileReadByte"], + ["keyword", "FileReadUTF16LE"], + ["keyword", "FileReadWord"], + ["keyword", "FileSeek"], + ["keyword", "FileWrite"], + ["keyword", "FileWriteByte"], + ["keyword", "FileWriteUTF16LE"], + ["keyword", "FileWriteWord"], + ["keyword", "FindClose"], + ["keyword", "FindFirst"], + ["keyword", "FindNext"], + ["keyword", "FindWindow"], + ["keyword", "FlushINI"], + ["keyword", "GetCurInstType"], + ["keyword", "GetCurrentAddress"], + ["keyword", "GetDlgItem"], + ["keyword", "GetDLLVersion"], + ["keyword", "GetDLLVersionLocal"], + ["keyword", "GetErrorLevel"], + ["keyword", "GetFileTime"], + ["keyword", "GetFileTimeLocal"], + ["keyword", "GetFullPathName"], + ["keyword", "GetFunction"], + ["keyword", "GetFunctionAddress"], + ["keyword", "GetFunctionEnd"], + ["keyword", "GetInstDirError"], + ["keyword", "GetKnownFolderPath"], + ["keyword", "GetLabelAddress"], + ["keyword", "GetTempFileName"], + ["keyword", "GetWinVer"], + ["keyword", "Goto"], + ["keyword", "HideWindow"], + ["keyword", "Icon"], + ["keyword", "IfAbort"], + ["keyword", "IfErrors"], + ["keyword", "IfFileExists"], + ["keyword", "IfRebootFlag"], + ["keyword", "IfRtlLanguage"], + ["keyword", "IfShellVarContextAll"], + ["keyword", "IfSilent"], + ["keyword", "InitPluginsDir"], + ["keyword", "InstallButtonText"], + ["keyword", "InstallColors"], + ["keyword", "InstallDir"], + ["keyword", "InstallDirRegKey"], + ["keyword", "InstProgressFlags"], + ["keyword", "InstType"], + ["keyword", "InstTypeGetText"], + ["keyword", "InstTypeSetText"], + ["keyword", "Int64Cmp"], + ["keyword", "Int64CmpU"], + ["keyword", "Int64Fmt"], + ["keyword", "IntCmp"], + ["keyword", "IntCmpU"], + ["keyword", "IntFmt"], + ["keyword", "IntOp"], + ["keyword", "IntPtrCmp"], + ["keyword", "IntPtrCmpU"], + ["keyword", "IntPtrOp"], + ["keyword", "IsWindow"], + ["keyword", "LangDLL"], + ["keyword", "LangString"], + ["keyword", "LicenseBkColor"], + ["keyword", "LicenseData"], + ["keyword", "LicenseForceSelection"], + ["keyword", "LicenseLangString"], + ["keyword", "LicenseText"], + ["keyword", "LoadLanguageFile"], + ["keyword", "LockWindow"], + ["keyword", "LogSet"], + ["keyword", "LogText"], + ["keyword", "ManifestDPIAware"], + ["keyword", "ManifestSupportedOS"], + ["keyword", "Math"], + ["keyword", "MessageBox"], + ["keyword", "MiscButtonText"], + ["keyword", "Name"], + ["keyword", "Nop"], + ["keyword", "nsDialogs"], + ["keyword", "nsExec"], + ["keyword", "NSISdl"], + ["keyword", "OutFile"], + ["keyword", "Page"], + ["keyword", "PageCallbacks"], + ["keyword", "PEDllCharacteristics"], + ["keyword", "PESubsysVer"], + ["keyword", "Pop"], + ["keyword", "Push"], + ["keyword", "Quit"], + ["keyword", "ReadEnvStr"], + ["keyword", "ReadINIStr"], + ["keyword", "ReadRegDWORD"], + ["keyword", "ReadRegStr"], + ["keyword", "Reboot"], + ["keyword", "RegDLL"], + ["keyword", "Rename"], + ["keyword", "RequestExecutionLevel"], + ["keyword", "ReserveFile"], + ["keyword", "Return"], + ["keyword", "RMDir"], + ["keyword", "SearchPath"], + ["keyword", "Section"], + ["keyword", "SectionEnd"], + ["keyword", "SectionGetFlags"], + ["keyword", "SectionGetInstTypes"], + ["keyword", "SectionGetSize"], + ["keyword", "SectionGetText"], + ["keyword", "SectionGroup"], + ["keyword", "SectionIn"], + ["keyword", "SectionSetFlags"], + ["keyword", "SectionSetInstTypes"], + ["keyword", "SectionSetSize"], + ["keyword", "SectionSetText"], + ["keyword", "SendMessage"], + ["keyword", "SetAutoClose"], + ["keyword", "SetBrandingImage"], + ["keyword", "SetCompress"], + ["keyword", "SetCompressor"], + ["keyword", "SetCompressorDictSize"], + ["keyword", "SetCtlColors"], + ["keyword", "SetCurInstType"], + ["keyword", "SetDatablockOptimize"], + ["keyword", "SetDateSave"], + ["keyword", "SetDetailsPrint"], + ["keyword", "SetDetailsView"], + ["keyword", "SetErrorLevel"], + ["keyword", "SetErrors"], + ["keyword", "SetFileAttributes"], + ["keyword", "SetFont"], + ["keyword", "SetOutPath"], + ["keyword", "SetOverwrite"], + ["keyword", "SetPluginUnload"], + ["keyword", "SetRebootFlag"], + ["keyword", "SetRegView"], + ["keyword", "SetShellVarContext"], + ["keyword", "SetSilent"], + ["keyword", "ShowInstDetails"], + ["keyword", "ShowUninstDetails"], + ["keyword", "ShowWindow"], + ["keyword", "SilentInstall"], + ["keyword", "SilentUnInstall"], + ["keyword", "Sleep"], + ["keyword", "SpaceTexts"], + ["keyword", "Splash"], + ["keyword", "StartMenu"], + ["keyword", "StrCmp"], + ["keyword", "StrCmpS"], + ["keyword", "StrCpy"], + ["keyword", "StrLen"], + ["keyword", "SubCaption"], + ["keyword", "System"], + ["keyword", "Target"], + ["keyword", "Unicode"], + ["keyword", "UninstallButtonText"], + ["keyword", "UninstallCaption"], + ["keyword", "UninstallIcon"], + ["keyword", "UninstallSubCaption"], + ["keyword", "UninstallText"], + ["keyword", "UninstPage"], + ["keyword", "UnRegDLL"], + ["keyword", "UserInfo"], + ["keyword", "Var"], + ["keyword", "VIAddVersionKey"], + ["keyword", "VIFileVersion"], + ["keyword", "VIProductVersion"], + ["keyword", "VPatch"], + ["keyword", "WindowIcon"], + ["keyword", "WriteINIStr"], + ["keyword", "WriteRegBin"], + ["keyword", "WriteRegDWORD"], + ["keyword", "WriteRegExpandStr"], + ["keyword", "WriteRegMultiStr"], + ["keyword", "WriteRegNone"], + ["keyword", "WriteRegStr"], + ["keyword", "WriteUninstaller"], + ["keyword", "XPStyle"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/nsis/number_feature.test b/package/src/prism/tests/languages/nsis/number_feature.test new file mode 100644 index 00000000..2ef1dced --- /dev/null +++ b/package/src/prism/tests/languages/nsis/number_feature.test @@ -0,0 +1,19 @@ +0xBadFace +42 +3.14159 +3.2e4 +1.0e-5 + +---------------------------------------------------- + +[ + ["number", "0xBadFace"], + ["number", "42"], + ["number", "3.14159"], + ["number", "3.2e4"], + ["number", "1.0e-5"] +] + +---------------------------------------------------- + +Checks for hexadecimal and decimal numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nsis/operator_feature.test b/package/src/prism/tests/languages/nsis/operator_feature.test new file mode 100644 index 00000000..37648084 --- /dev/null +++ b/package/src/prism/tests/languages/nsis/operator_feature.test @@ -0,0 +1,21 @@ ++ - ++ -- +< <= > >= += == === +& && | || +? * / ~ +^ % + +---------------------------------------------------- + +[ + ["operator", "+"], ["operator", "-"], ["operator", "++"], ["operator", "--"], + ["operator", "<"], ["operator", "<="], ["operator", ">"], ["operator", ">="], + ["operator", "="], ["operator", "=="], ["operator", "==="], + ["operator", "&"], ["operator", "&&"], ["operator", "|"], ["operator", "||"], + ["operator", "?"], ["operator", "*"], ["operator", "/"], ["operator", "~"], + ["operator", "^"], ["operator", "%"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nsis/property_feature.test b/package/src/prism/tests/languages/nsis/property_feature.test new file mode 100644 index 00000000..7a3e012f --- /dev/null +++ b/package/src/prism/tests/languages/nsis/property_feature.test @@ -0,0 +1,115 @@ +admin all auto both +colored false force +hide highest lastused +leave listonly none +normal notset off +on open print show +silent silentlog +smooth textonly +true user + +ARCHIVE +FILE_ATTRIBUTE_ARCHIVE +FILE_ATTRIBUTE_NORMAL +FILE_ATTRIBUTE_OFFLINE +FILE_ATTRIBUTE_READONLY +FILE_ATTRIBUTE_SYSTEM +FILE_ATTRIBUTE_TEMPORARY +HKCR HKCU HKLM +HKCR32 HKCU32 HKLM32 +HKCR64 HKCU64 HKLM64 +HKDD HKPD HKU +HKEY_CLASSES_ROOT +HKEY_CURRENT_CONFIG +HKEY_CURRENT_USER +HKEY_DYN_DATA +HKEY_LOCAL_MACHINE +HKEY_PERFORMANCE_DATA +HKEY_USERS +IDABORT IDCANCEL +IDIGNORE IDNO +IDOK IDRETRY IDYES +MB_ABORTRETRYIGNORE +MB_DEFBUTTON1 +MB_DEFBUTTON2 +MB_DEFBUTTON3 +MB_DEFBUTTON4 +MB_ICONEXCLAMATION +MB_ICONINFORMATION +MB_ICONQUESTION +MB_ICONSTOP +MB_OK +MB_OKCANCEL +MB_RETRYCANCEL +MB_RIGHT +MB_RTLREADING +MB_SETFOREGROUND +MB_TOPMOST +MB_USERICON +MB_YESNO +NORMAL OFFLINE +READONLY SHCTX +SHELL_CONTEXT +SYSTEM TEMPORARY + +---------------------------------------------------- + +[ + ["property", "admin"], ["property", "all"], ["property", "auto"], ["property", "both"], + ["property", "colored"], ["property", "false"], ["property", "force"], + ["property", "hide"], ["property", "highest"], ["property", "lastused"], + ["property", "leave"], ["property", "listonly"], ["property", "none"], + ["property", "normal"], ["property", "notset"], ["property", "off"], + ["property", "on"], ["property", "open"], ["property", "print"], ["property", "show"], + ["property", "silent"], ["property", "silentlog"], + ["property", "smooth"], ["property", "textonly"], + ["property", "true"], ["property", "user"], + + ["property", "ARCHIVE"], + ["property", "FILE_ATTRIBUTE_ARCHIVE"], + ["property", "FILE_ATTRIBUTE_NORMAL"], + ["property", "FILE_ATTRIBUTE_OFFLINE"], + ["property", "FILE_ATTRIBUTE_READONLY"], + ["property", "FILE_ATTRIBUTE_SYSTEM"], + ["property", "FILE_ATTRIBUTE_TEMPORARY"], + ["property", "HKCR"], ["property", "HKCU"], ["property", "HKLM"], + ["property", "HKCR32"], ["property", "HKCU32"], ["property", "HKLM32"], + ["property", "HKCR64"], ["property", "HKCU64"], ["property", "HKLM64"], + ["property", "HKDD"], ["property", "HKPD"], ["property", "HKU"], + ["property", "HKEY_CLASSES_ROOT"], + ["property", "HKEY_CURRENT_CONFIG"], + ["property", "HKEY_CURRENT_USER"], + ["property", "HKEY_DYN_DATA"], + ["property", "HKEY_LOCAL_MACHINE"], + ["property", "HKEY_PERFORMANCE_DATA"], + ["property", "HKEY_USERS"], + ["property", "IDABORT"], ["property", "IDCANCEL"], + ["property", "IDIGNORE"], ["property", "IDNO"], + ["property", "IDOK"], ["property", "IDRETRY"], ["property", "IDYES"], + ["property", "MB_ABORTRETRYIGNORE"], + ["property", "MB_DEFBUTTON1"], + ["property", "MB_DEFBUTTON2"], + ["property", "MB_DEFBUTTON3"], + ["property", "MB_DEFBUTTON4"], + ["property", "MB_ICONEXCLAMATION"], + ["property", "MB_ICONINFORMATION"], + ["property", "MB_ICONQUESTION"], + ["property", "MB_ICONSTOP"], + ["property", "MB_OK"], + ["property", "MB_OKCANCEL"], + ["property", "MB_RETRYCANCEL"], + ["property", "MB_RIGHT"], + ["property", "MB_RTLREADING"], + ["property", "MB_SETFOREGROUND"], + ["property", "MB_TOPMOST"], + ["property", "MB_USERICON"], + ["property", "MB_YESNO"], + ["property", "NORMAL"], ["property", "OFFLINE"], + ["property", "READONLY"], ["property", "SHCTX"], + ["property", "SHELL_CONTEXT"], + ["property", "SYSTEM"], ["property", "TEMPORARY"] +] + +---------------------------------------------------- + +Checks for all properties. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nsis/string_feature.test b/package/src/prism/tests/languages/nsis/string_feature.test new file mode 100644 index 00000000..f8f5c8b0 --- /dev/null +++ b/package/src/prism/tests/languages/nsis/string_feature.test @@ -0,0 +1,17 @@ +"" +"fo\"o" +'' +'fo\'o' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"o\""], + ["string", "''"], + ["string", "'fo\\'o'"] +] + +---------------------------------------------------- + +Checks for single-quoted and double-quoted strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/nsis/variable_feature.test b/package/src/prism/tests/languages/nsis/variable_feature.test new file mode 100644 index 00000000..1b4cdf8d --- /dev/null +++ b/package/src/prism/tests/languages/nsis/variable_feature.test @@ -0,0 +1,15 @@ +$INTERNET_CACHE +$LANGUAGE +$mui.Button.Next + +---------------------------------------------------- + +[ + ["variable", "$INTERNET_CACHE"], + ["variable", "$LANGUAGE"], + ["variable", "$mui.Button.Next"] +] + +---------------------------------------------------- + +Checks for variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/objectivec/char_feature.test b/package/src/prism/tests/languages/objectivec/char_feature.test new file mode 100644 index 00000000..a97fc67d --- /dev/null +++ b/package/src/prism/tests/languages/objectivec/char_feature.test @@ -0,0 +1,15 @@ +'a' +'\n' +'\000' +'\x00' +'\u0000' + +---------------------------------------------------- + +[ + ["char", "'a'"], + ["char", "'\\n'"], + ["char", "'\\000'"], + ["char", "'\\x00'"], + ["char", "'\\u0000'"] +] diff --git a/package/src/prism/tests/languages/objectivec/comment_feature.test b/package/src/prism/tests/languages/objectivec/comment_feature.test new file mode 100644 index 00000000..9d3cf13c --- /dev/null +++ b/package/src/prism/tests/languages/objectivec/comment_feature.test @@ -0,0 +1,26 @@ +// +// comment +// the comment \ + continues! + +/**/ +/* + * comment + */ + +/* open-ended comment + +---------------------------------------------------- + +[ + ["comment", "//"], + ["comment", "// comment"], + ["comment", "// the comment \\\n continues!"], + ["comment", "/**/"], + ["comment", "/*\n * comment\n */"], + ["comment", "/* open-ended comment"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/objectivec/keyword_feature.test b/package/src/prism/tests/languages/objectivec/keyword_feature.test new file mode 100644 index 00000000..99d3c4bc --- /dev/null +++ b/package/src/prism/tests/languages/objectivec/keyword_feature.test @@ -0,0 +1,59 @@ +asm typeof inline +auto break case +char const continue +default do double +else enum extern +float for goto +if int long +register return +short signed +sizeof static +struct switch +typedef union +unsigned void +volatile while +in self super + +@interface @end +@implementation +@protocol @class +@public @protected +@private @property +@try @catch +@finally @throw +@synthesize +@dynamic @selector + +---------------------------------------------------- + +[ + ["keyword", "asm"], ["keyword", "typeof"], ["keyword", "inline"], + ["keyword", "auto"], ["keyword", "break"], ["keyword", "case"], + ["keyword", "char"], ["keyword", "const"], ["keyword", "continue"], + ["keyword", "default"], ["keyword", "do"], ["keyword", "double"], + ["keyword", "else"], ["keyword", "enum"], ["keyword", "extern"], + ["keyword", "float"], ["keyword", "for"], ["keyword", "goto"], + ["keyword", "if"], ["keyword", "int"], ["keyword", "long"], + ["keyword", "register"], ["keyword", "return"], + ["keyword", "short"], ["keyword", "signed"], + ["keyword", "sizeof"], ["keyword", "static"], + ["keyword", "struct"], ["keyword", "switch"], + ["keyword", "typedef"], ["keyword", "union"], + ["keyword", "unsigned"], ["keyword", "void"], + ["keyword", "volatile"], ["keyword", "while"], + ["keyword", "in"], ["keyword", "self"], ["keyword", "super"], + + ["keyword", "@interface"], ["keyword", "@end"], + ["keyword", "@implementation"], + ["keyword", "@protocol"], ["keyword", "@class"], + ["keyword", "@public"], ["keyword", "@protected"], + ["keyword", "@private"], ["keyword", "@property"], + ["keyword", "@try"], ["keyword", "@catch"], + ["keyword", "@finally"], ["keyword", "@throw"], + ["keyword", "@synthesize"], + ["keyword", "@dynamic"], ["keyword", "@selector"] +] + +---------------------------------------------------- + +Checks for all keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/objectivec/operator_feature.test b/package/src/prism/tests/languages/objectivec/operator_feature.test new file mode 100644 index 00000000..87620474 --- /dev/null +++ b/package/src/prism/tests/languages/objectivec/operator_feature.test @@ -0,0 +1,25 @@ ++ - ++ -- +! != +< << <= <<= +> >> >= >>= +-> = == +^ ~ % +& && | || +? * / @ + +---------------------------------------------------- + +[ + ["operator", "+"], ["operator", "-"], ["operator", "++"], ["operator", "--"], + ["operator", "!"], ["operator", "!="], + ["operator", "<"], ["operator", "<<"], ["operator", "<="], ["operator", "<<="], + ["operator", ">"], ["operator", ">>"], ["operator", ">="], ["operator", ">>="], + ["operator", "->"], ["operator", "="], ["operator", "=="], + ["operator", "^"], ["operator", "~"], ["operator", "%"], + ["operator", "&"], ["operator", "&&"], ["operator", "|"], ["operator", "||"], + ["operator", "?"], ["operator", "*"], ["operator", "/"], ["operator", "@"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/objectivec/string_feature.test b/package/src/prism/tests/languages/objectivec/string_feature.test new file mode 100644 index 00000000..fa0b4a37 --- /dev/null +++ b/package/src/prism/tests/languages/objectivec/string_feature.test @@ -0,0 +1,25 @@ +"" +"fo\"o" +"foo\ +bar" + +@"" +@"fo\"o" +@"foo\ +bar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"o\""], + ["string", "\"foo\\\nbar\""], + + ["string", "@\"\""], + ["string", "@\"fo\\\"o\""], + ["string", "@\"foo\\\nbar\""] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/ocaml/boolean_feature.test b/package/src/prism/tests/languages/ocaml/boolean_feature.test new file mode 100644 index 00000000..ca400627 --- /dev/null +++ b/package/src/prism/tests/languages/ocaml/boolean_feature.test @@ -0,0 +1,13 @@ +false +true + +---------------------------------------------------- + +[ + ["boolean", "false"], + ["boolean", "true"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/ocaml/char_feature.test b/package/src/prism/tests/languages/ocaml/char_feature.test new file mode 100644 index 00000000..57dbbd9d --- /dev/null +++ b/package/src/prism/tests/languages/ocaml/char_feature.test @@ -0,0 +1,15 @@ +'a' +'\n' +'\'' +'\xA9' +'\169' + +---------------------------------------------------- + +[ + ["char", "'a'"], + ["char", "'\\n'"], + ["char", "'\\''"], + ["char", "'\\xA9'"], + ["char", "'\\169'"] +] diff --git a/package/src/prism/tests/languages/ocaml/comment_feature.test b/package/src/prism/tests/languages/ocaml/comment_feature.test new file mode 100644 index 00000000..c2a9bf8c --- /dev/null +++ b/package/src/prism/tests/languages/ocaml/comment_feature.test @@ -0,0 +1,14 @@ +(**) +(* foo +bar *) + +---------------------------------------------------- + +[ + ["comment", "(**)"], + ["comment", "(* foo\nbar *)"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/ocaml/directive_feature.test b/package/src/prism/tests/languages/ocaml/directive_feature.test new file mode 100644 index 00000000..d0bd590b --- /dev/null +++ b/package/src/prism/tests/languages/ocaml/directive_feature.test @@ -0,0 +1,15 @@ +#quit +#load +#load_rec + +---------------------------------------------------- + +[ + ["directive", "#quit"], + ["directive", "#load"], + ["directive", "#load_rec"] +] + +---------------------------------------------------- + +Checks for directives. \ No newline at end of file diff --git a/package/src/prism/tests/languages/ocaml/keyword_feature.test b/package/src/prism/tests/languages/ocaml/keyword_feature.test new file mode 100644 index 00000000..0636a53e --- /dev/null +++ b/package/src/prism/tests/languages/ocaml/keyword_feature.test @@ -0,0 +1,103 @@ +as +assert +begin +class +constraint +do +done +downto +else +end +exception +external +for +fun +function +functor +if +in +include +inherit +initializer +lazy +let +match +method +module +mutable +new +nonrec +object +of +open +private +rec +sig +struct +then +to +try +type +val +value +virtual +when +where +while +with + +---------------------------------------------------- + +[ + ["keyword", "as"], + ["keyword", "assert"], + ["keyword", "begin"], + ["keyword", "class"], + ["keyword", "constraint"], + ["keyword", "do"], + ["keyword", "done"], + ["keyword", "downto"], + ["keyword", "else"], + ["keyword", "end"], + ["keyword", "exception"], + ["keyword", "external"], + ["keyword", "for"], + ["keyword", "fun"], + ["keyword", "function"], + ["keyword", "functor"], + ["keyword", "if"], + ["keyword", "in"], + ["keyword", "include"], + ["keyword", "inherit"], + ["keyword", "initializer"], + ["keyword", "lazy"], + ["keyword", "let"], + ["keyword", "match"], + ["keyword", "method"], + ["keyword", "module"], + ["keyword", "mutable"], + ["keyword", "new"], + ["keyword", "nonrec"], + ["keyword", "object"], + ["keyword", "of"], + ["keyword", "open"], + ["keyword", "private"], + ["keyword", "rec"], + ["keyword", "sig"], + ["keyword", "struct"], + ["keyword", "then"], + ["keyword", "to"], + ["keyword", "try"], + ["keyword", "type"], + ["keyword", "val"], + ["keyword", "value"], + ["keyword", "virtual"], + ["keyword", "when"], + ["keyword", "where"], + ["keyword", "while"], + ["keyword", "with"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/ocaml/label_feature.test b/package/src/prism/tests/languages/ocaml/label_feature.test new file mode 100644 index 00000000..71b9bd46 --- /dev/null +++ b/package/src/prism/tests/languages/ocaml/label_feature.test @@ -0,0 +1,13 @@ +~foo +~bar_42 + +---------------------------------------------------- + +[ + ["label", "~foo"], + ["label", "~bar_42"] +] + +---------------------------------------------------- + +Checks for labels. \ No newline at end of file diff --git a/package/src/prism/tests/languages/ocaml/number_feature.test b/package/src/prism/tests/languages/ocaml/number_feature.test new file mode 100644 index 00000000..19132996 --- /dev/null +++ b/package/src/prism/tests/languages/ocaml/number_feature.test @@ -0,0 +1,37 @@ +1234 +32. +0xBad_Face +0o754_672 +0b1010_1111 +42_000 +3.14_15_9 +3.141_592_653_589_793_12 +1e-5 +3.2e8 +6.1E-7 +2.22044604925031308e-16 +0.4e+12_415 +0x1p-52 + +---------------------------------------------------- + +[ + ["number", "1234"], + ["number", "32."], + ["number", "0xBad_Face"], + ["number", "0o754_672"], + ["number", "0b1010_1111"], + ["number", "42_000"], + ["number", "3.14_15_9"], + ["number", "3.141_592_653_589_793_12"], + ["number", "1e-5"], + ["number", "3.2e8"], + ["number", "6.1E-7"], + ["number", "2.22044604925031308e-16"], + ["number", "0.4e+12_415"], + ["number", "0x1p-52"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/ocaml/operator_feature.test b/package/src/prism/tests/languages/ocaml/operator_feature.test new file mode 100644 index 00000000..b6959b5b --- /dev/null +++ b/package/src/prism/tests/languages/ocaml/operator_feature.test @@ -0,0 +1,52 @@ +and asr land +lor lsl lsr +lxor mod or + +:= :> += < > @ +^ | & ~ .~ ++ - * / +$ % ! ? +.. + +~=~ + +---------------------------------------------------- + +[ + ["operator", "and"], ["operator", "asr"], ["operator", "land"], + ["operator", "lor"], ["operator", "lsl"], ["operator", "lsr"], + ["operator", "lxor"], ["operator", "mod"], ["operator", "or"], + + ["operator", ":="], + ["operator", ":>"], + + ["operator", "="], + ["operator", "<"], + ["operator", ">"], + ["operator", "@"], + + ["operator", "^"], + ["operator", "|"], + ["operator", "&"], + ["operator", "~"], + ["operator", ".~"], + + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + + ["operator", "$"], + ["operator", "%"], + ["operator", "!"], + ["operator", "?"], + + ["operator", ".."], + + ["operator", "~=~"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/ocaml/punctuation_feature.test b/package/src/prism/tests/languages/ocaml/punctuation_feature.test new file mode 100644 index 00000000..8c607e03 --- /dev/null +++ b/package/src/prism/tests/languages/ocaml/punctuation_feature.test @@ -0,0 +1,41 @@ +( ) { } [ ] +. , : ; +_ +:: ;; + +[< [> [| {< +>] >} |] + +# + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + + ["punctuation", "."], + ["punctuation", ","], + ["punctuation", ":"], + ["punctuation", ";"], + + ["punctuation", "_"], + + ["punctuation", "::"], + ["punctuation", ";;"], + + ["operator-like-punctuation", "[<"], + ["operator-like-punctuation", "[>"], + ["operator-like-punctuation", "[|"], + ["operator-like-punctuation", "{<"], + + ["operator-like-punctuation", ">]"], + ["operator-like-punctuation", ">}"], + ["operator-like-punctuation", "|]"], + + ["punctuation", "#"] +] diff --git a/package/src/prism/tests/languages/ocaml/string_feature.test b/package/src/prism/tests/languages/ocaml/string_feature.test new file mode 100644 index 00000000..927a4087 --- /dev/null +++ b/package/src/prism/tests/languages/ocaml/string_feature.test @@ -0,0 +1,31 @@ +"" +"Fo\"obar" +"Call me Ishmael. Some years ago — never mind how long \ +precisely — having little or no money in my purse, and \ +nothing particular to interest me on shore, I thought I\ +\ would sail about a little and see the watery part of t\ +he world." + +{|This is a quoted string, here, neither \ nor " are special characters|} +{|"Hello, World!"|} +{|"\\"|} +{delimiter|the end of this|}quoted string is here|delimiter} +{ext|hello {|world|}|ext} + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"Fo\\\"obar\""], + ["string", "\"Call me Ishmael. Some years ago — never mind how long \\\nprecisely — having little or no money in my purse, and \\\nnothing particular to interest me on shore, I thought I\\\n\\ would sail about a little and see the watery part of t\\\nhe world.\""], + + ["string", "{|This is a quoted string, here, neither \\ nor \" are special characters|}"], + ["string", "{|\"Hello, World!\"|}"], + ["string", "{|\"\\\\\"|}"], + ["string", "{delimiter|the end of this|}quoted string is here|delimiter}"], + ["string", "{ext|hello {|world|}|ext}"] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/ocaml/type-variable_feature.test b/package/src/prism/tests/languages/ocaml/type-variable_feature.test new file mode 100644 index 00000000..75b9c36d --- /dev/null +++ b/package/src/prism/tests/languages/ocaml/type-variable_feature.test @@ -0,0 +1,13 @@ +'Foo +'bar_42 + +---------------------------------------------------- + +[ + ["type-variable", "'Foo"], + ["type-variable", "'bar_42"] +] + +---------------------------------------------------- + +Checks for type variables. diff --git a/package/src/prism/tests/languages/ocaml/variant_feature.test b/package/src/prism/tests/languages/ocaml/variant_feature.test new file mode 100644 index 00000000..5cc72425 --- /dev/null +++ b/package/src/prism/tests/languages/ocaml/variant_feature.test @@ -0,0 +1,15 @@ +`Foo +`bar32 +`Baz_42 + +---------------------------------------------------- + +[ + ["variant", "`Foo"], + ["variant", "`bar32"], + ["variant", "`Baz_42"] +] + +---------------------------------------------------- + +Checks for polymorphic variants. \ No newline at end of file diff --git a/package/src/prism/tests/languages/odin/boolean_feature.test b/package/src/prism/tests/languages/odin/boolean_feature.test new file mode 100644 index 00000000..75b3f44a --- /dev/null +++ b/package/src/prism/tests/languages/odin/boolean_feature.test @@ -0,0 +1,11 @@ +false +nil +true + +---------------------------------------------------- + +[ + ["boolean", "false"], + ["boolean", "nil"], + ["boolean", "true"] +] diff --git a/package/src/prism/tests/languages/odin/character_feature.test b/package/src/prism/tests/languages/odin/character_feature.test new file mode 100644 index 00000000..8cf23a54 --- /dev/null +++ b/package/src/prism/tests/languages/odin/character_feature.test @@ -0,0 +1,147 @@ +' ' +'!' +'"' +'0' +'\"' +'\'' +'\000' +'\077' +'\U000000' +'\UFFFFFF' +'\Uffffff' +'\\' +'\a' +'\b' +'\e' +'\f' +'\n' +'\r' +'\t' +'\u0000' +'\uFFFF' +'\uffff' +'\v' +'\x00' +'\xFF' +'\xff' +'a' + +---------------------------------------------------- + +[ + ["char", ["' '"]], + ["char", ["'!'"]], + ["char", ["'\"'"]], + ["char", ["'0'"]], + ["char", [ + "'", + ["symbol", "\\\""], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\'"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\000"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\077"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\U000000"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\UFFFFFF"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\Uffffff"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\\\"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\a"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\b"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\e"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\f"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\n"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\r"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\t"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\u0000"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\uFFFF"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\uffff"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\v"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\x00"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\xFF"], + "'" + ]], + ["char", [ + "'", + ["symbol", "\\xff"], + "'" + ]], + ["char", ["'a'"]] +] diff --git a/package/src/prism/tests/languages/odin/comment_feature.test b/package/src/prism/tests/languages/odin/comment_feature.test new file mode 100644 index 00000000..782e8a38 --- /dev/null +++ b/package/src/prism/tests/languages/odin/comment_feature.test @@ -0,0 +1,92 @@ +#! +#! A comment +#!! +#!"" +#!#! +#!' ' +#!/**/ +#!// +#!0 +#!`` +#!false +#!if +/* +*/ +/* 1 /* 2 */ 1 */ +/* A comment */ +/*!*/ +/*""*/ +/*"\a"*/ +/*#!*/ +/*' '*/ +/*'\a'*/ +/**/ +/*/**/*/ +/*0*/ +/*`\a`*/ +/*``*/ +/*false*/ +/*if*/ +// +// A comment +//! +//"" +//#! +//' ' +///**/ +//// +//0 +//`` +//false +//if +Not a comment #! A comment +Not a comment /* A comment */ +Not a comment // A comment + +---------------------------------------------------- + +[ + ["comment", "#!"], + ["comment", "#! A comment"], + ["comment", "#!!"], + ["comment", "#!\"\""], + ["comment", "#!#!"], + ["comment", "#!' '"], + ["comment", "#!/**/"], + ["comment", "#!//"], + ["comment", "#!0"], + ["comment", "#!``"], + ["comment", "#!false"], + ["comment", "#!if"], + ["comment", "/*\n*/"], + ["comment", "/* 1 /* 2 */ 1 */"], + ["comment", "/* A comment */"], + ["comment", "/*!*/"], + ["comment", "/*\"\"*/"], + ["comment", "/*\"\\a\"*/"], + ["comment", "/*#!*/"], + ["comment", "/*' '*/"], + ["comment", "/*'\\a'*/"], + ["comment", "/**/"], + ["comment", "/*/**/*/"], + ["comment", "/*0*/"], + ["comment", "/*`\\a`*/"], + ["comment", "/*``*/"], + ["comment", "/*false*/"], + ["comment", "/*if*/"], + ["comment", "//"], + ["comment", "// A comment"], + ["comment", "//!"], + ["comment", "//\"\""], + ["comment", "//#!"], + ["comment", "//' '"], + ["comment", "///**/"], + ["comment", "////"], + ["comment", "//0"], + ["comment", "//``"], + ["comment", "//false"], + ["comment", "//if"], + "\nNot a comment ", ["comment", "#! A comment"], + "\nNot a comment ", ["comment", "/* A comment */"], + "\nNot a comment ", ["comment", "// A comment"] +] diff --git a/package/src/prism/tests/languages/odin/constant_parameter_sign_feature.test b/package/src/prism/tests/languages/odin/constant_parameter_sign_feature.test new file mode 100644 index 00000000..072cebc8 --- /dev/null +++ b/package/src/prism/tests/languages/odin/constant_parameter_sign_feature.test @@ -0,0 +1,7 @@ +$ + +---------------------------------------------------- + +[ + ["constant-parameter-sign", "$"] +] diff --git a/package/src/prism/tests/languages/odin/directive_feature.test b/package/src/prism/tests/languages/odin/directive_feature.test new file mode 100644 index 00000000..61edb9b9 --- /dev/null +++ b/package/src/prism/tests/languages/odin/directive_feature.test @@ -0,0 +1,9 @@ +#assert +#no_bounds_check + +---------------------------------------------------- + +[ + ["directive", "#assert"], + ["directive", "#no_bounds_check"] +] diff --git a/package/src/prism/tests/languages/odin/discard_feature.test b/package/src/prism/tests/languages/odin/discard_feature.test new file mode 100644 index 00000000..d8f66961 --- /dev/null +++ b/package/src/prism/tests/languages/odin/discard_feature.test @@ -0,0 +1,7 @@ +_ + +---------------------------------------------------- + +[ + ["discard", "_"] +] diff --git a/package/src/prism/tests/languages/odin/keyword_feature.test b/package/src/prism/tests/languages/odin/keyword_feature.test new file mode 100644 index 00000000..c3380bec --- /dev/null +++ b/package/src/prism/tests/languages/odin/keyword_feature.test @@ -0,0 +1,77 @@ +asm +auto_cast +bit_set +break +case +cast +context +continue +defer +distinct +do +dynamic +else +enum +fallthrough +for +foreign +if +import +in +map +matrix +not_in +or_else +or_return +package +proc +return +struct +switch +transmute +typeid +union +using +when +where + +---------------------------------------------------- + +[ + ["keyword", "asm"], + ["keyword", "auto_cast"], + ["keyword", "bit_set"], + ["keyword", "break"], + ["keyword", "case"], + ["keyword", "cast"], + ["keyword", "context"], + ["keyword", "continue"], + ["keyword", "defer"], + ["keyword", "distinct"], + ["keyword", "do"], + ["keyword", "dynamic"], + ["keyword", "else"], + ["keyword", "enum"], + ["keyword", "fallthrough"], + ["keyword", "for"], + ["keyword", "foreign"], + ["keyword", "if"], + ["keyword", "import"], + ["keyword", "in"], + ["keyword", "map"], + ["keyword", "matrix"], + ["keyword", "not_in"], + ["keyword", "or_else"], + ["keyword", "or_return"], + ["keyword", "package"], + ["keyword", "proc"], + ["keyword", "return"], + ["keyword", "struct"], + ["keyword", "switch"], + ["keyword", "transmute"], + ["keyword", "typeid"], + ["keyword", "union"], + ["keyword", "using"], + ["keyword", "when"], + ["keyword", "where"] +] diff --git a/package/src/prism/tests/languages/odin/not_a_number_feature.test b/package/src/prism/tests/languages/odin/not_a_number_feature.test new file mode 100644 index 00000000..b533c13a --- /dev/null +++ b/package/src/prism/tests/languages/odin/not_a_number_feature.test @@ -0,0 +1,31 @@ +0B0 +0D0 +0I +0O0 +0Z0 +0b +0b2 +0d +0h +0h0 +0h00 +0h000 +0h00000 +0h0000000 +0h000000000 +0h000000000000000 +0h00000000000000000 +0h_ +0o +0o8 +0x +0X0 +0xG +0z +0zC + +---------------------------------------------------- + +[ + "0B0\n0D0\n0I\n0O0\n0Z0\n0b\n0b2\n0d\n0h\n0h0\n0h00\n0h000\n0h00000\n0h0000000\n0h000000000\n0h000000000000000\n0h00000000000000000\n0h_\n0o\n0o8\n0x\n0X0\n0xG\n0z\n0zC" +] diff --git a/package/src/prism/tests/languages/odin/number_feature.test b/package/src/prism/tests/languages/odin/number_feature.test new file mode 100644 index 00000000..2e2560fd --- /dev/null +++ b/package/src/prism/tests/languages/odin/number_feature.test @@ -0,0 +1,129 @@ +.0 +0 +0. +0E +0b0 +0b00 +0b01 +0b0_ +0b_ +0b_0 +0b_1 +0b__ +0d0 +0d00 +0d01 +0d0_ +0d_ +0d_0 +0d_1 +0d__ +0e +0e+ +0e+0 +0e+0i +0e+i +0e- +0e-0 +0e-0i +0e-i +0ei +0h0000 +0h00000000 +0h0000000000000000 +0i +0o0 +0o00 +0o01 +0o0_ +0o_ +0o_0 +0o_1 +0o__ +0x0 +0x00 +0x0_ +0x0F +0x0f +0x_ +0x_0 +0x__ +0x_F +0x_f +0z0 +0z00 +0z0_ +0z0B +0z0b +0z_ +0z_0 +0z__ +0z_B +0z_b + +---------------------------------------------------- + +[ + ["number", ".0"], + ["number", "0"], + ["number", "0."], + ["number", "0E"], + ["number", "0b0"], + ["number", "0b00"], + ["number", "0b01"], + ["number", "0b0_"], + ["number", "0b_"], + ["number", "0b_0"], + ["number", "0b_1"], + ["number", "0b__"], + ["number", "0d0"], + ["number", "0d00"], + ["number", "0d01"], + ["number", "0d0_"], + ["number", "0d_"], + ["number", "0d_0"], + ["number", "0d_1"], + ["number", "0d__"], + ["number", "0e"], + ["number", "0e+"], + ["number", "0e+0"], + ["number", "0e+0i"], + ["number", "0e+i"], + ["number", "0e-"], + ["number", "0e-0"], + ["number", "0e-0i"], + ["number", "0e-i"], + ["number", "0ei"], + ["number", "0h0000"], + ["number", "0h00000000"], + ["number", "0h0000000000000000"], + ["number", "0i"], + ["number", "0o0"], + ["number", "0o00"], + ["number", "0o01"], + ["number", "0o0_"], + ["number", "0o_"], + ["number", "0o_0"], + ["number", "0o_1"], + ["number", "0o__"], + ["number", "0x0"], + ["number", "0x00"], + ["number", "0x0_"], + ["number", "0x0F"], + ["number", "0x0f"], + ["number", "0x_"], + ["number", "0x_0"], + ["number", "0x__"], + ["number", "0x_F"], + ["number", "0x_f"], + ["number", "0z0"], + ["number", "0z00"], + ["number", "0z0_"], + ["number", "0z0B"], + ["number", "0z0b"], + ["number", "0z_"], + ["number", "0z_0"], + ["number", "0z__"], + ["number", "0z_B"], + ["number", "0z_b"] +] diff --git a/package/src/prism/tests/languages/odin/operator_feature.test b/package/src/prism/tests/languages/odin/operator_feature.test new file mode 100644 index 00000000..fd4752a0 --- /dev/null +++ b/package/src/prism/tests/languages/odin/operator_feature.test @@ -0,0 +1,97 @@ +! +!= +% +%% +%%= +%= +& +&& +&&= +&= +&~ +&~= +* +*= ++ +++ ++= +- +-- +-= +.. +..< +..= +/ +/= +< +<< +<<= +<= += +== +> +>= +>> +>>= +? +^ +| +|= +|| +||= +~ +~= + +// ranges +0..<10 + +---------------------------------------------------- + +[ + ["operator", "!"], + ["operator", "!="], + ["operator", "%"], + ["operator", "%%"], + ["operator", "%%="], + ["operator", "%="], + ["operator", "&"], + ["operator", "&&"], + ["operator", "&&="], + ["operator", "&="], + ["operator", "&~"], + ["operator", "&~="], + ["operator", "*"], + ["operator", "*="], + ["operator", "+"], + ["operator", "++"], + ["operator", "+="], + ["operator", "-"], + ["operator", "--"], + ["operator", "-="], + ["operator", ".."], + ["operator", "..<"], + ["operator", "..="], + ["operator", "/"], + ["operator", "/="], + ["operator", "<"], + ["operator", "<<"], + ["operator", "<<="], + ["operator", "<="], + ["operator", "="], + ["operator", "=="], + ["operator", ">"], + ["operator", ">="], + ["operator", ">>"], + ["operator", ">>="], + ["operator", "?"], + ["operator", "^"], + ["operator", "|"], + ["operator", "|="], + ["operator", "||"], + ["operator", "||="], + ["operator", "~"], + ["operator", "~="], + + ["comment", "// ranges"], + ["number", "0"], ["operator", "..<"], ["number", "10"] +] diff --git a/package/src/prism/tests/languages/odin/procedure_feature.test b/package/src/prism/tests/languages/odin/procedure_feature.test new file mode 100644 index 00000000..93a59f1c --- /dev/null +++ b/package/src/prism/tests/languages/odin/procedure_feature.test @@ -0,0 +1,27 @@ +do_math() +fibonacci() +log10() + +cross :: proc(a, b: Vector3) -> Vector3 + +---------------------------------------------------- + +[ + ["procedure-name", "do_math"], ["punctuation", "("], ["punctuation", ")"], + ["procedure-name", "fibonacci"], ["punctuation", "("], ["punctuation", ")"], + ["procedure-name", "log10"], ["punctuation", "("], ["punctuation", ")"], + + ["procedure-definition", "cross"], + ["punctuation", ":"], + ["punctuation", ":"], + ["keyword", "proc"], + ["punctuation", "("], + "a", + ["punctuation", ","], + " b", + ["punctuation", ":"], + " Vector3", + ["punctuation", ")"], + ["arrow", "->"], + " Vector3" +] diff --git a/package/src/prism/tests/languages/odin/punctuation_feature.test b/package/src/prism/tests/languages/odin/punctuation_feature.test new file mode 100644 index 00000000..8c4c80c1 --- /dev/null +++ b/package/src/prism/tests/languages/odin/punctuation_feature.test @@ -0,0 +1,29 @@ +( +) +, +-> +. +: +; +@ +[ +] +{ +} + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ","], + ["arrow", "->"], + ["punctuation", "."], + ["punctuation", ":"], + ["punctuation", ";"], + ["punctuation", "@"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/odin/raw_string_feature.test b/package/src/prism/tests/languages/odin/raw_string_feature.test new file mode 100644 index 00000000..063e6e0a --- /dev/null +++ b/package/src/prism/tests/languages/odin/raw_string_feature.test @@ -0,0 +1,79 @@ +` +` +`!` +`""` +`"\a"` +`' '` +`'\a'` +`/**/` +`//` +`0` +`\ +` +`\"` +`\'` +`\000` +`\077` +`\U000000` +`\UFFFFFF` +`\Uffffff` +`\\` +`\a` +`\b` +`\e` +`\f` +`\n` +`\r` +`\t` +`\u0000` +`\uFFFF` +`\uffff` +`\v` +`\x00` +`\xFF` +`\xff` +`A raw string.` +`` +`false` +`if` + +---------------------------------------------------- + +[ + ["string", "`\n`"], + ["string", "`!`"], + ["string", "`\"\"`"], + ["string", "`\"\\a\"`"], + ["string", "`' '`"], + ["string", "`'\\a'`"], + ["string", "`/**/`"], + ["string", "`//`"], + ["string", "`0`"], + ["string", "`\\\n`"], + ["string", "`\\\"`"], + ["string", "`\\'`"], + ["string", "`\\000`"], + ["string", "`\\077`"], + ["string", "`\\U000000`"], + ["string", "`\\UFFFFFF`"], + ["string", "`\\Uffffff`"], + ["string", "`\\\\`"], + ["string", "`\\a`"], + ["string", "`\\b`"], + ["string", "`\\e`"], + ["string", "`\\f`"], + ["string", "`\\n`"], + ["string", "`\\r`"], + ["string", "`\\t`"], + ["string", "`\\u0000`"], + ["string", "`\\uFFFF`"], + ["string", "`\\uffff`"], + ["string", "`\\v`"], + ["string", "`\\x00`"], + ["string", "`\\xFF`"], + ["string", "`\\xff`"], + ["string", "`A raw string.`"], + ["string", "``"], + ["string", "`false`"], + ["string", "`if`"] +] diff --git a/package/src/prism/tests/languages/odin/string_feature.test b/package/src/prism/tests/languages/odin/string_feature.test new file mode 100644 index 00000000..afb824b6 --- /dev/null +++ b/package/src/prism/tests/languages/odin/string_feature.test @@ -0,0 +1,178 @@ +"!" +"" +"' '" +"'\a'" +"/**/" +"//" +"0" +"\"" +"\'" +"\000" +"\077" +"\U000000" +"\UFFFFFF" +"\Uffffff" +"\\" +"\a" +"\b" +"\e" +"\f" +"\n" +"\r" +"\t" +"\u0000" +"\uFFFF" +"\uffff" +"\v" +"\x00" +"\xFF" +"\xff" +"Not +a +string" +"Not\ +a\ +string" +"String" +"String" Not a string" +"`\a`" +"``" +"false" +"if" + +---------------------------------------------------- + +[ + ["string", ["\"!\""]], + ["string", ["\"\""]], + ["string", ["\"' '\""]], + ["string", [ + "\"'", + ["symbol", "\\a"], + "'\"" + ]], + ["string", ["\"/**/\""]], + ["string", ["\"//\""]], + ["string", ["\"0\""]], + ["string", [ + "\"", + ["symbol", "\\\""], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\'"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\000"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\077"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\U000000"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\UFFFFFF"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\Uffffff"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\\\"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\a"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\b"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\e"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\f"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\n"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\r"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\t"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\u0000"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\uFFFF"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\uffff"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\v"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\x00"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\xFF"], + "\"" + ]], + ["string", [ + "\"", + ["symbol", "\\xff"], + "\"" + ]], + "\n\"Not\na\nstring\"\n\"Not\\\na\\\nstring\"\n", + ["string", ["\"String\""]], + ["string", ["\"String\""]], " Not a string\"\n", + ["string", [ + "\"`", + ["symbol", "\\a"], + "`\"" + ]], + ["string", ["\"``\""]], + ["string", ["\"false\""]], + ["string", ["\"if\""]] +] diff --git a/package/src/prism/tests/languages/odin/undefined_feature.test b/package/src/prism/tests/languages/odin/undefined_feature.test new file mode 100644 index 00000000..5347143d --- /dev/null +++ b/package/src/prism/tests/languages/odin/undefined_feature.test @@ -0,0 +1,7 @@ +--- + +---------------------------------------------------- + +[ + ["undefined", "---"] +] diff --git a/package/src/prism/tests/languages/opencl+c/boolean_feature.test b/package/src/prism/tests/languages/opencl+c/boolean_feature.test new file mode 100644 index 00000000..b7948b3f --- /dev/null +++ b/package/src/prism/tests/languages/opencl+c/boolean_feature.test @@ -0,0 +1,13 @@ +CL_TRUE +CL_FALSE + +---------------------------------------------------- + +[ + ["boolean-opencl-host", "CL_TRUE"], + ["boolean-opencl-host", "CL_FALSE"] +] + +---------------------------------------------------- + +Checks for reserved boolean types in OpenCL host code (C-API). \ No newline at end of file diff --git a/package/src/prism/tests/languages/opencl+c/constant_feature.test b/package/src/prism/tests/languages/opencl+c/constant_feature.test new file mode 100644 index 00000000..d2a7b36d --- /dev/null +++ b/package/src/prism/tests/languages/opencl+c/constant_feature.test @@ -0,0 +1,859 @@ +CL_A +CL_ABGR +CL_ADDRESS_CLAMP +CL_ADDRESS_CLAMP_TO_EDGE +CL_ADDRESS_MIRRORED_REPEAT +CL_ADDRESS_NONE +CL_ADDRESS_REPEAT +CL_ARGB +CL_BGRA +CL_BLOCKING +CL_BUFFER_CREATE_TYPE_REGION +CL_BUILD_ERROR +CL_BUILD_IN_PROGRESS +CL_BUILD_NONE +CL_BUILD_PROGRAM_FAILURE +CL_BUILD_SUCCESS +CL_COMMAND_ACQUIRE_GL_OBJECTS +CL_COMMAND_BARRIER +CL_COMMAND_COPY_BUFFER +CL_COMMAND_COPY_BUFFER_RECT +CL_COMMAND_COPY_BUFFER_TO_IMAGE +CL_COMMAND_COPY_IMAGE +CL_COMMAND_COPY_IMAGE_TO_BUFFER +CL_COMMAND_FILL_BUFFER +CL_COMMAND_FILL_IMAGE +CL_COMMAND_MAP_BUFFER +CL_COMMAND_MAP_IMAGE +CL_COMMAND_MARKER +CL_COMMAND_MIGRATE_MEM_OBJECTS +CL_COMMAND_MIGRATE_SVM_MEM_OBJECTS +CL_COMMAND_NATIVE_KERNEL +CL_COMMAND_NDRANGE_KERNEL +CL_COMMAND_READ_BUFFER +CL_COMMAND_READ_BUFFER_RECT +CL_COMMAND_READ_IMAGE +CL_COMMAND_RELEASE_GL_OBJECTS +CL_COMMAND_SVM_FREE +CL_COMMAND_SVM_MAP +CL_COMMAND_SVM_MEMCPY +CL_COMMAND_SVM_MEMFILL +CL_COMMAND_SVM_UNMAP +CL_COMMAND_TASK +CL_COMMAND_UNMAP_MEM_OBJECT +CL_COMMAND_USER +CL_COMMAND_WRITE_BUFFER +CL_COMMAND_WRITE_BUFFER_RECT +CL_COMMAND_WRITE_IMAGE +CL_COMPILER_NOT_AVAILABLE +CL_COMPILE_PROGRAM_FAILURE +CL_COMPLETE +CL_CONTEXT_DEVICES +CL_CONTEXT_INTEROP_USER_SYNC +CL_CONTEXT_NUM_DEVICES +CL_CONTEXT_PLATFORM +CL_CONTEXT_PROPERTIES +CL_CONTEXT_REFERENCE_COUNT +CL_DEPTH +CL_DEPTH_STENCIL +CL_DEVICE_ADDRESS_BITS +CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE +CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE +CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE +CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE +CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE +CL_DEVICE_AFFINITY_DOMAIN_NUMA +CL_DEVICE_AVAILABLE +CL_DEVICE_BUILT_IN_KERNELS +CL_DEVICE_COMPILER_AVAILABLE +CL_DEVICE_DOUBLE_FP_CONFIG +CL_DEVICE_ENDIAN_LITTLE +CL_DEVICE_ERROR_CORRECTION_SUPPORT +CL_DEVICE_EXECUTION_CAPABILITIES +CL_DEVICE_EXTENSIONS +CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE +CL_DEVICE_GLOBAL_MEM_CACHE_SIZE +CL_DEVICE_GLOBAL_MEM_CACHE_TYPE +CL_DEVICE_GLOBAL_MEM_SIZE +CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE +CL_DEVICE_HOST_UNIFIED_MEMORY +CL_DEVICE_IL_VERSION +CL_DEVICE_IMAGE2D_MAX_HEIGHT +CL_DEVICE_IMAGE2D_MAX_WIDTH +CL_DEVICE_IMAGE3D_MAX_DEPTH +CL_DEVICE_IMAGE3D_MAX_HEIGHT +CL_DEVICE_IMAGE3D_MAX_WIDTH +CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT +CL_DEVICE_IMAGE_MAX_ARRAY_SIZE +CL_DEVICE_IMAGE_MAX_BUFFER_SIZE +CL_DEVICE_IMAGE_PITCH_ALIGNMENT +CL_DEVICE_IMAGE_SUPPORT +CL_DEVICE_LINKER_AVAILABLE +CL_DEVICE_LOCAL_MEM_SIZE +CL_DEVICE_LOCAL_MEM_TYPE +CL_DEVICE_MAX_CLOCK_FREQUENCY +CL_DEVICE_MAX_COMPUTE_UNITS +CL_DEVICE_MAX_CONSTANT_ARGS +CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE +CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE +CL_DEVICE_MAX_MEM_ALLOC_SIZE +CL_DEVICE_MAX_NUM_SUB_GROUPS +CL_DEVICE_MAX_ON_DEVICE_EVENTS +CL_DEVICE_MAX_ON_DEVICE_QUEUES +CL_DEVICE_MAX_PARAMETER_SIZE +CL_DEVICE_MAX_PIPE_ARGS +CL_DEVICE_MAX_READ_IMAGE_ARGS +CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS +CL_DEVICE_MAX_SAMPLERS +CL_DEVICE_MAX_WORK_GROUP_SIZE +CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS +CL_DEVICE_MAX_WORK_ITEM_SIZES +CL_DEVICE_MAX_WRITE_IMAGE_ARGS +CL_DEVICE_MEM_BASE_ADDR_ALIGN +CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE +CL_DEVICE_NAME +CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR +CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE +CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT +CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF +CL_DEVICE_NATIVE_VECTOR_WIDTH_INT +CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG +CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT +CL_DEVICE_NOT_AVAILABLE +CL_DEVICE_NOT_FOUND +CL_DEVICE_OPENCL_C_VERSION +CL_DEVICE_PARENT_DEVICE +CL_DEVICE_PARTITION_AFFINITY_DOMAIN +CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN +CL_DEVICE_PARTITION_BY_COUNTS +CL_DEVICE_PARTITION_BY_COUNTS_LIST_END +CL_DEVICE_PARTITION_EQUALLY +CL_DEVICE_PARTITION_FAILED +CL_DEVICE_PARTITION_MAX_SUB_DEVICES +CL_DEVICE_PARTITION_PROPERTIES +CL_DEVICE_PARTITION_TYPE +CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS +CL_DEVICE_PIPE_MAX_PACKET_SIZE +CL_DEVICE_PLATFORM +CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT +CL_DEVICE_PREFERRED_INTEROP_USER_SYNC +CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT +CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT +CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR +CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE +CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT +CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF +CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT +CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG +CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT +CL_DEVICE_PRINTF_BUFFER_SIZE +CL_DEVICE_PROFILE +CL_DEVICE_PROFILING_TIMER_RESOLUTION +CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE +CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE +CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES +CL_DEVICE_QUEUE_ON_HOST_PROPERTIES +CL_DEVICE_QUEUE_PROPERTIES +CL_DEVICE_REFERENCE_COUNT +CL_DEVICE_SINGLE_FP_CONFIG +CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS +CL_DEVICE_SVM_ATOMICS +CL_DEVICE_SVM_CAPABILITIES +CL_DEVICE_SVM_COARSE_GRAIN_BUFFER +CL_DEVICE_SVM_FINE_GRAIN_BUFFER +CL_DEVICE_SVM_FINE_GRAIN_SYSTEM +CL_DEVICE_TYPE +CL_DEVICE_TYPE_ACCELERATOR +CL_DEVICE_TYPE_ALL +CL_DEVICE_TYPE_CPU +CL_DEVICE_TYPE_CUSTOM +CL_DEVICE_TYPE_DEFAULT +CL_DEVICE_TYPE_GPU +CL_DEVICE_VENDOR +CL_DEVICE_VENDOR_ID +CL_DEVICE_VERSION +CL_DRIVER_VERSION +CL_EVENT_COMMAND_EXECUTION_STATUS +CL_EVENT_COMMAND_QUEUE +CL_EVENT_COMMAND_TYPE +CL_EVENT_CONTEXT +CL_EVENT_REFERENCE_COUNT +CL_EXEC_KERNEL +CL_EXEC_NATIVE_KERNEL +CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST +CL_FILTER_LINEAR +CL_FILTER_NEAREST +CL_FLOAT +CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT +CL_FP_DENORM +CL_FP_FMA +CL_FP_INF_NAN +CL_FP_ROUND_TO_INF +CL_FP_ROUND_TO_NEAREST +CL_FP_ROUND_TO_ZERO +CL_FP_SOFT_FLOAT +CL_GLOBAL +CL_HALF_FLOAT +CL_IMAGE_ARRAY_SIZE +CL_IMAGE_BUFFER +CL_IMAGE_DEPTH +CL_IMAGE_ELEMENT_SIZE +CL_IMAGE_FORMAT +CL_IMAGE_FORMAT_MISMATCH +CL_IMAGE_FORMAT_NOT_SUPPORTED +CL_IMAGE_HEIGHT +CL_IMAGE_NUM_MIP_LEVELS +CL_IMAGE_NUM_SAMPLES +CL_IMAGE_ROW_PITCH +CL_IMAGE_SLICE_PITCH +CL_IMAGE_WIDTH +CL_INTENSITY +CL_INVALID_ARG_INDEX +CL_INVALID_ARG_SIZE +CL_INVALID_ARG_VALUE +CL_INVALID_BINARY +CL_INVALID_BUFFER_SIZE +CL_INVALID_BUILD_OPTIONS +CL_INVALID_COMMAND_QUEUE +CL_INVALID_COMPILER_OPTIONS +CL_INVALID_CONTEXT +CL_INVALID_DEVICE +CL_INVALID_DEVICE_PARTITION_COUNT +CL_INVALID_DEVICE_QUEUE +CL_INVALID_DEVICE_TYPE +CL_INVALID_EVENT +CL_INVALID_EVENT_WAIT_LIST +CL_INVALID_GLOBAL_OFFSET +CL_INVALID_GLOBAL_WORK_SIZE +CL_INVALID_GL_OBJECT +CL_INVALID_HOST_PTR +CL_INVALID_IMAGE_DESCRIPTOR +CL_INVALID_IMAGE_FORMAT_DESCRIPTOR +CL_INVALID_IMAGE_SIZE +CL_INVALID_KERNEL +CL_INVALID_KERNEL_ARGS +CL_INVALID_KERNEL_DEFINITION +CL_INVALID_KERNEL_NAME +CL_INVALID_LINKER_OPTIONS +CL_INVALID_MEM_OBJECT +CL_INVALID_MIP_LEVEL +CL_INVALID_OPERATION +CL_INVALID_PIPE_SIZE +CL_INVALID_PLATFORM +CL_INVALID_PROGRAM +CL_INVALID_PROGRAM_EXECUTABLE +CL_INVALID_PROPERTY +CL_INVALID_QUEUE_PROPERTIES +CL_INVALID_SAMPLER +CL_INVALID_VALUE +CL_INVALID_WORK_DIMENSION +CL_INVALID_WORK_GROUP_SIZE +CL_INVALID_WORK_ITEM_SIZE +CL_KERNEL_ARG_ACCESS_NONE +CL_KERNEL_ARG_ACCESS_QUALIFIER +CL_KERNEL_ARG_ACCESS_READ_ONLY +CL_KERNEL_ARG_ACCESS_READ_WRITE +CL_KERNEL_ARG_ACCESS_WRITE_ONLY +CL_KERNEL_ARG_ADDRESS_CONSTANT +CL_KERNEL_ARG_ADDRESS_GLOBAL +CL_KERNEL_ARG_ADDRESS_LOCAL +CL_KERNEL_ARG_ADDRESS_PRIVATE +CL_KERNEL_ARG_ADDRESS_QUALIFIER +CL_KERNEL_ARG_INFO_NOT_AVAILABLE +CL_KERNEL_ARG_NAME +CL_KERNEL_ARG_TYPE_CONST +CL_KERNEL_ARG_TYPE_NAME +CL_KERNEL_ARG_TYPE_NONE +CL_KERNEL_ARG_TYPE_PIPE +CL_KERNEL_ARG_TYPE_QUALIFIER +CL_KERNEL_ARG_TYPE_RESTRICT +CL_KERNEL_ARG_TYPE_VOLATILE +CL_KERNEL_ATTRIBUTES +CL_KERNEL_COMPILE_NUM_SUB_GROUPS +CL_KERNEL_COMPILE_WORK_GROUP_SIZE +CL_KERNEL_CONTEXT +CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM +CL_KERNEL_EXEC_INFO_SVM_PTRS +CL_KERNEL_FUNCTION_NAME +CL_KERNEL_GLOBAL_WORK_SIZE +CL_KERNEL_LOCAL_MEM_SIZE +CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT +CL_KERNEL_MAX_NUM_SUB_GROUPS +CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE +CL_KERNEL_NUM_ARGS +CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE +CL_KERNEL_PRIVATE_MEM_SIZE +CL_KERNEL_PROGRAM +CL_KERNEL_REFERENCE_COUNT +CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE +CL_KERNEL_WORK_GROUP_SIZE +CL_LINKER_NOT_AVAILABLE +CL_LINK_PROGRAM_FAILURE +CL_LOCAL +CL_LUMINANCE +CL_MAP_FAILURE +CL_MAP_READ +CL_MAP_WRITE +CL_MAP_WRITE_INVALIDATE_REGION +CL_MEM_ALLOC_HOST_PTR +CL_MEM_ASSOCIATED_MEMOBJECT +CL_MEM_CONTEXT +CL_MEM_COPY_HOST_PTR +CL_MEM_COPY_OVERLAP +CL_MEM_FLAGS +CL_MEM_HOST_NO_ACCESS +CL_MEM_HOST_PTR +CL_MEM_HOST_READ_ONLY +CL_MEM_HOST_WRITE_ONLY +CL_MEM_KERNEL_READ_AND_WRITE +CL_MEM_MAP_COUNT +CL_MEM_OBJECT_ALLOCATION_FAILURE +CL_MEM_OBJECT_BUFFER +CL_MEM_OBJECT_IMAGE1D +CL_MEM_OBJECT_IMAGE1D_ARRAY +CL_MEM_OBJECT_IMAGE1D_BUFFER +CL_MEM_OBJECT_IMAGE2D +CL_MEM_OBJECT_IMAGE2D_ARRAY +CL_MEM_OBJECT_IMAGE3D +CL_MEM_OBJECT_PIPE +CL_MEM_OFFSET +CL_MEM_READ_ONLY +CL_MEM_READ_WRITE +CL_MEM_REFERENCE_COUNT +CL_MEM_SIZE +CL_MEM_SVM_ATOMICS +CL_MEM_SVM_FINE_GRAIN_BUFFER +CL_MEM_TYPE +CL_MEM_USES_SVM_POINTER +CL_MEM_USE_HOST_PTR +CL_MEM_WRITE_ONLY +CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED +CL_MIGRATE_MEM_OBJECT_HOST +CL_MISALIGNED_SUB_BUFFER_OFFSET +CL_NONE +CL_NON_BLOCKING +CL_OUT_OF_HOST_MEMORY +CL_OUT_OF_RESOURCES +CL_PIPE_MAX_PACKETS +CL_PIPE_PACKET_SIZE +CL_PLATFORM_EXTENSIONS +CL_PLATFORM_HOST_TIMER_RESOLUTION +CL_PLATFORM_NAME +CL_PLATFORM_PROFILE +CL_PLATFORM_VENDOR +CL_PLATFORM_VERSION +CL_PROFILING_COMMAND_COMPLETE +CL_PROFILING_COMMAND_END +CL_PROFILING_COMMAND_QUEUED +CL_PROFILING_COMMAND_START +CL_PROFILING_COMMAND_SUBMIT +CL_PROFILING_INFO_NOT_AVAILABLE +CL_PROGRAM_BINARIES +CL_PROGRAM_BINARY_SIZES +CL_PROGRAM_BINARY_TYPE +CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT +CL_PROGRAM_BINARY_TYPE_EXECUTABLE +CL_PROGRAM_BINARY_TYPE_LIBRARY +CL_PROGRAM_BINARY_TYPE_NONE +CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE +CL_PROGRAM_BUILD_LOG +CL_PROGRAM_BUILD_OPTIONS +CL_PROGRAM_BUILD_STATUS +CL_PROGRAM_CONTEXT +CL_PROGRAM_DEVICES +CL_PROGRAM_IL +CL_PROGRAM_KERNEL_NAMES +CL_PROGRAM_NUM_DEVICES +CL_PROGRAM_NUM_KERNELS +CL_PROGRAM_REFERENCE_COUNT +CL_PROGRAM_SOURCE +CL_QUEUED +CL_QUEUE_CONTEXT +CL_QUEUE_DEVICE +CL_QUEUE_DEVICE_DEFAULT +CL_QUEUE_ON_DEVICE +CL_QUEUE_ON_DEVICE_DEFAULT +CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE +CL_QUEUE_PROFILING_ENABLE +CL_QUEUE_PROPERTIES +CL_QUEUE_REFERENCE_COUNT +CL_QUEUE_SIZE +CL_R +CL_RA +CL_READ_ONLY_CACHE +CL_READ_WRITE_CACHE +CL_RG +CL_RGB +CL_RGBA +CL_RGBx +CL_RGx +CL_RUNNING +CL_Rx +CL_SAMPLER_ADDRESSING_MODE +CL_SAMPLER_CONTEXT +CL_SAMPLER_FILTER_MODE +CL_SAMPLER_LOD_MAX +CL_SAMPLER_LOD_MIN +CL_SAMPLER_MIP_FILTER_MODE +CL_SAMPLER_NORMALIZED_COORDS +CL_SAMPLER_REFERENCE_COUNT +CL_SIGNED_INT16 +CL_SIGNED_INT32 +CL_SIGNED_INT8 +CL_SNORM_INT16 +CL_SNORM_INT8 +CL_SUBMITTED +CL_SUCCESS +CL_UNORM_INT16 +CL_UNORM_INT24 +CL_UNORM_INT8 +CL_UNORM_INT_101010 +CL_UNORM_INT_101010_2 +CL_UNORM_SHORT_555 +CL_UNORM_SHORT_565 +CL_UNSIGNED_INT16 +CL_UNSIGNED_INT32 +CL_UNSIGNED_INT8 +CL_VERSION_1_0 +CL_VERSION_1_1 +CL_VERSION_1_2 +CL_VERSION_2_0 +CL_VERSION_2_1 +CL_sBGRA +CL_sRGB +CL_sRGBA +CL_sRGBx + +---------------------------------------------------- + +[ + ["constant-opencl-host", "CL_A"], + ["constant-opencl-host", "CL_ABGR"], + ["constant-opencl-host", "CL_ADDRESS_CLAMP"], + ["constant-opencl-host", "CL_ADDRESS_CLAMP_TO_EDGE"], + ["constant-opencl-host", "CL_ADDRESS_MIRRORED_REPEAT"], + ["constant-opencl-host", "CL_ADDRESS_NONE"], + ["constant-opencl-host", "CL_ADDRESS_REPEAT"], + ["constant-opencl-host", "CL_ARGB"], + ["constant-opencl-host", "CL_BGRA"], + ["constant-opencl-host", "CL_BLOCKING"], + ["constant-opencl-host", "CL_BUFFER_CREATE_TYPE_REGION"], + ["constant-opencl-host", "CL_BUILD_ERROR"], + ["constant-opencl-host", "CL_BUILD_IN_PROGRESS"], + ["constant-opencl-host", "CL_BUILD_NONE"], + ["constant-opencl-host", "CL_BUILD_PROGRAM_FAILURE"], + ["constant-opencl-host", "CL_BUILD_SUCCESS"], + ["constant-opencl-host", "CL_COMMAND_ACQUIRE_GL_OBJECTS"], + ["constant-opencl-host", "CL_COMMAND_BARRIER"], + ["constant-opencl-host", "CL_COMMAND_COPY_BUFFER"], + ["constant-opencl-host", "CL_COMMAND_COPY_BUFFER_RECT"], + ["constant-opencl-host", "CL_COMMAND_COPY_BUFFER_TO_IMAGE"], + ["constant-opencl-host", "CL_COMMAND_COPY_IMAGE"], + ["constant-opencl-host", "CL_COMMAND_COPY_IMAGE_TO_BUFFER"], + ["constant-opencl-host", "CL_COMMAND_FILL_BUFFER"], + ["constant-opencl-host", "CL_COMMAND_FILL_IMAGE"], + ["constant-opencl-host", "CL_COMMAND_MAP_BUFFER"], + ["constant-opencl-host", "CL_COMMAND_MAP_IMAGE"], + ["constant-opencl-host", "CL_COMMAND_MARKER"], + ["constant-opencl-host", "CL_COMMAND_MIGRATE_MEM_OBJECTS"], + ["constant-opencl-host", "CL_COMMAND_MIGRATE_SVM_MEM_OBJECTS"], + ["constant-opencl-host", "CL_COMMAND_NATIVE_KERNEL"], + ["constant-opencl-host", "CL_COMMAND_NDRANGE_KERNEL"], + ["constant-opencl-host", "CL_COMMAND_READ_BUFFER"], + ["constant-opencl-host", "CL_COMMAND_READ_BUFFER_RECT"], + ["constant-opencl-host", "CL_COMMAND_READ_IMAGE"], + ["constant-opencl-host", "CL_COMMAND_RELEASE_GL_OBJECTS"], + ["constant-opencl-host", "CL_COMMAND_SVM_FREE"], + ["constant-opencl-host", "CL_COMMAND_SVM_MAP"], + ["constant-opencl-host", "CL_COMMAND_SVM_MEMCPY"], + ["constant-opencl-host", "CL_COMMAND_SVM_MEMFILL"], + ["constant-opencl-host", "CL_COMMAND_SVM_UNMAP"], + ["constant-opencl-host", "CL_COMMAND_TASK"], + ["constant-opencl-host", "CL_COMMAND_UNMAP_MEM_OBJECT"], + ["constant-opencl-host", "CL_COMMAND_USER"], + ["constant-opencl-host", "CL_COMMAND_WRITE_BUFFER"], + ["constant-opencl-host", "CL_COMMAND_WRITE_BUFFER_RECT"], + ["constant-opencl-host", "CL_COMMAND_WRITE_IMAGE"], + ["constant-opencl-host", "CL_COMPILER_NOT_AVAILABLE"], + ["constant-opencl-host", "CL_COMPILE_PROGRAM_FAILURE"], + ["constant-opencl-host", "CL_COMPLETE"], + ["constant-opencl-host", "CL_CONTEXT_DEVICES"], + ["constant-opencl-host", "CL_CONTEXT_INTEROP_USER_SYNC"], + ["constant-opencl-host", "CL_CONTEXT_NUM_DEVICES"], + ["constant-opencl-host", "CL_CONTEXT_PLATFORM"], + ["constant-opencl-host", "CL_CONTEXT_PROPERTIES"], + ["constant-opencl-host", "CL_CONTEXT_REFERENCE_COUNT"], + ["constant-opencl-host", "CL_DEPTH"], + ["constant-opencl-host", "CL_DEPTH_STENCIL"], + ["constant-opencl-host", "CL_DEVICE_ADDRESS_BITS"], + ["constant-opencl-host", "CL_DEVICE_AFFINITY_DOMAIN_L1_CACHE"], + ["constant-opencl-host", "CL_DEVICE_AFFINITY_DOMAIN_L2_CACHE"], + ["constant-opencl-host", "CL_DEVICE_AFFINITY_DOMAIN_L3_CACHE"], + ["constant-opencl-host", "CL_DEVICE_AFFINITY_DOMAIN_L4_CACHE"], + ["constant-opencl-host", "CL_DEVICE_AFFINITY_DOMAIN_NEXT_PARTITIONABLE"], + ["constant-opencl-host", "CL_DEVICE_AFFINITY_DOMAIN_NUMA"], + ["constant-opencl-host", "CL_DEVICE_AVAILABLE"], + ["constant-opencl-host", "CL_DEVICE_BUILT_IN_KERNELS"], + ["constant-opencl-host", "CL_DEVICE_COMPILER_AVAILABLE"], + ["constant-opencl-host", "CL_DEVICE_DOUBLE_FP_CONFIG"], + ["constant-opencl-host", "CL_DEVICE_ENDIAN_LITTLE"], + ["constant-opencl-host", "CL_DEVICE_ERROR_CORRECTION_SUPPORT"], + ["constant-opencl-host", "CL_DEVICE_EXECUTION_CAPABILITIES"], + ["constant-opencl-host", "CL_DEVICE_EXTENSIONS"], + ["constant-opencl-host", "CL_DEVICE_GLOBAL_MEM_CACHELINE_SIZE"], + ["constant-opencl-host", "CL_DEVICE_GLOBAL_MEM_CACHE_SIZE"], + ["constant-opencl-host", "CL_DEVICE_GLOBAL_MEM_CACHE_TYPE"], + ["constant-opencl-host", "CL_DEVICE_GLOBAL_MEM_SIZE"], + ["constant-opencl-host", "CL_DEVICE_GLOBAL_VARIABLE_PREFERRED_TOTAL_SIZE"], + ["constant-opencl-host", "CL_DEVICE_HOST_UNIFIED_MEMORY"], + ["constant-opencl-host", "CL_DEVICE_IL_VERSION"], + ["constant-opencl-host", "CL_DEVICE_IMAGE2D_MAX_HEIGHT"], + ["constant-opencl-host", "CL_DEVICE_IMAGE2D_MAX_WIDTH"], + ["constant-opencl-host", "CL_DEVICE_IMAGE3D_MAX_DEPTH"], + ["constant-opencl-host", "CL_DEVICE_IMAGE3D_MAX_HEIGHT"], + ["constant-opencl-host", "CL_DEVICE_IMAGE3D_MAX_WIDTH"], + ["constant-opencl-host", "CL_DEVICE_IMAGE_BASE_ADDRESS_ALIGNMENT"], + ["constant-opencl-host", "CL_DEVICE_IMAGE_MAX_ARRAY_SIZE"], + ["constant-opencl-host", "CL_DEVICE_IMAGE_MAX_BUFFER_SIZE"], + ["constant-opencl-host", "CL_DEVICE_IMAGE_PITCH_ALIGNMENT"], + ["constant-opencl-host", "CL_DEVICE_IMAGE_SUPPORT"], + ["constant-opencl-host", "CL_DEVICE_LINKER_AVAILABLE"], + ["constant-opencl-host", "CL_DEVICE_LOCAL_MEM_SIZE"], + ["constant-opencl-host", "CL_DEVICE_LOCAL_MEM_TYPE"], + ["constant-opencl-host", "CL_DEVICE_MAX_CLOCK_FREQUENCY"], + ["constant-opencl-host", "CL_DEVICE_MAX_COMPUTE_UNITS"], + ["constant-opencl-host", "CL_DEVICE_MAX_CONSTANT_ARGS"], + ["constant-opencl-host", "CL_DEVICE_MAX_CONSTANT_BUFFER_SIZE"], + ["constant-opencl-host", "CL_DEVICE_MAX_GLOBAL_VARIABLE_SIZE"], + ["constant-opencl-host", "CL_DEVICE_MAX_MEM_ALLOC_SIZE"], + ["constant-opencl-host", "CL_DEVICE_MAX_NUM_SUB_GROUPS"], + ["constant-opencl-host", "CL_DEVICE_MAX_ON_DEVICE_EVENTS"], + ["constant-opencl-host", "CL_DEVICE_MAX_ON_DEVICE_QUEUES"], + ["constant-opencl-host", "CL_DEVICE_MAX_PARAMETER_SIZE"], + ["constant-opencl-host", "CL_DEVICE_MAX_PIPE_ARGS"], + ["constant-opencl-host", "CL_DEVICE_MAX_READ_IMAGE_ARGS"], + ["constant-opencl-host", "CL_DEVICE_MAX_READ_WRITE_IMAGE_ARGS"], + ["constant-opencl-host", "CL_DEVICE_MAX_SAMPLERS"], + ["constant-opencl-host", "CL_DEVICE_MAX_WORK_GROUP_SIZE"], + ["constant-opencl-host", "CL_DEVICE_MAX_WORK_ITEM_DIMENSIONS"], + ["constant-opencl-host", "CL_DEVICE_MAX_WORK_ITEM_SIZES"], + ["constant-opencl-host", "CL_DEVICE_MAX_WRITE_IMAGE_ARGS"], + ["constant-opencl-host", "CL_DEVICE_MEM_BASE_ADDR_ALIGN"], + ["constant-opencl-host", "CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE"], + ["constant-opencl-host", "CL_DEVICE_NAME"], + ["constant-opencl-host", "CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR"], + ["constant-opencl-host", "CL_DEVICE_NATIVE_VECTOR_WIDTH_DOUBLE"], + ["constant-opencl-host", "CL_DEVICE_NATIVE_VECTOR_WIDTH_FLOAT"], + ["constant-opencl-host", "CL_DEVICE_NATIVE_VECTOR_WIDTH_HALF"], + ["constant-opencl-host", "CL_DEVICE_NATIVE_VECTOR_WIDTH_INT"], + ["constant-opencl-host", "CL_DEVICE_NATIVE_VECTOR_WIDTH_LONG"], + ["constant-opencl-host", "CL_DEVICE_NATIVE_VECTOR_WIDTH_SHORT"], + ["constant-opencl-host", "CL_DEVICE_NOT_AVAILABLE"], + ["constant-opencl-host", "CL_DEVICE_NOT_FOUND"], + ["constant-opencl-host", "CL_DEVICE_OPENCL_C_VERSION"], + ["constant-opencl-host", "CL_DEVICE_PARENT_DEVICE"], + ["constant-opencl-host", "CL_DEVICE_PARTITION_AFFINITY_DOMAIN"], + ["constant-opencl-host", "CL_DEVICE_PARTITION_BY_AFFINITY_DOMAIN"], + ["constant-opencl-host", "CL_DEVICE_PARTITION_BY_COUNTS"], + ["constant-opencl-host", "CL_DEVICE_PARTITION_BY_COUNTS_LIST_END"], + ["constant-opencl-host", "CL_DEVICE_PARTITION_EQUALLY"], + ["constant-opencl-host", "CL_DEVICE_PARTITION_FAILED"], + ["constant-opencl-host", "CL_DEVICE_PARTITION_MAX_SUB_DEVICES"], + ["constant-opencl-host", "CL_DEVICE_PARTITION_PROPERTIES"], + ["constant-opencl-host", "CL_DEVICE_PARTITION_TYPE"], + ["constant-opencl-host", "CL_DEVICE_PIPE_MAX_ACTIVE_RESERVATIONS"], + ["constant-opencl-host", "CL_DEVICE_PIPE_MAX_PACKET_SIZE"], + ["constant-opencl-host", "CL_DEVICE_PLATFORM"], + ["constant-opencl-host", "CL_DEVICE_PREFERRED_GLOBAL_ATOMIC_ALIGNMENT"], + ["constant-opencl-host", "CL_DEVICE_PREFERRED_INTEROP_USER_SYNC"], + ["constant-opencl-host", "CL_DEVICE_PREFERRED_LOCAL_ATOMIC_ALIGNMENT"], + ["constant-opencl-host", "CL_DEVICE_PREFERRED_PLATFORM_ATOMIC_ALIGNMENT"], + ["constant-opencl-host", "CL_DEVICE_PREFERRED_VECTOR_WIDTH_CHAR"], + ["constant-opencl-host", "CL_DEVICE_PREFERRED_VECTOR_WIDTH_DOUBLE"], + ["constant-opencl-host", "CL_DEVICE_PREFERRED_VECTOR_WIDTH_FLOAT"], + ["constant-opencl-host", "CL_DEVICE_PREFERRED_VECTOR_WIDTH_HALF"], + ["constant-opencl-host", "CL_DEVICE_PREFERRED_VECTOR_WIDTH_INT"], + ["constant-opencl-host", "CL_DEVICE_PREFERRED_VECTOR_WIDTH_LONG"], + ["constant-opencl-host", "CL_DEVICE_PREFERRED_VECTOR_WIDTH_SHORT"], + ["constant-opencl-host", "CL_DEVICE_PRINTF_BUFFER_SIZE"], + ["constant-opencl-host", "CL_DEVICE_PROFILE"], + ["constant-opencl-host", "CL_DEVICE_PROFILING_TIMER_RESOLUTION"], + ["constant-opencl-host", "CL_DEVICE_QUEUE_ON_DEVICE_MAX_SIZE"], + ["constant-opencl-host", "CL_DEVICE_QUEUE_ON_DEVICE_PREFERRED_SIZE"], + ["constant-opencl-host", "CL_DEVICE_QUEUE_ON_DEVICE_PROPERTIES"], + ["constant-opencl-host", "CL_DEVICE_QUEUE_ON_HOST_PROPERTIES"], + ["constant-opencl-host", "CL_DEVICE_QUEUE_PROPERTIES"], + ["constant-opencl-host", "CL_DEVICE_REFERENCE_COUNT"], + ["constant-opencl-host", "CL_DEVICE_SINGLE_FP_CONFIG"], + ["constant-opencl-host", "CL_DEVICE_SUB_GROUP_INDEPENDENT_FORWARD_PROGRESS"], + ["constant-opencl-host", "CL_DEVICE_SVM_ATOMICS"], + ["constant-opencl-host", "CL_DEVICE_SVM_CAPABILITIES"], + ["constant-opencl-host", "CL_DEVICE_SVM_COARSE_GRAIN_BUFFER"], + ["constant-opencl-host", "CL_DEVICE_SVM_FINE_GRAIN_BUFFER"], + ["constant-opencl-host", "CL_DEVICE_SVM_FINE_GRAIN_SYSTEM"], + ["constant-opencl-host", "CL_DEVICE_TYPE"], + ["constant-opencl-host", "CL_DEVICE_TYPE_ACCELERATOR"], + ["constant-opencl-host", "CL_DEVICE_TYPE_ALL"], + ["constant-opencl-host", "CL_DEVICE_TYPE_CPU"], + ["constant-opencl-host", "CL_DEVICE_TYPE_CUSTOM"], + ["constant-opencl-host", "CL_DEVICE_TYPE_DEFAULT"], + ["constant-opencl-host", "CL_DEVICE_TYPE_GPU"], + ["constant-opencl-host", "CL_DEVICE_VENDOR"], + ["constant-opencl-host", "CL_DEVICE_VENDOR_ID"], + ["constant-opencl-host", "CL_DEVICE_VERSION"], + ["constant-opencl-host", "CL_DRIVER_VERSION"], + ["constant-opencl-host", "CL_EVENT_COMMAND_EXECUTION_STATUS"], + ["constant-opencl-host", "CL_EVENT_COMMAND_QUEUE"], + ["constant-opencl-host", "CL_EVENT_COMMAND_TYPE"], + ["constant-opencl-host", "CL_EVENT_CONTEXT"], + ["constant-opencl-host", "CL_EVENT_REFERENCE_COUNT"], + ["constant-opencl-host", "CL_EXEC_KERNEL"], + ["constant-opencl-host", "CL_EXEC_NATIVE_KERNEL"], + ["constant-opencl-host", "CL_EXEC_STATUS_ERROR_FOR_EVENTS_IN_WAIT_LIST"], + ["constant-opencl-host", "CL_FILTER_LINEAR"], + ["constant-opencl-host", "CL_FILTER_NEAREST"], + ["constant-opencl-host", "CL_FLOAT"], + ["constant-opencl-host", "CL_FP_CORRECTLY_ROUNDED_DIVIDE_SQRT"], + ["constant-opencl-host", "CL_FP_DENORM"], + ["constant-opencl-host", "CL_FP_FMA"], + ["constant-opencl-host", "CL_FP_INF_NAN"], + ["constant-opencl-host", "CL_FP_ROUND_TO_INF"], + ["constant-opencl-host", "CL_FP_ROUND_TO_NEAREST"], + ["constant-opencl-host", "CL_FP_ROUND_TO_ZERO"], + ["constant-opencl-host", "CL_FP_SOFT_FLOAT"], + ["constant-opencl-host", "CL_GLOBAL"], + ["constant-opencl-host", "CL_HALF_FLOAT"], + ["constant-opencl-host", "CL_IMAGE_ARRAY_SIZE"], + ["constant-opencl-host", "CL_IMAGE_BUFFER"], + ["constant-opencl-host", "CL_IMAGE_DEPTH"], + ["constant-opencl-host", "CL_IMAGE_ELEMENT_SIZE"], + ["constant-opencl-host", "CL_IMAGE_FORMAT"], + ["constant-opencl-host", "CL_IMAGE_FORMAT_MISMATCH"], + ["constant-opencl-host", "CL_IMAGE_FORMAT_NOT_SUPPORTED"], + ["constant-opencl-host", "CL_IMAGE_HEIGHT"], + ["constant-opencl-host", "CL_IMAGE_NUM_MIP_LEVELS"], + ["constant-opencl-host", "CL_IMAGE_NUM_SAMPLES"], + ["constant-opencl-host", "CL_IMAGE_ROW_PITCH"], + ["constant-opencl-host", "CL_IMAGE_SLICE_PITCH"], + ["constant-opencl-host", "CL_IMAGE_WIDTH"], + ["constant-opencl-host", "CL_INTENSITY"], + ["constant-opencl-host", "CL_INVALID_ARG_INDEX"], + ["constant-opencl-host", "CL_INVALID_ARG_SIZE"], + ["constant-opencl-host", "CL_INVALID_ARG_VALUE"], + ["constant-opencl-host", "CL_INVALID_BINARY"], + ["constant-opencl-host", "CL_INVALID_BUFFER_SIZE"], + ["constant-opencl-host", "CL_INVALID_BUILD_OPTIONS"], + ["constant-opencl-host", "CL_INVALID_COMMAND_QUEUE"], + ["constant-opencl-host", "CL_INVALID_COMPILER_OPTIONS"], + ["constant-opencl-host", "CL_INVALID_CONTEXT"], + ["constant-opencl-host", "CL_INVALID_DEVICE"], + ["constant-opencl-host", "CL_INVALID_DEVICE_PARTITION_COUNT"], + ["constant-opencl-host", "CL_INVALID_DEVICE_QUEUE"], + ["constant-opencl-host", "CL_INVALID_DEVICE_TYPE"], + ["constant-opencl-host", "CL_INVALID_EVENT"], + ["constant-opencl-host", "CL_INVALID_EVENT_WAIT_LIST"], + ["constant-opencl-host", "CL_INVALID_GLOBAL_OFFSET"], + ["constant-opencl-host", "CL_INVALID_GLOBAL_WORK_SIZE"], + ["constant-opencl-host", "CL_INVALID_GL_OBJECT"], + ["constant-opencl-host", "CL_INVALID_HOST_PTR"], + ["constant-opencl-host", "CL_INVALID_IMAGE_DESCRIPTOR"], + ["constant-opencl-host", "CL_INVALID_IMAGE_FORMAT_DESCRIPTOR"], + ["constant-opencl-host", "CL_INVALID_IMAGE_SIZE"], + ["constant-opencl-host", "CL_INVALID_KERNEL"], + ["constant-opencl-host", "CL_INVALID_KERNEL_ARGS"], + ["constant-opencl-host", "CL_INVALID_KERNEL_DEFINITION"], + ["constant-opencl-host", "CL_INVALID_KERNEL_NAME"], + ["constant-opencl-host", "CL_INVALID_LINKER_OPTIONS"], + ["constant-opencl-host", "CL_INVALID_MEM_OBJECT"], + ["constant-opencl-host", "CL_INVALID_MIP_LEVEL"], + ["constant-opencl-host", "CL_INVALID_OPERATION"], + ["constant-opencl-host", "CL_INVALID_PIPE_SIZE"], + ["constant-opencl-host", "CL_INVALID_PLATFORM"], + ["constant-opencl-host", "CL_INVALID_PROGRAM"], + ["constant-opencl-host", "CL_INVALID_PROGRAM_EXECUTABLE"], + ["constant-opencl-host", "CL_INVALID_PROPERTY"], + ["constant-opencl-host", "CL_INVALID_QUEUE_PROPERTIES"], + ["constant-opencl-host", "CL_INVALID_SAMPLER"], + ["constant-opencl-host", "CL_INVALID_VALUE"], + ["constant-opencl-host", "CL_INVALID_WORK_DIMENSION"], + ["constant-opencl-host", "CL_INVALID_WORK_GROUP_SIZE"], + ["constant-opencl-host", "CL_INVALID_WORK_ITEM_SIZE"], + ["constant-opencl-host", "CL_KERNEL_ARG_ACCESS_NONE"], + ["constant-opencl-host", "CL_KERNEL_ARG_ACCESS_QUALIFIER"], + ["constant-opencl-host", "CL_KERNEL_ARG_ACCESS_READ_ONLY"], + ["constant-opencl-host", "CL_KERNEL_ARG_ACCESS_READ_WRITE"], + ["constant-opencl-host", "CL_KERNEL_ARG_ACCESS_WRITE_ONLY"], + ["constant-opencl-host", "CL_KERNEL_ARG_ADDRESS_CONSTANT"], + ["constant-opencl-host", "CL_KERNEL_ARG_ADDRESS_GLOBAL"], + ["constant-opencl-host", "CL_KERNEL_ARG_ADDRESS_LOCAL"], + ["constant-opencl-host", "CL_KERNEL_ARG_ADDRESS_PRIVATE"], + ["constant-opencl-host", "CL_KERNEL_ARG_ADDRESS_QUALIFIER"], + ["constant-opencl-host", "CL_KERNEL_ARG_INFO_NOT_AVAILABLE"], + ["constant-opencl-host", "CL_KERNEL_ARG_NAME"], + ["constant-opencl-host", "CL_KERNEL_ARG_TYPE_CONST"], + ["constant-opencl-host", "CL_KERNEL_ARG_TYPE_NAME"], + ["constant-opencl-host", "CL_KERNEL_ARG_TYPE_NONE"], + ["constant-opencl-host", "CL_KERNEL_ARG_TYPE_PIPE"], + ["constant-opencl-host", "CL_KERNEL_ARG_TYPE_QUALIFIER"], + ["constant-opencl-host", "CL_KERNEL_ARG_TYPE_RESTRICT"], + ["constant-opencl-host", "CL_KERNEL_ARG_TYPE_VOLATILE"], + ["constant-opencl-host", "CL_KERNEL_ATTRIBUTES"], + ["constant-opencl-host", "CL_KERNEL_COMPILE_NUM_SUB_GROUPS"], + ["constant-opencl-host", "CL_KERNEL_COMPILE_WORK_GROUP_SIZE"], + ["constant-opencl-host", "CL_KERNEL_CONTEXT"], + ["constant-opencl-host", "CL_KERNEL_EXEC_INFO_SVM_FINE_GRAIN_SYSTEM"], + ["constant-opencl-host", "CL_KERNEL_EXEC_INFO_SVM_PTRS"], + ["constant-opencl-host", "CL_KERNEL_FUNCTION_NAME"], + ["constant-opencl-host", "CL_KERNEL_GLOBAL_WORK_SIZE"], + ["constant-opencl-host", "CL_KERNEL_LOCAL_MEM_SIZE"], + ["constant-opencl-host", "CL_KERNEL_LOCAL_SIZE_FOR_SUB_GROUP_COUNT"], + ["constant-opencl-host", "CL_KERNEL_MAX_NUM_SUB_GROUPS"], + ["constant-opencl-host", "CL_KERNEL_MAX_SUB_GROUP_SIZE_FOR_NDRANGE"], + ["constant-opencl-host", "CL_KERNEL_NUM_ARGS"], + ["constant-opencl-host", "CL_KERNEL_PREFERRED_WORK_GROUP_SIZE_MULTIPLE"], + ["constant-opencl-host", "CL_KERNEL_PRIVATE_MEM_SIZE"], + ["constant-opencl-host", "CL_KERNEL_PROGRAM"], + ["constant-opencl-host", "CL_KERNEL_REFERENCE_COUNT"], + ["constant-opencl-host", "CL_KERNEL_SUB_GROUP_COUNT_FOR_NDRANGE"], + ["constant-opencl-host", "CL_KERNEL_WORK_GROUP_SIZE"], + ["constant-opencl-host", "CL_LINKER_NOT_AVAILABLE"], + ["constant-opencl-host", "CL_LINK_PROGRAM_FAILURE"], + ["constant-opencl-host", "CL_LOCAL"], + ["constant-opencl-host", "CL_LUMINANCE"], + ["constant-opencl-host", "CL_MAP_FAILURE"], + ["constant-opencl-host", "CL_MAP_READ"], + ["constant-opencl-host", "CL_MAP_WRITE"], + ["constant-opencl-host", "CL_MAP_WRITE_INVALIDATE_REGION"], + ["constant-opencl-host", "CL_MEM_ALLOC_HOST_PTR"], + ["constant-opencl-host", "CL_MEM_ASSOCIATED_MEMOBJECT"], + ["constant-opencl-host", "CL_MEM_CONTEXT"], + ["constant-opencl-host", "CL_MEM_COPY_HOST_PTR"], + ["constant-opencl-host", "CL_MEM_COPY_OVERLAP"], + ["constant-opencl-host", "CL_MEM_FLAGS"], + ["constant-opencl-host", "CL_MEM_HOST_NO_ACCESS"], + ["constant-opencl-host", "CL_MEM_HOST_PTR"], + ["constant-opencl-host", "CL_MEM_HOST_READ_ONLY"], + ["constant-opencl-host", "CL_MEM_HOST_WRITE_ONLY"], + ["constant-opencl-host", "CL_MEM_KERNEL_READ_AND_WRITE"], + ["constant-opencl-host", "CL_MEM_MAP_COUNT"], + ["constant-opencl-host", "CL_MEM_OBJECT_ALLOCATION_FAILURE"], + ["constant-opencl-host", "CL_MEM_OBJECT_BUFFER"], + ["constant-opencl-host", "CL_MEM_OBJECT_IMAGE1D"], + ["constant-opencl-host", "CL_MEM_OBJECT_IMAGE1D_ARRAY"], + ["constant-opencl-host", "CL_MEM_OBJECT_IMAGE1D_BUFFER"], + ["constant-opencl-host", "CL_MEM_OBJECT_IMAGE2D"], + ["constant-opencl-host", "CL_MEM_OBJECT_IMAGE2D_ARRAY"], + ["constant-opencl-host", "CL_MEM_OBJECT_IMAGE3D"], + ["constant-opencl-host", "CL_MEM_OBJECT_PIPE"], + ["constant-opencl-host", "CL_MEM_OFFSET"], + ["constant-opencl-host", "CL_MEM_READ_ONLY"], + ["constant-opencl-host", "CL_MEM_READ_WRITE"], + ["constant-opencl-host", "CL_MEM_REFERENCE_COUNT"], + ["constant-opencl-host", "CL_MEM_SIZE"], + ["constant-opencl-host", "CL_MEM_SVM_ATOMICS"], + ["constant-opencl-host", "CL_MEM_SVM_FINE_GRAIN_BUFFER"], + ["constant-opencl-host", "CL_MEM_TYPE"], + ["constant-opencl-host", "CL_MEM_USES_SVM_POINTER"], + ["constant-opencl-host", "CL_MEM_USE_HOST_PTR"], + ["constant-opencl-host", "CL_MEM_WRITE_ONLY"], + ["constant-opencl-host", "CL_MIGRATE_MEM_OBJECT_CONTENT_UNDEFINED"], + ["constant-opencl-host", "CL_MIGRATE_MEM_OBJECT_HOST"], + ["constant-opencl-host", "CL_MISALIGNED_SUB_BUFFER_OFFSET"], + ["constant-opencl-host", "CL_NONE"], + ["constant-opencl-host", "CL_NON_BLOCKING"], + ["constant-opencl-host", "CL_OUT_OF_HOST_MEMORY"], + ["constant-opencl-host", "CL_OUT_OF_RESOURCES"], + ["constant-opencl-host", "CL_PIPE_MAX_PACKETS"], + ["constant-opencl-host", "CL_PIPE_PACKET_SIZE"], + ["constant-opencl-host", "CL_PLATFORM_EXTENSIONS"], + ["constant-opencl-host", "CL_PLATFORM_HOST_TIMER_RESOLUTION"], + ["constant-opencl-host", "CL_PLATFORM_NAME"], + ["constant-opencl-host", "CL_PLATFORM_PROFILE"], + ["constant-opencl-host", "CL_PLATFORM_VENDOR"], + ["constant-opencl-host", "CL_PLATFORM_VERSION"], + ["constant-opencl-host", "CL_PROFILING_COMMAND_COMPLETE"], + ["constant-opencl-host", "CL_PROFILING_COMMAND_END"], + ["constant-opencl-host", "CL_PROFILING_COMMAND_QUEUED"], + ["constant-opencl-host", "CL_PROFILING_COMMAND_START"], + ["constant-opencl-host", "CL_PROFILING_COMMAND_SUBMIT"], + ["constant-opencl-host", "CL_PROFILING_INFO_NOT_AVAILABLE"], + ["constant-opencl-host", "CL_PROGRAM_BINARIES"], + ["constant-opencl-host", "CL_PROGRAM_BINARY_SIZES"], + ["constant-opencl-host", "CL_PROGRAM_BINARY_TYPE"], + ["constant-opencl-host", "CL_PROGRAM_BINARY_TYPE_COMPILED_OBJECT"], + ["constant-opencl-host", "CL_PROGRAM_BINARY_TYPE_EXECUTABLE"], + ["constant-opencl-host", "CL_PROGRAM_BINARY_TYPE_LIBRARY"], + ["constant-opencl-host", "CL_PROGRAM_BINARY_TYPE_NONE"], + ["constant-opencl-host", "CL_PROGRAM_BUILD_GLOBAL_VARIABLE_TOTAL_SIZE"], + ["constant-opencl-host", "CL_PROGRAM_BUILD_LOG"], + ["constant-opencl-host", "CL_PROGRAM_BUILD_OPTIONS"], + ["constant-opencl-host", "CL_PROGRAM_BUILD_STATUS"], + ["constant-opencl-host", "CL_PROGRAM_CONTEXT"], + ["constant-opencl-host", "CL_PROGRAM_DEVICES"], + ["constant-opencl-host", "CL_PROGRAM_IL"], + ["constant-opencl-host", "CL_PROGRAM_KERNEL_NAMES"], + ["constant-opencl-host", "CL_PROGRAM_NUM_DEVICES"], + ["constant-opencl-host", "CL_PROGRAM_NUM_KERNELS"], + ["constant-opencl-host", "CL_PROGRAM_REFERENCE_COUNT"], + ["constant-opencl-host", "CL_PROGRAM_SOURCE"], + ["constant-opencl-host", "CL_QUEUED"], + ["constant-opencl-host", "CL_QUEUE_CONTEXT"], + ["constant-opencl-host", "CL_QUEUE_DEVICE"], + ["constant-opencl-host", "CL_QUEUE_DEVICE_DEFAULT"], + ["constant-opencl-host", "CL_QUEUE_ON_DEVICE"], + ["constant-opencl-host", "CL_QUEUE_ON_DEVICE_DEFAULT"], + ["constant-opencl-host", "CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE"], + ["constant-opencl-host", "CL_QUEUE_PROFILING_ENABLE"], + ["constant-opencl-host", "CL_QUEUE_PROPERTIES"], + ["constant-opencl-host", "CL_QUEUE_REFERENCE_COUNT"], + ["constant-opencl-host", "CL_QUEUE_SIZE"], + ["constant-opencl-host", "CL_R"], + ["constant-opencl-host", "CL_RA"], + ["constant-opencl-host", "CL_READ_ONLY_CACHE"], + ["constant-opencl-host", "CL_READ_WRITE_CACHE"], + ["constant-opencl-host", "CL_RG"], + ["constant-opencl-host", "CL_RGB"], + ["constant-opencl-host", "CL_RGBA"], + ["constant-opencl-host", "CL_RGBx"], + ["constant-opencl-host", "CL_RGx"], + ["constant-opencl-host", "CL_RUNNING"], + ["constant-opencl-host", "CL_Rx"], + ["constant-opencl-host", "CL_SAMPLER_ADDRESSING_MODE"], + ["constant-opencl-host", "CL_SAMPLER_CONTEXT"], + ["constant-opencl-host", "CL_SAMPLER_FILTER_MODE"], + ["constant-opencl-host", "CL_SAMPLER_LOD_MAX"], + ["constant-opencl-host", "CL_SAMPLER_LOD_MIN"], + ["constant-opencl-host", "CL_SAMPLER_MIP_FILTER_MODE"], + ["constant-opencl-host", "CL_SAMPLER_NORMALIZED_COORDS"], + ["constant-opencl-host", "CL_SAMPLER_REFERENCE_COUNT"], + ["constant-opencl-host", "CL_SIGNED_INT16"], + ["constant-opencl-host", "CL_SIGNED_INT32"], + ["constant-opencl-host", "CL_SIGNED_INT8"], + ["constant-opencl-host", "CL_SNORM_INT16"], + ["constant-opencl-host", "CL_SNORM_INT8"], + ["constant-opencl-host", "CL_SUBMITTED"], + ["constant-opencl-host", "CL_SUCCESS"], + ["constant-opencl-host", "CL_UNORM_INT16"], + ["constant-opencl-host", "CL_UNORM_INT24"], + ["constant-opencl-host", "CL_UNORM_INT8"], + ["constant-opencl-host", "CL_UNORM_INT_101010"], + ["constant-opencl-host", "CL_UNORM_INT_101010_2"], + ["constant-opencl-host", "CL_UNORM_SHORT_555"], + ["constant-opencl-host", "CL_UNORM_SHORT_565"], + ["constant-opencl-host", "CL_UNSIGNED_INT16"], + ["constant-opencl-host", "CL_UNSIGNED_INT32"], + ["constant-opencl-host", "CL_UNSIGNED_INT8"], + ["constant-opencl-host", "CL_VERSION_1_0"], + ["constant-opencl-host", "CL_VERSION_1_1"], + ["constant-opencl-host", "CL_VERSION_1_2"], + ["constant-opencl-host", "CL_VERSION_2_0"], + ["constant-opencl-host", "CL_VERSION_2_1"], + ["constant-opencl-host", "CL_sBGRA"], + ["constant-opencl-host", "CL_sRGB"], + ["constant-opencl-host", "CL_sRGBA"], + ["constant-opencl-host", "CL_sRGBx"] +] + +---------------------------------------------------- + +Checks for all constants in OpenCL host code (C-API). \ No newline at end of file diff --git a/package/src/prism/tests/languages/opencl+c/function_feature.test b/package/src/prism/tests/languages/opencl+c/function_feature.test new file mode 100644 index 00000000..36a85b29 --- /dev/null +++ b/package/src/prism/tests/languages/opencl+c/function_feature.test @@ -0,0 +1,227 @@ +clBuildProgram +clCloneKernel +clCompileProgram +clCreateBuffer +clCreateCommandQueue +clCreateCommandQueueWithProperties +clCreateContext +clCreateContextFromType +clCreateImage +clCreateImage2D +clCreateImage3D +clCreateKernel +clCreateKernelsInProgram +clCreatePipe +clCreateProgramWithBinary +clCreateProgramWithBuiltInKernels +clCreateProgramWithIL +clCreateProgramWithSource +clCreateSampler +clCreateSamplerWithProperties +clCreateSubBuffer +clCreateSubDevices +clCreateUserEvent +clEnqueueBarrier +clEnqueueBarrierWithWaitList +clEnqueueCopyBuffer +clEnqueueCopyBufferRect +clEnqueueCopyBufferToImage +clEnqueueCopyImage +clEnqueueCopyImageToBuffer +clEnqueueFillBuffer +clEnqueueFillImage +clEnqueueMapBuffer +clEnqueueMapImage +clEnqueueMarker +clEnqueueMarkerWithWaitList +clEnqueueMigrateMemObjects +clEnqueueNDRangeKernel +clEnqueueNativeKernel +clEnqueueReadBuffer +clEnqueueReadBufferRect +clEnqueueReadImage +clEnqueueSVMFree +clEnqueueSVMMap +clEnqueueSVMMemFill +clEnqueueSVMMemcpy +clEnqueueSVMMigrateMem +clEnqueueSVMUnmap +clEnqueueTask +clEnqueueUnmapMemObject +clEnqueueWaitForEvents +clEnqueueWriteBuffer +clEnqueueWriteBufferRect +clEnqueueWriteImage +clFinish +clFlush +clGetCommandQueueInfo +clGetContextInfo +clGetDeviceAndHostTimer +clGetDeviceIDs +clGetDeviceInfo +clGetEventInfo +clGetEventProfilingInfo +clGetExtensionFunctionAddress +clGetExtensionFunctionAddressForPlatform +clGetHostTimer +clGetImageInfo +clGetKernelArgInfo +clGetKernelInfo +clGetKernelSubGroupInfo +clGetKernelWorkGroupInfo +clGetMemObjectInfo +clGetPipeInfo +clGetPlatformIDs +clGetPlatformInfo +clGetProgramBuildInfo +clGetProgramInfo +clGetSamplerInfo +clGetSupportedImageFormats +clLinkProgram +clReleaseCommandQueue +clReleaseContext +clReleaseDevice +clReleaseEvent +clReleaseKernel +clReleaseMemObject +clReleaseProgram +clReleaseSampler +clRetainCommandQueue +clRetainContext +clRetainDevice +clRetainEvent +clRetainKernel +clRetainMemObject +clRetainProgram +clRetainSampler +clSVMAlloc +clSVMFree +clSetCommandQueueProperty +clSetDefaultDeviceCommandQueue +clSetEventCallback +clSetKernelArg +clSetKernelArgSVMPointer +clSetKernelExecInfo +clSetMemObjectDestructorCallback +clSetUserEventStatus +clUnloadCompiler +clUnloadPlatformCompiler +clWaitForEvents + +---------------------------------------------------- + +[ + ["function-opencl-host", "clBuildProgram"], + ["function-opencl-host", "clCloneKernel"], + ["function-opencl-host", "clCompileProgram"], + ["function-opencl-host", "clCreateBuffer"], + ["function-opencl-host", "clCreateCommandQueue"], + ["function-opencl-host", "clCreateCommandQueueWithProperties"], + ["function-opencl-host", "clCreateContext"], + ["function-opencl-host", "clCreateContextFromType"], + ["function-opencl-host", "clCreateImage"], + ["function-opencl-host", "clCreateImage2D"], + ["function-opencl-host", "clCreateImage3D"], + ["function-opencl-host", "clCreateKernel"], + ["function-opencl-host", "clCreateKernelsInProgram"], + ["function-opencl-host", "clCreatePipe"], + ["function-opencl-host", "clCreateProgramWithBinary"], + ["function-opencl-host", "clCreateProgramWithBuiltInKernels"], + ["function-opencl-host", "clCreateProgramWithIL"], + ["function-opencl-host", "clCreateProgramWithSource"], + ["function-opencl-host", "clCreateSampler"], + ["function-opencl-host", "clCreateSamplerWithProperties"], + ["function-opencl-host", "clCreateSubBuffer"], + ["function-opencl-host", "clCreateSubDevices"], + ["function-opencl-host", "clCreateUserEvent"], + ["function-opencl-host", "clEnqueueBarrier"], + ["function-opencl-host", "clEnqueueBarrierWithWaitList"], + ["function-opencl-host", "clEnqueueCopyBuffer"], + ["function-opencl-host", "clEnqueueCopyBufferRect"], + ["function-opencl-host", "clEnqueueCopyBufferToImage"], + ["function-opencl-host", "clEnqueueCopyImage"], + ["function-opencl-host", "clEnqueueCopyImageToBuffer"], + ["function-opencl-host", "clEnqueueFillBuffer"], + ["function-opencl-host", "clEnqueueFillImage"], + ["function-opencl-host", "clEnqueueMapBuffer"], + ["function-opencl-host", "clEnqueueMapImage"], + ["function-opencl-host", "clEnqueueMarker"], + ["function-opencl-host", "clEnqueueMarkerWithWaitList"], + ["function-opencl-host", "clEnqueueMigrateMemObjects"], + ["function-opencl-host", "clEnqueueNDRangeKernel"], + ["function-opencl-host", "clEnqueueNativeKernel"], + ["function-opencl-host", "clEnqueueReadBuffer"], + ["function-opencl-host", "clEnqueueReadBufferRect"], + ["function-opencl-host", "clEnqueueReadImage"], + ["function-opencl-host", "clEnqueueSVMFree"], + ["function-opencl-host", "clEnqueueSVMMap"], + ["function-opencl-host", "clEnqueueSVMMemFill"], + ["function-opencl-host", "clEnqueueSVMMemcpy"], + ["function-opencl-host", "clEnqueueSVMMigrateMem"], + ["function-opencl-host", "clEnqueueSVMUnmap"], + ["function-opencl-host", "clEnqueueTask"], + ["function-opencl-host", "clEnqueueUnmapMemObject"], + ["function-opencl-host", "clEnqueueWaitForEvents"], + ["function-opencl-host", "clEnqueueWriteBuffer"], + ["function-opencl-host", "clEnqueueWriteBufferRect"], + ["function-opencl-host", "clEnqueueWriteImage"], + ["function-opencl-host", "clFinish"], + ["function-opencl-host", "clFlush"], + ["function-opencl-host", "clGetCommandQueueInfo"], + ["function-opencl-host", "clGetContextInfo"], + ["function-opencl-host", "clGetDeviceAndHostTimer"], + ["function-opencl-host", "clGetDeviceIDs"], + ["function-opencl-host", "clGetDeviceInfo"], + ["function-opencl-host", "clGetEventInfo"], + ["function-opencl-host", "clGetEventProfilingInfo"], + ["function-opencl-host", "clGetExtensionFunctionAddress"], + ["function-opencl-host", "clGetExtensionFunctionAddressForPlatform"], + ["function-opencl-host", "clGetHostTimer"], + ["function-opencl-host", "clGetImageInfo"], + ["function-opencl-host", "clGetKernelArgInfo"], + ["function-opencl-host", "clGetKernelInfo"], + ["function-opencl-host", "clGetKernelSubGroupInfo"], + ["function-opencl-host", "clGetKernelWorkGroupInfo"], + ["function-opencl-host", "clGetMemObjectInfo"], + ["function-opencl-host", "clGetPipeInfo"], + ["function-opencl-host", "clGetPlatformIDs"], + ["function-opencl-host", "clGetPlatformInfo"], + ["function-opencl-host", "clGetProgramBuildInfo"], + ["function-opencl-host", "clGetProgramInfo"], + ["function-opencl-host", "clGetSamplerInfo"], + ["function-opencl-host", "clGetSupportedImageFormats"], + ["function-opencl-host", "clLinkProgram"], + ["function-opencl-host", "clReleaseCommandQueue"], + ["function-opencl-host", "clReleaseContext"], + ["function-opencl-host", "clReleaseDevice"], + ["function-opencl-host", "clReleaseEvent"], + ["function-opencl-host", "clReleaseKernel"], + ["function-opencl-host", "clReleaseMemObject"], + ["function-opencl-host", "clReleaseProgram"], + ["function-opencl-host", "clReleaseSampler"], + ["function-opencl-host", "clRetainCommandQueue"], + ["function-opencl-host", "clRetainContext"], + ["function-opencl-host", "clRetainDevice"], + ["function-opencl-host", "clRetainEvent"], + ["function-opencl-host", "clRetainKernel"], + ["function-opencl-host", "clRetainMemObject"], + ["function-opencl-host", "clRetainProgram"], + ["function-opencl-host", "clRetainSampler"], + ["function-opencl-host", "clSVMAlloc"], + ["function-opencl-host", "clSVMFree"], + ["function-opencl-host", "clSetCommandQueueProperty"], + ["function-opencl-host", "clSetDefaultDeviceCommandQueue"], + ["function-opencl-host", "clSetEventCallback"], + ["function-opencl-host", "clSetKernelArg"], + ["function-opencl-host", "clSetKernelArgSVMPointer"], + ["function-opencl-host", "clSetKernelExecInfo"], + ["function-opencl-host", "clSetMemObjectDestructorCallback"], + ["function-opencl-host", "clSetUserEventStatus"], + ["function-opencl-host", "clUnloadCompiler"], + ["function-opencl-host", "clUnloadPlatformCompiler"], + ["function-opencl-host", "clWaitForEvents"] +] + +---------------------------------------------------- + +Checks for all reserved function names in OpenCL host code (C-API). \ No newline at end of file diff --git a/package/src/prism/tests/languages/opencl+c/type_feature.test b/package/src/prism/tests/languages/opencl+c/type_feature.test new file mode 100644 index 00000000..f6c82451 --- /dev/null +++ b/package/src/prism/tests/languages/opencl+c/type_feature.test @@ -0,0 +1,219 @@ +cl_GLenum +cl_GLint +cl_GLuin +cl_addressing_mode +cl_bitfield +cl_bool +cl_buffer_create_type +cl_build_status +cl_channel_order +cl_channel_type +cl_char +cl_char16 +cl_char2 +cl_char3 +cl_char4 +cl_char8 +cl_command_queue +cl_command_queue_info +cl_command_queue_properties +cl_command_type +cl_context +cl_context_info +cl_context_properties +cl_device_exec_capabilities +cl_device_fp_config +cl_device_id +cl_device_info +cl_device_local_mem_type +cl_device_mem_cache_type +cl_device_type +cl_double +cl_double16 +cl_double2 +cl_double3 +cl_double4 +cl_double8 +cl_event +cl_event_info +cl_filter_mode +cl_float +cl_float16 +cl_float2 +cl_float3 +cl_float4 +cl_float8 +cl_half +cl_image_info +cl_int +cl_int16 +cl_int2 +cl_int3 +cl_int4 +cl_int8 +cl_kernel +cl_kernel_info +cl_kernel_work_group_info +cl_long +cl_long16 +cl_long2 +cl_long3 +cl_long4 +cl_long8 +cl_map_flags +cl_mem +cl_mem_flags +cl_mem_info +cl_mem_object_type +cl_platform_id +cl_platform_info +cl_profiling_info +cl_program +cl_program_build_info +cl_program_info +cl_sampler +cl_sampler_info +cl_short +cl_short16 +cl_short2 +cl_short3 +cl_short4 +cl_short8 +cl_uchar +cl_uchar16 +cl_uchar2 +cl_uchar3 +cl_uchar4 +cl_uchar8 +cl_uint +cl_uint16 +cl_uint2 +cl_uint3 +cl_uint4 +cl_uint8 +cl_ulong +cl_ulong16 +cl_ulong2 +cl_ulong3 +cl_ulong4 +cl_ulong8 +cl_ushort +cl_ushort16 +cl_ushort2 +cl_ushort3 +cl_ushort4 +cl_ushort8 + +---------------------------------------------------- + +[ + ["type-opencl-host", "cl_GLenum"], + ["type-opencl-host", "cl_GLint"], + ["type-opencl-host", "cl_GLuin"], + ["type-opencl-host", "cl_addressing_mode"], + ["type-opencl-host", "cl_bitfield"], + ["type-opencl-host", "cl_bool"], + ["type-opencl-host", "cl_buffer_create_type"], + ["type-opencl-host", "cl_build_status"], + ["type-opencl-host", "cl_channel_order"], + ["type-opencl-host", "cl_channel_type"], + ["type-opencl-host", "cl_char"], + ["type-opencl-host", "cl_char16"], + ["type-opencl-host", "cl_char2"], + ["type-opencl-host", "cl_char3"], + ["type-opencl-host", "cl_char4"], + ["type-opencl-host", "cl_char8"], + ["type-opencl-host", "cl_command_queue"], + ["type-opencl-host", "cl_command_queue_info"], + ["type-opencl-host", "cl_command_queue_properties"], + ["type-opencl-host", "cl_command_type"], + ["type-opencl-host", "cl_context"], + ["type-opencl-host", "cl_context_info"], + ["type-opencl-host", "cl_context_properties"], + ["type-opencl-host", "cl_device_exec_capabilities"], + ["type-opencl-host", "cl_device_fp_config"], + ["type-opencl-host", "cl_device_id"], + ["type-opencl-host", "cl_device_info"], + ["type-opencl-host", "cl_device_local_mem_type"], + ["type-opencl-host", "cl_device_mem_cache_type"], + ["type-opencl-host", "cl_device_type"], + ["type-opencl-host", "cl_double"], + ["type-opencl-host", "cl_double16"], + ["type-opencl-host", "cl_double2"], + ["type-opencl-host", "cl_double3"], + ["type-opencl-host", "cl_double4"], + ["type-opencl-host", "cl_double8"], + ["type-opencl-host", "cl_event"], + ["type-opencl-host", "cl_event_info"], + ["type-opencl-host", "cl_filter_mode"], + ["type-opencl-host", "cl_float"], + ["type-opencl-host", "cl_float16"], + ["type-opencl-host", "cl_float2"], + ["type-opencl-host", "cl_float3"], + ["type-opencl-host", "cl_float4"], + ["type-opencl-host", "cl_float8"], + ["type-opencl-host", "cl_half"], + ["type-opencl-host", "cl_image_info"], + ["type-opencl-host", "cl_int"], + ["type-opencl-host", "cl_int16"], + ["type-opencl-host", "cl_int2"], + ["type-opencl-host", "cl_int3"], + ["type-opencl-host", "cl_int4"], + ["type-opencl-host", "cl_int8"], + ["type-opencl-host", "cl_kernel"], + ["type-opencl-host", "cl_kernel_info"], + ["type-opencl-host", "cl_kernel_work_group_info"], + ["type-opencl-host", "cl_long"], + ["type-opencl-host", "cl_long16"], + ["type-opencl-host", "cl_long2"], + ["type-opencl-host", "cl_long3"], + ["type-opencl-host", "cl_long4"], + ["type-opencl-host", "cl_long8"], + ["type-opencl-host", "cl_map_flags"], + ["type-opencl-host", "cl_mem"], + ["type-opencl-host", "cl_mem_flags"], + ["type-opencl-host", "cl_mem_info"], + ["type-opencl-host", "cl_mem_object_type"], + ["type-opencl-host", "cl_platform_id"], + ["type-opencl-host", "cl_platform_info"], + ["type-opencl-host", "cl_profiling_info"], + ["type-opencl-host", "cl_program"], + ["type-opencl-host", "cl_program_build_info"], + ["type-opencl-host", "cl_program_info"], + ["type-opencl-host", "cl_sampler"], + ["type-opencl-host", "cl_sampler_info"], + ["type-opencl-host", "cl_short"], + ["type-opencl-host", "cl_short16"], + ["type-opencl-host", "cl_short2"], + ["type-opencl-host", "cl_short3"], + ["type-opencl-host", "cl_short4"], + ["type-opencl-host", "cl_short8"], + ["type-opencl-host", "cl_uchar"], + ["type-opencl-host", "cl_uchar16"], + ["type-opencl-host", "cl_uchar2"], + ["type-opencl-host", "cl_uchar3"], + ["type-opencl-host", "cl_uchar4"], + ["type-opencl-host", "cl_uchar8"], + ["type-opencl-host", "cl_uint"], + ["type-opencl-host", "cl_uint16"], + ["type-opencl-host", "cl_uint2"], + ["type-opencl-host", "cl_uint3"], + ["type-opencl-host", "cl_uint4"], + ["type-opencl-host", "cl_uint8"], + ["type-opencl-host", "cl_ulong"], + ["type-opencl-host", "cl_ulong16"], + ["type-opencl-host", "cl_ulong2"], + ["type-opencl-host", "cl_ulong3"], + ["type-opencl-host", "cl_ulong4"], + ["type-opencl-host", "cl_ulong8"], + ["type-opencl-host", "cl_ushort"], + ["type-opencl-host", "cl_ushort16"], + ["type-opencl-host", "cl_ushort2"], + ["type-opencl-host", "cl_ushort3"], + ["type-opencl-host", "cl_ushort4"], + ["type-opencl-host", "cl_ushort8"] +] + +---------------------------------------------------- + +Checks for all reserved types in OpenCL host code (C-API). \ No newline at end of file diff --git a/package/src/prism/tests/languages/opencl/boolean_feature.test b/package/src/prism/tests/languages/opencl/boolean_feature.test new file mode 100644 index 00000000..95e7eb6d --- /dev/null +++ b/package/src/prism/tests/languages/opencl/boolean_feature.test @@ -0,0 +1,13 @@ +false +true + +---------------------------------------------------- + +[ + ["boolean", "false"], + ["boolean", "true"] +] + +---------------------------------------------------- + +Checks for booleans in OpenCL kernel code. diff --git a/package/src/prism/tests/languages/opencl/builtin-type_feature.test b/package/src/prism/tests/languages/opencl/builtin-type_feature.test new file mode 100644 index 00000000..e99ada8d --- /dev/null +++ b/package/src/prism/tests/languages/opencl/builtin-type_feature.test @@ -0,0 +1,71 @@ +_cl_command_queue +_cl_context +_cl_device_id +_cl_event +_cl_kernel +_cl_mem +_cl_platform_id +_cl_program +_cl_sampler +cl_image_format +cl_mem_fence_flags +clk_event_t +event_t +image1d_array_t +image1d_buffer_t +image1d_t +image2d_array_depth_t +image2d_array_msaa_depth_t +image2d_array_msaa_t +image2d_array_t +image2d_depth_t +image2d_msaa_depth_t +image2d_msaa_t +image2d_t +image3d_t +intptr_t +ndrange_t +ptrdiff_t +queue_t +reserve_id_t +sampler_t +size_t +uintptr_t + +---------------------------------------------------- + +[ + ["builtin-type", "_cl_command_queue"], + ["builtin-type", "_cl_context"], + ["builtin-type", "_cl_device_id"], + ["builtin-type", "_cl_event"], + ["builtin-type", "_cl_kernel"], + ["builtin-type", "_cl_mem"], + ["builtin-type", "_cl_platform_id"], + ["builtin-type", "_cl_program"], + ["builtin-type", "_cl_sampler"], + ["builtin-type", "cl_image_format"], + ["builtin-type", "cl_mem_fence_flags"], + ["builtin-type", "clk_event_t"], + ["builtin-type", "event_t"], + ["builtin-type", "image1d_array_t"], + ["builtin-type", "image1d_buffer_t"], + ["builtin-type", "image1d_t"], + ["builtin-type", "image2d_array_depth_t"], + ["builtin-type", "image2d_array_msaa_depth_t"], + ["builtin-type", "image2d_array_msaa_t"], + ["builtin-type", "image2d_array_t"], + ["builtin-type", "image2d_depth_t"], + ["builtin-type", "image2d_msaa_depth_t"], + ["builtin-type", "image2d_msaa_t"], + ["builtin-type", "image2d_t"], + ["builtin-type", "image3d_t"], + ["builtin-type", "intptr_t"], + ["builtin-type", "ndrange_t"], + ["builtin-type", "ptrdiff_t"], + ["builtin-type", "queue_t"], + ["builtin-type", "reserve_id_t"], + ["builtin-type", "sampler_t"], + ["builtin-type", "size_t"], + ["builtin-type", "uintptr_t"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/opencl/constant_feature.test b/package/src/prism/tests/languages/opencl/constant_feature.test new file mode 100644 index 00000000..84c97873 --- /dev/null +++ b/package/src/prism/tests/languages/opencl/constant_feature.test @@ -0,0 +1,257 @@ +CHAR_BIT +CHAR_MAX +CHAR_MIN +CLK_ADDRESS_CLAMP +CLK_ADDRESS_CLAMP_TO_EDGE +CLK_ADDRESS_NONE +CLK_ADDRESS_REPEAT +CLK_FILTER_LINEAR +CLK_FILTER_NEAREST +CLK_GLOBAL_MEM_FENCE +CLK_LOCAL_MEM_FENCE +CLK_NORMALIZED_COORDS_FALSE +CLK_NORMALIZED_COORDS_TRUE +CL_A +CL_ARGB +CL_BGRA +CL_FLOAT +CL_HALF_FLOAT +CL_INTENSITY +CL_LUMINANCE +CL_R +CL_RA +CL_RG +CL_RGB +CL_RGBA +CL_RGBx +CL_RGx +CL_Rx +CL_SIGNED_INT16 +CL_SIGNED_INT32 +CL_SIGNED_INT8 +CL_SNORM_INT16 +CL_SNORM_INT8 +CL_UNORM_INT16 +CL_UNORM_INT8 +CL_UNORM_INT_101010 +CL_UNORM_SHORT_555 +CL_UNORM_SHORT_565 +CL_UNSIGNED_INT16 +CL_UNSIGNED_INT32 +CL_UNSIGNED_INT8 +DBL_DIG +DBL_EPSILON +DBL_MANT_DIG +DBL_MAX +DBL_MAX_10_EXP +DBL_MIN +DBL_MIN_10_EXP +DBL_MIN_EXP +FLT_DIG +FLT_EPSILON +FLT_MANT_DIG +FLT_MAX +FLT_MAX_10_EXP +FLT_MAX_EXP +FLT_MIN +FLT_MIN_10_EXP +FLT_MIN_EXP +FLT_RADIX +HALF_DIG +HALF_EPSILON +HALF_MANT_DIG +HALF_MAX +HALF_MAX_10_EXP +HALF_MAX_EXP +HALF_MIN +HALF_MIN_10_EXP +HALF_MIN_EXP +HUGE_VALF +HUGE_VAL +INFINITY +INT_MAX +INT_MIN +LONG_MAX +LONG_MIN +MAXFLOAT +M_1_PI +M_2_PI +M_2_SQRTPI +M_E +M_LN10 +M_LN2 +M_LOG10E +M_LOG2E +M_PI +M_PI_2 +M_PI_4 +M_SQRT1_2 +M_SQRT2 +M_1_PI_F +M_2_PI_F +M_2_SQRTPI_F +M_E_F +M_LN10_F +M_LN2_F +M_LOG10E_F +M_LOG2E_F +M_PI_F +M_PI_2_F +M_PI_4_F +M_SQRT1_2_F +M_SQRT2_F +M_1_PI_H +M_2_PI_H +M_2_SQRTPI_H +M_E_H +M_LN10_H +M_LN2_H +M_LOG10E_H +M_LOG2E_H +M_PI_H +M_PI_2_H +M_PI_4_H +M_SQRT1_2_H +M_SQRT2_H +NAN +SCHAR_MAX +SCHAR_MIN +SHRT_MAX +SHRT_MIN +UCHAR_MAX +USHRT_MAX +UINT_MAX +ULONG_MAX + +---------------------------------------------------- + +[ + ["constant-opencl-kernel", "CHAR_BIT"], + ["constant-opencl-kernel", "CHAR_MAX"], + ["constant-opencl-kernel", "CHAR_MIN"], + ["constant-opencl-kernel", "CLK_ADDRESS_CLAMP"], + ["constant-opencl-kernel", "CLK_ADDRESS_CLAMP_TO_EDGE"], + ["constant-opencl-kernel", "CLK_ADDRESS_NONE"], + ["constant-opencl-kernel", "CLK_ADDRESS_REPEAT"], + ["constant-opencl-kernel", "CLK_FILTER_LINEAR"], + ["constant-opencl-kernel", "CLK_FILTER_NEAREST"], + ["constant-opencl-kernel", "CLK_GLOBAL_MEM_FENCE"], + ["constant-opencl-kernel", "CLK_LOCAL_MEM_FENCE"], + ["constant-opencl-kernel", "CLK_NORMALIZED_COORDS_FALSE"], + ["constant-opencl-kernel", "CLK_NORMALIZED_COORDS_TRUE"], + ["constant-opencl-kernel", "CL_A"], + ["constant-opencl-kernel", "CL_ARGB"], + ["constant-opencl-kernel", "CL_BGRA"], + ["constant-opencl-kernel", "CL_FLOAT"], + ["constant-opencl-kernel", "CL_HALF_FLOAT"], + ["constant-opencl-kernel", "CL_INTENSITY"], + ["constant-opencl-kernel", "CL_LUMINANCE"], + ["constant-opencl-kernel", "CL_R"], + ["constant-opencl-kernel", "CL_RA"], + ["constant-opencl-kernel", "CL_RG"], + ["constant-opencl-kernel", "CL_RGB"], + ["constant-opencl-kernel", "CL_RGBA"], + ["constant-opencl-kernel", "CL_RGBx"], + ["constant-opencl-kernel", "CL_RGx"], + ["constant-opencl-kernel", "CL_Rx"], + ["constant-opencl-kernel", "CL_SIGNED_INT16"], + ["constant-opencl-kernel", "CL_SIGNED_INT32"], + ["constant-opencl-kernel", "CL_SIGNED_INT8"], + ["constant-opencl-kernel", "CL_SNORM_INT16"], + ["constant-opencl-kernel", "CL_SNORM_INT8"], + ["constant-opencl-kernel", "CL_UNORM_INT16"], + ["constant-opencl-kernel", "CL_UNORM_INT8"], + ["constant-opencl-kernel", "CL_UNORM_INT_101010"], + ["constant-opencl-kernel", "CL_UNORM_SHORT_555"], + ["constant-opencl-kernel", "CL_UNORM_SHORT_565"], + ["constant-opencl-kernel", "CL_UNSIGNED_INT16"], + ["constant-opencl-kernel", "CL_UNSIGNED_INT32"], + ["constant-opencl-kernel", "CL_UNSIGNED_INT8"], + ["constant-opencl-kernel", "DBL_DIG"], + ["constant-opencl-kernel", "DBL_EPSILON"], + ["constant-opencl-kernel", "DBL_MANT_DIG"], + ["constant-opencl-kernel", "DBL_MAX"], + ["constant-opencl-kernel", "DBL_MAX_10_EXP"], + ["constant-opencl-kernel", "DBL_MIN"], + ["constant-opencl-kernel", "DBL_MIN_10_EXP"], + ["constant-opencl-kernel", "DBL_MIN_EXP"], + ["constant-opencl-kernel", "FLT_DIG"], + ["constant-opencl-kernel", "FLT_EPSILON"], + ["constant-opencl-kernel", "FLT_MANT_DIG"], + ["constant-opencl-kernel", "FLT_MAX"], + ["constant-opencl-kernel", "FLT_MAX_10_EXP"], + ["constant-opencl-kernel", "FLT_MAX_EXP"], + ["constant-opencl-kernel", "FLT_MIN"], + ["constant-opencl-kernel", "FLT_MIN_10_EXP"], + ["constant-opencl-kernel", "FLT_MIN_EXP"], + ["constant-opencl-kernel", "FLT_RADIX"], + ["constant-opencl-kernel", "HALF_DIG"], + ["constant-opencl-kernel", "HALF_EPSILON"], + ["constant-opencl-kernel", "HALF_MANT_DIG"], + ["constant-opencl-kernel", "HALF_MAX"], + ["constant-opencl-kernel", "HALF_MAX_10_EXP"], + ["constant-opencl-kernel", "HALF_MAX_EXP"], + ["constant-opencl-kernel", "HALF_MIN"], + ["constant-opencl-kernel", "HALF_MIN_10_EXP"], + ["constant-opencl-kernel", "HALF_MIN_EXP"], + ["constant-opencl-kernel", "HUGE_VALF"], + ["constant-opencl-kernel", "HUGE_VAL"], + ["constant-opencl-kernel", "INFINITY"], + ["constant-opencl-kernel", "INT_MAX"], + ["constant-opencl-kernel", "INT_MIN"], + ["constant-opencl-kernel", "LONG_MAX"], + ["constant-opencl-kernel", "LONG_MIN"], + ["constant-opencl-kernel", "MAXFLOAT"], + ["constant-opencl-kernel", "M_1_PI"], + ["constant-opencl-kernel", "M_2_PI"], + ["constant-opencl-kernel", "M_2_SQRTPI"], + ["constant-opencl-kernel", "M_E"], + ["constant-opencl-kernel", "M_LN10"], + ["constant-opencl-kernel", "M_LN2"], + ["constant-opencl-kernel", "M_LOG10E"], + ["constant-opencl-kernel", "M_LOG2E"], + ["constant-opencl-kernel", "M_PI"], + ["constant-opencl-kernel", "M_PI_2"], + ["constant-opencl-kernel", "M_PI_4"], + ["constant-opencl-kernel", "M_SQRT1_2"], + ["constant-opencl-kernel", "M_SQRT2"], + ["constant-opencl-kernel", "M_1_PI_F"], + ["constant-opencl-kernel", "M_2_PI_F"], + ["constant-opencl-kernel", "M_2_SQRTPI_F"], + ["constant-opencl-kernel", "M_E_F"], + ["constant-opencl-kernel", "M_LN10_F"], + ["constant-opencl-kernel", "M_LN2_F"], + ["constant-opencl-kernel", "M_LOG10E_F"], + ["constant-opencl-kernel", "M_LOG2E_F"], + ["constant-opencl-kernel", "M_PI_F"], + ["constant-opencl-kernel", "M_PI_2_F"], + ["constant-opencl-kernel", "M_PI_4_F"], + ["constant-opencl-kernel", "M_SQRT1_2_F"], + ["constant-opencl-kernel", "M_SQRT2_F"], + ["constant-opencl-kernel", "M_1_PI_H"], + ["constant-opencl-kernel", "M_2_PI_H"], + ["constant-opencl-kernel", "M_2_SQRTPI_H"], + ["constant-opencl-kernel", "M_E_H"], + ["constant-opencl-kernel", "M_LN10_H"], + ["constant-opencl-kernel", "M_LN2_H"], + ["constant-opencl-kernel", "M_LOG10E_H"], + ["constant-opencl-kernel", "M_LOG2E_H"], + ["constant-opencl-kernel", "M_PI_H"], + ["constant-opencl-kernel", "M_PI_2_H"], + ["constant-opencl-kernel", "M_PI_4_H"], + ["constant-opencl-kernel", "M_SQRT1_2_H"], + ["constant-opencl-kernel", "M_SQRT2_H"], + ["constant-opencl-kernel", "NAN"], + ["constant-opencl-kernel", "SCHAR_MAX"], + ["constant-opencl-kernel", "SCHAR_MIN"], + ["constant-opencl-kernel", "SHRT_MAX"], + ["constant-opencl-kernel", "SHRT_MIN"], + ["constant-opencl-kernel", "UCHAR_MAX"], + ["constant-opencl-kernel", "USHRT_MAX"], + ["constant-opencl-kernel", "UINT_MAX"], + ["constant-opencl-kernel", "ULONG_MAX"] +] + +---------------------------------------------------- + +Checks for all constant names in OpenCL kernel code. diff --git a/package/src/prism/tests/languages/opencl/keyword_feature.test b/package/src/prism/tests/languages/opencl/keyword_feature.test new file mode 100644 index 00000000..ffc873d5 --- /dev/null +++ b/package/src/prism/tests/languages/opencl/keyword_feature.test @@ -0,0 +1,355 @@ +__attribute__ +__constant +__global +__kernel +__local +__private +__read_only +__read_write +__write_only +auto +bool +bool16 +bool2 +bool3 +bool4 +bool8 +break +case +char +char16 +char2 +char3 +char4 +char8 +complex +const +constant +continue +do +double +double16 +double16x1 +double16x16 +double16x2 +double16x4 +double16x8 +double1x1 +double1x16 +double1x2 +double1x4 +double1x8 +double2 +double2x1 +double2x16 +double2x2 +double2x4 +double2x8 +double3 +double4 +double4x1 +double4x16 +double4x2 +double4x4 +double4x8 +double8 +double8x1 +double8x16 +double8x2 +double8x4 +double8x8 +else +enum; +extern +float +float16 +float16x1 +float16x16 +float16x2 +float16x4 +float16x8 +float1x1 +float1x16 +float1x2 +float1x4 +float1x8 +float2 +float2x1 +float2x16 +float2x2 +float2x4 +float2x8 +float3 +float4 +float4x1 +float4x16 +float4x2 +float4x4 +float4x8 +float8 +float8x1 +float8x16 +float8x2 +float8x4 +float8x8 +for +global +half +half16 +half2 +half3 +half4 +half8 +if +imaginary +int +int16 +int2 +int3 +int4 +int8 +kernel +local +long +long16 +long2 +long3 +long4 +long8 +packed +pipe +private +quad +quad16 +quad2 +quad3 +quad4 +quad8 +read_only +read_write +register +restrict +short +short16 +short2 +short3 +short4 +short8 +static +struct; +switch +typedef +uchar +uchar16 +uchar2 +uchar3 +uchar4 +uchar8 +uint +uint16 +uint2 +uint3 +uint4 +uint8 +ulong +ulong16 +ulong2 +ulong3 +ulong4 +ulong8 +uniform +union +unsigned +ushort +ushort16 +ushort2 +ushort3 +ushort4 +ushort8 +void +volatile +while +write_only + +---------------------------------------------------- + +[ + ["keyword", "__attribute__"], + ["keyword", "__constant"], + ["keyword", "__global"], + ["keyword", "__kernel"], + ["keyword", "__local"], + ["keyword", "__private"], + ["keyword", "__read_only"], + ["keyword", "__read_write"], + ["keyword", "__write_only"], + ["keyword", "auto"], + ["keyword", "bool"], + ["keyword", "bool16"], + ["keyword", "bool2"], + ["keyword", "bool3"], + ["keyword", "bool4"], + ["keyword", "bool8"], + ["keyword", "break"], + ["keyword", "case"], + ["keyword", "char"], + ["keyword", "char16"], + ["keyword", "char2"], + ["keyword", "char3"], + ["keyword", "char4"], + ["keyword", "char8"], + ["keyword", "complex"], + ["keyword", "const"], + ["keyword", "constant"], + ["keyword", "continue"], + ["keyword", "do"], + ["keyword", "double"], + ["keyword", "double16"], + ["keyword", "double16x1"], + ["keyword", "double16x16"], + ["keyword", "double16x2"], + ["keyword", "double16x4"], + ["keyword", "double16x8"], + ["keyword", "double1x1"], + ["keyword", "double1x16"], + ["keyword", "double1x2"], + ["keyword", "double1x4"], + ["keyword", "double1x8"], + ["keyword", "double2"], + ["keyword", "double2x1"], + ["keyword", "double2x16"], + ["keyword", "double2x2"], + ["keyword", "double2x4"], + ["keyword", "double2x8"], + ["keyword", "double3"], + ["keyword", "double4"], + ["keyword", "double4x1"], + ["keyword", "double4x16"], + ["keyword", "double4x2"], + ["keyword", "double4x4"], + ["keyword", "double4x8"], + ["keyword", "double8"], + ["keyword", "double8x1"], + ["keyword", "double8x16"], + ["keyword", "double8x2"], + ["keyword", "double8x4"], + ["keyword", "double8x8"], + ["keyword", "else"], + ["keyword", "enum"], + ["punctuation", ";"], + ["keyword", "extern"], + ["keyword", "float"], + ["keyword", "float16"], + ["keyword", "float16x1"], + ["keyword", "float16x16"], + ["keyword", "float16x2"], + ["keyword", "float16x4"], + ["keyword", "float16x8"], + ["keyword", "float1x1"], + ["keyword", "float1x16"], + ["keyword", "float1x2"], + ["keyword", "float1x4"], + ["keyword", "float1x8"], + ["keyword", "float2"], + ["keyword", "float2x1"], + ["keyword", "float2x16"], + ["keyword", "float2x2"], + ["keyword", "float2x4"], + ["keyword", "float2x8"], + ["keyword", "float3"], + ["keyword", "float4"], + ["keyword", "float4x1"], + ["keyword", "float4x16"], + ["keyword", "float4x2"], + ["keyword", "float4x4"], + ["keyword", "float4x8"], + ["keyword", "float8"], + ["keyword", "float8x1"], + ["keyword", "float8x16"], + ["keyword", "float8x2"], + ["keyword", "float8x4"], + ["keyword", "float8x8"], + ["keyword", "for"], + ["keyword", "global"], + ["keyword", "half"], + ["keyword", "half16"], + ["keyword", "half2"], + ["keyword", "half3"], + ["keyword", "half4"], + ["keyword", "half8"], + ["keyword", "if"], + ["keyword", "imaginary"], + ["keyword", "int"], + ["keyword", "int16"], + ["keyword", "int2"], + ["keyword", "int3"], + ["keyword", "int4"], + ["keyword", "int8"], + ["keyword", "kernel"], + ["keyword", "local"], + ["keyword", "long"], + ["keyword", "long16"], + ["keyword", "long2"], + ["keyword", "long3"], + ["keyword", "long4"], + ["keyword", "long8"], + ["keyword", "packed"], + ["keyword", "pipe"], + ["keyword", "private"], + ["keyword", "quad"], + ["keyword", "quad16"], + ["keyword", "quad2"], + ["keyword", "quad3"], + ["keyword", "quad4"], + ["keyword", "quad8"], + ["keyword", "read_only"], + ["keyword", "read_write"], + ["keyword", "register"], + ["keyword", "restrict"], + ["keyword", "short"], + ["keyword", "short16"], + ["keyword", "short2"], + ["keyword", "short3"], + ["keyword", "short4"], + ["keyword", "short8"], + ["keyword", "static"], + ["keyword", "struct"], + ["punctuation", ";"], + ["keyword", "switch"], + ["keyword", "typedef"], + ["keyword", "uchar"], + ["keyword", "uchar16"], + ["keyword", "uchar2"], + ["keyword", "uchar3"], + ["keyword", "uchar4"], + ["keyword", "uchar8"], + ["keyword", "uint"], + ["keyword", "uint16"], + ["keyword", "uint2"], + ["keyword", "uint3"], + ["keyword", "uint4"], + ["keyword", "uint8"], + ["keyword", "ulong"], + ["keyword", "ulong16"], + ["keyword", "ulong2"], + ["keyword", "ulong3"], + ["keyword", "ulong4"], + ["keyword", "ulong8"], + ["keyword", "uniform"], + ["keyword", "union"], + ["keyword", "unsigned"], + ["keyword", "ushort"], + ["keyword", "ushort16"], + ["keyword", "ushort2"], + ["keyword", "ushort3"], + ["keyword", "ushort4"], + ["keyword", "ushort8"], + ["keyword", "void"], + ["keyword", "volatile"], + ["keyword", "while"], + ["keyword", "write_only"] +] + +---------------------------------------------------- + +Checks for all keywords in OpenCL kernel code. \ No newline at end of file diff --git a/package/src/prism/tests/languages/opencl/number_feature.test b/package/src/prism/tests/languages/opencl/number_feature.test new file mode 100644 index 00000000..e47ef18c --- /dev/null +++ b/package/src/prism/tests/languages/opencl/number_feature.test @@ -0,0 +1,53 @@ +42 +3.14159 +4e10 +2.1e-10 +2.1e-10f +2.1e-10h +0.4e+2 +0xbabe +0xBABE +0x1.2 +0x0.3p-3 +0x0.3p-3f +0x0.3p-3h +0x0.3p4L +42f +42F +42h +42H +42u +42U +42l +42L + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "4e10"], + ["number", "2.1e-10"], + ["number", "2.1e-10f"], + ["number", "2.1e-10h"], + ["number", "0.4e+2"], + ["number", "0xbabe"], + ["number", "0xBABE"], + ["number", "0x1.2"], + ["number", "0x0.3p-3"], + ["number", "0x0.3p-3f"], + ["number", "0x0.3p-3h"], + ["number", "0x0.3p4L"], + ["number", "42f"], + ["number", "42F"], + ["number", "42h"], + ["number", "42H"], + ["number", "42u"], + ["number", "42U"], + ["number", "42l"], + ["number", "42L"] +] + +---------------------------------------------------- + +Checks for numbers in OpenCL kernel code. diff --git a/package/src/prism/tests/languages/openqasm/class-name_feature.test b/package/src/prism/tests/languages/openqasm/class-name_feature.test new file mode 100644 index 00000000..cc977098 --- /dev/null +++ b/package/src/prism/tests/languages/openqasm/class-name_feature.test @@ -0,0 +1,29 @@ +angle +bit +bool +creg +fixed +float +int +length +qreg +qubit +stretch +uint + +---------------------------------------------------- + +[ + ["class-name", "angle"], + ["class-name", "bit"], + ["class-name", "bool"], + ["class-name", "creg"], + ["class-name", "fixed"], + ["class-name", "float"], + ["class-name", "int"], + ["class-name", "length"], + ["class-name", "qreg"], + ["class-name", "qubit"], + ["class-name", "stretch"], + ["class-name", "uint"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/openqasm/comment_feature.test b/package/src/prism/tests/languages/openqasm/comment_feature.test new file mode 100644 index 00000000..50ebd015 --- /dev/null +++ b/package/src/prism/tests/languages/openqasm/comment_feature.test @@ -0,0 +1,13 @@ +/* + comment + */ + +// comment + +---------------------------------------------------- + +[ + ["comment", "/*\n comment\n */"], + + ["comment", "// comment"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/openqasm/constant_feature.test b/package/src/prism/tests/languages/openqasm/constant_feature.test new file mode 100644 index 00000000..91f002df --- /dev/null +++ b/package/src/prism/tests/languages/openqasm/constant_feature.test @@ -0,0 +1,9 @@ +pi tau euler +π τ ℇ + +---------------------------------------------------- + +[ + ["constant", "pi"], ["constant", "tau"], ["constant", "euler"], + ["constant", "π"], " τ ", ["constant", "ℇ"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/openqasm/function_feature.test b/package/src/prism/tests/languages/openqasm/function_feature.test new file mode 100644 index 00000000..cf018998 --- /dev/null +++ b/package/src/prism/tests/languages/openqasm/function_feature.test @@ -0,0 +1,23 @@ +sin( +cos( +tan( +exp( +ln( +sqrt( +rotl( +rotr( +popcount( + +---------------------------------------------------- + +[ + ["function", "sin"], ["punctuation", "("], + ["function", "cos"], ["punctuation", "("], + ["function", "tan"], ["punctuation", "("], + ["function", "exp"], ["punctuation", "("], + ["function", "ln"], ["punctuation", "("], + ["function", "sqrt"], ["punctuation", "("], + ["function", "rotl"], ["punctuation", "("], + ["function", "rotr"], ["punctuation", "("], + ["function", "popcount"], ["punctuation", "("] +] diff --git a/package/src/prism/tests/languages/openqasm/keyword_feature.test b/package/src/prism/tests/languages/openqasm/keyword_feature.test new file mode 100644 index 00000000..1ef2dee5 --- /dev/null +++ b/package/src/prism/tests/languages/openqasm/keyword_feature.test @@ -0,0 +1,79 @@ +barrier +boxas +boxto +break +const +continue +ctrl +def +defcal +defcalgrammar +delay +else +end +for +gate +gphase +if +in +include +inv +kernel +lengthof +let +measure +pow +reset +return +rotary +stretchinf +while + +OPENQASM + +CX +U + +#pragma + +---------------------------------------------------- + +[ + ["keyword", "barrier"], + ["keyword", "boxas"], + ["keyword", "boxto"], + ["keyword", "break"], + ["keyword", "const"], + ["keyword", "continue"], + ["keyword", "ctrl"], + ["keyword", "def"], + ["keyword", "defcal"], + ["keyword", "defcalgrammar"], + ["keyword", "delay"], + ["keyword", "else"], + ["keyword", "end"], + ["keyword", "for"], + ["keyword", "gate"], + ["keyword", "gphase"], + ["keyword", "if"], + ["keyword", "in"], + ["keyword", "include"], + ["keyword", "inv"], + ["keyword", "kernel"], + ["keyword", "lengthof"], + ["keyword", "let"], + ["keyword", "measure"], + ["keyword", "pow"], + ["keyword", "reset"], + ["keyword", "return"], + ["keyword", "rotary"], + ["keyword", "stretchinf"], + ["keyword", "while"], + + ["keyword", "OPENQASM"], + + ["keyword", "CX"], + ["keyword", "U"], + + ["keyword", "#pragma"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/openqasm/number_feature.test b/package/src/prism/tests/languages/openqasm/number_feature.test new file mode 100644 index 00000000..aed9ecd5 --- /dev/null +++ b/package/src/prism/tests/languages/openqasm/number_feature.test @@ -0,0 +1,23 @@ +1234 +1e2 +.5 + +1000ms +1000dt + +// not a number +$0 + +---------------------------------------------------- + +[ + ["number", "1234"], + ["number", "1e2"], + ["number", ".5"], + + ["number", "1000ms"], + ["number", "1000dt"], + + ["comment", "// not a number"], + "\n$0" +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/openqasm/operator_feature.test b/package/src/prism/tests/languages/openqasm/operator_feature.test new file mode 100644 index 00000000..dac0aa58 --- /dev/null +++ b/package/src/prism/tests/languages/openqasm/operator_feature.test @@ -0,0 +1,56 @@ +> < >= <= == != + +& | ~ ^ << >> +&= |= ~= ^= <<= >>= + +! && || + += -> @ + ++ - * / % ++= -= *= /= %= +++ -- + +---------------------------------------------------- + +[ + ["operator", ">"], + ["operator", "<"], + ["operator", ">="], + ["operator", "<="], + ["operator", "=="], + ["operator", "!="], + + ["operator", "&"], + ["operator", "|"], + ["operator", "~"], + ["operator", "^"], + ["operator", "<<"], + ["operator", ">>"], + + ["operator", "&="], + ["operator", "|="], + ["operator", "~="], + ["operator", "^="], + ["operator", "<<="], + ["operator", ">>="], + + ["operator", "!"], ["operator", "&&"], ["operator", "||"], + + ["operator", "="], ["operator", "->"], ["operator", "@"], + + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + ["operator", "%="], + + ["operator", "++"], + ["operator", "--"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/openqasm/punctuation_feature.test b/package/src/prism/tests/languages/openqasm/punctuation_feature.test new file mode 100644 index 00000000..462695fd --- /dev/null +++ b/package/src/prism/tests/languages/openqasm/punctuation_feature.test @@ -0,0 +1,18 @@ +( ) { } [ ] +; , : . + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + + ["punctuation", ";"], + ["punctuation", ","], + ["punctuation", ":"], + ["punctuation", "."] +] diff --git a/package/src/prism/tests/languages/openqasm/string_feature.test b/package/src/prism/tests/languages/openqasm/string_feature.test new file mode 100644 index 00000000..4c3981ae --- /dev/null +++ b/package/src/prism/tests/languages/openqasm/string_feature.test @@ -0,0 +1,9 @@ +"foo" +'bar' + +---------------------------------------------------- + +[ + ["string", "\"foo\""], + ["string", "'bar'"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/oz/atom_feature.test b/package/src/prism/tests/languages/oz/atom_feature.test new file mode 100644 index 00000000..11dd746f --- /dev/null +++ b/package/src/prism/tests/languages/oz/atom_feature.test @@ -0,0 +1,16 @@ +'' +'fo\'obar' +'foo +bar' + +---------------------------------------------------- + +[ + ["atom", "''"], + ["atom", "'fo\\'obar'"], + ["atom", "'foo\nbar'"] +] + +---------------------------------------------------- + +Checks for atoms. \ No newline at end of file diff --git a/package/src/prism/tests/languages/oz/attr-name_feature.test b/package/src/prism/tests/languages/oz/attr-name_feature.test new file mode 100644 index 00000000..f3906095 --- /dev/null +++ b/package/src/prism/tests/languages/oz/attr-name_feature.test @@ -0,0 +1,25 @@ +menubutton(text:'Test' underline:0) + +% negative example +val:=Value + +---------------------------------------------------- + +[ + ["function", "menubutton"], + ["punctuation", "("], + ["attr-name", "text"], + ["punctuation", ":"], + ["atom", "'Test'"], + ["attr-name", "underline"], + ["punctuation", ":"], + ["number", "0"], + ["punctuation", ")"], + + ["comment", "% negative example"], + "\nval", ["operator", ":="], "Value" +] + +---------------------------------------------------- + +Checks for parameter names. diff --git a/package/src/prism/tests/languages/oz/comment_feature.test b/package/src/prism/tests/languages/oz/comment_feature.test new file mode 100644 index 00000000..521d864f --- /dev/null +++ b/package/src/prism/tests/languages/oz/comment_feature.test @@ -0,0 +1,18 @@ +% +% Foobar +/**/ +/* Foo +bar */ + +---------------------------------------------------- + +[ + ["comment", "%"], + ["comment", "% Foobar"], + ["comment", "/**/"], + ["comment", "/* Foo\nbar */"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/oz/function_feature.test b/package/src/prism/tests/languages/oz/function_feature.test new file mode 100644 index 00000000..9abc1283 --- /dev/null +++ b/package/src/prism/tests/languages/oz/function_feature.test @@ -0,0 +1,13 @@ +foobar() +{Foobar} + +---------------------------------------------------- + +[ + ["function", "foobar"], ["punctuation", "("], ["punctuation", ")"], + ["punctuation", "{"], ["function", "Foobar"], ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for functions and procedures. \ No newline at end of file diff --git a/package/src/prism/tests/languages/oz/keyword_feature.test b/package/src/prism/tests/languages/oz/keyword_feature.test new file mode 100644 index 00000000..63848e77 --- /dev/null +++ b/package/src/prism/tests/languages/oz/keyword_feature.test @@ -0,0 +1,103 @@ +$ +_ +[] +at +attr +case +catch +choice +class +cond +declare +define +dis +else +elsecase +elseif +end +export +fail +false +feat +finally +from +fun +functor +if +import +in +local +lock +meth +nil +not +of +or +prepare +proc +prop +raise +require +self +skip +then +thread +true +try +unit + +---------------------------------------------------- + +[ + ["keyword", "$"], + ["keyword", "_"], + ["keyword", "[]"], + ["keyword", "at"], + ["keyword", "attr"], + ["keyword", "case"], + ["keyword", "catch"], + ["keyword", "choice"], + ["keyword", "class"], + ["keyword", "cond"], + ["keyword", "declare"], + ["keyword", "define"], + ["keyword", "dis"], + ["keyword", "else"], + ["keyword", "elsecase"], + ["keyword", "elseif"], + ["keyword", "end"], + ["keyword", "export"], + ["keyword", "fail"], + ["keyword", "false"], + ["keyword", "feat"], + ["keyword", "finally"], + ["keyword", "from"], + ["keyword", "fun"], + ["keyword", "functor"], + ["keyword", "if"], + ["keyword", "import"], + ["keyword", "in"], + ["keyword", "local"], + ["keyword", "lock"], + ["keyword", "meth"], + ["keyword", "nil"], + ["keyword", "not"], + ["keyword", "of"], + ["keyword", "or"], + ["keyword", "prepare"], + ["keyword", "proc"], + ["keyword", "prop"], + ["keyword", "raise"], + ["keyword", "require"], + ["keyword", "self"], + ["keyword", "skip"], + ["keyword", "then"], + ["keyword", "thread"], + ["keyword", "true"], + ["keyword", "try"], + ["keyword", "unit"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/oz/number_feature.test b/package/src/prism/tests/languages/oz/number_feature.test new file mode 100644 index 00000000..a8d3254f --- /dev/null +++ b/package/src/prism/tests/languages/oz/number_feature.test @@ -0,0 +1,35 @@ +0 +42 +0154 +0xBadFace +0B0101 +3.14159 +2e8 +3.E~7 +4.8E12 +&0 +&a +&\n +&\124 + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "42"], + ["number", "0154"], + ["number", "0xBadFace"], + ["number", "0B0101"], + ["number", "3.14159"], + ["number", "2e8"], + ["number", "3.E~7"], + ["number", "4.8E12"], + ["number", "&0"], + ["number", "&a"], + ["number", "&\\n"], + ["number", "&\\124"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/oz/operator_feature.test b/package/src/prism/tests/languages/oz/operator_feature.test new file mode 100644 index 00000000..bf826552 --- /dev/null +++ b/package/src/prism/tests/languages/oz/operator_feature.test @@ -0,0 +1,35 @@ +:= :: ::: +< <- <: <= += == =: =< =<: +> >= >: >=: +\= \=: +! !! +| # + - +* / , ~ +^ @ +andthen +div +mod +orelse + +---------------------------------------------------- + +[ + ["operator", ":="], ["operator", "::"], ["operator", ":::"], + ["operator", "<"], ["operator", "<-"], ["operator", "<:"], ["operator", "<="], + ["operator", "="], ["operator", "=="], ["operator", "=:"], ["operator", "=<"], ["operator", "=<:"], + ["operator", ">"], ["operator", ">="], ["operator", ">:"], ["operator", ">=:"], + ["operator", "\\="], ["operator", "\\=:"], + ["operator", "!"], ["operator", "!!"], + ["operator", "|"], ["operator", "#"], ["operator", "+"], ["operator", "-"], + ["operator", "*"], ["operator", "/"], ["operator", ","], ["operator", "~"], + ["operator", "^"], ["operator", "@"], + ["operator", "andthen"], + ["operator", "div"], + ["operator", "mod"], + ["operator", "orelse"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/oz/string_feature.test b/package/src/prism/tests/languages/oz/string_feature.test new file mode 100644 index 00000000..9b8c0653 --- /dev/null +++ b/package/src/prism/tests/languages/oz/string_feature.test @@ -0,0 +1,16 @@ +"" +"Fo\"obar" +"Foo +bar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"Fo\\\"obar\""], + ["string", "\"Foo\nbar\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/oz/variable_feature.test b/package/src/prism/tests/languages/oz/variable_feature.test new file mode 100644 index 00000000..86b9108d --- /dev/null +++ b/package/src/prism/tests/languages/oz/variable_feature.test @@ -0,0 +1,7 @@ +`foo` + +---------------------------------------------------- + +[ + ["variable", "`foo`"] +] diff --git a/package/src/prism/tests/languages/parigp/comment_feature.test b/package/src/prism/tests/languages/parigp/comment_feature.test new file mode 100644 index 00000000..abe5b457 --- /dev/null +++ b/package/src/prism/tests/languages/parigp/comment_feature.test @@ -0,0 +1,18 @@ +/**/ +/* foo +bar */ +\\ +\\ foobar + +---------------------------------------------------- + +[ + ["comment", "/**/"], + ["comment", "/* foo\nbar */"], + ["comment", "\\\\"], + ["comment", "\\\\ foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/parigp/function_feature.test b/package/src/prism/tests/languages/parigp/function_feature.test new file mode 100644 index 00000000..368ad735 --- /dev/null +++ b/package/src/prism/tests/languages/parigp/function_feature.test @@ -0,0 +1,13 @@ +foo() +f o o b a r ( ) + +---------------------------------------------------- + +[ + ["function", "foo"], ["punctuation", "("], ["punctuation", ")"], + ["function", "f o o b a r"], ["punctuation", "("], ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for functions. Also checks that whitespaces are ignored. \ No newline at end of file diff --git a/package/src/prism/tests/languages/parigp/keyword_feature.test b/package/src/prism/tests/languages/parigp/keyword_feature.test new file mode 100644 index 00000000..45d68fa0 --- /dev/null +++ b/package/src/prism/tests/languages/parigp/keyword_feature.test @@ -0,0 +1,103 @@ +break +breakpoint +dbg_down +dbg_err +dbg_up +dbg_x +for +forcomposite +fordiv +forell +forpart +forprime +forstep +forsubgroup +forvec +if +iferr +local +my +next +return +until +while + +br e ak +break point +d b g_down +dbg_e r r +dbg _ up +db g _x +f o r +for composite +for div +for ell +for part +for prime +for step +for subgroup +for vec +i f +if err +l o c a l +m y +ne xt +re tu rn +u nti l +whi le + +---------------------------------------------------- + +[ + ["keyword", "break"], + ["keyword", "breakpoint"], + ["keyword", "dbg_down"], + ["keyword", "dbg_err"], + ["keyword", "dbg_up"], + ["keyword", "dbg_x"], + ["keyword", "for"], + ["keyword", "forcomposite"], + ["keyword", "fordiv"], + ["keyword", "forell"], + ["keyword", "forpart"], + ["keyword", "forprime"], + ["keyword", "forstep"], + ["keyword", "forsubgroup"], + ["keyword", "forvec"], + ["keyword", "if"], + ["keyword", "iferr"], + ["keyword", "local"], + ["keyword", "my"], + ["keyword", "next"], + ["keyword", "return"], + ["keyword", "until"], + ["keyword", "while"], + + ["keyword", "br e ak"], + ["keyword", "break point"], + ["keyword", "d b g_down"], + ["keyword", "dbg_e r r"], + ["keyword", "dbg _ up"], + ["keyword", "db g _x"], + ["keyword", "f o r"], + ["keyword", "for composite"], + ["keyword", "for div"], + ["keyword", "for ell"], + ["keyword", "for part"], + ["keyword", "for prime"], + ["keyword", "for step"], + ["keyword", "for subgroup"], + ["keyword", "for vec"], + ["keyword", "i f"], + ["keyword", "if err"], + ["keyword", "l o c a l"], + ["keyword", "m y"], + ["keyword", "ne xt"], + ["keyword", "re tu rn"], + ["keyword", "u nti l"], + ["keyword", "whi le"] +] + +---------------------------------------------------- + +Checks for all keywords. Also checks that whitespaces are ignored. \ No newline at end of file diff --git a/package/src/prism/tests/languages/parigp/number_feature.test b/package/src/prism/tests/languages/parigp/number_feature.test new file mode 100644 index 00000000..b242b828 --- /dev/null +++ b/package/src/prism/tests/languages/parigp/number_feature.test @@ -0,0 +1,39 @@ +0 +42 +1 2 3 4 5 +4. +4 . +.5 +. 5 +3.14159 +3 . 14 15 9 +3E8 +3 E 8 +2.0e-7 +2 . 0 e - 7 +.28e+12 +. 2 8 e + 1 2 + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "42"], + ["number", "1 2 3 4 5"], + ["number", "4."], + ["number", "4 ."], + ["number", ".5"], + ["number", ". 5"], + ["number", "3.14159"], + ["number", "3 . 14 15 9"], + ["number", "3E8"], + ["number", "3 E 8"], + ["number", "2.0e-7"], + ["number", "2 . 0 e - 7"], + ["number", ".28e+12"], + ["number", ". 2 8 e + 1 2"] +] + +---------------------------------------------------- + +Checks for numbers. Also checks that whitespaces are ignored. \ No newline at end of file diff --git a/package/src/prism/tests/languages/parigp/operator_feature.test b/package/src/prism/tests/languages/parigp/operator_feature.test new file mode 100644 index 00000000..2f8865ec --- /dev/null +++ b/package/src/prism/tests/languages/parigp/operator_feature.test @@ -0,0 +1,155 @@ +.. +. . +* +*= +* = +/ +/= +/ = +! +!= +! = +% +%= +% = +%# +% # +%' +% ' +%#' +% # ' +%''''' +% ''''' +%#''''' +% # ''''' ++ +++ ++ + ++= ++ = +- +-- +- - +-= +- = +-> +- > +< +<< +< < +<= +< = +<<= +< < = +<> +< > +> +>> +> > +>= +> = +>>= +> > = += +== += = +=== += = = +\ +\/ +\ / +\= +\ = +\/= +\ / = +& +&& +& & +|| +| | +' +# +~ +^ + +---------------------------------------------------- + +[ + ["operator", ".."], + ["operator", ". ."], + ["operator", "*"], + ["operator", "*="], + ["operator", "* ="], + ["operator", "/"], + ["operator", "/="], + ["operator", "/ ="], + ["operator", "!"], + ["operator", "!="], + ["operator", "! ="], + ["operator", "%"], + ["operator", "%="], + ["operator", "% ="], + ["operator", "%#"], + ["operator", "% #"], + ["operator", "%'"], + ["operator", "% '"], + ["operator", "%#'"], + ["operator", "% # '"], + ["operator", "%'''''"], + ["operator", "% '''''"], + ["operator", "%#'''''"], + ["operator", "% # '''''"], + ["operator", "+"], + ["operator", "++"], + ["operator", "+ +"], + ["operator", "+="], + ["operator", "+ ="], + ["operator", "-"], + ["operator", "--"], + ["operator", "- -"], + ["operator", "-="], + ["operator", "- ="], + ["operator", "->"], + ["operator", "- >"], + ["operator", "<"], + ["operator", "<<"], + ["operator", "< <"], + ["operator", "<="], + ["operator", "< ="], + ["operator", "<<="], + ["operator", "< < ="], + ["operator", "<>"], + ["operator", "< >"], + ["operator", ">"], + ["operator", ">>"], + ["operator", "> >"], + ["operator", ">="], + ["operator", "> ="], + ["operator", ">>="], + ["operator", "> > ="], + ["operator", "="], + ["operator", "=="], + ["operator", "= ="], + ["operator", "==="], + ["operator", "= = ="], + ["operator", "\\"], + ["operator", "\\/"], + ["operator", "\\ /"], + ["operator", "\\="], + ["operator", "\\ ="], + ["operator", "\\/="], + ["operator", "\\ / ="], + ["operator", "&"], + ["operator", "&&"], + ["operator", "& &"], + ["operator", "||"], + ["operator", "| |"], + ["operator", "'"], + ["operator", "#"], + ["operator", "~"], + ["operator", "^"] +] + +---------------------------------------------------- + +Checks for operators. Also checks that whitespaces are ignored. \ No newline at end of file diff --git a/package/src/prism/tests/languages/parigp/string_feature.test b/package/src/prism/tests/languages/parigp/string_feature.test new file mode 100644 index 00000000..b3c6ec95 --- /dev/null +++ b/package/src/prism/tests/languages/parigp/string_feature.test @@ -0,0 +1,13 @@ +"" +"fo\"obar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/parser/boolean_feature.test b/package/src/prism/tests/languages/parser/boolean_feature.test new file mode 100644 index 00000000..507e9b2c --- /dev/null +++ b/package/src/prism/tests/languages/parser/boolean_feature.test @@ -0,0 +1,21 @@ +(true) +(false) + +---------------------------------------------------- + +[ + ["expression", [ + ["punctuation", "("], + ["boolean", "true"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["boolean", "false"], + ["punctuation", ")"] + ]] +] + +---------------------------------------------------- + +Checks for booleans inside expressions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/parser/escape_feature.test b/package/src/prism/tests/languages/parser/escape_feature.test new file mode 100644 index 00000000..1c2bdb34 --- /dev/null +++ b/package/src/prism/tests/languages/parser/escape_feature.test @@ -0,0 +1,66 @@ +^$ +^^ +^; +^@ +^( +^) +^[ +^] +^{ +^} +^" +^' +^: +^# +^#20 +^#af +^#AF + +^^date::now +^$foobar + +
+ +---------------------------------------------------- + +[ + ["escape", "^$"], + ["escape", "^^"], + ["escape", "^;"], + ["escape", "^@"], + ["escape", "^("], + ["escape", "^)"], + ["escape", "^["], + ["escape", "^]"], + ["escape", "^{"], + ["escape", "^}"], + ["escape", "^\""], + ["escape", "^'"], + ["escape", "^:"], + ["escape", "^#"], + ["escape", "^#20"], + ["escape", "^#af"], + ["escape", "^#AF"], + + ["escape", "^^"], "date::now\n", + ["escape", "^$"], "foobar\n\n", + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "foo", + ["escape", "^^"], + "bar", + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]] +] + +---------------------------------------------------- + +Checks for escapes. diff --git a/package/src/prism/tests/languages/parser/expression_feature.test b/package/src/prism/tests/languages/parser/expression_feature.test new file mode 100644 index 00000000..e46c3bfe --- /dev/null +++ b/package/src/prism/tests/languages/parser/expression_feature.test @@ -0,0 +1,58 @@ +((3-(9-2))*4) +^eval(4+2) + +
+ +---------------------------------------------------- + +[ + ["expression", [ + ["punctuation", "("], + ["punctuation", "("], + ["number", "3"], + ["operator", "-"], + ["punctuation", "("], + ["number", "9"], + ["operator", "-"], + ["number", "2"], + ["punctuation", ")"], + ["punctuation", ")"], + ["operator", "*"], + ["number", "4"], + ["punctuation", ")"] + ]], + + ["keyword", "^eval"], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "+"], + ["number", "2"], + ["punctuation", ")"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "foo-", + ["keyword", "^eval"], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "+"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]] +] + +---------------------------------------------------- + +Checks for expressions, up to 3 levels of depth. diff --git a/package/src/prism/tests/languages/parser/function_feature.test b/package/src/prism/tests/languages/parser/function_feature.test new file mode 100644 index 00000000..2c6763eb --- /dev/null +++ b/package/src/prism/tests/languages/parser/function_feature.test @@ -0,0 +1,90 @@ +@foo[] +@GET_foo[] +@SET_foo[] +^foo[] +^Foo::create[] +^date::now[] +^foo_bar.menu{} + +(^foo[]) + +
+ +---------------------------------------------------- + +[ + ["function", ["@foo"]], + ["punctuation", "["], + ["punctuation", "]"], + + ["function", [ + "@", + ["keyword", "GET_"], + "foo" + ]], + ["punctuation", "["], + ["punctuation", "]"], + + ["function", [ + "@", + ["keyword", "SET_"], + "foo" + ]], + ["punctuation", "["], + ["punctuation", "]"], + + ["function", ["^foo"]], + ["punctuation", "["], + ["punctuation", "]"], + + ["function", [ + "^Foo", + ["punctuation", "::"], + "create" + ]], + ["punctuation", "["], + ["punctuation", "]"], + + ["function", [ + "^date", + ["punctuation", "::"], + "now" + ]], + ["punctuation", "["], + ["punctuation", "]"], + + ["function", [ + "^foo_bar", + ["punctuation", "."], + "menu" + ]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["expression", [ + ["punctuation", "("], + ["function", ["^foo"]], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", ")"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["function", ["^foo"]], + ["parser-punctuation", "["], + ["parser-punctuation", "]"], + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]] +] + +---------------------------------------------------- + +Checks for functions and methods. diff --git a/package/src/prism/tests/languages/parser/keyword_feature.test b/package/src/prism/tests/languages/parser/keyword_feature.test new file mode 100644 index 00000000..465d542f --- /dev/null +++ b/package/src/prism/tests/languages/parser/keyword_feature.test @@ -0,0 +1,76 @@ +^case +^eval +^for +^if +^switch +^throw + +@BASE +@CLASS +@GET +@GET_DEFAULT +@OPTIONS +@SET_DEFAULT +@USE + +(^eval(2+2)) + +
+ +---------------------------------------------------- + +[ + ["keyword", "^case"], + ["keyword", "^eval"], + ["keyword", "^for"], + ["keyword", "^if"], + ["keyword", "^switch"], + ["keyword", "^throw"], + + ["keyword", "@BASE"], + ["keyword", "@CLASS"], + ["keyword", "@GET"], + ["keyword", "@GET_DEFAULT"], + ["keyword", "@OPTIONS"], + ["keyword", "@SET_DEFAULT"], + ["keyword", "@USE"], + + ["expression", [ + ["punctuation", "("], + ["keyword", "^eval"], + ["punctuation", "("], + ["number", "2"], + ["operator", "+"], + ["number", "2"], + ["punctuation", ")"], + ["punctuation", ")"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["keyword", "^if"], + ["expression", [ + ["punctuation", "("], + ["variable", ["$foo"]], + ["punctuation", ")"] + ]], + ["parser-punctuation", "{"], + "bar", + ["parser-punctuation", "}"], + ["parser-punctuation", "{"], + "baz", + ["parser-punctuation", "}"], + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/parser/number_feature.test b/package/src/prism/tests/languages/parser/number_feature.test new file mode 100644 index 00000000..89dc163c --- /dev/null +++ b/package/src/prism/tests/languages/parser/number_feature.test @@ -0,0 +1,51 @@ +(42) +(3.14159) +(3e5) +(0.8E-12) +(3.9e+2) +(0xbadface) +(0XBADFACE) + +---------------------------------------------------- + +[ + ["expression", [ + ["punctuation", "("], + ["number", "42"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "3.14159"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "3e5"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "0.8E-12"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "3.9e+2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "0xbadface"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "0XBADFACE"], + ["punctuation", ")"] + ]] +] + +---------------------------------------------------- + +Checks for numbers inside expressions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/parser/operator_feature.test b/package/src/prism/tests/languages/parser/operator_feature.test new file mode 100644 index 00000000..4b86a576 --- /dev/null +++ b/package/src/prism/tests/languages/parser/operator_feature.test @@ -0,0 +1,257 @@ +(~42) +(+42) +(-42) +(4/2) +(9\2) +(9%2) +(!true) +(4!|2) +(true!||false) +(4!=2) +(4&2) +(true&&false) +(4|2) +(true||false) +(4==2) +(4<2) +(4<=2) +(4<<2) +(4>2) +(4>=2) +(4>>2) +(-f "foo") +(-d "foo") +(def $foo) +(4 eq 2) +(4 ge 2) +(4 gt 2) +(in "foo") +($foo is string) +(4 le 2) +(4 lt 2) +(4 ne 2) + +---------------------------------------------------- + +[ + ["expression", [ + ["punctuation", "("], + ["operator", "~"], + ["number", "42"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["operator", "+"], + ["number", "42"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["operator", "-"], + ["number", "42"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "/"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "9"], + ["operator", "\\"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "9"], + ["operator", "%"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["operator", "!"], + ["boolean", "true"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "!|"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["boolean", "true"], + ["operator", "!||"], + ["boolean", "false"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "!="], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "&"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["boolean", "true"], + ["operator", "&&"], + ["boolean", "false"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "|"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["boolean", "true"], + ["operator", "||"], + ["boolean", "false"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "=="], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "<"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "<="], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "<<"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", ">"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", ">="], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", ">>"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["operator", "-f"], + ["string", "\"foo\""], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["operator", "-d"], + ["string", "\"foo\""], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["operator", "def"], + ["variable", ["$foo"]], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "eq"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "ge"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "gt"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["operator", "in"], + ["string", "\"foo\""], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["variable", ["$foo"]], + ["operator", "is"], + " string", + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "le"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "lt"], + ["number", "2"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["number", "4"], + ["operator", "ne"], + ["number", "2"], + ["punctuation", ")"] + ]] +] + +---------------------------------------------------- + +Checks for operators inside expressions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/parser/parser-comment_feature.test b/package/src/prism/tests/languages/parser/parser-comment_feature.test new file mode 100644 index 00000000..780a5a1e --- /dev/null +++ b/package/src/prism/tests/languages/parser/parser-comment_feature.test @@ -0,0 +1,17 @@ +Foo +# +# Foobar + +---------------------------------------------------- + +[ + "Foo\n", + ["parser-comment", "#"], + ["parser-comment", "# Foobar"] +] + +---------------------------------------------------- + +Checks for comments. +The first line of this test is needed, since we require a whitespace before the hash +and tests are trimmed. \ No newline at end of file diff --git a/package/src/prism/tests/languages/parser/string_feature.test b/package/src/prism/tests/languages/parser/string_feature.test new file mode 100644 index 00000000..6c9b2baf --- /dev/null +++ b/package/src/prism/tests/languages/parser/string_feature.test @@ -0,0 +1,47 @@ +("") +("foo^"bar") +("foo +bar") +('') +('foo^'bar') +('foo +bar') + +---------------------------------------------------- + +[ + ["expression", [ + ["punctuation", "("], + ["string", "\"\""], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["string", "\"foo^\"bar\""], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["string", "\"foo\nbar\""], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["string", "''"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["string", "'foo^'bar'"], + ["punctuation", ")"] + ]], + ["expression", [ + ["punctuation", "("], + ["string", "'foo\nbar'"], + ["punctuation", ")"] + ]] +] + +---------------------------------------------------- + +Checks for strings inside expressions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/parser/variable_feature.test b/package/src/prism/tests/languages/parser/variable_feature.test new file mode 100644 index 00000000..bada2f0c --- /dev/null +++ b/package/src/prism/tests/languages/parser/variable_feature.test @@ -0,0 +1,94 @@ +$foo +$foo[bar] +$foo_bar[ + $.baz[foo] + $.1[bar] +] +$foo.$bar +$foo.[$bar.baz] +$math:PI + +($foo) + +
+ +---------------------------------------------------- + +[ + ["variable", ["$foo"]], + + ["variable", ["$foo"]], + ["punctuation", "["], + "bar", + ["punctuation", "]"], + + ["variable", ["$foo_bar"]], + ["punctuation", "["], + + ["variable", [ + "$", + ["punctuation", "."], + "baz" + ]], + ["punctuation", "["], + "foo", + ["punctuation", "]"], + + ["variable", [ + "$", + ["punctuation", "."], + "1" + ]], + ["punctuation", "["], + "bar", + ["punctuation", "]"], + + ["punctuation", "]"], + + ["variable", [ + "$foo", + ["punctuation", "."] + ]], + ["variable", ["$bar"]], + + ["variable", [ + "$foo", + ["punctuation", "."] + ]], + ["punctuation", "["], + ["variable", [ + "$bar", + ["punctuation", "."], + "baz" + ]], + ["punctuation", "]"], + + ["variable", [ + "$math", + ["punctuation", ":"], + "PI" + ]], + + ["expression", [ + ["punctuation", "("], + ["variable", ["$foo"]], + ["punctuation", ")"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["variable", ["$foo"]], + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]] +] + +---------------------------------------------------- + +Checks for variables. diff --git a/package/src/prism/tests/languages/pascal/asm_feature.test b/package/src/prism/tests/languages/pascal/asm_feature.test new file mode 100644 index 00000000..dcd84e5d --- /dev/null +++ b/package/src/prism/tests/languages/pascal/asm_feature.test @@ -0,0 +1,344 @@ +program asmDemo(input, output, stderr); + +// The $asmMode directive informs the compiler +// which syntax is used in asm-blocks. +// Alternatives are 'att' (AT&T syntax) and 'direct'. +{$asmMode intel} + +var + n, m: longint; +begin + n := 42; + m := -7; + writeLn('n = ', n, '; m = ', m); + + // instead of declaring another temporary variable + // and writing "tmp := n; n := m; m := tmp;": + asm + mov eax, n // eax := n + // xchg can only operate at most on one memory address + xchg eax, m // swaps values in eax and at m + mov n, eax // n := eax (holding the former m value) + // an array of strings after the asm-block closing 'end' + // tells the compiler which registers have changed + // (you don't wanna mess with the compiler's notion + // which registers mean what) + end ['eax']; + + writeLn('n = ', n, '; m = ', m); +end. + +program sign(input, output, stderr); + +type + signumCodomain = -1..1; + +{ returns the sign of an integer } +function signum({$ifNDef CPUx86_64} const {$endIf} x: longint): signumCodomain; +{$ifDef CPUx86_64} // ============= optimized implementation +assembler; +{$asmMode intel} +asm + xor rax, rax // ensure result is not wrong + // due to any residue + + test x, x // x ≟ 0 + setnz al // al ≔ ¬ZF + + sar x, 63 // propagate sign-bit through reg. + cmovs rax, x // if SF then rax ≔ −1 +end; +{$else} // ========================== default implementation +begin + // This is what math.sign virtually does. + // The compiled code requires _two_ cmp instructions, though. + if x > 0 then + begin + signum := 1; + end + else if x < 0 then + begin + signum := -1; + end + else + begin + signum := 0; + end; +end; +{$endIf} + +// M A I N ================================================= +var + x: longint; +begin + readLn(x); + writeLn(signum(x)); +end. + +---------------------------------------------------- + +[ + ["keyword", "program"], + " asmDemo", + ["punctuation", "("], + "input", + ["punctuation", ","], + " output", + ["punctuation", ","], + " stderr", + ["punctuation", ")"], + ["punctuation", ";"], + + ["comment", "// The $asmMode directive informs the compiler"], + ["comment", "// which syntax is used in asm-blocks."], + ["comment", "// Alternatives are 'att' (AT&T syntax) and 'direct'."], + ["directive", "{$asmMode intel}"], + + ["keyword", "var"], + + "\n\tn", + ["punctuation", ","], + " m", + ["punctuation", ":"], + " longint", + ["punctuation", ";"], + + ["keyword", "begin"], + + "\n\tn ", + ["operator", ":="], + ["number", "42"], + ["punctuation", ";"], + + "\n\tm ", + ["operator", ":="], + ["operator", "-"], + ["number", "7"], + ["punctuation", ";"], + + "\n\twriteLn", + ["punctuation", "("], + ["string", "'n = '"], + ["punctuation", ","], + " n", + ["punctuation", ","], + ["string", "'; m = '"], + ["punctuation", ","], + " m", + ["punctuation", ")"], + ["punctuation", ";"], + + ["comment", "// instead of declaring another temporary variable"], + + ["comment", "// and writing \"tmp := n; n := m; m := tmp;\":"], + + ["keyword", "asm"], + ["asm", [ + "\n\t\tmov eax", + ["punctuation", ","], + " n ", + ["comment", "// eax := n"], + + ["comment", "// xchg can only operate at most on one memory address"], + + "\n\t\txchg eax", + ["punctuation", ","], + " m ", + ["comment", "// swaps values in eax and at m"], + + "\n\t\tmov n", + ["punctuation", ","], + " eax ", + ["comment", "// n := eax (holding the former m value)"], + + ["comment", "// an array of strings after the asm-block closing 'end'"], + + ["comment", "// tells the compiler which registers have changed"], + + ["comment", "// (you don't wanna mess with the compiler's notion"], + + ["comment", "// which registers mean what)"] + ]], + ["keyword", "end"], + ["punctuation", "["], + ["string", "'eax'"], + ["punctuation", "]"], + ["punctuation", ";"], + + "\n\n\twriteLn", + ["punctuation", "("], + ["string", "'n = '"], + ["punctuation", ","], + " n", + ["punctuation", ","], + ["string", "'; m = '"], + ["punctuation", ","], + " m", + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "end"], + ["punctuation", "."], + + ["keyword", "program"], + " sign", + ["punctuation", "("], + "input", + ["punctuation", ","], + " output", + ["punctuation", ","], + " stderr", + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "type"], + + "\n\tsignumCodomain ", + ["operator", "="], + ["operator", "-"], + ["number", "1"], + ["operator", ".."], + ["number", "1"], + ["punctuation", ";"], + + ["comment", "{ returns the sign of an integer }"], + + ["keyword", "function"], + " signum", + ["punctuation", "("], + ["directive", "{$ifNDef CPUx86_64}"], + ["keyword", "const"], + ["directive", "{$endIf}"], + " x", + ["punctuation", ":"], + " longint", + ["punctuation", ")"], + ["punctuation", ":"], + " signumCodomain", + ["punctuation", ";"], + + ["directive", "{$ifDef CPUx86_64}"], + ["comment", "// ============= optimized implementation"], + + ["keyword", "assembler"], + ["punctuation", ";"], + + ["directive", "{$asmMode intel}"], + + ["keyword", "asm"], + ["asm", [ + "\n\txor rax", + ["punctuation", ","], + " rax ", + ["comment", "// ensure result is not wrong"], + + ["comment", "// due to any residue"], + + "\n\n\ttest x", + ["punctuation", ","], + " x ", + ["comment", "// x ≟ 0"], + + "\n\tsetnz al ", + ["comment", "// al ≔ ¬ZF"], + + "\n\n\tsar x", + ["punctuation", ","], + ["number", "63"], + ["comment", "// propagate sign-bit through reg."], + + "\n\tcmovs rax", + ["punctuation", ","], + " x ", + ["comment", "// if SF then rax ≔ −1"] + ]], + ["keyword", "end"], + ["punctuation", ";"], + + ["directive", "{$else}"], + ["comment", "// ========================== default implementation"], + + ["keyword", "begin"], + + ["comment", "// This is what math.sign virtually does."], + + ["comment", "// The compiled code requires _two_ cmp instructions, though."], + + ["keyword", "if"], + " x ", + ["operator", ">"], + ["number", "0"], + ["keyword", "then"], + + ["keyword", "begin"], + + "\n\t\tsignum ", + ["operator", ":="], + ["number", "1"], + ["punctuation", ";"], + + ["keyword", "end"], + + ["keyword", "else"], + ["keyword", "if"], + " x ", + ["operator", "<"], + ["number", "0"], + ["keyword", "then"], + + ["keyword", "begin"], + + "\n\t\tsignum ", + ["operator", ":="], + ["operator", "-"], + ["number", "1"], + ["punctuation", ";"], + + ["keyword", "end"], + + ["keyword", "else"], + + ["keyword", "begin"], + + "\n\t\tsignum ", + ["operator", ":="], + ["number", "0"], + ["punctuation", ";"], + + ["keyword", "end"], + ["punctuation", ";"], + + ["keyword", "end"], + ["punctuation", ";"], + + ["directive", "{$endIf}"], + + ["comment", "// M A I N ================================================="], + + ["keyword", "var"], + + "\n\tx", + ["punctuation", ":"], + " longint", + ["punctuation", ";"], + + ["keyword", "begin"], + + "\n\treadLn", + ["punctuation", "("], + "x", + ["punctuation", ")"], + ["punctuation", ";"], + + "\n\twriteLn", + ["punctuation", "("], + "signum", + ["punctuation", "("], + "x", + ["punctuation", ")"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "end"], + ["punctuation", "."] +] diff --git a/package/src/prism/tests/languages/pascal/comment_feature.test b/package/src/prism/tests/languages/pascal/comment_feature.test new file mode 100644 index 00000000..8254e123 --- /dev/null +++ b/package/src/prism/tests/languages/pascal/comment_feature.test @@ -0,0 +1,23 @@ +(* foo *) +(* foo +bar *) +{ foo } +{ foo +bar } +// +// foobar + +---------------------------------------------------- + +[ + ["comment", "(* foo *)"], + ["comment", "(* foo\nbar *)"], + ["comment", "{ foo }"], + ["comment", "{ foo\nbar }"], + ["comment", "//"], + ["comment", "// foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pascal/directive_feature.test b/package/src/prism/tests/languages/pascal/directive_feature.test new file mode 100644 index 00000000..68b85d22 --- /dev/null +++ b/package/src/prism/tests/languages/pascal/directive_feature.test @@ -0,0 +1,12 @@ +{$ASSERTIONS} +{$asmMode intel} +{$ifDef CPUx86_64} // ============= optimized implementation + +---------------------------------------------------- + +[ + ["directive", "{$ASSERTIONS}"], + ["directive", "{$asmMode intel}"], + ["directive", "{$ifDef CPUx86_64}"], + ["comment", "// ============= optimized implementation"] +] diff --git a/package/src/prism/tests/languages/pascal/keyword_feature.test b/package/src/prism/tests/languages/pascal/keyword_feature.test new file mode 100644 index 00000000..a4e4af66 --- /dev/null +++ b/package/src/prism/tests/languages/pascal/keyword_feature.test @@ -0,0 +1,143 @@ +absolute array asm +begin case const +constructor +destructor +do downto else +end file for +function goto +if implementation +inherited inline +interface label +nil object of +operator packed +procedure program +record reintroduce +repeat self +set string then +to type unit +until uses var +while with + +dispose exit false +new true + +class dispinterface +except exports +finalization +finally +initialization +inline library +on out packed +property raise +resourcestring +threadvar try + +absolute abstract +alias assembler +bitpacked break +cdecl continue +cppdecl cvar +default deprecated +dynamic enumerator +experimental +export external +far far16 +forward generic +helper implements +index interrupt +iochecks local +message name near +nodefault noreturn +nostackframe +oldfpccall +otherwise +overload override +pascal platform +private protected +public published +read register +reintroduce result +safecall saveregisters +softfloat specialize +static stdcall +stored strict +unaligned +unimplemented +varargs virtual +write + +---------------------------------------------------- + +[ + ["keyword", "absolute"], ["keyword", "array"], ["keyword", "asm"], + ["keyword", "begin"], ["keyword", "case"], ["keyword", "const"], + ["keyword", "constructor"], + ["keyword", "destructor"], + ["keyword", "do"], ["keyword", "downto"], ["keyword", "else"], + ["keyword", "end"], ["keyword", "file"], ["keyword", "for"], + ["keyword", "function"], ["keyword", "goto"], + ["keyword", "if"], ["keyword", "implementation"], + ["keyword", "inherited"], ["keyword", "inline"], + ["keyword", "interface"], ["keyword", "label"], + ["keyword", "nil"], ["keyword", "object"], ["keyword", "of"], + ["keyword", "operator"], ["keyword", "packed"], + ["keyword", "procedure"], ["keyword", "program"], + ["keyword", "record"], ["keyword", "reintroduce"], + ["keyword", "repeat"], ["keyword", "self"], + ["keyword", "set"], ["keyword", "string"], ["keyword", "then"], + ["keyword", "to"], ["keyword", "type"], ["keyword", "unit"], + ["keyword", "until"], ["keyword", "uses"], ["keyword", "var"], + ["keyword", "while"], ["keyword", "with"], + + ["keyword", "dispose"], ["keyword", "exit"], ["keyword", "false"], + ["keyword", "new"], ["keyword", "true"], + + ["keyword", "class"], ["keyword", "dispinterface"], + ["keyword", "except"], ["keyword", "exports"], + ["keyword", "finalization"], + ["keyword", "finally"], + ["keyword", "initialization"], + ["keyword", "inline"], ["keyword", "library"], + ["keyword", "on"], ["keyword", "out"], ["keyword", "packed"], + ["keyword", "property"], ["keyword", "raise"], + ["keyword", "resourcestring"], + ["keyword", "threadvar"], ["keyword", "try"], + + ["keyword", "absolute"], ["keyword", "abstract"], + ["keyword", "alias"], ["keyword", "assembler"], + ["keyword", "bitpacked"], ["keyword", "break"], + ["keyword", "cdecl"], ["keyword", "continue"], + ["keyword", "cppdecl"], ["keyword", "cvar"], + ["keyword", "default"], ["keyword", "deprecated"], + ["keyword", "dynamic"], ["keyword", "enumerator"], + ["keyword", "experimental"], + ["keyword", "export"], ["keyword", "external"], + ["keyword", "far"], ["keyword", "far16"], + ["keyword", "forward"], ["keyword", "generic"], + ["keyword", "helper"], ["keyword", "implements"], + ["keyword", "index"], ["keyword", "interrupt"], + ["keyword", "iochecks"], ["keyword", "local"], + ["keyword", "message"], ["keyword", "name"], ["keyword", "near"], + ["keyword", "nodefault"], ["keyword", "noreturn"], + ["keyword", "nostackframe"], + ["keyword", "oldfpccall"], + ["keyword", "otherwise"], + ["keyword", "overload"], ["keyword", "override"], + ["keyword", "pascal"], ["keyword", "platform"], + ["keyword", "private"], ["keyword", "protected"], + ["keyword", "public"], ["keyword", "published"], + ["keyword", "read"], ["keyword", "register"], + ["keyword", "reintroduce"], ["keyword", "result"], + ["keyword", "safecall"], ["keyword", "saveregisters"], + ["keyword", "softfloat"], ["keyword", "specialize"], + ["keyword", "static"], ["keyword", "stdcall"], + ["keyword", "stored"], ["keyword", "strict"], + ["keyword", "unaligned"], + ["keyword", "unimplemented"], + ["keyword", "varargs"], ["keyword", "virtual"], + ["keyword", "write"] +] + +---------------------------------------------------- + +Checks for all keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pascal/number_feature.test b/package/src/prism/tests/languages/pascal/number_feature.test new file mode 100644 index 00000000..e9e41b66 --- /dev/null +++ b/package/src/prism/tests/languages/pascal/number_feature.test @@ -0,0 +1,25 @@ +42 +3.14159 +2.1e4 +1.0e-1 +3.8e+24 +$7aff +&17 +%11110101 + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "2.1e4"], + ["number", "1.0e-1"], + ["number", "3.8e+24"], + ["number", "$7aff"], + ["number", "&17"], + ["number", "%11110101"] +] + +---------------------------------------------------- + +Checks for decimal, hexadecimal, octal and binary numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pascal/operator_feature.test b/package/src/prism/tests/languages/pascal/operator_feature.test new file mode 100644 index 00000000..01cbc818 --- /dev/null +++ b/package/src/prism/tests/languages/pascal/operator_feature.test @@ -0,0 +1,31 @@ +.. ** := +< << <= > >> >= ++ - * / ++= -= *= /= +@ ^ = + +and as div +exclude in +include is +mod not or +shl shr xor + +---------------------------------------------------- + +[ + ["operator", ".."], ["operator", "**"], ["operator", ":="], + ["operator", "<"], ["operator", "<<"], ["operator", "<="], ["operator", ">"], ["operator", ">>"], ["operator", ">="], + ["operator", "+"], ["operator", "-"], ["operator", "*"], ["operator", "/"], + ["operator", "+="], ["operator", "-="], ["operator", "*="], ["operator", "/="], + ["operator", "@"], ["operator", "^"], ["operator", "="], + + ["operator", "and"], ["operator", "as"], ["operator", "div"], + ["operator", "exclude"], ["operator", "in"], + ["operator", "include"], ["operator", "is"], + ["operator", "mod"], ["operator", "not"], ["operator", "or"], + ["operator", "shl"], ["operator", "shr"], ["operator", "xor"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pascal/string_feature.test b/package/src/prism/tests/languages/pascal/string_feature.test new file mode 100644 index 00000000..c2b02c26 --- /dev/null +++ b/package/src/prism/tests/languages/pascal/string_feature.test @@ -0,0 +1,21 @@ +'' +'fo''o' +^G +#7 +#$f4 +'foo'#9'bar' + +---------------------------------------------------- + +[ + ["string", "''"], + ["string", "'fo''o'"], + ["string", "^G"], + ["string", "#7"], + ["string", "#$f4"], + ["string", "'foo'#9'bar'"] +] + +---------------------------------------------------- + +Checks for strings and chars. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pascaligo/boolean_feature.test b/package/src/prism/tests/languages/pascaligo/boolean_feature.test new file mode 100644 index 00000000..d68fb383 --- /dev/null +++ b/package/src/prism/tests/languages/pascaligo/boolean_feature.test @@ -0,0 +1,11 @@ +True False + +---------------------------------------------------- + +[ + ["boolean", "True"], ["boolean", "False"] +] + +---------------------------------------------------- + +Checks for all booleans. diff --git a/package/src/prism/tests/languages/pascaligo/builtin_feature.test b/package/src/prism/tests/languages/pascaligo/builtin_feature.test new file mode 100644 index 00000000..900b14f6 --- /dev/null +++ b/package/src/prism/tests/languages/pascaligo/builtin_feature.test @@ -0,0 +1,15 @@ +int unit +string nat map +list record bool + +---------------------------------------------------- + +[ + ["builtin", "int"], ["builtin", "unit"], + ["builtin", "string"], ["builtin", "nat"], ["builtin", "map"], + ["builtin", "list"], ["builtin", "record"], ["builtin", "bool"] +] + +---------------------------------------------------- + +Checks for builtins. diff --git a/package/src/prism/tests/languages/pascaligo/class-name_feature.test b/package/src/prism/tests/languages/pascaligo/class-name_feature.test new file mode 100644 index 00000000..8b5ee2b5 --- /dev/null +++ b/package/src/prism/tests/languages/pascaligo/class-name_feature.test @@ -0,0 +1,42 @@ +type storage is int + +function add (const store : storage; const delta : int) : storage is store + delta + +---------------------------------------------------- + +[ + ["keyword", "type"], + ["class-name", [ + "storage" + ]], + ["keyword", "is"], + ["class-name", [ + ["builtin", "int"] + ]], + + ["keyword", "function"], + ["function", "add"], + ["punctuation", "("], + ["keyword", "const"], + " store ", + ["punctuation", ":"], + ["class-name", [ + "storage" + ]], + ["punctuation", ";"], + ["keyword", "const"], + " delta ", + ["punctuation", ":"], + ["class-name", [ + ["builtin", "int"] + ]], + ["punctuation", ")"], + ["punctuation", ":"], + ["class-name", [ + "storage" + ]], + ["keyword", "is"], + " store ", + ["operator", "+"], + " delta" +] diff --git a/package/src/prism/tests/languages/pascaligo/comment_feature.test b/package/src/prism/tests/languages/pascaligo/comment_feature.test new file mode 100644 index 00000000..26df447f --- /dev/null +++ b/package/src/prism/tests/languages/pascaligo/comment_feature.test @@ -0,0 +1,18 @@ +(* foo *) +(* foo +bar *) +// +// foobar + +---------------------------------------------------- + +[ + ["comment", "(* foo *)"], + ["comment", "(* foo\nbar *)"], + ["comment", "//"], + ["comment", "// foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pascaligo/function_feature.test b/package/src/prism/tests/languages/pascaligo/function_feature.test new file mode 100644 index 00000000..0d134c70 --- /dev/null +++ b/package/src/prism/tests/languages/pascaligo/function_feature.test @@ -0,0 +1,23 @@ +somefunc() +some_func() +somefunc42() + +---------------------------------------------------- + +[ + ["function", "somefunc"], + ["punctuation", "("], + ["punctuation", ")"], + + ["function", "some_func"], + ["punctuation", "("], + ["punctuation", ")"], + + ["function", "somefunc42"], + ["punctuation", "("], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pascaligo/keyword_feature.test b/package/src/prism/tests/languages/pascaligo/keyword_feature.test new file mode 100644 index 00000000..5e8b027c --- /dev/null +++ b/package/src/prism/tests/languages/pascaligo/keyword_feature.test @@ -0,0 +1,29 @@ +if while for +return nil +remove +from else +then skip +with; is function +var +const type +end begin block +case of + +---------------------------------------------------- + +[ + ["keyword", "if"], ["keyword", "while"], ["keyword", "for"], + ["keyword", "return"], ["keyword", "nil"], + ["keyword", "remove"], + ["keyword", "from"], ["keyword", "else"], + ["keyword", "then"], ["keyword", "skip"], + ["keyword", "with"], ["punctuation", ";"], ["keyword", "is"], ["keyword", "function"], + ["keyword", "var"], + ["keyword", "const"], ["keyword", "type"], + ["keyword", "end"], ["keyword", "begin"], ["keyword", "block"], + ["keyword", "case"], ["keyword", "of"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/pascaligo/number_feature.test b/package/src/prism/tests/languages/pascaligo/number_feature.test new file mode 100644 index 00000000..287710cc --- /dev/null +++ b/package/src/prism/tests/languages/pascaligo/number_feature.test @@ -0,0 +1,31 @@ +42 +3.14159 +2.1e4 +1.0e-1 +3.8e+24 +$7aff +&17 +%11110101 + +123n +123mtz + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "2.1e4"], + ["number", "1.0e-1"], + ["number", "3.8e+24"], + ["number", "$7aff"], + ["number", "&17"], + ["number", "%11110101"], + + ["number", "123n"], + ["number", "123mtz"] +] + +---------------------------------------------------- + +Checks for decimal, hexadecimal, octal and binary numbers. diff --git a/package/src/prism/tests/languages/pascaligo/operator_feature.test b/package/src/prism/tests/languages/pascaligo/operator_feature.test new file mode 100644 index 00000000..f6c2a39d --- /dev/null +++ b/package/src/prism/tests/languages/pascaligo/operator_feature.test @@ -0,0 +1,25 @@ +.. ** := +< << <= > >> >= ++ - * / ++= -= *= /= +@ ^ = =/= +-> | + +mod and or + +---------------------------------------------------- + +[ + ["operator", ".."], ["operator", "**"], ["operator", ":="], + ["operator", "<"], ["operator", "<<"], ["operator", "<="], ["operator", ">"], ["operator", ">>"], ["operator", ">="], + ["operator", "+"], ["operator", "-"], ["operator", "*"], ["operator", "/"], + ["operator", "+="], ["operator", "-="], ["operator", "*="], ["operator", "/="], + ["operator", "@"], ["operator", "^"], ["operator", "="], ["operator", "=/="], + ["operator", "->"], ["operator", "|"], + + ["operator", "mod"], ["operator", "and"], ["operator", "or"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/pascaligo/string_feature.test b/package/src/prism/tests/languages/pascaligo/string_feature.test new file mode 100644 index 00000000..c384ca35 --- /dev/null +++ b/package/src/prism/tests/languages/pascaligo/string_feature.test @@ -0,0 +1,28 @@ +'a' +'ä' +'本' +'\t' +'\xff' +'\u12e4' + +"日本語" +"\xff\u00FF" + +---------------------------------------------------- + +[ + ["string", "'a'"], + ["string", "'ä'"], + ["string", "'本'"], + ["string", "'\\t'"], + ["string", "'\\xff'"], + ["string", "'\\u12e4'"], + + + ["string", "\"日本語\""], + ["string", "\"\\xff\\u00FF\""] +] + +---------------------------------------------------- + +Checks for runes and strings. diff --git a/package/src/prism/tests/languages/pcaxis/boolean_feature.test b/package/src/prism/tests/languages/pcaxis/boolean_feature.test new file mode 100644 index 00000000..2c77d3f9 --- /dev/null +++ b/package/src/prism/tests/languages/pcaxis/boolean_feature.test @@ -0,0 +1,13 @@ +YES +NO + +---------------------------------------------------- + +[ + ["boolean", "YES"], + ["boolean", "NO"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/pcaxis/keyword_feature.test b/package/src/prism/tests/languages/pcaxis/keyword_feature.test new file mode 100644 index 00000000..c5c6bf8f --- /dev/null +++ b/package/src/prism/tests/languages/pcaxis/keyword_feature.test @@ -0,0 +1,76 @@ +FOO=0; +FOO[en]=1; +FOO("param")=0; +FOO("param1","param2")=0; +FOO-BAR[en]("param1","param2")=1; + +---------------------------------------------------- + +[ + ["keyword", [ + ["keyword", "FOO"] + ]], + ["operator", "="], + ["number", "0"], + ["punctuation", ";"], + ["keyword", [ + ["keyword", "FOO"], + ["language", [ + ["punctuation", "["], + ["property", "en"], + ["punctuation", "]"] + ]] + ]], + ["operator", "="], + ["number", "1"], + ["punctuation", ";"], + + ["keyword", [ + ["keyword", "FOO"], + ["sub-key", [ + ["punctuation", "("], + ["parameter", "\"param\""], + ["punctuation", ")"] + ]] + ]], + ["operator", "="], + ["number", "0"], + ["punctuation", ";"], + + ["keyword", [ + ["keyword", "FOO"], + ["sub-key", [ + ["punctuation", "("], + ["parameter", "\"param1\""], + ["punctuation", ","], + ["parameter", "\"param2\""], + ["punctuation", ")"] + ]] + ]], + ["operator", "="], + ["number", "0"], + ["punctuation", ";"], + + ["keyword", [ + ["keyword", "FOO-BAR"], + ["language", [ + ["punctuation", "["], + ["property", "en"], + ["punctuation", "]"] + ]], + ["sub-key", [ + ["punctuation", "("], + ["parameter", "\"param1\""], + ["punctuation", ","], + ["parameter", "\"param2\""], + ["punctuation", ")"] + ]] + ]], + ["operator", "="], + ["number", "1"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/pcaxis/number_feature.test b/package/src/prism/tests/languages/pcaxis/number_feature.test new file mode 100644 index 00000000..898b383d --- /dev/null +++ b/package/src/prism/tests/languages/pcaxis/number_feature.test @@ -0,0 +1,17 @@ +0 +123456789 +123.456 +0.123 + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "123456789"], + ["number", "123.456"], + ["number", "0.123"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/pcaxis/string_feature.test b/package/src/prism/tests/languages/pcaxis/string_feature.test new file mode 100644 index 00000000..f432e689 --- /dev/null +++ b/package/src/prism/tests/languages/pcaxis/string_feature.test @@ -0,0 +1,13 @@ +"foo ,; ()[] bar" +"" + +---------------------------------------------------- + +[ + ["string", "\"foo ,; ()[] bar\""], + ["string", "\"\""] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/pcaxis/tlist_feature.test b/package/src/prism/tests/languages/pcaxis/tlist_feature.test new file mode 100644 index 00000000..828a803e --- /dev/null +++ b/package/src/prism/tests/languages/pcaxis/tlist_feature.test @@ -0,0 +1,72 @@ +FOO=TLIST(A1),"bar","baz"; +FOO=TLIST(A1); +FOO=TLIST(A1,"bar","baz"); +FOO=TLIST(A1,"1"-"100"); + +---------------------------------------------------- + +[ + ["keyword", [ + ["keyword", "FOO"] + ]], + ["operator", "="], + ["tlist", [ + ["function", "TLIST"], + ["punctuation", "("], + ["property", "A1"], + ["punctuation", ")"] + ]], + ["punctuation", ","], + ["string", "\"bar\""], + ["punctuation", ","], + ["string", "\"baz\""], + ["punctuation", ";"], + + ["keyword", [ + ["keyword", "FOO"] + ]], + ["operator", "="], + ["tlist", [ + ["function", "TLIST"], + ["punctuation", "("], + ["property", "A1"], + ["punctuation", ")"] + ]], + ["punctuation", ";"], + + ["keyword", [ + ["keyword", "FOO"] + ]], + ["operator", "="], + ["tlist", [ + ["function", "TLIST"], + ["punctuation", "("], + ["property", "A1"], + ["punctuation", ","], + ["string", "\"bar\""], + ["punctuation", ","], + ["string", "\"baz\""], + ["punctuation", ")"] + ]], + ["punctuation", ";"], + + ["keyword", [ + ["keyword", "FOO"] + ]], + ["operator", "="], + ["tlist", [ + ["function", "TLIST"], + ["punctuation", "("], + ["property", "A1"], + ["punctuation", ","], + ["string", "\"1\""], + ["operator", "-"], + ["string", "\"100\""], + ["punctuation", ")"] + ]], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for TLIST. diff --git a/package/src/prism/tests/languages/peoplecode/boolean_feature.test b/package/src/prism/tests/languages/peoplecode/boolean_feature.test new file mode 100644 index 00000000..c653fdbe --- /dev/null +++ b/package/src/prism/tests/languages/peoplecode/boolean_feature.test @@ -0,0 +1,13 @@ +false +true + +---------------------------------------------------- + +[ + ["boolean", "false"], + ["boolean", "true"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/peoplecode/class-name_feature.test b/package/src/prism/tests/languages/peoplecode/class-name_feature.test new file mode 100644 index 00000000..aee33d50 --- /dev/null +++ b/package/src/prism/tests/languages/peoplecode/class-name_feature.test @@ -0,0 +1,264 @@ +class FactorialClass + method factorial(&I as number) returns number; +end-class; + +class Fruit + property number FruitCount; +end-class; + +class Banana extends Fruit + property number BananaCount; +end-class; + +local Banana &MyBanana = Create Banana(); +local Fruit &MyFruit = &MyBanana; /* okay, Banana is a subtype of Fruit */ +local number &Num = &MyBanana.BananaCount; + +/* generic building class */ +class BuildingAsset + method Acquire(); + method DisasterPrep(); +end-class; + +method Acquire + %This.DisasterPrep(); +end-method;method DisasterPrep + PrepareForFire(); +end-method; + +/* building in Vancouver */ +class VancouverBuilding extends BuildingAssetmethod DisasterPrep(); +end-class; + +method DisasterPrep + PrepareForEarthquake();%Super.DisasterPrep(); /* call superclass method */ +end-method; + +/* building in Edmonton */ +class EdmontonBuilding extends BuildingAssetmethod DisasterPrep(); +end-class; + +method DisasterPrep + PrepareForFreezing();%Super.DisasterPrep(); /* call superclass method */ +end-method; + +local BuildingAsset &Building = Create VancouverBuilding(); + +&Building.Acquire(); /* calls PrepareForEarthquake then PrepareForFire */ + +&Building = Create EdmontonBuilding(); + +&Building.Acquire(); /* calls PrepareForFreezing then PrepareForFire */ + +---------------------------------------------------- + +[ + ["keyword", "class"], + ["class-name", ["FactorialClass"]], + + ["keyword", "method"], + ["function-definition", "factorial"], + ["punctuation", "("], + "&I ", + ["keyword", "as"], + ["class-name", ["number"]], + ["punctuation", ")"], + ["keyword", "returns"], + ["class-name", ["number"]], + ["punctuation", ";"], + + ["keyword", "end-class"], + ["punctuation", ";"], + + ["keyword", "class"], + ["class-name", ["Fruit"]], + + ["keyword", "property"], + ["class-name", ["number"]], + " FruitCount", + ["punctuation", ";"], + + ["keyword", "end-class"], + ["punctuation", ";"], + + ["keyword", "class"], + ["class-name", ["Banana"]], + ["keyword", "extends"], + ["class-name", ["Fruit"]], + + ["keyword", "property"], + ["class-name", ["number"]], + " BananaCount", + ["punctuation", ";"], + + ["keyword", "end-class"], + ["punctuation", ";"], + + ["keyword", "local"], + ["class-name", ["Banana"]], + " &MyBanana ", + ["operator", "="], + ["keyword", "Create"], + ["class-name", ["Banana"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "local"], + ["class-name", ["Fruit"]], + " &MyFruit ", + ["operator", "="], + " &MyBanana", + ["punctuation", ";"], + ["comment", "/* okay, Banana is a subtype of Fruit */"], + + ["keyword", "local"], + ["class-name", ["number"]], + " &Num ", + ["operator", "="], + " &MyBanana", + ["punctuation", "."], + "BananaCount", + ["punctuation", ";"], + + ["comment", "/* generic building class */"], + + ["keyword", "class"], + ["class-name", ["BuildingAsset"]], + + ["keyword", "method"], + ["function-definition", "Acquire"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "method"], + ["function-definition", "DisasterPrep"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "end-class"], + ["punctuation", ";"], + + ["keyword", "method"], + ["function-definition", "Acquire"], + + ["variable", "%This"], + ["punctuation", "."], + ["function", "DisasterPrep"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "end-method"], + ["punctuation", ";"], + ["keyword", "method"], + ["function-definition", "DisasterPrep"], + + ["function", "PrepareForFire"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "end-method"], + ["punctuation", ";"], + + ["comment", "/* building in Vancouver */"], + + ["keyword", "class"], + ["class-name", ["VancouverBuilding"]], + ["keyword", "extends"], + ["class-name", ["BuildingAssetmethod"]], + ["function", "DisasterPrep"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "end-class"], + ["punctuation", ";"], + + ["keyword", "method"], + ["function-definition", "DisasterPrep"], + + ["function", "PrepareForEarthquake"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["variable", "%Super"], + ["punctuation", "."], + ["function", "DisasterPrep"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "/* call superclass method */"], + + ["keyword", "end-method"], + ["punctuation", ";"], + + ["comment", "/* building in Edmonton */"], + + ["keyword", "class"], + ["class-name", ["EdmontonBuilding"]], + ["keyword", "extends"], + ["class-name", ["BuildingAssetmethod"]], + ["function", "DisasterPrep"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "end-class"], + ["punctuation", ";"], + + ["keyword", "method"], + ["function-definition", "DisasterPrep"], + + ["function", "PrepareForFreezing"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["variable", "%Super"], + ["punctuation", "."], + ["function", "DisasterPrep"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "/* call superclass method */"], + + ["keyword", "end-method"], + ["punctuation", ";"], + + ["keyword", "local"], + ["class-name", ["BuildingAsset"]], + " &Building ", + ["operator", "="], + ["keyword", "Create"], + ["class-name", ["VancouverBuilding"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + "\n\n&Building", + ["punctuation", "."], + ["function", "Acquire"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "/* calls PrepareForEarthquake then PrepareForFire */"], + + "\n\n&Building ", + ["operator", "="], + ["keyword", "Create"], + ["class-name", ["EdmontonBuilding"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + "\n\n&Building", + ["punctuation", "."], + ["function", "Acquire"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "/* calls PrepareForFreezing then PrepareForFire */"] +] diff --git a/package/src/prism/tests/languages/peoplecode/comment_feature.test b/package/src/prism/tests/languages/peoplecode/comment_feature.test new file mode 100644 index 00000000..29ec5c11 --- /dev/null +++ b/package/src/prism/tests/languages/peoplecode/comment_feature.test @@ -0,0 +1,40 @@ +/* +comment +*/ + +REM comment; +REM comment +statement; + +<* +comment +*> + +<* +<* +comment +*> +*> + +/+ +comment ++/ + +---------------------------------------------------- + +[ + ["comment", "/*\ncomment\n*/"], + + ["comment", "REM comment;"], + ["comment", "REM comment\nstatement;"], + + ["comment", "<*\ncomment\n*>"], + + ["comment", "<*\n<*\ncomment\n*>\n*>"], + + ["comment", "/+\ncomment\n+/"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/peoplecode/function_feature.test b/package/src/prism/tests/languages/peoplecode/function_feature.test new file mode 100644 index 00000000..f3edb215 --- /dev/null +++ b/package/src/prism/tests/languages/peoplecode/function_feature.test @@ -0,0 +1,9 @@ +GetCurrEffRow() + +---------------------------------------------------- + +[ + ["function", "GetCurrEffRow"], + ["punctuation", "("], + ["punctuation", ")"] +] diff --git a/package/src/prism/tests/languages/peoplecode/keyword_feature.test b/package/src/prism/tests/languages/peoplecode/keyword_feature.test new file mode 100644 index 00000000..bcbe17ca --- /dev/null +++ b/package/src/prism/tests/languages/peoplecode/keyword_feature.test @@ -0,0 +1,123 @@ +abstract +alias +as; +catch; +class; +component; +constant; +create; +declare +else +end-class +end-evaluate +end-for +end-function +end-get +end-if +end-method +end-set +end-try +end-while +evaluate +extends; +for +function +get +global; +implements; +import +instance; +if +library +local; +method +null +of; +out +peopleCode +private +program +property; +protected +readonly +ref +repeat +return +returns; +set +step +then +throw +to +try +until +value +when +when-other +while + +---------------------------------------------------- + +[ + ["keyword", "abstract"], + ["keyword", "alias"], + ["keyword", "as"], ["punctuation", ";"], + ["keyword", "catch"], ["punctuation", ";"], + ["keyword", "class"], ["punctuation", ";"], + ["keyword", "component"], ["punctuation", ";"], + ["keyword", "constant"], ["punctuation", ";"], + ["keyword", "create"], ["punctuation", ";"], + ["keyword", "declare"], + ["keyword", "else"], + ["keyword", "end-class"], + ["keyword", "end-evaluate"], + ["keyword", "end-for"], + ["keyword", "end-function"], + ["keyword", "end-get"], + ["keyword", "end-if"], + ["keyword", "end-method"], + ["keyword", "end-set"], + ["keyword", "end-try"], + ["keyword", "end-while"], + ["keyword", "evaluate"], + ["keyword", "extends"], ["punctuation", ";"], + ["keyword", "for"], + ["keyword", "function"], + ["function-definition", "get"], + ["keyword", "global"], ["punctuation", ";"], + ["keyword", "implements"], ["punctuation", ";"], + ["keyword", "import"], + ["keyword", "instance"], ["punctuation", ";"], + ["keyword", "if"], + ["keyword", "library"], + ["keyword", "local"], ["punctuation", ";"], + ["keyword", "method"], + ["function-definition", "null"], + ["keyword", "of"], ["punctuation", ";"], + ["keyword", "out"], + ["keyword", "peopleCode"], + ["keyword", "private"], + ["keyword", "program"], + ["keyword", "property"], ["punctuation", ";"], + ["keyword", "protected"], + ["keyword", "readonly"], + ["keyword", "ref"], + ["keyword", "repeat"], + ["keyword", "return"], + ["keyword", "returns"], ["punctuation", ";"], + ["keyword", "set"], + ["keyword", "step"], + ["keyword", "then"], + ["keyword", "throw"], + ["keyword", "to"], + ["keyword", "try"], + ["keyword", "until"], + ["keyword", "value"], + ["keyword", "when"], + ["keyword", "when-other"], + ["keyword", "while"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/peoplecode/operator_feature.test b/package/src/prism/tests/languages/peoplecode/operator_feature.test new file mode 100644 index 00000000..6b29e584 --- /dev/null +++ b/package/src/prism/tests/languages/peoplecode/operator_feature.test @@ -0,0 +1,38 @@ ++ - * / ** +> >= < <= = != <> +| @ + +and or not +AND OR NOT + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "**"], + + ["operator", ">"], + ["operator", ">="], + ["operator", "<"], + ["operator", "<="], + ["operator", "="], + ["operator", "!="], + ["operator", "<>"], + + ["operator", "|"], + ["operator", "@"], + + ["operator-keyword", "and"], + ["operator-keyword", "or"], + ["operator-keyword", "not"], + ["operator-keyword", "AND"], + ["operator-keyword", "OR"], + ["operator-keyword", "NOT"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/peoplecode/string_feature.test b/package/src/prism/tests/languages/peoplecode/string_feature.test new file mode 100644 index 00000000..117a0a1e --- /dev/null +++ b/package/src/prism/tests/languages/peoplecode/string_feature.test @@ -0,0 +1,22 @@ +"" +"foo" +"""foo"" " + +'' +'foo' +'''foo' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foo\""], + ["string", "\"\"\"foo\"\" \""], + ["string", "''"], + ["string", "'foo'"], + ["string", "'''foo'"] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/perl/comment_feature.test b/package/src/prism/tests/languages/perl/comment_feature.test new file mode 100644 index 00000000..386c2edb --- /dev/null +++ b/package/src/prism/tests/languages/perl/comment_feature.test @@ -0,0 +1,17 @@ +=label foo +bar +=cut +# +# foobar + +---------------------------------------------------- + +[ + ["comment", "=label foo\nbar\n=cut"], + ["comment", "#"], + ["comment", "# foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/perl/filehandle_feature.test b/package/src/prism/tests/languages/perl/filehandle_feature.test new file mode 100644 index 00000000..67834c65 --- /dev/null +++ b/package/src/prism/tests/languages/perl/filehandle_feature.test @@ -0,0 +1,17 @@ +_ +<> + + + +---------------------------------------------------- + +[ + ["filehandle", "_"], + ["filehandle", "<>"], + ["filehandle", ""], + ["filehandle", ""] +] + +---------------------------------------------------- + +Checks for file handles. \ No newline at end of file diff --git a/package/src/prism/tests/languages/perl/function_feature.test b/package/src/prism/tests/languages/perl/function_feature.test new file mode 100644 index 00000000..b63e81c0 --- /dev/null +++ b/package/src/prism/tests/languages/perl/function_feature.test @@ -0,0 +1,13 @@ +sub foo +sub Foo_Bar42 + +---------------------------------------------------- + +[ + ["keyword", "sub"], ["function", "foo"], + ["keyword", "sub"], ["function", "Foo_Bar42"] +] + +---------------------------------------------------- + +Checks for functions. diff --git a/package/src/prism/tests/languages/perl/keyword_feature.test b/package/src/prism/tests/languages/perl/keyword_feature.test new file mode 100644 index 00000000..5094b202 --- /dev/null +++ b/package/src/prism/tests/languages/perl/keyword_feature.test @@ -0,0 +1,29 @@ +any break continue +default delete die +do else elsif eval +for foreach given +goto if last local +my next our package +print redo require +return say state sub +switch undef unless +until use when while + +---------------------------------------------------- + +[ + ["keyword", "any"], ["keyword", "break"], ["keyword", "continue"], + ["keyword", "default"], ["keyword", "delete"], ["keyword", "die"], + ["keyword", "do"], ["keyword", "else"], ["keyword", "elsif"], ["keyword", "eval"], + ["keyword", "for"], ["keyword", "foreach"], ["keyword", "given"], + ["keyword", "goto"], ["keyword", "if"], ["keyword", "last"], ["keyword", "local"], + ["keyword", "my"], ["keyword", "next"], ["keyword", "our"], ["keyword", "package"], + ["keyword", "print"], ["keyword", "redo"], ["keyword", "require"], + ["keyword", "return"], ["keyword", "say"], ["keyword", "state"], ["keyword", "sub"], + ["keyword", "switch"], ["keyword", "undef"], ["keyword", "unless"], + ["keyword", "until"], ["keyword", "use"], ["keyword", "when"], ["keyword", "while"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/perl/number_feature.test b/package/src/prism/tests/languages/perl/number_feature.test new file mode 100644 index 00000000..ddc5343e --- /dev/null +++ b/package/src/prism/tests/languages/perl/number_feature.test @@ -0,0 +1,33 @@ +0xFF +0xBad_Face + +0b1100 +0b1111_0000 + +42 +42_000 +3.14_15_9 +1.2e4 +1_423.6E-2 +0.8E+12 + +---------------------------------------------------- + +[ + ["number", "0xFF"], + ["number", "0xBad_Face"], + + ["number", "0b1100"], + ["number", "0b1111_0000"], + + ["number", "42"], + ["number", "42_000"], + ["number", "3.14_15_9"], + ["number", "1.2e4"], + ["number", "1_423.6E-2"], + ["number", "0.8E+12"] +] + +---------------------------------------------------- + +Checks for hexadecimal, binary and decimal numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/perl/operator_feature.test b/package/src/prism/tests/languages/perl/operator_feature.test new file mode 100644 index 00000000..c3c9f82a --- /dev/null +++ b/package/src/prism/tests/languages/perl/operator_feature.test @@ -0,0 +1,71 @@ +-r -w -x -o -R +-W -X -O -e -z +-s -f -d -l -p +-S -b -c -t -u +-g -k -T -B -M +-A -C + ++ ++ += +- -- -= -> +* ** *= **= +1 / 2 +1 // 2 +$a /= 2 +$a //= 2 += == =~ => +~ ~~ ~= +| || |= ||= +& && &= &&= +< <= << <<= <=> +> >= >> >>= +! !~ != +% %= +^ ^= +. .= .. ... +\ ? + +lt gt le ge +eq ne cmp not +and or xor +x x= + +---------------------------------------------------- + +[ + + ["operator", "-r"], ["operator", "-w"], ["operator", "-x"], ["operator", "-o"], ["operator", "-R"], + ["operator", "-W"], ["operator", "-X"], ["operator", "-O"], ["operator", "-e"], ["operator", "-z"], + ["operator", "-s"], ["operator", "-f"], ["operator", "-d"], ["operator", "-l"], ["operator", "-p"], + ["operator", "-S"], ["operator", "-b"], ["operator", "-c"], ["operator", "-t"], ["operator", "-u"], + ["operator", "-g"], ["operator", "-k"], ["operator", "-T"], ["operator", "-B"], ["operator", "-M"], + ["operator", "-A"], ["operator", "-C"], + + ["operator", "+"], ["operator", "++"], ["operator", "+="], + ["operator", "-"], ["operator", "--"], ["operator", "-="], ["operator", "->"], + ["operator", "*"], ["operator", "**"], ["operator", "*="], ["operator", "**="], + ["number", "1"], ["operator", "/"], ["number", "2"], + ["number", "1"], ["operator", "//"], ["number", "2"], + ["variable", "$a"], ["operator", "/="], ["number", "2"], + ["variable", "$a"], ["operator", "//="], ["number", "2"], + ["operator", "="], ["operator", "=="], ["operator", "=~"], ["operator", "=>"], + ["operator", "~"], ["operator", "~~"], ["operator", "~="], + ["operator", "|"], ["operator", "||"], ["operator", "|="], ["operator", "||="], + ["operator", "&"], ["operator", "&&"], ["operator", "&="], ["operator", "&&="], + ["operator", "<"], ["operator", "<="], ["operator", "<<"], ["operator", "<<="], ["operator", "<=>"], + ["operator", ">"], ["operator", ">="], ["operator", ">>"], ["operator", ">>="], + ["operator", "!"], ["operator", "!~"], ["operator", "!="], + ["operator", "%"], ["operator", "%="], + ["operator", "^"], ["operator", "^="], + ["operator", "."], ["operator", ".="], ["operator", ".."], ["operator", "..."], + ["operator", "\\"], ["operator", "?"], + + ["operator", "lt"], ["operator", "gt"], ["operator", "le"], ["operator", "ge"], + ["operator", "eq"], ["operator", "ne"], ["operator", "cmp"], ["operator", "not"], + ["operator", "and"], ["operator", "or"], ["operator", "xor"], + ["operator", "x"], ["operator", "x="] + +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/perl/regex_feature.test b/package/src/prism/tests/languages/perl/regex_feature.test new file mode 100644 index 00000000..a5cbb18b --- /dev/null +++ b/package/src/prism/tests/languages/perl/regex_feature.test @@ -0,0 +1,139 @@ +m// +qr!foo\!bar!msix +m,foo +bar,aa + +qr aa +m afoob\araaa +qr pfoo +barpxpn + +m()c +qr(foo\(\)bar)u +m(foo +bar)l + +qr{}d +m{foo\{\}bar} +qr{foo +bar} + +m[] +qr[foo\[\]bar] +m[foo +bar] + +qr<>s +mbar>i +qrx + +s/// +tr%foo\%bar%baz%c +y!foo +bar!foo +baz!d + +s kkkmsix +tr afoob\arab\azas +y pfoo +barpfoo +bazpr + +s()() +tr(foo\(bar)(ba\)z) +y(foo +bar)(foo +baz)csr + +s{}{} +tr{foo\{bar}{ba\}z} +y{foo +bar}{foo +baz} + +y[][] +s[foo\[bar][ba\]z]u +y[foo +bar][foo +baz] + +tr<><>c +ya> +s + +tr()<>c +y{foo\a] +s(foo +baz) + +// +/foo/gsx +/foo\/bar/n + +---------------------------------------------------- + +[ + ["regex", "m//"], + ["regex", "qr!foo\\!bar!msix"], + ["regex", "m,foo\nbar,aa"], + + ["regex", "qr aa"], + ["regex", "m afoob\\araaa"], + ["regex", "qr pfoo\nbarpxpn"], + + ["regex", "m()c"], + ["regex", "qr(foo\\(\\)bar)u"], + ["regex", "m(foo\nbar)l"], + + ["regex", "qr{}d"], + ["regex", "m{foo\\{\\}bar}"], + ["regex", "qr{foo\nbar}"], + + ["regex", "m[]"], + ["regex", "qr[foo\\[\\]bar]"], + ["regex", "m[foo\nbar]"], + + ["regex", "qr<>s"], + ["regex", "mbar>i"], + ["regex", "qrx"], + + ["regex", "s///"], + ["regex", "tr%foo\\%bar%baz%c"], + ["regex", "y!foo\nbar!foo\nbaz!d"], + + ["regex", "s kkkmsix"], + ["regex", "tr afoob\\arab\\azas"], + ["regex", "y pfoo\nbarpfoo\nbazpr"], + + ["regex", "s()()"], + ["regex", "tr(foo\\(bar)(ba\\)z)"], + ["regex", "y(foo\nbar)(foo\nbaz)csr"], + + ["regex", "s{}{}"], + ["regex", "tr{foo\\{bar}{ba\\}z}"], + ["regex", "y{foo\nbar}{foo\nbaz}"], + + ["regex", "y[][]"], + ["regex", "s[foo\\[bar][ba\\]z]u"], + ["regex", "y[foo\nbar][foo\nbaz]"], + + ["regex", "tr<><>c"], + ["regex", "ya>"], + ["regex", "s"], + + ["regex", "tr()<>c"], + ["regex", "y{foo\\a]"], + ["regex", "s(foo\nbaz)"], + + ["regex", "//"], + ["regex", "/foo/gsx"], + ["regex", "/foo\\/bar/n"] +] + +---------------------------------------------------- + +Checks for regex and regex quote-like operators. diff --git a/package/src/prism/tests/languages/perl/string_feature.test b/package/src/prism/tests/languages/perl/string_feature.test new file mode 100644 index 00000000..48a665f4 --- /dev/null +++ b/package/src/prism/tests/languages/perl/string_feature.test @@ -0,0 +1,130 @@ +q// +q/foobar/ +q/foo\/bar/ +q/foo +bar/ + +qq!! +qq!foobar! +qq!foo\!bar! +qq!foo +bar! + +qw__ +qx_foobar_ +qx_foo\_bar_ +qw_foo +bar_ + +qw?? +qw?foobar? +qw?foo\?bar? +qw?foo +bar? + +q aa +q afoob\ara +q 4foobar4 +q pfoo +barp + +qq() +qq(foobar) +qq(foo\(\)bar) +qq(foo +bar) + +qx{} +qx{foobar} +qx{foo\{\}bar} +qx{foo +bar} + +qw[] +qw[foobar] +qw[foo\[\]bar] +qw[foo +bar] + +q<> +q +qbar> +q + +"" +"foo\"bar" +"foo +bar" + +'' +'foo\'bar' + +`` +`foo\`bar` +`foo +bar` + +---------------------------------------------------- + +[ + ["string", "q//"], + ["string", "q/foobar/"], + ["string", "q/foo\\/bar/"], + ["string", "q/foo\nbar/"], + + ["string", "qq!!"], + ["string", "qq!foobar!"], + ["string", "qq!foo\\!bar!"], + ["string", "qq!foo\nbar!"], + + ["string", "qw__"], + ["string", "qx_foobar_"], + ["string", "qx_foo\\_bar_"], + ["string", "qw_foo\nbar_"], + + ["string", "qw??"], + ["string", "qw?foobar?"], + ["string", "qw?foo\\?bar?"], + ["string", "qw?foo\nbar?"], + + ["string", "q aa"], + ["string", "q afoob\\ara"], + ["string", "q 4foobar4"], + ["string", "q pfoo\nbarp"], + + ["string", "qq()"], + ["string", "qq(foobar)"], + ["string", "qq(foo\\(\\)bar)"], + ["string", "qq(foo\nbar)"], + + ["string", "qx{}"], + ["string", "qx{foobar}"], + ["string", "qx{foo\\{\\}bar}"], + ["string", "qx{foo\nbar}"], + + ["string", "qw[]"], + ["string", "qw[foobar]"], + ["string", "qw[foo\\[\\]bar]"], + ["string", "qw[foo\nbar]"], + + ["string", "q<>"], + ["string", "q"], + ["string", "qbar>"], + ["string", "q"], + + ["string", "\"\""], + ["string", "\"foo\\\"bar\""], + ["string", "\"foo\nbar\""], + + ["string", "''"], + ["string", "'foo\\'bar'"], + + ["string", "``"], + ["string", "`foo\\`bar`"], + ["string", "`foo\nbar`"] +] + +---------------------------------------------------- + +Checks for strings and quote operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/perl/v-string_feature.test b/package/src/prism/tests/languages/perl/v-string_feature.test new file mode 100644 index 00000000..5997adf0 --- /dev/null +++ b/package/src/prism/tests/languages/perl/v-string_feature.test @@ -0,0 +1,13 @@ +v1.2 +1.2.3 + +---------------------------------------------------- + +[ + ["v-string", "v1.2"], + ["v-string", "1.2.3"] +] + +---------------------------------------------------- + +Checks for v-strings. diff --git a/package/src/prism/tests/languages/perl/variable_feature.test b/package/src/prism/tests/languages/perl/variable_feature.test new file mode 100644 index 00000000..a4255fc7 --- /dev/null +++ b/package/src/prism/tests/languages/perl/variable_feature.test @@ -0,0 +1,54 @@ +$foo +$#foo + +${^POSTMATCH} + +${...} + +$^V + +@1 +$42 + +$$ +$_ +%! + +%'foo +$foo'bar + +$::::'foo +$foo::'bar + +---------------------------------------------------- + +[ + ["variable", "$foo"], + ["variable", "$#foo"], + + ["variable", "${^POSTMATCH}"], + + ["variable", "$"], + ["punctuation", "{"], + ["operator", "..."], + ["punctuation", "}"], + + ["variable", "$^V"], + + ["variable", "@1"], + ["variable", "$42"], + + ["variable", "$$"], + ["variable", "$_"], + ["variable", "%!"], + + ["variable", "%'foo"], + ["variable", "$foo'bar"], + + ["variable", "$::::'foo"], + ["variable", "$foo::'bar"] +] + +---------------------------------------------------- + +Checks for variables. diff --git a/package/src/prism/tests/languages/php!+css-extras/issue2008.test b/package/src/prism/tests/languages/php!+css-extras/issue2008.test new file mode 100644 index 00000000..f9bf42a2 --- /dev/null +++ b/package/src/prism/tests/languages/php!+css-extras/issue2008.test @@ -0,0 +1,39 @@ + + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["img"]], + ["attr-name", ["style"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["language-css", [ + ["property", "width"], + ["punctuation", ":"], + ["php", [ + ["delimiter", ""] + ]], + "%" + ]], + ["punctuation", "\""] + ]], + ["punctuation", "/>"] + ]] +] + +---------------------------------------------------- + +Checks for #2008 where a part of markup templating's placeholder was tokenized as `number` by CSS Extras. diff --git a/package/src/prism/tests/languages/php!+php-extras/global_feature.test b/package/src/prism/tests/languages/php!+php-extras/global_feature.test new file mode 100644 index 00000000..7c79c497 --- /dev/null +++ b/package/src/prism/tests/languages/php!+php-extras/global_feature.test @@ -0,0 +1,37 @@ +$GLOBALS +$_SERVER +$_GET +$_POST +$_FILES +$_REQUEST +$_SESSION +$_ENV +$_COOKIE +$php_errormsg +$HTTP_RAW_POST_DATA +$http_response_header +$argc +$argv + +---------------------------------------------------- + +[ + ["global", "$GLOBALS"], + ["global", "$_SERVER"], + ["global", "$_GET"], + ["global", "$_POST"], + ["global", "$_FILES"], + ["global", "$_REQUEST"], + ["global", "$_SESSION"], + ["global", "$_ENV"], + ["global", "$_COOKIE"], + ["global", "$php_errormsg"], + ["global", "$HTTP_RAW_POST_DATA"], + ["global", "$http_response_header"], + ["global", "$argc"], + ["global", "$argv"] +] + +---------------------------------------------------- + +Checks for superglobals. \ No newline at end of file diff --git a/package/src/prism/tests/languages/php!+php-extras/scope_feature.test b/package/src/prism/tests/languages/php!+php-extras/scope_feature.test new file mode 100644 index 00000000..5da40098 --- /dev/null +++ b/package/src/prism/tests/languages/php!+php-extras/scope_feature.test @@ -0,0 +1,35 @@ +static::foo() +self::bar() +parent::baz() + +---------------------------------------------------- + +[ + ["scope", [ + ["keyword", "static"], + ["punctuation", "::"] + ]], + ["function", ["foo"]], + ["punctuation", "("], + ["punctuation", ")"], + + ["scope", [ + ["keyword", "self"], + ["punctuation", "::"] + ]], + ["function", ["bar"]], + ["punctuation", "("], + ["punctuation", ")"], + + ["scope", [ + ["keyword", "parent"], + ["punctuation", "::"] + ]], + ["function", ["baz"]], + ["punctuation", "("], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for scopes. diff --git a/package/src/prism/tests/languages/php!+php-extras/this_feature.test b/package/src/prism/tests/languages/php!+php-extras/this_feature.test new file mode 100644 index 00000000..f63c3ca4 --- /dev/null +++ b/package/src/prism/tests/languages/php!+php-extras/this_feature.test @@ -0,0 +1,11 @@ +$this + +---------------------------------------------------- + +[ + ["this", "$this"] +] + +---------------------------------------------------- + +Checks for $this. \ No newline at end of file diff --git a/package/src/prism/tests/languages/php/argument-name_feature.test b/package/src/prism/tests/languages/php/argument-name_feature.test new file mode 100644 index 00000000..0f491c1b --- /dev/null +++ b/package/src/prism/tests/languages/php/argument-name_feature.test @@ -0,0 +1,45 @@ +foo( + a: 'bar', + qux: 'baz' +); + +foo(a: 'bar', qux: 'baz' ); + +---------------------------------------------------- + +[ + ["function", ["foo"]], + ["punctuation", "("], + + ["argument-name", "a"], + ["punctuation", ":"], + ["string", "'bar'"], + ["punctuation", ","], + + ["argument-name", "qux"], + ["punctuation", ":"], + ["string", "'baz'"], + + ["punctuation", ")"], + ["punctuation", ";"], + + + ["function", ["foo"]], + ["punctuation", "("], + + ["argument-name", "a"], + ["punctuation", ":"], + ["string", "'bar'"], + ["punctuation", ","], + + ["argument-name", "qux"], + ["punctuation", ":"], + ["string", "'baz'"], + + ["punctuation", ")"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for named arguments. diff --git a/package/src/prism/tests/languages/php/array_feature.test b/package/src/prism/tests/languages/php/array_feature.test new file mode 100644 index 00000000..f537f3d1 --- /dev/null +++ b/package/src/prism/tests/languages/php/array_feature.test @@ -0,0 +1,136 @@ +$a = [ + 1 => [0, 1], + 2 => [2, 3], + 3 => [ + [0, 1], + [2, 3] + ] +]; + +$b = array( + Array(1, 2) +); + +$c = [...$a, ...$b, [5, 6]]; + +$d = [0, 1] + [2]; + +[$e] = [2, 3]; + +$f[] = 3; + +$g['key'] = 3; + +---------------------------------------------------- + +[ + ["variable", "$a"], + ["operator", "="], + ["punctuation", "["], + ["number", "1"], + ["operator", "=>"], + ["punctuation", "["], + ["number", "0"], + ["punctuation", ","], + ["number", "1"], + ["punctuation", "]"], + ["punctuation", ","], + ["number", "2"], + ["operator", "=>"], + ["punctuation", "["], + ["number", "2"], + ["punctuation", ","], + ["number", "3"], + ["punctuation", "]"], + ["punctuation", ","], + ["number", "3"], + ["operator", "=>"], + ["punctuation", "["], + ["punctuation", "["], + ["number", "0"], + ["punctuation", ","], + ["number", "1"], + ["punctuation", "]"], + ["punctuation", ","], + ["punctuation", "["], + ["number", "2"], + ["punctuation", ","], + ["number", "3"], + ["punctuation", "]"], + ["punctuation", "]"], + ["punctuation", "]"], + ["punctuation", ";"], + + ["variable", "$b"], + ["operator", "="], + ["keyword", "array"], + ["punctuation", "("], + ["keyword", "Array"], + ["punctuation", "("], + ["number", "1"], + ["punctuation", ","], + ["number", "2"], + ["punctuation", ")"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["variable", "$c"], + ["operator", "="], + ["punctuation", "["], + ["operator", "..."], + ["variable", "$a"], + ["punctuation", ","], + ["operator", "..."], + ["variable", "$b"], + ["punctuation", ","], + ["punctuation", "["], + ["number", "5"], + ["punctuation", ","], + ["number", "6"], + ["punctuation", "]"], + ["punctuation", "]"], + ["punctuation", ";"], + + ["variable", "$d"], + ["operator", "="], + ["punctuation", "["], + ["number", "0"], + ["punctuation", ","], + ["number", "1"], + ["punctuation", "]"], + ["operator", "+"], + ["punctuation", "["], + ["number", "2"], + ["punctuation", "]"], + ["punctuation", ";"], + + ["punctuation", "["], + ["variable", "$e"], + ["punctuation", "]"], + ["operator", "="], + ["punctuation", "["], + ["number", "2"], + ["punctuation", ","], + ["number", "3"], + ["punctuation", "]"], + ["punctuation", ";"], + + ["variable", "$f"], + ["punctuation", "["], + ["punctuation", "]"], + ["operator", "="], + ["number", "3"], + ["punctuation", ";"], + + ["variable", "$g"], + ["punctuation", "["], + ["string", "'key'"], + ["punctuation", "]"], + ["operator", "="], + ["number", "3"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for arrays. \ No newline at end of file diff --git a/package/src/prism/tests/languages/php/attribute_feature.test b/package/src/prism/tests/languages/php/attribute_feature.test new file mode 100644 index 00000000..dab664eb --- /dev/null +++ b/package/src/prism/tests/languages/php/attribute_feature.test @@ -0,0 +1,383 @@ +// #[Foo] + +#[] + +#[ + // something ] + Foo, + /* something + else #[] */ + Bar + # shell comments aren't confusing at all in here +] + +#[Foo([0, 1])] + +#[ + Foo( + [ + 1 => [0, 1], + 2 => [2, 3], + 3 => [ + [0, 1], + [2, 3] + ] + ] + ) +] + +#[Foo] +#[Foo\Bar\Baz] +#[Route(Http::POST, '/products/create', 1)] +#[ + Http\Route(Http::POST, '/products/create', 1), + Foo\Bar\Baz, + AttributeFoo('value') +] + +#[A1(1), A1(2), A2(3)] +class Foo { + public function foo(#[A1(5)] $a, #[A1(6)] $b) { } +} + +$object = new #[A1(7)] class () {}; + +function foo( + #[Attribute] $param1, + $param2 +) {} + +$f1 = #[ExampleAttribute] function () {}; + +$ref = new \ReflectionFunction(#[A1] #[A2] function () { }); + +#[DeprecationReason('reason: ')] +function main() {} + +---------------------------------------------------- + +[ + ["comment", "// #[Foo]"], + + "\n\n#", ["punctuation", "["], ["punctuation", "]"], + + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["comment", "// something ]"], + ["attribute-class-name", "Foo"], ["punctuation", ","], + ["comment", "/* something\n\telse #[] */"], + ["attribute-class-name", "Bar"], + ["comment", "# shell comments aren't confusing at all in here"] + ]], + ["delimiter", "]"] + ]], + + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "Foo"], + ["punctuation", "("], + ["punctuation", "["], + ["number", "0"], + ["punctuation", ","], + ["number", "1"], + ["punctuation", "]"], + ["punctuation", ")"] + ]], + ["delimiter", "]"] + ]], + + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "Foo"], + ["punctuation", "("], + + ["punctuation", "["], + + ["number", "1"], + ["operator", "=>"], + ["punctuation", "["], + ["number", "0"], + ["punctuation", ","], + ["number", "1"], + ["punctuation", "]"], + ["punctuation", ","], + + ["number", "2"], + ["operator", "=>"], + ["punctuation", "["], + ["number", "2"], + ["punctuation", ","], + ["number", "3"], + ["punctuation", "]"], + ["punctuation", ","], + + ["number", "3"], + ["operator", "=>"], + ["punctuation", "["], + + ["punctuation", "["], + ["number", "0"], + ["punctuation", ","], + ["number", "1"], + ["punctuation", "]"], + ["punctuation", ","], + + ["punctuation", "["], + ["number", "2"], + ["punctuation", ","], + ["number", "3"], + ["punctuation", "]"], + + ["punctuation", "]"], + + ["punctuation", "]"], + + ["punctuation", ")"] + ]], + ["delimiter", "]"] + ]], + + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "Foo"] + ]], + ["delimiter", "]"] + ]], + + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", [ + "Foo", + ["punctuation", "\\"], + "Bar", + ["punctuation", "\\"], + "Baz" + ]] + ]], + ["delimiter", "]"] + ]], + + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "Route"], + ["punctuation", "("], + ["attribute-class-name", "Http"], + ["operator", "::"], + ["constant", "POST"], + ["punctuation", ","], + ["string", "'/products/create'"], + ["punctuation", ","], + ["number", "1"], + ["punctuation", ")"] + ]], + ["delimiter", "]"] + ]], + + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", [ + "Http", + ["punctuation", "\\"], + "Route" + ]], + ["punctuation", "("], + ["attribute-class-name", "Http"], + ["operator", "::"], + ["constant", "POST"], + ["punctuation", ","], + ["string", "'/products/create'"], + ["punctuation", ","], + ["number", "1"], + ["punctuation", ")"], + ["punctuation", ","], + + ["attribute-class-name", [ + "Foo", + ["punctuation", "\\"], + "Bar", + ["punctuation", "\\"], + "Baz" + ]], + ["punctuation", ","], + + ["attribute-class-name", "AttributeFoo"], + ["punctuation", "("], + ["string", "'value'"], + ["punctuation", ")"] + ]], + ["delimiter", "]"] + ]], + + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "A1"], + ["punctuation", "("], + ["number", "1"], + ["punctuation", ")"], + ["punctuation", ","], + ["attribute-class-name", "A1"], + ["punctuation", "("], + ["number", "2"], + ["punctuation", ")"], + ["punctuation", ","], + ["attribute-class-name", "A2"], + ["punctuation", "("], + ["number", "3"], + ["punctuation", ")"] + ]], + ["delimiter", "]"] + ]], + + ["keyword", "class"], + ["class-name-definition", "Foo"], + ["punctuation", "{"], + + ["keyword", "public"], + ["keyword", "function"], + ["function-definition", "foo"], + ["punctuation", "("], + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "A1"], + ["punctuation", "("], + ["number", "5"], + ["punctuation", ")"] + ]], + ["delimiter", "]"] + ]], + ["variable", "$a"], + ["punctuation", ","], + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "A1"], + ["punctuation", "("], + ["number", "6"], + ["punctuation", ")"] + ]], + ["delimiter", "]"] + ]], + ["variable", "$b"], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["punctuation", "}"], + + ["variable", "$object"], + ["operator", "="], + ["keyword", "new"], + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "A1"], + ["punctuation", "("], + ["number", "7"], + ["punctuation", ")"] + ]], + ["delimiter", "]"] + ]], + ["keyword", "class"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "function"], + ["function-definition", "foo"], + ["punctuation", "("], + + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "Attribute"] + ]], + ["delimiter", "]"] + ]], + ["variable", "$param1"], + ["punctuation", ","], + + ["variable", "$param2"], + + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["variable", "$f1"], + ["operator", "="], + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "ExampleAttribute"] + ]], + ["delimiter", "]"] + ]], + ["keyword", "function"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["variable", "$ref"], + ["operator", "="], + ["keyword", "new"], + ["class-name", [ + ["punctuation", "\\"], + "ReflectionFunction" + ]], + ["punctuation", "("], + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "A1"] + ]], + ["delimiter", "]"] + ]], + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "A2"] + ]], + ["delimiter", "]"] + ]], + ["keyword", "function"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["attribute", [ + ["delimiter", "#["], + ["attribute-content", [ + ["attribute-class-name", "DeprecationReason"], + ["punctuation", "("], + ["string", "'reason: '"], + ["punctuation", ")"] + ]], + ["delimiter", "]"] + ]], + + ["keyword", "function"], + ["function-definition", "main"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for attributes. diff --git a/package/src/prism/tests/languages/php/boolean_feature.test b/package/src/prism/tests/languages/php/boolean_feature.test new file mode 100644 index 00000000..e958594d --- /dev/null +++ b/package/src/prism/tests/languages/php/boolean_feature.test @@ -0,0 +1,17 @@ +FALSE +false +TRUE +true + +---------------------------------------------------- + +[ + ["constant", "FALSE"], + ["constant", "false"], + ["constant", "TRUE"], + ["constant", "true"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/php/class-name_feature.test b/package/src/prism/tests/languages/php/class-name_feature.test new file mode 100644 index 00000000..b0fbc62c --- /dev/null +++ b/package/src/prism/tests/languages/php/class-name_feature.test @@ -0,0 +1,235 @@ +public Foo $a; + +Foo::bar(); + +\Foo::bar(); + +\Package\Foo::bar(); + +function f(Foo $variable): Foo {} + +function f(\Foo $variable): \Foo {} + +function f(\Package\Foo $variable): \Package\Foo {} + +function f($variable): ?Foo {} + +function f(Foo|Bar $variable): Foo|Bar {} + +function f(Foo|false $variable): Foo|Bar {} +function f(Foo|null $variable): Foo|Bar {} + +function f(\Package\Foo|\Package\Bar $variable): \Package\Foo|\Package\Bar {} + +class Foo extends Bar implements Baz {} + +class Foo extends \Package\Bar implements App\Baz {} + +---------------------------------------------------- + +[ + ["keyword", "public"], + ["class-name", "Foo"], + ["variable", "$a"], + ["punctuation", ";"], + + ["class-name", "Foo"], + ["operator", "::"], + ["function", ["bar"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["class-name", [ + ["punctuation", "\\"], + "Foo" + ]], + ["operator", "::"], + ["function", ["bar"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["class-name", [ + ["punctuation", "\\"], + "Package", + ["punctuation", "\\"], + "Foo" + ]], + ["operator", "::"], + ["function", ["bar"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "function"], + ["function-definition", "f"], + ["punctuation", "("], + ["class-name", "Foo"], + ["variable", "$variable"], + ["punctuation", ")"], + ["punctuation", ":"], + ["class-name", "Foo"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "function"], + ["function-definition", "f"], + ["punctuation", "("], + ["class-name", [ + ["punctuation", "\\"], + "Foo" + ]], + ["variable", "$variable"], + ["punctuation", ")"], + ["punctuation", ":"], + ["class-name", [ + ["punctuation", "\\"], + "Foo" + ]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "function"], + ["function-definition", "f"], + ["punctuation", "("], + ["class-name", [ + ["punctuation", "\\"], + "Package", + ["punctuation", "\\"], + "Foo" + ]], + ["variable", "$variable"], + ["punctuation", ")"], + ["punctuation", ":"], + ["class-name", [ + ["punctuation", "\\"], + "Package", + ["punctuation", "\\"], + "Foo" + ]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "function"], + ["function-definition", "f"], + ["punctuation", "("], + ["variable", "$variable"], + ["punctuation", ")"], + ["punctuation", ":"], + ["operator", "?"], + ["class-name", "Foo"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "function"], + ["function-definition", "f"], + ["punctuation", "("], + ["class-name", "Foo"], + ["operator", "|"], + ["class-name", "Bar"], + ["variable", "$variable"], + ["punctuation", ")"], + ["punctuation", ":"], + ["class-name", "Foo"], + ["operator", "|"], + ["class-name", "Bar"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "function"], + ["function-definition", "f"], + ["punctuation", "("], + ["class-name", "Foo"], + ["operator", "|"], + ["keyword", "false"], + ["variable", "$variable"], + ["punctuation", ")"], + ["punctuation", ":"], + ["class-name", "Foo"], + ["operator", "|"], + ["class-name", "Bar"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "function"], + ["function-definition", "f"], + ["punctuation", "("], + ["class-name", "Foo"], + ["operator", "|"], + ["keyword", "null"], + ["variable", "$variable"], + ["punctuation", ")"], + ["punctuation", ":"], + ["class-name", "Foo"], + ["operator", "|"], + ["class-name", "Bar"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "function"], + ["function-definition", "f"], + ["punctuation", "("], + ["class-name", [ + ["punctuation", "\\"], + "Package", + ["punctuation", "\\"], + "Foo" + ]], + ["operator", "|"], + ["class-name", [ + ["punctuation", "\\"], + "Package", + ["punctuation", "\\"], + "Bar" + ]], + ["variable", "$variable"], + ["punctuation", ")"], + ["punctuation", ":"], + ["class-name", [ + ["punctuation", "\\"], + "Package", + ["punctuation", "\\"], + "Foo" + ]], + ["operator", "|"], + ["class-name", [ + ["punctuation", "\\"], + "Package", + ["punctuation", "\\"], + "Bar" + ]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "class"], + ["class-name-definition", "Foo"], + ["keyword", "extends"], + ["class-name", "Bar"], + ["keyword", "implements"], + ["class-name", "Baz"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "class"], + ["class-name-definition", "Foo"], + ["keyword", "extends"], + ["class-name", [ + ["punctuation", "\\"], + "Package", + ["punctuation", "\\"], + "Bar" + ]], + ["keyword", "implements"], + ["class-name", [ + "App", + ["punctuation", "\\"], + "Baz" + ]], + ["punctuation", "{"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for class names. diff --git a/package/src/prism/tests/languages/php/comment_feature.test b/package/src/prism/tests/languages/php/comment_feature.test new file mode 100644 index 00000000..ea4dc231 --- /dev/null +++ b/package/src/prism/tests/languages/php/comment_feature.test @@ -0,0 +1,26 @@ +// +// foobar +/* foo +bar */ +/* */ +/**/ +/** doc comment */ +# +# foobar + +---------------------------------------------------- + +[ + ["comment", "//"], + ["comment", "// foobar"], + ["comment", "/* foo\nbar */"], + ["comment", "/* */"], + ["comment", "/**/"], + ["doc-comment", "/** doc comment */"], + ["comment", "#"], + ["comment", "# foobar"] +] + +---------------------------------------------------- + +Checks for single-line and multi-line comments. diff --git a/package/src/prism/tests/languages/php/constant_feature.test b/package/src/prism/tests/languages/php/constant_feature.test new file mode 100644 index 00000000..a413f82e --- /dev/null +++ b/package/src/prism/tests/languages/php/constant_feature.test @@ -0,0 +1,73 @@ +null +_ +X +AZ +PRISM +FOOBAR_42 + +class Foo{ + const BAR = 1; + const baz = 2; +} + +Foo::BAR; +Foo::baz; + + +switch ($i) { + case NULL: + break; + case X: + break; +} + +---------------------------------------------------- + +[ + ["constant", "null"], + ["constant", "_"], + ["constant", "X"], + ["constant", "AZ"], + ["constant", "PRISM"], + ["constant", "FOOBAR_42"], + + ["keyword", "class"], + ["class-name-definition", "Foo"], + ["punctuation", "{"], + ["keyword", "const"], + ["constant", "BAR"], + ["operator", "="], + ["number", "1"], + ["punctuation", ";"], + ["keyword", "const"], + ["constant", "baz"], + ["operator", "="], + ["number", "2"], + ["punctuation", ";"], + ["punctuation", "}"], + + ["class-name", "Foo"], ["operator", "::"], ["constant", "BAR"], ["punctuation", ";"], + ["class-name", "Foo"], ["operator", "::"], ["constant", "baz"], ["punctuation", ";"], + + ["keyword", "switch"], + ["punctuation", "("], + ["variable", "$i"], + ["punctuation", ")"], + ["punctuation", "{"], + ["keyword", "case"], + ["constant", "NULL"], + ["punctuation", ":"], + ["keyword", "break"], + ["punctuation", ";"], + ["keyword", "case"], + ["constant", "X"], + ["punctuation", ":"], + ["keyword", "break"], + ["punctuation", ";"], + ["punctuation", "}"] + +] + +---------------------------------------------------- + +Checks for constants. \ No newline at end of file diff --git a/package/src/prism/tests/languages/php/delimiter_feature.test b/package/src/prism/tests/languages/php/delimiter_feature.test new file mode 100644 index 00000000..e9897038 --- /dev/null +++ b/package/src/prism/tests/languages/php/delimiter_feature.test @@ -0,0 +1,57 @@ + + + + +')] +function main() {} +// php is not ended yet +?> + +---------------------------------------------------- + +[ + ["php", [ + ["delimiter", ""] + ]], + ["php", [ + ["delimiter", ""] + ]], + ["php", [ + ["delimiter", ""] + ]], + + ["php", [ + ["delimiter", "'"], + ["punctuation", ")"] + ]], + ["delimiter", "]"] + ]], + + ["keyword", "function"], + ["function-definition", "main"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["comment", "// php is not ended yet"], + + ["delimiter", "?>"] + ]] +] + +---------------------------------------------------- + +Checks for delimiters. diff --git a/package/src/prism/tests/languages/php/enum_feature.test b/package/src/prism/tests/languages/php/enum_feature.test new file mode 100644 index 00000000..dda449df --- /dev/null +++ b/package/src/prism/tests/languages/php/enum_feature.test @@ -0,0 +1,52 @@ +enum Foo implements Bar {} + +enum Suit { + case Hearts; + case Diamonds = 'D'; +} + +$val = Suit::Diamonds; + +Suit::Spades->name; + +---------------------------------------------------- + +[ + ["keyword", "enum"], + ["class-name-definition", "Foo"], + ["keyword", "implements"], + ["class-name", "Bar"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "enum"], + ["class-name-definition", "Suit"], + ["punctuation", "{"], + ["keyword", "case"], + ["constant", "Hearts"], + ["punctuation", ";"], + ["keyword", "case"], + ["constant", "Diamonds"], + ["operator", "="], + ["string", "'D'"], + ["punctuation", ";"], + ["punctuation", "}"], + + ["variable", "$val"], + ["operator", "="], + ["class-name", "Suit"], + ["operator", "::"], + ["constant", "Diamonds"], + ["punctuation", ";"], + + ["class-name", "Suit"], + ["operator", "::"], + ["constant", "Spades"], + ["operator", "->"], + ["property", "name"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for enums. diff --git a/package/src/prism/tests/languages/php/function_feature.test b/package/src/prism/tests/languages/php/function_feature.test new file mode 100644 index 00000000..4e709279 --- /dev/null +++ b/package/src/prism/tests/languages/php/function_feature.test @@ -0,0 +1,170 @@ +class A { + function __call() {} +} + +$a = new A(); +$a->if(); // it's allowed to call a magic method with keyword since forever in PHP + +class A { + function if() {} // error before 7.0, allowed now +} + +$variable->foreach(); // this "foreach" is a method +$variable->method(); // this is also a method +$var->match() + +foreach ($list as $value) { // this "foreach" is a keyword +} + +Test::foreach(); // this is "foreach" static method +Test::method(); // this is "method" static method + +// The only exception: class +$variable->class(); // this "class" should be interpreted as "keyword" +Test::class; // This "class" should still be a keyword + +mb_string(); // call to a global function +\mb_string(); // namespace \ is global +\a\b\c\mb_string(); // function in \a\b\c namespace + +---------------------------------------------------- + +[ + ["keyword", "class"], + ["class-name-definition", "A"], + ["punctuation", "{"], + + ["keyword", "function"], + ["function-definition", "__call"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["punctuation", "}"], + + ["variable", "$a"], + ["operator", "="], + ["keyword", "new"], + ["class-name", "A"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["variable", "$a"], + ["operator", "->"], + ["function", ["if"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "// it's allowed to call a magic method with keyword since forever in PHP"], + + ["keyword", "class"], + ["class-name-definition", "A"], + ["punctuation", "{"], + + ["keyword", "function"], + ["function-definition", "if"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["comment", "// error before 7.0, allowed now"], + + ["punctuation", "}"], + + ["variable", "$variable"], + ["operator", "->"], + ["function", ["foreach"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "// this \"foreach\" is a method"], + + ["variable", "$variable"], + ["operator", "->"], + ["function", ["method"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "// this is also a method"], + + ["variable", "$var"], + ["operator", "->"], + ["function", ["match"]], + ["punctuation", "("], + ["punctuation", ")"], + + ["keyword", "foreach"], + ["punctuation", "("], + ["variable", "$list"], + ["keyword", "as"], + ["variable", "$value"], + ["punctuation", ")"], + ["punctuation", "{"], + ["comment", "// this \"foreach\" is a keyword"], + + ["punctuation", "}"], + + ["class-name", "Test"], + ["operator", "::"], + ["function", ["foreach"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "// this is \"foreach\" static method"], + + ["class-name", "Test"], + ["operator", "::"], + ["function", ["method"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "// this is \"method\" static method"], + + ["comment", "// The only exception: class"], + + ["variable", "$variable"], + ["operator", "->"], + ["keyword", "class"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "// this \"class\" should be interpreted as \"keyword\""], + + ["class-name", "Test"], + ["operator", "::"], + ["keyword", "class"], + ["punctuation", ";"], + ["comment", "// This \"class\" should still be a keyword"], + + ["function", ["mb_string"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "// call to a global function"], + + ["function", [ + ["punctuation", "\\"], + "mb_string" + ]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "// namespace \\ is global"], + + ["function", [ + ["punctuation", "\\"], + "a", + ["punctuation", "\\"], + "b", + ["punctuation", "\\"], + "c", + ["punctuation", "\\"], + "mb_string" + ]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["comment", "// function in \\a\\b\\c namespace"] +] diff --git a/package/src/prism/tests/languages/php/issue2156.test b/package/src/prism/tests/languages/php/issue2156.test new file mode 100644 index 00000000..4223d818 --- /dev/null +++ b/package/src/prism/tests/languages/php/issue2156.test @@ -0,0 +1,125 @@ +","",str_replace("'","",str_replace("[","",str_replace("]","",$_POST['txtCode']))))); + } + if (isset($_SESSION['CAPTCHA_RndText'])) { + $CAPTCHA_RandomText = $_SESSION['CAPTCHA_RndText']; + } + + // Eingabefelder abfragen + $_SESSION['company'] = $_POST['company']; + $_SESSION['name'] = $_POST['name']; + $_SESSION['address'] = $_POST['address']; + $_SESSION['zip_code'] = $_POST['zip_code']; + $_SESSION['city'] = $_POST['city']; + $_SESSION['county'] = $_POST['county']; + $_SESSION['country'] = $_POST['country']; + $_SESSION['phone'] = $_POST['phone']; + $_SESSION['fax'] = $_POST['fax']; + $_SESSION['email'] = $_POST['email']; + $_SESSION['nachricht'] = $_POST['nachricht']; + + $email_i = $_SESSION['email']; + + // Email Funktion + function pruefe_mail($email_i) { + if(strstr($email_i, "@")) { + $email_i = explode ("@", $email_i); + if(strstr($email_i[1], ".")) $ok = TRUE; + } + return $ok; + } + + // Eingaben prüfen + $fehler = ""; + if(!pruefe_mail($email_i) && !empty($email_i)) { + $fehler .= "
  • email
  • "; + } + if ($_SESSION['name'] == ""){ + $fehler .= "
  • name
  • "; + } + if ($_SESSION['city'] == ""){ + $fehler .= "
  • city
  • "; + } + if ($_SESSION['country'] == ""){ + $fehler .= "
  • country
  • "; + } + if ($_SESSION['phone'] == ""){ + $fehler .= "
  • phone
  • "; + } + if ($_SESSION['email'] == ""){ + $fehler .= "
  • email
  • "; + } + if ($_SESSION['message'] == ""){ + $fehler .= "
  • message
  • "; + } + if ($CAPTCHA_EnteredText == $CAPTCHA_RandomText and isset($_POST['txtCode']) == true and isset($_SESSION['CAPTCHA_RndText'])){ + $captcha = true; + } else { + $fehler .= "
  • code
  • "; + } + echo '
    '; + if ($fehler == ""){ + // Email zumsammensetzen + $email = "From: " . $_SESSION['email']; + + + $nachrichtfertig = + "Company: " . $_SESSION['company'] "n\" + "Name: " $_SESSION['name'] "n\" + "Address: " $_SESSION['address'] "n\" + "ZIP Code: " $_SESSION['zip_code'] "n\" + "City: " $_SESSION['city'] "n\" + "County: " $_SESSION['county'] "n\" + "Country: " $_SESSION['country'] "n\" + "Phone: " $_SESSION['phone'] "n\" + "Fax: " $_SESSION['fax'] "n\" + "eMail: " $_SESSION['email'] "n\n\" + "Message: " $_SESSION['message']; + + + $versand = mail($empfaenger, $betreff, $nachrichtfertig, $email); + if ($versand) { + echo '

    Thank you very much!

    +

    The message were send successfully

    '; + + // Sessionvariablen löschen + unset($_SESSION['company']); + unset($_SESSION['name']); + unset($_SESSION['address']); + unset($_SESSION['zip_code']); + unset($_SESSION['city']); + unset($_SESSION['county']); + unset($_SESSION['country']); + unset($_SESSION['phone']); + unset($_SESSION['fax']); + unset($_SESSION['email']); + unset($_SESSION['nachricht']); + } + + } else { + echo '

    Error

    '; + echo '

    Please fill in all the $fehler field. back

    '; + } + echo '
    '; + + // Session unset + unset($_SESSION['CAPTCHA_RndText']); + +?> + +---------------------------------------------------- + +[ + ["prolog", "\",\"\",str_replace(\"'\",\"\",str_replace(\"[\",\"\",str_replace(\"]\",\"\",$_POST['txtCode'])))));\n\t}\n\tif (isset($_SESSION['CAPTCHA_RndText'])) {\n\t$CAPTCHA_RandomText = $_SESSION['CAPTCHA_RndText'];\n\t}\n\n\t// Eingabefelder abfragen\n\t$_SESSION['company'] = $_POST['company'];\n\t$_SESSION['name'] = $_POST['name'];\n\t$_SESSION['address'] = $_POST['address'];\n\t$_SESSION['zip_code'] = $_POST['zip_code'];\n\t$_SESSION['city'] = $_POST['city'];\n\t$_SESSION['county'] = $_POST['county'];\n\t$_SESSION['country'] = $_POST['country'];\n\t$_SESSION['phone'] = $_POST['phone'];\n\t$_SESSION['fax'] = $_POST['fax'];\n\t$_SESSION['email'] = $_POST['email'];\n\t$_SESSION['nachricht'] = $_POST['nachricht'];\n\n\t$email_i = $_SESSION['email'];\n\n\t// Email Funktion\n\tfunction pruefe_mail($email_i) {\n\t\t if(strstr($email_i, \"@\")) {\n\t\t\t$email_i = explode (\"@\", $email_i);\n\t\t\tif(strstr($email_i[1], \".\")) $ok = TRUE;\n\t\t }\n\t\t return $ok;\n\t\t}\n\n\t// Eingaben prüfen\n\t$fehler = \"\";\n\tif(!pruefe_mail($email_i) && !empty($email_i)) {\n\t\t\t$fehler .= \"
  • email
  • \";\n\t\t\t}\n\t\t\tif ($_SESSION['name'] == \"\"){\n\t\t\t$fehler .= \"
  • name
  • \";\n\t\t\t}\n\t\t\tif ($_SESSION['city'] == \"\"){\n\t\t\t$fehler .= \"
  • city
  • \";\n\t\t\t}\n\t\t\tif ($_SESSION['country'] == \"\"){\n\t\t\t$fehler .= \"
  • country
  • \";\n\t\t\t}\n\t\t\tif ($_SESSION['phone'] == \"\"){\n\t\t\t$fehler .= \"
  • phone
  • \";\n\t\t\t}\n\t\t\tif ($_SESSION['email'] == \"\"){\n\t\t\t$fehler .= \"
  • email
  • \";\n\t\t\t}\n\t\t\tif ($_SESSION['message'] == \"\"){\n\t\t\t$fehler .= \"
  • message
  • \";\n\t\t\t}\n\t\t\tif ($CAPTCHA_EnteredText == $CAPTCHA_RandomText and isset($_POST['txtCode']) == true and isset($_SESSION['CAPTCHA_RndText'])){\n\t\t\t$captcha = true;\n\t\t\t} else {\n\t\t\t$fehler .= \"
  • code
  • \";\n\t\t\t}\n\techo '
    ';\n\tif ($fehler == \"\"){\n\t// Email zumsammensetzen\n\t$email = \"From: \" . $_SESSION['email'];\n\n\n\t$nachrichtfertig =\n\t\"Company: \" . $_SESSION['company'] \"n\\\"\n\t\"Name: \" $_SESSION['name'] \"n\\\"\n\t\"Address: \" $_SESSION['address'] \"n\\\"\n\t\"ZIP Code: \" $_SESSION['zip_code'] \"n\\\"\n\t\"City: \" $_SESSION['city'] \"n\\\"\n\t\"County: \" $_SESSION['county'] \"n\\\"\n\t\"Country: \" $_SESSION['country'] \"n\\\"\n\t\"Phone: \" $_SESSION['phone'] \"n\\\"\n\t\"Fax: \" $_SESSION['fax'] \"n\\\"\n\t\"eMail: \" $_SESSION['email'] \"n\\n\\\"\n\t\"Message: \" $_SESSION['message'];\n\n\n\t$versand = mail($empfaenger, $betreff, $nachrichtfertig, $email);\n\t\t\tif ($versand) {\n\t\t\techo '

    Thank you very much!

    \n\t\t\t\t

    The message were send successfully

    ';\n\n\t\t\t// Sessionvariablen löschen\n\t\t\tunset($_SESSION['company']);\n\t\t\tunset($_SESSION['name']);\n\t\t\tunset($_SESSION['address']);\n\t\t\tunset($_SESSION['zip_code']);\n\t\t\tunset($_SESSION['city']);\n\t\t\tunset($_SESSION['county']);\n\t\t\tunset($_SESSION['country']);\n\t\t\tunset($_SESSION['phone']);\n\t\t\tunset($_SESSION['fax']);\n\t\t\tunset($_SESSION['email']);\n\t\t\tunset($_SESSION['nachricht']);\n\t\t\t}\n\n\t} else {\n\techo '

    Error

    ';\n\techo '

    Please fill in all the $fehler field. back

    ';\n\t}\n\techo '
    ';\n\n\t// Session unset\n\tunset($_SESSION['CAPTCHA_RndText']);\n\n?>"] +] + +---------------------------------------------------- + +Checks for issue #2156. diff --git a/package/src/prism/tests/languages/php/issue2614.test b/package/src/prism/tests/languages/php/issue2614.test new file mode 100644 index 00000000..dd05cf8b --- /dev/null +++ b/package/src/prism/tests/languages/php/issue2614.test @@ -0,0 +1,21 @@ +class First {} +class Second {} + +---------------------------------------------------- + +[ + ["keyword", "class"], + ["class-name-definition", "First"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "class"], + ["class-name-definition", "Second"], + ["punctuation", "{"], + ["punctuation", "}"] +] + + +---------------------------------------------------- + +Checks for issue #2614. \ No newline at end of file diff --git a/package/src/prism/tests/languages/php/keyword_feature.test b/package/src/prism/tests/languages/php/keyword_feature.test new file mode 100644 index 00000000..af27d91a --- /dev/null +++ b/package/src/prism/tests/languages/php/keyword_feature.test @@ -0,0 +1,167 @@ +__halt_compiler +abstract +and +array() +as +break +callable +case +catch +class; +clone +const +continue +declare +default +die +do +echo +else +elseif +empty +enddeclare +endfor +endforeach +endif +endswitch +endwhile +eval +exit +extends; +final +finally +fn +for +foreach +function +global +goto +if +implements; +include +include_once +instanceof; +insteadof +interface; +isset +list +namespace; +match +never +new; +or +parent +parent::; +print +private +protected +public +readonly +require +require_once +return +self +new self +self::; +static +static::; +switch +throw +trait; +try +unset +use; +var +void +while +xor +yield +yield from + +---------------------------------------------------- + +[ + ["keyword", "__halt_compiler"], + ["keyword", "abstract"], + ["keyword", "and"], + ["keyword", "array"], ["punctuation", "("], ["punctuation", ")"], + ["keyword", "as"], + ["keyword", "break"], + ["keyword", "callable"], + ["keyword", "case"], + ["keyword", "catch"], + ["keyword", "class"], ["punctuation", ";"], + ["keyword", "clone"], + ["keyword", "const"], + ["keyword", "continue"], + ["keyword", "declare"], + ["keyword", "default"], + ["keyword", "die"], + ["keyword", "do"], + ["keyword", "echo"], + ["keyword", "else"], + ["keyword", "elseif"], + ["keyword", "empty"], + ["keyword", "enddeclare"], + ["keyword", "endfor"], + ["keyword", "endforeach"], + ["keyword", "endif"], + ["keyword", "endswitch"], + ["keyword", "endwhile"], + ["keyword", "eval"], + ["keyword", "exit"], + ["keyword", "extends"], ["punctuation", ";"], + ["keyword", "final"], + ["keyword", "finally"], + ["keyword", "fn"], + ["keyword", "for"], + ["keyword", "foreach"], + ["keyword", "function"], + ["keyword", "global"], + ["keyword", "goto"], + ["keyword", "if"], + ["keyword", "implements"], ["punctuation", ";"], + ["keyword", "include"], + ["keyword", "include_once"], + ["keyword", "instanceof"], ["punctuation", ";"], + ["keyword", "insteadof"], + ["keyword", "interface"], ["punctuation", ";"], + ["keyword", "isset"], + ["keyword", "list"], + ["keyword", "namespace"], ["punctuation", ";"], + ["keyword", "match"], + ["keyword", "never"], + ["keyword", "new"], ["punctuation", ";"], + ["keyword", "or"], + ["keyword", "parent"], + ["keyword", "parent"], ["operator", "::"], ["punctuation", ";"], + ["keyword", "print"], + ["keyword", "private"], + ["keyword", "protected"], + ["keyword", "public"], + ["keyword", "readonly"], + ["keyword", "require"], + ["keyword", "require_once"], + ["keyword", "return"], + ["keyword", "self"], + ["keyword", "new"], ["keyword", "self"], + ["keyword", "self"], ["operator", "::"], ["punctuation", ";"], + ["keyword", "static"], + ["keyword", "static"], ["operator", "::"], ["punctuation", ";"], + ["keyword", "switch"], + ["keyword", "throw"], + ["keyword", "trait"], ["punctuation", ";"], + ["keyword", "try"], + ["keyword", "unset"], + ["keyword", "use"], ["punctuation", ";"], + ["keyword", "var"], + ["keyword", "void"], + ["keyword", "while"], + ["keyword", "xor"], + ["keyword", "yield"], + ["keyword", "yield"], ["keyword", "from"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/php/number_feature.test b/package/src/prism/tests/languages/php/number_feature.test new file mode 100644 index 00000000..12dc64ec --- /dev/null +++ b/package/src/prism/tests/languages/php/number_feature.test @@ -0,0 +1,41 @@ +664.6 +107_925_284.88_4 +1e7 +1.2e3 +1E-7 +0b10100111001 +0x539 +0x1A +0123 +0o123 +0O123 +0b1111_0000_111 +0o1111_0000_123 +0O1111_0000_123 +01111_0000_123 +0xAAAA_FFF_0123 + +---------------------------------------------------- + +[ + ["number", "664.6"], + ["number", "107_925_284.88_4"], + ["number", "1e7"], + ["number", "1.2e3"], + ["number", "1E-7"], + ["number", "0b10100111001"], + ["number", "0x539"], + ["number", "0x1A"], + ["number", "0123"], + ["number", "0o123"], + ["number", "0O123"], + ["number", "0b1111_0000_111"], + ["number", "0o1111_0000_123"], + ["number", "0O1111_0000_123"], + ["number", "01111_0000_123"], + ["number", "0xAAAA_FFF_0123"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/php/operators_feature.test b/package/src/prism/tests/languages/php/operators_feature.test new file mode 100644 index 00000000..0d9e58bc --- /dev/null +++ b/package/src/prism/tests/languages/php/operators_feature.test @@ -0,0 +1,97 @@ +=> +<=> +?? +??= +-> +?-> +:: +... +/ +/= +^ +^= +| +|| +|= +% +%= +* +*= +** +**= +& +&& +&= +< +<= +> +>= +. +.= ++ +++ ++= +- +-- +>> +<< +-= +? +~ +== +!= +=== +!== + +---------------------------------------------------- + +[ + ["operator", "=>"], + ["operator", "<=>"], + ["operator", "??"], + ["operator", "??="], + ["operator", "->"], + ["operator", "?->"], + ["operator", "::"], + ["operator", "..."], + ["operator", "/"], + ["operator", "/="], + ["operator", "^"], + ["operator", "^="], + ["operator", "|"], + ["operator", "||"], + ["operator", "|="], + ["operator", "%"], + ["operator", "%="], + ["operator", "*"], + ["operator", "*="], + ["operator", "**"], + ["operator", "**="], + ["operator", "&"], + ["operator", "&&"], + ["operator", "&="], + ["operator", "<"], + ["operator", "<="], + ["operator", ">"], + ["operator", ">="], + ["operator", "."], + ["operator", ".="], + ["operator", "+"], + ["operator", "++"], + ["operator", "+="], + ["operator", "-"], + ["operator", "--"], + ["operator", ">>"], + ["operator", "<<"], + ["operator", "-="], + ["operator", "?"], + ["operator", "~"], + ["operator", "=="], + ["operator", "!="], + ["operator", "==="], + ["operator", "!=="] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/php/package_feature.test b/package/src/prism/tests/languages/php/package_feature.test new file mode 100644 index 00000000..d4ccc8cf --- /dev/null +++ b/package/src/prism/tests/languages/php/package_feature.test @@ -0,0 +1,44 @@ +namespace App +namespace \foo +namespace \foo\bar\baz +use \foo +use \foo\bar\baz +use function \foo +use function \foo\bar\baz + +---------------------------------------------------- + +[ + ["keyword", "namespace"], + ["package", ["App"]], + ["keyword", "namespace"], + ["package", [["punctuation", "\\"], "foo"]], + ["keyword", "namespace"], + ["package", [ + ["punctuation", "\\"], "foo", + ["punctuation", "\\"], "bar", + ["punctuation", "\\"], "baz" + ]], + ["keyword", "use"], + ["package", [["punctuation", "\\"], "foo"]], + ["keyword", "use"], + ["package", [ + ["punctuation", "\\"], "foo", + ["punctuation", "\\"], "bar", + ["punctuation", "\\"], "baz" + ]], + ["keyword", "use"], + ["keyword", "function"], + ["package", [["punctuation", "\\"], "foo"]], + ["keyword", "use"], + ["keyword", "function"], + ["package", [ + ["punctuation", "\\"], "foo", + ["punctuation", "\\"], "bar", + ["punctuation", "\\"], "baz" + ]] +] + +---------------------------------------------------- + +Checks for packages. \ No newline at end of file diff --git a/package/src/prism/tests/languages/php/property_feature.test b/package/src/prism/tests/languages/php/property_feature.test new file mode 100644 index 00000000..3435b8e9 --- /dev/null +++ b/package/src/prism/tests/languages/php/property_feature.test @@ -0,0 +1,21 @@ +$variable->property; +$foo->bar->baz; + +---------------------------------------------------- + +[ + ["variable", "$variable"], + ["operator", "->"], + ["property", "property"], + ["punctuation", ";"], + ["variable", "$foo"], + ["operator", "->"], + ["property", "bar"], + ["operator", "->"], + ["property", "baz"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for properties. \ No newline at end of file diff --git a/package/src/prism/tests/languages/php/punctuation_feature.test b/package/src/prism/tests/languages/php/punctuation_feature.test new file mode 100644 index 00000000..92d99898 --- /dev/null +++ b/package/src/prism/tests/languages/php/punctuation_feature.test @@ -0,0 +1,27 @@ +{ +} +[ +] +( +) +, +: +; + +---------------------------------------------------- + +[ + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ","], + ["punctuation", ":"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for punctuation. \ No newline at end of file diff --git a/package/src/prism/tests/languages/php/string-interpolation_feature.test b/package/src/prism/tests/languages/php/string-interpolation_feature.test new file mode 100644 index 00000000..0d1a16b4 --- /dev/null +++ b/package/src/prism/tests/languages/php/string-interpolation_feature.test @@ -0,0 +1,256 @@ +"This $variable is interpolated" +"$foo[2], $bar[-4], $foo[$bar]" +"$foo->bar" +"More {$interpolation}" +"{$arr['key']}, {$arr['foo'][3]}" +"{${$name}}, but not {\${\$name}}" +"the return value of getName(): {${getName()}}" +"the return value of \$object->getName(): {${$object->getName()}}" +"{$foo->$bar}, {$foo->{$baz[1]}}" +<<support {${$string->interpolation()}} +FOO; +<<<"FOO_BAR" + {${$name}}, but not {\${\$name}} +FOO_BAR; + +$value = "$this->property->property"; +$value = "$foo[0][1]"; + +---------------------------------------------------- + +[ + ["string", [ + "\"This ", + ["interpolation", [ + ["variable", "$variable"] + ]], + " is interpolated\"" + ]], + + ["string", [ + "\"", + ["interpolation", [ + ["variable", "$foo"], + ["punctuation", "["], + ["number", "2"], + ["punctuation", "]"] + ]], + ", ", + ["interpolation", [ + ["variable", "$bar"], + ["punctuation", "["], + ["operator", "-"], + ["number", "4"], + ["punctuation", "]"] + ]], + ", ", + ["interpolation", [ + ["variable", "$foo"], + ["punctuation", "["], + ["variable", "$bar"], + ["punctuation", "]"] + ]], + "\"" + ]], + + ["string", [ + "\"", + ["interpolation", [ + ["variable", "$foo"], + ["operator", "->"], + ["property", "bar"] + ]], + "\"" + ]], + + ["string", [ + "\"More ", + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$interpolation"], + ["punctuation", "}"] + ]], + "\"" + ]], + + ["string", [ + "\"", + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$arr"], + ["punctuation", "["], + ["string", "'key'"], + ["punctuation", "]"], + ["punctuation", "}"] + ]], + ", ", + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$arr"], + ["punctuation", "["], + ["string", "'foo'"], + ["punctuation", "]"], + ["punctuation", "["], + ["number", "3"], + ["punctuation", "]"], + ["punctuation", "}"] + ]], + "\"" + ]], + + ["string", [ + "\"", + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$"], + ["punctuation", "{"], + ["variable", "$name"], + ["punctuation", "}"], + ["punctuation", "}"] + ]], + ", but not {\\${\\$name}}\"" + ]], + + ["string", [ + "\"the return value of getName(): ", + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$"], + ["punctuation", "{"], + ["function", ["getName"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "}"], + ["punctuation", "}"] + ]], + "\"" + ]], + + ["string", [ + "\"the return value of \\$object->getName(): ", + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$"], + ["punctuation", "{"], + ["variable", "$object"], + ["operator", "->"], + ["function", ["getName"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "}"], + ["punctuation", "}"] + ]], + "\"" + ]], + + ["string", [ + "\"", + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$foo"], + ["operator", "->"], + ["variable", "$bar"], + ["punctuation", "}"] + ]], + ", ", + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$foo"], + ["operator", "->"], + ["punctuation", "{"], + ["variable", "$baz"], + ["punctuation", "["], + ["number", "1"], + ["punctuation", "]"], + ["punctuation", "}"], + ["punctuation", "}"] + ]], + "\"" + ]], + + ["string", [ + ["delimiter", [ + ["punctuation", "<<<"], + "FOO" + ]], + + "\nHeredoc strings ", + ["interpolation", [ + ["variable", "$also"], + ["operator", "->"], + ["property", "support"] + ]], + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$"], + ["punctuation", "{"], + ["variable", "$string"], + ["operator", "->"], + ["function", ["interpolation"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "}"], + ["punctuation", "}"] + ]], + + ["delimiter", [ + "FOO", + ["punctuation", ";"] + ]] + ]], + + ["string", [ + ["delimiter", [ + ["punctuation", "<<<\""], + "FOO_BAR", + ["punctuation", "\""] + ]], + + ["interpolation", [ + ["punctuation", "{"], + ["variable", "$"], + ["punctuation", "{"], + ["variable", "$name"], + ["punctuation", "}"], + ["punctuation", "}"] + ]], + ", but not {\\${\\$name}}\n", + + ["delimiter", [ + "FOO_BAR", + ["punctuation", ";"] + ]] + ]], + + ["variable", "$value"], + ["operator", "="], + ["string", [ + "\"", + ["interpolation", [ + ["variable", "$this"], + ["operator", "->"], + ["property", "property"] + ]], + "->property\"" + ]], + ["punctuation", ";"], + + ["variable", "$value"], + ["operator", "="], + ["string", [ + "\"", + ["interpolation", [ + ["variable", "$foo"], + ["punctuation", "["], + ["number", "0"], + ["punctuation", "]"] + ]], + "[1]\"" + ]], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for interpolation inside strings. diff --git a/package/src/prism/tests/languages/php/string_feature.test b/package/src/prism/tests/languages/php/string_feature.test new file mode 100644 index 00000000..120add02 --- /dev/null +++ b/package/src/prism/tests/languages/php/string_feature.test @@ -0,0 +1,59 @@ +<< --> <- <-- <-> <--> +->> -->> <<- <<-- <<->> <<-->> +-/ --/ /- /-- /-/ /--/ +-// --// //- //-- //-// //--// +-\ --\ \- \-- \-\ \--\ +-\\ --\\ \\- \\-- \\-\\ \\--\\ + + +@startuml +Bob ->x Alice +Bob -> Alice +Bob ->> Alice +Bob -\ Alice +Bob \\- Alice +Bob //-- Alice + +Bob ->o Alice +Bob o\\-- Alice + +Bob <-> Alice +Bob <->o Alice +@enduml + +@startuml +Bob -[#red]> Alice : hello +Alice -[#0000FF]->Bob : ok +@enduml + +@startuml +participant Alice +participant Bob #lightblue +Alice -> Bob +Bob -> Carol +... +[-> Bob +[o-> Bob +[o->o Bob +[x-> Bob +... +[<- Bob +[x<- Bob +... +Bob ->] +Bob ->o] +Bob o->o] +Bob ->x] +... +Bob <-] +Bob x<-] +@enduml + +@startuml +?-> Alice +[-> Alice +[-> Bob +?-> Bob +Alice ->] +Alice ->? +Alice -> Bob +@enduml + +@startuml +(Use case 1) <.. :user: +(Use case 2) <- :user: +@enduml + +@startuml +:user: -left-> (dummyLeft) +:user: -right-> (dummyRight) +:user: -up-> (dummyUp) +:user: -down-> (dummyDown) +@enduml + +@startuml +Class11 <|.. Class12 +Class13 --> Class14 +Class15 ..> Class16 +Class17 ..|> Class18 +Class19 <--* Class20 +Class21 #-- Class22 +Class23 x-- Class24 +Class25 }-- Class26 +Class27 +-- Class28 +Class29 ^-- Class30 +@enduml + +---------------------------------------------------- + +[ + ["arrow", ["->"]], + ["arrow", ["-->"]], + ["arrow", ["<-"]], + ["arrow", ["<--"]], + ["arrow", ["<->"]], + ["arrow", ["<-->"]], + + ["arrow", ["->>"]], + ["arrow", ["-->>"]], + ["arrow", ["<<-"]], + ["arrow", ["<<--"]], + ["arrow", ["<<->>"]], + ["arrow", ["<<-->>"]], + + ["arrow", ["-/"]], + ["arrow", ["--/"]], + ["arrow", ["/-"]], + ["arrow", ["/--"]], + ["arrow", ["/-/"]], + ["arrow", ["/--/"]], + + ["arrow", ["-//"]], + ["arrow", ["--//"]], + ["arrow", ["//-"]], + ["arrow", ["//--"]], + ["arrow", ["//-//"]], + ["arrow", ["//--//"]], + + ["arrow", ["-\\"]], + ["arrow", ["--\\"]], + ["arrow", ["\\-"]], + ["arrow", ["\\--"]], + ["arrow", ["\\-\\"]], + ["arrow", ["\\--\\"]], + + ["arrow", ["-\\\\"]], + ["arrow", ["--\\\\"]], + ["arrow", ["\\\\-"]], + ["arrow", ["\\\\--"]], + ["arrow", ["\\\\-\\\\"]], + ["arrow", ["\\\\--\\\\"]], + + ["delimiter", "@startuml"], + + "\nBob ", + ["arrow", ["->x"]], + " Alice\nBob ", + ["arrow", ["->"]], + " Alice\nBob ", + ["arrow", ["->>"]], + " Alice\nBob ", + ["arrow", ["-\\"]], + " Alice\nBob ", + ["arrow", ["\\\\-"]], + " Alice\nBob ", + ["arrow", ["//--"]], + " Alice\n\nBob ", + ["arrow", ["->o"]], + " Alice\nBob ", + ["arrow", ["o\\\\--"]], + " Alice\n\nBob ", + ["arrow", ["<->"]], + " Alice\nBob ", + ["arrow", ["<->o"]], + " Alice\n", + + ["delimiter", "@enduml"], + + ["delimiter", "@startuml"], + + "\nBob ", + ["arrow", [ + "-", + ["punctuation", "["], + ["expression", [ + ["color", "#red"] + ]], + ["punctuation", "]"], + ">" + ]], + " Alice ", + ["punctuation", ":"], + " hello\nAlice ", + ["arrow", [ + "-", + ["punctuation", "["], + ["expression", [ + ["color", "#0000FF"] + ]], + ["punctuation", "]"], + "->" + ]], + "Bob ", + ["punctuation", ":"], + " ok\n", + + ["delimiter", "@enduml"], + + ["delimiter", "@startuml"], + ["keyword", "participant"], + " Alice\n", + ["keyword", "participant"], + " Bob ", + ["color", "#lightblue"], + "\nAlice ", + ["arrow", ["->"]], + " Bob\nBob ", + ["arrow", ["->"]], + " Carol\n", + ["punctuation", "..."], + ["arrow", ["[->"]], + " Bob\n", + ["arrow", ["[o->"]], + " Bob\n", + ["arrow", ["[o->o"]], + " Bob\n", + ["arrow", ["[x->"]], + " Bob\n", + ["punctuation", "..."], + ["arrow", ["[<-"]], + " Bob\n", + ["arrow", ["[x<-"]], + " Bob\n", + ["punctuation", "..."], + "\nBob ", + ["arrow", ["->]"]], + "\nBob ", + ["arrow", ["->o]"]], + "\nBob ", + ["arrow", ["o->o]"]], + "\nBob ", + ["arrow", ["->x]"]], + ["punctuation", "..."], + "\nBob ", + ["arrow", ["<-]"]], + "\nBob ", + ["arrow", ["x<-]"]], + ["delimiter", "@enduml"], + + ["delimiter", "@startuml"], + ["arrow", ["?->"]], " Alice\n", + ["arrow", ["[->"]], " Alice\n", + ["arrow", ["[->"]], " Bob\n", + ["arrow", ["?->"]], " Bob\nAlice ", ["arrow", ["->]"]], + "\nAlice ", ["arrow", ["->?"]], + "\nAlice ", ["arrow", ["->"]], " Bob\n", + ["delimiter", "@enduml"], + + ["delimiter", "@startuml"], + + ["punctuation", "("], + "Use case 1", + ["punctuation", ")"], + ["arrow", ["<.."]], + ["punctuation", ":"], + "user", + ["punctuation", ":"], + + ["punctuation", "("], + "Use case 2", + ["punctuation", ")"], + ["arrow", ["<-"]], + ["punctuation", ":"], + "user", + ["punctuation", ":"], + + ["delimiter", "@enduml"], + + ["delimiter", "@startuml"], + + ["punctuation", ":"], + "user", + ["punctuation", ":"], + ["arrow", ["-left->"]], + ["punctuation", "("], + "dummyLeft", + ["punctuation", ")"], + + ["punctuation", ":"], + "user", + ["punctuation", ":"], + ["arrow", ["-right->"]], + ["punctuation", "("], + "dummyRight", + ["punctuation", ")"], + + ["punctuation", ":"], + "user", + ["punctuation", ":"], + ["arrow", ["-up->"]], + ["punctuation", "("], + "dummyUp", + ["punctuation", ")"], + + ["punctuation", ":"], + "user", + ["punctuation", ":"], + ["arrow", ["-down->"]], + ["punctuation", "("], + "dummyDown", + ["punctuation", ")"], + + ["delimiter", "@enduml"], + + ["delimiter", "@startuml"], + + "\nClass11 ", + ["arrow", ["<|.."]], + " Class12\nClass13 ", + ["arrow", ["-->"]], + " Class14\nClass15 ", + ["arrow", ["..>"]], + " Class16\nClass17 ", + ["arrow", ["..|>"]], + " Class18\nClass19 ", + ["arrow", ["<--*"]], + " Class20\nClass21 ", + ["arrow", ["#--"]], + " Class22\nClass23 ", + ["arrow", ["x--"]], + " Class24\nClass25 ", + ["arrow", ["}--"]], + " Class26\nClass27 ", + ["arrow", ["+--"]], + " Class28\nClass29 ", + ["arrow", ["^--"]], + " Class30\n", + + ["delimiter", "@enduml"] +] diff --git a/package/src/prism/tests/languages/plant-uml/color_feature.test b/package/src/prism/tests/languages/plant-uml/color_feature.test new file mode 100644 index 00000000..bd5282e5 --- /dev/null +++ b/package/src/prism/tests/languages/plant-uml/color_feature.test @@ -0,0 +1,11 @@ +#palegreen +#gold +#FF00FF + +---------------------------------------------------- + +[ + ["color", "#palegreen"], + ["color", "#gold"], + ["color", "#FF00FF"] +] diff --git a/package/src/prism/tests/languages/plant-uml/comment_feature.test b/package/src/prism/tests/languages/plant-uml/comment_feature.test new file mode 100644 index 00000000..fdcc7cec --- /dev/null +++ b/package/src/prism/tests/languages/plant-uml/comment_feature.test @@ -0,0 +1,11 @@ +' comment +/' + comment +'/ + +---------------------------------------------------- + +[ + ["comment", "' comment"], + ["comment", "/'\n comment\n'/"] +] diff --git a/package/src/prism/tests/languages/plant-uml/delimiter_feature.test b/package/src/prism/tests/languages/plant-uml/delimiter_feature.test new file mode 100644 index 00000000..f52ed736 --- /dev/null +++ b/package/src/prism/tests/languages/plant-uml/delimiter_feature.test @@ -0,0 +1,9 @@ +@startuml +@enduml + +---------------------------------------------------- + +[ + ["delimiter", "@startuml"], + ["delimiter", "@enduml"] +] diff --git a/package/src/prism/tests/languages/plant-uml/divider_feature.test b/package/src/prism/tests/languages/plant-uml/divider_feature.test new file mode 100644 index 00000000..fae5cb72 --- /dev/null +++ b/package/src/prism/tests/languages/plant-uml/divider_feature.test @@ -0,0 +1,37 @@ +== Initialization == + +Alice -> Bob: Authentication Request +Bob --> Alice: Authentication Response + +== Repetition == + +Alice -> Bob: Another authentication Request +Alice <-- Bob: another authentication Response + +---------------------------------------------------- + +[ + ["divider", "== Initialization =="], + + "\n\nAlice ", + ["arrow", ["->"]], + " Bob", + ["punctuation", ":"], + " Authentication Request\nBob ", + ["arrow", ["-->"]], + " Alice", + ["punctuation", ":"], + " Authentication Response\n\n", + + ["divider", "== Repetition =="], + + "\n\nAlice ", + ["arrow", ["->"]], + " Bob", + ["punctuation", ":"], + " Another authentication Request\nAlice ", + ["arrow", ["<--"]], + " Bob", + ["punctuation", ":"], + " another authentication Response" +] diff --git a/package/src/prism/tests/languages/plant-uml/keyword_feature.test b/package/src/prism/tests/languages/plant-uml/keyword_feature.test new file mode 100644 index 00000000..7f9ed7ce --- /dev/null +++ b/package/src/prism/tests/languages/plant-uml/keyword_feature.test @@ -0,0 +1,337 @@ +if "Some Test" then + -->[true] "Some Action" + --> "Another Action" + -right-> (*) +else + ->[false] "Something else" + -->[Ending process] (*) +endif + +if (Graphviz installed?) then (yes) + :process all\ndiagrams; +else (no) + :process only + __sequence__ and __activity__ diagrams; +endif + +if (color?) is (red) then +:print red; +else +:print not red; + +if (counter?) equals (5) then +:print 5; +else +:print not 5; + +start +if (condition A) then (yes) + :Text 1; +elseif (condition B) then (yes) + :Text 2; + stop +(no) elseif (condition C) then (yes) + :Text 3; +(no) elseif (condition D) then (yes) + :Text 4; +else (nothing) + :Text else; +endif +stop + +switch (test?) +case ( condition A ) + :Text 1; +case ( condition B ) + :Text 2; +case ( condition C ) + :Text 3; +case ( condition D ) + :Text 4; +case ( condition E ) + :Text 5; +endswitch + +repeat + :read data; + :generate diagrams; +repeat while (more data?) is (yes) +->no; + +repeat while (Something went wrong with long text?) is (yes) not (no) +->//merged step//; + +---------------------------------------------------- + +[ + ["keyword", "if"], + ["string", "\"Some Test\""], + ["keyword", "then"], + + ["arrow", ["-->"]], + ["punctuation", "["], + "true", + ["punctuation", "]"], + ["string", "\"Some Action\""], + + ["arrow", ["-->"]], + ["string", "\"Another Action\""], + + ["arrow", ["-right->"]], + ["punctuation", "("], + "*", + ["punctuation", ")"], + + ["keyword", "else"], + + ["arrow", ["->"]], + ["punctuation", "["], + "false", + ["punctuation", "]"], + ["string", "\"Something else\""], + + ["arrow", ["-->"]], + ["punctuation", "["], + "Ending process", + ["punctuation", "]"], + ["punctuation", "("], + "*", + ["punctuation", ")"], + + ["keyword", "endif"], + + ["keyword", "if"], + ["punctuation", "("], + "Graphviz installed?", + ["punctuation", ")"], + ["keyword", "then"], + ["punctuation", "("], + "yes", + ["punctuation", ")"], + + ["punctuation", ":"], + "process all\\ndiagrams", + ["punctuation", ";"], + + ["keyword", "else"], + ["punctuation", "("], + "no", + ["punctuation", ")"], + + ["punctuation", ":"], + "process only\n __sequence__ and __activity__ diagrams", + ["punctuation", ";"], + + ["keyword", "endif"], + + ["keyword", "if"], + ["punctuation", "("], + "color?", + ["punctuation", ")"], + ["keyword", "is"], + ["punctuation", "("], + "red", + ["punctuation", ")"], + ["keyword", "then"], + + ["punctuation", ":"], + "print red", + ["punctuation", ";"], + + ["keyword", "else"], + + ["punctuation", ":"], + "print not red", + ["punctuation", ";"], + + ["keyword", "if"], + ["punctuation", "("], + "counter?", + ["punctuation", ")"], + ["keyword", "equals"], + ["punctuation", "("], + "5", + ["punctuation", ")"], + ["keyword", "then"], + + ["punctuation", ":"], + "print 5", + ["punctuation", ";"], + + ["keyword", "else"], + + ["punctuation", ":"], + "print not 5", + ["punctuation", ";"], + + ["keyword", "start"], + + ["keyword", "if"], + ["punctuation", "("], + "condition A", + ["punctuation", ")"], + ["keyword", "then"], + ["punctuation", "("], + "yes", + ["punctuation", ")"], + + ["punctuation", ":"], + "Text 1", + ["punctuation", ";"], + + ["keyword", "elseif"], + ["punctuation", "("], + "condition B", + ["punctuation", ")"], + ["keyword", "then"], + ["punctuation", "("], + "yes", + ["punctuation", ")"], + + ["punctuation", ":"], + "Text 2", + ["punctuation", ";"], + + ["keyword", "stop"], + + ["punctuation", "("], + "no", + ["punctuation", ")"], + ["keyword", "elseif"], + ["punctuation", "("], + "condition C", + ["punctuation", ")"], + ["keyword", "then"], + ["punctuation", "("], + "yes", + ["punctuation", ")"], + + ["punctuation", ":"], + "Text 3", + ["punctuation", ";"], + + ["punctuation", "("], + "no", + ["punctuation", ")"], + ["keyword", "elseif"], + ["punctuation", "("], + "condition D", + ["punctuation", ")"], + ["keyword", "then"], + ["punctuation", "("], + "yes", + ["punctuation", ")"], + + ["punctuation", ":"], + "Text 4", + ["punctuation", ";"], + + ["keyword", "else"], + ["punctuation", "("], + "nothing", + ["punctuation", ")"], + + ["punctuation", ":"], + "Text else", + ["punctuation", ";"], + + ["keyword", "endif"], + + ["keyword", "stop"], + + ["keyword", "switch"], + ["punctuation", "("], + "test?", + ["punctuation", ")"], + + ["keyword", "case"], + ["punctuation", "("], + " condition A ", + ["punctuation", ")"], + + ["punctuation", ":"], + "Text 1", + ["punctuation", ";"], + + ["keyword", "case"], + ["punctuation", "("], + " condition B ", + ["punctuation", ")"], + + ["punctuation", ":"], + "Text 2", + ["punctuation", ";"], + + ["keyword", "case"], + ["punctuation", "("], + " condition C ", + ["punctuation", ")"], + + ["punctuation", ":"], + "Text 3", + ["punctuation", ";"], + + ["keyword", "case"], + ["punctuation", "("], + " condition D ", + ["punctuation", ")"], + + ["punctuation", ":"], + "Text 4", + ["punctuation", ";"], + + ["keyword", "case"], + ["punctuation", "("], + " condition E ", + ["punctuation", ")"], + + ["punctuation", ":"], + "Text 5", + ["punctuation", ";"], + + ["keyword", "endswitch"], + + ["keyword", "repeat"], + + ["punctuation", ":"], + "read data", + ["punctuation", ";"], + + ["punctuation", ":"], + "generate diagrams", + ["punctuation", ";"], + + ["keyword", "repeat"], + ["keyword", "while"], + ["punctuation", "("], + "more data?", + ["punctuation", ")"], + ["keyword", "is"], + ["punctuation", "("], + "yes", + ["punctuation", ")"], + + ["arrow", ["->"]], + "no", + ["punctuation", ";"], + + ["keyword", "repeat"], + ["keyword", "while"], + ["punctuation", "("], + "Something went wrong with long text?", + ["punctuation", ")"], + ["keyword", "is"], + ["punctuation", "("], + "yes", + ["punctuation", ")"], + ["keyword", "not"], + ["punctuation", "("], + "no", + ["punctuation", ")"], + + ["arrow", ["->"]], + "//merged step//", + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/plant-uml/preprocessor_feature.test b/package/src/prism/tests/languages/plant-uml/preprocessor_feature.test new file mode 100644 index 00000000..baaafeb8 --- /dev/null +++ b/package/src/prism/tests/languages/plant-uml/preprocessor_feature.test @@ -0,0 +1,7 @@ +!pragma useVerticalIf on + +---------------------------------------------------- + +[ + ["preprocessor", ["!pragma useVerticalIf on"]] +] diff --git a/package/src/prism/tests/languages/plant-uml/string_feature.test b/package/src/prism/tests/languages/plant-uml/string_feature.test new file mode 100644 index 00000000..1cd3ca5e --- /dev/null +++ b/package/src/prism/tests/languages/plant-uml/string_feature.test @@ -0,0 +1,9 @@ +"foo" +"" + +---------------------------------------------------- + +[ + ["string", "\"foo\""], + ["string", "\"\""] +] diff --git a/package/src/prism/tests/languages/plant-uml/text_feature.test b/package/src/prism/tests/languages/plant-uml/text_feature.test new file mode 100644 index 00000000..15e13507 --- /dev/null +++ b/package/src/prism/tests/languages/plant-uml/text_feature.test @@ -0,0 +1,29 @@ +Alice -> Bob: Authentication request +Bob --> Alice: Response + +participant Participant [ + =Title + ---- + ""SubTitle"" +] + +---------------------------------------------------- + +[ + "Alice ", + ["arrow", ["->"]], + " Bob", + ["punctuation", ":"], + " Authentication request\nBob ", + ["arrow", ["-->"]], + " Alice", + ["punctuation", ":"], + " Response\n\n", + + ["keyword", "participant"], + " Participant ", + ["punctuation", "["], + + ["text", " =Title\n ----\n \"\"SubTitle\"\"\n"], + ["punctuation", "]"] +] diff --git a/package/src/prism/tests/languages/plant-uml/time_feature.test b/package/src/prism/tests/languages/plant-uml/time_feature.test new file mode 100644 index 00000000..d2b9ee3e --- /dev/null +++ b/package/src/prism/tests/languages/plant-uml/time_feature.test @@ -0,0 +1,92 @@ +@startuml +clock clk with period 1 +binary "enable" as EN +concise "dataBus" as db + +@0 as :start +@5 as :en_high +@10 as :en_low +@:en_high-2 as :en_highMinus2 + +@:start +EN is low +db is "0x0000" + +@:en_high +EN is high + +@:en_low +EN is low + +@:en_highMinus2 +db is "0xf23a" + +@:en_high+6 +db is "0x0000" +@enduml + +@1:15:00 +@2000/12/31 + +---------------------------------------------------- + +[ + ["delimiter", "@startuml"], + + ["keyword", "clock"], + " clk with period 1\n", + + ["keyword", "binary"], + ["string", "\"enable\""], + ["keyword", "as"], + " EN\n", + + ["keyword", "concise"], + ["string", "\"dataBus\""], + ["keyword", "as"], + " db\n\n", + + ["time", "@0"], + ["keyword", "as"], + ["punctuation", ":"], + "start\n", + + ["time", "@5"], + ["keyword", "as"], + ["punctuation", ":"], + "en_high\n", + + ["time", "@10"], + ["keyword", "as"], + ["punctuation", ":"], + "en_low\n", + + ["time", "@:en_high-2"], + ["keyword", "as"], + ["punctuation", ":"], + "en_highMinus2\n\n", + + ["time", "@:start"], + + "\nEN ", + ["keyword", "is"], + " low\ndb ", + ["keyword", "is"], + ["string", "\"0x0000\""], + + ["time", "@:en_high"], + "\nEN ", ["keyword", "is"], " high\n\n", + + ["time", "@:en_low"], + "\nEN ", ["keyword", "is"], " low\n\n", + + ["time", "@:en_highMinus2"], + "\ndb ", ["keyword", "is"], ["string", "\"0xf23a\""], + + ["time", "@:en_high+6"], + "\ndb ", ["keyword", "is"], ["string", "\"0x0000\""], + ["delimiter", "@enduml"], + + ["time", "@1:15:00"], + ["time", "@2000/12/31"] +] diff --git a/package/src/prism/tests/languages/plant-uml/variable_feature.test b/package/src/prism/tests/languages/plant-uml/variable_feature.test new file mode 100644 index 00000000..a7936dff --- /dev/null +++ b/package/src/prism/tests/languages/plant-uml/variable_feature.test @@ -0,0 +1,15 @@ +$foo +$bar + +%autonumber% +%page% + +---------------------------------------------------- + +[ + ["variable", "$foo"], + ["variable", "$bar"], + + ["variable", "%autonumber%"], + ["variable", "%page%"] +] diff --git a/package/src/prism/tests/languages/plsql/comment_feature.test b/package/src/prism/tests/languages/plsql/comment_feature.test new file mode 100644 index 00000000..b334b4ef --- /dev/null +++ b/package/src/prism/tests/languages/plsql/comment_feature.test @@ -0,0 +1,18 @@ +/**/ +/* foo +bar */ +-- +-- foo + +---------------------------------------------------- + +[ + ["comment", "/**/"], + ["comment", "/* foo\nbar */"], + ["comment", "--"], + ["comment", "-- foo"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/plsql/keyword_feature.test b/package/src/prism/tests/languages/plsql/keyword_feature.test new file mode 100644 index 00000000..338255bd --- /dev/null +++ b/package/src/prism/tests/languages/plsql/keyword_feature.test @@ -0,0 +1,679 @@ +A +ACCESSIBLE +ADD +AGENT +AGGREGATE +ALL +ALTER +AND +ANY +ARRAY +AS +ASC +AT +ATTRIBUTE +AUTHID +AVG +BEGIN +BETWEEN +BFILE_BASE +BINARY +BLOB_BASE +BLOCK +BODY +BOTH +BOUND +BULK +BY +BYTE +C +CALL +CALLING +CASCADE +CASE +CHAR +CHAR_BASE +CHARACTER +CHARSET +CHARSETFORM +CHARSETID +CHECK +CLOB_BASE +CLONE +CLOSE +CLUSTER +CLUSTERS +COLAUTH +COLLECT +COLUMNS +COMMENT +COMMIT +COMMITTED +COMPILED +COMPRESS +CONNECT +CONSTANT +CONSTRUCTOR +CONTEXT +CONTINUE +CONVERT +COUNT +CRASH +CREATE +CREDENTIAL +CURRENT +CURSOR +CUSTOMDATUM +DANGLING +DATA +DATE +DATE_BASE +DAY +DECLARE +DEFAULT +DEFINE +DELETE +DESC +DETERMINISTIC +DIRECTORY +DISTINCT +DOUBLE +DROP +DURATION +ELEMENT +ELSE +ELSIF +EMPTY +END +ESCAPE +EXCEPT +EXCEPTION +EXCEPTIONS +EXCLUSIVE +EXECUTE +EXISTS +EXIT +EXTERNAL +FETCH +FINAL +FIRST +FIXED +FLOAT +FOR +FORALL +FORCE +FROM +FUNCTION +GENERAL +GOTO +GRANT +GROUP +HASH +HAVING +HEAP +HIDDEN +HOUR +IDENTIFIED +IF +IMMEDIATE +IMMUTABLE +IN +INCLUDING +INDEX +INDEXES +INDICATOR +INDICES +INFINITE +INSERT +INSTANTIABLE +INT +INTERFACE +INTERSECT +INTERVAL +INTO +INVALIDATE +IS +ISOLATION +JAVA +LANGUAGE +LARGE +LEADING +LENGTH +LEVEL +LIBRARY +LIKE +LIKE2 +LIKE4 +LIKEC +LIMIT +LIMITED +LOCAL +LOCK +LONG +LOOP +MAP +MAX +MAXLEN +MEMBER +MERGE +MIN +MINUS +MINUTE +MOD +MODE +MODIFY +MONTH +MULTISET +MUTABLE +NAME +NAN +NATIONAL +NATIVE +NCHAR +NEW +NOCOMPRESS +NOCOPY +NOT +NOWAIT +NULL +NUMBER_BASE +OBJECT +OCICOLL +OCIDATE +OCIDATETIME +OCIDURATION +OCIINTERVAL +OCILOBLOCATOR +OCINUMBER +OCIRAW +OCIREF +OCIREFCURSOR +OCIROWID +OCISTRING +OCITYPE +OF +OLD +ON +ONLY +OPAQUE +OPEN +OPERATOR +OPTION +OR +ORACLE +ORADATA +ORDER +ORGANIZATION +ORLANY +ORLVARY +OTHERS +OUT +OVERLAPS +OVERRIDING +PACKAGE +PARALLEL_ENABLE +PARAMETER +PARAMETERS +PARENT +PARTITION +PASCAL +PERSISTABLE +PIPE +PIPELINED +PLUGGABLE +POLYMORPHIC +PRAGMA +PRECISION +PRIOR +PRIVATE +PROCEDURE +PUBLIC +RAISE +RANGE +RAW +READ +RECORD +REF +REFERENCE +RELIES_ON +REM +REMAINDER +RENAME +RESOURCE +RESULT +RESULT_CACHE +RETURN +RETURNING +REVERSE +REVOKE +ROLLBACK +ROW +SAMPLE +SAVE +SAVEPOINT +SB1 +SB2 +SB4 +SECOND +SEGMENT +SELECT +SELF +SEPARATE +SEQUENCE +SERIALIZABLE +SET +SHARE +SHORT +SIZE +SIZE_T +SOME +SPARSE +SQL +SQLCODE +SQLDATA +SQLNAME +SQLSTATE +STANDARD +START +STATIC +STDDEV +STORED +STRING +STRUCT +STYLE +SUBMULTISET +SUBPARTITION +SUBSTITUTABLE +SUBTYPE +SUM +SYNONYM +TABAUTH +TABLE +TDO +THE +THEN +TIME +TIMESTAMP +TIMEZONE_ABBR +TIMEZONE_HOUR +TIMEZONE_MINUTE +TIMEZONE_REGION +TO +TRAILING +TRANSACTION +TRANSACTIONAL +TRUSTED +TYPE +UB1 +UB2 +UB4 +UNDER +UNION +UNIQUE +UNPLUG +UNSIGNED +UNTRUSTED +UPDATE +USE +USING +VALIST +VALUE +VALUES +VARIABLE +VARIANCE +VARRAY +VARYING +VIEW +VIEWS +VOID +WHEN +WHERE +WHILE +WITH +WORK +WRAPPED +WRITE +YEAR +ZONE + +---------------------------------------------------- + +[ + ["keyword", "A"], + ["keyword", "ACCESSIBLE"], + ["keyword", "ADD"], + ["keyword", "AGENT"], + ["keyword", "AGGREGATE"], + ["keyword", "ALL"], + ["keyword", "ALTER"], + ["keyword", "AND"], + ["keyword", "ANY"], + ["keyword", "ARRAY"], + ["keyword", "AS"], + ["keyword", "ASC"], + ["keyword", "AT"], + ["keyword", "ATTRIBUTE"], + ["keyword", "AUTHID"], + ["keyword", "AVG"], + ["keyword", "BEGIN"], + ["keyword", "BETWEEN"], + ["keyword", "BFILE_BASE"], + ["keyword", "BINARY"], + ["keyword", "BLOB_BASE"], + ["keyword", "BLOCK"], + ["keyword", "BODY"], + ["keyword", "BOTH"], + ["keyword", "BOUND"], + ["keyword", "BULK"], + ["keyword", "BY"], + ["keyword", "BYTE"], + ["keyword", "C"], + ["keyword", "CALL"], + ["keyword", "CALLING"], + ["keyword", "CASCADE"], + ["keyword", "CASE"], + ["keyword", "CHAR"], + ["keyword", "CHAR_BASE"], + ["keyword", "CHARACTER"], + ["keyword", "CHARSET"], + ["keyword", "CHARSETFORM"], + ["keyword", "CHARSETID"], + ["keyword", "CHECK"], + ["keyword", "CLOB_BASE"], + ["keyword", "CLONE"], + ["keyword", "CLOSE"], + ["keyword", "CLUSTER"], + ["keyword", "CLUSTERS"], + ["keyword", "COLAUTH"], + ["keyword", "COLLECT"], + ["keyword", "COLUMNS"], + ["keyword", "COMMENT"], + ["keyword", "COMMIT"], + ["keyword", "COMMITTED"], + ["keyword", "COMPILED"], + ["keyword", "COMPRESS"], + ["keyword", "CONNECT"], + ["keyword", "CONSTANT"], + ["keyword", "CONSTRUCTOR"], + ["keyword", "CONTEXT"], + ["keyword", "CONTINUE"], + ["keyword", "CONVERT"], + ["keyword", "COUNT"], + ["keyword", "CRASH"], + ["keyword", "CREATE"], + ["keyword", "CREDENTIAL"], + ["keyword", "CURRENT"], + ["keyword", "CURSOR"], + ["keyword", "CUSTOMDATUM"], + ["keyword", "DANGLING"], + ["keyword", "DATA"], + ["keyword", "DATE"], + ["keyword", "DATE_BASE"], + ["keyword", "DAY"], + ["keyword", "DECLARE"], + ["keyword", "DEFAULT"], + ["keyword", "DEFINE"], + ["keyword", "DELETE"], + ["keyword", "DESC"], + ["keyword", "DETERMINISTIC"], + ["keyword", "DIRECTORY"], + ["keyword", "DISTINCT"], + ["keyword", "DOUBLE"], + ["keyword", "DROP"], + ["keyword", "DURATION"], + ["keyword", "ELEMENT"], + ["keyword", "ELSE"], + ["keyword", "ELSIF"], + ["keyword", "EMPTY"], + ["keyword", "END"], + ["keyword", "ESCAPE"], + ["keyword", "EXCEPT"], + ["keyword", "EXCEPTION"], + ["keyword", "EXCEPTIONS"], + ["keyword", "EXCLUSIVE"], + ["keyword", "EXECUTE"], + ["keyword", "EXISTS"], + ["keyword", "EXIT"], + ["keyword", "EXTERNAL"], + ["keyword", "FETCH"], + ["keyword", "FINAL"], + ["keyword", "FIRST"], + ["keyword", "FIXED"], + ["keyword", "FLOAT"], + ["keyword", "FOR"], + ["keyword", "FORALL"], + ["keyword", "FORCE"], + ["keyword", "FROM"], + ["keyword", "FUNCTION"], + ["keyword", "GENERAL"], + ["keyword", "GOTO"], + ["keyword", "GRANT"], + ["keyword", "GROUP"], + ["keyword", "HASH"], + ["keyword", "HAVING"], + ["keyword", "HEAP"], + ["keyword", "HIDDEN"], + ["keyword", "HOUR"], + ["keyword", "IDENTIFIED"], + ["keyword", "IF"], + ["keyword", "IMMEDIATE"], + ["keyword", "IMMUTABLE"], + ["keyword", "IN"], + ["keyword", "INCLUDING"], + ["keyword", "INDEX"], + ["keyword", "INDEXES"], + ["keyword", "INDICATOR"], + ["keyword", "INDICES"], + ["keyword", "INFINITE"], + ["keyword", "INSERT"], + ["keyword", "INSTANTIABLE"], + ["keyword", "INT"], + ["keyword", "INTERFACE"], + ["keyword", "INTERSECT"], + ["keyword", "INTERVAL"], + ["keyword", "INTO"], + ["keyword", "INVALIDATE"], + ["keyword", "IS"], + ["keyword", "ISOLATION"], + ["keyword", "JAVA"], + ["keyword", "LANGUAGE"], + ["keyword", "LARGE"], + ["keyword", "LEADING"], + ["keyword", "LENGTH"], + ["keyword", "LEVEL"], + ["keyword", "LIBRARY"], + ["keyword", "LIKE"], + ["keyword", "LIKE2"], + ["keyword", "LIKE4"], + ["keyword", "LIKEC"], + ["keyword", "LIMIT"], + ["keyword", "LIMITED"], + ["keyword", "LOCAL"], + ["keyword", "LOCK"], + ["keyword", "LONG"], + ["keyword", "LOOP"], + ["keyword", "MAP"], + ["keyword", "MAX"], + ["keyword", "MAXLEN"], + ["keyword", "MEMBER"], + ["keyword", "MERGE"], + ["keyword", "MIN"], + ["keyword", "MINUS"], + ["keyword", "MINUTE"], + ["keyword", "MOD"], + ["keyword", "MODE"], + ["keyword", "MODIFY"], + ["keyword", "MONTH"], + ["keyword", "MULTISET"], + ["keyword", "MUTABLE"], + ["keyword", "NAME"], + ["keyword", "NAN"], + ["keyword", "NATIONAL"], + ["keyword", "NATIVE"], + ["keyword", "NCHAR"], + ["keyword", "NEW"], + ["keyword", "NOCOMPRESS"], + ["keyword", "NOCOPY"], + ["keyword", "NOT"], + ["keyword", "NOWAIT"], + ["keyword", "NULL"], + ["keyword", "NUMBER_BASE"], + ["keyword", "OBJECT"], + ["keyword", "OCICOLL"], + ["keyword", "OCIDATE"], + ["keyword", "OCIDATETIME"], + ["keyword", "OCIDURATION"], + ["keyword", "OCIINTERVAL"], + ["keyword", "OCILOBLOCATOR"], + ["keyword", "OCINUMBER"], + ["keyword", "OCIRAW"], + ["keyword", "OCIREF"], + ["keyword", "OCIREFCURSOR"], + ["keyword", "OCIROWID"], + ["keyword", "OCISTRING"], + ["keyword", "OCITYPE"], + ["keyword", "OF"], + ["keyword", "OLD"], + ["keyword", "ON"], + ["keyword", "ONLY"], + ["keyword", "OPAQUE"], + ["keyword", "OPEN"], + ["keyword", "OPERATOR"], + ["keyword", "OPTION"], + ["keyword", "OR"], + ["keyword", "ORACLE"], + ["keyword", "ORADATA"], + ["keyword", "ORDER"], + ["keyword", "ORGANIZATION"], + ["keyword", "ORLANY"], + ["keyword", "ORLVARY"], + ["keyword", "OTHERS"], + ["keyword", "OUT"], + ["keyword", "OVERLAPS"], + ["keyword", "OVERRIDING"], + ["keyword", "PACKAGE"], + ["keyword", "PARALLEL_ENABLE"], + ["keyword", "PARAMETER"], + ["keyword", "PARAMETERS"], + ["keyword", "PARENT"], + ["keyword", "PARTITION"], + ["keyword", "PASCAL"], + ["keyword", "PERSISTABLE"], + ["keyword", "PIPE"], + ["keyword", "PIPELINED"], + ["keyword", "PLUGGABLE"], + ["keyword", "POLYMORPHIC"], + ["keyword", "PRAGMA"], + ["keyword", "PRECISION"], + ["keyword", "PRIOR"], + ["keyword", "PRIVATE"], + ["keyword", "PROCEDURE"], + ["keyword", "PUBLIC"], + ["keyword", "RAISE"], + ["keyword", "RANGE"], + ["keyword", "RAW"], + ["keyword", "READ"], + ["keyword", "RECORD"], + ["keyword", "REF"], + ["keyword", "REFERENCE"], + ["keyword", "RELIES_ON"], + ["keyword", "REM"], + ["keyword", "REMAINDER"], + ["keyword", "RENAME"], + ["keyword", "RESOURCE"], + ["keyword", "RESULT"], + ["keyword", "RESULT_CACHE"], + ["keyword", "RETURN"], + ["keyword", "RETURNING"], + ["keyword", "REVERSE"], + ["keyword", "REVOKE"], + ["keyword", "ROLLBACK"], + ["keyword", "ROW"], + ["keyword", "SAMPLE"], + ["keyword", "SAVE"], + ["keyword", "SAVEPOINT"], + ["keyword", "SB1"], + ["keyword", "SB2"], + ["keyword", "SB4"], + ["keyword", "SECOND"], + ["keyword", "SEGMENT"], + ["keyword", "SELECT"], + ["keyword", "SELF"], + ["keyword", "SEPARATE"], + ["keyword", "SEQUENCE"], + ["keyword", "SERIALIZABLE"], + ["keyword", "SET"], + ["keyword", "SHARE"], + ["keyword", "SHORT"], + ["keyword", "SIZE"], + ["keyword", "SIZE_T"], + ["keyword", "SOME"], + ["keyword", "SPARSE"], + ["keyword", "SQL"], + ["keyword", "SQLCODE"], + ["keyword", "SQLDATA"], + ["keyword", "SQLNAME"], + ["keyword", "SQLSTATE"], + ["keyword", "STANDARD"], + ["keyword", "START"], + ["keyword", "STATIC"], + ["keyword", "STDDEV"], + ["keyword", "STORED"], + ["keyword", "STRING"], + ["keyword", "STRUCT"], + ["keyword", "STYLE"], + ["keyword", "SUBMULTISET"], + ["keyword", "SUBPARTITION"], + ["keyword", "SUBSTITUTABLE"], + ["keyword", "SUBTYPE"], + ["keyword", "SUM"], + ["keyword", "SYNONYM"], + ["keyword", "TABAUTH"], + ["keyword", "TABLE"], + ["keyword", "TDO"], + ["keyword", "THE"], + ["keyword", "THEN"], + ["keyword", "TIME"], + ["keyword", "TIMESTAMP"], + ["keyword", "TIMEZONE_ABBR"], + ["keyword", "TIMEZONE_HOUR"], + ["keyword", "TIMEZONE_MINUTE"], + ["keyword", "TIMEZONE_REGION"], + ["keyword", "TO"], + ["keyword", "TRAILING"], + ["keyword", "TRANSACTION"], + ["keyword", "TRANSACTIONAL"], + ["keyword", "TRUSTED"], + ["keyword", "TYPE"], + ["keyword", "UB1"], + ["keyword", "UB2"], + ["keyword", "UB4"], + ["keyword", "UNDER"], + ["keyword", "UNION"], + ["keyword", "UNIQUE"], + ["keyword", "UNPLUG"], + ["keyword", "UNSIGNED"], + ["keyword", "UNTRUSTED"], + ["keyword", "UPDATE"], + ["keyword", "USE"], + ["keyword", "USING"], + ["keyword", "VALIST"], + ["keyword", "VALUE"], + ["keyword", "VALUES"], + ["keyword", "VARIABLE"], + ["keyword", "VARIANCE"], + ["keyword", "VARRAY"], + ["keyword", "VARYING"], + ["keyword", "VIEW"], + ["keyword", "VIEWS"], + ["keyword", "VOID"], + ["keyword", "WHEN"], + ["keyword", "WHERE"], + ["keyword", "WHILE"], + ["keyword", "WITH"], + ["keyword", "WORK"], + ["keyword", "WRAPPED"], + ["keyword", "WRITE"], + ["keyword", "YEAR"], + ["keyword", "ZONE"] +] diff --git a/package/src/prism/tests/languages/plsql/label_feature.test b/package/src/prism/tests/languages/plsql/label_feature.test new file mode 100644 index 00000000..478b3cb1 --- /dev/null +++ b/package/src/prism/tests/languages/plsql/label_feature.test @@ -0,0 +1,7 @@ +<< foo >> + +---------------------------------------------------- + +[ + ["label", "<< foo >>"] +] diff --git a/package/src/prism/tests/languages/plsql/operator_feature.test b/package/src/prism/tests/languages/plsql/operator_feature.test new file mode 100644 index 00000000..61b09184 --- /dev/null +++ b/package/src/prism/tests/languages/plsql/operator_feature.test @@ -0,0 +1,42 @@ ++ - * / ** +:= : +=> +% +|| +.. + += != <> ~= ^= < > <= >= +@ + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "**"], + ["operator", ":="], + ["operator", ":"], + ["operator", "=>"], + ["operator", "%"], + ["operator", "||"], + ["operator", ".."], + + ["operator", "="], + ["operator", "!="], + ["operator", "<"], + ["operator", ">"], + ["operator", "~="], + ["operator", "^="], + ["operator", "<"], + ["operator", ">"], + ["operator", "<="], + ["operator", ">="], + + ["operator", "@"] +] + +---------------------------------------------------- + +Checks for all operators. diff --git a/package/src/prism/tests/languages/powerquery/boolean_feature.test b/package/src/prism/tests/languages/powerquery/boolean_feature.test new file mode 100644 index 00000000..1b956af6 --- /dev/null +++ b/package/src/prism/tests/languages/powerquery/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for boolean. \ No newline at end of file diff --git a/package/src/prism/tests/languages/powerquery/comment_feature.test b/package/src/prism/tests/languages/powerquery/comment_feature.test new file mode 100644 index 00000000..0be8fb69 --- /dev/null +++ b/package/src/prism/tests/languages/powerquery/comment_feature.test @@ -0,0 +1,18 @@ +/**/ +/* foo +bar */ +// +// foo + +---------------------------------------------------- + +[ + ["comment", "/**/"], + ["comment", "/* foo\nbar */"], + ["comment", "//"], + ["comment", "// foo"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/powerquery/constant_feature.test b/package/src/prism/tests/languages/powerquery/constant_feature.test new file mode 100644 index 00000000..2825ef8f --- /dev/null +++ b/package/src/prism/tests/languages/powerquery/constant_feature.test @@ -0,0 +1,163 @@ +Day.Sunday +Day.Monday +Day.Tuesday +Day.Wednesday +Day.Thursday +Day.Friday +Day.Saturday +TraceLevel.Critical +TraceLevel.Error +TraceLevel.Information +TraceLevel.Verbose +TraceLevel.Warning +Occurrence.First +Occurrence.Last +Occurrence.All +Order.Ascending +Order.Descending +RoundingMode.AwayFromZero +RoundingMode.Down +RoundingMode.ToEven +RoundingMode.TowardZero +RoundingMode.Up +MissingField.Error +MissingField.Ignore +MissingField.UseNull +QuoteStyle.Csv +QuoteStyle.None +JoinKind.Inner +JoinKind.LeftOuter +JoinKind.RightOuter +JoinKind.FullOuter +JoinKind.LeftAnti +JoinKind.RightAnti +GroupKind.Global +GroupKind.Local +ExtraValues.List +ExtraValues.Ignore +ExtraValues.Error +JoinAlgorithm.Dynamic +JoinAlgorithm.PairwiseHash +JoinAlgorithm.SortMerge +JoinAlgorithm.LeftHash +JoinAlgorithm.RightHash +JoinAlgorithm.LeftIndex +JoinAlgorithm.RightIndex +JoinSide.Left +JoinSide.Right +Precision.Double +Precision.Decimal +RelativePosition.FromEnd +RelativePosition.FromStart +TextEncoding.Ascii +TextEncoding.BigEndianUnicode +TextEncoding.Unicode +TextEncoding.Utf8 +TextEncoding.Utf16 +TextEncoding.Windows +Any.Type +Binary.Type +Date.Type +DateTime.Type +DateTimeZone.Type +Duration.Type +Int8.Type +Int16.Type +Int32.Type +Int64.Type +Function.Type +List.Type +Logical.Type +None.Type +Number.Type +Record.Type +Table.Type +Text.Type +Time.Type +null + +---------------------------------------------------- + +[ + ["constant", "Day.Sunday"], + ["constant", "Day.Monday"], + ["constant", "Day.Tuesday"], + ["constant", "Day.Wednesday"], + ["constant", "Day.Thursday"], + ["constant", "Day.Friday"], + ["constant", "Day.Saturday"], + ["constant", "TraceLevel.Critical"], + ["constant", "TraceLevel.Error"], + ["constant", "TraceLevel.Information"], + ["constant", "TraceLevel.Verbose"], + ["constant", "TraceLevel.Warning"], + ["constant", "Occurrence.First"], + ["constant", "Occurrence.Last"], + ["constant", "Occurrence.All"], + ["constant", "Order.Ascending"], + ["constant", "Order.Descending"], + ["constant", "RoundingMode.AwayFromZero"], + ["constant", "RoundingMode.Down"], + ["constant", "RoundingMode.ToEven"], + ["constant", "RoundingMode.TowardZero"], + ["constant", "RoundingMode.Up"], + ["constant", "MissingField.Error"], + ["constant", "MissingField.Ignore"], + ["constant", "MissingField.UseNull"], + ["constant", "QuoteStyle.Csv"], + ["constant", "QuoteStyle.None"], + ["constant", "JoinKind.Inner"], + ["constant", "JoinKind.LeftOuter"], + ["constant", "JoinKind.RightOuter"], + ["constant", "JoinKind.FullOuter"], + ["constant", "JoinKind.LeftAnti"], + ["constant", "JoinKind.RightAnti"], + ["constant", "GroupKind.Global"], + ["constant", "GroupKind.Local"], + ["constant", "ExtraValues.List"], + ["constant", "ExtraValues.Ignore"], + ["constant", "ExtraValues.Error"], + ["constant", "JoinAlgorithm.Dynamic"], + ["constant", "JoinAlgorithm.PairwiseHash"], + ["constant", "JoinAlgorithm.SortMerge"], + ["constant", "JoinAlgorithm.LeftHash"], + ["constant", "JoinAlgorithm.RightHash"], + ["constant", "JoinAlgorithm.LeftIndex"], + ["constant", "JoinAlgorithm.RightIndex"], + ["constant", "JoinSide.Left"], + ["constant", "JoinSide.Right"], + ["constant", "Precision.Double"], + ["constant", "Precision.Decimal"], + ["constant", "RelativePosition.FromEnd"], + ["constant", "RelativePosition.FromStart"], + ["constant", "TextEncoding.Ascii"], + ["constant", "TextEncoding.BigEndianUnicode"], + ["constant", "TextEncoding.Unicode"], + ["constant", "TextEncoding.Utf8"], + ["constant", "TextEncoding.Utf16"], + ["constant", "TextEncoding.Windows"], + ["constant", "Any.Type"], + ["constant", "Binary.Type"], + ["constant", "Date.Type"], + ["constant", "DateTime.Type"], + ["constant", "DateTimeZone.Type"], + ["constant", "Duration.Type"], + ["constant", "Int8.Type"], + ["constant", "Int16.Type"], + ["constant", "Int32.Type"], + ["constant", "Int64.Type"], + ["constant", "Function.Type"], + ["constant", "List.Type"], + ["constant", "Logical.Type"], + ["constant", "None.Type"], + ["constant", "Number.Type"], + ["constant", "Record.Type"], + ["constant", "Table.Type"], + ["constant", "Text.Type"], + ["constant", "Time.Type"], + ["constant", "null"] +] + +---------------------------------------------------- + +Checks for contant. \ No newline at end of file diff --git a/package/src/prism/tests/languages/powerquery/datatype_feature.test b/package/src/prism/tests/languages/powerquery/datatype_feature.test new file mode 100644 index 00000000..cb2856db --- /dev/null +++ b/package/src/prism/tests/languages/powerquery/datatype_feature.test @@ -0,0 +1,41 @@ +any +anynonnull +binary +date +datetime +datetimezone +duration +function +list +logical +none +number +record +table +text +time + +---------------------------------------------------- + +[ + ["data-type", "any"], + ["data-type", "anynonnull"], + ["data-type", "binary"], + ["data-type", "date"], + ["data-type", "datetime"], + ["data-type", "datetimezone"], + ["data-type", "duration"], + ["data-type", "function"], + ["data-type", "list"], + ["data-type", "logical"], + ["data-type", "none"], + ["data-type", "number"], + ["data-type", "record"], + ["data-type", "table"], + ["data-type", "text"], + ["data-type", "time"] +] + +---------------------------------------------------- + +Checks for data-type. \ No newline at end of file diff --git a/package/src/prism/tests/languages/powerquery/function_feature.test b/package/src/prism/tests/languages/powerquery/function_feature.test new file mode 100644 index 00000000..9f01e3a7 --- /dev/null +++ b/package/src/prism/tests/languages/powerquery/function_feature.test @@ -0,0 +1,14 @@ +Table.ReplaceValue ( +UserDefinedFunction ( + +---------------------------------------------------- + +[ + ["function", "Table.ReplaceValue"], ["punctuation","("], + ["function", "UserDefinedFunction"], ["punctuation","("] + +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/powerquery/keyword_feature.test b/package/src/prism/tests/languages/powerquery/keyword_feature.test new file mode 100644 index 00000000..54c0b6ad --- /dev/null +++ b/package/src/prism/tests/languages/powerquery/keyword_feature.test @@ -0,0 +1,67 @@ +and +as +each +else +error +if +in +is +let +meta +not +otherwise +or +section +shared +then +try +type +#binary +#date +#datetime +#datetimezone +#duration +#infinity +#nan +#sections +#shared +#table +#time + +---------------------------------------------------- + +[ + ["keyword", "and"], + ["keyword", "as"], + ["keyword", "each"], + ["keyword", "else"], + ["keyword", "error"], + ["keyword", "if"], + ["keyword", "in"], + ["keyword", "is"], + ["keyword", "let"], + ["keyword", "meta"], + ["keyword", "not"], + ["keyword", "otherwise"], + ["keyword", "or"], + ["keyword", "section"], + ["keyword", "shared"], + ["keyword", "then"], + ["keyword", "try"], + ["keyword", "type"], + ["keyword", "#binary"], + ["keyword", "#date"], + ["keyword", "#datetime"], + ["keyword", "#datetimezone"], + ["keyword", "#duration"], + ["keyword", "#infinity"], + ["keyword", "#nan"], + ["keyword", "#sections"], + ["keyword", "#shared"], + ["keyword", "#table"], + ["keyword", "#time"] +] + +---------------------------------------------------- + +Checks for all keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/powerquery/number_feature.test b/package/src/prism/tests/languages/powerquery/number_feature.test new file mode 100644 index 00000000..83709bcf --- /dev/null +++ b/package/src/prism/tests/languages/powerquery/number_feature.test @@ -0,0 +1,45 @@ +42 +-42 ++42 +0.154 +.123 +0xF2 +42e5 +42.5e2 +123 +123e45 +123e+45 +123e-45 +123E45 +123E+45 +123E-45 +123.78e-45 +.78e-45 +123..456 + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "-42"], + ["number", "+42"], + ["number", "0.154"], + ["number", ".123"], + ["number", "0xF2"], + ["number", "42e5"], + ["number", "42.5e2"], + ["number", "123"], + ["number", "123e45"], + ["number", "123e+45"], + ["number", "123e-45"], + ["number", "123E45"], + ["number", "123E+45"], + ["number", "123E-45"], + ["number", "123.78e-45"], + ["number", ".78e-45"], + ["number", "123"], ["operator", ".."], ["number", "456"] +] + +---------------------------------------------------- + +Checks for number feature. \ No newline at end of file diff --git a/package/src/prism/tests/languages/powerquery/operator_feature.test b/package/src/prism/tests/languages/powerquery/operator_feature.test new file mode 100644 index 00000000..54e32810 --- /dev/null +++ b/package/src/prism/tests/languages/powerquery/operator_feature.test @@ -0,0 +1,19 @@ ++ - * / ^ += > >= < <= <> +& @ ? +=> +.. ... + +---------------------------------------------------- + +[ + ["operator", "+"], ["operator", "-"], ["operator", "*"], ["operator", "/"], ["operator", "^"], + ["operator", "="], ["operator", ">"], ["operator", ">="], ["operator", "<"], ["operator", "<="], ["operator", "<>"], + ["operator", "&"], ["operator", "@"], ["operator", "?"], + ["operator", "=>"], + ["operator", ".."], ["operator", "..."] +] + +---------------------------------------------------- + +Checks for all operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/powerquery/quoted_identifier_feature.test b/package/src/prism/tests/languages/powerquery/quoted_identifier_feature.test new file mode 100644 index 00000000..3bfe11ae --- /dev/null +++ b/package/src/prism/tests/languages/powerquery/quoted_identifier_feature.test @@ -0,0 +1,17 @@ +#"foo" +#"foo bar" +#"foo'bar" +#"foo""bar" + +---------------------------------------------------- + +[ + ["quoted-identifier", "#\"foo\""], + ["quoted-identifier", "#\"foo bar\""], + ["quoted-identifier", "#\"foo'bar\""], + ["quoted-identifier", "#\"foo\"\"bar\""] +] + +---------------------------------------------------- + +Checks for quoted-identifier. \ No newline at end of file diff --git a/package/src/prism/tests/languages/powerquery/string_feature.test b/package/src/prism/tests/languages/powerquery/string_feature.test new file mode 100644 index 00000000..afd850ec --- /dev/null +++ b/package/src/prism/tests/languages/powerquery/string_feature.test @@ -0,0 +1,19 @@ +"" +"foo" +"foo""bar" + +#!"Hello world#(cr,lf)" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foo\""], + ["string", "\"foo\"\"bar\""], + + ["string", "#!\"Hello world#(cr,lf)\""] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/powershell/boolean_feature.test b/package/src/prism/tests/languages/powershell/boolean_feature.test new file mode 100644 index 00000000..098bd621 --- /dev/null +++ b/package/src/prism/tests/languages/powershell/boolean_feature.test @@ -0,0 +1,18 @@ +$true $True $TRUE +$false $False $FALSE + +---------------------------------------------------- + +[ + ["boolean", "$true"], + ["boolean", "$True"], + ["boolean", "$TRUE"], + + ["boolean", "$false"], + ["boolean", "$False"], + ["boolean", "$FALSE"] + +] +---------------------------------------------------- + +Testing Booleans \ No newline at end of file diff --git a/package/src/prism/tests/languages/powershell/comment_feature.test b/package/src/prism/tests/languages/powershell/comment_feature.test new file mode 100644 index 00000000..7cabef68 --- /dev/null +++ b/package/src/prism/tests/languages/powershell/comment_feature.test @@ -0,0 +1,21 @@ +# single comment +# comment with $variable +<# multi + line + comment +#> +not a `# comment # is a comment + +---------------------------------------------------- + +[ + ["comment", "# single comment"], + ["comment", "# comment with $variable"], + ["comment", "<# multi\n\tline\n\tcomment\n#>"], + "\nnot a `# comment ", + ["comment", "# is a comment"] +] + +---------------------------------------------------- + +Testing comments \ No newline at end of file diff --git a/package/src/prism/tests/languages/powershell/function_feature.test b/package/src/prism/tests/languages/powershell/function_feature.test new file mode 100644 index 00000000..bd07a3dd --- /dev/null +++ b/package/src/prism/tests/languages/powershell/function_feature.test @@ -0,0 +1,400 @@ +ac cat chdir clc cli clp clv compare copy cp cpi cpp cvpa dbp del diff dir ebp +echo epal epcsv epsn erase fc fl ft fw gal gbp gc gci gcs gdr gi gl gm gp gps +group gsv gu gv gwmi iex ii ipal ipcsv ipsn irm iwmi iwr kill lp ls measure mi +mount move mp mv nal ndr ni nv ogv popd ps pushd pwd rbp rd rdr ren ri rm rmdir +rni rnp rp rv rvpa rwmi sal saps sasv sbp sc select set shcm si sl sleep sls +sort sp spps spsv start sv swmi tee trcm type write + +Add-Computer Add-Content Add-History Add-Member Add-PSSnapin Add-Type +Checkpoint-Computer Clear-Content Clear-EventLog Clear-History Clear-Item +Clear-ItemProperty Clear-Variable Compare-Object Complete-Transaction +Connect-PSSession ConvertFrom-Csv ConvertFrom-Json ConvertFrom-StringData +Convert-Path ConvertTo-Csv ConvertTo-Html ConvertTo-Json ConvertTo-Xml +Copy-Item Copy-ItemProperty Debug-Process Disable-ComputerRestore +Disable-PSBreakpoint Disable-PSRemoting Disable-PSSessionConfiguration +Disconnect-PSSession Enable-ComputerRestore Enable-PSBreakpoint +Enable-PSRemoting Enable-PSSessionConfiguration Enter-PSSession Exit-PSSession +Export-Alias Export-Clixml Export-Console Export-Csv Export-FormatData +Export-ModuleMember Export-PSSession ForEach-Object Format-Custom Format-List +Format-Table Format-Wide Get-Alias Get-ChildItem Get-Command +Get-ComputerRestorePoint Get-Content Get-ControlPanelItem Get-Culture Get-Date +Get-Event Get-EventLog Get-EventSubscriber Get-FormatData Get-Help Get-History +Get-Host Get-HotFix Get-Item Get-ItemProperty Get-Job Get-Location Get-Member +Get-Module Get-Process Get-PSBreakpoint Get-PSCallStack Get-PSDrive +Get-PSProvider Get-PSSession Get-PSSessionConfiguration Get-PSSnapin Get-Random +Get-Service Get-TraceSource Get-Transaction Get-TypeData Get-UICulture +Get-Unique Get-Variable Get-WmiObject Group-Object Import-Alias Import-Clixml +Import-Csv Import-LocalizedData Import-Module Import-PSSession Invoke-Command +Invoke-Expression Invoke-History Invoke-Item Invoke-RestMethod Invoke-WebRequest +Invoke-WmiMethod Join-Path Limit-EventLog Measure-Command Measure-Object +Move-Item Move-ItemProperty New-Alias New-Event New-EventLog New-Item +New-ItemProperty New-Module New-ModuleManifest New-Object New-PSDrive +New-PSSession New-PSSessionConfigurationFile New-PSSessionOption +New-PSTransportOption New-Service New-TimeSpan New-Variable New-WebServiceProxy +Out-Default Out-File Out-GridView Out-Host Out-Null Out-Printer Out-String +Pop-Location Push-Location Read-Host Receive-Job Receive-PSSession +Register-EngineEvent Register-ObjectEvent Register-PSSessionConfiguration +Register-WmiEvent Remove-Computer Remove-Event Remove-EventLog Remove-Item +Remove-ItemProperty Remove-Job Remove-Module Remove-PSBreakpoint Remove-PSDrive +Remove-PSSession Remove-PSSnapin Remove-TypeData Remove-Variable +Remove-WmiObject Rename-Computer Rename-Item Rename-ItemProperty +Reset-ComputerMachinePassword Resolve-Path Restart-Computer Restart-Service +Restore-Computer Resume-Job Resume-Service Save-Help Select-Object Select-String +Select-Xml Send-MailMessage Set-Alias Set-Content Set-Date Set-Item +Set-ItemProperty Set-Location Set-PSBreakpoint Set-PSDebug +Set-PSSessionConfiguration Set-Service Set-StrictMode Set-TraceSource +Set-Variable Set-WmiInstance Show-Command Show-ControlPanelItem Show-EventLog +Sort-Object Split-Path Start-Job Start-Process Start-Service Start-Sleep +Start-Transaction Stop-Computer Stop-Job Stop-Process Stop-Service Suspend-Job +Suspend-Service Tee-Object Test-ComputerSecureChannel Test-Connection +Test-ModuleManifest Test-Path Test-PSSessionConfigurationFile Trace-Command +Unblock-File Undo-Transaction Unregister-Event +Unregister-PSSessionConfiguration Update-FormatData Update-Help Update-List +Update-TypeData Use-Transaction Wait-Event Wait-Job Wait-Process Where-Object +Write-Debug Write-Error Write-EventLog Write-Host Write-Output Write-Progress +Write-Verbose Write-Warning +Get-AppxPackage + +---------------------------------------------------- + +[ + ["function", "ac"], + ["function", "cat"], + ["function", "chdir"], + ["function", "clc"], + ["function", "cli"], + ["function", "clp"], + ["function", "clv"], + ["function", "compare"], + ["function", "copy"], + ["function", "cp"], + ["function", "cpi"], + ["function", "cpp"], + ["function", "cvpa"], + ["function", "dbp"], + ["function", "del"], + ["function", "diff"], + ["function", "dir"], + ["function", "ebp"], + ["function", "echo"], + ["function", "epal"], + ["function", "epcsv"], + ["function", "epsn"], + ["function", "erase"], + ["function", "fc"], + ["function", "fl"], + ["function", "ft"], + ["function", "fw"], + ["function", "gal"], + ["function", "gbp"], + ["function", "gc"], + ["function", "gci"], + ["function", "gcs"], + ["function", "gdr"], + ["function", "gi"], + ["function", "gl"], + ["function", "gm"], + ["function", "gp"], + ["function", "gps"], + ["function", "group"], + ["function", "gsv"], + ["function", "gu"], + ["function", "gv"], + ["function", "gwmi"], + ["function", "iex"], + ["function", "ii"], + ["function", "ipal"], + ["function", "ipcsv"], + ["function", "ipsn"], + ["function", "irm"], + ["function", "iwmi"], + ["function", "iwr"], + ["function", "kill"], + ["function", "lp"], + ["function", "ls"], + ["function", "measure"], + ["function", "mi"], + ["function", "mount"], + ["function", "move"], + ["function", "mp"], + ["function", "mv"], + ["function", "nal"], + ["function", "ndr"], + ["function", "ni"], + ["function", "nv"], + ["function", "ogv"], + ["function", "popd"], + ["function", "ps"], + ["function", "pushd"], + ["function", "pwd"], + ["function", "rbp"], + ["function", "rd"], + ["function", "rdr"], + ["function", "ren"], + ["function", "ri"], + ["function", "rm"], + ["function", "rmdir"], + ["function", "rni"], + ["function", "rnp"], + ["function", "rp"], + ["function", "rv"], + ["function", "rvpa"], + ["function", "rwmi"], + ["function", "sal"], + ["function", "saps"], + ["function", "sasv"], + ["function", "sbp"], + ["function", "sc"], + ["function", "select"], + ["function", "set"], + ["function", "shcm"], + ["function", "si"], + ["function", "sl"], + ["function", "sleep"], + ["function", "sls"], + ["function", "sort"], + ["function", "sp"], + ["function", "spps"], + ["function", "spsv"], + ["function", "start"], + ["function", "sv"], + ["function", "swmi"], + ["function", "tee"], + ["function", "trcm"], + ["function", "type"], + ["function", "write"], + + ["function", "Add-Computer"], + ["function", "Add-Content"], + ["function", "Add-History"], + ["function", "Add-Member"], + ["function", "Add-PSSnapin"], + ["function", "Add-Type"], + ["function", "Checkpoint-Computer"], + ["function", "Clear-Content"], + ["function", "Clear-EventLog"], + ["function", "Clear-History"], + ["function", "Clear-Item"], + ["function", "Clear-ItemProperty"], + ["function", "Clear-Variable"], + ["function", "Compare-Object"], + ["function", "Complete-Transaction"], + ["function", "Connect-PSSession"], + ["function", "ConvertFrom-Csv"], + ["function", "ConvertFrom-Json"], + ["function", "ConvertFrom-StringData"], + ["function", "Convert-Path"], + ["function", "ConvertTo-Csv"], + ["function", "ConvertTo-Html"], + ["function", "ConvertTo-Json"], + ["function", "ConvertTo-Xml"], + ["function", "Copy-Item"], + ["function", "Copy-ItemProperty"], + ["function", "Debug-Process"], + ["function", "Disable-ComputerRestore"], + ["function", "Disable-PSBreakpoint"], + ["function", "Disable-PSRemoting"], + ["function", "Disable-PSSessionConfiguration"], + ["function", "Disconnect-PSSession"], + ["function", "Enable-ComputerRestore"], + ["function", "Enable-PSBreakpoint"], + ["function", "Enable-PSRemoting"], + ["function", "Enable-PSSessionConfiguration"], + ["function", "Enter-PSSession"], + ["function", "Exit-PSSession"], + ["function", "Export-Alias"], + ["function", "Export-Clixml"], + ["function", "Export-Console"], + ["function", "Export-Csv"], + ["function", "Export-FormatData"], + ["function", "Export-ModuleMember"], + ["function", "Export-PSSession"], + ["function", "ForEach-Object"], + ["function", "Format-Custom"], + ["function", "Format-List"], + ["function", "Format-Table"], + ["function", "Format-Wide"], + ["function", "Get-Alias"], + ["function", "Get-ChildItem"], + ["function", "Get-Command"], + ["function", "Get-ComputerRestorePoint"], + ["function", "Get-Content"], + ["function", "Get-ControlPanelItem"], + ["function", "Get-Culture"], + ["function", "Get-Date"], + ["function", "Get-Event"], + ["function", "Get-EventLog"], + ["function", "Get-EventSubscriber"], + ["function", "Get-FormatData"], + ["function", "Get-Help"], + ["function", "Get-History"], + ["function", "Get-Host"], + ["function", "Get-HotFix"], + ["function", "Get-Item"], + ["function", "Get-ItemProperty"], + ["function", "Get-Job"], + ["function", "Get-Location"], + ["function", "Get-Member"], + ["function", "Get-Module"], + ["function", "Get-Process"], + ["function", "Get-PSBreakpoint"], + ["function", "Get-PSCallStack"], + ["function", "Get-PSDrive"], + ["function", "Get-PSProvider"], + ["function", "Get-PSSession"], + ["function", "Get-PSSessionConfiguration"], + ["function", "Get-PSSnapin"], + ["function", "Get-Random"], + ["function", "Get-Service"], + ["function", "Get-TraceSource"], + ["function", "Get-Transaction"], + ["function", "Get-TypeData"], + ["function", "Get-UICulture"], + ["function", "Get-Unique"], + ["function", "Get-Variable"], + ["function", "Get-WmiObject"], + ["function", "Group-Object"], + ["function", "Import-Alias"], + ["function", "Import-Clixml"], + ["function", "Import-Csv"], + ["function", "Import-LocalizedData"], + ["function", "Import-Module"], + ["function", "Import-PSSession"], + ["function", "Invoke-Command"], + ["function", "Invoke-Expression"], + ["function", "Invoke-History"], + ["function", "Invoke-Item"], + ["function", "Invoke-RestMethod"], + ["function", "Invoke-WebRequest"], + ["function", "Invoke-WmiMethod"], + ["function", "Join-Path"], + ["function", "Limit-EventLog"], + ["function", "Measure-Command"], + ["function", "Measure-Object"], + ["function", "Move-Item"], + ["function", "Move-ItemProperty"], + ["function", "New-Alias"], + ["function", "New-Event"], + ["function", "New-EventLog"], + ["function", "New-Item"], + ["function", "New-ItemProperty"], + ["function", "New-Module"], + ["function", "New-ModuleManifest"], + ["function", "New-Object"], + ["function", "New-PSDrive"], + ["function", "New-PSSession"], + ["function", "New-PSSessionConfigurationFile"], + ["function", "New-PSSessionOption"], + ["function", "New-PSTransportOption"], + ["function", "New-Service"], + ["function", "New-TimeSpan"], + ["function", "New-Variable"], + ["function", "New-WebServiceProxy"], + ["function", "Out-Default"], + ["function", "Out-File"], + ["function", "Out-GridView"], + ["function", "Out-Host"], + ["function", "Out-Null"], + ["function", "Out-Printer"], + ["function", "Out-String"], + ["function", "Pop-Location"], + ["function", "Push-Location"], + ["function", "Read-Host"], + ["function", "Receive-Job"], + ["function", "Receive-PSSession"], + ["function", "Register-EngineEvent"], + ["function", "Register-ObjectEvent"], + ["function", "Register-PSSessionConfiguration"], + ["function", "Register-WmiEvent"], + ["function", "Remove-Computer"], + ["function", "Remove-Event"], + ["function", "Remove-EventLog"], + ["function", "Remove-Item"], + ["function", "Remove-ItemProperty"], + ["function", "Remove-Job"], + ["function", "Remove-Module"], + ["function", "Remove-PSBreakpoint"], + ["function", "Remove-PSDrive"], + ["function", "Remove-PSSession"], + ["function", "Remove-PSSnapin"], + ["function", "Remove-TypeData"], + ["function", "Remove-Variable"], + ["function", "Remove-WmiObject"], + ["function", "Rename-Computer"], + ["function", "Rename-Item"], + ["function", "Rename-ItemProperty"], + ["function", "Reset-ComputerMachinePassword"], + ["function", "Resolve-Path"], + ["function", "Restart-Computer"], + ["function", "Restart-Service"], + ["function", "Restore-Computer"], + ["function", "Resume-Job"], + ["function", "Resume-Service"], + ["function", "Save-Help"], + ["function", "Select-Object"], + ["function", "Select-String"], + ["function", "Select-Xml"], + ["function", "Send-MailMessage"], + ["function", "Set-Alias"], + ["function", "Set-Content"], + ["function", "Set-Date"], + ["function", "Set-Item"], + ["function", "Set-ItemProperty"], + ["function", "Set-Location"], + ["function", "Set-PSBreakpoint"], + ["function", "Set-PSDebug"], + ["function", "Set-PSSessionConfiguration"], + ["function", "Set-Service"], + ["function", "Set-StrictMode"], + ["function", "Set-TraceSource"], + ["function", "Set-Variable"], + ["function", "Set-WmiInstance"], + ["function", "Show-Command"], + ["function", "Show-ControlPanelItem"], + ["function", "Show-EventLog"], + ["function", "Sort-Object"], + ["function", "Split-Path"], + ["function", "Start-Job"], + ["function", "Start-Process"], + ["function", "Start-Service"], + ["function", "Start-Sleep"], + ["function", "Start-Transaction"], + ["function", "Stop-Computer"], + ["function", "Stop-Job"], + ["function", "Stop-Process"], + ["function", "Stop-Service"], + ["function", "Suspend-Job"], + ["function", "Suspend-Service"], + ["function", "Tee-Object"], + ["function", "Test-ComputerSecureChannel"], + ["function", "Test-Connection"], + ["function", "Test-ModuleManifest"], + ["function", "Test-Path"], + ["function", "Test-PSSessionConfigurationFile"], + ["function", "Trace-Command"], + ["function", "Unblock-File"], + ["function", "Undo-Transaction"], + ["function", "Unregister-Event"], + ["function", "Unregister-PSSessionConfiguration"], + ["function", "Update-FormatData"], + ["function", "Update-Help"], + ["function", "Update-List"], + ["function", "Update-TypeData"], + ["function", "Use-Transaction"], + ["function", "Wait-Event"], + ["function", "Wait-Job"], + ["function", "Wait-Process"], + ["function", "Where-Object"], + ["function", "Write-Debug"], + ["function", "Write-Error"], + ["function", "Write-EventLog"], + ["function", "Write-Host"], + ["function", "Write-Output"], + ["function", "Write-Progress"], + ["function", "Write-Verbose"], + ["function", "Write-Warning"], + ["function", "Get-AppxPackage"] +] +---------------------------------------------------- + +Testing functions and aliases diff --git a/package/src/prism/tests/languages/powershell/issue1407.test b/package/src/prism/tests/languages/powershell/issue1407.test new file mode 100644 index 00000000..683c9f20 --- /dev/null +++ b/package/src/prism/tests/languages/powershell/issue1407.test @@ -0,0 +1,43 @@ +While($true){ + Write-Output "$($($InFiles | Where-Object {$_.ToCopy -eq 0}).count)" +} + +---------------------------------------------------- + +[ + ["keyword", "While"], + ["punctuation", "("], + ["boolean", "$true"], + ["punctuation", ")"], + ["punctuation", "{"], + ["function", "Write-Output"], + ["string", [ + "\"", + ["function", [ + "$", + ["punctuation", "("], + "$", + ["punctuation", "("], + ["variable", "$InFiles"], + ["punctuation", "|"], + ["function", "Where-Object"], + ["punctuation", "{"], + ["variable", "$_"], + ["punctuation", "."], + "ToCopy ", + ["operator", "-eq"], + " 0", + ["punctuation", "}"], + ["punctuation", ")"], + ["punctuation", "."], + "count", + ["punctuation", ")"] + ]], + "\"" + ]], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for nested expressions in strings. See #1407 \ No newline at end of file diff --git a/package/src/prism/tests/languages/powershell/keyword_feature.test b/package/src/prism/tests/languages/powershell/keyword_feature.test new file mode 100644 index 00000000..4ffd92e6 --- /dev/null +++ b/package/src/prism/tests/languages/powershell/keyword_feature.test @@ -0,0 +1,46 @@ +Begin Break Catch Class Continue Data Define Do DynamicParam Else ElseIf End +Exit Filter Finally For ForEach From Function If InlineScript Parallel Param +Process Return Sequence Switch Throw Trap Try Until Using Var While Workflow + +---------------------------------------------------- + +[ + ["keyword", "Begin"], + ["keyword", "Break"], + ["keyword", "Catch"], + ["keyword", "Class"], + ["keyword", "Continue"], + ["keyword", "Data"], + ["keyword", "Define"], + ["keyword", "Do"], + ["keyword", "DynamicParam"], + ["keyword", "Else"], + ["keyword", "ElseIf"], + ["keyword", "End"], + ["keyword", "Exit"], + ["keyword", "Filter"], + ["keyword", "Finally"], + ["keyword", "For"], + ["keyword", "ForEach"], + ["keyword", "From"], + ["keyword", "Function"], + ["keyword", "If"], + ["keyword", "InlineScript"], + ["keyword", "Parallel"], + ["keyword", "Param"], + ["keyword", "Process"], + ["keyword", "Return"], + ["keyword", "Sequence"], + ["keyword", "Switch"], + ["keyword", "Throw"], + ["keyword", "Trap"], + ["keyword", "Try"], + ["keyword", "Until"], + ["keyword", "Using"], + ["keyword", "Var"], + ["keyword", "While"], + ["keyword", "Workflow"] +] +---------------------------------------------------- + +Testing keywords \ No newline at end of file diff --git a/package/src/prism/tests/languages/powershell/namespace_feature.test b/package/src/prism/tests/languages/powershell/namespace_feature.test new file mode 100644 index 00000000..6eaf01ca --- /dev/null +++ b/package/src/prism/tests/languages/powershell/namespace_feature.test @@ -0,0 +1,18 @@ +[System.String]::Empty; +[Foo.Bar+Baz]::Abc; +[int] 42; +[string[]] +[OutputType([System.Collections.Generic.List[int]])] + +---------------------------------------------------- + +[ + ["namespace", "[System.String]"],"::Empty",["punctuation", ";"], + ["namespace", "[Foo.Bar+Baz]"],"::Abc",["punctuation", ";"], + ["namespace", "[int]"]," 42",["punctuation", ";"], + ["namespace", "[string[]]"], + ["namespace", "[OutputType([System.Collections.Generic.List[int]])]"] +] +---------------------------------------------------- + +Testing namespaces \ No newline at end of file diff --git a/package/src/prism/tests/languages/powershell/operator_feature.test b/package/src/prism/tests/languages/powershell/operator_feature.test new file mode 100644 index 00000000..a746f1d6 --- /dev/null +++ b/package/src/prism/tests/languages/powershell/operator_feature.test @@ -0,0 +1,55 @@ +! -eq -ne -gt -ge -lt -le -shl -shr -not -band -and -bxor -bor -or +-Like -Match -Contains -In -NotLike -NotMatch -NotContains -NotIn -Replace -Join +-is -isNot -as +-= += *= /= %= - + * / % -- ++ + +---------------------------------------------------- + +[ + ["operator", "!"], + ["operator", "-eq"], + ["operator", "-ne"], + ["operator", "-gt"], + ["operator", "-ge"], + ["operator", "-lt"], + ["operator", "-le"], + ["operator", "-shl"], + ["operator", "-shr"], + ["operator", "-not"], + ["operator", "-band"], + ["operator", "-and"], + ["operator", "-bxor"], + ["operator", "-bor"], + ["operator", "-or"], + + ["operator", "-Like"], + ["operator", "-Match"], + ["operator", "-Contains"], + ["operator", "-In"], + ["operator", "-NotLike"], + ["operator", "-NotMatch"], + ["operator", "-NotContains"], + ["operator", "-NotIn"], + ["operator", "-Replace"], + ["operator", "-Join"], + ["operator", "-is"], + ["operator", "-isNot"], + ["operator", "-as"], + + ["operator", "-="], + ["operator", "+="], + ["operator", "*="], + ["operator", "/="], + ["operator", "%="], + ["operator", "-"], + ["operator", "+"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + ["operator", "--"], + ["operator", "++"] + +] +---------------------------------------------------- + +Testing operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/powershell/string_feature.test b/package/src/prism/tests/languages/powershell/string_feature.test new file mode 100644 index 00000000..d043d85a --- /dev/null +++ b/package/src/prism/tests/languages/powershell/string_feature.test @@ -0,0 +1,78 @@ +"a simple string" +"has $interpolated variables" +"has $($nesting -and 'interpolation')" +"string `"with`" escaping" +'non-interpolated $string' +'also ''with'' escaping' +'''twas also escaped' +an empty '' string +'can''t' +"a simple #comment string" +"has $interpolated <# variables #>" +"$($expression)" +"`$(escaped expression)" +"$($($exp))" + +---------------------------------------------------- + +[ + ["string", ["\"a simple string\""]], + ["string", [ + "\"has ", ["variable", "$interpolated"], " variables\"" + ]], + ["string", [ + "\"has ", + [ + "function", + [ + "$", + ["punctuation", "("], + ["variable", "$nesting"], + ["operator", "-and"], + ["string", "'interpolation'"], + ["punctuation", ")"] + ] + ], + "\"" + ]], + ["string", ["\"string `\"with`\" escaping\""]], + ["string", "'non-interpolated $string'"], + ["string", "'also ''with'' escaping'"], + ["string", "'''twas also escaped'"], + "\nan empty ", ["string", "''"], " string\n", + ["string", "'can''t'"], + ["string", ["\"a simple #comment string\""]], + ["string", [ + "\"has ", ["variable", "$interpolated"], " <# variables #>\"" + ]], + ["string", [ + "\"", + ["function", [ + "$", + ["punctuation", "("], + ["variable", "$expression"], + ["punctuation", ")"] + ]], + "\"" + ]], + ["string", [ + "\"`$(escaped expression)\"" + ]], + ["string", [ + "\"", + ["function", [ + "$", + ["punctuation", "("], + "$", + ["punctuation", "("], + ["variable", "$exp"], + ["punctuation", ")"], + ["punctuation", ")"] + ]], + "\"" + ]] +] + +---------------------------------------------------- + +Testing strings diff --git a/package/src/prism/tests/languages/powershell/variable_feature.test b/package/src/prism/tests/languages/powershell/variable_feature.test new file mode 100644 index 00000000..ede42010 --- /dev/null +++ b/package/src/prism/tests/languages/powershell/variable_feature.test @@ -0,0 +1,15 @@ +$foo $bar_baz $var4u $1 $true_as $falsey + +---------------------------------------------------- + +[ + ["variable", "$foo"], + ["variable", "$bar_baz"], + ["variable", "$var4u"], + ["variable", "$1"], + ["variable", "$true_as"], + ["variable", "$falsey"] +] +---------------------------------------------------- + +Testing variables \ No newline at end of file diff --git a/package/src/prism/tests/languages/processing/constant_feature.test b/package/src/prism/tests/languages/processing/constant_feature.test new file mode 100644 index 00000000..8761eb51 --- /dev/null +++ b/package/src/prism/tests/languages/processing/constant_feature.test @@ -0,0 +1,13 @@ +FOOBAR +FOO_BAR_42 + +---------------------------------------------------- + +[ + ["constant", "FOOBAR"], + ["constant", "FOO_BAR_42"] +] + +---------------------------------------------------- + +Checks for constants. \ No newline at end of file diff --git a/package/src/prism/tests/languages/processing/function_feature.test b/package/src/prism/tests/languages/processing/function_feature.test new file mode 100644 index 00000000..929e2590 --- /dev/null +++ b/package/src/prism/tests/languages/processing/function_feature.test @@ -0,0 +1,13 @@ +foo( +foo_bar_42 ( + +---------------------------------------------------- + +[ + ["function", "foo"], ["punctuation", "("], + ["function", "foo_bar_42"], ["punctuation", "("] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/processing/keyword_feature.test b/package/src/prism/tests/languages/processing/keyword_feature.test new file mode 100644 index 00000000..268b60dc --- /dev/null +++ b/package/src/prism/tests/languages/processing/keyword_feature.test @@ -0,0 +1,59 @@ +break +catch +case +class; +continue +default +else +extends; +final +for +if +implements; +import +new; +null +private +public +return +static +super +switch +this +try +void +while + +---------------------------------------------------- + +[ + ["keyword", "break"], + ["keyword", "catch"], + ["keyword", "case"], + ["keyword", "class"], ["punctuation", ";"], + ["keyword", "continue"], + ["keyword", "default"], + ["keyword", "else"], + ["keyword", "extends"], ["punctuation", ";"], + ["keyword", "final"], + ["keyword", "for"], + ["keyword", "if"], + ["keyword", "implements"], ["punctuation", ";"], + ["keyword", "import"], + ["keyword", "new"], ["punctuation", ";"], + ["keyword", "null"], + ["keyword", "private"], + ["keyword", "public"], + ["keyword", "return"], + ["keyword", "static"], + ["keyword", "super"], + ["keyword", "switch"], + ["keyword", "this"], + ["keyword", "try"], + ["keyword", "void"], + ["keyword", "while"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/processing/operator_feature.test b/package/src/prism/tests/languages/processing/operator_feature.test new file mode 100644 index 00000000..6e692fa7 --- /dev/null +++ b/package/src/prism/tests/languages/processing/operator_feature.test @@ -0,0 +1,31 @@ +< << <= +> >> >= +& && +| || +% ? +! != += == ++ += +- -= +* *= +/ /= + +---------------------------------------------------- + +[ + ["operator", "<"], ["operator", "<<"], ["operator", "<="], + ["operator", ">"], ["operator", ">>"], ["operator", ">="], + ["operator", "&"], ["operator", "&&"], + ["operator", "|"], ["operator", "||"], + ["operator", "%"], ["operator", "?"], + ["operator", "!"], ["operator", "!="], + ["operator", "="], ["operator", "=="], + ["operator", "+"], ["operator", "+="], + ["operator", "-"], ["operator", "-="], + ["operator", "*"], ["operator", "*="], + ["operator", "/"], ["operator", "/="] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/processing/type_feature.test b/package/src/prism/tests/languages/processing/type_feature.test new file mode 100644 index 00000000..0aeb5071 --- /dev/null +++ b/package/src/prism/tests/languages/processing/type_feature.test @@ -0,0 +1,31 @@ +boolean +byte +char +color +double +float +int +XML + +Foobar +Foo_bar_42 + +---------------------------------------------------- + +[ + ["type", "boolean"], + ["type", "byte"], + ["type", "char"], + ["type", "color"], + ["type", "double"], + ["type", "float"], + ["type", "int"], + ["type", "XML"], + + ["type", "Foobar"], + ["type", "Foo_bar_42"] +] + +---------------------------------------------------- + +Checks for types. \ No newline at end of file diff --git a/package/src/prism/tests/languages/prolog/builtin_feature.test b/package/src/prism/tests/languages/prolog/builtin_feature.test new file mode 100644 index 00000000..10e8947c --- /dev/null +++ b/package/src/prism/tests/languages/prolog/builtin_feature.test @@ -0,0 +1,17 @@ +fx +fy +xf xfx xfy +yf yfx + +---------------------------------------------------- + +[ + ["builtin", "fx"], + ["builtin", "fy"], + ["builtin", "xf"], ["builtin", "xfx"], ["builtin", "xfy"], + ["builtin", "yf"], ["builtin", "yfx"] +] + +---------------------------------------------------- + +Checks for builtins. \ No newline at end of file diff --git a/package/src/prism/tests/languages/prolog/comment_feature.test b/package/src/prism/tests/languages/prolog/comment_feature.test new file mode 100644 index 00000000..bec8c0c9 --- /dev/null +++ b/package/src/prism/tests/languages/prolog/comment_feature.test @@ -0,0 +1,16 @@ +% Foobar +/**/ +/* Foo +bar */ + +---------------------------------------------------- + +[ + ["comment", "% Foobar"], + ["comment", "/**/"], + ["comment", "/* Foo\nbar */"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/prolog/function_feature.test b/package/src/prism/tests/languages/prolog/function_feature.test new file mode 100644 index 00000000..56afaa3b --- /dev/null +++ b/package/src/prism/tests/languages/prolog/function_feature.test @@ -0,0 +1,17 @@ +foobar( +foo_bar_42( +abs/1 +atan/2 + +---------------------------------------------------- + +[ + ["function", "foobar"], ["punctuation", "("], + ["function", "foo_bar_42"], ["punctuation", "("], + ["function", "abs/1"], + ["function", "atan/2"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/prolog/number_feature.test b/package/src/prism/tests/languages/prolog/number_feature.test new file mode 100644 index 00000000..c969be19 --- /dev/null +++ b/package/src/prism/tests/languages/prolog/number_feature.test @@ -0,0 +1,15 @@ +42 +3.14159 +0 + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "0"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/prolog/operator_feature.test b/package/src/prism/tests/languages/prolog/operator_feature.test new file mode 100644 index 00000000..a282051b --- /dev/null +++ b/package/src/prism/tests/languages/prolog/operator_feature.test @@ -0,0 +1,29 @@ +is mod not xor + +: \ = +> < - +? * @ +/ ; + +^ | ! +$ . + +=@= + +---------------------------------------------------- + +[ + ["operator", "is"], ["operator", "mod"], ["operator", "not"], ["operator", "xor"], + + ["operator", ":"], ["operator", "\\"], ["operator", "="], + ["operator", ">"], ["operator", "<"], ["operator", "-"], + ["operator", "?"], ["operator", "*"], ["operator", "@"], + ["operator", "/"], ["operator", ";"], ["operator", "+"], + ["operator", "^"], ["operator", "|"], ["operator", "!"], + ["operator", "$"], ["operator", "."], + + ["operator", "=@="] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/prolog/string_feature.test b/package/src/prism/tests/languages/prolog/string_feature.test new file mode 100644 index 00000000..5993c668 --- /dev/null +++ b/package/src/prism/tests/languages/prolog/string_feature.test @@ -0,0 +1,27 @@ +"" +"fo\"obar" +"fo""obar" +"foo\ +bar" +'' +'fo\'obar' +'fo''obar' +'foo\ +bar' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""], + ["string", "\"fo\"\"obar\""], + ["string", "\"foo\\\nbar\""], + ["string", "''"], + ["string", "'fo\\'obar'"], + ["string", "'fo''obar'"], + ["string", "'foo\\\nbar'"] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/promql/aggregate_selection.test b/package/src/prism/tests/languages/promql/aggregate_selection.test new file mode 100644 index 00000000..da691de6 --- /dev/null +++ b/package/src/prism/tests/languages/promql/aggregate_selection.test @@ -0,0 +1,30 @@ +sum by (job) ( + rate(http_requests_total[5m]) +) + +---------------------------------------------------- + +[ + ["keyword", "sum"], + ["keyword", "by"], + ["vector-match", [ + ["punctuation", "("], + ["label-key", "job"], + ["punctuation", ")"] + ]], + ["punctuation", "("], + ["function", "rate"], + ["punctuation", "("], + "http_requests_total", + ["context-range", [ + ["punctuation", "["], + ["range-duration", "5m"], + ["punctuation", "]"] + ]], + ["punctuation", ")"], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks aggregate query. diff --git a/package/src/prism/tests/languages/promql/comment_feature.test b/package/src/prism/tests/languages/promql/comment_feature.test new file mode 100644 index 00000000..f218fd3c --- /dev/null +++ b/package/src/prism/tests/languages/promql/comment_feature.test @@ -0,0 +1,11 @@ +# These examples are taken from ... + +---------------------------------------------------- + +[ + ["comment", "# These examples are taken from ..."] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/promql/keyword_feature.test b/package/src/prism/tests/languages/promql/keyword_feature.test new file mode 100644 index 00000000..f579e7f1 --- /dev/null +++ b/package/src/prism/tests/languages/promql/keyword_feature.test @@ -0,0 +1,43 @@ +sum +min +max +avg +group +stddev +stdvar +count +count_values +bottomk +topk +quantile +on +ignoring +group_right +group_left +by +without +offset + +---------------------------------------------------- + +[ + ["keyword", "sum"], + ["keyword", "min"], + ["keyword", "max"], + ["keyword", "avg"], + ["keyword", "group"], + ["keyword", "stddev"], + ["keyword", "stdvar"], + ["keyword", "count"], + ["keyword", "count_values"], + ["keyword", "bottomk"], + ["keyword", "topk"], + ["keyword", "quantile"], + ["keyword", "on"], + ["keyword", "ignoring"], + ["keyword", "group_right"], + ["keyword", "group_left"], + ["keyword", "by"], + ["keyword", "without"], + ["keyword", "offset"] +] diff --git a/package/src/prism/tests/languages/promql/number_feature.test b/package/src/prism/tests/languages/promql/number_feature.test new file mode 100644 index 00000000..39af1314 --- /dev/null +++ b/package/src/prism/tests/languages/promql/number_feature.test @@ -0,0 +1,17 @@ +23 +-2.43 +3.4e-9 +0x8f +-Inf +NaN + +---------------------------------------------------- + +[ + ["number", "23"], + ["number", "-2.43"], + ["number", "3.4e-9"], + ["number", "0x8f"], + ["number", "-Inf"], + ["number", "NaN"] +] diff --git a/package/src/prism/tests/languages/promql/operator_feature.test b/package/src/prism/tests/languages/promql/operator_feature.test new file mode 100644 index 00000000..f3b638fc --- /dev/null +++ b/package/src/prism/tests/languages/promql/operator_feature.test @@ -0,0 +1,25 @@ +^ * / % + - +== != <= < >= > + +and unless or + +---------------------------------------------------- + +[ + ["operator", "^"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + ["operator", "+"], + ["operator", "-"], + ["operator", "=="], + ["operator", "!="], + ["operator", "<="], + ["operator", "<"], + ["operator", ">="], + ["operator", ">"], + + ["operator", "and"], + ["operator", "unless"], + ["operator", "or"] +] diff --git a/package/src/prism/tests/languages/promql/subquery_selection.test b/package/src/prism/tests/languages/promql/subquery_selection.test new file mode 100644 index 00000000..a56d098d --- /dev/null +++ b/package/src/prism/tests/languages/promql/subquery_selection.test @@ -0,0 +1,38 @@ +max_over_time(deriv(rate(distance_covered_total[5s])[30s:5s])[10m:]) + +---------------------------------------------------- + +[ + ["function", "max_over_time"], + ["punctuation", "("], + ["function", "deriv"], + ["punctuation", "("], + ["function", "rate"], + ["punctuation", "("], + "distance_covered_total", + ["context-range", [ + ["punctuation", "["], + ["range-duration", "5s"], + ["punctuation", "]"] + ]], + ["punctuation", ")"], + ["context-range", [ + ["punctuation", "["], + ["range-duration", "30s"], + ["punctuation", ":"], + ["range-duration", "5s"], + ["punctuation", "]"] + ]], + ["punctuation", ")"], + ["context-range", [ + ["punctuation", "["], + ["range-duration", "10m"], + ["punctuation", ":"], + ["punctuation", "]"] + ]], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks subquery. diff --git a/package/src/prism/tests/languages/promql/time_series_selection.test b/package/src/prism/tests/languages/promql/time_series_selection.test new file mode 100644 index 00000000..f4f33da0 --- /dev/null +++ b/package/src/prism/tests/languages/promql/time_series_selection.test @@ -0,0 +1,46 @@ +http_requests_total{job="apiserver", handler="/api/comments"}[5m] + +http_requests_total offset 5m + +http_requests_total{job=~".*server"} + +---------------------------------------------------- + +[ + "http_requests_total", + ["context-labels", [ + ["punctuation", "{"], + ["label-key", "job"], + ["punctuation", "="], + ["label-value", "\"apiserver\""], + ["punctuation", ","], + ["label-key", "handler"], + ["punctuation", "="], + ["label-value", "\"/api/comments\""], + ["punctuation", "}"] + ]], + ["context-range", [ + ["punctuation", "["], + ["range-duration", "5m"], + ["punctuation", "]"] + ]], + + "\n\nhttp_requests_total ", + ["keyword", "offset"], + ["context-range", [ + ["range-duration", "5m"] + ]], + + "\n\nhttp_requests_total", + ["context-labels", [ + ["punctuation", "{"], + ["label-key", "job"], + ["punctuation", "=~"], + ["label-value", "\".*server\""], + ["punctuation", "}"] + ]] +] + +---------------------------------------------------- + +Checks simple time series queries. diff --git a/package/src/prism/tests/languages/properties/comment_feature.test b/package/src/prism/tests/languages/properties/comment_feature.test new file mode 100644 index 00000000..2ac9b259 --- /dev/null +++ b/package/src/prism/tests/languages/properties/comment_feature.test @@ -0,0 +1,17 @@ +# +! +# Foobar baz +! Foobar baz + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "!"], + ["comment", "# Foobar baz"], + ["comment", "! Foobar baz"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/properties/key_value_feature.test b/package/src/prism/tests/languages/properties/key_value_feature.test new file mode 100644 index 00000000..953e04ec --- /dev/null +++ b/package/src/prism/tests/languages/properties/key_value_feature.test @@ -0,0 +1,36 @@ +foo bar +foo\:\=\ bar bar\:\= \ +baz +foo = bar +foo\:\=\ bar = bar\:\= \ +baz +foo : bar +foo\:\=\ bar : bar\:\= \ +baz + +---------------------------------------------------- + +[ + ["key", "foo"], + ["value", "bar"], + ["key", "foo\\:\\=\\ bar"], + ["value", "bar\\:\\= \\\nbaz"], + + ["key", "foo"], + ["punctuation", "="], + ["value", "bar"], + ["key", "foo\\:\\=\\ bar"], + ["punctuation", "="], + ["value", "bar\\:\\= \\\nbaz"], + + ["key", "foo"], + ["punctuation", ":"], + ["value", "bar"], + ["key", "foo\\:\\=\\ bar"], + ["punctuation", ":"], + ["value", "bar\\:\\= \\\nbaz"] +] + +---------------------------------------------------- + +Checks for keys and values. diff --git a/package/src/prism/tests/languages/protobuf/annotation_feature.test b/package/src/prism/tests/languages/protobuf/annotation_feature.test new file mode 100644 index 00000000..ec68a558 --- /dev/null +++ b/package/src/prism/tests/languages/protobuf/annotation_feature.test @@ -0,0 +1,20 @@ +int32 foo = 1 [deprecated=true]; + +---------------------------------------------------- + +[ + ["builtin", "int32"], + " foo ", + ["operator", "="], + ["number", "1"], + ["punctuation", "["], + ["annotation", "deprecated"], + ["operator", "="], + ["boolean", "true"], + ["punctuation", "]"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Check for annotations. diff --git a/package/src/prism/tests/languages/protobuf/builtin_feature.test b/package/src/prism/tests/languages/protobuf/builtin_feature.test new file mode 100644 index 00000000..bf170b97 --- /dev/null +++ b/package/src/prism/tests/languages/protobuf/builtin_feature.test @@ -0,0 +1,39 @@ +double +float +int32 +int64 +uint32 +uint64 +sint32 +sint64 +fixed32 +fixed64 +sfixed32 +sfixed64 +bool +string +bytes + +---------------------------------------------------- + +[ + ["builtin", "double"], + ["builtin", "float"], + ["builtin", "int32"], + ["builtin", "int64"], + ["builtin", "uint32"], + ["builtin", "uint64"], + ["builtin", "sint32"], + ["builtin", "sint64"], + ["builtin", "fixed32"], + ["builtin", "fixed64"], + ["builtin", "sfixed32"], + ["builtin", "sfixed64"], + ["builtin", "bool"], + ["builtin", "string"], + ["builtin", "bytes"] +] + +---------------------------------------------------- + +Check for builtin types. diff --git a/package/src/prism/tests/languages/protobuf/class-name_feature.test b/package/src/prism/tests/languages/protobuf/class-name_feature.test new file mode 100644 index 00000000..5f0ffb73 --- /dev/null +++ b/package/src/prism/tests/languages/protobuf/class-name_feature.test @@ -0,0 +1,102 @@ +syntax = "proto2"; +syntax = "proto3"; + +option java_multiple_files = true; + +import public "new.proto"; +import "other.proto"; + +enum Foo {} +extend Foo {} +service Foo {} +message Foo { + Bar Bar = 0; + foo.Bar Bar2 = 0; + .baz.Bar Bar3 = 0; +} + +---------------------------------------------------- + +[ + ["keyword", "syntax"], + ["operator", "="], + ["string", "\"proto2\""], + ["punctuation", ";"], + + ["keyword", "syntax"], + ["operator", "="], + ["string", "\"proto3\""], + ["punctuation", ";"], + + + ["keyword", "option"], + " java_multiple_files ", + ["operator", "="], + ["boolean", "true"], + ["punctuation", ";"], + + + ["keyword", "import"], + ["keyword", "public"], + ["string", "\"new.proto\""], + ["punctuation", ";"], + + ["keyword", "import"], + ["string", "\"other.proto\""], + ["punctuation", ";"], + + + ["keyword", "enum"], + ["class-name", "Foo"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "extend"], + ["class-name", "Foo"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "service"], + ["class-name", "Foo"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "message"], + ["class-name", "Foo"], + ["punctuation", "{"], + + ["positional-class-name", [ + "Bar" + ]], + " Bar ", + ["operator", "="], + ["number", "0"], + ["punctuation", ";"], + + ["positional-class-name", [ + "foo", + ["punctuation", "."], + "Bar" + ]], + " Bar2 ", + ["operator", "="], + ["number", "0"], + ["punctuation", ";"], + + ["positional-class-name", [ + ["punctuation", "."], + "baz", + ["punctuation", "."], + "Bar" + ]], + " Bar3 ", + ["operator", "="], + ["number", "0"], + ["punctuation", ";"], + + ["punctuation", "}"] +] + +---------------------------------------------------- + +Check for class names diff --git a/package/src/prism/tests/languages/protobuf/keyword_feature.test b/package/src/prism/tests/languages/protobuf/keyword_feature.test new file mode 100644 index 00000000..a5ae3f0a --- /dev/null +++ b/package/src/prism/tests/languages/protobuf/keyword_feature.test @@ -0,0 +1,49 @@ +enum +extend +extensions +import +message +oneof +option +optional +package +public +repeated +required +reserved +returns +rpc LotsOfReplies( +service +stream +syntax +to + +---------------------------------------------------- + +[ + ["keyword", "enum"], + ["keyword", "extend"], + ["keyword", "extensions"], + ["keyword", "import"], + ["keyword", "message"], + ["keyword", "oneof"], + ["keyword", "option"], + ["keyword", "optional"], + ["keyword", "package"], + ["keyword", "public"], + ["keyword", "repeated"], + ["keyword", "required"], + ["keyword", "reserved"], + ["keyword", "returns"], + ["keyword", "rpc"], + ["function", "LotsOfReplies"], + ["punctuation", "("], + ["keyword", "service"], + ["keyword", "stream"], + ["keyword", "syntax"], + ["keyword", "to"] +] + +---------------------------------------------------- + +Check for keywords diff --git a/package/src/prism/tests/languages/protobuf/map_feature.test b/package/src/prism/tests/languages/protobuf/map_feature.test new file mode 100644 index 00000000..94a54f6c --- /dev/null +++ b/package/src/prism/tests/languages/protobuf/map_feature.test @@ -0,0 +1,23 @@ +map bar; + +---------------------------------------------------- + +[ + ["map", [ + "map", + ["punctuation", "<"], + ["builtin", "string"], + ["punctuation", ","], + ["punctuation", "."], + "foo", + ["punctuation", "."], + "Foo", + ["punctuation", ">"] + ]], + " bar", + ["punctuation", ";"] +] + +---------------------------------------------------- + +Check for maps. diff --git a/package/src/prism/tests/languages/protobuf/rpc_feature.test b/package/src/prism/tests/languages/protobuf/rpc_feature.test new file mode 100644 index 00000000..a8802835 --- /dev/null +++ b/package/src/prism/tests/languages/protobuf/rpc_feature.test @@ -0,0 +1,68 @@ +rpc LotsOfReplies(HelloRequest) returns (stream HelloResponse); +rpc BidiHello(stream HelloRequest) returns (stream HelloResponse); +rpc CancelOperation(CancelOperationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { post: "/v1/{name=operations/**}:cancel" body: "*" }; +} + +---------------------------------------------------- + +[ + ["keyword", "rpc"], + ["function", "LotsOfReplies"], + ["punctuation", "("], + ["class-name", "HelloRequest"], + ["punctuation", ")"], + ["keyword", "returns"], + ["punctuation", "("], + ["keyword", "stream"], + ["class-name", "HelloResponse"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "rpc"], + ["function", "BidiHello"], + ["punctuation", "("], + ["keyword", "stream"], + ["class-name", "HelloRequest"], + ["punctuation", ")"], + ["keyword", "returns"], + ["punctuation", "("], + ["keyword", "stream"], + ["class-name", "HelloResponse"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "rpc"], + ["function", "CancelOperation"], + ["punctuation", "("], + ["class-name", "CancelOperationRequest"], + ["punctuation", ")"], + ["keyword", "returns"], + ["punctuation", "("], + ["class-name", "google.protobuf.Empty"], + ["punctuation", ")"], + ["punctuation", "{"], + ["keyword", "option"], + ["punctuation", "("], + "google", + ["punctuation", "."], + "api", + ["punctuation", "."], + "http", + ["punctuation", ")"], + ["operator", "="], + ["punctuation", "{"], + " post", + ["punctuation", ":"], + ["string", "\"/v1/{name=operations/**}:cancel\""], + " body", + ["punctuation", ":"], + ["string", "\"*\""], + ["punctuation", "}"], + ["punctuation", ";"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Check for RPC definitions. diff --git a/package/src/prism/tests/languages/protobuf/string_feature.test b/package/src/prism/tests/languages/protobuf/string_feature.test new file mode 100644 index 00000000..89296969 --- /dev/null +++ b/package/src/prism/tests/languages/protobuf/string_feature.test @@ -0,0 +1,23 @@ +"" +'' +"foo" +'foo' +"'foo'" +'"bar"' +" // comment " + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "''"], + ["string", "\"foo\""], + ["string", "'foo'"], + ["string", "\"'foo'\""], + ["string", "'\"bar\"'"], + ["string", "\" // comment \""] +] + +---------------------------------------------------- + +Checks for single-quoted and double-quoted strings. diff --git a/package/src/prism/tests/languages/psl/boolean_feature.test b/package/src/prism/tests/languages/psl/boolean_feature.test new file mode 100644 index 00000000..26f69ae9 --- /dev/null +++ b/package/src/prism/tests/languages/psl/boolean_feature.test @@ -0,0 +1,35 @@ +FALSE +False +false + +TRUE +True +true + +NO +No +no + +YES +Yes +yes + +---------------------------------------------------- + +[ + ["boolean", "FALSE"], + ["boolean", "False"], + ["boolean", "false"], + + ["boolean", "TRUE"], + ["boolean", "True"], + ["boolean", "true"], + + ["boolean", "NO"], + ["boolean", "No"], + ["boolean", "no"], + + ["boolean", "YES"], + ["boolean", "Yes"], + ["boolean", "yes"] +] diff --git a/package/src/prism/tests/languages/psl/builtin_feature.test b/package/src/prism/tests/languages/psl/builtin_feature.test new file mode 100644 index 00000000..ddb0e5e3 --- /dev/null +++ b/package/src/prism/tests/languages/psl/builtin_feature.test @@ -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 \ No newline at end of file diff --git a/package/src/prism/tests/languages/psl/comment_feature.test b/package/src/prism/tests/languages/psl/comment_feature.test new file mode 100644 index 00000000..5008b2ea --- /dev/null +++ b/package/src/prism/tests/languages/psl/comment_feature.test @@ -0,0 +1,23 @@ +# Comment +# This is not a "string" +# This is not a <<>=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 \ No newline at end of file diff --git a/package/src/prism/tests/languages/psl/overall_feature.test b/package/src/prism/tests/languages/psl/overall_feature.test new file mode 100644 index 00000000..66cab0cc --- /dev/null +++ b/package/src/prism/tests/languages/psl/overall_feature.test @@ -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", "{"], + + "\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 \ No newline at end of file diff --git a/package/src/prism/tests/languages/psl/string_feature.test b/package/src/prism/tests/languages/psl/string_feature.test new file mode 100644 index 00000000..a9a4a6de --- /dev/null +++ b/package/src/prism/tests/languages/psl/string_feature.test @@ -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\nline string\""]] +] + +---------------------------------------------------- + +Test for strings \ No newline at end of file diff --git a/package/src/prism/tests/languages/psl/variable_feature.test b/package/src/prism/tests/languages/psl/variable_feature.test new file mode 100644 index 00000000..fec84d3c --- /dev/null +++ b/package/src/prism/tests/languages/psl/variable_feature.test @@ -0,0 +1,15 @@ +errno +exit_status +PslDebug + +---------------------------------------------------- + +[ + ["variable", "errno"], + ["variable", "exit_status"], + ["variable", "PslDebug"] +] + +---------------------------------------------------- + +Test for variables \ No newline at end of file diff --git a/package/src/prism/tests/languages/pug/code_feature.test b/package/src/prism/tests/languages/pug/code_feature.test new file mode 100644 index 00000000..d8c17fec --- /dev/null +++ b/package/src/prism/tests/languages/pug/code_feature.test @@ -0,0 +1,36 @@ +- if(foo) + +p= 'This code is' + ' !' + +span + != 'Not escaped' + +---------------------------------------------------- + +[ + ["punctuation", "-"], + ["code", [ + ["keyword", "if"], + ["punctuation", "("], + "foo", + ["punctuation", ")"] + ]], + + ["tag", ["p"]], + ["punctuation", "="], + ["code", [ + ["string", "'This code is'"], + ["operator", "+"], + ["string", "' !'"] + ]], + + ["tag", ["span"]], + ["punctuation", "!="], + ["code", [ + ["string", "'Not escaped'"] + ]] +] + +---------------------------------------------------- + +Checks for inline code. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pug/comment_feature.test b/package/src/prism/tests/languages/pug/comment_feature.test new file mode 100644 index 00000000..1d550ebc --- /dev/null +++ b/package/src/prism/tests/languages/pug/comment_feature.test @@ -0,0 +1,22 @@ +// foo + bar + + // foo + bar baz + +// foo + + // bar + +---------------------------------------------------- + +[ + ["comment", "// foo\n bar"], + ["comment", "// foo\n\t\tbar baz"], + ["comment", "// foo"], + ["comment", "// bar"] +] + +---------------------------------------------------- + +Checks for single-line comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pug/doctype_feature.test b/package/src/prism/tests/languages/pug/doctype_feature.test new file mode 100644 index 00000000..cc97bb91 --- /dev/null +++ b/package/src/prism/tests/languages/pug/doctype_feature.test @@ -0,0 +1,15 @@ +doctype html +doctype 1.1 +doctype html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" + +---------------------------------------------------- + +[ + ["doctype", "doctype html"], + ["doctype", "doctype 1.1"], + ["doctype", "doctype html PUBLIC \"-//W3C//DTD XHTML Basic 1.1//EN\""] +] + +---------------------------------------------------- + +Checks for doctypes. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pug/filter_feature.test b/package/src/prism/tests/languages/pug/filter_feature.test new file mode 100644 index 00000000..f055e200 --- /dev/null +++ b/package/src/prism/tests/languages/pug/filter_feature.test @@ -0,0 +1,11 @@ +:language + code + +---------------------------------------------------- + +[ + ["filter", [ + ["filter-name", ":language"], + ["text", "code"] + ]] +] diff --git a/package/src/prism/tests/languages/pug/flow-control_feature.test b/package/src/prism/tests/languages/pug/flow-control_feature.test new file mode 100644 index 00000000..526ae016 --- /dev/null +++ b/package/src/prism/tests/languages/pug/flow-control_feature.test @@ -0,0 +1,75 @@ +each val, index in [1,2,3] + +if foo +else if bar +else + +unless foo + +while n < 4 + +case foo + when "bar" + default + +---------------------------------------------------- + +[ + ["flow-control", [ + ["each", [ + ["keyword", "each"], + " val", + ["punctuation", ","], + " index ", + ["keyword", "in"] + ]], + ["punctuation", "["], + ["number", "1"], + ["punctuation", ","], + ["number", "2"], + ["punctuation", ","], + ["number", "3"], + ["punctuation", "]"] + ]], + + ["flow-control", [ + ["branch", "if"], + " foo" + ]], + ["flow-control", [ + ["branch", "else"], + ["keyword", "if"], + " bar" + ]], + ["flow-control", [ + ["branch", "else"] + ]], + + ["flow-control", [ + ["branch", "unless"], + " foo" + ]], + + ["flow-control", [ + ["branch", "while"], + " n ", + ["operator", "<"], + ["number", "4"] + ]], + + ["flow-control", [ + ["branch", "case"], + " foo" + ]], + ["flow-control", [ + ["branch", "when"], + ["string", "\"bar\""] + ]], + ["flow-control", [ + ["branch", "default"] + ]] +] + +---------------------------------------------------- + +Checks for all flow-control structures. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pug/keyword_feature.test b/package/src/prism/tests/languages/pug/keyword_feature.test new file mode 100644 index 00000000..7a748a62 --- /dev/null +++ b/package/src/prism/tests/languages/pug/keyword_feature.test @@ -0,0 +1,27 @@ +block title + + extends ./foo.pug + +include ./bar.pug + +block append foo +append bar + +block prepend foo +prepend bar + +---------------------------------------------------- + +[ + ["keyword", "block title"], + ["keyword", "extends ./foo.pug"], + ["keyword", "include ./bar.pug"], + ["keyword", "block append foo"], + ["keyword", "append bar"], + ["keyword", "block prepend foo"], + ["keyword", "prepend bar"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/pug/mixin_feature.test b/package/src/prism/tests/languages/pug/mixin_feature.test new file mode 100644 index 00000000..06dcbb89 --- /dev/null +++ b/package/src/prism/tests/languages/pug/mixin_feature.test @@ -0,0 +1,35 @@ +mixin foo +mixin pet(name) + ++foo ++pet('cat') + +---------------------------------------------------- + +[ + ["mixin", [ + ["keyword", "mixin"], + ["function", "foo"] + ]], + ["mixin", [ + ["keyword", "mixin"], + ["function", "pet"], + ["punctuation", "("], + "name", + ["punctuation", ")"] + ]], + + ["mixin", [ + ["name", "+foo"] + ]], + ["mixin", [ + ["name", "+pet"], + ["punctuation", "("], + ["string", "'cat'"], + ["punctuation", ")"] + ]] +] + +---------------------------------------------------- + +Checks for mixins declaration and usage. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pug/multiline-plain-text_feature.test b/package/src/prism/tests/languages/pug/multiline-plain-text_feature.test new file mode 100644 index 00000000..04558567 --- /dev/null +++ b/package/src/prism/tests/languages/pug/multiline-plain-text_feature.test @@ -0,0 +1,30 @@ +div. + foobar + + baz +. + div. + foobar + baz + +---------------------------------------------------- + +[ + ["tag", [ + "div" + ]], + ["punctuation", "."], + ["multiline-plain-text", "\n foobar\n\n baz"], + + ["punctuation", "."], + + ["tag", [ + "div" + ]], + ["punctuation", "."], + ["multiline-plain-text", "\n\t\tfoobar\n\t\tbaz"] +] + +---------------------------------------------------- + +Checks for multi-line plain text. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pug/multiline-script_feature.test b/package/src/prism/tests/languages/pug/multiline-script_feature.test new file mode 100644 index 00000000..f71a82b3 --- /dev/null +++ b/package/src/prism/tests/languages/pug/multiline-script_feature.test @@ -0,0 +1,60 @@ +script. + alert(42); + +. + script(type='text/javascript'). + + if(foo) { + bar(1 + 5); + } + +---------------------------------------------------- + +[ + ["tag", ["script"]], + ["punctuation", "."], + ["multiline-script", [ + ["function", ["alert"]], + ["punctuation", "("], + ["number", "42"], + ["punctuation", ")"], + ["punctuation", ";"] + ]], + + ["punctuation", "."], + + ["tag", [ + "script", + ["attributes", [ + ["punctuation", "("], + ["attr-name", "type"], + ["punctuation", "="], + ["attr-value", [ + ["string", "'text/javascript'"] + ]], + ["punctuation", ")"] + ]] + ]], + ["punctuation", "."], + ["multiline-script", [ + ["keyword", "if"], + ["punctuation", "("], + "foo", + ["punctuation", ")"], + ["punctuation", "{"], + + ["function", ["bar"]], + ["punctuation", "("], + ["number", "1"], + ["operator", "+"], + ["number", "5"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "}"] + ]] +] + +---------------------------------------------------- + +Checks for multi-line scripts. The alone dot serves as a separator. diff --git a/package/src/prism/tests/languages/pug/plain-text_feature.test b/package/src/prism/tests/languages/pug/plain-text_feature.test new file mode 100644 index 00000000..b8cfc0a0 --- /dev/null +++ b/package/src/prism/tests/languages/pug/plain-text_feature.test @@ -0,0 +1,19 @@ +div foo + span foo bar + +---------------------------------------------------- + +[ + ["tag", [ + "div" + ]], + ["plain-text", "foo"], + ["tag", [ + "span" + ]], + ["plain-text", "foo bar"] +] + +---------------------------------------------------- + +Checks for single-line plain text. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pug/script_feature.test b/package/src/prism/tests/languages/pug/script_feature.test new file mode 100644 index 00000000..1c9b4d1c --- /dev/null +++ b/package/src/prism/tests/languages/pug/script_feature.test @@ -0,0 +1,39 @@ +script alert(42); + script(type='text/javascript') alert(42); + +---------------------------------------------------- + +[ + ["tag", ["script"]], + ["script", [ + ["function", ["alert"]], + ["punctuation", "("], + ["number", "42"], + ["punctuation", ")"], + ["punctuation", ";"] + ]], + + ["tag", [ + "script", + ["attributes", [ + ["punctuation", "("], + ["attr-name", "type"], + ["punctuation", "="], + ["attr-value", [ + ["string", "'text/javascript'"] + ]], + ["punctuation", ")"] + ]] + ]], + ["script", [ + ["function", ["alert"]], + ["punctuation", "("], + ["number", "42"], + ["punctuation", ")"], + ["punctuation", ";"] + ]] +] + +---------------------------------------------------- + +Checks for single-line scripts. diff --git a/package/src/prism/tests/languages/pug/tag_feature.test b/package/src/prism/tests/languages/pug/tag_feature.test new file mode 100644 index 00000000..034e556b --- /dev/null +++ b/package/src/prism/tests/languages/pug/tag_feature.test @@ -0,0 +1,132 @@ +div + span&attributes({'data-foo': 'bar'}) + +input(data-bar="foo", type='checkbox', checked) + +a(style={color: 'red', background: 'green'}) + +div(unescaped!="") + +a.button +.content + +a#main-link +#content + +div#test-id.test-class1.test-class2 +.test-class1#test-id.test-class2 + +a: span + +---------------------------------------------------- + +[ + ["tag", ["div"]], + ["tag", [ + "span", + ["attributes", [ + ["operator", "&"], + ["function", ["attributes"]], + ["punctuation", "("], + ["punctuation", "{"], + ["string-property", "'data-foo'"], + ["operator", ":"], + ["string", "'bar'"], + ["punctuation", "}"], + ["punctuation", ")"] + ]] + ]], + + ["tag", [ + "input", + ["attributes", [ + ["punctuation", "("], + ["attr-name", "data-bar"], + ["punctuation", "="], + ["attr-value", [ + ["string", "\"foo\""] + ]], + ["punctuation", ","], + ["attr-name", "type"], + ["punctuation", "="], + ["attr-value", [ + ["string", "'checkbox'"] + ]], + ["punctuation", ","], + ["attr-name", "checked"], + ["punctuation", ")"] + ]] + ]], + + ["tag", [ + "a", + ["attributes", [ + ["punctuation", "("], + ["attr-name", "style"], + ["punctuation", "="], + ["attr-value", [ + ["punctuation", "{"], + ["literal-property", "color"], + ["operator", ":"], + ["string", "'red'"], + ["punctuation", ","], + ["literal-property", "background"], + ["operator", ":"], + ["string", "'green'"], + ["punctuation", "}"] + ]], + ["punctuation", ")"] + ]] + ]], + + ["tag", [ + "div", + ["attributes", [ + ["punctuation", "("], + ["attr-name", "unescaped"], + ["punctuation", "!="], + ["attr-value", [ + ["string", "\"\""] + ]], + ["punctuation", ")"] + ]] + ]], + + ["tag", [ + "a", + ["attr-class", ".button"] + ]], + ["tag", [ + ["attr-class", ".content"] + ]], + + ["tag", [ + "a", + ["attr-id", "#main-link"] + ]], + ["tag", [ + ["attr-id", "#content"] + ]], + + ["tag", [ + "div", + ["attr-id", "#test-id"], + ["attr-class", ".test-class1"], + ["attr-class", ".test-class2"] + ]], + ["tag", [ + ["attr-class", ".test-class1"], + ["attr-id", "#test-id"], + ["attr-class", ".test-class2"] + ]], + + ["tag", [ + "a", + ["punctuation", ":"] + ]], + ["tag", ["span"]] +] + +---------------------------------------------------- + +Checks for tags and attributes. diff --git a/package/src/prism/tests/languages/puppet/attr-name_feature.test b/package/src/prism/tests/languages/puppet/attr-name_feature.test new file mode 100644 index 00000000..566a6f5c --- /dev/null +++ b/package/src/prism/tests/languages/puppet/attr-name_feature.test @@ -0,0 +1,19 @@ +foo { + bar => bar, + * => {} +} + +---------------------------------------------------- + +[ + "foo ", ["punctuation", "{"], + ["attr-name", "bar"], ["operator", "=>"], + " bar", ["punctuation", ","], + ["attr-name", "*"], ["operator", "=>"], + ["punctuation", "{"], ["punctuation", "}"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for attributes. \ No newline at end of file diff --git a/package/src/prism/tests/languages/puppet/boolean_feature.test b/package/src/prism/tests/languages/puppet/boolean_feature.test new file mode 100644 index 00000000..a40f8d95 --- /dev/null +++ b/package/src/prism/tests/languages/puppet/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/puppet/comment_feature.test b/package/src/prism/tests/languages/puppet/comment_feature.test new file mode 100644 index 00000000..163abecf --- /dev/null +++ b/package/src/prism/tests/languages/puppet/comment_feature.test @@ -0,0 +1,22 @@ +# +# Foobar +/* Foo +bar */ +/* @(foo) */ +# @(foo) +# foo /* bar */ baz + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# Foobar"], + ["multiline-comment", "/* Foo\nbar */"], + ["multiline-comment", "/* @(foo) */"], + ["comment", "# @(foo)"], + ["comment", "# foo /* bar */ baz"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/puppet/datatype_feature.test b/package/src/prism/tests/languages/puppet/datatype_feature.test new file mode 100644 index 00000000..ca504991 --- /dev/null +++ b/package/src/prism/tests/languages/puppet/datatype_feature.test @@ -0,0 +1,63 @@ +Any +Array +Boolean +Callable +Catalogentry +Class +Collection +Data +Default +Enum +Float +Hash +Integer +NotUndef +Numeric +Optional +Pattern +Regexp +Resource +Runtime +Scalar +String +Struct +Tuple +Type +Undef +Variant + +---------------------------------------------------- + +[ + ["datatype", "Any"], + ["datatype", "Array"], + ["datatype", "Boolean"], + ["datatype", "Callable"], + ["datatype", "Catalogentry"], + ["datatype", "Class"], + ["datatype", "Collection"], + ["datatype", "Data"], + ["datatype", "Default"], + ["datatype", "Enum"], + ["datatype", "Float"], + ["datatype", "Hash"], + ["datatype", "Integer"], + ["datatype", "NotUndef"], + ["datatype", "Numeric"], + ["datatype", "Optional"], + ["datatype", "Pattern"], + ["datatype", "Regexp"], + ["datatype", "Resource"], + ["datatype", "Runtime"], + ["datatype", "Scalar"], + ["datatype", "String"], + ["datatype", "Struct"], + ["datatype", "Tuple"], + ["datatype", "Type"], + ["datatype", "Undef"], + ["datatype", "Variant"] +] + +---------------------------------------------------- + +Checks for data types. \ No newline at end of file diff --git a/package/src/prism/tests/languages/puppet/function_feature.test b/package/src/prism/tests/languages/puppet/function_feature.test new file mode 100644 index 00000000..561e2c50 --- /dev/null +++ b/package/src/prism/tests/languages/puppet/function_feature.test @@ -0,0 +1,37 @@ +$foo.foobar +foo_bar_42() + +contain +debug +err +fail +include +info +notice +realize +require +tag +warning + +---------------------------------------------------- + +[ + ["variable", ["$foo"]], ["punctuation", "."], ["function", "foobar"], + ["function", "foo_bar_42"], ["punctuation", "("], ["punctuation", ")"], + + ["function", "contain"], + ["function", "debug"], + ["function", "err"], + ["function", "fail"], + ["function", "include"], + ["function", "info"], + ["function", "notice"], + ["function", "realize"], + ["function", "require"], + ["function", "tag"], + ["function", "warning"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/puppet/heredoc_feature.test b/package/src/prism/tests/languages/puppet/heredoc_feature.test new file mode 100644 index 00000000..0ab697f5 --- /dev/null +++ b/package/src/prism/tests/languages/puppet/heredoc_feature.test @@ -0,0 +1,51 @@ +@("FOO") + bar + $baz +FOO + +@(FOO BAR/) + bar + $baz + | FOO BAR + +@(foo!) +bar +|-foo! + +@("some text..."/nrts$uL) +some text +some text.. +some text... + +$foo = @(FOOBAR) == $bar + Foobar + -FOOBAR + +---------------------------------------------------- + +[ + ["heredoc", ["@(", ["punctuation", "\"FOO\""], ")"]], + ["heredoc", [ + "\tbar\n\t", + ["interpolation", ["$baz"]], + ["punctuation", "FOO"] + ]], + ["heredoc", ["@(", ["punctuation", "FOO BAR/"], ")"]], + ["heredoc", [ + "\tbar\n\t$baz\n\t", + ["punctuation", "| FOO BAR"] + ]], + ["heredoc", ["@(", ["punctuation", "foo!"], ")"]], + ["heredoc", ["bar\n", ["punctuation", "|-foo!"]]], + ["heredoc", ["@(", ["punctuation", "\"some text...\"/nrts$uL"], ")"]], + ["heredoc", ["some text\nsome text..\n", ["punctuation", "some text..."]]], + ["variable", ["$foo"]], ["operator", "="], + ["heredoc", ["@(", ["punctuation", "FOOBAR"], ")"]], + ["operator", "=="], ["variable", ["$bar"]], + ["heredoc", ["\tFoobar\n\t", ["punctuation", "-FOOBAR"]]] +] + +---------------------------------------------------- + +Checks for heredoc strings. +Also checks that string interpolation applies only inside quoted heredoc strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/puppet/interpolation_feature.test b/package/src/prism/tests/languages/puppet/interpolation_feature.test new file mode 100644 index 00000000..e078ec57 --- /dev/null +++ b/package/src/prism/tests/languages/puppet/interpolation_feature.test @@ -0,0 +1,54 @@ +"$foo ${::foo} ${foo::bar.foobar} +${foobar(42)} ${::interfaces.split(",")[3]} +${[1,20,3].filter |$value| { $value < 10 }}" + +---------------------------------------------------- + +[ + ["string", [["double-quoted", [ + "\"", + ["interpolation", ["$foo"]], + ["interpolation", [ + ["delimiter", "$"], ["punctuation", "{"], + ["short-variable", [["punctuation", "::"], "foo"]], + ["punctuation", "}"] + ]], + ["interpolation", [ + ["delimiter", "$"], ["punctuation", "{"], + ["short-variable", ["foo", ["punctuation", "::"], "bar"]], + ["punctuation", "."], ["function", "foobar"], + ["punctuation", "}"] + ]], + ["interpolation", [ + ["delimiter", "$"], ["punctuation", "{"], + ["function", "foobar"], ["punctuation", "("], + ["number", "42"], ["punctuation", ")"], + ["punctuation", "}"] + ]], + ["interpolation", [ + ["delimiter", "$"], ["punctuation", "{"], + ["short-variable", [["punctuation", "::"], "interfaces"]], + ["punctuation", "."], ["function", "split"], + ["punctuation", "("], ["string", [["double-quoted", ["\",\""]]]], + ["punctuation", ")"], ["punctuation", "["], + ["number", "3"], ["punctuation", "]"], + ["punctuation", "}"] + ]], + ["interpolation", [ + ["delimiter", "$"], ["punctuation", "{"], + ["punctuation", "["], ["number", "1"], + ["punctuation", ","], ["number", "20"], + ["punctuation", ","], ["number", "3"], ["punctuation", "]"], + ["punctuation", "."], ["function", "filter"], + ["operator", "|"], ["variable", ["$value"]], ["operator", "|"], + ["punctuation", "{"], ["variable", ["$value"]], + ["operator", "<"], ["number", "10"], ["punctuation", "}"], + ["punctuation", "}"] + ]], + "\"" + ]]]] +] + +---------------------------------------------------- + +Checks for interpolation. \ No newline at end of file diff --git a/package/src/prism/tests/languages/puppet/keyword_feature.test b/package/src/prism/tests/languages/puppet/keyword_feature.test new file mode 100644 index 00000000..3bff46c7 --- /dev/null +++ b/package/src/prism/tests/languages/puppet/keyword_feature.test @@ -0,0 +1,47 @@ +application +attr +case +class +consumes +default +define +else +elsif +function +if +import +inherits +node +private +produces +type +undef +unless + +---------------------------------------------------- + +[ + ["keyword", "application"], + ["keyword", "attr"], + ["keyword", "case"], + ["keyword", "class"], + ["keyword", "consumes"], + ["keyword", "default"], + ["keyword", "define"], + ["keyword", "else"], + ["keyword", "elsif"], + ["keyword", "function"], + ["keyword", "if"], + ["keyword", "import"], + ["keyword", "inherits"], + ["keyword", "node"], + ["keyword", "private"], + ["keyword", "produces"], + ["keyword", "type"], + ["keyword", "undef"], + ["keyword", "unless"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/puppet/number_feature.test b/package/src/prism/tests/languages/puppet/number_feature.test new file mode 100644 index 00000000..173733d5 --- /dev/null +++ b/package/src/prism/tests/languages/puppet/number_feature.test @@ -0,0 +1,25 @@ +0 +42 +3.14159 +3e8 +3.2E-7 +0777 +0xBadFace +0XBADFACE + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "42"], + ["number", "3.14159"], + ["number", "3e8"], + ["number", "3.2E-7"], + ["number", "0777"], + ["number", "0xBadFace"], + ["number", "0XBADFACE"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/puppet/operator_feature.test b/package/src/prism/tests/languages/puppet/operator_feature.test new file mode 100644 index 00000000..c3b9d394 --- /dev/null +++ b/package/src/prism/tests/languages/puppet/operator_feature.test @@ -0,0 +1,29 @@ += == =~ => +! != !~ +< << <<| +<= <~ <| <- +> >> >= +- -> +~> +| |> |>> +* / % + ? +and in or + +---------------------------------------------------- + +[ + ["operator", "="], ["operator", "=="], ["operator", "=~"], ["operator", "=>"], + ["operator", "!"], ["operator", "!="], ["operator", "!~"], + ["operator", "<"], ["operator", "<<"], ["operator", "<<|"], + ["operator", "<="], ["operator", "<~"], ["operator", "<|"], ["operator", "<-"], + ["operator", ">"], ["operator", ">>"], ["operator", ">="], + ["operator", "-"], ["operator", "->"], + ["operator", "~>"], + ["operator", "|"], ["operator", "|>"], ["operator", "|>>"], + ["operator", "*"], ["operator", "/"], ["operator", "%"], ["operator", "+"], ["operator", "?"], + ["operator", "and"], ["operator", "in"], ["operator", "or"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/puppet/regex_feature.test b/package/src/prism/tests/languages/puppet/regex_feature.test new file mode 100644 index 00000000..076e9925 --- /dev/null +++ b/package/src/prism/tests/languages/puppet/regex_feature.test @@ -0,0 +1,32 @@ +node /f(o)"o"[b]?a\/r/ +$foo = /foo +bar # baz +/m +$foo = /foo +bar # baz +/ixm +$foo = /@(foo)/ + +---------------------------------------------------- + +[ + ["keyword", "node"], + ["regex", ["/f(o)\"o\"[b]?a\\/r/"]], + ["variable", ["$foo"]], ["operator", "="], + ["regex", ["/foo\nbar # baz\n/m"]], + ["variable", ["$foo"]], ["operator", "="], + ["regex", [ + ["extended-regex", [ + "/foo\nbar ", + ["comment", "# baz"], + "\n/ixm" + ]] + ]], + ["variable", ["$foo"]], ["operator", "="], + ["regex", ["/@(foo)/"]] +] + +---------------------------------------------------- + +Checks for regular expressions. +Also checks that extended-regex accept inline comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/puppet/string_feature.test b/package/src/prism/tests/languages/puppet/string_feature.test new file mode 100644 index 00000000..27a25207 --- /dev/null +++ b/package/src/prism/tests/languages/puppet/string_feature.test @@ -0,0 +1,36 @@ +'' +'fo\'obar' +'foo +$bar +baz' +"" +"fo\"obar" +"foo +$bar +baz" +" @(foo) " +"foo /* bar */ baz" +"foo #bar baz" + +---------------------------------------------------- + +[ + ["string", ["''"]], + ["string", ["'fo\\'obar'"]], + ["string", ["'foo\n$bar\nbaz'"]], + ["string", [["double-quoted", ["\"\""]]]], + ["string", [["double-quoted", ["\"fo\\\"obar\""]]]], + ["string", [["double-quoted", [ + "\"foo\n", + ["interpolation", ["$bar"]], + "\nbaz\"" + ]]]], + ["string", [["double-quoted", ["\" @(foo) \""]]]], + ["string", [["double-quoted", ["\"foo /* bar */ baz\""]]]], + ["string", [["double-quoted", ["\"foo #bar baz\""]]]] +] + +---------------------------------------------------- + +Checks for strings. +Also checks that string interpolation only applies to double-quoted strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/puppet/variable_feature.test b/package/src/prism/tests/languages/puppet/variable_feature.test new file mode 100644 index 00000000..142e2070 --- /dev/null +++ b/package/src/prism/tests/languages/puppet/variable_feature.test @@ -0,0 +1,15 @@ +$foo +$::foobar_42 +$Foo::Bar_42::baz + +---------------------------------------------------- + +[ + ["variable", ["$foo"]], + ["variable", ["$", ["punctuation", "::"], "foobar_42"]], + ["variable", ["$Foo", ["punctuation", "::"], "Bar_42", ["punctuation", "::"], "baz"]] +] + +---------------------------------------------------- + +Checks for variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pure/comment_feature.test b/package/src/prism/tests/languages/pure/comment_feature.test new file mode 100644 index 00000000..474d904a --- /dev/null +++ b/package/src/prism/tests/languages/pure/comment_feature.test @@ -0,0 +1,20 @@ +// +// Foobar +/**/ +/* Foo +bar */ +#! --nochecks + +---------------------------------------------------- + +[ + ["comment", "//"], + ["comment", "// Foobar"], + ["comment", "/**/"], + ["comment", "/* Foo\nbar */"], + ["comment", "#! --nochecks"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pure/function_feature.test b/package/src/prism/tests/languages/pure/function_feature.test new file mode 100644 index 00000000..d89c5479 --- /dev/null +++ b/package/src/prism/tests/languages/pure/function_feature.test @@ -0,0 +1,619 @@ +abs +add_fundef +add_fundef_at +add_interface +add_interface_at +add_macdef +add_macdef_at +add_typedef +add_typedef_at +add_addr +add_constdef +add_vardef +all +any +appl +applp +arity +bigint +bigintp +blob +blob_crc +blob_size +blobp +bool +boolp +byte_matrix +byte_pointer +byte_string +byte_cstring +byte_string_pointer +byte_cstring_pointer +calloc +cat +catmap +ceil +char +charp +chars +check_ptrtag +chr +clear_sentry +clearsym +closure +closurep +cmatrix +cmatrixp +col +cols +colcat +colcatmap +colmap +colrev +colvector +colvectorp +colvectorseq +complex +complex_float_matrix +complex_float_pointer +complex_matrix +complex_matrix_view +complex_pointer +complexp +conj +cooked +cookedp +cst +cstring +cstring_dup +cstring_list +cstring_vector +curry +curry3 +cycle +cyclen +del_constdef +del_fundef +del_interface +del_macdef +del_typedef +del_vardef +delete +diag +diagmat +dim +dmatrix +dmatrixp +do +double +double_matrix +double_matrix_view +double_pointer +doublep +dowith +dowith3 +drop +dropwhile +eval +evalcmd +exactp +filter +fix +fixity +flip +float_matrix +float_pointer +floor +foldl +foldl1 +foldr +foldr1 +frac +free +fun +funp +function +functionp +gcd +get +get_byte +get_constdef +get_double +get_float +get_fundef +get_int +get_int64 +get_interface +get_interface_typedef +get_long +get_macdef +get_pointer +get_ptrtag +get_short +get_sentry +get_string +get_typedef +get_vardef +globsym +hash +head +id +im +imatrix +imatrixp +index +inexactp +infp +init +insert +int +int_matrix +int_matrix_view +int_pointer +intp +int64_matrix +int64_pointer +integer +integerp +iterate +iteraten +iterwhile +join +key +keys +lambda +lambdap +last +lasterr +lasterrpos +lcd +list +list2 +listp +listmap +make_ptrtag +malloc +map +matcat +matrix +matrixp +max +member +min +nanp +nargs +nmatrix +nmatrixp +null +number +numberp +ord +pack +packed +pointer +pointer_cast +pointer_tag +pointer_type +pointerp +pow +pred +ptrtag +put +put_byte +put_double +put_float +put_int +put_int64 +put_long +put_pointer +put_short +put_string +rational +rationalp +re +real +realp +realloc +record +recordp +redim +reduce +reduce_with +ref +refp +repeat +repeatn +reverse +rlist +rlistp +round +row +rows +rowcat +rowcatmap +rowmap +rowrev +rowvector +rowvectorp +rowvectorseq +same +scanl +scanl1 +scanr +scanr1 +sentry +sgn +short_matrix +short_pointer +slice +smatrix +smatrixp +sort +split +str +strcat +stream +stride +string +string_dup +string_list +string_vector +stringp +subdiag +subdiagmat +submat +subseq +subseq2 +substr +succ +supdiag +supdiagmat +symbol +symbolp +tail +take +takewhile +thunk +thunkp +transpose +trunc +tuple +tuplep +typep +ubyte +uint +uint64 +ulong +uncurry +uncurry3 +unref +unzip +unzip3 +update +ushort +val +vals +var +varp +vector +vectorp +vectorseq +void +zip +zip3 +zipwith +zipwith3 + +---------------------------------------------------- + +[ + ["function", "abs"], + ["function", "add_fundef"], + ["function", "add_fundef_at"], + ["function", "add_interface"], + ["function", "add_interface_at"], + ["function", "add_macdef"], + ["function", "add_macdef_at"], + ["function", "add_typedef"], + ["function", "add_typedef_at"], + ["function", "add_addr"], + ["function", "add_constdef"], + ["function", "add_vardef"], + ["function", "all"], + ["function", "any"], + ["function", "appl"], + ["function", "applp"], + ["function", "arity"], + ["function", "bigint"], + ["function", "bigintp"], + ["function", "blob"], + ["function", "blob_crc"], + ["function", "blob_size"], + ["function", "blobp"], + ["function", "bool"], + ["function", "boolp"], + ["function", "byte_matrix"], + ["function", "byte_pointer"], + ["function", "byte_string"], + ["function", "byte_cstring"], + ["function", "byte_string_pointer"], + ["function", "byte_cstring_pointer"], + ["function", "calloc"], + ["function", "cat"], + ["function", "catmap"], + ["function", "ceil"], + ["function", "char"], + ["function", "charp"], + ["function", "chars"], + ["function", "check_ptrtag"], + ["function", "chr"], + ["function", "clear_sentry"], + ["function", "clearsym"], + ["function", "closure"], + ["function", "closurep"], + ["function", "cmatrix"], + ["function", "cmatrixp"], + ["function", "col"], + ["function", "cols"], + ["function", "colcat"], + ["function", "colcatmap"], + ["function", "colmap"], + ["function", "colrev"], + ["function", "colvector"], + ["function", "colvectorp"], + ["function", "colvectorseq"], + ["function", "complex"], + ["function", "complex_float_matrix"], + ["function", "complex_float_pointer"], + ["function", "complex_matrix"], + ["function", "complex_matrix_view"], + ["function", "complex_pointer"], + ["function", "complexp"], + ["function", "conj"], + ["function", "cooked"], + ["function", "cookedp"], + ["function", "cst"], + ["function", "cstring"], + ["function", "cstring_dup"], + ["function", "cstring_list"], + ["function", "cstring_vector"], + ["function", "curry"], + ["function", "curry3"], + ["function", "cycle"], + ["function", "cyclen"], + ["function", "del_constdef"], + ["function", "del_fundef"], + ["function", "del_interface"], + ["function", "del_macdef"], + ["function", "del_typedef"], + ["function", "del_vardef"], + ["function", "delete"], + ["function", "diag"], + ["function", "diagmat"], + ["function", "dim"], + ["function", "dmatrix"], + ["function", "dmatrixp"], + ["function", "do"], + ["function", "double"], + ["function", "double_matrix"], + ["function", "double_matrix_view"], + ["function", "double_pointer"], + ["function", "doublep"], + ["function", "dowith"], + ["function", "dowith3"], + ["function", "drop"], + ["function", "dropwhile"], + ["function", "eval"], + ["function", "evalcmd"], + ["function", "exactp"], + ["function", "filter"], + ["function", "fix"], + ["function", "fixity"], + ["function", "flip"], + ["function", "float_matrix"], + ["function", "float_pointer"], + ["function", "floor"], + ["function", "foldl"], + ["function", "foldl1"], + ["function", "foldr"], + ["function", "foldr1"], + ["function", "frac"], + ["function", "free"], + ["function", "fun"], + ["function", "funp"], + ["function", "function"], + ["function", "functionp"], + ["function", "gcd"], + ["function", "get"], + ["function", "get_byte"], + ["function", "get_constdef"], + ["function", "get_double"], + ["function", "get_float"], + ["function", "get_fundef"], + ["function", "get_int"], + ["function", "get_int64"], + ["function", "get_interface"], + ["function", "get_interface_typedef"], + ["function", "get_long"], + ["function", "get_macdef"], + ["function", "get_pointer"], + ["function", "get_ptrtag"], + ["function", "get_short"], + ["function", "get_sentry"], + ["function", "get_string"], + ["function", "get_typedef"], + ["function", "get_vardef"], + ["function", "globsym"], + ["function", "hash"], + ["function", "head"], + ["function", "id"], + ["function", "im"], + ["function", "imatrix"], + ["function", "imatrixp"], + ["function", "index"], + ["function", "inexactp"], + ["function", "infp"], + ["function", "init"], + ["function", "insert"], + ["function", "int"], + ["function", "int_matrix"], + ["function", "int_matrix_view"], + ["function", "int_pointer"], + ["function", "intp"], + ["function", "int64_matrix"], + ["function", "int64_pointer"], + ["function", "integer"], + ["function", "integerp"], + ["function", "iterate"], + ["function", "iteraten"], + ["function", "iterwhile"], + ["function", "join"], + ["function", "key"], + ["function", "keys"], + ["function", "lambda"], + ["function", "lambdap"], + ["function", "last"], + ["function", "lasterr"], + ["function", "lasterrpos"], + ["function", "lcd"], + ["function", "list"], + ["function", "list2"], + ["function", "listp"], + ["function", "listmap"], + ["function", "make_ptrtag"], + ["function", "malloc"], + ["function", "map"], + ["function", "matcat"], + ["function", "matrix"], + ["function", "matrixp"], + ["function", "max"], + ["function", "member"], + ["function", "min"], + ["function", "nanp"], + ["function", "nargs"], + ["function", "nmatrix"], + ["function", "nmatrixp"], + ["function", "null"], + ["function", "number"], + ["function", "numberp"], + ["function", "ord"], + ["function", "pack"], + ["function", "packed"], + ["function", "pointer"], + ["function", "pointer_cast"], + ["function", "pointer_tag"], + ["function", "pointer_type"], + ["function", "pointerp"], + ["function", "pow"], + ["function", "pred"], + ["function", "ptrtag"], + ["function", "put"], + ["function", "put_byte"], + ["function", "put_double"], + ["function", "put_float"], + ["function", "put_int"], + ["function", "put_int64"], + ["function", "put_long"], + ["function", "put_pointer"], + ["function", "put_short"], + ["function", "put_string"], + ["function", "rational"], + ["function", "rationalp"], + ["function", "re"], + ["function", "real"], + ["function", "realp"], + ["function", "realloc"], + ["function", "record"], + ["function", "recordp"], + ["function", "redim"], + ["function", "reduce"], + ["function", "reduce_with"], + ["function", "ref"], + ["function", "refp"], + ["function", "repeat"], + ["function", "repeatn"], + ["function", "reverse"], + ["function", "rlist"], + ["function", "rlistp"], + ["function", "round"], + ["function", "row"], + ["function", "rows"], + ["function", "rowcat"], + ["function", "rowcatmap"], + ["function", "rowmap"], + ["function", "rowrev"], + ["function", "rowvector"], + ["function", "rowvectorp"], + ["function", "rowvectorseq"], + ["function", "same"], + ["function", "scanl"], + ["function", "scanl1"], + ["function", "scanr"], + ["function", "scanr1"], + ["function", "sentry"], + ["function", "sgn"], + ["function", "short_matrix"], + ["function", "short_pointer"], + ["function", "slice"], + ["function", "smatrix"], + ["function", "smatrixp"], + ["function", "sort"], + ["function", "split"], + ["function", "str"], + ["function", "strcat"], + ["function", "stream"], + ["function", "stride"], + ["function", "string"], + ["function", "string_dup"], + ["function", "string_list"], + ["function", "string_vector"], + ["function", "stringp"], + ["function", "subdiag"], + ["function", "subdiagmat"], + ["function", "submat"], + ["function", "subseq"], + ["function", "subseq2"], + ["function", "substr"], + ["function", "succ"], + ["function", "supdiag"], + ["function", "supdiagmat"], + ["function", "symbol"], + ["function", "symbolp"], + ["function", "tail"], + ["function", "take"], + ["function", "takewhile"], + ["function", "thunk"], + ["function", "thunkp"], + ["function", "transpose"], + ["function", "trunc"], + ["function", "tuple"], + ["function", "tuplep"], + ["function", "typep"], + ["function", "ubyte"], + ["function", "uint"], + ["function", "uint64"], + ["function", "ulong"], + ["function", "uncurry"], + ["function", "uncurry3"], + ["function", "unref"], + ["function", "unzip"], + ["function", "unzip3"], + ["function", "update"], + ["function", "ushort"], + ["function", "val"], + ["function", "vals"], + ["function", "var"], + ["function", "varp"], + ["function", "vector"], + ["function", "vectorp"], + ["function", "vectorseq"], + ["function", "void"], + ["function", "zip"], + ["function", "zip3"], + ["function", "zipwith"], + ["function", "zipwith3"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pure/keyword_feature.test b/package/src/prism/tests/languages/pure/keyword_feature.test new file mode 100644 index 00000000..be0a4dec --- /dev/null +++ b/package/src/prism/tests/languages/pure/keyword_feature.test @@ -0,0 +1,113 @@ +ans +break +bt +case +catch +cd +clear +const +def +del +dump +else +end +exit +extern +false +force +help +if +infix +infixl +infixr +interface +let +ls +mem +namespace +nonfix +NULL +of +otherwise +outfix +override +postfix +prefix +private +public +pwd +quit +run +save +show +stats +then +throw +trace +true +type +underride +using +when +with + +---------------------------------------------------- + +[ + ["keyword", "ans"], + ["keyword", "break"], + ["keyword", "bt"], + ["keyword", "case"], + ["keyword", "catch"], + ["keyword", "cd"], + ["keyword", "clear"], + ["keyword", "const"], + ["keyword", "def"], + ["keyword", "del"], + ["keyword", "dump"], + ["keyword", "else"], + ["keyword", "end"], + ["keyword", "exit"], + ["keyword", "extern"], + ["keyword", "false"], + ["keyword", "force"], + ["keyword", "help"], + ["keyword", "if"], + ["keyword", "infix"], + ["keyword", "infixl"], + ["keyword", "infixr"], + ["keyword", "interface"], + ["keyword", "let"], + ["keyword", "ls"], + ["keyword", "mem"], + ["keyword", "namespace"], + ["keyword", "nonfix"], + ["keyword", "NULL"], + ["keyword", "of"], + ["keyword", "otherwise"], + ["keyword", "outfix"], + ["keyword", "override"], + ["keyword", "postfix"], + ["keyword", "prefix"], + ["keyword", "private"], + ["keyword", "public"], + ["keyword", "pwd"], + ["keyword", "quit"], + ["keyword", "run"], + ["keyword", "save"], + ["keyword", "show"], + ["keyword", "stats"], + ["keyword", "then"], + ["keyword", "throw"], + ["keyword", "trace"], + ["keyword", "true"], + ["keyword", "type"], + ["keyword", "underride"], + ["keyword", "using"], + ["keyword", "when"], + ["keyword", "with"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pure/number_feature.test b/package/src/prism/tests/languages/pure/number_feature.test new file mode 100644 index 00000000..e3a030a4 --- /dev/null +++ b/package/src/prism/tests/languages/pure/number_feature.test @@ -0,0 +1,31 @@ +inf +nan + +0xBadFace +0b01010 +42 +4711L +3.14159 +3e8 +4.2E-7 +0.9e+12 + +---------------------------------------------------- + +[ + ["number", "inf"], + ["number", "nan"], + + ["number", "0xBadFace"], + ["number", "0b01010"], + ["number", "42"], + ["number", "4711L"], + ["number", "3.14159"], + ["number", "3e8"], + ["number", "4.2E-7"], + ["number", "0.9e+12"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pure/operator_feature.test b/package/src/prism/tests/languages/pure/operator_feature.test new file mode 100644 index 00000000..c48a3557 --- /dev/null +++ b/package/src/prism/tests/languages/pure/operator_feature.test @@ -0,0 +1,29 @@ +and div mod not or + +! " # $ % & +' * + - . / +: < = > ? @ +\ ^ _ ` ~ + +¡ ¢ × ÷ + +<,| + +---------------------------------------------------- + +[ + ["operator", "and"], ["operator", "div"], ["operator", "mod"], ["operator", "not"], ["operator", "or"], + + ["operator", "!"], ["operator", "\""], ["operator", "#"], ["operator", "$"], ["operator", "%"], ["operator", "&"], + ["operator", "'"], ["operator", "*"], ["operator", "+"], ["operator", "-"], ["operator", "."], ["operator", "/"], + ["operator", ":"], ["operator", "<"], ["operator", "="], ["operator", ">"], ["operator", "?"], ["operator", "@"], + ["operator", "\\"], ["operator", "^"], ["operator", "_"], ["operator", "`"], ["operator", "~"], + + ["operator", "¡"], ["operator", "¢"], ["operator", "×"], ["operator", "÷"], + + ["operator", "<,|"] +] + +---------------------------------------------------- + +Checks for some operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pure/punctuation_feature.test b/package/src/prism/tests/languages/pure/punctuation_feature.test new file mode 100644 index 00000000..dfad5774 --- /dev/null +++ b/package/src/prism/tests/languages/pure/punctuation_feature.test @@ -0,0 +1,13 @@ +( ) { } [ ] ; + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/pure/special_feature.test b/package/src/prism/tests/languages/pure/special_feature.test new file mode 100644 index 00000000..83f45595 --- /dev/null +++ b/package/src/prism/tests/languages/pure/special_feature.test @@ -0,0 +1,15 @@ +__show__ +__cmd__ +__with__ + +---------------------------------------------------- + +[ + ["special", "__show__"], + ["special", "__cmd__"], + ["special", "__with__"] +] + +---------------------------------------------------- + +Checks for special functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/pure/string_feature.test b/package/src/prism/tests/languages/pure/string_feature.test new file mode 100644 index 00000000..b3c6ec95 --- /dev/null +++ b/package/src/prism/tests/languages/pure/string_feature.test @@ -0,0 +1,13 @@ +"" +"fo\"obar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/purebasic/asm_feature.test b/package/src/prism/tests/languages/purebasic/asm_feature.test new file mode 100644 index 00000000..a2646f50 --- /dev/null +++ b/package/src/prism/tests/languages/purebasic/asm_feature.test @@ -0,0 +1,375 @@ +Procedure.i XorTwoBlocks2(*buffer1, *buffer2, length) + ; move all the required data to source reg, destination reg and counter reg + !mov esi, [p.p_buffer1] ; read 32-bit integer from p.p_buffer1 and move to esi + !mov edi, [p.p_buffer2] ; read 32-bit integer from p.p_buffer2 and move to edi + !mov ecx, [p.v_length] ; read 32-bit integer from p.v_length and move to ecx + + !@@: ; anonymous label, can be reached by @b (back) or @f (forward) + !mov al, byte [edi + ecx - 1] ; read byte from destination + !xor byte [esi + ecx - 1], al ; xor source with destination (i.e. xor bytes from both blocks) + !dec ecx ; decrease counter + !jne @b ; jumb back to first anonymous label behind + ProcedureReturn 0 +EndProcedure + +!jne label1 +!jmp @b +!EXTERN printf +!DEFAULT rel + +; source: http://www.jose.it-berater.org/smfforum/index.php?topic=5091.0 +Procedure PopCount64(x.q) + !mov rax, [p.v_x] + !mov rdx, rax + !shr rdx, 1 + !and rdx, [popcount64_v55] + !sub rax, rdx + ;x = (x & $3333333333333333) + ((x >> 2) & $3333333333333333) + !mov rdx, rax ;x + !and rax, [popcount64_v33] + !shr rdx, 2 + !and rdx, [popcount64_v33] + !add rax, rdx + ;x = (x + (x >> 4)) & $0f0f0f0f0f0f0f0f0f0f + !mov rdx, rax + !shr rdx, 4 + !add rax, rdx + !and rax, [popcount64_v0f] + ;x * $0101010101010101 >> 56 + !imul rax, [popcount64_v01] + !shr rax, 56 + ProcedureReturn + !popcount64_v01: dq 0x0101010101010101 + !popcount64_v0f: dq 0x0f0f0f0f0f0f0f0f + !popcount64_v33: dq 0x3333333333333333 + !popcount64_v55: dq 0x5555555555555555 +EndProcedure + +---------------------------------------------------- + +[ + ["keyword", "Procedure"], + ["punctuation", "."], + "i ", + ["function", "XorTwoBlocks2"], + ["punctuation", "("], + ["operator", "*buffer1"], + ["punctuation", ","], + ["operator", "*buffer2"], + ["punctuation", ","], + " length", + ["punctuation", ")"], + + ["comment", "; move all the required data to source reg, destination reg and counter reg"], + + ["asm", [ + ["operator", "!"], + ["function", "mov"], + ["register", "esi"], + ["operator", ","], + ["operator", "["], + "p", + ["operator", "."], + "p_buffer1", + ["operator", "]"] + ]], + ["comment", "; read 32-bit integer from p.p_buffer1 and move to esi"], + + ["asm", [ + ["operator", "!"], + ["function", "mov"], + ["register", "edi"], + ["operator", ","], + ["operator", "["], + "p", + ["operator", "."], + "p_buffer2", + ["operator", "]"] + ]], + ["comment", "; read 32-bit integer from p.p_buffer2 and move to edi"], + + ["asm", [ + ["operator", "!"], + ["function", "mov"], + ["register", "ecx"], + ["operator", ","], + ["operator", "["], + "p", + ["operator", "."], + "v_length", + ["operator", "]"] + ]], + ["comment", "; read 32-bit integer from p.v_length and move to ecx"], + + ["asm", [ + ["operator", "!"], + ["label", "@@"], + ["operator", ":"] + ]], + ["comment", "; anonymous label, can be reached by @b (back) or @f (forward)"], + + ["asm", [ + ["operator", "!"], + ["function", "mov"], + ["register", "al"], + ["operator", ","], + " byte ", + ["operator", "["], + ["register", "edi"], + ["operator", "+"], + ["register", "ecx"], + ["operator", "-"], + ["number", "1"], + ["operator", "]"] + ]], + ["comment", "; read byte from destination"], + + ["asm", [ + ["operator", "!"], + ["function", "xor"], + " byte ", + ["operator", "["], + ["register", "esi"], + ["operator", "+"], + ["register", "ecx"], + ["operator", "-"], + ["number", "1"], + ["operator", "]"], + ["operator", ","], + ["register", "al"] + ]], + ["comment", "; xor source with destination (i.e. xor bytes from both blocks)"], + + ["asm", [ + ["operator", "!"], + ["function", "dec"], + ["register", "ecx"] + ]], + ["comment", "; decrease counter"], + + ["asm", [ + ["operator", "!"], + ["function", "jne"], + ["label-reference-anonymous", "@b"] + ]], + ["comment", "; jumb back to first anonymous label behind"], + + ["keyword", "ProcedureReturn"], + ["number", "0"], + + ["keyword", "EndProcedure"], + + ["asm", [ + ["operator", "!"], + ["function", "jne"], + ["label-reference-addressed", "label1"] + ]], + ["asm", [ + ["operator", "!"], + ["function", "jmp"], + ["label-reference-anonymous", "@b"] + ]], + ["asm", [ + ["operator", "!"], + ["keyword", "EXTERN printf"] + ]], + ["asm", [ + ["operator", "!"], + ["keyword", "DEFAULT rel"] + ]], + + ["comment", "; source: http://www.jose.it-berater.org/smfforum/index.php?topic=5091.0"], + + ["keyword", "Procedure"], + ["function", "PopCount64"], + ["punctuation", "("], + "x", + ["punctuation", "."], + "q", + ["punctuation", ")"], + + ["asm", [ + ["operator", "!"], + ["function", "mov"], + ["register", "rax"], + ["operator", ","], + ["operator", "["], + "p", + ["operator", "."], + "v_x", + ["operator", "]"] + ]], + + ["asm", [ + ["operator", "!"], + ["function", "mov"], + ["register", "rdx"], + ["operator", ","], + ["register", "rax"] + ]], + + ["asm", [ + ["operator", "!"], + ["function", "shr"], + ["register", "rdx"], + ["operator", ","], + ["number", "1"] + ]], + + ["asm", [ + ["operator", "!"], + ["function", "and"], + ["register", "rdx"], + ["operator", ","], + ["operator", "["], + "popcount64_v55", + ["operator", "]"] + ]], + + ["asm", [ + ["operator", "!"], + ["function", "sub"], + ["register", "rax"], + ["operator", ","], + ["register", "rdx"] + ]], + + ["comment", ";x = (x & $3333333333333333) + ((x >> 2) & $3333333333333333)"], + + ["asm", [ + ["operator", "!"], + ["function", "mov"], + ["register", "rdx"], + ["operator", ","], + ["register", "rax"] + ]], + ["comment", ";x"], + + ["asm", [ + ["operator", "!"], + ["function", "and"], + ["register", "rax"], + ["operator", ","], + ["operator", "["], + "popcount64_v33", + ["operator", "]"] + ]], + + ["asm", [ + ["operator", "!"], + ["function", "shr"], + ["register", "rdx"], + ["operator", ","], + ["number", "2"] + ]], + + ["asm", [ + ["operator", "!"], + ["function", "and"], + ["register", "rdx"], + ["operator", ","], + ["operator", "["], + "popcount64_v33", + ["operator", "]"] + ]], + + ["asm", [ + ["operator", "!"], + ["function", "add"], + ["register", "rax"], + ["operator", ","], + ["register", "rdx"] + ]], + + ["comment", ";x = (x + (x >> 4)) & $0f0f0f0f0f0f0f0f0f0f"], + + ["asm", [ + ["operator", "!"], + ["function", "mov"], + ["register", "rdx"], + ["operator", ","], + ["register", "rax"] + ]], + + ["asm", [ + ["operator", "!"], + ["function", "shr"], + ["register", "rdx"], + ["operator", ","], + ["number", "4"] + ]], + + ["asm", [ + ["operator", "!"], + ["function", "add"], + ["register", "rax"], + ["operator", ","], + ["register", "rdx"] + ]], + + ["asm", [ + ["operator", "!"], + ["function", "and"], + ["register", "rax"], + ["operator", ","], + ["operator", "["], + "popcount64_v0f", + ["operator", "]"] + ]], + + ["comment", ";x * $0101010101010101 >> 56"], + + ["asm", [ + ["operator", "!"], + ["function", "imul"], + ["register", "rax"], + ["operator", ","], + ["operator", "["], + "popcount64_v01", + ["operator", "]"] + ]], + + ["asm", [ + ["operator", "!"], + ["function", "shr"], + ["register", "rax"], + ["operator", ","], + ["number", "56"] + ]], + + ["keyword", "ProcedureReturn"], + + ["asm", [ + ["operator", "!"], + ["label", "popcount64_v01"], + ["operator", ":"], + ["function-inline", "dq"], + ["number", "0x0101010101010101"] + ]], + + ["asm", [ + ["operator", "!"], + ["label", "popcount64_v0f"], + ["operator", ":"], + ["function-inline", "dq"], + ["number", "0x0f0f0f0f0f0f0f0f"] + ]], + + ["asm", [ + ["operator", "!"], + ["label", "popcount64_v33"], + ["operator", ":"], + ["function-inline", "dq"], + ["number", "0x3333333333333333"] + ]], + + ["asm", [ + ["operator", "!"], + ["label", "popcount64_v55"], + ["operator", ":"], + ["function-inline", "dq"], + ["number", "0x5555555555555555"] + ]], + + ["keyword", "EndProcedure"] +] diff --git a/package/src/prism/tests/languages/purebasic/comment_feature.test b/package/src/prism/tests/languages/purebasic/comment_feature.test new file mode 100644 index 00000000..a32b9cfb --- /dev/null +++ b/package/src/prism/tests/languages/purebasic/comment_feature.test @@ -0,0 +1,20 @@ +; +; comment + +a$ = 2 ;Test + +---------------------------------------------------- + +[ + ["comment", ";"], + ["comment", "; comment"], + + "\n\na$ ", + ["operator", "="], + ["number", "2"], + ["comment", ";Test"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/purebasic/function_feature.test b/package/src/prism/tests/languages/purebasic/function_feature.test new file mode 100644 index 00000000..896990e8 --- /dev/null +++ b/package/src/prism/tests/languages/purebasic/function_feature.test @@ -0,0 +1,9 @@ +foo() + +---------------------------------------------------- + +[ + ["function", "foo"], + ["punctuation", "("], + ["punctuation", ")"] +] diff --git a/package/src/prism/tests/languages/purebasic/keyword_feature.test b/package/src/prism/tests/languages/purebasic/keyword_feature.test new file mode 100644 index 00000000..c0aa789b --- /dev/null +++ b/package/src/prism/tests/languages/purebasic/keyword_feature.test @@ -0,0 +1,213 @@ +DECLARECDLL +DECLAREDLL +COMPILERSELECT +COMPILERCASE +COMPILERDEFAULT +COMPILERENDSELECT +COMPILERERROR +ENABLEEXPLICIT +DISABLEEXPLICIT +NOT +AND +OR +XOR +CALLDEBUGGER +DEBUGLEVEL +ENABLEDEBUGGER +DISABLEDEBUGGER +RESTORE +READ +INCLUDEPATH +INCLUDEBINARY +THREADED +RUNTIME +WITH +ENDWITH +STRUCTUREUNION +ENDSTRUCTUREUNION +ALIGN +NEWLIST +NEWMAP +INTERFACE +ENDINTERFACE +EXTENDS +ENUMERATION +ENDENUMERATION +SWAP +FOREACH +CONTINUE +FAKERETURN +GOTO +GOSUB +RETURN +BREAK +MODULE +ENDMODULE +DECLAREMODULE +ENDDECLAREMODULE +DECLARE +DECLAREC +PROTOTYPE +PROTOTYPEC +ENABLEASM +DISABLEASM +DIM +REDIM +DATA +DATASECTION +ENDDATASECTION +TO +PROCEDURERETURN +DEBUG +DEFAULT +CASE +SELECT +ENDSELECT +AS +IMPORT +ENDIMPORT +IMPORTC +COMPILERIF +COMPILERELSE +COMPILERENDIF +COMPILERELSEIF +END +STRUCTURE +ENDSTRUCTURE +WHILE +WEND +FOR +NEXT +STEP +IF +ELSE +ELSEIF +ENDIF +REPEAT +UNTIL +PROCEDURE +PROCEDUREDLL +PROCEDUREC +PROCEDURECDLL +ENDPROCEDURE +PROTECTED +SHARED +STATIC +GLOBAL +DEFINE +INCLUDEFILE +XINCLUDEFILE +MACRO +ENDMACRO +FOREVER + +---------------------------------------------------- + +[ + ["keyword", "DECLARECDLL"], + ["keyword", "DECLAREDLL"], + ["keyword", "COMPILERSELECT"], + ["keyword", "COMPILERCASE"], + ["keyword", "COMPILERDEFAULT"], + ["keyword", "COMPILERENDSELECT"], + ["keyword", "COMPILERERROR"], + ["keyword", "ENABLEEXPLICIT"], + ["keyword", "DISABLEEXPLICIT"], + ["keyword", "NOT"], + ["keyword", "AND"], + ["keyword", "OR"], + ["keyword", "XOR"], + ["keyword", "CALLDEBUGGER"], + ["keyword", "DEBUGLEVEL"], + ["keyword", "ENABLEDEBUGGER"], + ["keyword", "DISABLEDEBUGGER"], + ["keyword", "RESTORE"], + ["keyword", "READ"], + ["keyword", "INCLUDEPATH"], + ["keyword", "INCLUDEBINARY"], + ["keyword", "THREADED"], + ["keyword", "RUNTIME"], + ["keyword", "WITH"], + ["keyword", "ENDWITH"], + ["keyword", "STRUCTUREUNION"], + ["keyword", "ENDSTRUCTUREUNION"], + ["keyword", "ALIGN"], + ["keyword", "NEWLIST"], + ["keyword", "NEWMAP"], + ["keyword", "INTERFACE"], + ["keyword", "ENDINTERFACE"], + ["keyword", "EXTENDS"], + ["keyword", "ENUMERATION"], + ["keyword", "ENDENUMERATION"], + ["keyword", "SWAP"], + ["keyword", "FOREACH"], + ["keyword", "CONTINUE"], + ["keyword", "FAKERETURN"], + ["keyword", "GOTO"], + ["keyword", "GOSUB"], + ["keyword", "RETURN"], + ["keyword", "BREAK"], + ["keyword", "MODULE"], + ["keyword", "ENDMODULE"], + ["keyword", "DECLAREMODULE"], + ["keyword", "ENDDECLAREMODULE"], + ["keyword", "DECLARE"], + ["keyword", "DECLAREC"], + ["keyword", "PROTOTYPE"], + ["keyword", "PROTOTYPEC"], + ["keyword", "ENABLEASM"], + ["keyword", "DISABLEASM"], + ["keyword", "DIM"], + ["keyword", "REDIM"], + ["keyword", "DATA"], + ["keyword", "DATASECTION"], + ["keyword", "ENDDATASECTION"], + ["keyword", "TO"], + ["keyword", "PROCEDURERETURN"], + ["keyword", "DEBUG"], + ["keyword", "DEFAULT"], + ["keyword", "CASE"], + ["keyword", "SELECT"], + ["keyword", "ENDSELECT"], + ["keyword", "AS"], + ["keyword", "IMPORT"], + ["keyword", "ENDIMPORT"], + ["keyword", "IMPORTC"], + ["keyword", "COMPILERIF"], + ["keyword", "COMPILERELSE"], + ["keyword", "COMPILERENDIF"], + ["keyword", "COMPILERELSEIF"], + ["keyword", "END"], + ["keyword", "STRUCTURE"], + ["keyword", "ENDSTRUCTURE"], + ["keyword", "WHILE"], + ["keyword", "WEND"], + ["keyword", "FOR"], + ["keyword", "NEXT"], + ["keyword", "STEP"], + ["keyword", "IF"], + ["keyword", "ELSE"], + ["keyword", "ELSEIF"], + ["keyword", "ENDIF"], + ["keyword", "REPEAT"], + ["keyword", "UNTIL"], + ["keyword", "PROCEDURE"], + ["keyword", "PROCEDUREDLL"], + ["keyword", "PROCEDUREC"], + ["keyword", "PROCEDURECDLL"], + ["keyword", "ENDPROCEDURE"], + ["keyword", "PROTECTED"], + ["keyword", "SHARED"], + ["keyword", "STATIC"], + ["keyword", "GLOBAL"], + ["keyword", "DEFINE"], + ["keyword", "INCLUDEFILE"], + ["keyword", "XINCLUDEFILE"], + ["keyword", "MACRO"], + ["keyword", "ENDMACRO"], + ["keyword", "FOREVER"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/purebasic/number_feature.test b/package/src/prism/tests/languages/purebasic/number_feature.test new file mode 100644 index 00000000..fea76d12 --- /dev/null +++ b/package/src/prism/tests/languages/purebasic/number_feature.test @@ -0,0 +1,19 @@ +42 +3.14159 +2e8 +3.4E-9 +0.7E+12 + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "2e8"], + ["number", "3.4E-9"], + ["number", "0.7E+12"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/purebasic/operator_feature.test b/package/src/prism/tests/languages/purebasic/operator_feature.test new file mode 100644 index 00000000..dfb661b1 --- /dev/null +++ b/package/src/prism/tests/languages/purebasic/operator_feature.test @@ -0,0 +1,17 @@ +< <= +> >= ++ - * +@ab$ + +---------------------------------------------------- + +[ + ["operator", "<"], ["operator", "<="], + ["operator", ">"], ["operator", ">="], + ["operator", "+"], ["operator", "-"], ["operator", "*"], + ["operator", "@ab$"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/purebasic/string_feature.test b/package/src/prism/tests/languages/purebasic/string_feature.test new file mode 100644 index 00000000..03aeb38c --- /dev/null +++ b/package/src/prism/tests/languages/purebasic/string_feature.test @@ -0,0 +1,13 @@ +"" +"foobar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foobar\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/purebasic/tag_feature.test b/package/src/prism/tests/languages/purebasic/tag_feature.test new file mode 100644 index 00000000..263c4079 --- /dev/null +++ b/package/src/prism/tests/languages/purebasic/tag_feature.test @@ -0,0 +1,9 @@ +#foo +#NULL$ + +---------------------------------------------------- + +[ + ["tag", "#foo"], + ["tag", "#NULL$"] +] diff --git a/package/src/prism/tests/languages/purescript/builtin_feature.test b/package/src/prism/tests/languages/purescript/builtin_feature.test new file mode 100644 index 00000000..18537d61 --- /dev/null +++ b/package/src/prism/tests/languages/purescript/builtin_feature.test @@ -0,0 +1,109 @@ +when +unless +liftA1 +apply +bind +discard +join +ifM +identity +whenM +unlessM +liftM1 +ap +compose +otherwise +top +bottom +recip +eq +notEq +degree +div +mod +lcm +gcd +flip +const +map +void +flap +conj +disj +not +mempty +compare +min +max +comparing +clamp +between +sub +negate +append +add +zero +mul +one +show +unit +absurd + +---------------------------------------------------- + +[ + ["builtin", "when"], + ["builtin", "unless"], + ["builtin", "liftA1"], + ["builtin", "apply"], + ["builtin", "bind"], + ["builtin", "discard"], + ["builtin", "join"], + ["builtin", "ifM"], + ["builtin", "identity"], + ["builtin", "whenM"], + ["builtin", "unlessM"], + ["builtin", "liftM1"], + ["builtin", "ap"], + ["builtin", "compose"], + ["builtin", "otherwise"], + ["builtin", "top"], + ["builtin", "bottom"], + ["builtin", "recip"], + ["builtin", "eq"], + ["builtin", "notEq"], + ["builtin", "degree"], + ["builtin", "div"], + ["builtin", "mod"], + ["builtin", "lcm"], + ["builtin", "gcd"], + ["builtin", "flip"], + ["builtin", "const"], + ["builtin", "map"], + ["builtin", "void"], + ["builtin", "flap"], + ["builtin", "conj"], + ["builtin", "disj"], + ["builtin", "not"], + ["builtin", "mempty"], + ["builtin", "compare"], + ["builtin", "min"], + ["builtin", "max"], + ["builtin", "comparing"], + ["builtin", "clamp"], + ["builtin", "between"], + ["builtin", "sub"], + ["builtin", "negate"], + ["builtin", "append"], + ["builtin", "add"], + ["builtin", "zero"], + ["builtin", "mul"], + ["builtin", "one"], + ["builtin", "show"], + ["builtin", "unit"], + ["builtin", "absurd"] +] + +---------------------------------------------------- + +Checks for all builtin. diff --git a/package/src/prism/tests/languages/purescript/char_feature.test b/package/src/prism/tests/languages/purescript/char_feature.test new file mode 100644 index 00000000..bb04120c --- /dev/null +++ b/package/src/prism/tests/languages/purescript/char_feature.test @@ -0,0 +1,17 @@ +'a' +'\n' +'\23' +'\xFE' + +---------------------------------------------------- + +[ + ["char", "'a'"], + ["char", "'\\n'"], + ["char", "'\\23'"], + ["char", "'\\xFE'"] +] + +---------------------------------------------------- + +Checks for chars. \ No newline at end of file diff --git a/package/src/prism/tests/languages/purescript/comment_feature.test b/package/src/prism/tests/languages/purescript/comment_feature.test new file mode 100644 index 00000000..2f824f42 --- /dev/null +++ b/package/src/prism/tests/languages/purescript/comment_feature.test @@ -0,0 +1,14 @@ +-- foo +{- foo +bar -} + +---------------------------------------------------- + +[ + ["comment", "-- foo"], + ["comment", "{- foo\nbar -}"] +] + +---------------------------------------------------- + +Checks for single-line and multi-line comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/purescript/constant_feature.test b/package/src/prism/tests/languages/purescript/constant_feature.test new file mode 100644 index 00000000..5399b196 --- /dev/null +++ b/package/src/prism/tests/languages/purescript/constant_feature.test @@ -0,0 +1,23 @@ +Foo +Foo.Bar +Baz.Foobar_42 + +---------------------------------------------------- + +[ + ["constant", ["Foo"]], + ["constant", [ + "Foo", + ["punctuation", "."], + "Bar" + ]], + ["constant", [ + "Baz", + ["punctuation", "."], + "Foobar_42" + ]] +] + +---------------------------------------------------- + +Checks for constants. diff --git a/package/src/prism/tests/languages/purescript/hvariable_feature.test b/package/src/prism/tests/languages/purescript/hvariable_feature.test new file mode 100644 index 00000000..3a2a2e54 --- /dev/null +++ b/package/src/prism/tests/languages/purescript/hvariable_feature.test @@ -0,0 +1,23 @@ +foo +Foo.bar +Baz.foobar_42 + +---------------------------------------------------- + +[ + ["hvariable", ["foo"]], + ["hvariable", [ + "Foo", + ["punctuation", "."], + "bar" + ]], + ["hvariable", [ + "Baz", + ["punctuation", "."], + "foobar_42" + ]] +] + +---------------------------------------------------- + +Checks for hvariables. diff --git a/package/src/prism/tests/languages/purescript/import_statement_feature.test b/package/src/prism/tests/languages/purescript/import_statement_feature.test new file mode 100644 index 00000000..ad5c9bb2 --- /dev/null +++ b/package/src/prism/tests/languages/purescript/import_statement_feature.test @@ -0,0 +1,48 @@ +import Foo +import Foo_42.Bar as Foobar +import Foo.Bar as Foo.Baz hiding +import Foo.Bar (test) + +---------------------------------------------------- + +[ + ["import-statement", [ + ["keyword", "import"], + " Foo" + ]], + + ["import-statement", [ + ["keyword", "import"], + " Foo_42", + ["punctuation", "."], + "Bar ", + ["keyword", "as"], + " Foobar" + ]], + + ["import-statement", [ + ["keyword", "import"], + " Foo", + ["punctuation", "."], + "Bar ", + ["keyword", "as"], + " Foo", + ["punctuation", "."], + "Baz ", + ["keyword", "hiding"] + ]], + + ["import-statement", [ + ["keyword", "import"], + " Foo", + ["punctuation", "."], + "Bar" + ]], + ["punctuation", "("], + ["hvariable", ["test"]], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for import statement. diff --git a/package/src/prism/tests/languages/purescript/issue3006.test b/package/src/prism/tests/languages/purescript/issue3006.test new file mode 100644 index 00000000..bf8dfbe3 --- /dev/null +++ b/package/src/prism/tests/languages/purescript/issue3006.test @@ -0,0 +1,161 @@ +readBooleanOrIntAsBoolean ∷ Foreign → Foreign.F Boolean +readBooleanOrIntAsBoolean value = + Foreign.readBoolean value + <|> (toBool =<< Foreign.readInt value) + where + toBool ∷ Int → Foreign.F Boolean + toBool = case _ of + 0 → pure false + 1 → pure true + int → Foreign.fail (Foreign.ForeignError ("Invalid integer: " <> show int)) + +isSuccessResponse ∷ ∀ a. AX.Response a → Boolean +isSuccessResponse { status } = status >= (StatusCode 200) && status < (StatusCode 400) + +infix 4 eq as ≡ + +isMempty ∷ ∀ m. Monoid m → Boolean +isMempty = _ ≡ mempty + +---------------------------------------------------- + +[ + ["hvariable", ["readBooleanOrIntAsBoolean"]], + ["operator", "∷"], + ["constant", ["Foreign"]], + ["operator", "→"], + ["constant", [ + "Foreign", + ["punctuation", "."], + "F" + ]], + ["constant", ["Boolean"]], + + ["hvariable", ["readBooleanOrIntAsBoolean"]], + ["hvariable", ["value"]], + ["operator", "="], + + ["hvariable", [ + "Foreign", + ["punctuation", "."], + "readBoolean" + ]], + ["hvariable", ["value"]], + + ["operator", "<|>"], + ["punctuation", "("], + ["hvariable", ["toBool"]], + ["operator", "=<<"], + ["hvariable", [ + "Foreign", + ["punctuation", "."], + "readInt" + ]], + ["hvariable", ["value"]], + ["punctuation", ")"], + + ["keyword", "where"], + + ["hvariable", ["toBool"]], + ["operator", "∷"], + ["constant", ["Int"]], + ["operator", "→"], + ["constant", [ + "Foreign", + ["punctuation", "."], + "F" + ]], + ["constant", ["Boolean"]], + + ["hvariable", ["toBool"]], + ["operator", "="], + ["keyword", "case"], + ["hvariable", ["_"]], + ["keyword", "of"], + + ["number", "0"], + ["operator", "→"], + ["hvariable", ["pure"]], + ["hvariable", ["false"]], + + ["number", "1"], + ["operator", "→"], + ["hvariable", ["pure"]], + ["hvariable", ["true"]], + + ["hvariable", ["int"]], + ["operator", "→"], + ["hvariable", [ + "Foreign", + ["punctuation", "."], + "fail" + ]], + ["punctuation", "("], + ["constant", [ + "Foreign", + ["punctuation", "."], + "ForeignError" + ]], + ["punctuation", "("], + ["string", "\"Invalid integer: \""], + ["operator", "<>"], + ["builtin", "show"], + ["hvariable", ["int"]], + ["punctuation", ")"], + ["punctuation", ")"], + + ["hvariable", ["isSuccessResponse"]], + ["operator", "∷"], + ["keyword", "∀"], + ["hvariable", ["a"]], + ["punctuation", "."], + ["constant", [ + "AX", + ["punctuation", "."], + "Response" + ]], + ["hvariable", ["a"]], + ["operator", "→"], + ["constant", ["Boolean"]], + + ["hvariable", ["isSuccessResponse"]], + ["punctuation", "{"], + ["hvariable", ["status"]], + ["punctuation", "}"], + ["operator", "="], + ["hvariable", ["status"]], + ["operator", ">="], + ["punctuation", "("], + ["constant", ["StatusCode"]], + ["number", "200"], + ["punctuation", ")"], + ["operator", "&&"], + ["hvariable", ["status"]], + ["operator", "<"], + ["punctuation", "("], + ["constant", ["StatusCode"]], + ["number", "400"], + ["punctuation", ")"], + + ["hvariable", ["infix"]], + ["number", "4"], + ["builtin", "eq"], + ["hvariable", ["as"]], + ["operator", "≡"], + + ["hvariable", ["isMempty"]], + ["operator", "∷"], + ["keyword", "∀"], + ["hvariable", ["m"]], + ["punctuation", "."], + ["constant", ["Monoid"]], + ["hvariable", ["m"]], + ["operator", "→"], + ["constant", ["Boolean"]], + + ["hvariable", ["isMempty"]], + ["operator", "="], + ["hvariable", ["_"]], + ["operator", "≡"], + ["builtin", "mempty"] +] diff --git a/package/src/prism/tests/languages/purescript/keyword_feature.test b/package/src/prism/tests/languages/purescript/keyword_feature.test new file mode 100644 index 00000000..f368008f --- /dev/null +++ b/package/src/prism/tests/languages/purescript/keyword_feature.test @@ -0,0 +1,53 @@ +ado +case +class +data +derive +do +else +forall +if +in +infixl +infixr +instance +let +module +newtype +of +primitive +then +type +where +∀ + +---------------------------------------------------- + +[ + ["keyword", "ado"], + ["keyword", "case"], + ["keyword", "class"], + ["keyword", "data"], + ["keyword", "derive"], + ["keyword", "do"], + ["keyword", "else"], + ["keyword", "forall"], + ["keyword", "if"], + ["keyword", "in"], + ["keyword", "infixl"], + ["keyword", "infixr"], + ["keyword", "instance"], + ["keyword", "let"], + ["keyword", "module"], + ["keyword", "newtype"], + ["keyword", "of"], + ["keyword", "primitive"], + ["keyword", "then"], + ["keyword", "type"], + ["keyword", "where"], + ["keyword", "∀"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/purescript/number_feature.test b/package/src/prism/tests/languages/purescript/number_feature.test new file mode 100644 index 00000000..e5e602d3 --- /dev/null +++ b/package/src/prism/tests/languages/purescript/number_feature.test @@ -0,0 +1,23 @@ +42 +3.14159 +2E3 +1.2e-4 +0.9e+1 +0o47 +0xBadFace + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "2E3"], + ["number", "1.2e-4"], + ["number", "0.9e+1"], + ["number", "0o47"], + ["number", "0xBadFace"] +] + +---------------------------------------------------- + +Checks for decimal, octal and hexadecimal numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/purescript/operator_feature.test b/package/src/prism/tests/languages/purescript/operator_feature.test new file mode 100644 index 00000000..ef1a1352 --- /dev/null +++ b/package/src/prism/tests/languages/purescript/operator_feature.test @@ -0,0 +1,100 @@ +.. +reverse <<< sort +`foo` +`Foo.bar` ++ - * / +^ ^^ ** +&& || +< <= == /= +>= > \ | +++ : !! +\\ <- -> += :: => +>> >>= >@> +~ ! @ + +∷ +→ ← +⇒ ⇐ +∘ + +∘ × ÷ ≡ ≠ ⫽ ⩓ ⩔ ∧ ∨ ↝ ⨁ ⊹ + +---------------------------------------------------- + +[ + ["operator", ".."], + + ["hvariable", ["reverse"]], + ["operator", "<<<"], + ["hvariable", ["sort"]], + + ["operator", "`foo`"], + + ["operator", "`Foo.bar`"], + + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + + ["operator", "^"], + ["operator", "^^"], + ["operator", "**"], + + ["operator", "&&"], + ["operator", "||"], + + ["operator", "<"], + ["operator", "<="], + ["operator", "=="], + ["operator", "/="], + + ["operator", ">="], + ["operator", ">"], + ["operator", "\\"], + ["operator", "|"], + + ["operator", "++"], + ["operator", ":"], + ["operator", "!!"], + + ["operator", "\\\\"], + ["operator", "<-"], + ["operator", "->"], + + ["operator", "="], + ["operator", "::"], + ["operator", "=>"], + + ["operator", ">>"], + ["operator", ">>="], + ["operator", ">@>"], + + ["operator", "~"], + ["operator", "!"], + ["operator", "@"], + + ["operator", "∷"], + ["operator", "→"], ["operator", "←"], + ["operator", "⇒"], ["operator", "⇐"], + ["operator", "∘"], + + ["operator", "∘"], + ["operator", "×"], + ["operator", "÷"], + ["operator", "≡"], + ["operator", "≠"], + ["operator", "⫽"], + ["operator", "⩓"], + ["operator", "⩔"], + ["operator", "∧"], + ["operator", "∨"], + ["operator", "↝"], + ["operator", "⨁"], + ["operator", "⊹"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/purescript/string_feature.test b/package/src/prism/tests/languages/purescript/string_feature.test new file mode 100644 index 00000000..14971cf3 --- /dev/null +++ b/package/src/prism/tests/languages/purescript/string_feature.test @@ -0,0 +1,19 @@ +"" +"fo\"o" +"foo \ + \ bar" +"foo -- comment lookalike \ + \ bar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"o\""], + ["string", "\"foo \\\n \\ bar\""], + ["string", "\"foo -- comment lookalike \\\n \\ bar\""] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/python/boolean_feature.test b/package/src/prism/tests/languages/python/boolean_feature.test new file mode 100644 index 00000000..a3f2d03c --- /dev/null +++ b/package/src/prism/tests/languages/python/boolean_feature.test @@ -0,0 +1,15 @@ +True +False +None + +---------------------------------------------------- + +[ + ["boolean", "True"], + ["boolean", "False"], + ["boolean", "None"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/python/builtin_feature.test b/package/src/prism/tests/languages/python/builtin_feature.test new file mode 100644 index 00000000..df2f77e4 --- /dev/null +++ b/package/src/prism/tests/languages/python/builtin_feature.test @@ -0,0 +1,56 @@ +abs all any apply +ascii basestring bin bool +buffer bytearray bytes callable +chr classmethod cmp coerce +compile complex delattr +dict dir divmod enumerate +eval execfile file +filter float format frozenset +getattr globals hasattr hash +help hex id input +int intern isinstance issubclass +iter len list locals +long map max memoryview +min next object oct +open ord pow property +range raw_input reduce reload +repr reversed round set +setattr slice sorted staticmethod +str sum super tuple +type unichr unicode vars +xrange() +zip( +__import__ + + +---------------------------------------------------- + +[ + ["builtin", "abs"], ["builtin", "all"], ["builtin", "any"], ["builtin", "apply"], + ["builtin", "ascii"], ["builtin", "basestring"], ["builtin", "bin"], ["builtin", "bool"], + ["builtin", "buffer"], ["builtin", "bytearray"], ["builtin", "bytes"], ["builtin", "callable"], + ["builtin", "chr"], ["builtin", "classmethod"], ["builtin", "cmp"], ["builtin", "coerce"], + ["builtin", "compile"], ["builtin", "complex"], ["builtin", "delattr"], + ["builtin", "dict"], ["builtin", "dir"], ["builtin", "divmod"], ["builtin", "enumerate"], + ["builtin", "eval"], ["builtin", "execfile"], ["builtin", "file"], + ["builtin", "filter"], ["builtin", "float"], ["builtin", "format"], ["builtin", "frozenset"], + ["builtin", "getattr"], ["builtin", "globals"], ["builtin", "hasattr"], ["builtin", "hash"], + ["builtin", "help"], ["builtin", "hex"], ["builtin", "id"], ["builtin", "input"], + ["builtin", "int"], ["builtin", "intern"], ["builtin", "isinstance"], ["builtin", "issubclass"], + ["builtin", "iter"], ["builtin", "len"], ["builtin", "list"], ["builtin", "locals"], + ["builtin", "long"], ["builtin", "map"], ["builtin", "max"], ["builtin", "memoryview"], + ["builtin", "min"], ["builtin", "next"], ["builtin", "object"], ["builtin", "oct"], + ["builtin", "open"], ["builtin", "ord"], ["builtin", "pow"], ["builtin", "property"], + ["builtin", "range"], ["builtin", "raw_input"], ["builtin", "reduce"], ["builtin", "reload"], + ["builtin", "repr"], ["builtin", "reversed"], ["builtin", "round"], ["builtin", "set"], + ["builtin", "setattr"], ["builtin", "slice"], ["builtin", "sorted"], ["builtin", "staticmethod"], + ["builtin", "str"], ["builtin", "sum"], ["builtin", "super"], ["builtin", "tuple"], + ["builtin", "type"], ["builtin", "unichr"], ["builtin", "unicode"], ["builtin", "vars"], + ["builtin", "xrange"], ["punctuation", "("], ["punctuation", ")"], + ["builtin", "zip"], ["punctuation", "("], + ["builtin", "__import__"] +] + +---------------------------------------------------- + +Checks for all builtins. \ No newline at end of file diff --git a/package/src/prism/tests/languages/python/class-name_feature.test b/package/src/prism/tests/languages/python/class-name_feature.test new file mode 100644 index 00000000..5e6dd068 --- /dev/null +++ b/package/src/prism/tests/languages/python/class-name_feature.test @@ -0,0 +1,15 @@ +class Foo +class foobar_42 +class _ + +---------------------------------------------------- + +[ + ["keyword", "class"], ["class-name", "Foo"], + ["keyword", "class"], ["class-name", "foobar_42"], + ["keyword", "class"], ["class-name", "_"] +] + +---------------------------------------------------- + +Checks for class names. \ No newline at end of file diff --git a/package/src/prism/tests/languages/python/comment_feature.test b/package/src/prism/tests/languages/python/comment_feature.test new file mode 100644 index 00000000..710014b8 --- /dev/null +++ b/package/src/prism/tests/languages/python/comment_feature.test @@ -0,0 +1,13 @@ +# +# foobar + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/python/decorator_feature.test b/package/src/prism/tests/languages/python/decorator_feature.test new file mode 100644 index 00000000..4ea22c35 --- /dev/null +++ b/package/src/prism/tests/languages/python/decorator_feature.test @@ -0,0 +1,57 @@ +@some.decorator(foobar) +def foo(bar): + pass + +@decorator +def foo(bar): + pass + +@decorator +def foo(bar): + pass + +---------------------------------------------------- + +[ + ["decorator", [ + "@some", + ["punctuation", "."], + "decorator" + ]], + ["punctuation", "("], + "foobar", + ["punctuation", ")"], + ["keyword", "def"], + ["function", "foo"], + ["punctuation", "("], + "bar", + ["punctuation", ")"], + ["punctuation", ":"], + ["keyword", "pass"], + + ["decorator", [ + "@decorator" + ]], + ["keyword", "def"], + ["function", "foo"], + ["punctuation", "("], + "bar", + ["punctuation", ")"], + ["punctuation", ":"], + ["keyword", "pass"], + + ["decorator", [ + "@decorator" + ]], + ["keyword", "def"], + ["function", "foo"], + ["punctuation", "("], + "bar", + ["punctuation", ")"], + ["punctuation", ":"], + ["keyword", "pass"] +] + +---------------------------------------------------- + +Checks for decorators. diff --git a/package/src/prism/tests/languages/python/function_feature.test b/package/src/prism/tests/languages/python/function_feature.test new file mode 100644 index 00000000..547c8cab --- /dev/null +++ b/package/src/prism/tests/languages/python/function_feature.test @@ -0,0 +1,17 @@ +def Foo( +def foo_bar_42( +def _( +def foo_ () + +---------------------------------------------------- + +[ + ["keyword", "def"], ["function", "Foo"], ["punctuation", "("], + ["keyword", "def"], ["function", "foo_bar_42"], ["punctuation", "("], + ["keyword", "def"], ["function", "_"], ["punctuation", "("], + ["keyword", "def"], ["function", "foo_"], ["punctuation", "("], ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/python/issue1355.test b/package/src/prism/tests/languages/python/issue1355.test new file mode 100644 index 00000000..35b9f983 --- /dev/null +++ b/package/src/prism/tests/languages/python/issue1355.test @@ -0,0 +1,24 @@ +print('""#') +print('"trigger="#T'+str(3)) + +---------------------------------------------------- + +[ + ["keyword", "print"], + ["punctuation", "("], + ["string", "'\"\"#'"], + ["punctuation", ")"], + ["keyword", "print"], + ["punctuation", "("], + ["string", "'\"trigger=\"#T'"], + ["operator", "+"], + ["builtin", "str"], + ["punctuation", "("], + ["number", "3"], + ["punctuation", ")"], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for comment-like substrings. See #1355 \ No newline at end of file diff --git a/package/src/prism/tests/languages/python/keyword_feature.test b/package/src/prism/tests/languages/python/keyword_feature.test new file mode 100644 index 00000000..7b415f7d --- /dev/null +++ b/package/src/prism/tests/languages/python/keyword_feature.test @@ -0,0 +1,33 @@ +as assert async await +break class; +continue def; +del elif else +except exec finally +for from global if +import in is lambda +pass print raise return +try while with yield +nonlocal +and not or +match case _: + +---------------------------------------------------- + +[ + ["keyword", "as"], ["keyword", "assert"], ["keyword", "async"], ["keyword", "await"], + ["keyword", "break"], ["keyword", "class"], ["punctuation", ";"], + ["keyword", "continue"], ["keyword", "def"], ["punctuation", ";"], + ["keyword", "del"], ["keyword", "elif"], ["keyword", "else"], + ["keyword", "except"], ["keyword", "exec"], ["keyword", "finally"], + ["keyword", "for"], ["keyword", "from"], ["keyword", "global"], ["keyword", "if"], + ["keyword", "import"], ["keyword", "in"], ["keyword", "is"], ["keyword", "lambda"], + ["keyword", "pass"], ["keyword", "print"], ["keyword", "raise"], ["keyword", "return"], + ["keyword", "try"], ["keyword", "while"], ["keyword", "with"], ["keyword", "yield"], + ["keyword", "nonlocal"], + ["keyword", "and"], ["keyword", "not"], ["keyword", "or"], + ["keyword", "match"], ["keyword", "case"], ["keyword", "_"], ["punctuation", ":"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/python/number_feature.test b/package/src/prism/tests/languages/python/number_feature.test new file mode 100644 index 00000000..921cdbe0 --- /dev/null +++ b/package/src/prism/tests/languages/python/number_feature.test @@ -0,0 +1,45 @@ +0b0001 +0o754 +0xBadFace +42 +3.14159 +10. +2.1E10 +0.3e-7 +4.8e+1 +42j +0b_0001 +0b0_001 +0o_754 +0o7_540 +0x_BadFace +0xBad_Face +4_200 +4_200j + +---------------------------------------------------- + +[ + ["number", "0b0001"], + ["number", "0o754"], + ["number", "0xBadFace"], + ["number", "42"], + ["number", "3.14159"], + ["number", "10."], + ["number", "2.1E10"], + ["number", "0.3e-7"], + ["number", "4.8e+1"], + ["number", "42j"], + ["number", "0b_0001"], + ["number", "0b0_001"], + ["number", "0o_754"], + ["number", "0o7_540"], + ["number", "0x_BadFace"], + ["number", "0xBad_Face"], + ["number", "4_200"], + ["number", "4_200j"] +] + +---------------------------------------------------- + +Checks for hexadecimal, octal, binary and decimal numbers. diff --git a/package/src/prism/tests/languages/python/operator_feature.test b/package/src/prism/tests/languages/python/operator_feature.test new file mode 100644 index 00000000..58ae6cbc --- /dev/null +++ b/package/src/prism/tests/languages/python/operator_feature.test @@ -0,0 +1,31 @@ ++ += +- -= +* ** *= **= +/ /= // //= +% %= +< <= <> << +> >= >> += == +!= +:= +& | ^ ~ + +---------------------------------------------------- + +[ + ["operator", "+"], ["operator", "+="], + ["operator", "-"], ["operator", "-="], + ["operator", "*"], ["operator", "**"], ["operator", "*="], ["operator", "**="], + ["operator", "/"], ["operator", "/="], ["operator", "//"], ["operator", "//="], + ["operator", "%"], ["operator", "%="], + ["operator", "<"], ["operator", "<="], ["operator", "<>"], ["operator", "<<"], + ["operator", ">"], ["operator", ">="], ["operator", ">>"], + ["operator", "="], ["operator", "=="], + ["operator", "!="], + ["operator", ":="], + ["operator", "&"], ["operator", "|"], ["operator", "^"], ["operator", "~"] +] + +---------------------------------------------------- + +Checks for all operators. diff --git a/package/src/prism/tests/languages/python/string-interpolation_feature.test b/package/src/prism/tests/languages/python/string-interpolation_feature.test new file mode 100644 index 00000000..3c96801f --- /dev/null +++ b/package/src/prism/tests/languages/python/string-interpolation_feature.test @@ -0,0 +1,147 @@ +f'The value is {value}.' + +f"The value is {'4'}." + +f'input={value!s:#06x}' + +f'{{{4*10}}}' + +fr'x={4*10}\n' + +f'''{x ++1}''' + +f'mapping is { {a:b for (a, b) in ((1, 2), (3, 4))} }' + +f'{(lambda x: x*2)(3)}' + +---------------------------------------------------- + +[ + ["string-interpolation", [ + ["string", "f'The value is "], + ["interpolation", [ + ["punctuation", "{"], + "value", + ["punctuation", "}"] + ]], + ["string", ".'"] + ]], + + ["string-interpolation", [ + ["string", "f\"The value is "], + ["interpolation", [ + ["punctuation", "{"], + ["string", "'4'"], + ["punctuation", "}"] + ]], + ["string", ".\""] + ]], + + ["string-interpolation", [ + ["string", "f'input="], + ["interpolation", [ + ["punctuation", "{"], + "value", + ["conversion-option", "!s"], + ["punctuation", ":"], + ["format-spec", "#06x"], + ["punctuation", "}"] + ]], + ["string", "'"] + ]], + + ["string-interpolation", [ + ["string", "f'{{"], + ["interpolation", [ + ["punctuation", "{"], + ["number", "4"], + ["operator", "*"], + ["number", "10"], + ["punctuation", "}"] + ]], + ["string", "}}'"] + ]], + + ["string-interpolation", [ + ["string", "fr'x="], + ["interpolation", [ + ["punctuation", "{"], + ["number", "4"], + ["operator", "*"], + ["number", "10"], + ["punctuation", "}"] + ]], + ["string", "\\n'"] + ]], + + ["string-interpolation", [ + ["string", "f'''"], + ["interpolation", [ + ["punctuation", "{"], + "x\n", + ["operator", "+"], + ["number", "1"], + ["punctuation", "}"] + ]], + ["string", "'''"] + ]], + + ["string-interpolation", [ + ["string", "f'mapping is "], + ["interpolation", [ + ["punctuation", "{"], + ["punctuation", "{"], + "a", + ["punctuation", ":"], + "b ", + ["keyword", "for"], + ["punctuation", "("], + "a", + ["punctuation", ","], + " b", + ["punctuation", ")"], + ["keyword", "in"], + ["punctuation", "("], + ["punctuation", "("], + ["number", "1"], + ["punctuation", ","], + ["number", "2"], + ["punctuation", ")"], + ["punctuation", ","], + ["punctuation", "("], + ["number", "3"], + ["punctuation", ","], + ["number", "4"], + ["punctuation", ")"], + ["punctuation", ")"], + ["punctuation", "}"], + ["punctuation", "}"] + ]], + ["string", "'"] + ]], + + ["string-interpolation", [ + ["string", "f'"], + ["interpolation", [ + ["punctuation", "{"], + ["punctuation", "("], + ["keyword", "lambda"], + " x", + ["punctuation", ":"], + " x", + ["operator", "*"], + ["number", "2"], + ["punctuation", ")"], + ["punctuation", "("], + ["number", "3"], + ["punctuation", ")"], + ["punctuation", "}"] + ]], + ["string", "'"] + ]] +] + +---------------------------------------------------- + +Checks for string interpolation. diff --git a/package/src/prism/tests/languages/python/string_feature.test b/package/src/prism/tests/languages/python/string_feature.test new file mode 100644 index 00000000..e9fea6d2 --- /dev/null +++ b/package/src/prism/tests/languages/python/string_feature.test @@ -0,0 +1,29 @@ +"" +"fo\"obar" +'' +'fo\'obar' +"fo\" # comment obar" + +r"\n" +b'foo' +rb"foo\n" +u"foo" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""], + ["string", "''"], + ["string", "'fo\\'obar'"], + ["string", "\"fo\\\" # comment obar\""], + + ["string", "r\"\\n\""], + ["string", "b'foo'"], + ["string", "rb\"foo\\n\""], + ["string", "u\"foo\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/python/triple-quoted-string_feature.test b/package/src/prism/tests/languages/python/triple-quoted-string_feature.test new file mode 100644 index 00000000..692a45b6 --- /dev/null +++ b/package/src/prism/tests/languages/python/triple-quoted-string_feature.test @@ -0,0 +1,25 @@ +"""""" +"""foobar""" +"""fo"o +#bar +baz""" +'''''' +'''foobar''' +'''fo'o +#bar +baz''' + +---------------------------------------------------- + +[ + ["triple-quoted-string", "\"\"\"\"\"\""], + ["triple-quoted-string", "\"\"\"foobar\"\"\""], + ["triple-quoted-string", "\"\"\"fo\"o\n#bar\nbaz\"\"\""], + ["triple-quoted-string", "''''''"], + ["triple-quoted-string", "'''foobar'''"], + ["triple-quoted-string", "'''fo'o\n#bar\nbaz'''"] +] + +---------------------------------------------------- + +Checks for triple-quoted strings. diff --git a/package/src/prism/tests/languages/q/adverb_feature.test b/package/src/prism/tests/languages/q/adverb_feature.test new file mode 100644 index 00000000..9cb2ba70 --- /dev/null +++ b/package/src/prism/tests/languages/q/adverb_feature.test @@ -0,0 +1,17 @@ +' ': ++/ +/: +\ \: +each + +---------------------------------------------------- + +[ + ["adverb", "'"], ["adverb", "':"], + ["verb", "+"], ["adverb", "/"], ["verb", "+"], ["adverb", "/:"], + ["adverb", "\\"], ["adverb", "\\:"], + ["adverb", "each"] +] + +---------------------------------------------------- + +Checks for adverbs. \ No newline at end of file diff --git a/package/src/prism/tests/languages/q/comment_feature.test b/package/src/prism/tests/languages/q/comment_feature.test new file mode 100644 index 00000000..eb5ebb26 --- /dev/null +++ b/package/src/prism/tests/languages/q/comment_feature.test @@ -0,0 +1,30 @@ +#!/usr/bin/env q +/ Foobar "baz" + +/ +Foo +bar "baz" +\ + +`john / an atom of type symbol + +\ +Foo +Bar "baz" + +---------------------------------------------------- + +[ + ["comment", "#!/usr/bin/env q"], + ["comment", "/ Foobar \"baz\""], + + ["comment", "/\nFoo\nbar \"baz\"\n\\"], + + ["symbol", "`john"], ["comment", "/ an atom of type symbol"], + + ["comment", "\\\nFoo\nBar \"baz\""] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/q/datetime_feature.test b/package/src/prism/tests/languages/q/datetime_feature.test new file mode 100644 index 00000000..5fc209a5 --- /dev/null +++ b/package/src/prism/tests/languages/q/datetime_feature.test @@ -0,0 +1,39 @@ +0Nm 0Nd 0Nz 0Nu 0Nv 0Nt +0Wd 0Wt 0Wz + +2015.09m +2015.09.08 +2015.09.08d +2015.09.08z +2015.09.08T08:25:32 +2015.09.08T08:25:32.000 +08:25 +08:25u +08:25v +08:25t +08:25:32 +08:25:32:000 + +---------------------------------------------------- + +[ + ["datetime", "0Nm"], ["datetime", "0Nd"], ["datetime", "0Nz"], ["datetime", "0Nu"], ["datetime", "0Nv"], ["datetime", "0Nt"], + ["datetime", "0Wd"], ["datetime", "0Wt"], ["datetime", "0Wz"], + + ["datetime", "2015.09m"], + ["datetime", "2015.09.08"], + ["datetime", "2015.09.08d"], + ["datetime", "2015.09.08z"], + ["datetime", "2015.09.08T08:25:32"], + ["datetime", "2015.09.08T08:25:32.000"], + ["datetime", "08:25"], + ["datetime", "08:25u"], + ["datetime", "08:25v"], + ["datetime", "08:25t"], + ["datetime", "08:25:32"], + ["datetime", "08:25:32:000"] +] + +---------------------------------------------------- + +Checks for dates, times and datetimes. \ No newline at end of file diff --git a/package/src/prism/tests/languages/q/keyword_feature.test b/package/src/prism/tests/languages/q/keyword_feature.test new file mode 100644 index 00000000..3d0fa599 --- /dev/null +++ b/package/src/prism/tests/languages/q/keyword_feature.test @@ -0,0 +1,371 @@ +\foo +\foo_bar_42 + +abs +acos +aj +aj0 +all +and +any +asc +asin +asof +atan +attr +avg +avgs +bin +binr +by +ceiling +cols +cor +cos +count +cov +cross +csv +cut +delete +deltas +desc +dev +differ +distinct +div +do +dsave +ej +enlist +eval +except +exec +exit +exp +fby +fills +first +fkeys +flip +floor +from +get +getenv +group +gtime +hclose +hcount +hdel +hopen +hsym +iasc +identity +idesc +if +ij +in +insert +inter +inv +key +keys +last +like +list +lj +ljf +load +log +lower +lsq +ltime +ltrim +mavg +max +maxs +mcount +md5 +mdev +med +meta +min +mins +mmax +mmin +mmu +mod +msum +neg +next +not +null +or +over +parse +peach +pj +plist +prd +prds +prev +prior +rand +rank +ratios +raze +read0 +read1 +reciprocal +reval +reverse +rload +rotate +rsave +rtrim +save +scan +scov +sdev +select +set +setenv +show +signum +sin +sqrt +ss +ssr +string +sublist +sum +sums +sv +svar +system +tables +tan +til +trim +txf +type +uj +ungroup +union +update +upper +upsert +value +var +view +views +vs +wavg +where +while +within +wj +wj1 +wsum +ww +xasc +xbar +xcol +xcols +xdesc +xexp +xgroup +xkey +xlog +xprev +xrank + +---------------------------------------------------- + +[ + ["keyword", "\\foo"], + ["keyword", "\\foo_bar_42"], + + ["keyword", "abs"], + ["keyword", "acos"], + ["keyword", "aj"], + ["keyword", "aj0"], + ["keyword", "all"], + ["keyword", "and"], + ["keyword", "any"], + ["keyword", "asc"], + ["keyword", "asin"], + ["keyword", "asof"], + ["keyword", "atan"], + ["keyword", "attr"], + ["keyword", "avg"], + ["keyword", "avgs"], + ["keyword", "bin"], + ["keyword", "binr"], + ["keyword", "by"], + ["keyword", "ceiling"], + ["keyword", "cols"], + ["keyword", "cor"], + ["keyword", "cos"], + ["keyword", "count"], + ["keyword", "cov"], + ["keyword", "cross"], + ["keyword", "csv"], + ["keyword", "cut"], + ["keyword", "delete"], + ["keyword", "deltas"], + ["keyword", "desc"], + ["keyword", "dev"], + ["keyword", "differ"], + ["keyword", "distinct"], + ["keyword", "div"], + ["keyword", "do"], + ["keyword", "dsave"], + ["keyword", "ej"], + ["keyword", "enlist"], + ["keyword", "eval"], + ["keyword", "except"], + ["keyword", "exec"], + ["keyword", "exit"], + ["keyword", "exp"], + ["keyword", "fby"], + ["keyword", "fills"], + ["keyword", "first"], + ["keyword", "fkeys"], + ["keyword", "flip"], + ["keyword", "floor"], + ["keyword", "from"], + ["keyword", "get"], + ["keyword", "getenv"], + ["keyword", "group"], + ["keyword", "gtime"], + ["keyword", "hclose"], + ["keyword", "hcount"], + ["keyword", "hdel"], + ["keyword", "hopen"], + ["keyword", "hsym"], + ["keyword", "iasc"], + ["keyword", "identity"], + ["keyword", "idesc"], + ["keyword", "if"], + ["keyword", "ij"], + ["keyword", "in"], + ["keyword", "insert"], + ["keyword", "inter"], + ["keyword", "inv"], + ["keyword", "key"], + ["keyword", "keys"], + ["keyword", "last"], + ["keyword", "like"], + ["keyword", "list"], + ["keyword", "lj"], + ["keyword", "ljf"], + ["keyword", "load"], + ["keyword", "log"], + ["keyword", "lower"], + ["keyword", "lsq"], + ["keyword", "ltime"], + ["keyword", "ltrim"], + ["keyword", "mavg"], + ["keyword", "max"], + ["keyword", "maxs"], + ["keyword", "mcount"], + ["keyword", "md5"], + ["keyword", "mdev"], + ["keyword", "med"], + ["keyword", "meta"], + ["keyword", "min"], + ["keyword", "mins"], + ["keyword", "mmax"], + ["keyword", "mmin"], + ["keyword", "mmu"], + ["keyword", "mod"], + ["keyword", "msum"], + ["keyword", "neg"], + ["keyword", "next"], + ["keyword", "not"], + ["keyword", "null"], + ["keyword", "or"], + ["keyword", "over"], + ["keyword", "parse"], + ["keyword", "peach"], + ["keyword", "pj"], + ["keyword", "plist"], + ["keyword", "prd"], + ["keyword", "prds"], + ["keyword", "prev"], + ["keyword", "prior"], + ["keyword", "rand"], + ["keyword", "rank"], + ["keyword", "ratios"], + ["keyword", "raze"], + ["keyword", "read0"], + ["keyword", "read1"], + ["keyword", "reciprocal"], + ["keyword", "reval"], + ["keyword", "reverse"], + ["keyword", "rload"], + ["keyword", "rotate"], + ["keyword", "rsave"], + ["keyword", "rtrim"], + ["keyword", "save"], + ["keyword", "scan"], + ["keyword", "scov"], + ["keyword", "sdev"], + ["keyword", "select"], + ["keyword", "set"], + ["keyword", "setenv"], + ["keyword", "show"], + ["keyword", "signum"], + ["keyword", "sin"], + ["keyword", "sqrt"], + ["keyword", "ss"], + ["keyword", "ssr"], + ["keyword", "string"], + ["keyword", "sublist"], + ["keyword", "sum"], + ["keyword", "sums"], + ["keyword", "sv"], + ["keyword", "svar"], + ["keyword", "system"], + ["keyword", "tables"], + ["keyword", "tan"], + ["keyword", "til"], + ["keyword", "trim"], + ["keyword", "txf"], + ["keyword", "type"], + ["keyword", "uj"], + ["keyword", "ungroup"], + ["keyword", "union"], + ["keyword", "update"], + ["keyword", "upper"], + ["keyword", "upsert"], + ["keyword", "value"], + ["keyword", "var"], + ["keyword", "view"], + ["keyword", "views"], + ["keyword", "vs"], + ["keyword", "wavg"], + ["keyword", "where"], + ["keyword", "while"], + ["keyword", "within"], + ["keyword", "wj"], + ["keyword", "wj1"], + ["keyword", "wsum"], + ["keyword", "ww"], + ["keyword", "xasc"], + ["keyword", "xbar"], + ["keyword", "xcol"], + ["keyword", "xcols"], + ["keyword", "xdesc"], + ["keyword", "xexp"], + ["keyword", "xgroup"], + ["keyword", "xkey"], + ["keyword", "xlog"], + ["keyword", "xprev"], + ["keyword", "xrank"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/q/number_feature.test b/package/src/prism/tests/languages/q/number_feature.test new file mode 100644 index 00000000..3c12bd53 --- /dev/null +++ b/package/src/prism/tests/languages/q/number_feature.test @@ -0,0 +1,33 @@ +0w 0n +0W 0Wh 0Wj +0N 0Nh 0Nj 0Ne + +0xBadFace +42 +3.14159 +3e8 +0.4e-7 +3.12e+42 +42h 42j 42f +4.00e 1b + +---------------------------------------------------- + +[ + ["number", "0w"], ["number", "0n"], + ["number", "0W"], ["number", "0Wh"], ["number", "0Wj"], + ["number", "0N"], ["number", "0Nh"], ["number", "0Nj"], ["number", "0Ne"], + + ["number", "0xBadFace"], + ["number", "42"], + ["number", "3.14159"], + ["number", "3e8"], + ["number", "0.4e-7"], + ["number", "3.12e+42"], + ["number", "42h"], ["number", "42j"], ["number", "42f"], + ["number", "4.00e"], ["number", "1b"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/q/punctuation_feature.test b/package/src/prism/tests/languages/q/punctuation_feature.test new file mode 100644 index 00000000..9a58c891 --- /dev/null +++ b/package/src/prism/tests/languages/q/punctuation_feature.test @@ -0,0 +1,17 @@ +( ) { } [ ] ; + +sp.s + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", ";"], + + "\n\nsp", ["punctuation", "."], "s" +] diff --git a/package/src/prism/tests/languages/q/string_feature.test b/package/src/prism/tests/languages/q/string_feature.test new file mode 100644 index 00000000..13a966cf --- /dev/null +++ b/package/src/prism/tests/languages/q/string_feature.test @@ -0,0 +1,13 @@ +"" +"Fo\"obar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"Fo\\\"obar\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/q/symbol_feature.test b/package/src/prism/tests/languages/q/symbol_feature.test new file mode 100644 index 00000000..5caba4a3 --- /dev/null +++ b/package/src/prism/tests/languages/q/symbol_feature.test @@ -0,0 +1,17 @@ +` +`foobar +`:www.example.com:8888 +`.foo + +---------------------------------------------------- + +[ + ["symbol", "`"], + ["symbol", "`foobar"], + ["symbol", "`:www.example.com:8888"], + ["symbol", "`.foo"] +] + +---------------------------------------------------- + +Checks for symbols. \ No newline at end of file diff --git a/package/src/prism/tests/languages/q/verb_feature.test b/package/src/prism/tests/languages/q/verb_feature.test new file mode 100644 index 00000000..9402ed08 --- /dev/null +++ b/package/src/prism/tests/languages/q/verb_feature.test @@ -0,0 +1,35 @@ +. .: +0: 1: +< <: <> <>: <= <=: +> >: >= >=: +: :: ++ +: - -: +* *: % %: +, ,: ! !: +? ?: _ _: +~ ~: = =: +| |: $ $: +& &: # #: +@ @: ^ ^: + +---------------------------------------------------- + +[ + ["verb", "."], ["verb", ".:"], + ["verb", "0:"], ["verb", "1:"], + ["verb", "<"], ["verb", "<:"], ["verb", "<>"], ["verb", "<>:"], ["verb", "<="], ["verb", "<=:"], + ["verb", ">"], ["verb", ">:"], ["verb", ">="], ["verb", ">=:"], + ["verb", ":"], ["verb", "::"], + ["verb", "+"], ["verb", "+:"], ["verb", "-"], ["verb", "-:"], + ["verb", "*"], ["verb", "*:"], ["verb", "%"], ["verb", "%:"], + ["verb", ","], ["verb", ",:"], ["verb", "!"], ["verb", "!:"], + ["verb", "?"], ["verb", "?:"], ["verb", "_"], ["verb", "_:"], + ["verb", "~"], ["verb", "~:"], ["verb", "="], ["verb", "=:"], + ["verb", "|"], ["verb", "|:"], ["verb", "$"], ["verb", "$:"], + ["verb", "&"], ["verb", "&:"], ["verb", "#"], ["verb", "#:"], + ["verb", "@"], ["verb", "@:"], ["verb", "^"], ["verb", "^:"] +] + +---------------------------------------------------- + +Checks for verbs. \ No newline at end of file diff --git a/package/src/prism/tests/languages/qml/class-name_feature.test b/package/src/prism/tests/languages/qml/class-name_feature.test new file mode 100644 index 00000000..00e38574 --- /dev/null +++ b/package/src/prism/tests/languages/qml/class-name_feature.test @@ -0,0 +1,61 @@ +Foo { + bar: FooBar {} + Baz {} + RotationAnimation on rotation { + loops: Animation.Infinite + from: 0 + to: 360 + } +} + +---------------------------------------------------- + +[ + ["class-name", "Foo"], + ["punctuation", "{"], + + ["property", "bar"], + ["punctuation", ":"], + ["class-name", "FooBar"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["class-name", "Baz"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["class-name", "RotationAnimation"], + ["keyword", "on"], + " rotation ", + ["punctuation", "{"], + + ["property", "loops"], + ["punctuation", ":"], + ["javascript-expression", [ + ["maybe-class-name", "Animation"], + ["punctuation", "."], + ["property-access", [ + ["maybe-class-name", "Infinite"] + ]] + ]], + + ["property", "from"], + ["punctuation", ":"], + ["javascript-expression", [ + ["number", "0"] + ]], + + ["property", "to"], + ["punctuation", ":"], + ["javascript-expression", [ + ["number", "360"] + ]], + + ["punctuation", "}"], + + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for class names. diff --git a/package/src/prism/tests/languages/qml/comment_feature.test b/package/src/prism/tests/languages/qml/comment_feature.test new file mode 100644 index 00000000..90913ce4 --- /dev/null +++ b/package/src/prism/tests/languages/qml/comment_feature.test @@ -0,0 +1,15 @@ +// foo +/* + bar + */ + +---------------------------------------------------- + +[ + ["comment", "// foo"], + ["comment", "/*\n bar\n */"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/qml/import_feature.test b/package/src/prism/tests/languages/qml/import_feature.test new file mode 100644 index 00000000..e0703f26 --- /dev/null +++ b/package/src/prism/tests/languages/qml/import_feature.test @@ -0,0 +1,26 @@ +import QtQuick 2.9 +import QtQml.Models 2.2 +import Person 1.0 +import "componentCreation.js" as MyScript + +---------------------------------------------------- + +[ + ["keyword", "import"], + " QtQuick 2.9\n", + + ["keyword", "import"], + " QtQml.Models 2.2\n", + + ["keyword", "import"], + " Person 1.0\n", + + ["keyword", "import"], + ["string", "\"componentCreation.js\""], + ["keyword", "as"], + " MyScript" +] + +---------------------------------------------------- + +Checks for imports. diff --git a/package/src/prism/tests/languages/qml/javascript-function_feature.test b/package/src/prism/tests/languages/qml/javascript-function_feature.test new file mode 100644 index 00000000..ed4a07ee --- /dev/null +++ b/package/src/prism/tests/languages/qml/javascript-function_feature.test @@ -0,0 +1,88 @@ +Foo { + function onClicked(mouse) { foo(mouse) } + + function calculateMyHeight() { + return Math.max(otherItem.height, thirdItem.height); + var foo = "//"; + let bar = (1 / 1); + if (true) {} else {} + } +} + +---------------------------------------------------- + +[ + ["class-name", "Foo"], + ["punctuation", "{"], + + ["javascript-function", [ + ["keyword", "function"], + ["function", ["onClicked"]], + ["punctuation", "("], + ["parameter", ["mouse"]], + ["punctuation", ")"], + ["punctuation", "{"], + ["function", ["foo"]], + ["punctuation", "("], + "mouse", + ["punctuation", ")"], + ["punctuation", "}"] + ]], + + ["javascript-function", [ + ["keyword", "function"], + ["function", ["calculateMyHeight"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + + ["keyword", "return"], + ["maybe-class-name", "Math"], + ["punctuation", "."], + ["function", ["max"]], + ["punctuation", "("], + "otherItem", + ["punctuation", "."], + ["property-access", ["height"]], + ["punctuation", ","], + " thirdItem", + ["punctuation", "."], + ["property-access", ["height"]], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "var"], + " foo ", + ["operator", "="], + ["string", "\"//\""], + ["punctuation", ";"], + + ["keyword", "let"], + " bar ", + ["operator", "="], + ["punctuation", "("], + ["number", "1"], + ["operator", "/"], + ["number", "1"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "if"], + ["punctuation", "("], + ["boolean", "true"], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["keyword", "else"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["punctuation", "}"] + ]], + + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for functions. diff --git a/package/src/prism/tests/languages/qml/keyword_feature.test b/package/src/prism/tests/languages/qml/keyword_feature.test new file mode 100644 index 00000000..7f9c5ec8 --- /dev/null +++ b/package/src/prism/tests/languages/qml/keyword_feature.test @@ -0,0 +1,15 @@ +as +import +on + +---------------------------------------------------- + +[ + ["keyword", "as"], + ["keyword", "import"], + ["keyword", "on"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/qml/property_feature.test b/package/src/prism/tests/languages/qml/property_feature.test new file mode 100644 index 00000000..194926b7 --- /dev/null +++ b/package/src/prism/tests/languages/qml/property_feature.test @@ -0,0 +1,159 @@ +Foo { + bar: 4 + a: 0; b: 1; c: 2 + Components.foo: 2 + + Bar { a: 0; b: Baz {}; c: 2 } + + property Component mycomponent: comp1 + property color color: "green" + + // produces warning: "Unable to assign [undefined] to double value" + value: if (mouse.pressed) mouse.mouseX +} + +BirthdayParty { + guests: [ + Person { name: "Leo Hodges" }, + Person { name: "Jack Smith" }, + Person { name: "Anne Brown" } + ] +} + +---------------------------------------------------- + +[ + ["class-name", "Foo"], + ["punctuation", "{"], + + ["property", "bar"], + ["punctuation", ":"], + ["javascript-expression", [ + ["number", "4"] + ]], + + ["property", "a"], + ["punctuation", ":"], + ["javascript-expression", [ + ["number", "0"] + ]], + ["punctuation", ";"], + ["property", "b"], + ["punctuation", ":"], + ["javascript-expression", [ + ["number", "1"] + ]], + ["punctuation", ";"], + ["property", "c"], + ["punctuation", ":"], + ["javascript-expression", [ + ["number", "2"] + ]], + + ["property", "Components.foo"], + ["punctuation", ":"], + ["javascript-expression", [ + ["number", "2"] + ]], + + ["class-name", "Bar"], + ["punctuation", "{"], + ["property", "a"], + ["punctuation", ":"], + ["javascript-expression", [ + ["number", "0"] + ]], + ["punctuation", ";"], + ["property", "b"], + ["punctuation", ":"], + ["class-name", "Baz"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + ["property", "c"], + ["punctuation", ":"], + ["javascript-expression", [ + ["number", "2"] + ]], + ["punctuation", "}"], + + ["property", [ + ["keyword", "property"], + ["property", "Component"], + ["property", "mycomponent"] + ]], + ["punctuation", ":"], + ["javascript-expression", ["comp1"]], + + ["property", [ + ["keyword", "property"], + ["property", "color"], + ["property", "color"] + ]], + ["punctuation", ":"], + ["javascript-expression", [ + ["string", "\"green\""] + ]], + + ["comment", "// produces warning: \"Unable to assign [undefined] to double value\""], + + ["property", "value"], + ["punctuation", ":"], + ["javascript-expression", [ + ["keyword", "if"], + ["punctuation", "("], + "mouse", + ["punctuation", "."], + ["property-access", ["pressed"]], + ["punctuation", ")"], + " mouse", + ["punctuation", "."], + ["property-access", ["mouseX"]] + ]], + + ["punctuation", "}"], + + ["class-name", "BirthdayParty"], + ["punctuation", "{"], + + ["property", "guests"], + ["punctuation", ":"], + ["punctuation", "["], + + ["class-name", "Person"], + ["punctuation", "{"], + ["property", "name"], + ["punctuation", ":"], + ["javascript-expression", [ + ["string", "\"Leo Hodges\""] + ]], + ["punctuation", "}"], + ["punctuation", ","], + + ["class-name", "Person"], + ["punctuation", "{"], + ["property", "name"], + ["punctuation", ":"], + ["javascript-expression", [ + ["string", "\"Jack Smith\""] + ]], + ["punctuation", "}"], + ["punctuation", ","], + + ["class-name", "Person"], + ["punctuation", "{"], + ["property", "name"], + ["punctuation", ":"], + ["javascript-expression", [ + ["string", "\"Anne Brown\""] + ]], + ["punctuation", "}"], + + ["punctuation", "]"], + + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for properties. diff --git a/package/src/prism/tests/languages/qml/punctuation_feature.test b/package/src/prism/tests/languages/qml/punctuation_feature.test new file mode 100644 index 00000000..db8af74b --- /dev/null +++ b/package/src/prism/tests/languages/qml/punctuation_feature.test @@ -0,0 +1,17 @@ +{} [] : ; , + +---------------------------------------------------- + +[ + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", ":"], + ["punctuation", ";"], + ["punctuation", ","] +] + +---------------------------------------------------- + +Checks for punctuation. diff --git a/package/src/prism/tests/languages/qore/boolean_feature.test b/package/src/prism/tests/languages/qore/boolean_feature.test new file mode 100644 index 00000000..a40f8d95 --- /dev/null +++ b/package/src/prism/tests/languages/qore/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/qore/comment_feature.test b/package/src/prism/tests/languages/qore/comment_feature.test new file mode 100644 index 00000000..f06a8dff --- /dev/null +++ b/package/src/prism/tests/languages/qore/comment_feature.test @@ -0,0 +1,22 @@ +/* foo */ +/* foo +bar */ +// +// foobar +# +# foobar + +---------------------------------------------------- + +[ + ["comment", "/* foo */"], + ["comment", "/* foo\nbar */"], + ["comment", "//"], + ["comment", "// foobar"], + ["comment", "#"], + ["comment", "# foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/qore/function_feature.test b/package/src/prism/tests/languages/qore/function_feature.test new file mode 100644 index 00000000..5335ab0a --- /dev/null +++ b/package/src/prism/tests/languages/qore/function_feature.test @@ -0,0 +1,15 @@ +foo() +foo_bar() +Foo_bar_42() + +---------------------------------------------------- + +[ + ["function", "foo"], ["punctuation", "("], ["punctuation", ")"], + ["function", "foo_bar"], ["punctuation", "("], ["punctuation", ")"], + ["function", "Foo_bar_42"], ["punctuation", "("], ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/qore/keyword_feature.test b/package/src/prism/tests/languages/qore/keyword_feature.test new file mode 100644 index 00000000..f04594e7 --- /dev/null +++ b/package/src/prism/tests/languages/qore/keyword_feature.test @@ -0,0 +1,63 @@ +abstract any assert binary +bool boolean break byte +case catch char +class; +code const continue data +default do double else +enum +extends; +final finally float for +goto hash if +implements; +import inherits +instanceof; +int +interface; +long my native +new; +nothing null object our +own private reference +rethrow return short +softint softfloat softnumber +softbool softstring softdate +softlist static strictfp +string sub super switch +synchronized this throw +throws transient try +void volatile while + +---------------------------------------------------- + +[ + ["keyword", "abstract"], ["keyword", "any"], ["keyword", "assert"], ["keyword", "binary"], + ["keyword", "bool"], ["keyword", "boolean"], ["keyword", "break"], ["keyword", "byte"], + ["keyword", "case"], ["keyword", "catch"], ["keyword", "char"], + ["keyword", "class"], ["punctuation", ";"], + ["keyword", "code"], ["keyword", "const"], ["keyword", "continue"], ["keyword", "data"], + ["keyword", "default"], ["keyword", "do"], ["keyword", "double"], ["keyword", "else"], + ["keyword", "enum"], + ["keyword", "extends"], ["punctuation", ";"], + ["keyword", "final"], ["keyword", "finally"], ["keyword", "float"], ["keyword", "for"], + ["keyword", "goto"], ["keyword", "hash"], ["keyword", "if"], + ["keyword", "implements"], ["punctuation", ";"], + ["keyword", "import"], ["keyword", "inherits"], + ["keyword", "instanceof"], ["punctuation", ";"], + ["keyword", "int"], + ["keyword", "interface"], ["punctuation", ";"], + ["keyword", "long"], ["keyword", "my"], ["keyword", "native"], + ["keyword", "new"], ["punctuation", ";"], + ["keyword", "nothing"], ["keyword", "null"], ["keyword", "object"], ["keyword", "our"], + ["keyword", "own"], ["keyword", "private"], ["keyword", "reference"], + ["keyword", "rethrow"], ["keyword", "return"], ["keyword", "short"], + ["keyword", "softint"], ["keyword", "softfloat"], ["keyword", "softnumber"], + ["keyword", "softbool"], ["keyword", "softstring"], ["keyword", "softdate"], + ["keyword", "softlist"], ["keyword", "static"], ["keyword", "strictfp"], + ["keyword", "string"], ["keyword", "sub"], ["keyword", "super"], ["keyword", "switch"], + ["keyword", "synchronized"], ["keyword", "this"], ["keyword", "throw"], + ["keyword", "throws"], ["keyword", "transient"], ["keyword", "try"], + ["keyword", "void"], ["keyword", "volatile"], ["keyword", "while"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/qore/number_feature.test b/package/src/prism/tests/languages/qore/number_feature.test new file mode 100644 index 00000000..7a48d3ef --- /dev/null +++ b/package/src/prism/tests/languages/qore/number_feature.test @@ -0,0 +1,21 @@ +0b11110000 +0xBadFace +0xabp-3 +42 +3.14159 +3.2e8f + +---------------------------------------------------- + +[ + ["number", "0b11110000"], + ["number", "0xBadFace"], + ["number", "0xabp-3"], + ["number", "42"], + ["number", "3.14159"], + ["number", "3.2e8f"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/qore/operator_feature.test b/package/src/prism/tests/languages/qore/operator_feature.test new file mode 100644 index 00000000..9e62209f --- /dev/null +++ b/package/src/prism/tests/languages/qore/operator_feature.test @@ -0,0 +1,37 @@ ++ ++ += +- -- -= +! != !== !~ +~ +* *= +/ /= +% %= +^ ^= +? += == === =~ +> >= >> >>= +< <= <=> << <<= +& && &= +| || |= + +---------------------------------------------------- + +[ + ["operator", "+"], ["operator", "++"], ["operator", "+="], + ["operator", "-"], ["operator", "--"], ["operator", "-="], + ["operator", "!"], ["operator", "!="], ["operator", "!=="], ["operator", "!~"], + ["operator", "~"], + ["operator", "*"], ["operator", "*="], + ["operator", "/"], ["operator", "/="], + ["operator", "%"], ["operator", "%="], + ["operator", "^"], ["operator", "^="], + ["operator", "?"], + ["operator", "="], ["operator", "=="], ["operator", "==="], ["operator", "=~"], + ["operator", ">"], ["operator", ">="], ["operator", ">>"], ["operator", ">>="], + ["operator", "<"], ["operator", "<="], ["operator", "<=>"], ["operator", "<<"], ["operator", "<<="], + ["operator", "&"], ["operator", "&&"], ["operator", "&="], + ["operator", "|"], ["operator", "||"], ["operator", "|="] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/qore/string_feature.test b/package/src/prism/tests/languages/qore/string_feature.test new file mode 100644 index 00000000..12871ac3 --- /dev/null +++ b/package/src/prism/tests/languages/qore/string_feature.test @@ -0,0 +1,19 @@ +"" +"fo\"o +bar" +'' +'fo\'o +bar' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"o\nbar\""], + ["string", "''"], + ["string", "'fo\\'o\nbar'"] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/qore/variable_feature.test b/package/src/prism/tests/languages/qore/variable_feature.test new file mode 100644 index 00000000..4411840e --- /dev/null +++ b/package/src/prism/tests/languages/qore/variable_feature.test @@ -0,0 +1,15 @@ +$foobar +$foo_bar_42 +$Foobar + +---------------------------------------------------- + +[ + ["variable", "$foobar"], + ["variable", "$foo_bar_42"], + ["variable", "$Foobar"] +] + +---------------------------------------------------- + +Checks for variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/qsharp/comments_feature.test b/package/src/prism/tests/languages/qsharp/comments_feature.test new file mode 100644 index 00000000..2b4ac169 --- /dev/null +++ b/package/src/prism/tests/languages/qsharp/comments_feature.test @@ -0,0 +1,23 @@ +// The following using block creates a fresh qubit and initializes it +// in the |0> state. + +use qubit = Qubit(); + +---------------------------------------------------- + +[ + ["comment", "// The following using block creates a fresh qubit and initializes it"], + ["comment", "// in the |0> state."], + ["keyword", "use"], + " qubit ", + ["operator", "="], + ["keyword", "Qubit"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"] +] + + +---------------------------------------------------- + +Checks for comments diff --git a/package/src/prism/tests/languages/qsharp/if_with_function_feature.test b/package/src/prism/tests/languages/qsharp/if_with_function_feature.test new file mode 100644 index 00000000..7d4c397d --- /dev/null +++ b/package/src/prism/tests/languages/qsharp/if_with_function_feature.test @@ -0,0 +1,24 @@ +if result == One { + X(qubit); +} + +---------------------------------------------------- + +[ + ["keyword", "if"], + " result ", + ["operator", "=="], + ["keyword", "One"], + ["punctuation", "{"], + ["function", "X"], + ["punctuation", "("], + "qubit", + ["punctuation", ")"], + ["punctuation", ";"], + ["punctuation", "}"] +] + + +---------------------------------------------------- + +Checks for if, equality and function diff --git a/package/src/prism/tests/languages/qsharp/keyword_feature.test b/package/src/prism/tests/languages/qsharp/keyword_feature.test new file mode 100644 index 00000000..ec67ccfc --- /dev/null +++ b/package/src/prism/tests/languages/qsharp/keyword_feature.test @@ -0,0 +1,129 @@ +// type +Adj +BigInt +Bool +Ctl +Double +false +Int +One +Pauli +PauliI +PauliX +PauliY +PauliZ +Qubit +Range +Result +String +true +Unit +Zero + +// other +Adjoint +adjoint +apply +as +auto +body +borrow +borrowing +Controlled +controlled +distribute +elif +else +fail +fixup +for +function +if +in +internal +intrinsic +invert +is +let +mutable +namespace +new +newtype +open +operation +repeat +return +self +set +until +use +using +while +within + +---------------------------------------------------- + +[ + ["comment", "// type"], + ["keyword", "Adj"], + ["keyword", "BigInt"], + ["keyword", "Bool"], + ["keyword", "Ctl"], + ["keyword", "Double"], + ["keyword", "false"], + ["keyword", "Int"], + ["keyword", "One"], + ["keyword", "Pauli"], + ["keyword", "PauliI"], + ["keyword", "PauliX"], + ["keyword", "PauliY"], + ["keyword", "PauliZ"], + ["keyword", "Qubit"], + ["keyword", "Range"], + ["keyword", "Result"], + ["keyword", "String"], + ["keyword", "true"], + ["keyword", "Unit"], + ["keyword", "Zero"], + + ["comment", "// other"], + ["keyword", "Adjoint"], + ["keyword", "adjoint"], + ["keyword", "apply"], + ["keyword", "as"], + ["keyword", "auto"], + ["keyword", "body"], + ["keyword", "borrow"], + ["keyword", "borrowing"], + ["keyword", "Controlled"], + ["keyword", "controlled"], + ["keyword", "distribute"], + ["keyword", "elif"], + ["keyword", "else"], + ["keyword", "fail"], + ["keyword", "fixup"], + ["keyword", "for"], + ["keyword", "function"], + ["keyword", "if"], + ["keyword", "in"], + ["keyword", "internal"], + ["keyword", "intrinsic"], + ["keyword", "invert"], + ["keyword", "is"], + ["keyword", "let"], + ["keyword", "mutable"], + ["keyword", "namespace"], + ["keyword", "new"], + ["keyword", "newtype"], + ["keyword", "open"], + ["keyword", "operation"], + ["keyword", "repeat"], + ["keyword", "return"], + ["keyword", "self"], + ["keyword", "set"], + ["keyword", "until"], + ["keyword", "use"], + ["keyword", "using"], + ["keyword", "while"], + ["keyword", "within"] +] diff --git a/package/src/prism/tests/languages/qsharp/namespace_feature.test b/package/src/prism/tests/languages/qsharp/namespace_feature.test new file mode 100644 index 00000000..578e279f --- /dev/null +++ b/package/src/prism/tests/languages/qsharp/namespace_feature.test @@ -0,0 +1,30 @@ +namespace Quantum.App1 { + open Microsoft.Quantum.Canon; +} + +---------------------------------------------------- + +[ + ["keyword", "namespace"], + ["class-name", [ + "Quantum", + ["punctuation", "."], + "App1" + ]], + ["punctuation", "{"], + ["keyword", "open"], + ["class-name", [ + "Microsoft", + ["punctuation", "."], + "Quantum", + ["punctuation", "."], + "Canon" + ]], + ["punctuation", ";"], + ["punctuation", "}"] +] + + +---------------------------------------------------- + +Checks for namespace declaration and import diff --git a/package/src/prism/tests/languages/qsharp/operators_feature.test b/package/src/prism/tests/languages/qsharp/operators_feature.test new file mode 100644 index 00000000..fa0aa9a8 --- /dev/null +++ b/package/src/prism/tests/languages/qsharp/operators_feature.test @@ -0,0 +1,32 @@ +and or not +and= or= +<- <= -> => +* / + - = ^ ! % +*= /= += -= == ^= != %= +>>> >>>= <<< <<<= +^^^ ^^^= +||| |||= +&&& &&&= +w/ w/= +~~~ + +---------------------------------------------------- + +[ + ["operator", "and"], ["operator", "or"], ["operator", "not"], + ["operator", "and="], ["operator", "or="], + ["operator", "<-"], ["operator", "<="], ["operator", "->"], ["operator", "=>"], + ["operator", "*"], ["operator", "/"], ["operator", "+"], ["operator", "-"], ["operator", "="], ["operator", "^"], ["operator", "!"], ["operator", "%"], + ["operator", "*="], ["operator", "/="], ["operator", "+="], ["operator", "-="], ["operator", "=="], ["operator", "^="], ["operator", "!="], ["operator", "%="], + ["operator", ">>>"], ["operator", ">>>="], ["operator", "<<<"], ["operator", "<<<="], + ["operator", "^^^"], ["operator", "^^^="], + ["operator", "|||"], ["operator", "|||="], + ["operator", "&&&"], ["operator", "&&&="], + ["operator", "w/"], ["operator", "w/="], + ["operator", "~~~"] +] + + +---------------------------------------------------- + +Checks for opertors diff --git a/package/src/prism/tests/languages/qsharp/string_feature.test b/package/src/prism/tests/languages/qsharp/string_feature.test new file mode 100644 index 00000000..146080fd --- /dev/null +++ b/package/src/prism/tests/languages/qsharp/string_feature.test @@ -0,0 +1,39 @@ +"" +"foo" +"foo\"\n" + +$"" +$"foo" +$"\"" +$"foo{1+1}baz" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foo\""], + ["string", "\"foo\\\"\\n\""], + + ["interpolation-string", [ + ["string", "$\"\""] + ]], + ["interpolation-string", [ + ["string", "$\"foo\""] + ]], + ["interpolation-string", [ + ["string", "$\"\\\"\""] + ]], + ["interpolation-string", [ + ["string", "$\"foo"], + ["interpolation", [ + ["punctuation", "{"], + ["expression", [ + ["number", "1"], + ["operator", "+"], + ["number", "1"] + ]], + ["punctuation", "}"] + ]], + ["string", "baz\""] + ]] +] diff --git a/package/src/prism/tests/languages/qsharp/variable_assignment_numbers_feature.test b/package/src/prism/tests/languages/qsharp/variable_assignment_numbers_feature.test new file mode 100644 index 00000000..2db81959 --- /dev/null +++ b/package/src/prism/tests/languages/qsharp/variable_assignment_numbers_feature.test @@ -0,0 +1,30 @@ +let var1 = 3; +mutable var2 = 5L; +set var2 = var2 + 1.5; + +---------------------------------------------------- + +[ + ["keyword", "let"], + " var1 ", + ["operator", "="], + ["number", "3"], + ["punctuation", ";"], + ["keyword", "mutable"], + " var2 ", + ["operator", "="], + ["number", "5L"], + ["punctuation", ";"], + ["keyword", "set"], + " var2 ", + ["operator", "="], + " var2 ", + ["operator", "+"], + ["number", "1.5"], + ["punctuation", ";"] +] + + +---------------------------------------------------- + +Checks for variable assignment and numbers diff --git a/package/src/prism/tests/languages/r/boolean_feature.test b/package/src/prism/tests/languages/r/boolean_feature.test new file mode 100644 index 00000000..ef7bc6fc --- /dev/null +++ b/package/src/prism/tests/languages/r/boolean_feature.test @@ -0,0 +1,13 @@ +TRUE +FALSE + +---------------------------------------------------- + +[ + ["boolean", "TRUE"], + ["boolean", "FALSE"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/r/comment_feature.test b/package/src/prism/tests/languages/r/comment_feature.test new file mode 100644 index 00000000..710014b8 --- /dev/null +++ b/package/src/prism/tests/languages/r/comment_feature.test @@ -0,0 +1,13 @@ +# +# foobar + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/r/ellipsis_feature.test b/package/src/prism/tests/languages/r/ellipsis_feature.test new file mode 100644 index 00000000..40e8d305 --- /dev/null +++ b/package/src/prism/tests/languages/r/ellipsis_feature.test @@ -0,0 +1,15 @@ +... +..1 +..42 + +---------------------------------------------------- + +[ + ["ellipsis", "..."], + ["ellipsis", "..1"], + ["ellipsis", "..42"] +] + +---------------------------------------------------- + +Checks for ellipsis and special identifiers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/r/keyword_feature.test b/package/src/prism/tests/languages/r/keyword_feature.test new file mode 100644 index 00000000..dd401b2f --- /dev/null +++ b/package/src/prism/tests/languages/r/keyword_feature.test @@ -0,0 +1,25 @@ +if else repeat +while function +for in next +break NULL NA +NA_integer_ +NA_real_ +NA_complex_ +NA_character_ + +---------------------------------------------------- + +[ + ["keyword", "if"], ["keyword", "else"], ["keyword", "repeat"], + ["keyword", "while"], ["keyword", "function"], + ["keyword", "for"], ["keyword", "in"], ["keyword", "next"], + ["keyword", "break"], ["keyword", "NULL"], ["keyword", "NA"], + ["keyword", "NA_integer_"], + ["keyword", "NA_real_"], + ["keyword", "NA_complex_"], + ["keyword", "NA_character_"] +] + +---------------------------------------------------- + +Checks for all keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/r/number_feature.test b/package/src/prism/tests/languages/r/number_feature.test new file mode 100644 index 00000000..d2f98239 --- /dev/null +++ b/package/src/prism/tests/languages/r/number_feature.test @@ -0,0 +1,39 @@ +NaN Inf +0xBadFace +0xf4.42 +0x21.2p2 +0xffP+4 +0xeap-1 +42 +42L +3.14159 +3.2E4 +4e+8 +0.1e-12 +2i +4.1i +1e-2i + +---------------------------------------------------- + +[ + ["number", "NaN"], ["number", "Inf"], + ["number", "0xBadFace"], + ["number", "0xf4.42"], + ["number", "0x21.2p2"], + ["number", "0xffP+4"], + ["number", "0xeap-1"], + ["number", "42"], + ["number", "42L"], + ["number", "3.14159"], + ["number", "3.2E4"], + ["number", "4e+8"], + ["number", "0.1e-12"], + ["number", "2i"], + ["number", "4.1i"], + ["number", "1e-2i"] +] + +---------------------------------------------------- + +Checks for hexadecimal, decimal and complex numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/r/operator_feature.test b/package/src/prism/tests/languages/r/operator_feature.test new file mode 100644 index 00000000..760a8c42 --- /dev/null +++ b/package/src/prism/tests/languages/r/operator_feature.test @@ -0,0 +1,29 @@ ++ * / ^ +~ $ @ +- -> ->> +> >= +< <= <- <<- += == +! != +& && +| || +: :: + +---------------------------------------------------- + +[ + ["operator", "+"], ["operator", "*"], ["operator", "/"], ["operator", "^"], + ["operator", "~"], ["operator", "$"], ["operator", "@"], + ["operator", "-"], ["operator", "->"], ["operator", "->>"], + ["operator", ">"], ["operator", ">="], + ["operator", "<"], ["operator", "<="], ["operator", "<-"], ["operator", "<<-"], + ["operator", "="], ["operator", "=="], + ["operator", "!"], ["operator", "!="], + ["operator", "&"], ["operator", "&&"], + ["operator", "|"], ["operator", "||"], + ["operator", ":"], ["operator", "::"] +] + +---------------------------------------------------- + +Checks for all operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/r/percent-operator_feature.test b/package/src/prism/tests/languages/r/percent-operator_feature.test new file mode 100644 index 00000000..26ab2304 --- /dev/null +++ b/package/src/prism/tests/languages/r/percent-operator_feature.test @@ -0,0 +1,15 @@ +%% %*% %/% +%in% %o% %x% +%foobar% + +---------------------------------------------------- + +[ + ["percent-operator", "%%"], ["percent-operator", "%*%"], ["percent-operator", "%/%"], + ["percent-operator", "%in%"], ["percent-operator", "%o%"], ["percent-operator", "%x%"], + ["percent-operator", "%foobar%"] +] + +---------------------------------------------------- + +Checks for user-defined operators and operators starting with %. \ No newline at end of file diff --git a/package/src/prism/tests/languages/r/punctuation_feature.test b/package/src/prism/tests/languages/r/punctuation_feature.test new file mode 100644 index 00000000..4a7c5ff4 --- /dev/null +++ b/package/src/prism/tests/languages/r/punctuation_feature.test @@ -0,0 +1,14 @@ +( ) { } [ ] , ; + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", ","], + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/r/string_feature.test b/package/src/prism/tests/languages/r/string_feature.test new file mode 100644 index 00000000..3d6595fe --- /dev/null +++ b/package/src/prism/tests/languages/r/string_feature.test @@ -0,0 +1,17 @@ +"" +"fo\"obar" +'' +'fo\'obar' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""], + ["string", "''"], + ["string", "'fo\\'obar'"] +] + +---------------------------------------------------- + +Checks for single-quoted and double-quoted strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/racket/boolean_feature.test b/package/src/prism/tests/languages/racket/boolean_feature.test new file mode 100644 index 00000000..29fdb963 --- /dev/null +++ b/package/src/prism/tests/languages/racket/boolean_feature.test @@ -0,0 +1,13 @@ +#t +#f + +---------------------------------------------------- + +[ + ["boolean", "#t"], + ["boolean", "#f"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/racket/builtin_feature.test b/package/src/prism/tests/languages/racket/builtin_feature.test new file mode 100644 index 00000000..bcb228ad --- /dev/null +++ b/package/src/prism/tests/languages/racket/builtin_feature.test @@ -0,0 +1,99 @@ +(cons) +(car) +(cdr) +(null?) +(pair?) +(boolean?) +(eof-object?) +(char?) +(procedure?) +(number?) +(port?) +(string?) +(vector?) +(symbol?) +(bytevector?) +(list) +(call-with-current-continuation) +(call/cc) +(append) +(abs) +(apply) +(eval) + +[cons] +[car] +[cdr] +[null?] +[pair?] +[boolean?] +[eof-object?] +[char?] +[procedure?] +[number?] +[port?] +[string?] +[vector?] +[symbol?] +[bytevector?] +[list] +[call-with-current-continuation] +[call/cc] +[append] +[abs] +[apply] +[eval] + +---------------------------------------------------- + +[ + ["punctuation", "("], ["builtin", "cons"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "car"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "cdr"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "null?"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "pair?"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "boolean?"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "eof-object?"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "char?"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "procedure?"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "number?"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "port?"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "string?"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "vector?"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "symbol?"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "bytevector?"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "list"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "call-with-current-continuation"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "call/cc"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "append"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "abs"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "apply"], ["punctuation", ")"], + ["punctuation", "("], ["builtin", "eval"], ["punctuation", ")"], + + ["punctuation", "["], ["builtin", "cons"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "car"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "cdr"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "null?"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "pair?"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "boolean?"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "eof-object?"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "char?"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "procedure?"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "number?"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "port?"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "string?"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "vector?"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "symbol?"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "bytevector?"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "list"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "call-with-current-continuation"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "call/cc"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "append"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "abs"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "apply"], ["punctuation", "]"], + ["punctuation", "["], ["builtin", "eval"], ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for builtins. diff --git a/package/src/prism/tests/languages/racket/char_feature.test b/package/src/prism/tests/languages/racket/char_feature.test new file mode 100644 index 00000000..1e92a056 --- /dev/null +++ b/package/src/prism/tests/languages/racket/char_feature.test @@ -0,0 +1,41 @@ +#\a ; lowercase letter +#\A ; uppercase letter +#\( ; left parenthesis +#\space ; the space character +#\newline ; the newline character + +#\c-a ; Control-a +#\meta-b ; Meta-b +#\c-s-m-h-a ; Control-Meta-Super-Hyper-A + +#\; #\' #\" + +#\u0041 +#\x10FFFF +#\λ +#\) + +---------------------------------------------------- + +[ + ["char", "#\\a"], ["comment", "; lowercase letter"], + ["char", "#\\A"], ["comment", "; uppercase letter"], + ["char", "#\\("], ["comment", "; left parenthesis"], + ["char", "#\\space"], ["comment", "; the space character"], + ["char", "#\\newline"], ["comment", "; the newline character"], + + ["char", "#\\c-a"], ["comment", "; Control-a"], + ["char", "#\\meta-b"], ["comment", "; Meta-b"], + ["char", "#\\c-s-m-h-a"], ["comment", "; Control-Meta-Super-Hyper-A"], + + ["char", "#\\;"], ["char", "#\\'"], ["char", "#\\\""], + + ["char", "#\\u0041"], + ["char", "#\\x10FFFF"], + ["char", "#\\λ"], + ["char", "#\\)"] +] + +---------------------------------------------------- + +Checks for character literals. diff --git a/package/src/prism/tests/languages/racket/comment_feature.test b/package/src/prism/tests/languages/racket/comment_feature.test new file mode 100644 index 00000000..5fd28252 --- /dev/null +++ b/package/src/prism/tests/languages/racket/comment_feature.test @@ -0,0 +1,13 @@ +; +; foobar + +---------------------------------------------------- + +[ + ["comment", ";"], + ["comment", "; foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/racket/function_feature.test b/package/src/prism/tests/languages/racket/function_feature.test new file mode 100644 index 00000000..4fd30f5d --- /dev/null +++ b/package/src/prism/tests/languages/racket/function_feature.test @@ -0,0 +1,39 @@ +(fl= 1 2) +(flmin 2 3) +(inexact->exact 3) +(!fact) +(** 10) +(** +(defined foo) + +[fl= 1 2] +[flmin 2 3] +[inexact->exact 3] +[!fact] +[** 10] +[** +[defined foo] + +---------------------------------------------------- + +[ + ["punctuation", "("], ["function", "fl="], ["number", "1"], ["number", "2"], ["punctuation", ")"], + ["punctuation", "("], ["function", "flmin"], ["number", "2"], ["number", "3"], ["punctuation", ")"], + ["punctuation", "("], ["function", "inexact->exact"], ["number", "3"], ["punctuation", ")"], + ["punctuation", "("], ["function", "!fact"], ["punctuation", ")"], + ["punctuation", "("], ["function", "**"], ["number", "10"], ["punctuation", ")"], + ["punctuation", "("], ["function", "**"], + ["punctuation", "("], ["function", "defined"], " foo", ["punctuation", ")"], + + ["punctuation", "["], ["function", "fl="], ["number", "1"], ["number", "2"], ["punctuation", "]"], + ["punctuation", "["], ["function", "flmin"], ["number", "2"], ["number", "3"], ["punctuation", "]"], + ["punctuation", "["], ["function", "inexact->exact"], ["number", "3"], ["punctuation", "]"], + ["punctuation", "["], ["function", "!fact"], ["punctuation", "]"], + ["punctuation", "["], ["function", "**"], ["number", "10"], ["punctuation", "]"], + ["punctuation", "["], ["function", "**"], + ["punctuation", "["], ["function", "defined"], " foo", ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for functions. diff --git a/package/src/prism/tests/languages/racket/identifier_feature.test b/package/src/prism/tests/languages/racket/identifier_feature.test new file mode 100644 index 00000000..e57533ce --- /dev/null +++ b/package/src/prism/tests/languages/racket/identifier_feature.test @@ -0,0 +1,7 @@ +|\x9;\x9;| + +---------------------------------------------------- + +[ + ["identifier", "|\\x9;\\x9;|"] +] diff --git a/package/src/prism/tests/languages/racket/keyword_feature.test b/package/src/prism/tests/languages/racket/keyword_feature.test new file mode 100644 index 00000000..5ab2aa4f --- /dev/null +++ b/package/src/prism/tests/languages/racket/keyword_feature.test @@ -0,0 +1,13 @@ +(define) +[define] + +---------------------------------------------------- + +[ + ["punctuation", "("], ["keyword", "define"], ["punctuation", ")"], + ["punctuation", "["], ["keyword", "define"], ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/racket/lambda_parameter_feature.test b/package/src/prism/tests/languages/racket/lambda_parameter_feature.test new file mode 100644 index 00000000..20ec4bc2 --- /dev/null +++ b/package/src/prism/tests/languages/racket/lambda_parameter_feature.test @@ -0,0 +1,35 @@ +(lambda (foo bar) (concat foo bar)) + +(lambda [foo bar] [concat foo bar]) + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["keyword", "lambda"], + ["punctuation", "("], + ["lambda-parameter", "foo"], + " bar", + ["punctuation", ")"], + ["punctuation", "("], + ["function", "concat"], + " foo bar", + ["punctuation", ")"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "lambda"], + ["punctuation", "["], + ["lambda-parameter", "foo"], + " bar", + ["punctuation", "]"], + ["punctuation", "["], + ["function", "concat"], + " foo bar", + ["punctuation", "]"], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for lambda parameters. diff --git a/package/src/prism/tests/languages/racket/lang_feature.test b/package/src/prism/tests/languages/racket/lang_feature.test new file mode 100644 index 00000000..d05f0f0b --- /dev/null +++ b/package/src/prism/tests/languages/racket/lang_feature.test @@ -0,0 +1,17 @@ +#lang racket +#lang racket/base +#lang s-exp "html.rkt" +#lang s-exp pollen/private/dialect + +---------------------------------------------------- + +[ + ["lang", "#lang racket"], + ["lang", "#lang racket/base"], + ["lang", "#lang s-exp \"html.rkt\""], + ["lang", "#lang s-exp pollen/private/dialect"] +] + +---------------------------------------------------- + +Checks for #lang. diff --git a/package/src/prism/tests/languages/racket/number_feature.test b/package/src/prism/tests/languages/racket/number_feature.test new file mode 100644 index 00000000..568ab168 --- /dev/null +++ b/package/src/prism/tests/languages/racket/number_feature.test @@ -0,0 +1,118 @@ +123 + +(foo 42 +42 -42) +(foo 1e3 +1e3 -1e3) +(foo 1e+3 1e-3 3.14159 3.14159e-1) +(foo 8/3) +(foo 3+4i 2.5+0.0i 2.5+0.0i -2.5e4+0.0e4i 3+0i -2e-5i) +(list +10i -10i 10+10i 10.10+10.10i 10-10i 10+10e+10i) + +(list #d123 #e#d123e-4 #d#i12 #i-1.234i) + +(list #xBAD #b1110011 #o777) +(list #i#x10 #i#x10+10i #b10+10i) + +10+i +10+.1i +10+1.i + +; not a number but a symbol +(define 1+2 10) + + +[foo 42] + +---------------------------------------------------- + +[ + ["number", "123"], + + ["punctuation", "("], + ["function", "foo"], + ["number", "42"], + ["number", "+42"], + ["number", "-42"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "foo"], + ["number", "1e3"], + ["number", "+1e3"], + ["number", "-1e3"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "foo"], + ["number", "1e+3"], + ["number", "1e-3"], + ["number", "3.14159"], + ["number", "3.14159e-1"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "foo"], + ["number", "8/3"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "foo"], + ["number", "3+4i"], + ["number", "2.5+0.0i"], + ["number", "2.5+0.0i"], + ["number", "-2.5e4+0.0e4i"], + ["number", "3+0i"], + ["number", "-2e-5i"], + ["punctuation", ")"], + + ["punctuation", "("], + ["builtin", "list"], + ["number", "+10i"], + ["number", "-10i"], + ["number", "10+10i"], + ["number", "10.10+10.10i"], + ["number", "10-10i"], + ["number", "10+10e+10i"], + ["punctuation", ")"], + + ["punctuation", "("], + ["builtin", "list"], + ["number", "#d123"], + ["number", "#e#d123e-4"], + ["number", "#d#i12"], + ["number", "#i-1.234i"], + ["punctuation", ")"], + + ["punctuation", "("], + ["builtin", "list"], + ["number", "#xBAD"], + ["number", "#b1110011"], + ["number", "#o777"], + ["punctuation", ")"], + + ["punctuation", "("], + ["builtin", "list"], + ["number", "#i#x10"], + ["number", "#i#x10+10i"], + ["number", "#b10+10i"], + ["punctuation", ")"], + + ["number", "10+i"], + ["number", "10+.1i"], + ["number", "10+1.i"], + + ["comment", "; not a number but a symbol"], + ["punctuation", "("], + ["keyword", "define"], + " 1+2 ", + ["number", "10"], + ["punctuation", ")"], + + ["punctuation", "["], + ["function", "foo"], + ["number", "42"], + ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for numbers, rational numbers, and complex numbers. diff --git a/package/src/prism/tests/languages/racket/operator_feature.test b/package/src/prism/tests/languages/racket/operator_feature.test new file mode 100644 index 00000000..3d6036b1 --- /dev/null +++ b/package/src/prism/tests/languages/racket/operator_feature.test @@ -0,0 +1,55 @@ +(+ +(- +(* +(/ +(% +(< +(<= +(> +(>= +(= +(=> + +[+ +[- +[* +[/ +[% +[< +[<= +[> +[>= +[= +[=> + +---------------------------------------------------- + +[ + ["punctuation", "("], ["operator", "+"], + ["punctuation", "("], ["operator", "-"], + ["punctuation", "("], ["operator", "*"], + ["punctuation", "("], ["operator", "/"], + ["punctuation", "("], ["operator", "%"], + ["punctuation", "("], ["operator", "<"], + ["punctuation", "("], ["operator", "<="], + ["punctuation", "("], ["operator", ">"], + ["punctuation", "("], ["operator", ">="], + ["punctuation", "("], ["operator", "="], + ["punctuation", "("], ["operator", "=>"], + + ["punctuation", "["], ["operator", "+"], + ["punctuation", "["], ["operator", "-"], + ["punctuation", "["], ["operator", "*"], + ["punctuation", "["], ["operator", "/"], + ["punctuation", "["], ["operator", "%"], + ["punctuation", "["], ["operator", "<"], + ["punctuation", "["], ["operator", "<="], + ["punctuation", "["], ["operator", ">"], + ["punctuation", "["], ["operator", ">="], + ["punctuation", "["], ["operator", "="], + ["punctuation", "["], ["operator", "=>"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/racket/string_feature.test b/package/src/prism/tests/languages/racket/string_feature.test new file mode 100644 index 00000000..7a61a9e0 --- /dev/null +++ b/package/src/prism/tests/languages/racket/string_feature.test @@ -0,0 +1,18 @@ +"" +"fo\"obar" +" +multi +line +" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""], + ["string", "\"\nmulti\nline\n\""] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/racket/symbol_feature.test b/package/src/prism/tests/languages/racket/symbol_feature.test new file mode 100644 index 00000000..ccf371a5 --- /dev/null +++ b/package/src/prism/tests/languages/racket/symbol_feature.test @@ -0,0 +1,13 @@ +'turkey +(define a 'foo) + +---------------------------------------------------- + +[ + ["symbol", "'turkey"], + ["punctuation", "("], ["keyword", "define"], " a ", ["symbol","'foo"], ["punctuation",")"] +] + +---------------------------------------------------- + +Checks for symbols. diff --git a/package/src/prism/tests/languages/reason/char_feature.test b/package/src/prism/tests/languages/reason/char_feature.test new file mode 100644 index 00000000..244b0765 --- /dev/null +++ b/package/src/prism/tests/languages/reason/char_feature.test @@ -0,0 +1,19 @@ +'a' +'\'' +'\\' +'\xff' +'\o214' + +---------------------------------------------------- + +[ + ["char", "'a'"], + ["char", "'\\''"], + ["char", "'\\\\'"], + ["char", "'\\xff'"], + ["char", "'\\o214'"] +] + +---------------------------------------------------- + +Checks for characters. diff --git a/package/src/prism/tests/languages/reason/class-name_feature.test b/package/src/prism/tests/languages/reason/class-name_feature.test new file mode 100644 index 00000000..9d033ff2 --- /dev/null +++ b/package/src/prism/tests/languages/reason/class-name_feature.test @@ -0,0 +1,15 @@ +String.foo +Foo_bar.baz +A.bar + +---------------------------------------------------- + +[ + ["class-name", "String"], ["punctuation", "."], "foo\n", + ["class-name", "Foo_bar"], ["punctuation", "."], "baz\n", + ["class-name", "A"], ["punctuation", "."], "bar" +] + +---------------------------------------------------- + +Checks for class names. \ No newline at end of file diff --git a/package/src/prism/tests/languages/reason/comment_feature.test b/package/src/prism/tests/languages/reason/comment_feature.test new file mode 100644 index 00000000..91a73219 --- /dev/null +++ b/package/src/prism/tests/languages/reason/comment_feature.test @@ -0,0 +1,22 @@ +// foobar +/**/ +/* Single line comment */ +/* Multiline +comment */ +/** +Doc comment +*/ + +---------------------------------------------------- + +[ + ["comment", "// foobar"], + ["comment", "/**/"], + ["comment", "/* Single line comment */"], + ["comment", "/* Multiline\ncomment */"], + ["comment", "/**\nDoc comment\n*/"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/reason/constructor_feature.test b/package/src/prism/tests/languages/reason/constructor_feature.test new file mode 100644 index 00000000..23b6f3fc --- /dev/null +++ b/package/src/prism/tests/languages/reason/constructor_feature.test @@ -0,0 +1,15 @@ +Yes +Foo_bar +A + +---------------------------------------------------- + +[ + ["constructor", "Yes"], + ["constructor", "Foo_bar"], + ["constructor", "A"] +] + +---------------------------------------------------- + +Checks for constructors. \ No newline at end of file diff --git a/package/src/prism/tests/languages/reason/keyword_feature.test b/package/src/prism/tests/languages/reason/keyword_feature.test new file mode 100644 index 00000000..45a60c5e --- /dev/null +++ b/package/src/prism/tests/languages/reason/keyword_feature.test @@ -0,0 +1,103 @@ +and +as +assert +begin +class +constraint +do +done +downto +else +end +exception +external +for +fun +function +functor +if +in +include +inherit +initializer +lazy +let +method +module +mutable +new +nonrec +object +of +open +or +private +rec +sig +struct +switch +then +to +try +type +val +virtual +when +while +with + +---------------------------------------------------- + +[ + ["keyword", "and"], + ["keyword", "as"], + ["keyword", "assert"], + ["keyword", "begin"], + ["keyword", "class"], + ["keyword", "constraint"], + ["keyword", "do"], + ["keyword", "done"], + ["keyword", "downto"], + ["keyword", "else"], + ["keyword", "end"], + ["keyword", "exception"], + ["keyword", "external"], + ["keyword", "for"], + ["keyword", "fun"], + ["keyword", "function"], + ["keyword", "functor"], + ["keyword", "if"], + ["keyword", "in"], + ["keyword", "include"], + ["keyword", "inherit"], + ["keyword", "initializer"], + ["keyword", "lazy"], + ["keyword", "let"], + ["keyword", "method"], + ["keyword", "module"], + ["keyword", "mutable"], + ["keyword", "new"], + ["keyword", "nonrec"], + ["keyword", "object"], + ["keyword", "of"], + ["keyword", "open"], + ["keyword", "or"], + ["keyword", "private"], + ["keyword", "rec"], + ["keyword", "sig"], + ["keyword", "struct"], + ["keyword", "switch"], + ["keyword", "then"], + ["keyword", "to"], + ["keyword", "try"], + ["keyword", "type"], + ["keyword", "val"], + ["keyword", "virtual"], + ["keyword", "when"], + ["keyword", "while"], + ["keyword", "with"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/reason/label_feature.test b/package/src/prism/tests/languages/reason/label_feature.test new file mode 100644 index 00000000..747ee525 --- /dev/null +++ b/package/src/prism/tests/languages/reason/label_feature.test @@ -0,0 +1,13 @@ +foo::bar +a::baz + +---------------------------------------------------- + +[ + ["label", "foo"], ["operator", "::"], "bar\n", + ["label", "a"], ["operator", "::"], "baz" +] + +---------------------------------------------------- + +Checks for labels. \ No newline at end of file diff --git a/package/src/prism/tests/languages/reason/operator_feature.test b/package/src/prism/tests/languages/reason/operator_feature.test new file mode 100644 index 00000000..8a28832e --- /dev/null +++ b/package/src/prism/tests/languages/reason/operator_feature.test @@ -0,0 +1,31 @@ +... +:: := += == === +< <= > >= +| ^ ? ' +# ! ~ ` ++ - * / ++. -. *. /. +mod land lor lxor +lsl lsr asr +|> -> + +---------------------------------------------------- + +[ + ["operator", "..."], + ["operator", "::"], ["operator", ":="], + ["operator", "="], ["operator", "=="], ["operator", "==="], + ["operator", "<"], ["operator", "<="], ["operator", ">"], ["operator", ">="], + ["operator", "|"], ["operator", "^"], ["operator", "?"], ["operator", "'"], + ["operator", "#"], ["operator", "!"], ["operator", "~"], ["operator", "`"], + ["operator", "+"], ["operator", "-"], ["operator", "*"], ["operator", "/"], + ["operator", "+."], ["operator", "-."], ["operator", "*."], ["operator", "/."], + ["operator", "mod"], ["operator", "land"], ["operator", "lor"], ["operator", "lxor"], + ["operator", "lsl"], ["operator", "lsr"], ["operator", "asr"], + ["operator", "|>"], ["operator", "->"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/reason/string_feature.test b/package/src/prism/tests/languages/reason/string_feature.test new file mode 100644 index 00000000..24bb9926 --- /dev/null +++ b/package/src/prism/tests/languages/reason/string_feature.test @@ -0,0 +1,13 @@ +"" +"foo\"bar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foo\\\"bar\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/regex/anchor_feature.test b/package/src/prism/tests/languages/regex/anchor_feature.test new file mode 100644 index 00000000..b09a4310 --- /dev/null +++ b/package/src/prism/tests/languages/regex/anchor_feature.test @@ -0,0 +1,25 @@ +^ +$ +\A +\G +\Z +\z +\b +\B + +---------------------------------------------------- + +[ + ["anchor", "^"], + ["anchor", "$"], + ["anchor", "\\A"], + ["anchor", "\\G"], + ["anchor", "\\Z"], + ["anchor", "\\z"], + ["anchor", "\\b"], + ["anchor", "\\B"] +] + +---------------------------------------------------- + +Checks for anchors. diff --git a/package/src/prism/tests/languages/regex/backreference_feature.test b/package/src/prism/tests/languages/regex/backreference_feature.test new file mode 100644 index 00000000..fab6226d --- /dev/null +++ b/package/src/prism/tests/languages/regex/backreference_feature.test @@ -0,0 +1,26 @@ +\1 \2 \3 \4 \5 \6 \7 \8 \9 +\k + +---------------------------------------------------- + +[ + ["backreference", "\\1"], + ["backreference", "\\2"], + ["backreference", "\\3"], + ["backreference", "\\4"], + ["backreference", "\\5"], + ["backreference", "\\6"], + ["backreference", "\\7"], + ["backreference", "\\8"], + ["backreference", "\\9"], + + ["backreference", [ + "\\k<", + ["group-name", "name"], + ">" + ]] +] + +---------------------------------------------------- + +Checks for backreferences. diff --git a/package/src/prism/tests/languages/regex/char-class_feature.test b/package/src/prism/tests/languages/regex/char-class_feature.test new file mode 100644 index 00000000..1c278a52 --- /dev/null +++ b/package/src/prism/tests/languages/regex/char-class_feature.test @@ -0,0 +1,48 @@ +[] +[^] +[foo] +[\]\b] +[.^$\1] +[\d\D\p{L}] + +---------------------------------------------------- + +[ + ["char-class", [ + ["char-class-punctuation", "["], + ["char-class-punctuation", "]"] + ]], + ["char-class", [ + ["char-class-punctuation", "["], + ["char-class-negation", "^"], + ["char-class-punctuation", "]"] + ]], + ["char-class", [ + ["char-class-punctuation", "["], + "foo", + ["char-class-punctuation", "]"] + ]], + ["char-class", [ + ["char-class-punctuation", "["], + ["special-escape", "\\]"], + ["escape", "\\b"], + ["char-class-punctuation", "]"] + ]], + ["char-class", [ + ["char-class-punctuation", "["], + ".^$", + ["escape", "\\1"], + ["char-class-punctuation", "]"] + ]], + ["char-class", [ + ["char-class-punctuation", "["], + ["char-set", "\\d"], + ["char-set", "\\D"], + ["char-set", "\\p{L}"], + ["char-class-punctuation", "]"] + ]] +] + +---------------------------------------------------- + +Checks for character sets. diff --git a/package/src/prism/tests/languages/regex/char-set_feature.test b/package/src/prism/tests/languages/regex/char-set_feature.test new file mode 100644 index 00000000..6ea56ddc --- /dev/null +++ b/package/src/prism/tests/languages/regex/char-set_feature.test @@ -0,0 +1,21 @@ +. +\w \W +\s \S +\d \D +\p{ASCII} +\P{ASCII} + +---------------------------------------------------- + +[ + ["char-set", "."], + ["char-set", "\\w"], ["char-set", "\\W"], + ["char-set", "\\s"], ["char-set", "\\S"], + ["char-set", "\\d"], ["char-set", "\\D"], + ["char-set", "\\p{ASCII}"], + ["char-set", "\\P{ASCII}"] +] + +---------------------------------------------------- + +Checks for character classes. diff --git a/package/src/prism/tests/languages/regex/escape_feature.test b/package/src/prism/tests/languages/regex/escape_feature.test new file mode 100644 index 00000000..460faa70 --- /dev/null +++ b/package/src/prism/tests/languages/regex/escape_feature.test @@ -0,0 +1,42 @@ +\0 \\ \. \+ +\xFF +\uFFFF \u{10FFFF} +\cA \cZ +\01 \077 \377 +\n \r \t \f \a + +\[ \] + +---------------------------------------------------- + +[ + ["escape", "\\0"], + ["special-escape", "\\\\"], + ["special-escape", "\\."], + ["special-escape", "\\+"], + + ["escape", "\\xFF"], + + ["escape", "\\uFFFF"], + ["escape", "\\u{10FFFF}"], + + ["escape", "\\cA"], + ["escape", "\\cZ"], + + ["escape", "\\01"], + ["escape", "\\077"], + ["escape", "\\377"], + + ["escape", "\\n"], + ["escape", "\\r"], + ["escape", "\\t"], + ["escape", "\\f"], + ["escape", "\\a"], + + ["special-escape", "\\["], + ["special-escape", "\\]"] +] + +---------------------------------------------------- + +Checks for escapes. diff --git a/package/src/prism/tests/languages/regex/group_feature.test b/package/src/prism/tests/languages/regex/group_feature.test new file mode 100644 index 00000000..bb7e0878 --- /dev/null +++ b/package/src/prism/tests/languages/regex/group_feature.test @@ -0,0 +1,67 @@ +() +(?:) +(?>) +(?=) (?!) +(?<=) (?) +(?'name') + +(?i) +(?i:) +(?idmsuxU-idmsuxU) +(?idmsux-idmsux:X) + +---------------------------------------------------- + +[ + ["group", "("], + ["group", ")"], + + ["group", "("], + ["group", ["?:"]], + ["group", ")"], + + ["group", "("], + ["group", ["?>"]], + ["group", ")"], + + ["group", "("], + ["group", ["?="]], + ["group", ")"], + ["group", "("], + ["group", ["?!"]], + ["group", ")"], + + ["group", "("], + ["group", ["?<="]], + ["group", ")"], + ["group", "("], + ["group", ["?" + ]], + ["group", ")"], + + ["group", "("], + ["group", [ + "?'", + ["group-name", "name"], + "'" + ]], + ["group", ")"], + + ["group", "("], ["group", ["?i"]], ["group", ")"], + ["group", "("], ["group", ["?i:"]], ["group", ")"], + ["group", "("], ["group", ["?idmsuxU-idmsuxU"]], ["group", ")"], + ["group", "("], ["group", ["?idmsux-idmsux:"]], "X", ["group", ")"] +] + +---------------------------------------------------- + +Checks for groups. diff --git a/package/src/prism/tests/languages/regex/quantifier_feature.test b/package/src/prism/tests/languages/regex/quantifier_feature.test new file mode 100644 index 00000000..bd4e9bf9 --- /dev/null +++ b/package/src/prism/tests/languages/regex/quantifier_feature.test @@ -0,0 +1,37 @@ +* + ? +{2} {2,} {0,1} + +*? +? ?? +{2}? {2,}? {0,1}? + +*+ ++ ?+ +{2}+ {2,}+ {0,1}+ + +---------------------------------------------------- + +[ + ["quantifier", "*"], + ["quantifier", "+"], + ["quantifier", "?"], + ["quantifier", "{2}"], + ["quantifier", "{2,}"], + ["quantifier", "{0,1}"], + + ["quantifier", "*?"], + ["quantifier", "+?"], + ["quantifier", "??"], + ["quantifier", "{2}?"], + ["quantifier", "{2,}?"], + ["quantifier", "{0,1}?"], + + ["quantifier", "*+"], + ["quantifier", "++"], + ["quantifier", "?+"], + ["quantifier", "{2}+"], + ["quantifier", "{2,}+"], + ["quantifier", "{0,1}+"] +] + +---------------------------------------------------- + +Checks for quantifiers. diff --git a/package/src/prism/tests/languages/regex/range_feature.test b/package/src/prism/tests/languages/regex/range_feature.test new file mode 100644 index 00000000..fc1fb680 --- /dev/null +++ b/package/src/prism/tests/languages/regex/range_feature.test @@ -0,0 +1,51 @@ +[a-zA-Z0-9] +[\xa1-Z\u00FF-\u{256}] +[^-aaa-] + +---------------------------------------------------- + +[ + ["char-class", [ + ["char-class-punctuation", "["], + ["range", [ + "a", + ["range-punctuation", "-"], + "z" + ]], + ["range", [ + "A", + ["range-punctuation", "-"], + "Z" + ]], + ["range", [ + "0", + ["range-punctuation", "-"], + "9" + ]], + ["char-class-punctuation", "]"] + ]], + ["char-class", [ + ["char-class-punctuation", "["], + ["range", [ + ["escape", "\\xa1"], + ["range-punctuation", "-"], + "Z" + ]], + ["range", [ + ["escape", "\\u00FF"], + ["range-punctuation", "-"], + ["escape", "\\u{256}"] + ]], + ["char-class-punctuation", "]"] + ]], + ["char-class", [ + ["char-class-punctuation", "["], + ["char-class-negation", "^"], + "-aaa-", + ["char-class-punctuation", "]"] + ]] +] + +---------------------------------------------------- + +Checks for character ranges in sets. diff --git a/package/src/prism/tests/languages/rego/boolean_feature.test b/package/src/prism/tests/languages/rego/boolean_feature.test new file mode 100644 index 00000000..ca34f181 --- /dev/null +++ b/package/src/prism/tests/languages/rego/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/rego/comment_feature.test b/package/src/prism/tests/languages/rego/comment_feature.test new file mode 100644 index 00000000..710014b8 --- /dev/null +++ b/package/src/prism/tests/languages/rego/comment_feature.test @@ -0,0 +1,13 @@ +# +# foobar + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rego/function_feature.test b/package/src/prism/tests/languages/rego/function_feature.test new file mode 100644 index 00000000..1d68dc07 --- /dev/null +++ b/package/src/prism/tests/languages/rego/function_feature.test @@ -0,0 +1,173 @@ +object.remove({"a": {"b": {"c": 2}}, "x": 123}, {"a": 1}) == {"x": 123} + +output := is_set(x) +output := intersection(set[set]) +output := regex.match(pattern, value) +output := glob.match("*.github.com", [], "api.github.com") +output := bits.rsh(x, s) +output := io.jwt.verify_ps384(string, certificate) + +io.jwt.encode_sign({ + "typ": "JWT", + "alg": "HS256"}, + {}, { + "kty": "oct", + "k": "AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow" +}) + +---------------------------------------------------- + +[ + ["function", [ + ["namespace", "object"], + ["punctuation", "."], + "remove" + ]], + ["punctuation", "("], + ["punctuation", "{"], + ["property", "\"a\""], + ["operator", ":"], + ["punctuation", "{"], + ["property", "\"b\""], + ["operator", ":"], + ["punctuation", "{"], + ["property", "\"c\""], + ["operator", ":"], + ["number", "2"], + ["punctuation", "}"], + ["punctuation", "}"], + ["punctuation", ","], + ["property", "\"x\""], + ["operator", ":"], + ["number", "123"], + ["punctuation", "}"], + ["punctuation", ","], + ["punctuation", "{"], + ["property", "\"a\""], + ["operator", ":"], + ["number", "1"], + ["punctuation", "}"], + ["punctuation", ")"], + ["operator", "=="], + ["punctuation", "{"], + ["property", "\"x\""], + ["operator", ":"], + ["number", "123"], + ["punctuation", "}"], + + "\n\noutput ", + ["operator", ":="], + ["function", ["is_set"]], + ["punctuation", "("], + "x", + ["punctuation", ")"], + + "\noutput ", + ["operator", ":="], + ["function", ["intersection"]], + ["punctuation", "("], + "set", + ["punctuation", "["], + "set", + ["punctuation", "]"], + ["punctuation", ")"], + + "\noutput ", + ["operator", ":="], + ["function", [ + ["namespace", "regex"], + ["punctuation", "."], + "match" + ]], + ["punctuation", "("], + "pattern", + ["punctuation", ","], + " value", + ["punctuation", ")"], + + "\noutput ", + ["operator", ":="], + ["function", [ + ["namespace", "glob"], + ["punctuation", "."], + "match" + ]], + ["punctuation", "("], + ["string", "\"*.github.com\""], + ["punctuation", ","], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", ","], + ["string", "\"api.github.com\""], + ["punctuation", ")"], + + "\noutput ", + ["operator", ":="], + ["function", [ + ["namespace", "bits"], + ["punctuation", "."], + "rsh" + ]], + ["punctuation", "("], + "x", + ["punctuation", ","], + " s", + ["punctuation", ")"], + + "\noutput ", + ["operator", ":="], + ["function", [ + ["namespace", "io"], + ["punctuation", "."], + ["namespace", "jwt"], + ["punctuation", "."], + "verify_ps384" + ]], + ["punctuation", "("], + "string", + ["punctuation", ","], + " certificate", + ["punctuation", ")"], + + ["function", [ + ["namespace", "io"], + ["punctuation", "."], + ["namespace", "jwt"], + ["punctuation", "."], + "encode_sign" + ]], + ["punctuation", "("], + ["punctuation", "{"], + + ["property", "\"typ\""], + ["operator", ":"], + ["string", "\"JWT\""], + ["punctuation", ","], + + ["property", "\"alg\""], + ["operator", ":"], + ["string", "\"HS256\""], + ["punctuation", "}"], + ["punctuation", ","], + + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["punctuation", "{"], + + ["property", "\"kty\""], + ["operator", ":"], + ["string", "\"oct\""], + ["punctuation", ","], + + ["property", "\"k\""], + ["operator", ":"], + ["string", "\"AyM1SysPpbyDfgZld3umj1qzKObwVMkoqQ-EstJQLr_T-1qS0gZH75aKtMN3Yj0iPS4hcgUuTwjAzZr1Z9CAow\""], + + ["punctuation", "}"], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for all functions. diff --git a/package/src/prism/tests/languages/rego/keyword_feature.test b/package/src/prism/tests/languages/rego/keyword_feature.test new file mode 100644 index 00000000..9f37e66a --- /dev/null +++ b/package/src/prism/tests/languages/rego/keyword_feature.test @@ -0,0 +1,31 @@ +as +default +else +import +package +not +null +some +with + +set() + +---------------------------------------------------- + +[ + ["keyword", "as"], + ["keyword", "default"], + ["keyword", "else"], + ["keyword", "import"], + ["keyword", "package"], + ["keyword", "not"], + ["keyword", "null"], + ["keyword", "some"], + ["keyword", "with"], + + ["keyword", "set"], ["punctuation", "("], ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/rego/number_feature.test b/package/src/prism/tests/languages/rego/number_feature.test new file mode 100644 index 00000000..79d2fe81 --- /dev/null +++ b/package/src/prism/tests/languages/rego/number_feature.test @@ -0,0 +1,23 @@ +0 +123 +3.14159 +5.0e8 +0.2E+2 +47e-5 +-1.23 +-2.34E33 +-4.34E-33 + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "123"], + ["number", "3.14159"], + ["number", "5.0e8"], + ["number", "0.2E+2"], + ["number", "47e-5"], + ["number", "-1.23"], + ["number", "-2.34E33"], + ["number", "-4.34E-33"] +] diff --git a/package/src/prism/tests/languages/rego/operator_feature.test b/package/src/prism/tests/languages/rego/operator_feature.test new file mode 100644 index 00000000..8641cffc --- /dev/null +++ b/package/src/prism/tests/languages/rego/operator_feature.test @@ -0,0 +1,35 @@ +:= = : +== != < <= > >= ++ - / * % +& | +_ + +---------------------------------------------------- + +[ + ["operator", ":="], + ["operator", "="], + ["operator", ":"], + + ["operator", "=="], + ["operator", "!="], + ["operator", "<"], + ["operator", "<="], + ["operator", ">"], + ["operator", ">="], + + ["operator", "+"], + ["operator", "-"], + ["operator", "/"], + ["operator", "*"], + ["operator", "%"], + + ["operator", "&"], + ["operator", "|"], + + ["operator", "_"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/rego/property_feature.test b/package/src/prism/tests/languages/rego/property_feature.test new file mode 100644 index 00000000..b696e6d5 --- /dev/null +++ b/package/src/prism/tests/languages/rego/property_feature.test @@ -0,0 +1,208 @@ +instances[instance] { + server := sites[_].servers[_] + instance := {"address": server.hostname, "name": server.name} +} { + container := containers[_] + instance := {"address": container.ipaddress, "name": container.name} +} + +apps := [ + { + "name": "web", + "servers": ["web-0", "web-1", "web-1000", "web-1001", "web-dev"] + }, + { + "name": "mysql", + "servers": ["db-0", "db-1000"] + }, + { + "name": "mongodb", + "servers": ["db-dev"] + } +] + +not allow with input as {"user": "charlie", "method": "GET"} with data.roles as {"dev": ["bob"]} + +allow with input as {"user": "charlie", "method": "GET"} with data.roles as {"dev": ["charlie"]} + +---------------------------------------------------- + +[ + "instances", + ["punctuation", "["], + "instance", + ["punctuation", "]"], + ["punctuation", "{"], + + "\n server ", + ["operator", ":="], + " sites", + ["punctuation", "["], + ["operator", "_"], + ["punctuation", "]"], + ["punctuation", "."], + "servers", + ["punctuation", "["], + ["operator", "_"], + ["punctuation", "]"], + + "\n instance ", + ["operator", ":="], + ["punctuation", "{"], + ["property", "\"address\""], + ["operator", ":"], + " server", + ["punctuation", "."], + "hostname", + ["punctuation", ","], + ["property", "\"name\""], + ["operator", ":"], + " server", + ["punctuation", "."], + "name", + ["punctuation", "}"], + + ["punctuation", "}"], + ["punctuation", "{"], + + "\n container ", + ["operator", ":="], + " containers", + ["punctuation", "["], + ["operator", "_"], + ["punctuation", "]"], + + "\n instance ", + ["operator", ":="], + ["punctuation", "{"], + ["property", "\"address\""], + ["operator", ":"], + " container", + ["punctuation", "."], + "ipaddress", + ["punctuation", ","], + ["property", "\"name\""], + ["operator", ":"], + " container", + ["punctuation", "."], + "name", + ["punctuation", "}"], + + ["punctuation", "}"], + + "\n\napps ", + ["operator", ":="], + ["punctuation", "["], + + ["punctuation", "{"], + + ["property", "\"name\""], + ["operator", ":"], + ["string", "\"web\""], + ["punctuation", ","], + + ["property", "\"servers\""], + ["operator", ":"], + ["punctuation", "["], + ["string", "\"web-0\""], + ["punctuation", ","], + ["string", "\"web-1\""], + ["punctuation", ","], + ["string", "\"web-1000\""], + ["punctuation", ","], + ["string", "\"web-1001\""], + ["punctuation", ","], + ["string", "\"web-dev\""], + ["punctuation", "]"], + + ["punctuation", "}"], + ["punctuation", ","], + + ["punctuation", "{"], + + ["property", "\"name\""], + ["operator", ":"], + ["string", "\"mysql\""], + ["punctuation", ","], + + ["property", "\"servers\""], + ["operator", ":"], + ["punctuation", "["], + ["string", "\"db-0\""], + ["punctuation", ","], + ["string", "\"db-1000\""], + ["punctuation", "]"], + + ["punctuation", "}"], + ["punctuation", ","], + + ["punctuation", "{"], + + ["property", "\"name\""], + ["operator", ":"], + ["string", "\"mongodb\""], + ["punctuation", ","], + + ["property", "\"servers\""], + ["operator", ":"], + ["punctuation", "["], + ["string", "\"db-dev\""], + ["punctuation", "]"], + + ["punctuation", "}"], + + ["punctuation", "]"], + + ["keyword", "not"], + " allow ", + ["keyword", "with"], + " input ", + ["keyword", "as"], + ["punctuation", "{"], + ["property", "\"user\""], + ["operator", ":"], + ["string", "\"charlie\""], + ["punctuation", ","], + ["property", "\"method\""], + ["operator", ":"], + ["string", "\"GET\""], + ["punctuation", "}"], + ["keyword", "with"], + " data", + ["punctuation", "."], + "roles ", + ["keyword", "as"], + ["punctuation", "{"], + ["property", "\"dev\""], + ["operator", ":"], + ["punctuation", "["], + ["string", "\"bob\""], + ["punctuation", "]"], + ["punctuation", "}"], + + "\n\nallow ", + ["keyword", "with"], + " input ", + ["keyword", "as"], + ["punctuation", "{"], + ["property", "\"user\""], + ["operator", ":"], + ["string", "\"charlie\""], + ["punctuation", ","], + ["property", "\"method\""], + ["operator", ":"], + ["string", "\"GET\""], + ["punctuation", "}"], + ["keyword", "with"], + " data", + ["punctuation", "."], + "roles ", + ["keyword", "as"], + ["punctuation", "{"], + ["property", "\"dev\""], + ["operator", ":"], + ["punctuation", "["], + ["string", "\"charlie\""], + ["punctuation", "]"], + ["punctuation", "}"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/rego/punctuation_feature.test b/package/src/prism/tests/languages/rego/punctuation_feature.test new file mode 100644 index 00000000..7b24c73a --- /dev/null +++ b/package/src/prism/tests/languages/rego/punctuation_feature.test @@ -0,0 +1,17 @@ +, ; . +( ) [ ] { } + +---------------------------------------------------- + +[ + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", "."], + + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/rego/string_feature.test b/package/src/prism/tests/languages/rego/string_feature.test new file mode 100644 index 00000000..f30b43cc --- /dev/null +++ b/package/src/prism/tests/languages/rego/string_feature.test @@ -0,0 +1,43 @@ +"" +"foo\"bar" +`raw-string` + +jwks = `{ + "keys": [{ + "kty":"EC", + "crv":"P-256", + "x":"z8J91ghFy5o6f2xZ4g8LsLH7u2wEpT2ntj8loahnlsE", + "y":"7bdeXLH61KrGWRdh7ilnbcGQACxykaPKfmBccTHIOUo" + }] +}` + +cert = `-----BEGIN CERTIFICATE----- +MIIBcDCCARagAwIBAgIJAMZmuGSIfvgzMAoGCCqGSM49BAMCMBMxETAPBgNVBAMM +CHdoYXRldmVyMB4XDTE4MDgxMDE0Mjg1NFoXDTE4MDkwOTE0Mjg1NFowEzERMA8G +A1UEAwwId2hhdGV2ZXIwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATPwn3WCEXL +mjp/bFniDwuwsfu7bASlPae2PyWhqGeWwe23Xlyx+tSqxlkXYe4pZ23BkAAscpGj +yn5gXHExyDlKo1MwUTAdBgNVHQ4EFgQUElRjSoVgKjUqY5AXz2o74cLzzS8wHwYD +VR0jBBgwFoAUElRjSoVgKjUqY5AXz2o74cLzzS8wDwYDVR0TAQH/BAUwAwEB/zAK +BggqhkjOPQQDAgNIADBFAiEA4yQ/88ZrUX68c6kOe9G11u8NUaUzd8pLOtkKhniN +OHoCIHmNX37JOqTcTzGn2u9+c8NlnvZ0uDvsd1BmKPaUmjmm +-----END CERTIFICATE-----` + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foo\\\"bar\""], + ["string", "`raw-string`"], + + "\n\njwks ", + ["operator", "="], + ["string", "`{\n \"keys\": [{\n \"kty\":\"EC\",\n \"crv\":\"P-256\",\n \"x\":\"z8J91ghFy5o6f2xZ4g8LsLH7u2wEpT2ntj8loahnlsE\",\n \"y\":\"7bdeXLH61KrGWRdh7ilnbcGQACxykaPKfmBccTHIOUo\"\n }]\n}`"], + + "\n\ncert ", + ["operator", "="], + ["string", "`-----BEGIN CERTIFICATE-----\nMIIBcDCCARagAwIBAgIJAMZmuGSIfvgzMAoGCCqGSM49BAMCMBMxETAPBgNVBAMM\nCHdoYXRldmVyMB4XDTE4MDgxMDE0Mjg1NFoXDTE4MDkwOTE0Mjg1NFowEzERMA8G\nA1UEAwwId2hhdGV2ZXIwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAATPwn3WCEXL\nmjp/bFniDwuwsfu7bASlPae2PyWhqGeWwe23Xlyx+tSqxlkXYe4pZ23BkAAscpGj\nyn5gXHExyDlKo1MwUTAdBgNVHQ4EFgQUElRjSoVgKjUqY5AXz2o74cLzzS8wHwYD\nVR0jBBgwFoAUElRjSoVgKjUqY5AXz2o74cLzzS8wDwYDVR0TAQH/BAUwAwEB/zAK\nBggqhkjOPQQDAgNIADBFAiEA4yQ/88ZrUX68c6kOe9G11u8NUaUzd8pLOtkKhniN\nOHoCIHmNX37JOqTcTzGn2u9+c8NlnvZ0uDvsd1BmKPaUmjmm\n-----END CERTIFICATE-----`"] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/renpy/boolean_feature.test b/package/src/prism/tests/languages/renpy/boolean_feature.test new file mode 100644 index 00000000..30c2be15 --- /dev/null +++ b/package/src/prism/tests/languages/renpy/boolean_feature.test @@ -0,0 +1,9 @@ +true false +True False + +---------------------------------------------------- + +[ + ["boolean", "true"], ["boolean", "false"], + ["boolean", "True"], ["boolean", "False"] +] diff --git a/package/src/prism/tests/languages/renpy/comment_feature.test b/package/src/prism/tests/languages/renpy/comment_feature.test new file mode 100644 index 00000000..7883a734 --- /dev/null +++ b/package/src/prism/tests/languages/renpy/comment_feature.test @@ -0,0 +1,7 @@ +# comment + +---------------------------------------------------- + +[ + ["comment", "# comment"] +] diff --git a/package/src/prism/tests/languages/renpy/function_feature.test b/package/src/prism/tests/languages/renpy/function_feature.test new file mode 100644 index 00000000..3ec94de7 --- /dev/null +++ b/package/src/prism/tests/languages/renpy/function_feature.test @@ -0,0 +1,43 @@ +renpy.register_bmfont("bmfont", 22, filename="bmfont.fnt") + +# Resize the background of the text window if it's too small. +init python: + style.window.background = Frame("frame.png", 10, 10) + +---------------------------------------------------- + +[ + ["keyword", "renpy"], + ["punctuation", "."], + ["function", "register_bmfont"], + ["punctuation", "("], + ["string", "\"bmfont\""], + ["punctuation", ","], + ["number", "22"], + ["punctuation", ","], + " filename", + ["operator", "="], + ["string", "\"bmfont.fnt\""], + ["punctuation", ")"], + + ["comment", "# Resize the background of the text window if it's too small."], + + ["keyword", "init"], + ["keyword", "python"], + ["punctuation", ":"], + + ["keyword", "style"], + ["punctuation", "."], + ["tag", "window"], + ["punctuation", "."], + ["property", "background"], + ["operator", "="], + ["function", "Frame"], + ["punctuation", "("], + ["string", "\"frame.png\""], + ["punctuation", ","], + ["number", "10"], + ["punctuation", ","], + ["number", "10"], + ["punctuation", ")"] +] diff --git a/package/src/prism/tests/languages/renpy/keyword_feature.test b/package/src/prism/tests/languages/renpy/keyword_feature.test new file mode 100644 index 00000000..410cacf4 --- /dev/null +++ b/package/src/prism/tests/languages/renpy/keyword_feature.test @@ -0,0 +1,239 @@ +; None +; add +; adjustment +; alignaround +; allow +; angle +; animation +; around +; as +; assert +; behind +; box_layout +; break +; build +; cache +; call +; center +; changed +; child_size +; choice +; circles +; class +; clear +; clicked +; clipping +; clockwise +; config +; contains +; continue +; corner1 +; corner2 +; counterclockwise +; def +; default +; define +; del +; delay +; disabled +; disabled_text +; dissolve +; elif +; else +; event +; except +; exclude +; exec +; expression +; fade +; finally +; for +; from +; function +; global +; gm_root +; has +; hide +; id +; if +; import +; in +; init +; is +; jump +; knot +; lambda +; left +; less_rounded +; mm_root +; movie +; music +; null +; on +; onlayer +; pass +; pause +; persistent +; play +; print +; python +; queue +; raise +; random +; renpy +; repeat +; return +; right +; rounded_window +; scene +; scope +; set +; show +; slow +; slow_abortable +; slow_done +; sound +; stop +; store +; style +; style_group +; substitute +; suffix +; theme +; transform +; transform_anchor +; transpose +; try +; ui +; unhovered +; updater +; use +; voice +; while +; widget +; widget_hover +; widget_selected +; widget_text +; yield + +---------------------------------------------------- + +[ + ["punctuation", ";"], ["keyword", "None"], + ["punctuation", ";"], ["keyword", "add"], + ["punctuation", ";"], ["keyword", "adjustment"], + ["punctuation", ";"], ["keyword", "alignaround"], + ["punctuation", ";"], ["keyword", "allow"], + ["punctuation", ";"], ["keyword", "angle"], + ["punctuation", ";"], ["keyword", "animation"], + ["punctuation", ";"], ["keyword", "around"], + ["punctuation", ";"], ["keyword", "as"], + ["punctuation", ";"], ["keyword", "assert"], + ["punctuation", ";"], ["keyword", "behind"], + ["punctuation", ";"], ["keyword", "box_layout"], + ["punctuation", ";"], ["keyword", "break"], + ["punctuation", ";"], ["keyword", "build"], + ["punctuation", ";"], ["keyword", "cache"], + ["punctuation", ";"], ["keyword", "call"], + ["punctuation", ";"], ["keyword", "center"], + ["punctuation", ";"], ["keyword", "changed"], + ["punctuation", ";"], ["keyword", "child_size"], + ["punctuation", ";"], ["keyword", "choice"], + ["punctuation", ";"], ["keyword", "circles"], + ["punctuation", ";"], ["keyword", "class"], + ["punctuation", ";"], ["keyword", "clear"], + ["punctuation", ";"], ["keyword", "clicked"], + ["punctuation", ";"], ["keyword", "clipping"], + ["punctuation", ";"], ["keyword", "clockwise"], + ["punctuation", ";"], ["keyword", "config"], + ["punctuation", ";"], ["keyword", "contains"], + ["punctuation", ";"], ["keyword", "continue"], + ["punctuation", ";"], ["keyword", "corner1"], + ["punctuation", ";"], ["keyword", "corner2"], + ["punctuation", ";"], ["keyword", "counterclockwise"], + ["punctuation", ";"], ["keyword", "def"], + ["punctuation", ";"], ["keyword", "default"], + ["punctuation", ";"], ["keyword", "define"], + ["punctuation", ";"], ["keyword", "del"], + ["punctuation", ";"], ["keyword", "delay"], + ["punctuation", ";"], ["keyword", "disabled"], + ["punctuation", ";"], ["keyword", "disabled_text"], + ["punctuation", ";"], ["keyword", "dissolve"], + ["punctuation", ";"], ["keyword", "elif"], + ["punctuation", ";"], ["keyword", "else"], + ["punctuation", ";"], ["keyword", "event"], + ["punctuation", ";"], ["keyword", "except"], + ["punctuation", ";"], ["keyword", "exclude"], + ["punctuation", ";"], ["keyword", "exec"], + ["punctuation", ";"], ["keyword", "expression"], + ["punctuation", ";"], ["keyword", "fade"], + ["punctuation", ";"], ["keyword", "finally"], + ["punctuation", ";"], ["keyword", "for"], + ["punctuation", ";"], ["keyword", "from"], + ["punctuation", ";"], ["keyword", "function"], + ["punctuation", ";"], ["keyword", "global"], + ["punctuation", ";"], ["keyword", "gm_root"], + ["punctuation", ";"], ["keyword", "has"], + ["punctuation", ";"], ["keyword", "hide"], + ["punctuation", ";"], ["keyword", "id"], + ["punctuation", ";"], ["keyword", "if"], + ["punctuation", ";"], ["keyword", "import"], + ["punctuation", ";"], ["keyword", "in"], + ["punctuation", ";"], ["keyword", "init"], + ["punctuation", ";"], ["keyword", "is"], + ["punctuation", ";"], ["keyword", "jump"], + ["punctuation", ";"], ["keyword", "knot"], + ["punctuation", ";"], ["keyword", "lambda"], + ["punctuation", ";"], ["keyword", "left"], + ["punctuation", ";"], ["keyword", "less_rounded"], + ["punctuation", ";"], ["keyword", "mm_root"], + ["punctuation", ";"], ["keyword", "movie"], + ["punctuation", ";"], ["keyword", "music"], + ["punctuation", ";"], ["keyword", "null"], + ["punctuation", ";"], ["keyword", "on"], + ["punctuation", ";"], ["keyword", "onlayer"], + ["punctuation", ";"], ["keyword", "pass"], + ["punctuation", ";"], ["keyword", "pause"], + ["punctuation", ";"], ["keyword", "persistent"], + ["punctuation", ";"], ["keyword", "play"], + ["punctuation", ";"], ["keyword", "print"], + ["punctuation", ";"], ["keyword", "python"], + ["punctuation", ";"], ["keyword", "queue"], + ["punctuation", ";"], ["keyword", "raise"], + ["punctuation", ";"], ["keyword", "random"], + ["punctuation", ";"], ["keyword", "renpy"], + ["punctuation", ";"], ["keyword", "repeat"], + ["punctuation", ";"], ["keyword", "return"], + ["punctuation", ";"], ["keyword", "right"], + ["punctuation", ";"], ["keyword", "rounded_window"], + ["punctuation", ";"], ["keyword", "scene"], + ["punctuation", ";"], ["keyword", "scope"], + ["punctuation", ";"], ["keyword", "set"], + ["punctuation", ";"], ["keyword", "show"], + ["punctuation", ";"], ["keyword", "slow"], + ["punctuation", ";"], ["keyword", "slow_abortable"], + ["punctuation", ";"], ["keyword", "slow_done"], + ["punctuation", ";"], ["keyword", "sound"], + ["punctuation", ";"], ["keyword", "stop"], + ["punctuation", ";"], ["keyword", "store"], + ["punctuation", ";"], ["keyword", "style"], + ["punctuation", ";"], ["keyword", "style_group"], + ["punctuation", ";"], ["keyword", "substitute"], + ["punctuation", ";"], ["keyword", "suffix"], + ["punctuation", ";"], ["keyword", "theme"], + ["punctuation", ";"], ["keyword", "transform"], + ["punctuation", ";"], ["keyword", "transform_anchor"], + ["punctuation", ";"], ["keyword", "transpose"], + ["punctuation", ";"], ["keyword", "try"], + ["punctuation", ";"], ["keyword", "ui"], + ["punctuation", ";"], ["keyword", "unhovered"], + ["punctuation", ";"], ["keyword", "updater"], + ["punctuation", ";"], ["keyword", "use"], + ["punctuation", ";"], ["keyword", "voice"], + ["punctuation", ";"], ["keyword", "while"], + ["punctuation", ";"], ["keyword", "widget"], + ["punctuation", ";"], ["keyword", "widget_hover"], + ["punctuation", ";"], ["keyword", "widget_selected"], + ["punctuation", ";"], ["keyword", "widget_text"], + ["punctuation", ";"], ["keyword", "yield"] +] diff --git a/package/src/prism/tests/languages/renpy/property_feature.test b/package/src/prism/tests/languages/renpy/property_feature.test new file mode 100644 index 00000000..0eab089f --- /dev/null +++ b/package/src/prism/tests/languages/renpy/property_feature.test @@ -0,0 +1,469 @@ +insensitive +idle +hover +selected_idle +selected_hover +background +position +alt +xpos +ypos +pos +xanchor +yanchor +anchor +xalign +yalign +align +xcenter +ycenter +xofsset +yoffset +ymaximum +maximum +xmaximum +xminimum +yminimum +minimum +xsize +ysizexysize +xfill +yfill +area +antialias +black_color +bold +caret +color +first_indent +font +size +italic +justify +kerning +language +layout +line_leading +line_overlap_split +line_spacing +min_width +newline_indent +outlines +rest_indent +ruby_style +slow_cps +slow_cps_multiplier +strikethrough +text_align +underline +hyperlink_functions +vertical +hinting +foreground +left_margin +xmargin +top_margin +bottom_margin +ymargin +left_padding +right_padding +xpadding +top_padding +bottom_padding +ypadding +size_group +child +hover_sound +activate_sound +mouse +focus_mask +keyboard_focus +bar_vertical +bar_invert +bar_resizing +left_gutter +right_gutter +top_gutter +bottom_gutter +left_bar +right_bar +top_bar +bottom_bar +thumb +thumb_shadow +thumb_offset +unscrollable +spacing +first_spacing +box_reverse +box_wrap +order_reverse +fit_first +ysize +thumbnail_width +thumbnail_height +help +text_ypos +text_xpos +idle_color +hover_color +selected_idle_color +selected_hover_color +insensitive_color +alpha +insensitive_background +hover_background +zorder +value +width +xadjustment +xanchoraround +xaround +xinitial +xoffset +xzoom +yadjustment +yanchoraround +yaround +yinitial +yzoom +zoom +ground +height +text_style +text_y_fudge +selected_insensitive +has_sound +has_music +has_voice +focus +hovered +image_style +length +minwidth +mousewheel +offset +prefix +radius +range +right_margin +rotate +rotate_pad +developer +screen_width +screen_height +window_title +name +version +windows_icon +default_fullscreen +default_text_cps +default_afm_time +main_menu_music +sample_sound +enter_sound +exit_sound +save_directory +enter_transition +exit_transition +intra_transition +main_game_transition +game_main_transition +end_splash_transition +end_game_transition +after_load_transition +window_show_transition +window_hide_transition +adv_nvl_transition +nvl_adv_transition +enter_yesno_transition +exit_yesno_transition +enter_replay_transition +exit_replay_transition +say_attribute_transition +directory_name +executable_name +include_update +window_icon +modal +google_play_key +google_play_salt +drag_name +drag_handle +draggable +dragged +droppable +dropped +narrator_menu +action +default_afm_enable +version_name +version_tuple +inside +fadeout +fadein +layers +layer_clipping +linear +scrollbars +side_xpos +side_ypos +side_spacing +edgescroll +drag_joined +drag_raise +drop_shadow +drop_shadow_color +subpixel +easein +easeout +time +crop +auto +update +get_installed_packages +can_update +UpdateVersion +Update +overlay_functions +translations +window_left_padding +show_side_image +show_two_window + +---------------------------------------------------- + +[ + ["property", "insensitive"], + ["property", "idle"], + ["property", "hover"], + ["property", "selected_idle"], + ["property", "selected_hover"], + ["property", "background"], + ["property", "position"], + ["property", "alt"], + ["property", "xpos"], + ["property", "ypos"], + ["property", "pos"], + ["property", "xanchor"], + ["property", "yanchor"], + ["property", "anchor"], + ["property", "xalign"], + ["property", "yalign"], + ["property", "align"], + ["property", "xcenter"], + ["property", "ycenter"], + ["property", "xofsset"], + ["property", "yoffset"], + ["property", "ymaximum"], + ["property", "maximum"], + ["property", "xmaximum"], + ["property", "xminimum"], + ["property", "yminimum"], + ["property", "minimum"], + ["property", "xsize"], + ["property", "ysizexysize"], + ["property", "xfill"], + ["property", "yfill"], + ["property", "area"], + ["property", "antialias"], + ["property", "black_color"], + ["property", "bold"], + ["property", "caret"], + ["property", "color"], + ["property", "first_indent"], + ["property", "font"], + ["property", "size"], + ["property", "italic"], + ["property", "justify"], + ["property", "kerning"], + ["property", "language"], + ["property", "layout"], + ["property", "line_leading"], + ["property", "line_overlap_split"], + ["property", "line_spacing"], + ["property", "min_width"], + ["property", "newline_indent"], + ["property", "outlines"], + ["property", "rest_indent"], + ["property", "ruby_style"], + ["property", "slow_cps"], + ["property", "slow_cps_multiplier"], + ["property", "strikethrough"], + ["property", "text_align"], + ["property", "underline"], + ["property", "hyperlink_functions"], + ["property", "vertical"], + ["property", "hinting"], + ["property", "foreground"], + ["property", "left_margin"], + ["property", "xmargin"], + ["property", "top_margin"], + ["property", "bottom_margin"], + ["property", "ymargin"], + ["property", "left_padding"], + ["property", "right_padding"], + ["property", "xpadding"], + ["property", "top_padding"], + ["property", "bottom_padding"], + ["property", "ypadding"], + ["property", "size_group"], + ["property", "child"], + ["property", "hover_sound"], + ["property", "activate_sound"], + ["property", "mouse"], + ["property", "focus_mask"], + ["property", "keyboard_focus"], + ["property", "bar_vertical"], + ["property", "bar_invert"], + ["property", "bar_resizing"], + ["property", "left_gutter"], + ["property", "right_gutter"], + ["property", "top_gutter"], + ["property", "bottom_gutter"], + ["property", "left_bar"], + ["property", "right_bar"], + ["property", "top_bar"], + ["property", "bottom_bar"], + ["property", "thumb"], + ["property", "thumb_shadow"], + ["property", "thumb_offset"], + ["property", "unscrollable"], + ["property", "spacing"], + ["property", "first_spacing"], + ["property", "box_reverse"], + ["property", "box_wrap"], + ["property", "order_reverse"], + ["property", "fit_first"], + ["property", "ysize"], + ["property", "thumbnail_width"], + ["property", "thumbnail_height"], + ["property", "help"], + ["property", "text_ypos"], + ["property", "text_xpos"], + ["property", "idle_color"], + ["property", "hover_color"], + ["property", "selected_idle_color"], + ["property", "selected_hover_color"], + ["property", "insensitive_color"], + ["property", "alpha"], + ["property", "insensitive_background"], + ["property", "hover_background"], + ["property", "zorder"], + ["property", "value"], + ["property", "width"], + ["property", "xadjustment"], + ["property", "xanchoraround"], + ["property", "xaround"], + ["property", "xinitial"], + ["property", "xoffset"], + ["property", "xzoom"], + ["property", "yadjustment"], + ["property", "yanchoraround"], + ["property", "yaround"], + ["property", "yinitial"], + ["property", "yzoom"], + ["property", "zoom"], + ["property", "ground"], + ["property", "height"], + ["property", "text_style"], + ["property", "text_y_fudge"], + ["property", "selected_insensitive"], + ["property", "has_sound"], + ["property", "has_music"], + ["property", "has_voice"], + ["property", "focus"], + ["property", "hovered"], + ["property", "image_style"], + ["property", "length"], + ["property", "minwidth"], + ["property", "mousewheel"], + ["property", "offset"], + ["property", "prefix"], + ["property", "radius"], + ["property", "range"], + ["property", "right_margin"], + ["property", "rotate"], + ["property", "rotate_pad"], + ["property", "developer"], + ["property", "screen_width"], + ["property", "screen_height"], + ["property", "window_title"], + ["property", "name"], + ["property", "version"], + ["property", "windows_icon"], + ["property", "default_fullscreen"], + ["property", "default_text_cps"], + ["property", "default_afm_time"], + ["property", "main_menu_music"], + ["property", "sample_sound"], + ["property", "enter_sound"], + ["property", "exit_sound"], + ["property", "save_directory"], + ["property", "enter_transition"], + ["property", "exit_transition"], + ["property", "intra_transition"], + ["property", "main_game_transition"], + ["property", "game_main_transition"], + ["property", "end_splash_transition"], + ["property", "end_game_transition"], + ["property", "after_load_transition"], + ["property", "window_show_transition"], + ["property", "window_hide_transition"], + ["property", "adv_nvl_transition"], + ["property", "nvl_adv_transition"], + ["property", "enter_yesno_transition"], + ["property", "exit_yesno_transition"], + ["property", "enter_replay_transition"], + ["property", "exit_replay_transition"], + ["property", "say_attribute_transition"], + ["property", "directory_name"], + ["property", "executable_name"], + ["property", "include_update"], + ["property", "window_icon"], + ["property", "modal"], + ["property", "google_play_key"], + ["property", "google_play_salt"], + ["property", "drag_name"], + ["property", "drag_handle"], + ["property", "draggable"], + ["property", "dragged"], + ["property", "droppable"], + ["property", "dropped"], + ["property", "narrator_menu"], + ["property", "action"], + ["property", "default_afm_enable"], + ["property", "version_name"], + ["property", "version_tuple"], + ["property", "inside"], + ["property", "fadeout"], + ["property", "fadein"], + ["property", "layers"], + ["property", "layer_clipping"], + ["property", "linear"], + ["property", "scrollbars"], + ["property", "side_xpos"], + ["property", "side_ypos"], + ["property", "side_spacing"], + ["property", "edgescroll"], + ["property", "drag_joined"], + ["property", "drag_raise"], + ["property", "drop_shadow"], + ["property", "drop_shadow_color"], + ["property", "subpixel"], + ["property", "easein"], + ["property", "easeout"], + ["property", "time"], + ["property", "crop"], + ["property", "auto"], + ["property", "update"], + ["property", "get_installed_packages"], + ["property", "can_update"], + ["property", "UpdateVersion"], + ["property", "Update"], + ["property", "overlay_functions"], + ["property", "translations"], + ["property", "window_left_padding"], + ["property", "show_side_image"], + ["property", "show_two_window"] +] diff --git a/package/src/prism/tests/languages/renpy/string_feature.test b/package/src/prism/tests/languages/renpy/string_feature.test new file mode 100644 index 00000000..7606ed20 --- /dev/null +++ b/package/src/prism/tests/languages/renpy/string_feature.test @@ -0,0 +1,29 @@ +"# This isn't a comment, since it's part of a string." + +"Since this line contains a string, it continues + even when the line ends." + +$ a = [ "Because of parenthesis, this line also", + "spans more than one line." ] + +'Strings can\'t contain their delimiter, unless you escape it.' + +---------------------------------------------------- + +[ + ["string", "\"# This isn't a comment, since it's part of a string.\""], + + ["string", "\"Since this line contains a string, it continues\n even when the line ends.\""], + + ["tag", "$"], + " a ", + ["operator", "="], + ["punctuation", "["], + ["string", "\"Because of parenthesis, this line also\""], + ["punctuation", ","], + + ["string", "\"spans more than one line.\""], + ["punctuation", "]"], + + ["string", "'Strings can\\'t contain their delimiter, unless you escape it.'"] +] diff --git a/package/src/prism/tests/languages/renpy/tag_feature.test b/package/src/prism/tests/languages/renpy/tag_feature.test new file mode 100644 index 00000000..1bc9484d --- /dev/null +++ b/package/src/prism/tests/languages/renpy/tag_feature.test @@ -0,0 +1,75 @@ +label +image +menu +hbox +vbox +frame +text +imagemap +imagebutton +bar +vbar +screen +textbutton +buttoscreenn +fixed +grid +input +key +mousearea +side +timer +viewport +window +hotspot +hotbar +self +button +drag +draggroup +tag +mm_menu_frame +nvl +block + +$ + +---------------------------------------------------- + +[ + ["tag", "label"], + ["tag", "image"], + ["tag", "menu"], + ["tag", "hbox"], + ["tag", "vbox"], + ["tag", "frame"], + ["tag", "text"], + ["tag", "imagemap"], + ["tag", "imagebutton"], + ["tag", "bar"], + ["tag", "vbar"], + ["tag", "screen"], + ["tag", "textbutton"], + ["tag", "buttoscreenn"], + ["tag", "fixed"], + ["tag", "grid"], + ["tag", "input"], + ["tag", "key"], + ["tag", "mousearea"], + ["tag", "side"], + ["tag", "timer"], + ["tag", "viewport"], + ["tag", "window"], + ["tag", "hotspot"], + ["tag", "hotbar"], + ["tag", "self"], + ["tag", "button"], + ["tag", "drag"], + ["tag", "draggroup"], + ["tag", "tag"], + ["tag", "mm_menu_frame"], + ["tag", "nvl"], + ["tag", "block"], + + ["tag", "$"] +] diff --git a/package/src/prism/tests/languages/rescript/attr-value_feature.test b/package/src/prism/tests/languages/rescript/attr-value_feature.test new file mode 100644 index 00000000..50a2b5a2 --- /dev/null +++ b/package/src/prism/tests/languages/rescript/attr-value_feature.test @@ -0,0 +1,20 @@ + + +---------------------------------------------------- + +[ + ["operator", "<"], + ["tag", ["button"]], + ["operator", ">"], + ["tag", [ + ["operator", "<"], + ["operator", "/"], + "button" + ]], + ["operator", ">"] +] + +---------------------------------------------------- + +Checks for tag. diff --git a/package/src/prism/tests/languages/rest/command-line-option_feature.test b/package/src/prism/tests/languages/rest/command-line-option_feature.test new file mode 100644 index 00000000..53ed6f9f --- /dev/null +++ b/package/src/prism/tests/languages/rest/command-line-option_feature.test @@ -0,0 +1,37 @@ +-a Simple option +-b + Simple option on next line +--very-long-option Long option ++f Option using + +-f FILE Option with value 1 +--file=FILE Option with value 2 +-2, --two Two options in a row. +-f FILE, --file=FILE Two options with values in a row. +/V A VMS/DOS-style option. + +---------------------------------------------------- + +[ + ["command-line-option", "-a"], + " Simple option\n", + ["command-line-option", "-b"], + "\n Simple option on next line\n", + ["command-line-option", "--very-long-option"], + " Long option\n", + ["command-line-option", "+f"], + " Option using +\n", + ["command-line-option", "-f FILE"], + " Option with value 1\n", + ["command-line-option", "--file=FILE"], + " Option with value 2\n", + ["command-line-option", "-2, --two"], + " Two options in a row.\n", + ["command-line-option", "-f FILE, --file=FILE"], + " Two options with values in a row.\n", + ["command-line-option", "/V"], + " A VMS/DOS-style option." +] + +---------------------------------------------------- + +Checks for command line options. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/comment_feature.test b/package/src/prism/tests/languages/rest/comment_feature.test new file mode 100644 index 00000000..2ce0f14a --- /dev/null +++ b/package/src/prism/tests/languages/rest/comment_feature.test @@ -0,0 +1,24 @@ +.. foo + +.. foo +bar + +.. + _foo: + [bar] + |baz| + +---------------------------------------------------- + +[ + ["punctuation", ".."], + ["comment", " foo"], + ["punctuation", ".."], + ["comment", " foo\nbar"], + ["punctuation", ".."], + ["comment", "\n\t_foo:\n\t[bar]\n\t|baz|"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/directive_feature.test b/package/src/prism/tests/languages/rest/directive_feature.test new file mode 100644 index 00000000..779e882f --- /dev/null +++ b/package/src/prism/tests/languages/rest/directive_feature.test @@ -0,0 +1,33 @@ +.. image:: mylogo.jpeg +.. figure:: foo.png + +.. note:: This is a paragraph. + +---------------------------------------------------- + +[ + ["punctuation", ".."], + ["directive", [ + "image", + ["punctuation", "::"] + ]], + " mylogo.jpeg\n", + + ["punctuation", ".."], + ["directive", [ + "figure", + ["punctuation", "::"] + ]], + " foo.png\n\n", + + ["punctuation", ".."], + ["directive", [ + "note", + ["punctuation", "::"] + ]], + " This is a paragraph." +] + +---------------------------------------------------- + +Checks for directives. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/doctest-block_feature.test b/package/src/prism/tests/languages/rest/doctest-block_feature.test new file mode 100644 index 00000000..bf35ef23 --- /dev/null +++ b/package/src/prism/tests/languages/rest/doctest-block_feature.test @@ -0,0 +1,22 @@ +>>> Foo + +>>> foo +bar +baz + +---------------------------------------------------- + +[ + ["doctest-block", [ + ["punctuation", ">>>"], + " Foo" + ]], + ["doctest-block", [ + ["punctuation", ">>>"], + " foo\nbar\nbaz" + ]] +] + +---------------------------------------------------- + +Checks for doctest blocks. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/field_feature.test b/package/src/prism/tests/languages/rest/field_feature.test new file mode 100644 index 00000000..f427fcb9 --- /dev/null +++ b/package/src/prism/tests/languages/rest/field_feature.test @@ -0,0 +1,19 @@ +:scale: 50 % + :alt: map to buried treasure + +:width: 11 +:height: 11 + +---------------------------------------------------- + +[ + ["field", ":scale:"], " 50 %\n\t", + ["field", ":alt:"], " map to buried treasure\n\n", + + ["field", ":width:"], " 11\n", + ["field", ":height:"], " 11" +] + +---------------------------------------------------- + +Checks for fields. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/hr_feature.test b/package/src/prism/tests/languages/rest/hr_feature.test new file mode 100644 index 00000000..4b125a55 --- /dev/null +++ b/package/src/prism/tests/languages/rest/hr_feature.test @@ -0,0 +1,112 @@ +Foo + +!!!! + +"""" + +#### + +$$$$ + +%%%% + +&&&& + +'''' + +(((( + +)))) + +**** + +++++ + +,,,, + +---- + +.... + +//// + +:::: + +;;;; + +<<<< + +==== + +>>>> + +???? + +@@@@ + +[[[[ + +\\\\ + +]]]] + +^^^^ + +____ + +```` + +{{{{ + +|||| + +}}}} + +~~~~ + +Foo + +---------------------------------------------------- + +[ + "Foo\n\n", + ["hr", "!!!!"], + ["hr", "\"\"\"\""], + ["hr", "####"], + ["hr", "$$$$"], + ["hr", "%%%%"], + ["hr", "&&&&"], + ["hr", "''''"], + ["hr", "(((("], + ["hr", "))))"], + ["hr", "****"], + ["hr", "++++"], + ["hr", ",,,,"], + ["hr", "----"], + ["hr", "...."], + ["hr", "////"], + ["hr", "::::"], + ["hr", ";;;;"], + ["hr", "<<<<"], + ["hr", "===="], + ["hr", ">>>>"], + ["hr", "????"], + ["hr", "@@@@"], + ["hr", "[[[["], + ["hr", "\\\\\\\\"], + ["hr", "]]]]"], + ["hr", "^^^^"], + ["hr", "____"], + ["hr", "````"], + ["hr", "{{{{"], + ["hr", "||||"], + ["hr", "}}}}"], + ["hr", "~~~~"], + "\n\nFoo" +] + +---------------------------------------------------- + +Checks for horizontal lines, with every possible characters. +The "Foo"s are required since tests are trimmed and horizontal lines +require line feeds before and after. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/inline_feature.test b/package/src/prism/tests/languages/rest/inline_feature.test new file mode 100644 index 00000000..683f9cbe --- /dev/null +++ b/package/src/prism/tests/languages/rest/inline_feature.test @@ -0,0 +1,55 @@ +Foo *emphasis*. +**Strong** bar. +This is `interpreted text`. +:role:`interpreted text` +`interpreted text`:role: +``inline literals`` +This is a regexp: ``[+-]?(\d+(\.\d*)?|\.\d+)`` +Usage of |substitution|. + +---------------------------------------------------- + +[ + "Foo ", + ["inline", [ + ["punctuation", "*"], ["italic", "emphasis"], ["punctuation", "*"] + ]], + ".\n", + ["inline", [ + ["punctuation", "**"], ["bold", "Strong"], ["punctuation", "**"] + ]], + " bar.\nThis is ", + ["inline", [ + ["punctuation", "`"], ["interpreted-text", "interpreted text"], ["punctuation", "`"] + ]], + ".\n", + ["inline", [ + ["role", [ + ["punctuation", ":"], "role", ["punctuation", ":"] + ]], + ["punctuation", "`"], ["interpreted-text", "interpreted text"], ["punctuation", "`"] + ]], + ["inline", [ + ["punctuation", "`"], ["interpreted-text", "interpreted text"], ["punctuation", "`"], + ["role", [ + ["punctuation", ":"], "role", ["punctuation", ":"] + ]] + ]], + ["inline", [ + ["punctuation", "``"], ["inline-literal", "inline literals"], ["punctuation", "``"] + ]], + "\nThis is a regexp: ", + ["inline", [ + ["punctuation", "``"], ["inline-literal", "[+-]?(\\d+(\\.\\d*)?|\\.\\d+)"], ["punctuation", "``"] + ]], + "\nUsage of ", + ["inline", [ + ["punctuation", "|"], ["substitution", "substitution"], ["punctuation", "|"] + ]], + "." +] + +---------------------------------------------------- + +Checks for most inline markup: emphasis, bold, interpreted text, +roles, inline literals and substitutions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/issue2940.test b/package/src/prism/tests/languages/rest/issue2940.test new file mode 100644 index 00000000..d9604193 --- /dev/null +++ b/package/src/prism/tests/languages/rest/issue2940.test @@ -0,0 +1,33 @@ +`ALTER ROLE `_ or ``ALTER_ROLE`` + +`ALTER ROLE `_ +or ``ALTER_ROLE`` + +---------------------------------------------------- + +[ + ["link", [ + ["punctuation", "`"], + "ALTER ROLE ", + ["punctuation", "`_"] + ]], + " or ", + ["inline", [ + ["punctuation", "``"], + ["inline-literal", "ALTER_ROLE"], + ["punctuation", "``"] + ]], + + ["link", [ + ["punctuation", "`"], + "ALTER ROLE ", + ["punctuation", "`_"] + ]], + + "\nor ", + ["inline", [ + ["punctuation", "``"], + ["inline-literal", "ALTER_ROLE"], + ["punctuation", "``"] + ]] +] diff --git a/package/src/prism/tests/languages/rest/link-target_feature.test b/package/src/prism/tests/languages/rest/link-target_feature.test new file mode 100644 index 00000000..5194b5f1 --- /dev/null +++ b/package/src/prism/tests/languages/rest/link-target_feature.test @@ -0,0 +1,90 @@ +.. [1] Foo +.. [2] Bar +.. [#] Baz +.. [#foobar] Foobar +.. [CIT2002] Foobar + +.. _foobar: Foobar +.. _foo\:bar: Foobar +.. _`foo:bar`: Foobar +.. __: Anonymous + +---------------------------------------------------- + +[ + ["punctuation", ".."], + ["link-target", [ + ["punctuation", "["], + "1", + ["punctuation", "]"] + ]], + " Foo\n", + + ["punctuation", ".."], + ["link-target", [ + ["punctuation", "["], + "2", + ["punctuation", "]"] + ]], + " Bar\n", + + ["punctuation", ".."], + ["link-target", [ + ["punctuation", "["], + "#", + ["punctuation", "]"] + ]], + " Baz\n", + + ["punctuation", ".."], + ["link-target", [ + ["punctuation", "["], + "#foobar", + ["punctuation", "]"] + ]], + " Foobar\n", + + ["punctuation", ".."], + ["link-target", [ + ["punctuation", "["], + "CIT2002", + ["punctuation", "]"] + ]], + " Foobar\n\n", + + ["punctuation", ".."], + ["link-target", [ + ["punctuation", "_"], + "foobar", + ["punctuation", ":"] + ]], + " Foobar\n", + + ["punctuation", ".."], + ["link-target", [ + ["punctuation", "_"], + "foo\\:bar", + ["punctuation", ":"] + ]], + " Foobar\n", + + ["punctuation", ".."], + ["link-target", [ + ["punctuation", "_"], + "`foo:bar`", + ["punctuation", ":"] + ]], + " Foobar\n", + + ["punctuation", ".."], + ["link-target", [ + ["punctuation", "_"], + ["punctuation", "_"], + ["punctuation", ":"] + ]], + " Anonymous" +] + +---------------------------------------------------- + +Checks for link targets. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/link_feature.test b/package/src/prism/tests/languages/rest/link_feature.test new file mode 100644 index 00000000..f7d3f07b --- /dev/null +++ b/package/src/prism/tests/languages/rest/link_feature.test @@ -0,0 +1,33 @@ +[1]_ +[2]_ +[#]_ +[#foobar]_ +[CIT2002]_ + +foobar_ +foo__ +foo:bar_ +`foo:bar`_ +`foo bar baz`__ +_`inline internal target` + +---------------------------------------------------- + +[ + ["link", [["punctuation", "["], "1", ["punctuation", "]_"]]], + ["link", [["punctuation", "["], "2", ["punctuation", "]_"]]], + ["link", [["punctuation", "["], "#", ["punctuation", "]_"]]], + ["link", [["punctuation", "["], "#foobar", ["punctuation", "]_"]]], + ["link", [["punctuation", "["], "CIT2002", ["punctuation", "]_"]]], + + ["link", ["foobar", ["punctuation", "_"]]], + ["link", ["foo", ["punctuation", "__"]]], + ["link", ["foo:bar", ["punctuation", "_"]]], + ["link", [["punctuation", "`"], "foo:bar", ["punctuation", "`_"]]], + ["link", [["punctuation", "`"], "foo bar baz", ["punctuation", "`__"]]], + ["link", [["punctuation", "_`"], "inline internal target", ["punctuation", "`"]]] +] + +---------------------------------------------------- + +Checks for links. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/list-bullet_feature.test b/package/src/prism/tests/languages/rest/list-bullet_feature.test new file mode 100644 index 00000000..d2830932 --- /dev/null +++ b/package/src/prism/tests/languages/rest/list-bullet_feature.test @@ -0,0 +1,45 @@ +* foo ++ bar +- baz +• foo +‣ bar +⁃ baz + +(42) foo +(a) bar +(xvii) baz + +4) foo +h) bar +MLCDXVI) 1666 + +1. foo +z. bar +mlcdxvi. baz + +---------------------------------------------------- + +[ + ["list-bullet", "*"], " foo\n", + ["list-bullet", "+"], " bar\n", + ["list-bullet", "-"], " baz\n", + ["list-bullet", "•"], " foo\n", + ["list-bullet", "‣"], " bar\n", + ["list-bullet", "⁃"], " baz\n\n", + + ["list-bullet", "(42)"], " foo\n", + ["list-bullet", "(a)"], " bar\n", + ["list-bullet", "(xvii)"], " baz\n\n", + + ["list-bullet", "4)"], " foo\n", + ["list-bullet", "h)"], " bar\n", + ["list-bullet", "MLCDXVI)"], " 1666\n\n", + + ["list-bullet", "1."], " foo\n", + ["list-bullet", "z."], " bar\n", + ["list-bullet", "mlcdxvi."], " baz" +] + +---------------------------------------------------- + +Checks for list bullets. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/literal-block_feature.test b/package/src/prism/tests/languages/rest/literal-block_feature.test new file mode 100644 index 00000000..ba7f19b3 --- /dev/null +++ b/package/src/prism/tests/languages/rest/literal-block_feature.test @@ -0,0 +1,29 @@ +:: + + Foo + Bar + Baz + +Foobar:: + + Foo + Bar + Baz + +---------------------------------------------------- + +[ + ["literal-block", [ + ["literal-block-punctuation", "::"], + "\n\n\tFoo\n\tBar\n\tBaz" + ]], + "\n\nFoobar", + ["literal-block", [ + ["literal-block-punctuation", "::"], + "\n\n Foo\n Bar\n Baz" + ]] +] + +---------------------------------------------------- + +Checks for literal blocks. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/quoted-literal-block_feature.test b/package/src/prism/tests/languages/rest/quoted-literal-block_feature.test new file mode 100644 index 00000000..78ceec50 --- /dev/null +++ b/package/src/prism/tests/languages/rest/quoted-literal-block_feature.test @@ -0,0 +1,365 @@ +:: + +! Foo +!! Bar +! Baz + +Foobar :: + +" Foo +" Bar +"" Baz + +:: + +# Foo +# Bar + +:: + +$ Foo +$ Bar + +:: + +% Foo +% Bar + +:: + +& Foo +& Bar + +:: + +' Foo +' Bar + +:: + +( Foo +( Bar + +:: + +) Foo +) Bar + +:: + +* Foo +* Bar + +:: + ++ Foo ++ Bar + +:: + +, Foo +, Bar + +:: + +- Foo +- Bar + +:: + +. Foo +. Bar + +:: + +/ Foo +/ Bar + +:: + +: Foo +: Bar + +:: + +; Foo +; Bar + +:: + +< Foo +< Bar + +:: + += Foo += Bar + +:: + +> Foo +> Bar + +:: + +? Foo +? Bar + +:: + +@ Foo +@ Bar + +:: + +[ Foo +[ Bar + +:: + +\ Foo +\ Bar + +:: + +] Foo +] Bar + +:: + +^ Foo +^ Bar + +:: + +_ Foo +_ Bar + +:: + +` Foo +` Bar + +:: + +{ Foo +{ Bar + +:: + +| Foo +| Bar + +:: + +} Foo +} Bar + +:: + +~ Foo +~ Bar + + +---------------------------------------------------- + +[ + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "!"], " Foo\n", + ["literal-block-punctuation", "!!"], " Bar\n", + ["literal-block-punctuation", "!"], " Baz" + ]], + + "\n\nFoobar ", + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "\""], " Foo\n", + ["literal-block-punctuation", "\""], " Bar\n", + ["literal-block-punctuation", "\"\""], " Baz" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "#"], " Foo\n", + ["literal-block-punctuation", "#"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "$"], " Foo\n", + ["literal-block-punctuation", "$"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "%"], " Foo\n", + ["literal-block-punctuation", "%"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "&"], " Foo\n", + ["literal-block-punctuation", "&"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "'"], " Foo\n", + ["literal-block-punctuation", "'"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "("], " Foo\n", + ["literal-block-punctuation", "("], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", ")"], " Foo\n", + ["literal-block-punctuation", ")"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "*"], " Foo\n", + ["literal-block-punctuation", "*"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "+"], " Foo\n", + ["literal-block-punctuation", "+"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", ","], " Foo\n", + ["literal-block-punctuation", ","], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "-"], " Foo\n", + ["literal-block-punctuation", "-"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "."], " Foo\n", + ["literal-block-punctuation", "."], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "/"], " Foo\n", + ["literal-block-punctuation", "/"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", ":"], " Foo\n", + ["literal-block-punctuation", ":"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", ";"], " Foo\n", + ["literal-block-punctuation", ";"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "<"], " Foo\n", + ["literal-block-punctuation", "<"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "="], " Foo\n", + ["literal-block-punctuation", "="], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", ">"], " Foo\n", + ["literal-block-punctuation", ">"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "?"], " Foo\n", + ["literal-block-punctuation", "?"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "@"], " Foo\n", + ["literal-block-punctuation", "@"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "["], " Foo\n", + ["literal-block-punctuation", "["], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "\\"], " Foo\n", + ["literal-block-punctuation", "\\"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "]"], " Foo\n", + ["literal-block-punctuation", "]"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "^"], " Foo\n", + ["literal-block-punctuation", "^"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "_"], " Foo\n", + ["literal-block-punctuation", "_"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "`"], " Foo\n", + ["literal-block-punctuation", "`"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "{"], " Foo\n", + ["literal-block-punctuation", "{"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "|"], " Foo\n", + ["literal-block-punctuation", "|"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "}"], " Foo\n", + ["literal-block-punctuation", "}"], " Bar" + ]], + + ["quoted-literal-block", [ + ["literal-block-punctuation", "::"], + ["literal-block-punctuation", "~"], " Foo\n", + ["literal-block-punctuation", "~"], " Bar" + ]] +] + +---------------------------------------------------- + +Checks for quoted literal blocks, with every possible character. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/substitution-def_feature.test b/package/src/prism/tests/languages/rest/substitution-def_feature.test new file mode 100644 index 00000000..d97b5cf3 --- /dev/null +++ b/package/src/prism/tests/languages/rest/substitution-def_feature.test @@ -0,0 +1,69 @@ +.. |biohazard| image:: biohazard.png +.. |Red light| image:: red_light.png + +.. |Michael| user:: mjones +.. |Jon| user:: jhl + +---------------------------------------------------- + +[ + ["punctuation", ".."], + ["substitution-def", [ + ["substitution", [ + ["punctuation", "|"], + "biohazard", + ["punctuation", "|"] + ]], + ["directive", [ + "image", + ["punctuation", "::"] + ]] + ]], + " biohazard.png\n", + + ["punctuation", ".."], + ["substitution-def", [ + ["substitution", [ + ["punctuation", "|"], + "Red light", + ["punctuation", "|"] + ]], + ["directive", [ + "image", + ["punctuation", "::"] + ]] + ]], + " red_light.png\n\n", + + ["punctuation", ".."], + ["substitution-def", [ + ["substitution", [ + ["punctuation", "|"], + "Michael", + ["punctuation", "|"] + ]], + ["directive", [ + "user", + ["punctuation", "::"] + ]] + ]], + " mjones\n", + + ["punctuation", ".."], + ["substitution-def", [ + ["substitution", [ + ["punctuation", "|"], + "Jon", + ["punctuation", "|"] + ]], + ["directive", [ + "user", + ["punctuation", "::"] + ]] + ]], + " jhl" +] + +---------------------------------------------------- + +Checks for substitution definitions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/table_feature.test b/package/src/prism/tests/languages/rest/table_feature.test new file mode 100644 index 00000000..419b3979 --- /dev/null +++ b/package/src/prism/tests/languages/rest/table_feature.test @@ -0,0 +1,64 @@ ++-----+---------+ +| foo | bar | ++=====+=========+ +| foo | bar | ++-----+---------+ + + +---+ + | 1 | + +---+ + +=== === + a b +=== === + 1 2 +=== === + + ==== ==== ===== + foo bar + --------- ----- + ab cd e + ==== ==== ===== + 1 2 3 + 4 5 6 + ==== ==== ===== + +---------------------------------------------------- + +[ + ["table", [ + ["punctuation", "+-----+---------+"], + ["punctuation", "|"], " foo ", ["punctuation", "|"], " bar ", ["punctuation", "|"], + ["punctuation", "+=====+=========+"], + ["punctuation", "|"], " foo ", ["punctuation", "|"], " bar ", ["punctuation", "|"], + ["punctuation", "+-----+---------+"] + ]], + + ["table", [ + ["punctuation", "+---+"], + ["punctuation", "|"], " 1 ", ["punctuation", "|"], + ["punctuation", "+---+"] + ]], + + ["table", [ + ["punctuation", "==="], ["punctuation", "==="], + "\n a b\n", + ["punctuation", "==="], ["punctuation", "==="], + "\n 1 2\n", + ["punctuation", "==="], ["punctuation", "==="] + ]], + + ["table", [ + ["punctuation", "===="], ["punctuation", "===="], ["punctuation", "====="], + "\n\t foo bar\n\t", + ["punctuation", "---------"], ["punctuation", "-----"], + "\n\t ab cd e\n\t", + ["punctuation", "===="], ["punctuation", "===="], ["punctuation", "====="], + "\n\t 1 2 3\n\t 4 5 6\n\t", + ["punctuation", "===="], ["punctuation", "===="], ["punctuation", "====="] + ]] +] + +---------------------------------------------------- + +Checks for grid tables and simple tables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rest/title_feature.test b/package/src/prism/tests/languages/rest/title_feature.test new file mode 100644 index 00000000..b3aef56e --- /dev/null +++ b/package/src/prism/tests/languages/rest/title_feature.test @@ -0,0 +1,585 @@ +!!!! +Foo +!!!! + +"""" +Foo +"""" + +#### +Foo +#### + +$$$$ +Foo +$$$$ + +%%%% +Foo +%%%% + +&&&& +Foo +&&&& + +'''' +Foo +'''' + +(((( +Foo +(((( + +)))) +Foo +)))) + +**** +Foo +**** + +++++ +Foo +++++ + +,,,, +Foo +,,,, + +--- +Foo +--- + +.... +Foo +.... + +//// +Foo +//// + +:::: +Foo +:::: + +;;;; +Foo +;;;; + +<<<< +Foo +<<<< + +==== +Foo +==== + +>>>> +Foo +>>>> + +???? +Foo +???? + +@@@@ +Foo +@@@@ + +[[[[ +Foo +[[[[ + +\\\\ +Foo +\\\\ + +]]]] +Foo +]]]] + +^^^^ +Foo +^^^^ + +____ +Foo +____ + +```` +Foo +```` + +{{{{ +Foo +{{{{ + +|||| +Foo +|||| + +}}}} +Foo +}}}} + +~~~~ +Foo +~~~~ + + +Bar +!!!! + +Bar +"""" + +Bar +#### + +Bar +$$$$ + +Bar +%%%% + +Bar +&&&& + +Bar +'''' + +Bar +(((( + +Bar +)))) + +Bar +**** + +Bar +++++ + +Bar +,,,, + +Bar +--- + +Bar +.... + +Bar +//// + +Bar +:::: + +Bar +;;;; + +Bar +<<<< + +Bar +==== + +Bar +>>>> + +Bar +???? + +Bar +@@@@ + +Bar +[[[[ + +Bar +\\\\ + +Bar +]]]] + +Bar +^^^^ + +Bar +____ + +Bar +```` + +Bar +{{{{ + +Bar +|||| + +Bar +}}}} + +Bar +~~~~ + +---------------------------------------------------- + +[ + ["title", [ + ["punctuation", "!!!!"], + ["important", "Foo"], + ["punctuation", "!!!!"] + ]], + + ["title", [ + ["punctuation", "\"\"\"\""], + ["important", "Foo"], + ["punctuation", "\"\"\"\""] + ]], + + ["title", [ + ["punctuation", "####"], + ["important", "Foo"], + ["punctuation", "####"] + ]], + + ["title", [ + ["punctuation", "$$$$"], + ["important", "Foo"], + ["punctuation", "$$$$"] + ]], + + ["title", [ + ["punctuation", "%%%%"], + ["important", "Foo"], + ["punctuation", "%%%%"] + ]], + + ["title", [ + ["punctuation", "&&&&"], + ["important", "Foo"], + ["punctuation", "&&&&"] + ]], + + ["title", [ + ["punctuation", "''''"], + ["important", "Foo"], + ["punctuation", "''''"] + ]], + + ["title", [ + ["punctuation", "(((("], + ["important", "Foo"], + ["punctuation", "(((("] + ]], + + ["title", [ + ["punctuation", "))))"], + ["important", "Foo"], + ["punctuation", "))))"] + ]], + + ["title", [ + ["punctuation", "****"], + ["important", "Foo"], + ["punctuation", "****"] + ]], + + ["title", [ + ["punctuation", "++++"], + ["important", "Foo"], + ["punctuation", "++++"] + ]], + + ["title", [ + ["punctuation", ",,,,"], + ["important", "Foo"], + ["punctuation", ",,,,"] + ]], + + ["title", [ + ["punctuation", "---"], + ["important", "Foo"], + ["punctuation", "---"] + ]], + + ["title", [ + ["punctuation", "...."], + ["important", "Foo"], + ["punctuation", "...."] + ]], + + ["title", [ + ["punctuation", "////"], + ["important", "Foo"], + ["punctuation", "////"] + ]], + + ["title", [ + ["punctuation", "::::"], + ["important", "Foo"], + ["punctuation", "::::"] + ]], + + ["title", [ + ["punctuation", ";;;;"], + ["important", "Foo"], + ["punctuation", ";;;;"] + ]], + + ["title", [ + ["punctuation", "<<<<"], + ["important", "Foo"], + ["punctuation", "<<<<"] + ]], + + ["title", [ + ["punctuation", "===="], + ["important", "Foo"], + ["punctuation", "===="] + ]], + + ["title", [ + ["punctuation", ">>>>"], + ["important", "Foo"], + ["punctuation", ">>>>"] + ]], + + ["title", [ + ["punctuation", "????"], + ["important", "Foo"], + ["punctuation", "????"] + ]], + + ["title", [ + ["punctuation", "@@@@"], + ["important", "Foo"], + ["punctuation", "@@@@"] + ]], + + ["title", [ + ["punctuation", "[[[["], + ["important", "Foo"], + ["punctuation", "[[[["] + ]], + + ["title", [ + ["punctuation", "\\\\\\\\"], + ["important", "Foo"], + ["punctuation", "\\\\\\\\"] + ]], + + ["title", [ + ["punctuation", "]]]]"], + ["important", "Foo"], + ["punctuation", "]]]]"] + ]], + + ["title", [ + ["punctuation", "^^^^"], + ["important", "Foo"], + ["punctuation", "^^^^"] + ]], + + ["title", [ + ["punctuation", "____"], + ["important", "Foo"], + ["punctuation", "____"] + ]], + + ["title", [ + ["punctuation", "````"], + ["important", "Foo"], + ["punctuation", "````"] + ]], + + ["title", [ + ["punctuation", "{{{{"], + ["important", "Foo"], + ["punctuation", "{{{{"] + ]], + + ["title", [ + ["punctuation", "||||"], + ["important", "Foo"], + ["punctuation", "||||"] + ]], + + ["title", [ + ["punctuation", "}}}}"], + ["important", "Foo"], + ["punctuation", "}}}}"] + ]], + + ["title", [ + ["punctuation", "~~~~"], + ["important", "Foo"], + ["punctuation", "~~~~"] + ]], + + + ["title", [ + ["important", "Bar"], + ["punctuation", "!!!!"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "\"\"\"\""] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "####"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "$$$$"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "%%%%"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "&&&&"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "''''"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "(((("] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "))))"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "****"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "++++"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", ",,,,"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "---"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "...."] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "////"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "::::"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", ";;;;"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "<<<<"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "===="] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", ">>>>"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "????"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "@@@@"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "[[[["] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "\\\\\\\\"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "]]]]"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "^^^^"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "____"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "````"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "{{{{"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "||||"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "}}}}"] + ]], + + ["title", [ + ["important", "Bar"], + ["punctuation", "~~~~"] + ]] +] + +---------------------------------------------------- + +Checks for titles, overlined and underlined or underlined only, with every possible adornments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rip/boolean_feature.test b/package/src/prism/tests/languages/rip/boolean_feature.test new file mode 100644 index 00000000..a40f8d95 --- /dev/null +++ b/package/src/prism/tests/languages/rip/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rip/builtin_feature.test b/package/src/prism/tests/languages/rip/builtin_feature.test new file mode 100644 index 00000000..ba4ac741 --- /dev/null +++ b/package/src/prism/tests/languages/rip/builtin_feature.test @@ -0,0 +1,13 @@ +@ +System + +---------------------------------------------------- + +[ + ["builtin", "@"], + ["builtin", "System"] +] + +---------------------------------------------------- + +Checks for builtins. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rip/char_feature.test b/package/src/prism/tests/languages/rip/char_feature.test new file mode 100644 index 00000000..83c14588 --- /dev/null +++ b/package/src/prism/tests/languages/rip/char_feature.test @@ -0,0 +1,15 @@ +`a +`b +`Z + +---------------------------------------------------- + +[ + ["char", "`a"], + ["char", "`b"], + ["char", "`Z"] +] + +---------------------------------------------------- + +Checks for characters. diff --git a/package/src/prism/tests/languages/rip/comment_feature.test b/package/src/prism/tests/languages/rip/comment_feature.test new file mode 100644 index 00000000..710014b8 --- /dev/null +++ b/package/src/prism/tests/languages/rip/comment_feature.test @@ -0,0 +1,13 @@ +# +# foobar + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rip/date_time_feature.test b/package/src/prism/tests/languages/rip/date_time_feature.test new file mode 100644 index 00000000..43acc2d0 --- /dev/null +++ b/package/src/prism/tests/languages/rip/date_time_feature.test @@ -0,0 +1,23 @@ +2015-08-30 +1970-01-01 + +17:43:21 +00:00:00 + +2015-08-30T17:43:21 +1970-01-01T00:00:00 + +---------------------------------------------------- + +[ + ["date", "2015-08-30"], + ["date", "1970-01-01"], + ["time", "17:43:21"], + ["time", "00:00:00"], + ["datetime", "2015-08-30T17:43:21"], + ["datetime", "1970-01-01T00:00:00"] +] + +---------------------------------------------------- + +Checks for dates, times and datetimes. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rip/keyword_feature.test b/package/src/prism/tests/languages/rip/keyword_feature.test new file mode 100644 index 00000000..a95a44a5 --- /dev/null +++ b/package/src/prism/tests/languages/rip/keyword_feature.test @@ -0,0 +1,21 @@ +=> -> +class if else +switch case +return exit +try catch +finally raise + +---------------------------------------------------- + +[ + ["keyword", "=>"], ["keyword", "->"], + ["keyword", "class"], ["keyword", "if"], ["keyword", "else"], + ["keyword", "switch"], ["keyword", "case"], + ["keyword", "return"], ["keyword", "exit"], + ["keyword", "try"], ["keyword", "catch"], + ["keyword", "finally"], ["keyword", "raise"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rip/number_feature.test b/package/src/prism/tests/languages/rip/number_feature.test new file mode 100644 index 00000000..a5a00143 --- /dev/null +++ b/package/src/prism/tests/languages/rip/number_feature.test @@ -0,0 +1,21 @@ +42 +3.14159 ++18 ++0.14 +-242 +-85.21 + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "+18"], + ["number", "+0.14"], + ["number", "-242"], + ["number", "-85.21"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rip/punctuation_feature.test b/package/src/prism/tests/languages/rip/punctuation_feature.test new file mode 100644 index 00000000..2ef1910a --- /dev/null +++ b/package/src/prism/tests/languages/rip/punctuation_feature.test @@ -0,0 +1,28 @@ +.. ... + +` , . : ; = / \ +( ) < > [ ] { } + +---------------------------------------------------- + +[ + ["punctuation", ".."], ["punctuation", "..."], + + ["punctuation", "`"], + ["punctuation", ","], + ["punctuation", "."], + ["punctuation", ":"], + ["punctuation", ";"], + ["punctuation", "="], + ["punctuation", "/"], + ["punctuation", "\\"], + + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "<"], + ["punctuation", ">"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/rip/reference_feature.test b/package/src/prism/tests/languages/rip/reference_feature.test new file mode 100644 index 00000000..bfa74584 --- /dev/null +++ b/package/src/prism/tests/languages/rip/reference_feature.test @@ -0,0 +1,13 @@ +foo +foo_bar + +---------------------------------------------------- + +[ + ["reference", "foo"], + ["reference", "foo_bar"] +] + +---------------------------------------------------- + +Checks for reference. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rip/regex_feature.test b/package/src/prism/tests/languages/rip/regex_feature.test new file mode 100644 index 00000000..72132f58 --- /dev/null +++ b/package/src/prism/tests/languages/rip/regex_feature.test @@ -0,0 +1,17 @@ +/foobar/ +/fo[o](?=bar)/ +/\/\\\[\]/ +/(fo|o?)+b*ar?/ + +---------------------------------------------------- + +[ + ["regex", "/foobar/"], + ["regex", "/fo[o](?=bar)/"], + ["regex", "/\\/\\\\\\[\\]/"], + ["regex", "/(fo|o?)+b*ar?/"] +] + +---------------------------------------------------- + +Checks for regexes. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rip/string_feature.test b/package/src/prism/tests/languages/rip/string_feature.test new file mode 100644 index 00000000..3d6595fe --- /dev/null +++ b/package/src/prism/tests/languages/rip/string_feature.test @@ -0,0 +1,17 @@ +"" +"fo\"obar" +'' +'fo\'obar' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""], + ["string", "''"], + ["string", "'fo\\'obar'"] +] + +---------------------------------------------------- + +Checks for single-quoted and double-quoted strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rip/symbol_feature.test b/package/src/prism/tests/languages/rip/symbol_feature.test new file mode 100644 index 00000000..237b6f58 --- /dev/null +++ b/package/src/prism/tests/languages/rip/symbol_feature.test @@ -0,0 +1,15 @@ +:foo +:foobar42 +:foo_bar + +---------------------------------------------------- + +[ + ["symbol", ":foo"], + ["symbol", ":foobar42"], + ["symbol", ":foo_bar"] +] + +---------------------------------------------------- + +Checks for symbols. \ No newline at end of file diff --git a/package/src/prism/tests/languages/roboconf/comment_feature.test b/package/src/prism/tests/languages/roboconf/comment_feature.test new file mode 100644 index 00000000..37dc9f91 --- /dev/null +++ b/package/src/prism/tests/languages/roboconf/comment_feature.test @@ -0,0 +1,13 @@ +# +# Foobar + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# Foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/roboconf/component_feature.test b/package/src/prism/tests/languages/roboconf/component_feature.test new file mode 100644 index 00000000..aeceff4a --- /dev/null +++ b/package/src/prism/tests/languages/roboconf/component_feature.test @@ -0,0 +1,13 @@ +ApacheServer {} +lb--apache-mod-jk--puppet {} + +---------------------------------------------------- + +[ + ["component", "ApacheServer"], ["punctuation", "{"], ["punctuation", "}"], + ["component", "lb--apache-mod-jk--puppet"], ["punctuation", "{"], ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for component names. \ No newline at end of file diff --git a/package/src/prism/tests/languages/roboconf/keyword_feature.test b/package/src/prism/tests/languages/roboconf/keyword_feature.test new file mode 100644 index 00000000..dbeda750 --- /dev/null +++ b/package/src/prism/tests/languages/roboconf/keyword_feature.test @@ -0,0 +1,19 @@ +facet Foo {} +instance of Bar {} +external +import + +---------------------------------------------------- + +[ + ["keyword", "facet"], + ["component", "Foo"], ["punctuation", "{"], ["punctuation", "}"], + ["keyword", "instance of"], + ["component", "Bar"], ["punctuation", "{"], ["punctuation", "}"], + ["keyword", "external"], + ["keyword", "import"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/roboconf/optional_feature.test b/package/src/prism/tests/languages/roboconf/optional_feature.test new file mode 100644 index 00000000..23d6f0bd --- /dev/null +++ b/package/src/prism/tests/languages/roboconf/optional_feature.test @@ -0,0 +1,11 @@ +(optional) + +---------------------------------------------------- + +[ + ["optional", "(optional)"] +] + +---------------------------------------------------- + +Checks for optional flag. \ No newline at end of file diff --git a/package/src/prism/tests/languages/roboconf/property_feature.test b/package/src/prism/tests/languages/roboconf/property_feature.test new file mode 100644 index 00000000..2296bcf1 --- /dev/null +++ b/package/src/prism/tests/languages/roboconf/property_feature.test @@ -0,0 +1,17 @@ +extends : +imports: +installer: +data.ec2.elastic.ip: + +---------------------------------------------------- + +[ + ["property", "extends"], ["punctuation", ":"], + ["property", "imports"], ["punctuation", ":"], + ["property", "installer"], ["punctuation", ":"], + ["property", "data.ec2.elastic.ip"], ["punctuation", ":"] +] + +---------------------------------------------------- + +Checks for properties. \ No newline at end of file diff --git a/package/src/prism/tests/languages/roboconf/value_feature.test b/package/src/prism/tests/languages/roboconf/value_feature.test new file mode 100644 index 00000000..40074990 --- /dev/null +++ b/package/src/prism/tests/languages/roboconf/value_feature.test @@ -0,0 +1,20 @@ +port = 8080; +MySQL.port = 3307, My-Client-Database.port = 3308; +my-own-variable = something; + +---------------------------------------------------- + +[ + "port ", ["punctuation", "="], + ["value", "8080"], ["punctuation", ";"], + "\nMySQL", ["punctuation", "."], "port ", ["punctuation", "="], + ["value", "3307"], ["punctuation", ","], + " My-Client-Database", ["punctuation", "."], "port ", ["punctuation", "="], + ["value", "3308"], ["punctuation", ";"], + "\nmy-own-variable ", ["punctuation", "="], + ["value", "something"], ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for default values. \ No newline at end of file diff --git a/package/src/prism/tests/languages/roboconf/wildcard_feature.test b/package/src/prism/tests/languages/roboconf/wildcard_feature.test new file mode 100644 index 00000000..ecd8affe --- /dev/null +++ b/package/src/prism/tests/languages/roboconf/wildcard_feature.test @@ -0,0 +1,12 @@ +load-balance-able.* + +---------------------------------------------------- + +[ + "load-balance-able", ["punctuation", "."], + ["wildcard", "*"] +] + +---------------------------------------------------- + +Checks for wildcards. \ No newline at end of file diff --git a/package/src/prism/tests/languages/robotframework/comment_feature.test b/package/src/prism/tests/languages/robotframework/comment_feature.test new file mode 100644 index 00000000..b8eb1b27 --- /dev/null +++ b/package/src/prism/tests/languages/robotframework/comment_feature.test @@ -0,0 +1,45 @@ +# comment + +*** Keywords *** # comment +Run Program # comment + [Arguments] @{args} # comment + Run Process program.py @{args} # comment + +---------------------------------------------------- + +[ + ["comment", "# comment"], + ["keywords", [ + ["section-header", "*** Keywords ***"], + ["comment", "# comment"], + ["keyword-name", [ + "Run Program" + ]], + ["comment", "# comment"], + ["tag", [ + ["punctuation", "["], + "Arguments", + ["punctuation", "]"] + ]], + ["variable", [ + ["punctuation", "@{"], + "args", + ["punctuation", "}"] + ]], + ["comment", "# comment"], + ["property", [ + "Run Process" + ]], + " program.py ", + ["variable", [ + ["punctuation", "@{"], + "args", + ["punctuation", "}"] + ]], + ["comment", "# comment"] + ]] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/robotframework/documentation_feature.test b/package/src/prism/tests/languages/robotframework/documentation_feature.test new file mode 100644 index 00000000..ba4f7027 --- /dev/null +++ b/package/src/prism/tests/languages/robotframework/documentation_feature.test @@ -0,0 +1,56 @@ +*** Settings *** +Documentation Example using the space separated plain text format. +Documentation This is documentation for this test suite. +... This kind of documentation can often be get quite long... + +*** Keywords *** +One line documentation + [Documentation] One line documentation. + +Multiline documentation + [Documentation] The first line creates the short doc. + ... + ... This is the body of the documentation. + ... It is not shown in Libdoc outputs but only + ... the short doc is shown in logs. + No Operation + +---------------------------------------------------- + +[ + ["settings", [ + ["section-header", "*** Settings ***"], + ["property", "Documentation"], + ["documentation", "Example using the space separated plain text format."], + ["property", "Documentation"], + ["documentation", "This is documentation for this test suite.\n... This kind of documentation can often be get quite long..."] + ]], + ["keywords", [ + ["section-header", "*** Keywords ***"], + ["keyword-name", [ + "One line documentation" + ]], + ["tag", [ + ["punctuation", "["], + "Documentation", + ["punctuation", "]"] + ]], + ["documentation", "One line documentation."], + ["keyword-name", [ + "Multiline documentation" + ]], + ["tag", [ + ["punctuation", "["], + "Documentation", + ["punctuation", "]"] + ]], + ["documentation", "The first line creates the short doc.\n\t...\n\t... This is the body of the documentation.\n\t... It is not shown in Libdoc outputs but only\n\t... the short doc is shown in logs."], + ["property", [ + "No Operation" + ]] + ]] +] + +---------------------------------------------------- + +Checks for documentation. diff --git a/package/src/prism/tests/languages/robotframework/name_and_property_feature.test b/package/src/prism/tests/languages/robotframework/name_and_property_feature.test new file mode 100644 index 00000000..9c6507a2 --- /dev/null +++ b/package/src/prism/tests/languages/robotframework/name_and_property_feature.test @@ -0,0 +1,116 @@ +*** Test Cases *** +Another Test + Should Be Equal ${MESSAGE} Hello, world! + +*** Keywords *** +My Keyword + Directory Should Exist ${path} + +I have ${program} open + Start Program ${program} + +Result should be ${expected} + ${result} = Get Result + Should Be Equal ${result} ${expected} + +*** Tasks *** +Process invoice + Read information from PDF + Validate information + +---------------------------------------------------- + +[ + ["test-cases", [ + ["section-header", "*** Test Cases ***"], + ["test-name", [ + "Another Test" + ]], + ["property", [ + "Should Be Equal" + ]], + ["variable", [ + ["punctuation", "${"], + "MESSAGE", + ["punctuation", "}"] + ]], + " Hello, world!\n" + ]], + ["keywords", [ + ["section-header", "*** Keywords ***"], + ["keyword-name", [ + "My Keyword" + ]], + ["property", [ + "Directory Should Exist" + ]], + ["variable", [ + ["punctuation", "${"], + "path", + ["punctuation", "}"] + ]], + ["keyword-name", [ + "I have ", + ["variable", [ + ["punctuation", "${"], + "program", + ["punctuation", "}"] + ]], + " open" + ]], + ["property", [ + "Start Program" + ]], + ["variable", [ + ["punctuation", "${"], + "program", + ["punctuation", "}"] + ]], + ["keyword-name", [ + "Result should be ", + ["variable", [ + ["punctuation", "${"], + "expected", + ["punctuation", "}"] + ]] + ]], + ["property", [ + ["variable", [ + ["punctuation", "${"], + "result", + ["punctuation", "}"] + ]], + " =" + ]], + " Get Result\n\t", + ["property", [ + "Should Be Equal" + ]], + ["variable", [ + ["punctuation", "${"], + "result", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "${"], + "expected", + ["punctuation", "}"] + ]] + ]], + ["tasks", [ + ["section-header", "*** Tasks ***"], + ["task-name", [ + "Process invoice" + ]], + ["property", [ + "Read information from PDF" + ]], + ["property", [ + "Validate information" + ]] + ]] +] + +---------------------------------------------------- + +Checks for names and properties. diff --git a/package/src/prism/tests/languages/robotframework/sections_feature.test b/package/src/prism/tests/languages/robotframework/sections_feature.test new file mode 100644 index 00000000..a5dec0ec --- /dev/null +++ b/package/src/prism/tests/languages/robotframework/sections_feature.test @@ -0,0 +1,43 @@ +*** Settings *** +# foo + +*** Variables *** +# foo + +*** Test Cases *** +# foo + +*** Keywords *** +# foo + +*** Tasks *** +# foo + +---------------------------------------------------- + +[ + ["settings", [ + ["section-header", "*** Settings ***"], + ["comment", "# foo"] + ]], + ["variables", [ + ["section-header", "*** Variables ***"], + ["comment", "# foo"] + ]], + ["test-cases", [ + ["section-header", "*** Test Cases ***"], + ["comment", "# foo"] + ]], + ["keywords", [ + ["section-header", "*** Keywords ***"], + ["comment", "# foo"] + ]], + ["tasks", [ + ["section-header", "*** Tasks ***"], + ["comment", "# foo"] + ]] +] + +---------------------------------------------------- + +Checks for all known section types. diff --git a/package/src/prism/tests/languages/robotframework/settings_property_feature.test b/package/src/prism/tests/languages/robotframework/settings_property_feature.test new file mode 100644 index 00000000..d5455845 --- /dev/null +++ b/package/src/prism/tests/languages/robotframework/settings_property_feature.test @@ -0,0 +1,19 @@ +*** Settings *** +Documentation Example using the space separated plain text format. +Library OperatingSystem + +---------------------------------------------------- + +[ + ["settings", [ + ["section-header", "*** Settings ***"], + ["property", "Documentation"], + ["documentation", "Example using the space separated plain text format."], + ["property", "Library"], + " OperatingSystem" + ]] +] + +---------------------------------------------------- + +Checks for setting properties. diff --git a/package/src/prism/tests/languages/robotframework/tag_feature.test b/package/src/prism/tests/languages/robotframework/tag_feature.test new file mode 100644 index 00000000..787edc57 --- /dev/null +++ b/package/src/prism/tests/languages/robotframework/tag_feature.test @@ -0,0 +1,91 @@ +*** Keywords *** +Wrapper With Customizable Timeout + [Arguments] ${timeout} @{args} + [Documentation] Same as the above but timeout given as an argument. + [Timeout] NONE + +With Teardown + Do Something + [Teardown] Log keyword teardown + +Return Three Values + [Return] foo bar zap + +Settings tags using separate setting + [Tags] my fine tags + No Operation + +---------------------------------------------------- + +[ + ["keywords", [ + ["section-header", "*** Keywords ***"], + ["keyword-name", [ + "Wrapper With Customizable Timeout" + ]], + ["tag", [ + ["punctuation", "["], + "Arguments", + ["punctuation", "]"] + ]], + ["variable", [ + ["punctuation", "${"], + "timeout", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "@{"], + "args", + ["punctuation", "}"] + ]], + ["tag", [ + ["punctuation", "["], + "Documentation", + ["punctuation", "]"] + ]], + ["documentation", "Same as the above but timeout given as an argument."], + ["tag", [ + ["punctuation", "["], + "Timeout", + ["punctuation", "]"] + ]], + " NONE\n\n", + ["keyword-name", [ + "With Teardown" + ]], + ["property", [ + "Do Something" + ]], + ["tag", [ + ["punctuation", "["], + "Teardown", + ["punctuation", "]"] + ]], + " Log keyword teardown\n\n", + ["keyword-name", [ + "Return Three Values" + ]], + ["tag", [ + ["punctuation", "["], + "Return", + ["punctuation", "]"] + ]], + " foo bar zap\n\n", + ["keyword-name", [ + "Settings tags using separate setting" + ]], + ["tag", [ + ["punctuation", "["], + "Tags", + ["punctuation", "]"] + ]], + " my fine tags\n\t", + ["property", [ + "No Operation" + ]] + ]] +] + +---------------------------------------------------- + +Checks for tags. diff --git a/package/src/prism/tests/languages/robotframework/variable_feature.test b/package/src/prism/tests/languages/robotframework/variable_feature.test new file mode 100644 index 00000000..71389cce --- /dev/null +++ b/package/src/prism/tests/languages/robotframework/variable_feature.test @@ -0,0 +1,358 @@ +*** Test Cases *** +Variables + Log ${GREET}, ${NAME}!! + Login &{USER} + +Environment variables for ${name} + Log Current user: %{USER} + Run %{JAVA_HOME}${/}javac + +Assign multiple + ${a} ${b} ${c} = Get Three + ${first} @{rest} = Get Three + @{before} ${last} = Get Three + ${begin} @{middle} ${end} = Get Three + +*** Keywords *** +With Positional + [Arguments] ${positional} @{} ${named} + Log Many ${positional} ${named} + +With Free Named + [Arguments] @{varargs} ${named only} &{free named} + Log Many @{varargs} ${named only} &{free named} + +*** Settings *** +Suite Setup Some Keyword @{KW ARGS} +Suite Setup ${KEYWORD} @{KW ARGS} + +*** Variables *** +${ANOTHER VARIABLE} This is pretty easy! +${INTEGER} ${42} +@{STRINGS} one two kolme four +@{NUMBERS} ${1} ${INTEGER} ${3.14} +&{MAPPING} one=${1} two=${2} three=${3} +@{ANIMALS} cat dog +&{FINNISH} cat=kissa dog=koira +${MULTILINE} SEPARATOR=\n First line +... Second line Third line + +---------------------------------------------------- + +[ + ["test-cases", [ + ["section-header", "*** Test Cases ***"], + ["test-name", [ + "Variables" + ]], + ["property", [ + "Log" + ]], + ["variable", [ + ["punctuation", "${"], + "GREET", + ["punctuation", "}"] + ]], + ", ", + ["variable", [ + ["punctuation", "${"], + "NAME", + ["punctuation", "}"] + ]], + "!!\n\t", + ["property", [ + "Login" + ]], + ["variable", [ + ["punctuation", "&{"], + "USER", + ["punctuation", "}"] + ]], + ["test-name", [ + "Environment variables for ", + ["variable", [ + ["punctuation", "${"], + "name", + ["punctuation", "}"] + ]] + ]], + ["property", [ + "Log" + ]], + " Current user: ", + ["variable", [ + ["punctuation", "%{"], + "USER", + ["punctuation", "}"] + ]], + ["property", [ + "Run" + ]], + ["variable", [ + ["punctuation", "%{"], + "JAVA_HOME", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "${"], + "/", + ["punctuation", "}"] + ]], + "javac\n\n", + ["test-name", [ + "Assign multiple" + ]], + ["property", [ + ["variable", [ + ["punctuation", "${"], + "a", + ["punctuation", "}"] + ]] + ]], + ["variable", [ + ["punctuation", "${"], + "b", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "${"], + "c", + ["punctuation", "}"] + ]], + " = Get Three\n\t", + ["property", [ + ["variable", [ + ["punctuation", "${"], + "first", + ["punctuation", "}"] + ]] + ]], + ["variable", [ + ["punctuation", "@{"], + "rest", + ["punctuation", "}"] + ]], + " = Get Three\n\t", + ["property", [ + ["variable", [ + ["punctuation", "@{"], + "before", + ["punctuation", "}"] + ]] + ]], + ["variable", [ + ["punctuation", "${"], + "last", + ["punctuation", "}"] + ]], + " = Get Three\n\t", + ["property", [ + ["variable", [ + ["punctuation", "${"], + "begin", + ["punctuation", "}"] + ]] + ]], + ["variable", [ + ["punctuation", "@{"], + "middle", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "${"], + "end", + ["punctuation", "}"] + ]], + " = Get Three\n" + ]], + ["keywords", [ + ["section-header", "*** Keywords ***"], + ["keyword-name", [ + "With Positional" + ]], + ["tag", [ + ["punctuation", "["], + "Arguments", + ["punctuation", "]"] + ]], + ["variable", [ + ["punctuation", "${"], + "positional", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "@{"], + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "${"], + "named", + ["punctuation", "}"] + ]], + ["property", [ + "Log Many" + ]], + ["variable", [ + ["punctuation", "${"], + "positional", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "${"], + "named", + ["punctuation", "}"] + ]], + ["keyword-name", [ + "With Free Named" + ]], + ["tag", [ + ["punctuation", "["], + "Arguments", + ["punctuation", "]"] + ]], + ["variable", [ + ["punctuation", "@{"], + "varargs", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "${"], + "named only", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "&{"], + "free named", + ["punctuation", "}"] + ]], + ["property", [ + "Log Many" + ]], + ["variable", [ + ["punctuation", "@{"], + "varargs", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "${"], + "named only", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "&{"], + "free named", + ["punctuation", "}"] + ]] + ]], + ["settings", [ + ["section-header", "*** Settings ***"], + ["property", "Suite Setup"], + " Some Keyword ", + ["variable", [ + ["punctuation", "@{"], + "KW ARGS", + ["punctuation", "}"] + ]], + ["property", "Suite Setup"], + ["variable", [ + ["punctuation", "${"], + "KEYWORD", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "@{"], + "KW ARGS", + ["punctuation", "}"] + ]] + ]], + ["variables", [ + ["section-header", "*** Variables ***"], + ["variable", [ + ["punctuation", "${"], + "ANOTHER VARIABLE", + ["punctuation", "}"] + ]], + " This is pretty easy!\n", + ["variable", [ + ["punctuation", "${"], + "INTEGER", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "${"], + "42", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "@{"], + "STRINGS", + ["punctuation", "}"] + ]], + " one two kolme four\n", + ["variable", [ + ["punctuation", "@{"], + "NUMBERS", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "${"], + "1", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "${"], + "INTEGER", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "${"], + "3.14", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "&{"], + "MAPPING", + ["punctuation", "}"] + ]], + " one=", + ["variable", [ + ["punctuation", "${"], + "1", + ["punctuation", "}"] + ]], + " two=", + ["variable", [ + ["punctuation", "${"], + "2", + ["punctuation", "}"] + ]], + " three=", + ["variable", [ + ["punctuation", "${"], + "3", + ["punctuation", "}"] + ]], + ["variable", [ + ["punctuation", "@{"], + "ANIMALS", + ["punctuation", "}"] + ]], + " cat dog\n", + ["variable", [ + ["punctuation", "&{"], + "FINNISH", + ["punctuation", "}"] + ]], + " cat=kissa dog=koira\n", + ["variable", [ + ["punctuation", "${"], + "MULTILINE", + ["punctuation", "}"] + ]], + " SEPARATOR=\\n First line\n... Second line Third line" + ]] +] + +---------------------------------------------------- + +Checks for variables in different positions. diff --git a/package/src/prism/tests/languages/ruby+haml/ruby_inclusion.test b/package/src/prism/tests/languages/ruby+haml/ruby_inclusion.test new file mode 100644 index 00000000..a82e3d8d --- /dev/null +++ b/package/src/prism/tests/languages/ruby+haml/ruby_inclusion.test @@ -0,0 +1,56 @@ +:ruby + def circumference + Math::PI * radius ** 2 + end + +~ + :ruby + def circumference + Math::PI * radius ** 2 + end + +---------------------------------------------------- + +[ + ["filter-ruby", [ + ["filter-name", ":ruby"], + ["text", [ + ["keyword", "def"], + ["method-definition", [ + ["function", "circumference"] + ]], + + "\n\t\tMath", + ["double-colon", "::"], + ["constant", "PI"], + ["operator", "*"], + " radius ", + ["operator", "**"], + ["number", "2"], + + ["keyword", "end"] + ]] + ]], + + ["punctuation", "~"], + + ["filter-ruby", [ + ["filter-name", ":ruby"], + ["text", [ + ["keyword", "def"], + ["method-definition", [ + ["function", "circumference"] + ]], + + "\n\t\t\tMath", + ["double-colon", "::"], + ["constant", "PI"], + ["operator", "*"], + " radius ", + ["operator", "**"], + ["number", "2"], + + ["keyword", "end"] + ]] + ]] +] diff --git a/package/src/prism/tests/languages/ruby/boolean_feature.test b/package/src/prism/tests/languages/ruby/boolean_feature.test new file mode 100644 index 00000000..ca34f181 --- /dev/null +++ b/package/src/prism/tests/languages/ruby/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/ruby/builtin_feature.test b/package/src/prism/tests/languages/ruby/builtin_feature.test new file mode 100644 index 00000000..1a9fbe01 --- /dev/null +++ b/package/src/prism/tests/languages/ruby/builtin_feature.test @@ -0,0 +1,29 @@ +Array Bignum Binding +Class; +Continuation Dir Exception +FalseClass File Stat File +Fixnum Float Hash Integer +IO MatchData Method Module +NilClass Numeric Object +Proc Range Regexp String +Struct TMS Symbol ThreadGroup +Thread Time TrueClass + +---------------------------------------------------- + +[ + ["builtin", "Array"], ["builtin", "Bignum"], ["builtin", "Binding"], + ["builtin", "Class"], ["punctuation", ";"], + ["builtin", "Continuation"], ["builtin", "Dir"], ["builtin", "Exception"], + ["builtin", "FalseClass"], ["builtin", "File"], ["builtin", "Stat"], ["builtin", "File"], + ["builtin", "Fixnum"], ["builtin", "Float"], ["builtin", "Hash"], ["builtin", "Integer"], + ["builtin", "IO"], ["builtin", "MatchData"], ["builtin", "Method"], ["builtin", "Module"], + ["builtin", "NilClass"], ["builtin", "Numeric"], ["builtin", "Object"], + ["builtin", "Proc"], ["builtin", "Range"], ["builtin", "Regexp"], ["builtin", "String"], + ["builtin", "Struct"], ["builtin", "TMS"], ["builtin", "Symbol"], ["builtin", "ThreadGroup"], + ["builtin", "Thread"], ["builtin", "Time"], ["builtin", "TrueClass"] +] + +---------------------------------------------------- + +Checks for all builtins. \ No newline at end of file diff --git a/package/src/prism/tests/languages/ruby/class-name_feature.test b/package/src/prism/tests/languages/ruby/class-name_feature.test new file mode 100644 index 00000000..5893cbc2 --- /dev/null +++ b/package/src/prism/tests/languages/ruby/class-name_feature.test @@ -0,0 +1,73 @@ +class Customer + @@no_of_customers = 0 +end + +cust1 = Customer. new +cust2 = Customer. new + +class Accounts + def reading_charge + end + def Accounts.return_date + end +end + +class Salad + def self.buy_olive_oil + end +end + +---------------------------------------------------- + +[ + ["keyword", "class"], ["class-name", ["Customer"]], + ["variable", "@@no_of_customers"], ["operator", "="], ["number", "0"], + ["keyword", "end"], + + "\n\ncust1 ", + ["operator", "="], + ["class-name", ["Customer"]], + ["punctuation", "."], + ["keyword", "new"], + + "\ncust2 ", + ["operator", "="], + ["class-name", ["Customer"]], + ["punctuation", "."], + ["keyword", "new"], + + ["keyword", "class"], + ["class-name", ["Accounts"]], + + ["keyword", "def"], + ["method-definition", [ + ["function", "reading_charge"] + ]], + + ["keyword", "end"], + + ["keyword", "def"], + ["method-definition", [ + ["class-name", "Accounts"], + ["punctuation", "."], + ["function", "return_date"] + ]], + + ["keyword", "end"], + + ["keyword", "end"], + + ["keyword", "class"], + ["class-name", ["Salad"]], + + ["keyword", "def"], + ["method-definition", [ + ["keyword", "self"], + ["punctuation", "."], + ["function", "buy_olive_oil"] + ]], + + ["keyword", "end"], + + ["keyword", "end"] +] diff --git a/package/src/prism/tests/languages/ruby/command_feature.test b/package/src/prism/tests/languages/ruby/command_feature.test new file mode 100644 index 00000000..b65f8e87 --- /dev/null +++ b/package/src/prism/tests/languages/ruby/command_feature.test @@ -0,0 +1,105 @@ +`echo foo` +`echo #{user_input}` +`grep hosts /private/etc/* 2>&1` + +%x[ ls ] +%x{ ls } +%x + +%x!foo #{ 42 }! +%x(foo #{ 42 }) +%x{foo #{ 42 }} +%x[foo #{ 42 }] +%x + +---------------------------------------------------- + +[ + ["command-literal", [ + ["command", "`echo foo`"] + ]], + ["command-literal", [ + ["command", "`echo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", ["user_input"]], + ["delimiter", "}"] + ]], + ["command", "`"] + ]], + ["command-literal", [ + ["command", "`grep hosts /private/etc/* 2>&1`"] + ]], + + ["command-literal", [ + ["command", "%x[ ls ]"] + ]], + ["command-literal", [ + ["command", "%x{ ls }"] + ]], + ["command-literal", [ + ["command", "%x"] + ]], + + ["command-literal", [ + ["command", "%x!foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["command", "!"] + ]], + ["command-literal", [ + ["command", "%x(foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["command", ")"] + ]], + ["command-literal", [ + ["command", "%x{foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["command", "}"] + ]], + ["command-literal", [ + ["command", "%x[foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["command", "]"] + ]], + ["command-literal", [ + ["command", "%x"] + ]] +] diff --git a/package/src/prism/tests/languages/ruby/comment_feature.test b/package/src/prism/tests/languages/ruby/comment_feature.test new file mode 100644 index 00000000..8e826782 --- /dev/null +++ b/package/src/prism/tests/languages/ruby/comment_feature.test @@ -0,0 +1,25 @@ +# +# foobar +=begin +foo bar baz +=end +=begin +=end +=begin foo +=end +#{comment} + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# foobar"], + ["comment", "=begin\nfoo bar baz\n=end"], + ["comment", "=begin\n=end"], + ["comment", "=begin foo\n=end"], + ["comment", "#{comment}"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/ruby/constant_feature.test b/package/src/prism/tests/languages/ruby/constant_feature.test new file mode 100644 index 00000000..6d071e62 --- /dev/null +++ b/package/src/prism/tests/languages/ruby/constant_feature.test @@ -0,0 +1,19 @@ +FOO_BAR_42 +F +FOO +BAR? +BAZ! + +---------------------------------------------------- + +[ + ["constant", "FOO_BAR_42"], + ["constant", "F"], + ["constant", "FOO"], + ["constant", "BAR?"], + ["constant", "BAZ!"] +] + +---------------------------------------------------- + +Checks for constants. diff --git a/package/src/prism/tests/languages/ruby/issue1336.test b/package/src/prism/tests/languages/ruby/issue1336.test new file mode 100644 index 00000000..4b624444 --- /dev/null +++ b/package/src/prism/tests/languages/ruby/issue1336.test @@ -0,0 +1,13 @@ +:Foo +Foo::Bar + +---------------------------------------------------- + +[ + ["symbol", ":Foo"], + "\nFoo", ["double-colon", "::"], "Bar" +] + +---------------------------------------------------- + +Ensures module syntax is not confused with symbols. See #1336 diff --git a/package/src/prism/tests/languages/ruby/keyword_feature.test b/package/src/prism/tests/languages/ruby/keyword_feature.test new file mode 100644 index 00000000..b7e6061f --- /dev/null +++ b/package/src/prism/tests/languages/ruby/keyword_feature.test @@ -0,0 +1,105 @@ +alias +and +BEGIN +begin +break +case +class; +def; +define_method +defined +do +each +else +elsif +END +end +ensure +extend +for +if +in +include +module; +new; +next +nil +not +or +prepend +protected +private +public +raise +redo +require +rescue +retry +return +self +super +then +throw +undef +unless +until +when +while +yield + +---------------------------------------------------- + +[ + ["keyword", "alias"], + ["keyword", "and"], + ["keyword", "BEGIN"], + ["keyword", "begin"], + ["keyword", "break"], + ["keyword", "case"], + ["keyword", "class"], ["punctuation", ";"], + ["keyword", "def"], ["punctuation", ";"], + ["keyword", "define_method"], + ["keyword", "defined"], + ["keyword", "do"], + ["keyword", "each"], + ["keyword", "else"], + ["keyword", "elsif"], + ["keyword", "END"], + ["keyword", "end"], + ["keyword", "ensure"], + ["keyword", "extend"], + ["keyword", "for"], + ["keyword", "if"], + ["keyword", "in"], + ["keyword", "include"], + ["keyword", "module"], ["punctuation", ";"], + ["keyword", "new"], ["punctuation", ";"], + ["keyword", "next"], + ["keyword", "nil"], + ["keyword", "not"], + ["keyword", "or"], + ["keyword", "prepend"], + ["keyword", "protected"], + ["keyword", "private"], + ["keyword", "public"], + ["keyword", "raise"], + ["keyword", "redo"], + ["keyword", "require"], + ["keyword", "rescue"], + ["keyword", "retry"], + ["keyword", "return"], + ["keyword", "self"], + ["keyword", "super"], + ["keyword", "then"], + ["keyword", "throw"], + ["keyword", "undef"], + ["keyword", "unless"], + ["keyword", "until"], + ["keyword", "when"], + ["keyword", "while"], + ["keyword", "yield"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/ruby/method_definition_feature.test b/package/src/prism/tests/languages/ruby/method_definition_feature.test new file mode 100644 index 00000000..00a4b5f4 --- /dev/null +++ b/package/src/prism/tests/languages/ruby/method_definition_feature.test @@ -0,0 +1,94 @@ +class Circle + def self.of_diameter(diameter) + new diameter / 2 + end + + def initialize(radius) + @radius = radius + end + + def circumference + Math::PI * radius ** 2 + end + + # Seattle style + def grow_by factor: + @radius = @radius * factor + end +end + +---------------------------------------------------- + +[ + ["keyword", "class"], + ["class-name", ["Circle"]], + + ["keyword", "def"], + ["method-definition", [ + ["keyword", "self"], + ["punctuation", "."], + ["function", "of_diameter"] + ]], + ["punctuation", "("], + "diameter", + ["punctuation", ")"], + + ["keyword", "new"], + " diameter ", + ["operator", "/"], + ["number", "2"], + + ["keyword", "end"], + + ["keyword", "def"], + ["method-definition", [ + ["function", "initialize"] + ]], + ["punctuation", "("], + "radius", + ["punctuation", ")"], + + ["variable", "@radius"], + ["operator", "="], + " radius\n ", + + ["keyword", "end"], + + ["keyword", "def"], + ["method-definition", [ + ["function", "circumference"] + ]], + + "\n Math", + ["double-colon", "::"], + ["constant", "PI"], + ["operator", "*"], + " radius ", + ["operator", "**"], + ["number", "2"], + + ["keyword", "end"], + + ["comment", "# Seattle style"], + + ["keyword", "def"], + ["method-definition", [ + ["function", "grow_by"] + ]], + " factor", + ["operator", ":"], + + ["variable", "@radius"], + ["operator", "="], + ["variable", "@radius"], + ["operator", "*"], + " factor\n ", + + ["keyword", "end"], + + ["keyword", "end"] +] + +---------------------------------------------------- + +Checks that method definitions are highlighted correctly diff --git a/package/src/prism/tests/languages/ruby/operator_feature.test b/package/src/prism/tests/languages/ruby/operator_feature.test new file mode 100644 index 00000000..c2172901 --- /dev/null +++ b/package/src/prism/tests/languages/ruby/operator_feature.test @@ -0,0 +1,80 @@ ++ - * / % ** ++= -= *= /= %= **= + +== != < > <= >= <=> === +!~ =~ += +& | ^ ~ << >> +&= |= ^= <<= >>= +&& || ! +&&= ||= + +=> + +&. + +? : +.. ... + +and or not + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + ["operator", "**"], + + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + ["operator", "%="], + ["operator", "**="], + + ["operator", "=="], + ["operator", "!="], + ["operator", "<"], + ["operator", ">"], + ["operator", "<="], + ["operator", ">="], + ["operator", "<=>"], + ["operator", "==="], + + ["operator", "!~"], + ["operator", "=~"], + + ["operator", "="], + + ["operator", "&"], + ["operator", "|"], + ["operator", "^"], + ["operator", "~"], + ["operator", "<<"], + ["operator", ">>"], + + ["operator", "&="], + ["operator", "|="], + ["operator", "^="], + ["operator", "<<="], + ["operator", ">>="], + + ["operator", "&&"], + ["operator", "||"], + ["operator", "!"], + + ["operator", "&&="], + ["operator", "||="], + + ["operator", "=>"], + + ["operator", "&."], + + ["operator", "?"], ["operator", ":"], + ["operator", ".."], ["operator", "..."], + + ["keyword", "and"], ["keyword", "or"], ["keyword", "not"] +] diff --git a/package/src/prism/tests/languages/ruby/punctuation_feature.test b/package/src/prism/tests/languages/ruby/punctuation_feature.test new file mode 100644 index 00000000..fc24af16 --- /dev/null +++ b/package/src/prism/tests/languages/ruby/punctuation_feature.test @@ -0,0 +1,20 @@ +( ) { } [ ] +. , ; +:: + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + + ["punctuation", "."], + ["punctuation", ","], + ["punctuation", ";"], + + ["double-colon", "::"] +] diff --git a/package/src/prism/tests/languages/ruby/regex_feature.test b/package/src/prism/tests/languages/ruby/regex_feature.test new file mode 100644 index 00000000..b205f81f --- /dev/null +++ b/package/src/prism/tests/languages/ruby/regex_feature.test @@ -0,0 +1,176 @@ +/[foo]\/bar/gim +/[bar]/, +/./i; +/foo#{bar}/; +/ab+c/ix +%r!foo?bar#{39+3}! +%r(foo?bar#{39+3}) +%r{foo?bar#{39+3}} +%r[foo?bar#{39+3}] +%r + +/foo/ # comment +/foo#{bar}/ # comment + +# flags +/abc/e +/abc/g +/abc/i +/abc/m +/abc/n +/abc/o +/abc/s +/abc/u +/abc/x + +---------------------------------------------------- + +[ + ["regex-literal", [ + ["regex", "/[foo]\\/bar/gim"] + ]], + + ["regex-literal", [ + ["regex", "/[bar]/"] + ]], + ["punctuation", ","], + + ["regex-literal", [ + ["regex", "/./i"] + ]], + ["punctuation", ";"], + + ["regex-literal", [ + ["regex", "/foo"], + ["interpolation", [ + ["delimiter", "#{"], + ["content", ["bar"]], + ["delimiter", "}"] + ]], + ["regex", "/"] + ]], + ["punctuation", ";"], + + ["regex-literal", [ + ["regex", "/ab+c/ix"] + ]], + + ["regex-literal", [ + ["regex", "%r!foo?bar"], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "39"], + ["operator", "+"], + ["number", "3"] + ]], + ["delimiter", "}"] + ]], + ["regex", "!"] + ]], + + ["regex-literal", [ + ["regex", "%r(foo?bar"], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "39"], + ["operator", "+"], + ["number", "3"] + ]], + ["delimiter", "}"] + ]], + ["regex", ")"] + ]], + + ["regex-literal", [ + ["regex", "%r{foo?bar"], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "39"], + ["operator", "+"], + ["number", "3"] + ]], + ["delimiter", "}"] + ]], + ["regex", "}"] + ]], + + ["regex-literal", [ + ["regex", "%r[foo?bar"], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "39"], + ["operator", "+"], + ["number", "3"] + ]], + ["delimiter", "}"] + ]], + ["regex", "]"] + ]], + + ["regex-literal", [ + ["regex", "%r"] + ]], + + ["regex-literal", [ + ["regex", "/foo/"] + ]], + ["comment", "# comment"], + + ["regex-literal", [ + ["regex", "/foo"], + ["interpolation", [ + ["delimiter", "#{"], + ["content", ["bar"]], + ["delimiter", "}"] + ]], + ["regex", "/"] + ]], + ["comment", "# comment"], + + ["comment", "# flags"], + ["regex-literal", [ + ["regex", "/abc/e"] + ]], + ["regex-literal", [ + ["regex", "/abc/g"] + ]], + ["regex-literal", [ + ["regex", "/abc/i"] + ]], + ["regex-literal", [ + ["regex", "/abc/m"] + ]], + ["regex-literal", [ + ["regex", "/abc/n"] + ]], + ["regex-literal", [ + ["regex", "/abc/o"] + ]], + ["regex-literal", [ + ["regex", "/abc/s"] + ]], + ["regex-literal", [ + ["regex", "/abc/u"] + ]], + ["regex-literal", [ + ["regex", "/abc/x"] + ]] +] + +---------------------------------------------------- + +Checks for regex. diff --git a/package/src/prism/tests/languages/ruby/string_feature.test b/package/src/prism/tests/languages/ruby/string_feature.test new file mode 100644 index 00000000..dfee3aff --- /dev/null +++ b/package/src/prism/tests/languages/ruby/string_feature.test @@ -0,0 +1,406 @@ +'' +"" +'foo' +"foo" +'foo\ +bar' +"foo\ +bar" + +"foo #bar" +"foo #{ 42 } bar" +"\#{a + b}" + +%!foo #{ 42 }! +%(foo #{ 42 }) +%{foo #{ 42 }} +%[foo #{ 42 }] +% +%Q!foo #{ 42 }! +%Q(foo #{ 42 }) +%Q{foo #{ 42 }} +%Q[foo #{ 42 }] +%Q +%I!foo #{ 42 }! +%I(foo #{ 42 }) +%I{foo #{ 42 }} +%I[foo #{ 42 }] +%I +%W!foo #{ 42 }! +%W(foo #{ 42 }) +%W{foo #{ 42 }} +%W[foo #{ 42 }] +%W + +<"] + ]], + ["string-literal", [ + ["string", "%Q!foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", "!"] + ]], + ["string-literal", [ + ["string", "%Q(foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", ")"] + ]], + ["string-literal", [ + ["string", "%Q{foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", "}"] + ]], + ["string-literal", [ + ["string", "%Q[foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", "]"] + ]], + ["string-literal", [ + ["string", "%Q"] + ]], + ["string-literal", [ + ["string", "%I!foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", "!"] + ]], + ["string-literal", [ + ["string", "%I(foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", ")"] + ]], + ["string-literal", [ + ["string", "%I{foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", "}"] + ]], + ["string-literal", [ + ["string", "%I[foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", "]"] + ]], + ["string-literal", [ + ["string", "%I"] + ]], + ["string-literal", [ + ["string", "%W!foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", "!"] + ]], + ["string-literal", [ + ["string", "%W(foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", ")"] + ]], + ["string-literal", [ + ["string", "%W{foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", "}"] + ]], + ["string-literal", [ + ["string", "%W[foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", "]"] + ]], + ["string-literal", [ + ["string", "%W"] + ]], + + ["string-literal", [ + ["delimiter", [ + ["punctuation", "<<"], + ["symbol", "STRING"] + ]], + ["string", "\n foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", " bar\n"], + ["delimiter", [ + ["symbol", "STRING"] + ]] + ]], + ["string-literal", [ + ["delimiter", [ + ["punctuation", "<<-"], + ["symbol", "STRING"] + ]], + ["string", "\n foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", " bar\n "], + ["delimiter", [ + ["symbol", "STRING"] + ]] + ]], + ["string-literal", [ + ["delimiter", [ + ["punctuation", "<<~"], + ["symbol", "STRING"] + ]], + ["string", "\n foo "], + ["interpolation", [ + ["delimiter", "#{"], + ["content", [ + ["number", "42"] + ]], + ["delimiter", "}"] + ]], + ["string", " bar\n "], + ["delimiter", [ + ["symbol", "STRING"] + ]] + ]], + ["string-literal", [ + ["delimiter", [ + ["punctuation", "<<'"], + ["symbol", "STRING"], + ["punctuation", "'"] + ]], + ["string", "\n foo #{42} bar\n"], + ["delimiter", [ + ["symbol", "STRING"] + ]] + ]], + ["string-literal", [ + ["delimiter", [ + ["punctuation", "<<-'"], + ["symbol", "STRING"], + ["punctuation", "'"] + ]], + ["string", "\n foo #{42} bar\n "], + ["delimiter", [ + ["symbol", "STRING"] + ]] + ]], + ["string-literal", [ + ["delimiter", [ + ["punctuation", "<<~'"], + ["symbol", "STRING"], + ["punctuation", "'"] + ]], + ["string", "\n foo #{42} bar\n "], + ["delimiter", [ + ["symbol", "STRING"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for strings and string interpolation. diff --git a/package/src/prism/tests/languages/ruby/symbol_feature.test b/package/src/prism/tests/languages/ruby/symbol_feature.test new file mode 100644 index 00000000..69b2fd25 --- /dev/null +++ b/package/src/prism/tests/languages/ruby/symbol_feature.test @@ -0,0 +1,80 @@ +:_ +:foo +:BAR? +:Baz_42! +:あ +:"name" +:"\u{c4 d6 dc}" +:question? +:exclamation! +:$; + +:foo.object_id + +# in hashes + +{ :one => "eins", :two => "zwei", :three => "drei" } +{ one: "eins", two: "zwei", three: "drei" } + +---------------------------------------------------- + +[ + ["symbol", ":_"], + ["symbol", ":foo"], + ["symbol", ":BAR?"], + ["symbol", ":Baz_42!"], + ["symbol", ":あ"], + ["symbol", ":\"name\""], + ["symbol", ":\"\\u{c4 d6 dc}\""], + ["symbol", ":question?"], + ["symbol", ":exclamation!"], + ["symbol", ":$;"], + + ["symbol", ":foo"], ["punctuation", "."], "object_id\n\n", + + ["comment", "# in hashes"], + + ["punctuation", "{"], + ["symbol", ":one"], + ["operator", "=>"], + ["string-literal", [ + ["string", "\"eins\""] + ]], + ["punctuation", ","], + ["symbol", ":two"], + ["operator", "=>"], + ["string-literal", [ + ["string", "\"zwei\""] + ]], + ["punctuation", ","], + ["symbol", ":three"], + ["operator", "=>"], + ["string-literal", [ + ["string", "\"drei\""] + ]], + ["punctuation", "}"], + + ["punctuation", "{"], + ["symbol", "one"], + ["operator", ":"], + ["string-literal", [ + ["string", "\"eins\""] + ]], + ["punctuation", ","], + ["symbol", "two"], + ["operator", ":"], + ["string-literal", [ + ["string", "\"zwei\""] + ]], + ["punctuation", ","], + ["symbol", "three"], + ["operator", ":"], + ["string-literal", [ + ["string", "\"drei\""] + ]], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for symbols. diff --git a/package/src/prism/tests/languages/ruby/variable_feature.test b/package/src/prism/tests/languages/ruby/variable_feature.test new file mode 100644 index 00000000..6065ccef --- /dev/null +++ b/package/src/prism/tests/languages/ruby/variable_feature.test @@ -0,0 +1,27 @@ +$_ +$foo +$BAR? +$Baz_42! + +@_ +@foo +@BAR? +@Baz_42! + +---------------------------------------------------- + +[ + ["variable", "$_"], + ["variable", "$foo"], + ["variable", "$BAR?"], + ["variable", "$Baz_42!"], + + ["variable", "@_"], + ["variable", "@foo"], + ["variable", "@BAR?"], + ["variable", "@Baz_42!"] +] + +---------------------------------------------------- + +Checks for variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rust/attribute_feature.test b/package/src/prism/tests/languages/rust/attribute_feature.test new file mode 100644 index 00000000..828f31e1 --- /dev/null +++ b/package/src/prism/tests/languages/rust/attribute_feature.test @@ -0,0 +1,35 @@ +#[test] +#![warn(unstable)] +#[doc(hidden)] +#[unstable( + feature = "thread_local_internals", + reason = "recently added to create a key", + issue = "none" +)] + +---------------------------------------------------- + +[ + ["attribute", [ + "#[test]" + ]], + ["attribute", [ + "#![warn(unstable)]" + ]], + ["attribute", [ + "#[doc(hidden)]" + ]], + ["attribute", [ + "#[unstable(\n\tfeature = ", + ["string", "\"thread_local_internals\""], + ",\n\treason = ", + ["string", "\"recently added to create a key\""], + ",\n\tissue = ", + ["string", "\"none\""], + "\n)]" + ]] +] + +---------------------------------------------------- + +Checks for attributes. diff --git a/package/src/prism/tests/languages/rust/boolean_feature.test b/package/src/prism/tests/languages/rust/boolean_feature.test new file mode 100644 index 00000000..c653fdbe --- /dev/null +++ b/package/src/prism/tests/languages/rust/boolean_feature.test @@ -0,0 +1,13 @@ +false +true + +---------------------------------------------------- + +[ + ["boolean", "false"], + ["boolean", "true"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/rust/char_feature.test b/package/src/prism/tests/languages/rust/char_feature.test new file mode 100644 index 00000000..9d26e24a --- /dev/null +++ b/package/src/prism/tests/languages/rust/char_feature.test @@ -0,0 +1,21 @@ +'a' +'स' +'\'' +'\n' +'\u{00e9}' +'\x41' + +---------------------------------------------------- + +[ + ["char", "'a'"], + ["char", "'स'"], + ["char", "'\\''"], + ["char", "'\\n'"], + ["char", "'\\u{00e9}'"], + ["char", "'\\x41'"] +] + +---------------------------------------------------- + +Checks for chars. diff --git a/package/src/prism/tests/languages/rust/class-name_feature.test b/package/src/prism/tests/languages/rust/class-name_feature.test new file mode 100644 index 00000000..24e63235 --- /dev/null +++ b/package/src/prism/tests/languages/rust/class-name_feature.test @@ -0,0 +1,132 @@ +struct foo {} + +let foo: CStr; +let foo: &'a CStr; +let foo: &'a Foo; +Option::Some(foo); +Option::None; + +// we can differentiate between enum variants and class names +// so let's make the bug a feature! +enum Foo { + Const, + Tuple(i8,i8), + Struct { + foo: u8 + } +} + +pub trait Summary { + fn summarize(&self) -> String; +} + +type Point = (u8, u8); + +---------------------------------------------------- + +[ + ["keyword", "struct"], + ["type-definition", "foo"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "let"], + " foo", + ["punctuation", ":"], + ["class-name", "CStr"], + ["punctuation", ";"], + + ["keyword", "let"], + " foo", + ["punctuation", ":"], + ["operator", "&"], + ["lifetime-annotation", "'a"], + ["class-name", "CStr"], + ["punctuation", ";"], + + ["keyword", "let"], + " foo", + ["punctuation", ":"], + ["operator", "&"], + ["lifetime-annotation", "'a"], + ["class-name", "Foo"], + ["operator", "<"], + ["keyword", "dyn"], + ["class-name", "Bar"], + ["operator", ">"], + ["punctuation", ";"], + + ["class-name", "Option"], + ["punctuation", "::"], + ["class-name", "Some"], + ["punctuation", "("], + "foo", + ["punctuation", ")"], + ["punctuation", ";"], + + ["class-name", "Option"], + ["punctuation", "::"], + ["class-name", "None"], + ["punctuation", ";"], + + ["comment", "// we can differentiate between enum variants and class names"], + + ["comment", "// so let's make the bug a feature!"], + + ["keyword", "enum"], + ["type-definition", "Foo"], + ["punctuation", "{"], + + ["class-name", "Const"], + ["punctuation", ","], + + ["class-name", "Tuple"], + ["punctuation", "("], + ["keyword", "i8"], + ["punctuation", ","], + ["keyword", "i8"], + ["punctuation", ")"], + ["punctuation", ","], + + ["class-name", "Struct"], + ["punctuation", "{"], + + "\n\t\tfoo", + ["punctuation", ":"], + ["keyword", "u8"], + + ["punctuation", "}"], + + ["punctuation", "}"], + + ["keyword", "pub"], + ["keyword", "trait"], + ["type-definition", "Summary"], + ["punctuation", "{"], + + ["keyword", "fn"], + ["function-definition", "summarize"], + ["punctuation", "("], + ["operator", "&"], + ["keyword", "self"], + ["punctuation", ")"], + ["punctuation", "->"], + ["class-name", "String"], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["keyword", "type"], + ["type-definition", "Point"], + ["operator", "="], + ["punctuation", "("], + ["keyword", "u8"], + ["punctuation", ","], + ["keyword", "u8"], + ["punctuation", ")"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for class names and enum variants. diff --git a/package/src/prism/tests/languages/rust/closure-params_feature.test b/package/src/prism/tests/languages/rust/closure-params_feature.test new file mode 100644 index 00000000..3dbf7df0 --- /dev/null +++ b/package/src/prism/tests/languages/rust/closure-params_feature.test @@ -0,0 +1,134 @@ +|x: int, y: int| -> int {} +|| {} + +vec1.iter().any(|&x| x == 2); +foo(123, || x * x); + +let add_one_v2 = |x: u32| -> u32 { x + 1 }; +let add_one_v3 = |x| { x + 1 }; +let add_one_v4 = |x| x + 1 ; +move || println!("This is a: {}", text) + +---------------------------------------------------- + +[ + ["closure-params", [ + ["closure-punctuation", "|"], + "x", + ["punctuation", ":"], + " int", + ["punctuation", ","], + " y", + ["punctuation", ":"], + " int", + ["closure-punctuation", "|"] + ]], + ["punctuation", "->"], + " int ", + ["punctuation", "{"], + ["punctuation", "}"], + + ["closure-params", [ + ["closure-punctuation", "|"], + ["closure-punctuation", "|"] + ]], + ["punctuation", "{"], + ["punctuation", "}"], + + "\n\nvec1", + ["punctuation", "."], + ["function", "iter"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "."], + ["function", "any"], + ["punctuation", "("], + ["closure-params", [ + ["closure-punctuation", "|"], + ["operator", "&"], + "x", + ["closure-punctuation", "|"] + ]], + " x ", + ["operator", "=="], + ["number", "2"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["function", "foo"], + ["punctuation", "("], + ["number", "123"], + ["punctuation", ","], + ["closure-params", [ + ["closure-punctuation", "|"], + ["closure-punctuation", "|"] + ]], + " x ", + ["operator", "*"], + " x", + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "let"], + " add_one_v2 ", + ["operator", "="], + ["closure-params", [ + ["closure-punctuation", "|"], + "x", + ["punctuation", ":"], + ["keyword", "u32"], + ["closure-punctuation", "|"] + ]], + ["punctuation", "->"], + ["keyword", "u32"], + ["punctuation", "{"], + " x ", + ["operator", "+"], + ["number", "1"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "let"], + " add_one_v3 ", + ["operator", "="], + ["closure-params", [ + ["closure-punctuation", "|"], + "x", + ["closure-punctuation", "|"] + ]], + ["punctuation", "{"], + " x ", + ["operator", "+"], + ["number", "1"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "let"], + " add_one_v4 ", + ["operator", "="], + ["closure-params", [ + ["closure-punctuation", "|"], + "x", + ["closure-punctuation", "|"] + ]], + " x ", + ["operator", "+"], + ["number", "1"], + ["punctuation", ";"], + + ["keyword", "move"], + ["closure-params", [ + ["closure-punctuation", "|"], + ["closure-punctuation", "|"] + ]], + ["macro", "println!"], + ["punctuation", "("], + ["string", "\"This is a: {}\""], + ["punctuation", ","], + " text", + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for closure params. diff --git a/package/src/prism/tests/languages/rust/comment_feature.test b/package/src/prism/tests/languages/rust/comment_feature.test new file mode 100644 index 00000000..1f7dc503 --- /dev/null +++ b/package/src/prism/tests/languages/rust/comment_feature.test @@ -0,0 +1,25 @@ +// +// foobar +/**/ +/* foo +bar */ + +/* /* */ /** */ /*! */ */ +/*! /* */ /** */ /*! */ */ +/** /* */ /** */ /*! */ */ + +---------------------------------------------------- + +[ + ["comment", "//"], + ["comment", "// foobar"], + ["comment", "/**/"], + ["comment", "/* foo\nbar */"], + ["comment", "/* /* */ /** */ /*! */ */"], + ["comment", "/*! /* */ /** */ /*! */ */"], + ["comment", "/** /* */ /** */ /*! */ */"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/rust/constant_feature.test b/package/src/prism/tests/languages/rust/constant_feature.test new file mode 100644 index 00000000..84cac8b1 --- /dev/null +++ b/package/src/prism/tests/languages/rust/constant_feature.test @@ -0,0 +1,19 @@ +MAX +SOME_CONSTANT + +// not a constant +T + +---------------------------------------------------- + +[ + ["constant", "MAX"], + ["constant", "SOME_CONSTANT"], + + ["comment", "// not a constant"], + ["class-name", "T"] +] + +---------------------------------------------------- + +Checks for constants. diff --git a/package/src/prism/tests/languages/rust/function_feature.test b/package/src/prism/tests/languages/rust/function_feature.test new file mode 100644 index 00000000..19fccb24 --- /dev/null +++ b/package/src/prism/tests/languages/rust/function_feature.test @@ -0,0 +1,90 @@ +foo ( +foobar( +foo_bar_42( + +foo_generic::>() + +mem::transmute::, Box>() + +fn apply(f: F) where F: FnOnce() { + f(); +} + +---------------------------------------------------- + +[ + ["function", "foo"], + ["punctuation", "("], + ["function", "foobar"], + ["punctuation", "("], + ["function", "foo_bar_42"], + ["punctuation", "("], + + ["function", "foo_generic"], + ["punctuation", "::"], + ["operator", "<"], + ["class-name", "T"], + ["punctuation", ","], + ["class-name", "Option"], + ["operator", "<"], + ["class-name", "T"], + ["operator", ">>"], + ["punctuation", "("], + ["punctuation", ")"], + + ["namespace", [ + "mem", + ["punctuation", "::"] + ]], + ["function", "transmute"], + ["punctuation", "::"], + ["operator", "<"], + ["class-name", "Box"], + ["operator", "<"], + ["keyword", "dyn"], + ["class-name", "FnOnce"], + ["punctuation", "("], + ["punctuation", ")"], + ["operator", "+"], + ["lifetime-annotation", "'a"], + ["operator", ">"], + ["punctuation", ","], + ["class-name", "Box"], + ["operator", "<"], + ["keyword", "dyn"], + ["class-name", "FnOnce"], + ["punctuation", "("], + ["punctuation", ")"], + ["operator", "+"], + ["lifetime-annotation", "'static"], + ["operator", ">>"], + ["punctuation", "("], + ["punctuation", ")"], + + ["keyword", "fn"], + ["function-definition", "apply"], + ["operator", "<"], + ["class-name", "F"], + ["operator", ">"], + ["punctuation", "("], + "f", + ["punctuation", ":"], + ["class-name", "F"], + ["punctuation", ")"], + ["keyword", "where"], + ["class-name", "F"], + ["punctuation", ":"], + ["class-name", "FnOnce"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["function", "f"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for functions and macros. diff --git a/package/src/prism/tests/languages/rust/issue1339.test b/package/src/prism/tests/languages/rust/issue1339.test new file mode 100644 index 00000000..7a831a6d --- /dev/null +++ b/package/src/prism/tests/languages/rust/issue1339.test @@ -0,0 +1,51 @@ +const ALL_CARDS: &'static [&'static char] = &["2"] + +fn foo<'a> (first: &'a str, second: &'a str) => () { } + +---------------------------------------------------- + +[ + ["keyword", "const"], + ["constant", "ALL_CARDS"], + ["punctuation", ":"], + ["operator", "&"], + ["lifetime-annotation", "'static"], + ["punctuation", "["], + ["operator", "&"], + ["lifetime-annotation", "'static"], + ["keyword", "char"], + ["punctuation", "]"], + ["operator", "="], + ["operator", "&"], + ["punctuation", "["], + ["string", "\"2\""], + ["punctuation", "]"], + + ["keyword", "fn"], + ["function-definition", "foo"], + ["operator", "<"], + ["lifetime-annotation", "'a"], + ["operator", ">"], + ["punctuation", "("], + "first", + ["punctuation", ":"], + ["operator", "&"], + ["lifetime-annotation", "'a"], + ["keyword", "str"], + ["punctuation", ","], + " second", + ["punctuation", ":"], + ["operator", "&"], + ["lifetime-annotation", "'a"], + ["keyword", "str"], + ["punctuation", ")"], + ["operator", "=>"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for lifetime annotations in real-world examples. See #1339. diff --git a/package/src/prism/tests/languages/rust/issue1353.test b/package/src/prism/tests/languages/rust/issue1353.test new file mode 100644 index 00000000..03766c19 --- /dev/null +++ b/package/src/prism/tests/languages/rust/issue1353.test @@ -0,0 +1,16 @@ +(*e 0 b'a') + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["operator", "*"], + "e ", + ["number", "0"], + ["char", "b'a'"], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Makes sure lifetime annotations do not mess with bytes. See #1353. \ No newline at end of file diff --git a/package/src/prism/tests/languages/rust/keyword_feature.test b/package/src/prism/tests/languages/rust/keyword_feature.test new file mode 100644 index 00000000..2c1d363f --- /dev/null +++ b/package/src/prism/tests/languages/rust/keyword_feature.test @@ -0,0 +1,109 @@ +abstract; +as; +async; +await; +become; +box; +break; +const; +continue; +crate; +do; +dyn; +else; +enum; +extern; +final; +fn; +for; +if; +impl; +in; +let; +loop; +macro; +match; +mod; +move; +mut; +override; +priv; +pub; +ref; +return; +self; +Self; +static; +struct; +super; +trait; +try; +type; +typeof; +union; +unsafe; +unsized; +use; +virtual; +where; +while; +yield; + +---------------------------------------------------- + +[ + ["keyword", "abstract"], ["punctuation", ";"], + ["keyword", "as"], ["punctuation", ";"], + ["keyword", "async"], ["punctuation", ";"], + ["keyword", "await"], ["punctuation", ";"], + ["keyword", "become"], ["punctuation", ";"], + ["keyword", "box"], ["punctuation", ";"], + ["keyword", "break"], ["punctuation", ";"], + ["keyword", "const"], ["punctuation", ";"], + ["keyword", "continue"], ["punctuation", ";"], + ["keyword", "crate"], ["punctuation", ";"], + ["keyword", "do"], ["punctuation", ";"], + ["keyword", "dyn"], ["punctuation", ";"], + ["keyword", "else"], ["punctuation", ";"], + ["keyword", "enum"], ["punctuation", ";"], + ["keyword", "extern"], ["punctuation", ";"], + ["keyword", "final"], ["punctuation", ";"], + ["keyword", "fn"], ["punctuation", ";"], + ["keyword", "for"], ["punctuation", ";"], + ["keyword", "if"], ["punctuation", ";"], + ["keyword", "impl"], ["punctuation", ";"], + ["keyword", "in"], ["punctuation", ";"], + ["keyword", "let"], ["punctuation", ";"], + ["keyword", "loop"], ["punctuation", ";"], + ["keyword", "macro"], ["punctuation", ";"], + ["keyword", "match"], ["punctuation", ";"], + ["keyword", "mod"], ["punctuation", ";"], + ["keyword", "move"], ["punctuation", ";"], + ["keyword", "mut"], ["punctuation", ";"], + ["keyword", "override"], ["punctuation", ";"], + ["keyword", "priv"], ["punctuation", ";"], + ["keyword", "pub"], ["punctuation", ";"], + ["keyword", "ref"], ["punctuation", ";"], + ["keyword", "return"], ["punctuation", ";"], + ["keyword", "self"], ["punctuation", ";"], + ["keyword", "Self"], ["punctuation", ";"], + ["keyword", "static"], ["punctuation", ";"], + ["keyword", "struct"], ["punctuation", ";"], + ["keyword", "super"], ["punctuation", ";"], + ["keyword", "trait"], ["punctuation", ";"], + ["keyword", "try"], ["punctuation", ";"], + ["keyword", "type"], ["punctuation", ";"], + ["keyword", "typeof"], ["punctuation", ";"], + ["keyword", "union"], ["punctuation", ";"], + ["keyword", "unsafe"], ["punctuation", ";"], + ["keyword", "unsized"], ["punctuation", ";"], + ["keyword", "use"], ["punctuation", ";"], + ["keyword", "virtual"], ["punctuation", ";"], + ["keyword", "where"], ["punctuation", ";"], + ["keyword", "while"], ["punctuation", ";"], + ["keyword", "yield"], ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/rust/lifetime-annotation_feature.test b/package/src/prism/tests/languages/rust/lifetime-annotation_feature.test new file mode 100644 index 00000000..c50df1cb --- /dev/null +++ b/package/src/prism/tests/languages/rust/lifetime-annotation_feature.test @@ -0,0 +1,19 @@ +'static +'foo +'a +'_ +<'a> + +---------------------------------------------------- + +[ + ["lifetime-annotation", "'static"], + ["lifetime-annotation", "'foo"], + ["lifetime-annotation", "'a"], + ["lifetime-annotation", "'_"], + ["operator", "<"], ["lifetime-annotation", "'a"], ["operator", ">"] +] + +---------------------------------------------------- + +Checks for lifetime annotations. diff --git a/package/src/prism/tests/languages/rust/macro_example.test b/package/src/prism/tests/languages/rust/macro_example.test new file mode 100644 index 00000000..593fe2f9 --- /dev/null +++ b/package/src/prism/tests/languages/rust/macro_example.test @@ -0,0 +1,144 @@ +macro_rules! write_html { + ($w:expr, ) => (()); + + ($w:expr, $e:tt) => (write!($w, "{}", $e)); + + ($w:expr, $tag:ident [ $($inner:tt)* ] $($rest:tt)*) => {{ + write!($w, "<{}>", stringify!($tag)); + write_html!($w, $($inner)*); + write!($w, "", stringify!($tag)); + write_html!($w, $($rest)*); + }}; +} + +---------------------------------------------------- + +[ + ["macro", "macro_rules!"], + " write_html ", + ["punctuation", "{"], + + ["punctuation", "("], + ["variable", "$w"], + ["punctuation", ":"], + ["fragment-specifier", "expr"], + ["punctuation", ","], + ["punctuation", ")"], + ["operator", "=>"], + ["punctuation", "("], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "("], + ["variable", "$w"], + ["punctuation", ":"], + ["fragment-specifier", "expr"], + ["punctuation", ","], + ["variable", "$e"], + ["punctuation", ":"], + ["fragment-specifier", "tt"], + ["punctuation", ")"], + ["operator", "=>"], + ["punctuation", "("], + ["macro", "write!"], + ["punctuation", "("], + ["variable", "$w"], + ["punctuation", ","], + ["string", "\"{}\""], + ["punctuation", ","], + ["variable", "$e"], + ["punctuation", ")"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "("], + ["variable", "$w"], + ["punctuation", ":"], + ["fragment-specifier", "expr"], + ["punctuation", ","], + ["variable", "$tag"], + ["punctuation", ":"], + ["fragment-specifier", "ident"], + ["punctuation", "["], + " $", + ["punctuation", "("], + ["variable", "$inner"], + ["punctuation", ":"], + ["fragment-specifier", "tt"], + ["punctuation", ")"], + ["operator", "*"], + ["punctuation", "]"], + " $", + ["punctuation", "("], + ["variable", "$rest"], + ["punctuation", ":"], + ["fragment-specifier", "tt"], + ["punctuation", ")"], + ["operator", "*"], + ["punctuation", ")"], + ["operator", "=>"], + ["punctuation", "{"], + ["punctuation", "{"], + + ["macro", "write!"], + ["punctuation", "("], + ["variable", "$w"], + ["punctuation", ","], + ["string", "\"<{}>\""], + ["punctuation", ","], + ["macro", "stringify!"], + ["punctuation", "("], + ["variable", "$tag"], + ["punctuation", ")"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["macro", "write_html!"], + ["punctuation", "("], + ["variable", "$w"], + ["punctuation", ","], + " $", + ["punctuation", "("], + ["variable", "$inner"], + ["punctuation", ")"], + ["operator", "*"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["macro", "write!"], + ["punctuation", "("], + ["variable", "$w"], + ["punctuation", ","], + ["string", "\"\""], + ["punctuation", ","], + ["macro", "stringify!"], + ["punctuation", "("], + ["variable", "$tag"], + ["punctuation", ")"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["macro", "write_html!"], + ["punctuation", "("], + ["variable", "$w"], + ["punctuation", ","], + " $", + ["punctuation", "("], + ["variable", "$rest"], + ["punctuation", ")"], + ["operator", "*"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "}"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks this macro example. diff --git a/package/src/prism/tests/languages/rust/macro_feature.test b/package/src/prism/tests/languages/rust/macro_feature.test new file mode 100644 index 00000000..e043ac7f --- /dev/null +++ b/package/src/prism/tests/languages/rust/macro_feature.test @@ -0,0 +1,15 @@ +foo! +foo_bar! +foo_bar_42! + +---------------------------------------------------- + +[ + ["macro", "foo!"], + ["macro", "foo_bar!"], + ["macro", "foo_bar_42!"] +] + +---------------------------------------------------- + +Checks for macros. diff --git a/package/src/prism/tests/languages/rust/namespace_feature.test b/package/src/prism/tests/languages/rust/namespace_feature.test new file mode 100644 index 00000000..3ccfa1ad --- /dev/null +++ b/package/src/prism/tests/languages/rust/namespace_feature.test @@ -0,0 +1,221 @@ +use std::{ + fs::File, + io::{BufRead, BufReader}, + path::PathBuf, +}; +use ::serde::de::{Error, Visitor}; +use std::sync::atomic::{AtomicBool, Ordering}; +pub mod sample; +extern crate test; + +Result + +where D: serde::Deserializer<'de>, + +serde_json::from_str(&line) +self.read_records::() + +pub static ALLOCATOR: alloc::Tracing = alloc::Tracing::new(); + +unsafe fn alloc(&self, layout: std::alloc::Layout) -> *mut u8 {} + +use crate::cool::function as root_function; +self::cool::function(); + +---------------------------------------------------- + +[ + ["keyword", "use"], + ["namespace", [ + "std", + ["punctuation", "::"] + ]], + ["punctuation", "{"], + + ["namespace", [ + "fs", + ["punctuation", "::"] + ]], + ["class-name", "File"], + ["punctuation", ","], + + ["namespace", [ + "io", + ["punctuation", "::"] + ]], + ["punctuation", "{"], + ["class-name", "BufRead"], + ["punctuation", ","], + ["class-name", "BufReader"], + ["punctuation", "}"], + ["punctuation", ","], + + ["namespace", [ + "path", + ["punctuation", "::"] + ]], + ["class-name", "PathBuf"], + ["punctuation", ","], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "use"], + ["punctuation", "::"], + ["namespace", [ + "serde", + ["punctuation", "::"], + "de", + ["punctuation", "::"] + ]], + ["punctuation", "{"], + ["class-name", "Error"], + ["punctuation", ","], + ["class-name", "Visitor"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "use"], + ["namespace", [ + "std", + ["punctuation", "::"], + "sync", + ["punctuation", "::"], + "atomic", + ["punctuation", "::"] + ]], + ["punctuation", "{"], + ["class-name", "AtomicBool"], + ["punctuation", ","], + ["class-name", "Ordering"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "pub"], + ["keyword", "mod"], + ["module-declaration", "sample"], + ["punctuation", ";"], + + ["keyword", "extern"], + ["keyword", "crate"], + ["module-declaration", "test"], + ["punctuation", ";"], + + ["class-name", "Result"], + ["operator", "<"], + ["keyword", "Self"], + ["punctuation", ","], + ["class-name", "D"], + ["punctuation", "::"], + ["class-name", "Error"], + ["operator", ">"], + + ["keyword", "where"], + ["class-name", "D"], + ["punctuation", ":"], + ["namespace", [ + "serde", + ["punctuation", "::"] + ]], + ["class-name", "Deserializer"], + ["operator", "<"], + ["lifetime-annotation", "'de"], + ["operator", ">"], + ["punctuation", ","], + + ["namespace", [ + "serde_json", + ["punctuation", "::"] + ]], + ["function", "from_str"], + ["punctuation", "("], + ["operator", "&"], + "line", + ["punctuation", ")"], + + ["keyword", "self"], + ["punctuation", "."], + ["function", "read_records"], + ["punctuation", "::"], + ["operator", "<"], + ["namespace", [ + "smol_str", + ["punctuation", "::"] + ]], + ["class-name", "SmolStr"], + ["operator", ">"], + ["punctuation", "("], + ["punctuation", ")"], + + ["keyword", "pub"], + ["keyword", "static"], + ["constant", "ALLOCATOR"], + ["punctuation", ":"], + ["namespace", [ + "alloc", + ["punctuation", "::"] + ]], + ["class-name", "Tracing"], + ["operator", "="], + ["namespace", [ + "alloc", + ["punctuation", "::"] + ]], + ["class-name", "Tracing"], + ["punctuation", "::"], + ["function", "new"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "unsafe"], + ["keyword", "fn"], + ["function-definition", "alloc"], + ["punctuation", "("], + ["operator", "&"], + ["keyword", "self"], + ["punctuation", ","], + " layout", + ["punctuation", ":"], + ["namespace", [ + "std", + ["punctuation", "::"], + "alloc", + ["punctuation", "::"] + ]], + ["class-name", "Layout"], + ["punctuation", ")"], + ["punctuation", "->"], + ["operator", "*"], + ["keyword", "mut"], + ["keyword", "u8"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "use"], + ["keyword", "crate"], + ["module-declaration", [ + ["punctuation", "::"], + "cool", + ["punctuation", "::"] + ]], + "function ", + ["keyword", "as"], + " root_function", + ["punctuation", ";"], + + ["keyword", "self"], + ["module-declaration", [ + ["punctuation", "::"], + "cool", + ["punctuation", "::"] + ]], + ["function", "function"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for namespaces. diff --git a/package/src/prism/tests/languages/rust/number_feature.test b/package/src/prism/tests/languages/rust/number_feature.test new file mode 100644 index 00000000..869c7a54 --- /dev/null +++ b/package/src/prism/tests/languages/rust/number_feature.test @@ -0,0 +1,51 @@ +0xBad_Face +0o741_123 +0b0000_1111 +42_000 +3.14_15_9 +3e4 +3.5E-8 +4.6e+41 + +0xBad_Faceu8 +0o741_123i8 +0b0000_1111u16 +42_000i16 +3.14_15_9u32 +3e4i32 +3.5E-8u64 +4.6e+41i64 +4.2f32 +4.2f64 + +0usize + +---------------------------------------------------- + +[ + ["number", "0xBad_Face"], + ["number", "0o741_123"], + ["number", "0b0000_1111"], + ["number", "42_000"], + ["number", "3.14_15_9"], + ["number", "3e4"], + ["number", "3.5E-8"], + ["number", "4.6e+41"], + + ["number", "0xBad_Faceu8"], + ["number", "0o741_123i8"], + ["number", "0b0000_1111u16"], + ["number", "42_000i16"], + ["number", "3.14_15_9u32"], + ["number", "3e4i32"], + ["number", "3.5E-8u64"], + ["number", "4.6e+41i64"], + ["number", "4.2f32"], + ["number", "4.2f64"], + + ["number", "0usize"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/rust/operator_feature.test b/package/src/prism/tests/languages/rust/operator_feature.test new file mode 100644 index 00000000..2a93c563 --- /dev/null +++ b/package/src/prism/tests/languages/rust/operator_feature.test @@ -0,0 +1,35 @@ ++ += +- -= +* *= +/ /= +% %= +! != +^ ^= += == => +& && &= ; +| || |= +< << <= <<= +> >> >= >>= +@ ? + +---------------------------------------------------- + +[ + ["operator", "+"], ["operator", "+="], + ["operator", "-"], ["operator", "-="], + ["operator", "*"], ["operator", "*="], + ["operator", "/"], ["operator", "/="], + ["operator", "%"], ["operator", "%="], + ["operator", "!"], ["operator", "!="], + ["operator", "^"], ["operator", "^="], + ["operator", "="], ["operator", "=="], ["operator", "=>"], + ["operator", "&"], ["operator", "&&"], ["operator", "&="], ["punctuation", ";"], + ["operator", "|"], ["operator", "||"], ["operator", "|="], + ["operator", "<"], ["operator", "<<"], ["operator", "<="], ["operator", "<<="], + ["operator", ">"], ["operator", ">>"], ["operator", ">="], ["operator", ">>="], + ["operator", "@"], ["operator", "?"] +] + +---------------------------------------------------- + +Checks for all operators. diff --git a/package/src/prism/tests/languages/rust/punctuation_feature.test b/package/src/prism/tests/languages/rust/punctuation_feature.test new file mode 100644 index 00000000..025a29c4 --- /dev/null +++ b/package/src/prism/tests/languages/rust/punctuation_feature.test @@ -0,0 +1,29 @@ +-> +. .. ... ..= +:: +{} [] () +; , : + +---------------------------------------------------- + +[ + ["punctuation", "->"], + ["punctuation", "."], + ["punctuation", ".."], + ["punctuation", "..."], + ["punctuation", "..="], + ["punctuation", "::"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["punctuation", ","], + ["punctuation", ":"] +] + +---------------------------------------------------- + +Checks for all punctuation. diff --git a/package/src/prism/tests/languages/rust/string_feature.test b/package/src/prism/tests/languages/rust/string_feature.test new file mode 100644 index 00000000..10f30294 --- /dev/null +++ b/package/src/prism/tests/languages/rust/string_feature.test @@ -0,0 +1,53 @@ +"" +"fo\"obar" +"foo\ + bar" +"foo +bar" + +b"" +b"fo\"obar" + +r#""# +r#"fo"obar"# +r###"foo +# +bar"### + +br#""# +br#"fo"obar"# +br###"foo#bar"### + +r"(?x) +(?P\d{4}) # the year +- +(?P\d{2}) # the month +- +(?P\d{2}) # the day +" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""], + ["string", "\"foo\\\n\tbar\""], + ["string", "\"foo\nbar\""], + + ["string", "b\"\""], + ["string", "b\"fo\\\"obar\""], + + ["string", "r#\"\"#"], + ["string", "r#\"fo\"obar\"#"], + ["string", "r###\"foo\n#\nbar\"###"], + + ["string", "br#\"\"#"], + ["string", "br#\"fo\"obar\"#"], + ["string", "br###\"foo#bar\"###"], + + ["string", "r\"(?x)\n(?P\\d{4}) # the year\n-\n(?P\\d{2}) # the month\n-\n(?P\\d{2}) # the day\n\""] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/sas/comment_feature.test b/package/src/prism/tests/languages/sas/comment_feature.test new file mode 100644 index 00000000..7d2d7c30 --- /dev/null +++ b/package/src/prism/tests/languages/sas/comment_feature.test @@ -0,0 +1,20 @@ +* foobar; +foo; * foobar; +/* foo +bar */ + +/*options cashost="cloud.example.com" casport=5570;*/ + +---------------------------------------------------- + +[ + ["comment", "* foobar;"], + "\nfoo", ["punctuation", ";"], + ["comment", "* foobar;"], + ["comment", "/* foo\nbar */"], + ["comment", "/*options cashost=\"cloud.example.com\" casport=5570;*/"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/sas/datalines_feature.test b/package/src/prism/tests/languages/sas/datalines_feature.test new file mode 100644 index 00000000..e4fbaf64 --- /dev/null +++ b/package/src/prism/tests/languages/sas/datalines_feature.test @@ -0,0 +1,38 @@ +datalines; +1993 2,819 1,120 422 391 63 98 +1994 2,477 1,160 500 172 47 70 +; + +lines; +foo bar baz +; + +cards; +foo +bar +baz +; + +---------------------------------------------------- + +[ + ["datalines", [ + ["keyword", "datalines"], ["punctuation", ";"], + "\n1993 2,819 1,120 422 391 63 98\n1994 2,477 1,160 500 172 47 70\n", + ["punctuation", ";"] + ]], + ["datalines", [ + ["keyword", "lines"], ["punctuation", ";"], + "\nfoo bar baz\n", + ["punctuation", ";"] + ]], + ["datalines", [ + ["keyword", "cards"], ["punctuation", ";"], + "\nfoo\nbar\nbaz\n", + ["punctuation", ";"] + ]] +] + +---------------------------------------------------- + +Checks for datalines. diff --git a/package/src/prism/tests/languages/sas/datetime_feature.test b/package/src/prism/tests/languages/sas/datetime_feature.test new file mode 100644 index 00000000..ea4cbfc7 --- /dev/null +++ b/package/src/prism/tests/languages/sas/datetime_feature.test @@ -0,0 +1,24 @@ +'1jan2013'd +'9:25:19pm't +'18jan2003:9:27:05am'dt + +* don't match the following just because of "'t"; + +'foo'¦¦'test'; + +---------------------------------------------------- + +[ + ["datetime", "'1jan2013'd"], + ["datetime", "'9:25:19pm't"], + ["datetime", "'18jan2003:9:27:05am'dt"], + ["comment", "* don't match the following just because of \"'t\";"], + ["string", "'foo'"], + ["operator", "¦¦"], + ["string", "'test'"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for date, times and datetimes. diff --git a/package/src/prism/tests/languages/sas/format_feature.test b/package/src/prism/tests/languages/sas/format_feature.test new file mode 100644 index 00000000..6442b101 --- /dev/null +++ b/package/src/prism/tests/languages/sas/format_feature.test @@ -0,0 +1,36 @@ +put x $hex16.; +format salary uscurrency.; +format=dollar12.; + +---------------------------------------------------- + +[ + ["altformat", + [ + ["keyword", "put"], + " x ", + ["format", "$hex16."] + ] + ], + ["punctuation", ";"], + ["altformat", + [ + ["keyword","format"], + " salary ", + ["format", "uscurrency."] + ] + ], + ["punctuation", ";"], + ["format", + [ + ["keyword", "format"], + ["equals", "="], + ["format", "dollar12."] + ] + ], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks that options captures "options" and correctly tags following text. diff --git a/package/src/prism/tests/languages/sas/function_feature.test b/package/src/prism/tests/languages/sas/function_feature.test new file mode 100644 index 00000000..047f6233 --- /dev/null +++ b/package/src/prism/tests/languages/sas/function_feature.test @@ -0,0 +1,21 @@ +function() +x=addrlong(item); + +---------------------------------------------------- + +[ + ["function", "function"], + ["punctuation", "("], + ["punctuation", ")"], + "\nx", + ["operator", "="], + ["function", "addrlong"], + ["punctuation", "("], + "item", + ["punctuation", ")"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks that options captures "options" and correctly tags following text. diff --git a/package/src/prism/tests/languages/sas/input_feature.test b/package/src/prism/tests/languages/sas/input_feature.test new file mode 100644 index 00000000..84648fbe --- /dev/null +++ b/package/src/prism/tests/languages/sas/input_feature.test @@ -0,0 +1,42 @@ +input name $ score1 score2 score3 team $; +input name $ & score; +input outlook $ 1-8 temperature humidity windy $ 16 - 21 /* golf $22 - 32 */; + +---------------------------------------------------- + +[ + [ + "input", + [ + ["input", "input"], + " name $ score1 score2 score3 team $;" + ] + ], + [ + "input", + [ + ["input", "input"], + " name $ & score;" + ] + ], + ["input", + [ + ["input", "input"], + " outlook $ ", + ["number", "1"], + "-", + ["number", "8"], + " temperature humidity windy $ ", + ["number", "16"], + " - ", + ["number", "21"], + ["comment", "/* golf $22 - 32 */"], + ";" + ] + ] +] + +---------------------------------------------------- + +Checks that input captures "input" and text that follows up to and including +the semicolon. diff --git a/package/src/prism/tests/languages/sas/keyword_feature.test b/package/src/prism/tests/languages/sas/keyword_feature.test new file mode 100644 index 00000000..4de2b5ad --- /dev/null +++ b/package/src/prism/tests/languages/sas/keyword_feature.test @@ -0,0 +1,46 @@ +after analysis and array barchart barwidth begingraph by +cas cbarline cfill class classlev close column compute computed contains data= +define document do do over dol drop dul end entryTitle else endcomp eval +evaluate exec execute fill fillattrs filename group groupby headline headskip +histogram if infile keep keylabel keyword label layout legendlabel length +libname merge midpoints name noobs nowd ods or out output overlay plot ranexp +rannor rbreak retain set session sessref statgraph sum summarize table temp then +then do title to var where xaxisopts yaxisopts y2axisopts + +---------------------------------------------------- + +[ + ["keyword", "after"], ["keyword", "analysis"], + ["keyword", "and"], ["keyword", "array"], ["keyword", "barchart"], + ["keyword", "barwidth"], ["keyword", "begingraph"], ["keyword", "by"], + ["keyword", "cas"], ["keyword", "cbarline"], ["keyword", "cfill"], + ["keyword", "class"], ["keyword", "classlev"], + ["keyword", "close"], ["keyword", "column"], ["keyword", "compute"], + ["keyword", "computed"], ["keyword", "contains"], ["keyword", "data"], + ["operator", "="], ["keyword", "define"], ["keyword", "document"], + ["keyword", "do"], ["keyword", "do over"], ["keyword", "dol"], + ["keyword", "drop"], ["keyword", "dul"], ["keyword", "end"], + ["keyword", "entryTitle"], ["keyword", "else"], ["keyword", "endcomp"], + ["keyword", "eval"], ["keyword", "evaluate"], ["keyword", "exec"], + ["keyword", "execute"], ["keyword", "fill"], ["keyword", "fillattrs"], + ["keyword", "filename"], ["keyword", "group"], ["keyword", "groupby"], + ["keyword", "headline"], ["keyword", "headskip"], ["keyword", "histogram"], + ["keyword", "if"], ["keyword", "infile"], ["keyword", "keep"], + ["keyword", "keylabel"], ["keyword", "keyword"], ["keyword", "label"], + ["keyword", "layout"], ["keyword", "legendlabel"], ["keyword", "length"], + ["keyword", "libname"], ["keyword", "merge"], ["keyword", "midpoints"], + ["keyword", "name"], ["keyword", "noobs"], ["keyword", "nowd"], + ["keyword", "ods"], ["keyword", "or"], ["keyword", "out"], + ["keyword", "output"], ["keyword", "overlay"], ["keyword", "plot"], + ["keyword", "ranexp"], ["keyword", "rannor"], ["keyword", "rbreak"], + ["keyword", "retain"], ["keyword", "set"], ["keyword", "session"], + ["keyword", "sessref"], ["keyword", "statgraph"], ["keyword", "sum"], + ["keyword", "summarize"], ["keyword", "table"], ["keyword", "temp"], + ["keyword", "then"], ["keyword", "then do"], ["keyword", "title"], + ["keyword", "to"], ["keyword", "var"], ["keyword", "where"], + ["keyword", "xaxisopts"], ["keyword", "yaxisopts"], ["keyword", "y2axisopts"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/sas/macro_feature.test b/package/src/prism/tests/languages/sas/macro_feature.test new file mode 100644 index 00000000..3dd8660b --- /dev/null +++ b/package/src/prism/tests/languages/sas/macro_feature.test @@ -0,0 +1,23 @@ +%_zscore(length); +%_test(string, 0.3); + +---------------------------------------------------- + +[ + ["macro", "%_zscore"], + ["punctuation", "("], + "length", + ["punctuation", ")"], + ["punctuation", ";"], + ["macro", "%_test"], + ["punctuation", "("], + "string", + ["punctuation", ","], + ["number", "0.3"], + ["punctuation", ")"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks that options captures "options" and correctly tags following text. diff --git a/package/src/prism/tests/languages/sas/macro_string_function_feature.test b/package/src/prism/tests/languages/sas/macro_string_function_feature.test new file mode 100644 index 00000000..5b681b30 --- /dev/null +++ b/package/src/prism/tests/languages/sas/macro_string_function_feature.test @@ -0,0 +1,95 @@ +%let a=%bquote(' "); +%let b=%nrbquote(' "); +%let c=%nrquote(%' %"); +%let d=%nrstr(%' %"); +%let e=%quote(%' %"); +%let f=%str(%' %"); +%let char1 = %bquote(%substr(&infile,1,1)); + +---------------------------------------------------- + +[ + ["macro-keyword", "%let"], + " a", + ["operator", "="], + ["macro-string-functions", [ + ["function", "%bquote"], + ["punctuation", "("], + "' \"", + ["punctuation", ")"] + ]], + ["punctuation", ";"], + ["macro-keyword", "%let"], + " b", + ["operator", "="], + ["macro-string-functions", [ + ["function", "%nrbquote"], + ["punctuation", "("], + "' \"", + ["punctuation", ")"] + ]], + ["punctuation", ";"], + ["macro-keyword", "%let"], + " c", + ["operator", "="], + ["macro-string-functions", [ + ["function", "%nrquote"], + ["punctuation", "("], + ["escaped-char", "%'"], + ["escaped-char", "%\""], + ["punctuation", ")"] + ]], + ["punctuation", ";"], + ["macro-keyword", "%let"], + " d", + ["operator", "="], + ["macro-string-functions", [ + ["function", "%nrstr"], + ["punctuation", "("], + ["escaped-char", "%'"], + ["escaped-char", "%\""], + ["punctuation", ")"] + ]], + ["punctuation", ";"], + ["macro-keyword", "%let"], + " e", + ["operator", "="], + ["macro-string-functions", [ + ["function", "%quote"], + ["punctuation", "("], + ["escaped-char", "%'"], + ["escaped-char", "%\""], + ["punctuation", ")"] + ]], + ["punctuation", ";"], + ["macro-keyword", "%let"], + " f", + ["operator", "="], + ["macro-string-functions", [ + ["function", "%str"], + ["punctuation", "("], + ["escaped-char", "%'"], + ["escaped-char", "%\""], + ["punctuation", ")"] + ]], + ["punctuation", ";"], + ["macro-keyword", "%let"], + " char1 ", + ["operator", "="], + ["function", "%bquote"], + ["punctuation", "("], + ["macro-keyword", "%substr"], + ["punctuation", "("], + ["macro-variable", "&infile"], + ["punctuation", ","], + ["number", "1"], + ["punctuation", ","], + ["number", "1"], + ["punctuation", ")"], + ["punctuation", ")"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for all macro string functions. diff --git a/package/src/prism/tests/languages/sas/macrodefinition_feature.test b/package/src/prism/tests/languages/sas/macrodefinition_feature.test new file mode 100644 index 00000000..97c64389 --- /dev/null +++ b/package/src/prism/tests/languages/sas/macrodefinition_feature.test @@ -0,0 +1,111 @@ +%macro prnt(var,sum); + proc print data=srhigh; + var &var; + sum ∑ + run; +%mend prnt; + +%macro printz/parmbuff; + %let num=1; + %let dsname=%scan(&syspbuff,&num); + %do %while(&dsname ne); + proc print data=&dsname; + run; + %let num=%eval(&num+1); + %let dsname=%scan(&syspbuff,&num); + %end; +%mend printz; + +---------------------------------------------------- + +[ + ["macro-declaration", [ + ["keyword", "%macro"], + " prnt(var,sum)" + ]], + ["punctuation", ";"], + ["step", "proc print"], + ["keyword", "data"], + ["operator", "="], + "srhigh", + ["punctuation", ";"], + ["keyword", "var"], + ["macro-variable", "&var"], + ["punctuation", ";"], + ["keyword", "sum"], + ["macro-variable", "&sum"], + ["punctuation", ";"], + ["step", "run"], + ["punctuation", ";"], + ["macro-end", [ + ["keyword", "%mend"], + " prnt" + ]], + ["punctuation", ";"], + + ["macro-declaration", [ + ["keyword", "%macro"], + " printz/parmbuff" + ]], + ["punctuation", ";"], + ["macro-keyword", "%let"], + " num", + ["operator", "="], + ["number", "1"], + ["punctuation", ";"], + ["macro-keyword", "%let"], + " dsname", + ["operator", "="], + ["macro-keyword", "%scan"], + ["punctuation", "("], + ["macro-variable", "&syspbuff"], + ["punctuation", ","], + ["macro-variable", "&num"], + ["punctuation", ")"], + ["punctuation", ";"], + ["macro-keyword", "%do"], + ["macro-keyword", "%while"], + ["punctuation", "("], + ["macro-variable", "&dsname"], + ["operator-keyword", "ne"], + ["punctuation", ")"], + ["punctuation", ";"], + ["step", "proc print"], + ["keyword", "data"], + ["operator", "="], + ["macro-variable", "&dsname"], + ["punctuation", ";"], + ["step", "run"], + ["punctuation", ";"], + ["macro-keyword", "%let"], + " num", + ["operator", "="], + ["macro-keyword", "%eval"], + ["punctuation", "("], + ["macro-variable", "&num"], + ["operator", "+"], + ["number", "1"], + ["punctuation", ")"], + ["punctuation", ";"], + ["macro-keyword", "%let"], + " dsname", + ["operator", "="], + ["macro-keyword", "%scan"], + ["punctuation", "("], + ["macro-variable", "&syspbuff"], + ["punctuation", ","], + ["macro-variable", "&num"], + ["punctuation", ")"], + ["punctuation", ";"], + ["macro-keyword", "%end"], + ["punctuation", ";"], + ["macro-end", [ + ["keyword", "%mend"], + " printz" + ]], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Check that macro definition correctly recognizes %macro and %mend. diff --git a/package/src/prism/tests/languages/sas/macrokeyword_feature.test b/package/src/prism/tests/languages/sas/macrokeyword_feature.test new file mode 100644 index 00000000..10de9826 --- /dev/null +++ b/package/src/prism/tests/languages/sas/macrokeyword_feature.test @@ -0,0 +1,38 @@ +%ABORT %BY %CMS %COPY %DISPLAY %DO %ELSE %END %EVAL %GLOBAL %GO %GOTO %IF %INC %INCLUDE +%INDEX %INPUT %KTRIM %LENGTH %LET %LIST %LOCAL %PUT %QKTRIM %QSCAN +%QSUBSTR %QSYSFUNC %QUPCASE %RETURN %RUN %SCAN %SUBSTR %SUPERQ %SYMDEL %SYMGLOBL +%SYMLOCAL %SYMEXIST %SYSCALL %SYSEVALF %SYSEXEC %SYSFUNC %SYSGET %SYSRPUT %THEN %TO %TSO +%UNQUOTE %UNTIL %UPCASE %WHILE %WINDOW + +---------------------------------------------------- + +[ + ["macro-keyword", "%ABORT"], ["macro-keyword", "%BY"], + ["macro-keyword", "%CMS"], ["macro-keyword", "%COPY"], ["macro-keyword", "%DISPLAY"], + ["macro-keyword", "%DO"], ["macro-keyword", "%ELSE"], ["macro-keyword", "%END"], + ["macro-keyword", "%EVAL"], ["macro-keyword", "%GLOBAL"], ["macro-keyword", "%GO"], + ["macro-keyword", "%GOTO"], ["macro-keyword", "%IF"], ["macro-keyword", "%INC"], + ["macro-keyword", "%INCLUDE"], ["macro-keyword", "%INDEX"], + ["macro-keyword", "%INPUT"], ["macro-keyword", "%KTRIM"], + ["macro-keyword", "%LENGTH"], ["macro-keyword", "%LET"], ["macro-keyword", "%LIST"], + ["macro-keyword", "%LOCAL"], + ["macro-keyword", "%PUT"], ["macro-keyword", "%QKTRIM"], + ["macro-keyword", "%QSCAN"], ["macro-keyword", "%QSUBSTR"], + ["macro-keyword", "%QSYSFUNC"], + ["macro-keyword", "%QUPCASE"], ["macro-keyword", "%RETURN"], + ["macro-keyword", "%RUN"], ["macro-keyword", "%SCAN"], + ["macro-keyword", "%SUBSTR"], ["macro-keyword", "%SUPERQ"], + ["macro-keyword", "%SYMDEL"], ["macro-keyword", "%SYMGLOBL"], + ["macro-keyword", "%SYMLOCAL"], ["macro-keyword", "%SYMEXIST"], + ["macro-keyword", "%SYSCALL"], ["macro-keyword", "%SYSEVALF"], + ["macro-keyword", "%SYSEXEC"], ["macro-keyword", "%SYSFUNC"], + ["macro-keyword", "%SYSGET"], ["macro-keyword", "%SYSRPUT"], + ["macro-keyword", "%THEN"], ["macro-keyword", "%TO"], ["macro-keyword", "%TSO"], + ["macro-keyword", "%UNQUOTE"], ["macro-keyword", "%UNTIL"], + ["macro-keyword", "%UPCASE"], ["macro-keyword", "%WHILE"], + ["macro-keyword", "%WINDOW"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/sas/number_feature.test b/package/src/prism/tests/languages/sas/number_feature.test new file mode 100644 index 00000000..8b9637de --- /dev/null +++ b/package/src/prism/tests/languages/sas/number_feature.test @@ -0,0 +1,31 @@ +42 +3.14159 +3.2e10 +0.4e-8 +1.4E+2 +BadFacex +0c1x +0b0ax + +"3132,3334"x +'3132,3334'x + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "3.2e10"], + ["number", "0.4e-8"], + ["number", "1.4E+2"], + "\nBadFacex\n", + ["number", "0c1x"], + ["number", "0b0ax"], + + ["numeric-constant", "\"3132,3334\"x"], + ["numeric-constant", "'3132,3334'x"] +] + +---------------------------------------------------- + +Checks for decimal and hexadecimal numbers. diff --git a/package/src/prism/tests/languages/sas/operator_feature.test b/package/src/prism/tests/languages/sas/operator_feature.test new file mode 100644 index 00000000..2a69bd84 --- /dev/null +++ b/package/src/prism/tests/languages/sas/operator_feature.test @@ -0,0 +1,36 @@ +* ** +| || +! !! +¦ ¦¦ +< <> <= +> >< >= +~ ~= +¬ ¬= +^ ^= += / + +- & + +eq ne gt lt +ge le in not + +---------------------------------------------------- + +[ + ["operator", "*"], ["operator", "**"], + ["operator", "|"], ["operator", "||"], + ["operator", "!"], ["operator", "!!"], + ["operator", "¦"], ["operator", "¦¦"], + ["operator", "<"], ["operator", "<>"], ["operator", "<="], + ["operator", ">"], ["operator", "><"], ["operator", ">="], + ["operator", "~"], ["operator", "~="], + ["operator", "¬"], ["operator", "¬="], + ["operator", "^"], ["operator", "^="], + ["operator", "="], ["operator", "/"], ["operator", "+"], + ["operator", "-"], ["operator", "&"], + ["operator-keyword", "eq"], ["operator-keyword", "ne"], ["operator-keyword", "gt"], ["operator-keyword", "lt"], + ["operator-keyword", "ge"], ["operator-keyword", "le"], ["operator-keyword", "in"], ["operator-keyword", "not"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/sas/options_feature.test b/package/src/prism/tests/languages/sas/options_feature.test new file mode 100644 index 00000000..420de545 --- /dev/null +++ b/package/src/prism/tests/languages/sas/options_feature.test @@ -0,0 +1,50 @@ +options nodate linesize=72; +options validmemname=extend validvarname=any; +options insert=(fmtsearch="c:/myformats"); + +---------------------------------------------------- + +[ + ["keyword", "options"], + [ + "options-args", + [ + ["arg","nodate"], + ["arg", "linesize"], + ["operator", "="], + ["number", "72"] + ] + ], + ["punctuation", ";"], + ["keyword", "options"], + [ + "options-args", + [ + ["arg", "validmemname"], + ["operator", "="], + ["arg-value", "extend"], + ["arg", "validvarname"], + ["operator", "="], + ["arg-value", "any"] + ] + ], + ["punctuation", ";"], + ["keyword", "options"], + [ + "options-args", + [ + ["arg", "insert"], + ["operator", "="], + ["punctuation", "("], + ["arg", "fmtsearch"], + ["operator", "="], + ["string", "\"c:/myformats\""], + ["punctuation", ")"] + ] + ], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks that options captures "options" and correctly tags following text. diff --git a/package/src/prism/tests/languages/sas/proccas_feature.test b/package/src/prism/tests/languages/sas/proccas_feature.test new file mode 100644 index 00000000..2e16bd09 --- /dev/null +++ b/package/src/prism/tests/languages/sas/proccas_feature.test @@ -0,0 +1,143 @@ +proc cas; + session casauto; + builtins.actionSetInfo result=results; + print results.setinfo[,{'actionset', 'label'}]; +run; +quit; + +proc cas; + /* Testing a comment */ + session casauto; + output log; + table.loadTable / path="iris.sashdat"; + simple.summary result=iris / table={name="iris"}; + tableIris=findtable(iris); + saveresult tableIris csv="sum.csv"; +run; +quit; + +proc cas; + action table.fileinfo / path="%.csv"; +run; +quit; + +---------------------------------------------------- + +[ + ["step", "proc cas"], + ["punctuation", ";"], + ["proc-cas", + [ + ["keyword", "session"], + " casauto", + ["punctuation", ";"], + ["cas-actions", [ + ["keyword", "builtins.actionSetInfo"], + ["argument", "result"], + ["operator", "="], + ["arg-value", "results"] + ] + ], + ["punctuation", ";"], + ["keyword", "print"], + " results", + ["punctuation", "."], + "setinfo", + ["punctuation", "["], + ["punctuation", ","], + ["punctuation", "{"], + ["string", "'actionset'"], + ["punctuation", ","], + ["string", "'label'"], + ["punctuation", "}"], + ["punctuation", "]"], + ["punctuation", ";"], + ["step", "run"], + ["punctuation", ";"] + ] + ], + ["step", "quit"], + ["punctuation", ";"], + ["step", "proc cas"], + ["punctuation", ";"], + ["proc-cas", + [ + ["comment", "/* Testing a comment */"], + ["keyword", "session"], + " casauto", + ["punctuation", ";"], + ["statement", [ + ["arg", "output"], + ["arg", "log"] + ]], + ["punctuation", ";"], + ["cas-actions", [ + ["keyword", "table.loadTable"], + " / ", + ["argument", "path"], + ["operator", "="], + ["string", "\"iris.sashdat\""] + ] + ], + ["punctuation", ";"], + ["cas-actions", [ + ["keyword", "simple.summary"], + ["argument", "result"], + ["operator", "="], + ["arg-value", "iris"], + " / ", + ["argument", "table"], + ["operator", "="], + ["punctuation", "{"], + ["argument", "name"], + ["operator", "="], + ["string", "\"iris\""], + ["punctuation", "}"] + ] + ], + ["punctuation", ";"], + "\n tableIris=", + ["function", "findtable"], + ["punctuation", "("], + "iris", + ["punctuation", ")"], + ["punctuation", ";"], + ["statement-var", [ + [ "statement", [ + ["keyword", "saveresult"], + " tableIris" + ] + ], + ["arg", "csv"], + ["operator", "="], + ["string", "\"sum.csv\""] + ]], + ["punctuation", ";"], + ["step", "run"], + ["punctuation", ";"] + ] + ], + ["step", "quit"], + ["punctuation", ";"], + ["step", "proc cas"], + ["punctuation", ";"], + ["proc-cas", + [ + ["cas-actions", + [ + ["action", "action"], + ["keyword", "table.fileinfo"], + " / ", + ["argument", "path"], + ["operator", "="], + ["string", "\"%.csv\""] + ] + ], + ["punctuation", ";"], + ["step", "run"], + ["punctuation", ";"] + ] + ], + ["step", "quit"], + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/sas/step_feature.test b/package/src/prism/tests/languages/sas/step_feature.test new file mode 100644 index 00000000..7ba8aa07 --- /dev/null +++ b/package/src/prism/tests/languages/sas/step_feature.test @@ -0,0 +1,30 @@ +data carsurvey; +proc format; +proc sort data=allacty; +run; +quit; + +---------------------------------------------------- + +[ + ["step", "data"], + " carsurvey", + ["punctuation", ";"], + ["step", "proc format"], + ["punctuation", ";"], + ["step", "proc sort"], + ["proc-args",[ + ["arg", "data"], + ["operator", "="], + ["arg-value", "allacty"], + ["punctuation", ";"] + ]], + ["step", "run"], + ["punctuation", ";"], + ["step", "quit"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks that options captures "options" and correctly tags following text. diff --git a/package/src/prism/tests/languages/sas/string_feature.test b/package/src/prism/tests/languages/sas/string_feature.test new file mode 100644 index 00000000..2ec246e8 --- /dev/null +++ b/package/src/prism/tests/languages/sas/string_feature.test @@ -0,0 +1,23 @@ +"" +"fo""o" +"foo +bar" +'' +'fo''o' +'foo +bar' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\"\"o\""], + ["string", "\"foo\nbar\""], + ["string", "''"], + ["string", "'fo''o'"], + ["string", "'foo\nbar'"] +] + +---------------------------------------------------- + +Checks for single-quoted and double-quoted strings. diff --git a/package/src/prism/tests/languages/sass/atrule-line_feature.test b/package/src/prism/tests/languages/sass/atrule-line_feature.test new file mode 100644 index 00000000..005015f0 --- /dev/null +++ b/package/src/prism/tests/languages/sass/atrule-line_feature.test @@ -0,0 +1,35 @@ +@mixin foobar +@media (min-width: 600px) + @include foobar + +=foobar ++foobar + +---------------------------------------------------- + +[ + ["atrule-line", [ + ["atrule", "@mixin"], + " foobar" + ]], + ["atrule-line", [ + ["atrule", "@media"], + " (min-width: 600px)" + ]], + ["atrule-line", [ + ["atrule", "@include"], + " foobar" + ]], + ["atrule-line", [ + ["atrule", "="], + "foobar" + ]], + ["atrule-line", [ + ["atrule", "+"], + "foobar" + ]] +] + +---------------------------------------------------- + +Checks for at-rules. \ No newline at end of file diff --git a/package/src/prism/tests/languages/sass/comment_feature.test b/package/src/prism/tests/languages/sass/comment_feature.test new file mode 100644 index 00000000..bdccb317 --- /dev/null +++ b/package/src/prism/tests/languages/sass/comment_feature.test @@ -0,0 +1,23 @@ +// +// foobar +/* +/* foo + bar + + /* foo + bar + baz + +---------------------------------------------------- + +[ + ["comment", "//"], + ["comment", "// foobar"], + ["comment", "/*"], + ["comment", "/* foo\n\tbar"], + ["comment", "/* foo\n\t bar\n\t baz"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/sass/property-line_feature.test b/package/src/prism/tests/languages/sass/property-line_feature.test new file mode 100644 index 00000000..2f41facc --- /dev/null +++ b/package/src/prism/tests/languages/sass/property-line_feature.test @@ -0,0 +1,47 @@ +foo: bar + color: $color !important +-moz-border-radius: 10px +transition-timing-function: ease-in-out + + :color #{$color} +:font-size 0.5em + 3em + +---------------------------------------------------- + +[ + ["property-line", [ + ["property", "foo"], + ["punctuation", ":"], + " bar" + ]], + ["property-line", [ + ["property", "color"], + ["punctuation", ":"], + ["variable", "$color"], + ["important", "!important"] + ]], + ["property-line", [ + ["property", "-moz-border-radius"], + ["punctuation", ":"], + " 10px" + ]], + ["property-line", [ + ["property", "transition-timing-function"], + ["punctuation", ":"], + " ease-in-out" + ]], + ["property-line", [ + ["punctuation", ":"], + ["property", "color"], + ["variable", "#{$color}"] + ]], + ["property-line", [ + ["punctuation", ":"], + ["property", "font-size"], + " 0.5em ", ["operator", "+"], " 3em" + ]] +] + +---------------------------------------------------- + +Checks for properties. \ No newline at end of file diff --git a/package/src/prism/tests/languages/sass/selector_feature.test b/package/src/prism/tests/languages/sass/selector_feature.test new file mode 100644 index 00000000..db4100cb --- /dev/null +++ b/package/src/prism/tests/languages/sass/selector_feature.test @@ -0,0 +1,24 @@ +div, span +.foo .bar + div +#foobar .baz:first-child + +div, + .bar + + #foo, + .bar, + .baz + +---------------------------------------------------- + +[ + ["selector", "div, span"], + ["selector", ".foo .bar + div"], + ["selector", "#foobar .baz:first-child"], + ["selector", "div,\n .bar"], + ["selector", "#foo,\n\t\t.bar,\n\t\t.baz"] +] + +---------------------------------------------------- + +Checks for selectors. \ No newline at end of file diff --git a/package/src/prism/tests/languages/sass/variable-line_feature.test b/package/src/prism/tests/languages/sass/variable-line_feature.test new file mode 100644 index 00000000..8e6ef9cc --- /dev/null +++ b/package/src/prism/tests/languages/sass/variable-line_feature.test @@ -0,0 +1,37 @@ +$width: 5em +$foo: $bar + $baz +$foo: $bar - $baz +$bar: #{$baz} + +---------------------------------------------------- + +[ + ["variable-line", [ + ["variable", "$width"], + ["punctuation", ":"], + " 5em" + ]], + ["variable-line", [ + ["variable", "$foo"], + ["punctuation", ":"], + ["variable", "$bar"], + ["operator", "+"], + ["variable", "$baz"] + ]], + ["variable-line", [ + ["variable", "$foo"], + ["punctuation", ":"], + ["variable", "$bar"], + ["operator", "-"], + ["variable", "$baz"] + ]], + ["variable-line", [ + ["variable", "$bar"], + ["punctuation", ":"], + ["variable", "#{$baz}"] + ]] +] + +---------------------------------------------------- + +Checks for variable declarations. diff --git a/package/src/prism/tests/languages/scala/builtin_feature.test b/package/src/prism/tests/languages/scala/builtin_feature.test new file mode 100644 index 00000000..52ab3f2b --- /dev/null +++ b/package/src/prism/tests/languages/scala/builtin_feature.test @@ -0,0 +1,17 @@ +String Int Long Short +Byte Boolean Double +Float Char Any AnyRef +AnyVal Unit Nothing + +---------------------------------------------------- + +[ + ["builtin", "String"], ["builtin", "Int"], ["builtin", "Long"], ["builtin", "Short"], + ["builtin", "Byte"], ["builtin", "Boolean"], ["builtin", "Double"], + ["builtin", "Float"], ["builtin", "Char"], ["builtin", "Any"], ["builtin", "AnyRef"], + ["builtin", "AnyVal"], ["builtin", "Unit"], ["builtin", "Nothing"] +] + +---------------------------------------------------- + +Checks for builtins. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scala/char_feature.test b/package/src/prism/tests/languages/scala/char_feature.test new file mode 100644 index 00000000..b409bcfd --- /dev/null +++ b/package/src/prism/tests/languages/scala/char_feature.test @@ -0,0 +1,13 @@ +'a' +'\u0041' +'\n' +'\t' + +---------------------------------------------------- + +[ + ["char", "'a'"], + ["char", "'\\u0041'"], + ["char", "'\\n'"], + ["char", "'\\t'"] +] diff --git a/package/src/prism/tests/languages/scala/keyword_feature.test b/package/src/prism/tests/languages/scala/keyword_feature.test new file mode 100644 index 00000000..d9138383 --- /dev/null +++ b/package/src/prism/tests/languages/scala/keyword_feature.test @@ -0,0 +1,91 @@ +<- => + +abstract case catch +class def derives do +else enum extends extension +final finally +for forSome given if +implicit import; +infix inline lazy +match new null object +opaque open +override package private +protected return sealed +self super this throw +trait transparent try +type using val +var while with yield + +---------------------------------------------------- + +[ + ["keyword", "<-"], ["keyword", "=>"], + + ["keyword", "abstract"], + ["keyword", "case"], + ["keyword", "catch"], + + ["keyword", "class"], + ["keyword", "def"], + ["keyword", "derives"], + ["keyword", "do"], + + ["keyword", "else"], + ["keyword", "enum"], + ["keyword", "extends"], + ["keyword", "extension"], + + ["keyword", "final"], + ["keyword", "finally"], + + ["keyword", "for"], + ["keyword", "forSome"], + ["keyword", "given"], + ["keyword", "if"], + + ["keyword", "implicit"], + ["keyword", "import"], + ["punctuation", ";"], + + ["keyword", "infix"], + ["keyword", "inline"], + ["keyword", "lazy"], + + ["keyword", "match"], + ["keyword", "new"], + ["keyword", "null"], + ["keyword", "object"], + + ["keyword", "opaque"], + ["keyword", "open"], + + ["namespace", ["override"]], + ["keyword", "package"], + ["keyword", "private"], + + ["keyword", "protected"], + ["keyword", "return"], + ["keyword", "sealed"], + + ["keyword", "self"], + ["keyword", "super"], + ["keyword", "this"], + ["keyword", "throw"], + + ["keyword", "trait"], + ["keyword", "transparent"], + ["keyword", "try"], + + ["keyword", "type"], + ["keyword", "using"], + ["keyword", "val"], + + ["keyword", "var"], + ["keyword", "while"], + ["keyword", "with"], + ["keyword", "yield"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/scala/number_feature.test b/package/src/prism/tests/languages/scala/number_feature.test new file mode 100644 index 00000000..f610ffc4 --- /dev/null +++ b/package/src/prism/tests/languages/scala/number_feature.test @@ -0,0 +1,27 @@ +0xBadFace +0xf7.fb +42 +3.14159 +3e4 +0.1E8 +42d +0777L +1e30f + +---------------------------------------------------- + +[ + ["number", "0xBadFace"], + ["number", "0xf7.fb"], + ["number", "42"], + ["number", "3.14159"], + ["number", "3e4"], + ["number", "0.1E8"], + ["number", "42d"], + ["number", "0777L"], + ["number", "1e30f"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scala/string_feature.test b/package/src/prism/tests/languages/scala/string_feature.test new file mode 100644 index 00000000..2eba4f35 --- /dev/null +++ b/package/src/prism/tests/languages/scala/string_feature.test @@ -0,0 +1,90 @@ +"" +"fo\"obar" + +"""fo"o +bar""" +"""fo"o +// comment +bar""" +"""{"name":"James"}""" +"foo /* comment */ bar" + +s"Hello, $name" +s"1 + 1 = ${1 + 1}" +s"New offers starting at $$14.99" +f"$name%s is $height%2.2f meters tall" +json"{ name: $name, id: $id }" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""], + + ["triple-quoted-string", "\"\"\"fo\"o\nbar\"\"\""], + ["triple-quoted-string", "\"\"\"fo\"o\n// comment\nbar\"\"\""], + ["triple-quoted-string", "\"\"\"{\"name\":\"James\"}\"\"\""], + ["string", "\"foo /* comment */ bar\""], + + ["string-interpolation", [ + ["id", "s"], + ["string", "\"Hello, "], + ["interpolation", [ + ["punctuation", "$"], + ["expression", ["name"]] + ]], + ["string", "\""] + ]], + ["string-interpolation", [ + ["id", "s"], + ["string", "\"1 + 1 = "], + ["interpolation", [ + ["punctuation", "${"], + ["expression", [ + ["number", "1"], + ["operator", "+"], + ["number", "1"] + ]], + ["punctuation", "}"] + ]], + ["string", "\""] + ]], + ["string-interpolation", [ + ["id", "s"], + ["string", "\"New offers starting at "], + ["escape", "$$"], + ["string", "14.99\""] + ]], + ["string-interpolation", [ + ["id", "f"], + ["string", "\""], + ["interpolation", [ + ["punctuation", "$"], + ["expression", ["name"]] + ]], + ["string", "%s is "], + ["interpolation", [ + ["punctuation", "$"], + ["expression", ["height"]] + ]], + ["string", "%2.2f meters tall\""] + ]], + ["string-interpolation", [ + ["id", "json"], + ["string", "\"{ name: "], + ["interpolation", [ + ["punctuation", "$"], + ["expression", ["name"]] + ]], + ["string", ", id: "], + ["interpolation", [ + ["punctuation", "$"], + ["expression", ["id"]] + ]], + ["string", " }\""] + ]] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/scala/symbol_feature.test b/package/src/prism/tests/languages/scala/symbol_feature.test new file mode 100644 index 00000000..d1a4baba --- /dev/null +++ b/package/src/prism/tests/languages/scala/symbol_feature.test @@ -0,0 +1,15 @@ +'foo +'foo_42 +'foo_bar + +---------------------------------------------------- + +[ + ["symbol", "'foo"], + ["symbol", "'foo_42"], + ["symbol", "'foo_bar"] +] + +---------------------------------------------------- + +Checks for symbols. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scheme/boolean_feature.test b/package/src/prism/tests/languages/scheme/boolean_feature.test new file mode 100644 index 00000000..06b45f6b --- /dev/null +++ b/package/src/prism/tests/languages/scheme/boolean_feature.test @@ -0,0 +1,17 @@ +#t +#f +#true +#false + +---------------------------------------------------- + +[ + ["boolean", "#t"], + ["boolean", "#f"], + ["boolean", "#true"], + ["boolean", "#false"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/scheme/builtin_feature.test b/package/src/prism/tests/languages/scheme/builtin_feature.test new file mode 100644 index 00000000..1f1ffb7e --- /dev/null +++ b/package/src/prism/tests/languages/scheme/builtin_feature.test @@ -0,0 +1,407 @@ +(abs +(and +(append +(apply +(assoc +(assq +(assv +(binary-port? +(boolean=? +(boolean? +(bytevector +(bytevector-append +(bytevector-copy +(bytevector-copy! +(bytevector-length +(bytevector-u8-ref +(bytevector-u8-set! +(bytevector? +(caar +(cadr +(call-with-current-continuation +(call-with-port +(call-with-values +(call/cc +(car +(cdar +(cddr +(cdr +(ceiling +(char->integer +(char-ready? +(char<=? +(char=? +(char>? +(char? +(close-input-port +(close-output-port +(close-port +(complex? +(cons +(current-error-port +(current-input-port +(current-output-port +(denominator +(dynamic-wind +(eof-object +(eof-object? +(eq? +(equal? +(eqv? +(error +(error-object-irritants +(error-object-message +(error-object? +(eval +(even? +(exact +(exact-integer-sqrt +(exact-integer? +(exact? +(expt +(features +(file-error? +(floor +(floor-quotient +(floor-remainder +(floor/ +(flush-output-port +(for-each +(gcd +(get-output-bytevector +(get-output-string +(inexact +(inexact? +(input-port-open? +(input-port? +(integer->char +(integer? +(lcm +(length +(list +(list->string +(list->vector +(list-copy +(list-ref +(list-set! +(list-tail +(list? +(make-bytevector +(make-list +(make-parameter +(make-string +(make-vector +(map +(max +(member +(memq +(memv +(min +(modulo +(negative? +(newline +(not +(null? +(number->string +(number? +(numerator +(odd? +(open-input-bytevector +(open-input-string +(open-output-bytevector +(open-output-string +(or +(output-port-open? +(output-port? +(pair? +(peek-char +(peek-u8 +(port? +(positive? +(procedure? +(quotient +(raise +(raise-continuable +(rational? +(rationalize +(read-bytevector +(read-bytevector! +(read-char +(read-error? +(read-line +(read-string +(read-u8 +(real? +(remainder +(reverse +(round +(set-car! +(set-cdr! +(square +(string +(string->list +(string->number +(string->symbol +(string->utf8 +(string->vector +(string-append +(string-copy +(string-copy! +(string-fill! +(string-for-each +(string-length +(string-map +(string-ref +(string-set! +(string<=? +(string=? +(string>? +(string? +(substring +(symbol->string +(symbol=? +(symbol? +(syntax-error +(textual-port? +(truncate +(truncate-quotient +(truncate-remainder +(truncate/ +(u8-ready? +(utf8->string +(values +(vector +(vector->list +(vector->string +(vector-append +(vector-copy +(vector-copy! +(vector-fill! +(vector-for-each +(vector-length +(vector-map +(vector-ref +(vector-set! +(vector? +(with-exception-handler +(write-bytevector +(write-char +(write-string +(write-u8 +(zero? + +; with brackets +[map +[max + +---------------------------------------------------- + +[ + ["punctuation", "("], ["builtin", "abs"], + ["punctuation", "("], ["builtin", "and"], + ["punctuation", "("], ["builtin", "append"], + ["punctuation", "("], ["builtin", "apply"], + ["punctuation", "("], ["builtin", "assoc"], + ["punctuation", "("], ["builtin", "assq"], + ["punctuation", "("], ["builtin", "assv"], + ["punctuation", "("], ["builtin", "binary-port?"], + ["punctuation", "("], ["builtin", "boolean=?"], + ["punctuation", "("], ["builtin", "boolean?"], + ["punctuation", "("], ["builtin", "bytevector"], + ["punctuation", "("], ["builtin", "bytevector-append"], + ["punctuation", "("], ["builtin", "bytevector-copy"], + ["punctuation", "("], ["builtin", "bytevector-copy!"], + ["punctuation", "("], ["builtin", "bytevector-length"], + ["punctuation", "("], ["builtin", "bytevector-u8-ref"], + ["punctuation", "("], ["builtin", "bytevector-u8-set!"], + ["punctuation", "("], ["builtin", "bytevector?"], + ["punctuation", "("], ["builtin", "caar"], + ["punctuation", "("], ["builtin", "cadr"], + ["punctuation", "("], ["builtin", "call-with-current-continuation"], + ["punctuation", "("], ["builtin", "call-with-port"], + ["punctuation", "("], ["builtin", "call-with-values"], + ["punctuation", "("], ["builtin", "call/cc"], + ["punctuation", "("], ["builtin", "car"], + ["punctuation", "("], ["builtin", "cdar"], + ["punctuation", "("], ["builtin", "cddr"], + ["punctuation", "("], ["builtin", "cdr"], + ["punctuation", "("], ["builtin", "ceiling"], + ["punctuation", "("], ["builtin", "char->integer"], + ["punctuation", "("], ["builtin", "char-ready?"], + ["punctuation", "("], ["builtin", "char<=?"], + ["punctuation", "("], ["builtin", "char=?"], + ["punctuation", "("], ["builtin", "char>?"], + ["punctuation", "("], ["builtin", "char?"], + ["punctuation", "("], ["builtin", "close-input-port"], + ["punctuation", "("], ["builtin", "close-output-port"], + ["punctuation", "("], ["builtin", "close-port"], + ["punctuation", "("], ["builtin", "complex?"], + ["punctuation", "("], ["builtin", "cons"], + ["punctuation", "("], ["builtin", "current-error-port"], + ["punctuation", "("], ["builtin", "current-input-port"], + ["punctuation", "("], ["builtin", "current-output-port"], + ["punctuation", "("], ["builtin", "denominator"], + ["punctuation", "("], ["builtin", "dynamic-wind"], + ["punctuation", "("], ["builtin", "eof-object"], + ["punctuation", "("], ["builtin", "eof-object?"], + ["punctuation", "("], ["builtin", "eq?"], + ["punctuation", "("], ["builtin", "equal?"], + ["punctuation", "("], ["builtin", "eqv?"], + ["punctuation", "("], ["builtin", "error"], + ["punctuation", "("], ["builtin", "error-object-irritants"], + ["punctuation", "("], ["builtin", "error-object-message"], + ["punctuation", "("], ["builtin", "error-object?"], + ["punctuation", "("], ["builtin", "eval"], + ["punctuation", "("], ["builtin", "even?"], + ["punctuation", "("], ["builtin", "exact"], + ["punctuation", "("], ["builtin", "exact-integer-sqrt"], + ["punctuation", "("], ["builtin", "exact-integer?"], + ["punctuation", "("], ["builtin", "exact?"], + ["punctuation", "("], ["builtin", "expt"], + ["punctuation", "("], ["builtin", "features"], + ["punctuation", "("], ["builtin", "file-error?"], + ["punctuation", "("], ["builtin", "floor"], + ["punctuation", "("], ["builtin", "floor-quotient"], + ["punctuation", "("], ["builtin", "floor-remainder"], + ["punctuation", "("], ["builtin", "floor/"], + ["punctuation", "("], ["builtin", "flush-output-port"], + ["punctuation", "("], ["builtin", "for-each"], + ["punctuation", "("], ["builtin", "gcd"], + ["punctuation", "("], ["builtin", "get-output-bytevector"], + ["punctuation", "("], ["builtin", "get-output-string"], + ["punctuation", "("], ["builtin", "inexact"], + ["punctuation", "("], ["builtin", "inexact?"], + ["punctuation", "("], ["builtin", "input-port-open?"], + ["punctuation", "("], ["builtin", "input-port?"], + ["punctuation", "("], ["builtin", "integer->char"], + ["punctuation", "("], ["builtin", "integer?"], + ["punctuation", "("], ["builtin", "lcm"], + ["punctuation", "("], ["builtin", "length"], + ["punctuation", "("], ["builtin", "list"], + ["punctuation", "("], ["builtin", "list->string"], + ["punctuation", "("], ["builtin", "list->vector"], + ["punctuation", "("], ["builtin", "list-copy"], + ["punctuation", "("], ["builtin", "list-ref"], + ["punctuation", "("], ["builtin", "list-set!"], + ["punctuation", "("], ["builtin", "list-tail"], + ["punctuation", "("], ["builtin", "list?"], + ["punctuation", "("], ["builtin", "make-bytevector"], + ["punctuation", "("], ["builtin", "make-list"], + ["punctuation", "("], ["builtin", "make-parameter"], + ["punctuation", "("], ["builtin", "make-string"], + ["punctuation", "("], ["builtin", "make-vector"], + ["punctuation", "("], ["builtin", "map"], + ["punctuation", "("], ["builtin", "max"], + ["punctuation", "("], ["builtin", "member"], + ["punctuation", "("], ["builtin", "memq"], + ["punctuation", "("], ["builtin", "memv"], + ["punctuation", "("], ["builtin", "min"], + ["punctuation", "("], ["builtin", "modulo"], + ["punctuation", "("], ["builtin", "negative?"], + ["punctuation", "("], ["builtin", "newline"], + ["punctuation", "("], ["builtin", "not"], + ["punctuation", "("], ["builtin", "null?"], + ["punctuation", "("], ["builtin", "number->string"], + ["punctuation", "("], ["builtin", "number?"], + ["punctuation", "("], ["builtin", "numerator"], + ["punctuation", "("], ["builtin", "odd?"], + ["punctuation", "("], ["builtin", "open-input-bytevector"], + ["punctuation", "("], ["builtin", "open-input-string"], + ["punctuation", "("], ["builtin", "open-output-bytevector"], + ["punctuation", "("], ["builtin", "open-output-string"], + ["punctuation", "("], ["builtin", "or"], + ["punctuation", "("], ["builtin", "output-port-open?"], + ["punctuation", "("], ["builtin", "output-port?"], + ["punctuation", "("], ["builtin", "pair?"], + ["punctuation", "("], ["builtin", "peek-char"], + ["punctuation", "("], ["builtin", "peek-u8"], + ["punctuation", "("], ["builtin", "port?"], + ["punctuation", "("], ["builtin", "positive?"], + ["punctuation", "("], ["builtin", "procedure?"], + ["punctuation", "("], ["builtin", "quotient"], + ["punctuation", "("], ["builtin", "raise"], + ["punctuation", "("], ["builtin", "raise-continuable"], + ["punctuation", "("], ["builtin", "rational?"], + ["punctuation", "("], ["builtin", "rationalize"], + ["punctuation", "("], ["builtin", "read-bytevector"], + ["punctuation", "("], ["builtin", "read-bytevector!"], + ["punctuation", "("], ["builtin", "read-char"], + ["punctuation", "("], ["builtin", "read-error?"], + ["punctuation", "("], ["builtin", "read-line"], + ["punctuation", "("], ["builtin", "read-string"], + ["punctuation", "("], ["builtin", "read-u8"], + ["punctuation", "("], ["builtin", "real?"], + ["punctuation", "("], ["builtin", "remainder"], + ["punctuation", "("], ["builtin", "reverse"], + ["punctuation", "("], ["builtin", "round"], + ["punctuation", "("], ["builtin", "set-car!"], + ["punctuation", "("], ["builtin", "set-cdr!"], + ["punctuation", "("], ["builtin", "square"], + ["punctuation", "("], ["builtin", "string"], + ["punctuation", "("], ["builtin", "string->list"], + ["punctuation", "("], ["builtin", "string->number"], + ["punctuation", "("], ["builtin", "string->symbol"], + ["punctuation", "("], ["builtin", "string->utf8"], + ["punctuation", "("], ["builtin", "string->vector"], + ["punctuation", "("], ["builtin", "string-append"], + ["punctuation", "("], ["builtin", "string-copy"], + ["punctuation", "("], ["builtin", "string-copy!"], + ["punctuation", "("], ["builtin", "string-fill!"], + ["punctuation", "("], ["builtin", "string-for-each"], + ["punctuation", "("], ["builtin", "string-length"], + ["punctuation", "("], ["builtin", "string-map"], + ["punctuation", "("], ["builtin", "string-ref"], + ["punctuation", "("], ["builtin", "string-set!"], + ["punctuation", "("], ["builtin", "string<=?"], + ["punctuation", "("], ["builtin", "string=?"], + ["punctuation", "("], ["builtin", "string>?"], + ["punctuation", "("], ["builtin", "string?"], + ["punctuation", "("], ["builtin", "substring"], + ["punctuation", "("], ["builtin", "symbol->string"], + ["punctuation", "("], ["builtin", "symbol=?"], + ["punctuation", "("], ["builtin", "symbol?"], + ["punctuation", "("], ["builtin", "syntax-error"], + ["punctuation", "("], ["builtin", "textual-port?"], + ["punctuation", "("], ["builtin", "truncate"], + ["punctuation", "("], ["builtin", "truncate-quotient"], + ["punctuation", "("], ["builtin", "truncate-remainder"], + ["punctuation", "("], ["builtin", "truncate/"], + ["punctuation", "("], ["builtin", "u8-ready?"], + ["punctuation", "("], ["builtin", "utf8->string"], + ["punctuation", "("], ["builtin", "values"], + ["punctuation", "("], ["builtin", "vector"], + ["punctuation", "("], ["builtin", "vector->list"], + ["punctuation", "("], ["builtin", "vector->string"], + ["punctuation", "("], ["builtin", "vector-append"], + ["punctuation", "("], ["builtin", "vector-copy"], + ["punctuation", "("], ["builtin", "vector-copy!"], + ["punctuation", "("], ["builtin", "vector-fill!"], + ["punctuation", "("], ["builtin", "vector-for-each"], + ["punctuation", "("], ["builtin", "vector-length"], + ["punctuation", "("], ["builtin", "vector-map"], + ["punctuation", "("], ["builtin", "vector-ref"], + ["punctuation", "("], ["builtin", "vector-set!"], + ["punctuation", "("], ["builtin", "vector?"], + ["punctuation", "("], ["builtin", "with-exception-handler"], + ["punctuation", "("], ["builtin", "write-bytevector"], + ["punctuation", "("], ["builtin", "write-char"], + ["punctuation", "("], ["builtin", "write-string"], + ["punctuation", "("], ["builtin", "write-u8"], + ["punctuation", "("], ["builtin", "zero?"], + + ["comment", "; with brackets"], + ["punctuation", "["], ["builtin", "map"], + ["punctuation", "["], ["builtin", "max"] +] + +---------------------------------------------------- + +Checks for builtins. diff --git a/package/src/prism/tests/languages/scheme/char_feature.test b/package/src/prism/tests/languages/scheme/char_feature.test new file mode 100644 index 00000000..799cf566 --- /dev/null +++ b/package/src/prism/tests/languages/scheme/char_feature.test @@ -0,0 +1,43 @@ +#\a ; lowercase letter +#\A ; uppercase letter +#\( ; left parenthesis +#\space ; the space character +#\newline ; the newline character + +#\c-a ; Control-a +#\meta-b ; Meta-b +#\c-s-m-h-a ; Control-Meta-Super-Hyper-A + +#\; #\' #\" + +#\u0041 +#\x10FFFF +#\λ +#\) +#\💩 + +---------------------------------------------------- + +[ + ["char", "#\\a"], ["comment", "; lowercase letter"], + ["char", "#\\A"], ["comment", "; uppercase letter"], + ["char", "#\\("], ["comment", "; left parenthesis"], + ["char", "#\\space"], ["comment", "; the space character"], + ["char", "#\\newline"], ["comment", "; the newline character"], + + ["char", "#\\c-a"], ["comment", "; Control-a"], + ["char", "#\\meta-b"], ["comment", "; Meta-b"], + ["char", "#\\c-s-m-h-a"], ["comment", "; Control-Meta-Super-Hyper-A"], + + ["char", "#\\;"], ["char", "#\\'"], ["char", "#\\\""], + + ["char", "#\\u0041"], + ["char", "#\\x10FFFF"], + ["char", "#\\λ"], + ["char", "#\\)"], + ["char", "#\\💩"] +] + +---------------------------------------------------- + +Checks for character literals. diff --git a/package/src/prism/tests/languages/scheme/comment_feature.test b/package/src/prism/tests/languages/scheme/comment_feature.test new file mode 100644 index 00000000..4be60d81 --- /dev/null +++ b/package/src/prism/tests/languages/scheme/comment_feature.test @@ -0,0 +1,30 @@ +; +; foobar + +#;(foo bar) +#; (foo) +#;[foo bar] +#; [foo] + +#| + comment + #| nested comment |# +|# + +---------------------------------------------------- + +[ + ["comment", ";"], + ["comment", "; foobar"], + + ["comment", "#;(foo bar)"], + ["comment", "#; (foo)"], + ["comment", "#;[foo bar]"], + ["comment", "#; [foo]"], + + ["comment", "#|\n comment\n #| nested comment |#\n|#"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/scheme/function_feature.test b/package/src/prism/tests/languages/scheme/function_feature.test new file mode 100644 index 00000000..b48b29f9 --- /dev/null +++ b/package/src/prism/tests/languages/scheme/function_feature.test @@ -0,0 +1,103 @@ +(fl= 1 2) +(flmin 2 3) +(inexact->exact 3) +(!fact) +(** 10) +(** +(defined foo) +(|some name| foo) + +[fl= 1 2] +[flmin 2 3] +[inexact->exact 3] +[!fact] +[** 10] +[** +[defined foo] +[|some name| foo] + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["function", "fl="], + ["number", "1"], + ["number", "2"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "flmin"], + ["number", "2"], + ["number", "3"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "inexact->exact"], + ["number", "3"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "!fact"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "**"], + ["number", "10"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "**"], + + ["punctuation", "("], + ["function", "defined"], + " foo", + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "|some name|"], + " foo", + ["punctuation", ")"], + + ["punctuation", "["], + ["function", "fl="], + ["number", "1"], + ["number", "2"], + ["punctuation", "]"], + + ["punctuation", "["], + ["function", "flmin"], + ["number", "2"], + ["number", "3"], + ["punctuation", "]"], + + ["punctuation", "["], + ["function", "inexact->exact"], + ["number", "3"], + ["punctuation", "]"], + + ["punctuation", "["], + ["function", "!fact"], + ["punctuation", "]"], + + ["punctuation", "["], + ["function", "**"], + ["number", "10"], + ["punctuation", "]"], + + ["punctuation", "["], + ["function", "**"], + + ["punctuation", "["], + ["function", "defined"], + " foo", + ["punctuation", "]"], + + ["punctuation", "["], + ["function", "|some name|"], + " foo", + ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for functions. diff --git a/package/src/prism/tests/languages/scheme/identifier_feature.test b/package/src/prism/tests/languages/scheme/identifier_feature.test new file mode 100644 index 00000000..520b689b --- /dev/null +++ b/package/src/prism/tests/languages/scheme/identifier_feature.test @@ -0,0 +1,7 @@ +|\x9;\x9;| + +---------------------------------------------------- + +[ + ["identifier", "|\\x9;\\x9;|"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/scheme/issue1331.test b/package/src/prism/tests/languages/scheme/issue1331.test new file mode 100644 index 00000000..3f0d1f4c --- /dev/null +++ b/package/src/prism/tests/languages/scheme/issue1331.test @@ -0,0 +1,12 @@ +(pair? '(1 2)) + +---------------------------------------------------- + +[ + ["punctuation", "("], ["builtin", "pair?"], + ["punctuation", "'"], ["punctuation", "("], ["number", "1"], ["number", "2"], ["punctuation", ")"], ["punctuation", ")"] +] + +---------------------------------------------------- + +Tests that first number of a list is not highlighted as a function. See #1331 diff --git a/package/src/prism/tests/languages/scheme/issue2609.test b/package/src/prism/tests/languages/scheme/issue2609.test new file mode 100644 index 00000000..46da83e0 --- /dev/null +++ b/package/src/prism/tests/languages/scheme/issue2609.test @@ -0,0 +1,30 @@ +'(foo bar baz) +`(foo bar baz) +#(foo bar baz) +'#(foo bar baz) + +---------------------------------------------------- + +[ + ["punctuation", "'"], + ["punctuation", "("], + "foo bar baz", + ["punctuation", ")"], + "\n`", + ["punctuation", "("], + "foo bar baz", + ["punctuation", ")"], + "\n#", + ["punctuation", "("], + "foo bar baz", + ["punctuation", ")"], + ["punctuation", "'"], + "#", + ["punctuation", "("], + "foo bar baz", + ["punctuation", ")"] +] + +---------------------------------------------------- + +None of the "foo"s are functions, so they shouldn't be highlighted as such. See #2609 for more details. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scheme/issue2811.test b/package/src/prism/tests/languages/scheme/issue2811.test new file mode 100644 index 00000000..553ab4c0 --- /dev/null +++ b/package/src/prism/tests/languages/scheme/issue2811.test @@ -0,0 +1,27 @@ +(let ([x 10] + [y 20]) + (+ x y)) + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["keyword", "let"], + ["punctuation", "("], + ["punctuation", "["], + ["function", "x"], + ["number", "10"], + ["punctuation", "]"], + + ["punctuation", "["], + ["function", "y"], + ["number", "20"], + ["punctuation", "]"], + ["punctuation", ")"], + + ["punctuation", "("], + ["operator", "+"], + " x y", + ["punctuation", ")"], + ["punctuation", ")"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/scheme/keyword_feature.test b/package/src/prism/tests/languages/scheme/keyword_feature.test new file mode 100644 index 00000000..2ea0c3ec --- /dev/null +++ b/package/src/prism/tests/languages/scheme/keyword_feature.test @@ -0,0 +1,258 @@ +(begin) +(case) +(case-lambda) +(cond) +(cond-expand) +(define-library) +(define-macro) +(define-record-type) +(define-syntax) +(define-values) +(define) +(defmacro) +(delay-force) +(delay) +(do) +(else) +(export) +(except) +(guard) +(if) +(import) +(include) +(include-ci) +(include-library-declarations) +(lambda) +(let-syntax) +(let-values) +(let) +(let*-values) +(let*) +(letrec-syntax) +(letrec-values) +(letrec) +(letrec*) +(only) +(parameterize) +(prefix) +(quasi-quote) +(quasiquote) +(quote) +(rename) +(set!) +(syntax-case) +(syntax-rules) +(unless) +(unquote) +(unquote-splicing) +(when) + +; with brackets + +[if] +[when] + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["keyword", "begin"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "case"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "case-lambda"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "cond"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "cond-expand"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "define-library"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "define-macro"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "define-record-type"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "define-syntax"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "define-values"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "define"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "defmacro"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "delay-force"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "delay"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "do"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "else"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "export"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "except"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "guard"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "if"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "import"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "include"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "include-ci"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "include-library-declarations"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "lambda"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "let-syntax"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "let-values"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "let"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "let*-values"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "let*"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "letrec-syntax"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "letrec-values"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "letrec"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "letrec*"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "only"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "parameterize"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "prefix"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "quasi-quote"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "quasiquote"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "quote"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "rename"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "set!"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "syntax-case"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "syntax-rules"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "unless"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "unquote"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "unquote-splicing"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "when"], + ["punctuation", ")"], + + ["comment", "; with brackets"], + + ["punctuation", "["], ["keyword", "if"], ["punctuation", "]"], + ["punctuation", "["], ["keyword", "when"], ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/scheme/lambda_parameter_feature.test b/package/src/prism/tests/languages/scheme/lambda_parameter_feature.test new file mode 100644 index 00000000..cf5bfe32 --- /dev/null +++ b/package/src/prism/tests/languages/scheme/lambda_parameter_feature.test @@ -0,0 +1,58 @@ +(lambda x x) + +(lambda |some name| |some name|) + +(lambda (x) x) + +(lambda (foo bar) (concat foo bar)) +(lambda [foo bar] (concat foo bar)) + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["keyword", "lambda"], + ["lambda-parameter", "x"], + " x", + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "lambda"], + ["lambda-parameter", "|some name|"], + ["identifier", "|some name|"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "lambda"], + ["punctuation", "("], + ["lambda-parameter", "x"], + ["punctuation", ")"], + " x", + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "lambda"], + ["punctuation", "("], + ["lambda-parameter", "foo bar"], + ["punctuation", ")"], + ["punctuation", "("], + ["function", "concat"], + " foo bar", + ["punctuation", ")"], + ["punctuation", ")"], + + ["punctuation", "("], + ["keyword", "lambda"], + ["punctuation", "["], + ["lambda-parameter", "foo bar"], + ["punctuation", "]"], + ["punctuation", "("], + ["function", "concat"], + " foo bar", + ["punctuation", ")"], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for lambda parameters. diff --git a/package/src/prism/tests/languages/scheme/number_feature.test b/package/src/prism/tests/languages/scheme/number_feature.test new file mode 100644 index 00000000..abc9903e --- /dev/null +++ b/package/src/prism/tests/languages/scheme/number_feature.test @@ -0,0 +1,147 @@ +123 + +(foo 42 +42 -42) +(foo 1e3 +1e3 -1e3) +(foo 1e+3 1e-3 3.14159 3.14159e-1) +(foo 8/3) +(foo 3+4i 2.5+0.0i 2.5+0.0i -2.5e4+0.0e4i 3+0i -2e-5i) +(list +10i -10i 10+10i 10.10+10.10i 10-10i 10+10e+10i) + +(list #d123 #e#d123e-4 #d#i12 #i-1.234i) + +(list #xBAD #b1110011 #o777) +(list #i#x10 #i#x10+10i #b10+10i) + +[list 123] + +10+i +10+.1i +10+1.i + +10.0E2 +10.0D2 +10.0L2 +10.0S2 +10.0F2 + +10.0e2 +10.0d2 +10.0l2 +10.0s2 +10.0f2 + +; not a number but a symbol +(define 1+2 10) + +(list 10.0P2 10.0g2 10.0w2) + +---------------------------------------------------- + +[ + ["number", "123"], + + ["punctuation", "("], + ["function", "foo"], + ["number", "42"], + ["number", "+42"], + ["number", "-42"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "foo"], + ["number", "1e3"], + ["number", "+1e3"], + ["number", "-1e3"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "foo"], + ["number", "1e+3"], + ["number", "1e-3"], + ["number", "3.14159"], + ["number", "3.14159e-1"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "foo"], + ["number", "8/3"], + ["punctuation", ")"], + + ["punctuation", "("], + ["function", "foo"], + ["number", "3+4i"], + ["number", "2.5+0.0i"], + ["number", "2.5+0.0i"], + ["number", "-2.5e4+0.0e4i"], + ["number", "3+0i"], + ["number", "-2e-5i"], + ["punctuation", ")"], + + ["punctuation", "("], + ["builtin", "list"], + ["number", "+10i"], + ["number", "-10i"], + ["number", "10+10i"], + ["number", "10.10+10.10i"], + ["number", "10-10i"], + ["number", "10+10e+10i"], + ["punctuation", ")"], + + ["punctuation", "("], + ["builtin", "list"], + ["number", "#d123"], + ["number", "#e#d123e-4"], + ["number", "#d#i12"], + ["number", "#i-1.234i"], + ["punctuation", ")"], + + ["punctuation", "("], + ["builtin", "list"], + ["number", "#xBAD"], + ["number", "#b1110011"], + ["number", "#o777"], + ["punctuation", ")"], + + ["punctuation", "("], + ["builtin", "list"], + ["number", "#i#x10"], + ["number", "#i#x10+10i"], + ["number", "#b10+10i"], + ["punctuation", ")"], + + ["punctuation", "["], ["builtin", "list"], ["number", "123"], ["punctuation", "]"], + + ["number", "10+i"], + ["number", "10+.1i"], + ["number", "10+1.i"], + + ["number", "10.0E2"], + ["number", "10.0D2"], + ["number", "10.0L2"], + ["number", "10.0S2"], + ["number", "10.0F2"], + + ["number", "10.0e2"], + ["number", "10.0d2"], + ["number", "10.0l2"], + ["number", "10.0s2"], + ["number", "10.0f2"], + + ["comment", "; not a number but a symbol"], + + ["punctuation", "("], + ["keyword", "define"], + " 1+2 ", + ["number", "10"], + ["punctuation", ")"], + + ["punctuation", "("], + ["builtin", "list"], + " 10.0P2 10.0g2 10.0w2", + ["punctuation", ")"] + +] + +---------------------------------------------------- + +Checks for numbers, rational numbers, and complex numbers. diff --git a/package/src/prism/tests/languages/scheme/operator_feature.test b/package/src/prism/tests/languages/scheme/operator_feature.test new file mode 100644 index 00000000..73cc36a0 --- /dev/null +++ b/package/src/prism/tests/languages/scheme/operator_feature.test @@ -0,0 +1,39 @@ +(+ +(- +(* +(/ +(% +(< +(<= +(> +(>= +(= +(=> + +; with brackets +[= +[=> + +---------------------------------------------------- + +[ + ["punctuation", "("], ["operator", "+"], + ["punctuation", "("], ["operator", "-"], + ["punctuation", "("], ["operator", "*"], + ["punctuation", "("], ["operator", "/"], + ["punctuation", "("], ["operator", "%"], + ["punctuation", "("], ["operator", "<"], + ["punctuation", "("], ["operator", "<="], + ["punctuation", "("], ["operator", ">"], + ["punctuation", "("], ["operator", ">="], + ["punctuation", "("], ["operator", "="], + ["punctuation", "("], ["operator", "=>"], + + ["comment", "; with brackets"], + ["punctuation", "["], ["operator", "="], + ["punctuation", "["], ["operator", "=>"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/scheme/string_feature.test b/package/src/prism/tests/languages/scheme/string_feature.test new file mode 100644 index 00000000..7a61a9e0 --- /dev/null +++ b/package/src/prism/tests/languages/scheme/string_feature.test @@ -0,0 +1,18 @@ +"" +"fo\"obar" +" +multi +line +" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""], + ["string", "\"\nmulti\nline\n\""] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/scheme/symbol_feature.test b/package/src/prism/tests/languages/scheme/symbol_feature.test new file mode 100644 index 00000000..ccf371a5 --- /dev/null +++ b/package/src/prism/tests/languages/scheme/symbol_feature.test @@ -0,0 +1,13 @@ +'turkey +(define a 'foo) + +---------------------------------------------------- + +[ + ["symbol", "'turkey"], + ["punctuation", "("], ["keyword", "define"], " a ", ["symbol","'foo"], ["punctuation",")"] +] + +---------------------------------------------------- + +Checks for symbols. diff --git a/package/src/prism/tests/languages/scss+haml/scss_inclusion.test b/package/src/prism/tests/languages/scss+haml/scss_inclusion.test new file mode 100644 index 00000000..9b2b9d96 --- /dev/null +++ b/package/src/prism/tests/languages/scss+haml/scss_inclusion.test @@ -0,0 +1,50 @@ +:scss + #main { + width: $width; + } + +~ + :scss + #main { + width: $width; + } + +---------------------------------------------------- + +[ + ["filter-scss", [ + ["filter-name", ":scss"], + ["text", [ + ["selector", ["#main "]], + ["punctuation", "{"], + + ["property", ["width"]], + ["punctuation", ":"], + ["variable", "$width"], + ["punctuation", ";"], + + ["punctuation", "}"] + ]] + ]], + + ["punctuation", "~"], + + ["filter-scss", [ + ["filter-name", ":scss"], + ["text", [ + ["selector", ["#main "]], + ["punctuation", "{"], + + ["property", ["width"]], + ["punctuation", ":"], + ["variable", "$width"], + ["punctuation", ";"], + + ["punctuation", "}"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for CSS filter in Haml. The tilde serves only as a separator. diff --git a/package/src/prism/tests/languages/scss+pug/scss_inclusion.test b/package/src/prism/tests/languages/scss+pug/scss_inclusion.test new file mode 100644 index 00000000..bf75c674 --- /dev/null +++ b/package/src/prism/tests/languages/scss+pug/scss_inclusion.test @@ -0,0 +1,19 @@ +:sass + @extend .foo; + +---------------------------------------------------- + +[ + ["filter-sass", [ + ["filter-name", ":sass"], + ["text", [ + ["keyword", "@extend"], + " .foo", + ["punctuation", ";"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for sass filter (Scss) in pug. diff --git a/package/src/prism/tests/languages/scss/atrule_feature.test b/package/src/prism/tests/languages/scss/atrule_feature.test new file mode 100644 index 00000000..529b8afd --- /dev/null +++ b/package/src/prism/tests/languages/scss/atrule_feature.test @@ -0,0 +1,20 @@ +@media (min-width: 600px) {} + +---------------------------------------------------- + +[ + ["atrule", [ + ["rule", "@media"], + ["punctuation", "("], + ["property", ["min-width"]], + ["punctuation", ":"], + " 600px", + ["punctuation", ")"] + ]], + ["punctuation", "{"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for at-rules. diff --git a/package/src/prism/tests/languages/scss/boolean_feature.test b/package/src/prism/tests/languages/scss/boolean_feature.test new file mode 100644 index 00000000..a40f8d95 --- /dev/null +++ b/package/src/prism/tests/languages/scss/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scss/comment_feature.test b/package/src/prism/tests/languages/scss/comment_feature.test new file mode 100644 index 00000000..33d04e92 --- /dev/null +++ b/package/src/prism/tests/languages/scss/comment_feature.test @@ -0,0 +1,19 @@ +// +// foobar +/**/ +/* foo +bar */ + + +---------------------------------------------------- + +[ + ["comment", "//"], + ["comment", "// foobar"], + ["comment", "/**/"], + ["comment", "/* foo\nbar */"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scss/keyword_feature.test b/package/src/prism/tests/languages/scss/keyword_feature.test new file mode 100644 index 00000000..179f71f9 --- /dev/null +++ b/package/src/prism/tests/languages/scss/keyword_feature.test @@ -0,0 +1,28 @@ +@if @else if @else +@for @each @while +@import @extend @use @forward +@debug @warn @mixin +@include @function +@return @content + +@for $i from 1 through 3 + +---------------------------------------------------- + +[ + ["keyword", "@if"], ["keyword", "@else if"], ["keyword", "@else"], + ["keyword", "@for"], ["keyword", "@each"], ["keyword", "@while"], + ["keyword", "@import"], ["keyword", "@extend"], ["keyword", "@use"], ["keyword", "@forward"], + ["keyword", "@debug"], ["keyword", "@warn"], ["keyword", "@mixin"], + ["keyword", "@include"], ["keyword", "@function"], + ["keyword", "@return"], ["keyword", "@content"], + + ["keyword", "@for"], + ["variable", "$i"], + ["keyword", "from"], + " 1 ", + ["keyword", "through"], + " 3" +] + +---------------------------------------------------- diff --git a/package/src/prism/tests/languages/scss/module-modifier_feature.test b/package/src/prism/tests/languages/scss/module-modifier_feature.test new file mode 100644 index 00000000..531852d7 --- /dev/null +++ b/package/src/prism/tests/languages/scss/module-modifier_feature.test @@ -0,0 +1,17 @@ +@use "foo" as bar; +@use "foo" with ($color: blue); +@forward "foo" show bar; +@forward "foo" hide baz; + +---------------------------------------------------- + +[ + ["keyword", "@use"], ["string", "\"foo\""], ["module-modifier", "as"], " bar", ["punctuation", ";"], + ["keyword", "@use"], ["string", "\"foo\""], ["module-modifier", "with"], ["punctuation", "("], ["property", [["variable", "$color"]]], ["punctuation", ":"], " blue", ["punctuation", ")"], ["punctuation", ";"], + ["keyword", "@forward"], ["string", "\"foo\""], ["module-modifier", "show"], " bar", ["punctuation", ";"], + ["keyword", "@forward"], ["string", "\"foo\""], ["module-modifier", "hide"], " baz", ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for Sass module modifiers diff --git a/package/src/prism/tests/languages/scss/null_feature.test b/package/src/prism/tests/languages/scss/null_feature.test new file mode 100644 index 00000000..00062049 --- /dev/null +++ b/package/src/prism/tests/languages/scss/null_feature.test @@ -0,0 +1,11 @@ +null + +---------------------------------------------------- + +[ + ["null", "null"] +] + +---------------------------------------------------- + +Checks for null. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scss/operator_feature.test b/package/src/prism/tests/languages/scss/operator_feature.test new file mode 100644 index 00000000..27d768f0 --- /dev/null +++ b/package/src/prism/tests/languages/scss/operator_feature.test @@ -0,0 +1,38 @@ +4 - 2; +4 + 2; +4 * 2; +4 / 2; +4 % 2; +4 == 2; +4 != 2; +4 < 2; +4 <= 2; +4 > 2; +4 >= 2; +true and false +false or true +not true + +---------------------------------------------------- + +[ + "4 ", ["operator", "-"], " 2", ["punctuation", ";"], + "\n4 ", ["operator", "+"], " 2", ["punctuation", ";"], + "\n4 ", ["operator", "*"], " 2", ["punctuation", ";"], + "\n4 ", ["operator", "/"], " 2", ["punctuation", ";"], + "\n4 ", ["operator", "%"], " 2", ["punctuation", ";"], + "\n4 ", ["operator", "=="], " 2", ["punctuation", ";"], + "\n4 ", ["operator", "!="], " 2", ["punctuation", ";"], + "\n4 ", ["operator", "<"], " 2", ["punctuation", ";"], + "\n4 ", ["operator", "<="], " 2", ["punctuation", ";"], + "\n4 ", ["operator", ">"], " 2", ["punctuation", ";"], + "\n4 ", ["operator", ">="], " 2", ["punctuation", ";"], + + ["boolean", "true"], ["operator", "and"], ["boolean", "false"], + ["boolean", "false"], ["operator", "or"], ["boolean", "true"], + ["operator", "not"], ["boolean", "true"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scss/placeholder_feature.test b/package/src/prism/tests/languages/scss/placeholder_feature.test new file mode 100644 index 00000000..93406023 --- /dev/null +++ b/package/src/prism/tests/languages/scss/placeholder_feature.test @@ -0,0 +1,15 @@ +%foobar +%foo-bar +%foo_bar + +---------------------------------------------------- + +[ + ["placeholder", "%foobar"], + ["placeholder", "%foo-bar"], + ["placeholder", "%foo_bar"] +] + +---------------------------------------------------- + +Checks for placeholders. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scss/property_feature.test b/package/src/prism/tests/languages/scss/property_feature.test new file mode 100644 index 00000000..7e8e6a3d --- /dev/null +++ b/package/src/prism/tests/languages/scss/property_feature.test @@ -0,0 +1,23 @@ +$bg: background; +$color: color; +div { + $bg: none; + background-#{$color}: blue; + #{$bg}-repeat: no-repeat; +} + +---------------------------------------------------- + +[ + ["property", [["variable", "$bg"]]], ["punctuation", ":"], " background", ["punctuation", ";"], + ["property", [["variable", "$color"]]], ["punctuation", ":"], " color", ["punctuation", ";"], + ["selector", ["div "]], ["punctuation", "{"], + ["property", [["variable", "$bg"]]], ["punctuation", ":"], " none", ["punctuation", ";"], + ["property", ["background-", ["variable", "#{$color}"]]], ["punctuation", ":"], " blue", ["punctuation", ";"], + ["property", [["variable", "#{$bg}"], "-repeat"]], ["punctuation", ":"], " no-repeat", ["punctuation", ";"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for properties. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scss/selector_feature.test b/package/src/prism/tests/languages/scss/selector_feature.test new file mode 100644 index 00000000..52faa4a0 --- /dev/null +++ b/package/src/prism/tests/languages/scss/selector_feature.test @@ -0,0 +1,23 @@ +a {} +p, div {} +#foobar .foo {} +&:hover {} +&-sidebar {} +#context a%extreme {} +#{$selector}:before {} + +---------------------------------------------------- + +[ + ["selector", ["a "]], ["punctuation", "{"], ["punctuation", "}"], + ["selector", ["p, div "]], ["punctuation", "{"], ["punctuation", "}"], + ["selector", ["#foobar .foo "]], ["punctuation", "{"], ["punctuation", "}"], + ["selector", [["parent", "&"], ":hover "]], ["punctuation", "{"], ["punctuation", "}"], + ["selector", [["parent", "&"], "-sidebar "]], ["punctuation", "{"], ["punctuation", "}"], + ["selector", ["#context a", ["placeholder", "%extreme"]]], ["punctuation", "{"], ["punctuation", "}"], + ["selector", [["variable", "#{$selector}"], ":before "]], ["punctuation", "{"], ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for selectors. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scss/statement_feature.test b/package/src/prism/tests/languages/scss/statement_feature.test new file mode 100644 index 00000000..001d2c72 --- /dev/null +++ b/package/src/prism/tests/languages/scss/statement_feature.test @@ -0,0 +1,21 @@ +$foo: "bar" !default; +@extend .baz !optional; + +---------------------------------------------------- + +[ + ["property", [["variable", "$foo"]]], + ["punctuation", ":"], + ["string", "\"bar\""], + ["statement", "!default"], + ["punctuation", ";"], + + ["keyword", "@extend"], + " .baz ", + ["statement", "!optional"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for statements. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scss/url_feature.test b/package/src/prism/tests/languages/scss/url_feature.test new file mode 100644 index 00000000..eb1c4058 --- /dev/null +++ b/package/src/prism/tests/languages/scss/url_feature.test @@ -0,0 +1,19 @@ +url('foo.png') +font-url('foo.ttf') + +---------------------------------------------------- + +[ + ["url", "url"], + ["punctuation", "("], + ["string", "'foo.png'"], + ["punctuation", ")"], + ["url", "font-url"], + ["punctuation", "("], + ["string", "'foo.ttf'"], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for URLs. \ No newline at end of file diff --git a/package/src/prism/tests/languages/scss/variable_feature.test b/package/src/prism/tests/languages/scss/variable_feature.test new file mode 100644 index 00000000..b4834657 --- /dev/null +++ b/package/src/prism/tests/languages/scss/variable_feature.test @@ -0,0 +1,21 @@ +$foo +$foo-bar +$foo_bar +#{$foo} +#{$foo-bar} +#{$foo_bar} + +---------------------------------------------------- + +[ + ["variable", "$foo"], + ["variable", "$foo-bar"], + ["variable", "$foo_bar"], + ["variable", "#{$foo}"], + ["variable", "#{$foo-bar}"], + ["variable", "#{$foo_bar}"] +] + +---------------------------------------------------- + +Checks for variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/shell-session/command_feature.test b/package/src/prism/tests/languages/shell-session/command_feature.test new file mode 100644 index 00000000..66c64df4 --- /dev/null +++ b/package/src/prism/tests/languages/shell-session/command_feature.test @@ -0,0 +1,44 @@ +$ git checkout master +Switched to branch 'master' +Your branch is up-to-date with 'origin/master'. +$ git push +Everything up-to-date +# echo "root" +root + +---------------------------------------------------- + +[ + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["function", "git"], + " checkout master" + ]] + ]], + ["output", "Switched to branch 'master'\nYour branch is up-to-date with 'origin/master'.\n"], + + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["function", "git"], + " push" + ]] + ]], + ["output", "Everything up-to-date\n"], + + ["command", [ + ["shell-symbol", "#"], + ["bash", [ + ["builtin", "echo"], + ["string", [ + "\"root\"" + ]] + ]] + ]], + ["output", "root"] +] + +---------------------------------------------------- + +Checks for commands. diff --git a/package/src/prism/tests/languages/shell-session/command_string_feature.test b/package/src/prism/tests/languages/shell-session/command_string_feature.test new file mode 100644 index 00000000..17d0b471 --- /dev/null +++ b/package/src/prism/tests/languages/shell-session/command_string_feature.test @@ -0,0 +1,115 @@ +$ echo 'Foo +> Bar' + +$ echo "Foo +> Bar" + +$ echo <<- STRING_END +foo +bar +STRING_END + +$ echo <<- "STRING_END" +foo +bar +STRING_END + +$ echo \'a # ' + +$ cat << "EOF" > /etc/ipsec.secrets +: RSA vpn-server-a.key +# : RSA vpn-server-b.key +EOF + +$ LC_ALL=C tr -cd 'a-zA-Z0-9_-;:!?.@\\*/#%$' < /dev/random | head -c 8 +y_#!$U48 + +---------------------------------------------------- + +[ + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["builtin", "echo"], + ["string", "'Foo\n> Bar'"] + ]] + ]], + + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["builtin", "echo"], + ["string", ["\"Foo\n> Bar\""]] + ]] + ]], + + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["builtin", "echo"], + ["operator", ["<<-"]], + ["string", ["STRING_END\nfoo\nbar\nSTRING_END"]] + ]] + ]], + + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["builtin", "echo"], + ["operator", ["<<-"]], + ["string", ["\"STRING_END\"\nfoo\nbar\nSTRING_END"]] + ]] + ]], + + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["builtin", "echo"], + ["punctuation", "\\"], + "'a ", + ["comment", "# '"] + ]] + ]], + + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["function", "cat"], + ["operator", ["<<"]], + ["string", [ + "\"EOF\"", + ["bash", [ + ["operator", [">"]], + " /etc/ipsec.secrets" + ]], + + "\n: RSA vpn-server-a.key\n# : RSA vpn-server-b.key\nEOF" + ]] + ]] + ]], + + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["assign-left", [ + ["environment", "LC_ALL"] + ]], + ["operator", ["="]], + "C ", + ["function", "tr"], + ["parameter", "-cd"], + ["string", "'a-zA-Z0-9_-;:!?.@\\\\*/#%$'"], + ["operator", ["<"]], + " /dev/random ", + ["operator", ["|"]], + ["function", "head"], + ["parameter", "-c"], + ["number", "8"] + ]] + ]], + ["output", "y_#!$U48"] +] + +---------------------------------------------------- + +Checks for multi-line strings inside commands. diff --git a/package/src/prism/tests/languages/shell-session/info_feature.test b/package/src/prism/tests/languages/shell-session/info_feature.test new file mode 100644 index 00000000..dd2451ce --- /dev/null +++ b/package/src/prism/tests/languages/shell-session/info_feature.test @@ -0,0 +1,77 @@ +foo@bar:/var/local$ cd ~ +foo@bar:~$ sudo -i +[sudo] password for foo: +root@bar:~# echo "hello!" +hello! + +foo@bar$ zsh +foo@bar% exit + +---------------------------------------------------- + +[ + ["command", [ + ["info", [ + ["user", "foo@bar"], + ["punctuation", ":"], + ["path", "/var/local"] + ]], + ["shell-symbol", "$"], + ["bash", [ + ["builtin", "cd"], + " ~" + ]] + ]], + + ["command", [ + ["info", [ + ["user", "foo@bar"], + ["punctuation", ":"], + ["path", "~"] + ]], + ["shell-symbol", "$"], + ["bash", [ + ["function", "sudo"], + ["parameter", "-i"] + ]] + ]], + + ["output", "[sudo] password for foo:\n"], + ["command", [ + ["info", [ + ["user", "root@bar"], + ["punctuation", ":"], + ["path", "~"] + ]], + ["shell-symbol", "#"], + ["bash", [ + ["builtin", "echo"], + ["string", ["\"hello!\""]] + ]] + ]], + + ["output", "hello!\n\n"], + ["command", [ + ["info", [ + ["user", "foo@bar"] + ]], + ["shell-symbol", "$"], + ["bash", [ + ["function", "zsh"] + ]] + ]], + + ["command", [ + ["info", [ + ["user", "foo@bar"] + ]], + ["shell-symbol", "%"], + ["bash", [ + ["builtin", "exit"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for the info bash outputs. \ No newline at end of file diff --git a/package/src/prism/tests/languages/shell-session/issue2644.test b/package/src/prism/tests/languages/shell-session/issue2644.test new file mode 100644 index 00000000..c9963798 --- /dev/null +++ b/package/src/prism/tests/languages/shell-session/issue2644.test @@ -0,0 +1,56 @@ +$ export BORG_PASSCOMMAND="security find-generic-password -a $USER -s borg-passphrase -w" +$ export BORG_RSH="ssh -i ~/.ssh/borg" +$ borg init --encryption=keyfile-blake2 "borg@1.2.3.4:backup" + +By default repositories initialized with this version will produce security +errors if written to with an older version (up to and including Borg 1.0.8). + +If you want to use these older versions, you can disable the check by running: +borg upgrade --disable-tam ssh://borg@1.2.3.4/./backup + +See https://borgbackup.readthedocs.io/en/stable/changes.html#pre-1-0-9-manifest-spoofing-vulnerability for details about the security implications. + +IMPORTANT: you will need both KEY AND PASSPHRASE to access this repo! +Use "borg key export" to export the key, optionally in printable format. +Write down the passphrase. Store both at safe place(s). + +--- + +---------------------------------------------------- + +[ + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["builtin", "export"], + ["assign-left", ["BORG_PASSCOMMAND"]], + ["operator", ["="]], + ["string", [ + "\"security find-generic-password -a ", + ["environment", "$USER"], + " -s borg-passphrase -w\"" + ]] + ]] + ]], + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["builtin", "export"], + ["assign-left", ["BORG_RSH"]], + ["operator", ["="]], + ["string", ["\"ssh -i ~/.ssh/borg\""]] + ]] + ]], + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + "borg init ", + ["parameter", "--encryption"], + ["operator", ["="]], + "keyfile-blake2 ", + ["string", ["\"borg@1.2.3.4:backup\""]] + ]] + ]], + + ["output", "By default repositories initialized with this version will produce security\nerrors if written to with an older version (up to and including Borg 1.0.8).\n\nIf you want to use these older versions, you can disable the check by running:\nborg upgrade --disable-tam ssh://borg@1.2.3.4/./backup\n\nSee https://borgbackup.readthedocs.io/en/stable/changes.html#pre-1-0-9-manifest-spoofing-vulnerability for details about the security implications.\n\nIMPORTANT: you will need both KEY AND PASSPHRASE to access this repo!\nUse \"borg key export\" to export the key, optionally in printable format.\nWrite down the passphrase. Store both at safe place(s).\n\n---"] +] diff --git a/package/src/prism/tests/languages/shell-session/issue2685.test b/package/src/prism/tests/languages/shell-session/issue2685.test new file mode 100644 index 00000000..7140ea52 --- /dev/null +++ b/package/src/prism/tests/languages/shell-session/issue2685.test @@ -0,0 +1,29 @@ +/home/user$ echo "Hello World" +Hello World +/home/user$ exit + +---------------------------------------------------- + +[ + ["command", [ + ["info", [ + ["path", "/home/user"] + ]], + ["shell-symbol", "$"], + ["bash", [ + ["builtin", "echo"], + ["string", ["\"Hello World\""]] + ]] + ]], + + ["output", "Hello World\n"], + ["command", [ + ["info", [ + ["path", "/home/user"] + ]], + ["shell-symbol", "$"], + ["bash", [ + ["builtin", "exit"] + ]] + ]] +] diff --git a/package/src/prism/tests/languages/shell-session/issue2871.test b/package/src/prism/tests/languages/shell-session/issue2871.test new file mode 100644 index 00000000..a64e39f7 --- /dev/null +++ b/package/src/prism/tests/languages/shell-session/issue2871.test @@ -0,0 +1,30 @@ +fyu@home $ sudo ls -l ~/.config 's' && \ + echo 'hello' +drwxr-xr-x - franklinyu 26 Sep 2020 asciinema +drwxr-xr-x - franklinyu 26 Jan 2020 'bash' +hello + +---------------------------------------------------- + +[ + ["command", [ + ["info", [ + ["user", "fyu@home "] + ]], + ["shell-symbol", "$"], + ["bash", [ + ["function", "sudo"], + ["function", "ls"], + ["parameter", "-l"], + " ~/.config ", + ["string", "'s'"], + ["operator", ["&&"]], + ["punctuation", "\\"], + + ["builtin", "echo"], + ["string", "'hello'"] + ]] + ]], + + ["output", "drwxr-xr-x - franklinyu 26 Sep 2020 asciinema\ndrwxr-xr-x - franklinyu 26 Jan 2020 'bash'\nhello"] +] diff --git a/package/src/prism/tests/languages/shell-session/issue3047_1.test b/package/src/prism/tests/languages/shell-session/issue3047_1.test new file mode 100644 index 00000000..79c4f64f --- /dev/null +++ b/package/src/prism/tests/languages/shell-session/issue3047_1.test @@ -0,0 +1,96 @@ +$ diskutil list +/dev/disk0 (internal, physical): + #: TYPE NAME SIZE IDENTIFIER + 0: GUID_partition_scheme *500.3 GB disk0 + 1: EFI EFI 209.7 MB disk0s1 + 2: Apple_APFS Container disk1 500.1 GB disk0s2 + +/dev/disk1 (synthesized): + #: TYPE NAME SIZE IDENTIFIER + 0: APFS Container Scheme - +500.1 GB disk1 + Physical Store disk0s2 + 1: APFS Volume Macintosh HD - Data 340.9 GB disk1s1 + 2: APFS Volume Preboot 85.9 MB disk1s2 + 3: APFS Volume Recovery 529.0 MB disk1s3 + 4: APFS Volume VM 3.2 GB disk1s4 + 5: APFS Volume Macintosh HD 11.3 GB disk1s5 + +/dev/disk2 (internal, physical): + #: TYPE NAME SIZE IDENTIFIER + 0: FDisk_partition_scheme *15.9 GB disk2 + 1: Windows_FAT_32 boot 268.4 MB disk2s1 + 2: Linux 15.7 GB disk2s2 + +$ sudo diskutil unmount /dev/diskn +disk2 was already unmounted or it has a partitioning scheme so use "diskutil unmountDisk" instead + +$ sudo diskutil unmountDisk /dev/diskn (if previous step fails) +Unmount of all volumes on disk2 was successful + +$ sudo dd bs=1m if=$HOME/Downloads/tails-amd64-4.18.img of=/dev/rdiskn +1131+0 records in +1131+0 records out +1185939456 bytes transferred in 44.708618 secs (26525970 bytes/sec) + +$ sudo diskutil unmountDisk /dev/diskn +Unmount of all volumes on disk2 was successful + +---------------------------------------------------- + +[ + ["command", [ + ["shell-symbol", "$"], + ["bash", ["diskutil list"]] + ]], + + ["output", "/dev/disk0 (internal, physical):\n #: TYPE NAME SIZE IDENTIFIER\n 0: GUID_partition_scheme *500.3 GB disk0\n 1: EFI EFI 209.7 MB disk0s1\n 2: Apple_APFS Container disk1 500.1 GB disk0s2\n\n/dev/disk1 (synthesized):\n #: TYPE NAME SIZE IDENTIFIER\n 0: APFS Container Scheme - +500.1 GB disk1\n Physical Store disk0s2\n 1: APFS Volume Macintosh HD - Data 340.9 GB disk1s1\n 2: APFS Volume Preboot 85.9 MB disk1s2\n 3: APFS Volume Recovery 529.0 MB disk1s3\n 4: APFS Volume VM 3.2 GB disk1s4\n 5: APFS Volume Macintosh HD 11.3 GB disk1s5\n\n/dev/disk2 (internal, physical):\n #: TYPE NAME SIZE IDENTIFIER\n 0: FDisk_partition_scheme *15.9 GB disk2\n 1: Windows_FAT_32 boot 268.4 MB disk2s1\n 2: Linux 15.7 GB disk2s2\n\n"], + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["function", "sudo"], + " diskutil unmount /dev/diskn" + ]] + ]], + + ["output", "disk2 was already unmounted or it has a partitioning scheme so use \"diskutil unmountDisk\" instead\n\n"], + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["function", "sudo"], + " diskutil unmountDisk /dev/diskn ", + ["punctuation", "("], + "if previous step fails", + ["punctuation", ")"] + ]] + ]], + + ["output", "Unmount of all volumes on disk2 was successful\n\n"], + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["function", "sudo"], + ["function", "dd"], + ["assign-left", ["bs"]], + ["operator", ["="]], + "1m ", + ["assign-left", ["if"]], + ["operator", ["="]], + ["environment", "$HOME"], + "/Downloads/tails-amd64-4.18.img ", + ["assign-left", ["of"]], + ["operator", ["="]], + "/dev/rdiskn" + ]] + ]], + + ["output", "1131+0 records in\n1131+0 records out\n1185939456 bytes transferred in 44.708618 secs (26525970 bytes/sec)\n\n"], + ["command", [ + ["shell-symbol", "$"], + ["bash", [ + ["function", "sudo"], + " diskutil unmountDisk /dev/diskn" + ]] + ]], + + ["output", "Unmount of all volumes on disk2 was successful"] +] diff --git a/package/src/prism/tests/languages/shell-session/issue3047_2.test b/package/src/prism/tests/languages/shell-session/issue3047_2.test new file mode 100644 index 00000000..51eb48a4 --- /dev/null +++ b/package/src/prism/tests/languages/shell-session/issue3047_2.test @@ -0,0 +1,43 @@ +$ gpg --card-status +Reader ...........: Yubico YubiKey CCID +Application ID ...: D******************************* +Application type .: OpenPGP +Version ..........: 0.0 +Manufacturer .....: Yubico +Serial number ....: 1******* +Name of cardholder: John Doe +Language prefs ...: en +Salutation .......: +URL of public key : [not set] +Login data .......: john@example.net +Signature PIN ....: not forced +Key attributes ...: ed25519 cv25519 ed25519 +Max. PIN lengths .: 127 127 127 +PIN retry counter : 3 0 3 +Signature counter : 0 +KDF setting ......: off +UIF setting ......: Sign=on Decrypt=on Auth=on +Signature key ....: ACE1 3F15 90C1 A8C9 D942 51E3 02ED C61B 6543 509B + created ....: 2021-07-21 18:44:34 +Encryption key....: 0524 00F4 8E1D 085A F3E1 61EC D463 4E0D 6E2D D8BF + created ....: 2021-07-21 18:44:52 +Authentication key: A27B 582F 1F62 03BA 549B 3D44 1E7B 69B2 38FF A21B + created ....: 2021-07-21 18:45:13 +General key info..: sub ed25519/0x02EDC61B6543509B 2021-07-21 John Doe +sec# ed25519/0xC2709D13BAB4763C created: 2021-07-21 expires: never +ssb> ed25519/0x02EDC61B6543509B created: 2021-07-21 expires: 2022-07-21 + card-no: 0006 1******* +ssb> cv25519/0xD4634E0D6E2DD8BF created: 2021-07-21 expires: 2022-07-21 + card-no: 0006 1******* +ssb> ed25519/0x1E7B69B238FFA21B created: 2021-07-21 expires: 2022-07-21 + card-no: 0006 1******* + +---------------------------------------------------- + +[ + ["command", [ + ["shell-symbol", "$"], + ["bash", ["gpg --card-status"]] + ]], + ["output", "Reader ...........: Yubico YubiKey CCID\nApplication ID ...: D*******************************\nApplication type .: OpenPGP\nVersion ..........: 0.0\nManufacturer .....: Yubico\nSerial number ....: 1*******\nName of cardholder: John Doe\nLanguage prefs ...: en\nSalutation .......:\nURL of public key : [not set]\nLogin data .......: john@example.net\nSignature PIN ....: not forced\nKey attributes ...: ed25519 cv25519 ed25519\nMax. PIN lengths .: 127 127 127\nPIN retry counter : 3 0 3\nSignature counter : 0\nKDF setting ......: off\nUIF setting ......: Sign=on Decrypt=on Auth=on\nSignature key ....: ACE1 3F15 90C1 A8C9 D942 51E3 02ED C61B 6543 509B\n created ....: 2021-07-21 18:44:34\nEncryption key....: 0524 00F4 8E1D 085A F3E1 61EC D463 4E0D 6E2D D8BF\n created ....: 2021-07-21 18:44:52\nAuthentication key: A27B 582F 1F62 03BA 549B 3D44 1E7B 69B2 38FF A21B\n created ....: 2021-07-21 18:45:13\nGeneral key info..: sub ed25519/0x02EDC61B6543509B 2021-07-21 John Doe \nsec# ed25519/0xC2709D13BAB4763C created: 2021-07-21 expires: never\nssb> ed25519/0x02EDC61B6543509B created: 2021-07-21 expires: 2022-07-21\n card-no: 0006 1*******\nssb> cv25519/0xD4634E0D6E2DD8BF created: 2021-07-21 expires: 2022-07-21\n card-no: 0006 1*******\nssb> ed25519/0x1E7B69B238FFA21B created: 2021-07-21 expires: 2022-07-21\n card-no: 0006 1*******"] +] diff --git a/package/src/prism/tests/languages/smali/boolean_feature.test b/package/src/prism/tests/languages/smali/boolean_feature.test new file mode 100644 index 00000000..ca34f181 --- /dev/null +++ b/package/src/prism/tests/languages/smali/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/smali/builtin_feature.test b/package/src/prism/tests/languages/smali/builtin_feature.test new file mode 100644 index 00000000..46eba703 --- /dev/null +++ b/package/src/prism/tests/languages/smali/builtin_feature.test @@ -0,0 +1,73 @@ +new-array v0, v0, [I + +.method static constructor ()V + +.field mWifiOnUid:I + +.field public static mWifiRunning:Z = false +.field public static final PI:D = 3.141592653589793 + +.field static final LOG_TAG:Ljava/lang/String; = "CDMA" + +---------------------------------------------------- + +[ + "new-array ", + ["register", "v0"], + ["punctuation", ","], + ["register", "v0"], + ["punctuation", ","], + ["operator", "["], + ["builtin", "I"], + + ["keyword", ".method"], + ["keyword", "static"], + ["keyword", "constructor"], + ["function", ""], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "V"], + + ["keyword", ".field"], + ["field", "mWifiOnUid"], + ["punctuation", ":"], + ["builtin", "I"], + + ["keyword", ".field"], + ["keyword", "public"], + ["keyword", "static"], + ["field", "mWifiRunning"], + ["punctuation", ":"], + ["builtin", "Z"], + ["operator", "="], + ["boolean", "false"], + + ["keyword", ".field"], + ["keyword", "public"], + ["keyword", "static"], + ["keyword", "final"], + ["field", "PI"], + ["punctuation", ":"], + ["builtin", "D"], + ["operator", "="], + ["number", "3.141592653589793"], + + ["keyword", ".field"], + ["keyword", "static"], + ["keyword", "final"], + ["field", "LOG_TAG"], + ["punctuation", ":"], + ["class-name", [ + ["builtin", "L"], + ["namespace", [ + "java", + ["punctuation", "/"], + "lang", + ["punctuation", "/"] + ]], + ["class-name", "String"] + ]], + ["punctuation", ";"], + ["operator", "="], + ["string", "\"CDMA\""] +] diff --git a/package/src/prism/tests/languages/smali/class-name_feature.test b/package/src/prism/tests/languages/smali/class-name_feature.test new file mode 100644 index 00000000..6b0ab72d --- /dev/null +++ b/package/src/prism/tests/languages/smali/class-name_feature.test @@ -0,0 +1,125 @@ +LMain; +Ljava/lang/String; +Lfoo/bar/Foo$Bar; +LFoo$Bar; + +Ljava/lang/String; +LI; +LV; +LI/I/I; +L`single`; +L`java`/lang/String; +L`java`/`lang`/`String`; +Lspace/test/`20 a0 1680 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 200a 202f 205f 3000 `; + + +---------------------------------------------------- + +[ + ["class-name", [ + ["builtin", "L"], + ["class-name", "Main"] + ]], + ["punctuation", ";"], + ["class-name", [ + ["builtin", "L"], + ["namespace", [ + "java", + ["punctuation", "/"], + "lang", + ["punctuation", "/"] + ]], + ["class-name", "String"] + ]], + ["punctuation", ";"], + ["class-name", [ + ["builtin", "L"], + ["namespace", [ + "foo", + ["punctuation", "/"], + "bar", + ["punctuation", "/"] + ]], + ["class-name", "Foo$Bar"] + ]], + ["punctuation", ";"], + ["class-name", [ + ["builtin", "L"], + ["class-name", "Foo$Bar"] + ]], + ["punctuation", ";"], + ["class-name", [ + ["builtin", "L"], + ["namespace", [ + "java", + ["punctuation", "/"], + "lang", + ["punctuation", "/"] + ]], + ["class-name", "String"] + ]], + ["punctuation", ";"], + ["class-name", [ + ["builtin", "L"], + ["class-name", "I"] + ]], + ["punctuation", ";"], + ["class-name", [ + ["builtin", "L"], + ["class-name", "V"] + ]], + ["punctuation", ";"], + ["class-name", [ + ["builtin", "L"], + ["namespace", [ + "I", + ["punctuation", "/"], + "I", + ["punctuation", "/"] + ]], + ["class-name", "I"] + ]], + ["punctuation", ";"], + ["class-name", [ + ["builtin", "L"], + ["class-name", "`single`"] + ]], + ["punctuation", ";"], + ["class-name", [ + ["builtin", "L"], + ["namespace", [ + "`java`", + ["punctuation", "/"], + "lang", + ["punctuation", "/"] + ]], + ["class-name", "String"] + ]], + ["punctuation", ";"], + ["class-name", [ + ["builtin", "L"], + ["namespace", [ + "`java`", + ["punctuation", "/"], + "`lang`", + ["punctuation", "/"] + ]], + ["class-name", "`String`"] + ]], + ["punctuation", ";"], + ["class-name", [ + ["builtin", "L"], + ["namespace", [ + "space", + ["punctuation", "/"], + "test", + ["punctuation", "/"] + ]], + ["class-name", "`20 a0 1680 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 200a 202f 205f 3000 `"] + ]], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for class names. diff --git a/package/src/prism/tests/languages/smali/comment_feature.test b/package/src/prism/tests/languages/smali/comment_feature.test new file mode 100644 index 00000000..d6d40f17 --- /dev/null +++ b/package/src/prism/tests/languages/smali/comment_feature.test @@ -0,0 +1,11 @@ +# comment + +---------------------------------------------------- + +[ + ["comment", "# comment"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/smali/field_feature.test b/package/src/prism/tests/languages/smali/field_feature.test new file mode 100644 index 00000000..bb8ee34d --- /dev/null +++ b/package/src/prism/tests/languages/smali/field_feature.test @@ -0,0 +1,18 @@ +foo: +$VALUES: +12: + +---------------------------------------------------- + +[ + ["field", "foo"], + ["punctuation", ":"], + ["field", "$VALUES"], + ["punctuation", ":"], + ["field", "12"], + ["punctuation", ":"] +] + +---------------------------------------------------- + +Checks for fields. diff --git a/package/src/prism/tests/languages/smali/function_feature.test b/package/src/prism/tests/languages/smali/function_feature.test new file mode 100644 index 00000000..3566bd27 --- /dev/null +++ b/package/src/prism/tests/languages/smali/function_feature.test @@ -0,0 +1,85 @@ +foo()V +(Ljava/lang/String;I)V +()V + +# a complex method +method(I[[IILjava/lang/String;[Ljava/lang/Object;)Ljava/lang/String; + +---------------------------------------------------- + +[ + ["function", "foo"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "V"], + + ["function", ""], + ["punctuation", "("], + ["class-name", [ + ["builtin", "L"], + ["namespace", [ + "java", + ["punctuation", "/"], + "lang", + ["punctuation", "/"] + ]], + ["class-name", "String"] + ]], + ["punctuation", ";"], + ["builtin", "I"], + ["punctuation", ")"], + ["builtin", "V"], + + ["function", ""], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "V"], + + ["comment", "# a complex method"], + + ["function", "method"], + ["punctuation", "("], + ["builtin", "I"], + ["operator", "["], + ["operator", "["], + ["builtin", "II"], + ["class-name", [ + ["builtin", "L"], + ["namespace", [ + "java", + ["punctuation", "/"], + "lang", + ["punctuation", "/"] + ]], + ["class-name", "String"] + ]], + ["punctuation", ";"], + ["operator", "["], + ["class-name", [ + ["builtin", "L"], + ["namespace", [ + "java", + ["punctuation", "/"], + "lang", + ["punctuation", "/"] + ]], + ["class-name", "Object"] + ]], + ["punctuation", ";"], + ["punctuation", ")"], + ["class-name", [ + ["builtin", "L"], + ["namespace", [ + "java", + ["punctuation", "/"], + "lang", + ["punctuation", "/"] + ]], + ["class-name", "String"] + ]], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for functions/methods. diff --git a/package/src/prism/tests/languages/smali/keyword_feature.test b/package/src/prism/tests/languages/smali/keyword_feature.test new file mode 100644 index 00000000..42eb1fcd --- /dev/null +++ b/package/src/prism/tests/languages/smali/keyword_feature.test @@ -0,0 +1,45 @@ +abstract +annotation +bridge +constructor +enum +final +interface +private +protected +public +runtime +static +synthetic +system +transient + +.something +.end something + +---------------------------------------------------- + +[ + ["keyword", "abstract"], + ["keyword", "annotation"], + ["keyword", "bridge"], + ["keyword", "constructor"], + ["keyword", "enum"], + ["keyword", "final"], + ["keyword", "interface"], + ["keyword", "private"], + ["keyword", "protected"], + ["keyword", "public"], + ["keyword", "runtime"], + ["keyword", "static"], + ["keyword", "synthetic"], + ["keyword", "system"], + ["keyword", "transient"], + ["keyword", ".something"], + ["keyword", ".end"], + ["keyword", "something"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/smali/label_feature.test b/package/src/prism/tests/languages/smali/label_feature.test new file mode 100644 index 00000000..f81f38dd --- /dev/null +++ b/package/src/prism/tests/languages/smali/label_feature.test @@ -0,0 +1,13 @@ +.line 989 +:cond_2b + +goto :goto_1f + +---------------------------------------------------- + +[ + ["keyword", ".line"], ["number", "989"], + ["punctuation", ":"], ["label", "cond_2b"], + + "\n\ngoto ", ["punctuation", ":"], ["label", "goto_1f"] +] diff --git a/package/src/prism/tests/languages/smali/number_feature.test b/package/src/prism/tests/languages/smali/number_feature.test new file mode 100644 index 00000000..a837c54c --- /dev/null +++ b/package/src/prism/tests/languages/smali/number_feature.test @@ -0,0 +1,88 @@ +123 +-123 +123t +123s +123l +123T +123S +123L + +123f +123.0f +123.0 +-1234e-9 +.2e-2 +-.2e-2 +-1234.D +.2f + +0xFF +0xFFt +0x0FFs +0x0FFl +0x123ABCp-1D +0x12AB.12ABp10d + +infinity +infinityd +infinityf +infinityD +infinityF + +INFINITY +INFINITYd +INFINITYf +INFINITYD +INFINITYF + +NaN +NaNd +NaNf +NaND +NaNF + +---------------------------------------------------- + +[ + ["number", "123"], + ["number", "-123"], + ["number", "123t"], + ["number", "123s"], + ["number", "123l"], + ["number", "123T"], + ["number", "123S"], + ["number", "123L"], + ["number", "123f"], + ["number", "123.0f"], + ["number", "123.0"], + ["number", "-1234e-9"], + ["number", ".2e-2"], + ["number", "-.2e-2"], + ["number", "-1234.D"], + ["number", ".2f"], + ["number", "0xFF"], + ["number", "0xFFt"], + ["number", "0x0FFs"], + ["number", "0x0FFl"], + ["number", "0x123ABCp-1D"], + ["number", "0x12AB.12ABp10d"], + ["number", "infinity"], + ["number", "infinityd"], + ["number", "infinityf"], + ["number", "infinityD"], + ["number", "infinityF"], + ["number", "INFINITY"], + ["number", "INFINITYd"], + ["number", "INFINITYf"], + ["number", "INFINITYD"], + ["number", "INFINITYF"], + ["number", "NaN"], + ["number", "NaNd"], + ["number", "NaNf"], + ["number", "NaND"], + ["number", "NaNF"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/smali/register_feature.test b/package/src/prism/tests/languages/smali/register_feature.test new file mode 100644 index 00000000..949c11cc --- /dev/null +++ b/package/src/prism/tests/languages/smali/register_feature.test @@ -0,0 +1,28 @@ +move v1, p1 + +move v2, p2 + +move-object v4, p3 + +move v5, p4 + +---------------------------------------------------- + +[ + "move ", ["register", "v1"], ["punctuation", ","], ["register", "p1"], + + "\n\nmove ", + ["register", "v2"], + ["punctuation", ","], + ["register", "p2"], + + "\n\nmove-object ", + ["register", "v4"], + ["punctuation", ","], + ["register", "p3"], + + "\n\nmove ", + ["register", "v5"], + ["punctuation", ","], + ["register", "p4"] +] diff --git a/package/src/prism/tests/languages/smali/string_feature.test b/package/src/prism/tests/languages/smali/string_feature.test new file mode 100644 index 00000000..4e09cbec --- /dev/null +++ b/package/src/prism/tests/languages/smali/string_feature.test @@ -0,0 +1,16 @@ +"" +"foo" + +'c' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foo\""], + ["string", "'c'"] +] + +---------------------------------------------------- + +Checks for strings and chars. diff --git a/package/src/prism/tests/languages/smalltalk/block-arguments_feature.test b/package/src/prism/tests/languages/smalltalk/block-arguments_feature.test new file mode 100644 index 00000000..2dcf4d75 --- /dev/null +++ b/package/src/prism/tests/languages/smalltalk/block-arguments_feature.test @@ -0,0 +1,26 @@ +[ :i | +] +[ :a :b | +] + +---------------------------------------------------- + +[ + ["punctuation", "["], + ["block-arguments", [ + ["variable", ":i"], + ["punctuation", "|"] + ]], + ["punctuation", "]"], + ["punctuation", "["], + ["block-arguments", [ + ["variable", ":a"], + ["variable", ":b"], + ["punctuation", "|"] + ]], + ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for block arguments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/smalltalk/boolean_feature.test b/package/src/prism/tests/languages/smalltalk/boolean_feature.test new file mode 100644 index 00000000..e002f72d --- /dev/null +++ b/package/src/prism/tests/languages/smalltalk/boolean_feature.test @@ -0,0 +1,8 @@ +true false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] diff --git a/package/src/prism/tests/languages/smalltalk/char_feature.test b/package/src/prism/tests/languages/smalltalk/char_feature.test new file mode 100644 index 00000000..6c3bd04b --- /dev/null +++ b/package/src/prism/tests/languages/smalltalk/char_feature.test @@ -0,0 +1,17 @@ +$a +$4 +$. +$^ + +---------------------------------------------------- + +[ + ["char", "$a"], + ["char", "$4"], + ["char", "$."], + ["char", "$^"] +] + +---------------------------------------------------- + +Checks for characters. diff --git a/package/src/prism/tests/languages/smalltalk/comment_feature.test b/package/src/prism/tests/languages/smalltalk/comment_feature.test new file mode 100644 index 00000000..f12ab758 --- /dev/null +++ b/package/src/prism/tests/languages/smalltalk/comment_feature.test @@ -0,0 +1,16 @@ +"foobar" +"foo""bar +baz" +"" + +---------------------------------------------------- + +[ + ["comment", "\"foobar\""], + ["comment", "\"foo\"\"bar\nbaz\""], + ["comment", "\"\""] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/smalltalk/keyword_feature.test b/package/src/prism/tests/languages/smalltalk/keyword_feature.test new file mode 100644 index 00000000..7862b616 --- /dev/null +++ b/package/src/prism/tests/languages/smalltalk/keyword_feature.test @@ -0,0 +1,13 @@ +nil +self super new + +---------------------------------------------------- + +[ + ["keyword", "nil"], + ["keyword", "self"], ["keyword", "super"], ["keyword", "new"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/smalltalk/number_feature.test b/package/src/prism/tests/languages/smalltalk/number_feature.test new file mode 100644 index 00000000..02dac001 --- /dev/null +++ b/package/src/prism/tests/languages/smalltalk/number_feature.test @@ -0,0 +1,23 @@ +42 +3.14159 +3e8 +0.2e-4 +2r10001111 +2r10.1111e4 +16rBADFACE + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "3e8"], + ["number", "0.2e-4"], + ["number", "2r10001111"], + ["number", "2r10.1111e4"], + ["number", "16rBADFACE"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/smalltalk/operator_feature.test b/package/src/prism/tests/languages/smalltalk/operator_feature.test new file mode 100644 index 00000000..b560d302 --- /dev/null +++ b/package/src/prism/tests/languages/smalltalk/operator_feature.test @@ -0,0 +1,29 @@ +:= += == +~= ~~ +< <= +> >> >= +/ // +\\ +! ^ + +- * & +| , @ + +---------------------------------------------------- + +[ + ["operator", ":="], + ["operator", "="], ["operator", "=="], + ["operator", "~="], ["operator", "~~"], + ["operator", "<"], ["operator", "<="], + ["operator", ">"], ["operator", ">>"], ["operator", ">="], + ["operator", "/"], ["operator", "//"], + ["operator", "\\\\"], + ["operator", "!"], ["operator", "^"], ["operator", "+"], + ["operator", "-"], ["operator", "*"], ["operator", "&"], + ["operator", "|"], ["operator", ","], ["operator", "@"] +] + +---------------------------------------------------- + +Checks for all operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/smalltalk/string_char_feature.test b/package/src/prism/tests/languages/smalltalk/string_char_feature.test new file mode 100644 index 00000000..4750cd2e --- /dev/null +++ b/package/src/prism/tests/languages/smalltalk/string_char_feature.test @@ -0,0 +1,13 @@ +$' +'foobar' + +---------------------------------------------------- + +[ + ["char", "$'"], + ["string", "'foobar'"] +] + +---------------------------------------------------- + +Checks a single-quote-character doesn't confuse string parsing. diff --git a/package/src/prism/tests/languages/smalltalk/string_feature.test b/package/src/prism/tests/languages/smalltalk/string_feature.test new file mode 100644 index 00000000..8020a2b3 --- /dev/null +++ b/package/src/prism/tests/languages/smalltalk/string_feature.test @@ -0,0 +1,16 @@ +'foobar' +'foo''bar +baz' +'' + +---------------------------------------------------- + +[ + ["string", "'foobar'"], + ["string", "'foo''bar\nbaz'"], + ["string", "''"] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/smalltalk/symbol_feature.test b/package/src/prism/tests/languages/smalltalk/symbol_feature.test new file mode 100644 index 00000000..9174bf8b --- /dev/null +++ b/package/src/prism/tests/languages/smalltalk/symbol_feature.test @@ -0,0 +1,21 @@ +#foo +#Foo42 +#- +#+ +#** +#( + +---------------------------------------------------- + +[ + ["symbol", "#foo"], + ["symbol", "#Foo42"], + ["symbol", "#-"], + ["symbol", "#+"], + ["symbol", "#**"], + ["symbol", "#"], ["punctuation", "("] +] + +---------------------------------------------------- + +Checks for symbols. \ No newline at end of file diff --git a/package/src/prism/tests/languages/smalltalk/temporary-variables_feature.test b/package/src/prism/tests/languages/smalltalk/temporary-variables_feature.test new file mode 100644 index 00000000..977a7b69 --- /dev/null +++ b/package/src/prism/tests/languages/smalltalk/temporary-variables_feature.test @@ -0,0 +1,25 @@ +| foo | +| x y myVar z cnt | + +---------------------------------------------------- + +[ + ["temporary-variables", [ + ["punctuation", "|"], + ["variable", "foo"], + ["punctuation", "|"] + ]], + ["temporary-variables", [ + ["punctuation", "|"], + ["variable", "x"], + ["variable", "y"], + ["variable", "myVar"], + ["variable", "z"], + ["variable", "cnt"], + ["punctuation", "|"] + ]] +] + +---------------------------------------------------- + +Checks for temporary variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/smarty!+php/inclusion.test b/package/src/prism/tests/languages/smarty!+php/inclusion.test new file mode 100644 index 00000000..73a4e186 --- /dev/null +++ b/package/src/prism/tests/languages/smarty!+php/inclusion.test @@ -0,0 +1,106 @@ +{php} + // including a php script directly from the template. + include('/path/to/display_weather.php'); +{/php} + +{* this template includes a {php} block that assign's the variable $varX *} +{php} + global $foo, $bar; + if($foo == $bar){ + echo 'This will be sent to browser'; + } + // assign a variable to Smarty + $this->assign('varX','Toffee'); +{/php} +{* output the variable *} +{$varX} is my fav ice cream :-) + +---------------------------------------------------- + +[ + ["smarty", [ + ["delimiter", "{"], + ["keyword", "php"], + ["delimiter", "}"] + ]], + ["embedded-php", [ + ["comment", "// including a php script directly from the template."], + + ["keyword", "include"], + ["punctuation", "("], + ["string", "'/path/to/display_weather.php'"], + ["punctuation", ")"], + ["punctuation", ";"] + ]], + ["smarty", [ + ["delimiter", "{/"], + ["keyword", "php"], + ["delimiter", "}"] + ]], + + ["smarty-comment", "{* this template includes a {php} block that assign's the variable $varX *}"], + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "php"], + ["delimiter", "}"] + ]], + ["embedded-php", [ + ["keyword", "global"], + ["variable", "$foo"], + ["punctuation", ","], + ["variable", "$bar"], + ["punctuation", ";"], + + ["keyword", "if"], + ["punctuation", "("], + ["variable", "$foo"], + ["operator", "=="], + ["variable", "$bar"], + ["punctuation", ")"], + ["punctuation", "{"], + + ["keyword", "echo"], + ["string", "'This will be sent to browser'"], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["comment", "// assign a variable to Smarty"], + + ["variable", "$this"], + ["operator", "->"], + ["function", ["assign"]], + ["punctuation", "("], + ["string", "'varX'"], + ["punctuation", ","], + ["string", "'Toffee'"], + ["punctuation", ")"], + ["punctuation", ";"] + ]], + ["smarty", [ + ["delimiter", "{/"], + ["keyword", "php"], + ["delimiter", "}"] + ]], + + ["smarty-comment", "{* output the variable *}"], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["strong"]], + ["punctuation", ">"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$varX"], + ["delimiter", "}"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + " is my fav ice cream :-", + ["markup-bracket", ")"] +] diff --git a/package/src/prism/tests/languages/smarty/attr-name_feature.test b/package/src/prism/tests/languages/smarty/attr-name_feature.test new file mode 100644 index 00000000..41c390a5 --- /dev/null +++ b/package/src/prism/tests/languages/smarty/attr-name_feature.test @@ -0,0 +1,30 @@ +{assign var=foo value="bar"} +{foo bar = 40} + +---------------------------------------------------- + +[ + ["smarty", [ + ["delimiter", "{"], + ["keyword", "assign"], + ["attr-name", "var"], + ["operator", "="], + ["variable", "foo"], + ["attr-name", "value"], + ["operator", "="], + ["string", ["\"bar\""]], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "foo"], + ["attr-name", "bar"], + ["operator", "="], + ["number", "40"], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for attributes. diff --git a/package/src/prism/tests/languages/smarty/booelan_feature.test b/package/src/prism/tests/languages/smarty/booelan_feature.test new file mode 100644 index 00000000..12b77768 --- /dev/null +++ b/package/src/prism/tests/languages/smarty/booelan_feature.test @@ -0,0 +1,51 @@ +{if false} +{if off} +{if on} +{if no} +{if true} +{if yes} + +---------------------------------------------------- + +[ + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["boolean", "false"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["boolean", "off"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["boolean", "on"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["boolean", "no"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["boolean", "true"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["boolean", "yes"], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/smarty/comment_feature.test b/package/src/prism/tests/languages/smarty/comment_feature.test new file mode 100644 index 00000000..49534a26 --- /dev/null +++ b/package/src/prism/tests/languages/smarty/comment_feature.test @@ -0,0 +1,20 @@ +{**} +{* foo +bar *} + +{* you cannot nest comments *} +{* {* foo *} *} + +---------------------------------------------------- + +[ + ["smarty-comment", "{**}"], + ["smarty-comment", "{* foo\nbar *}"], + + ["smarty-comment", "{* you cannot nest comments *}"], + ["smarty-comment", "{* {* foo *}"], " *", ["markup-bracket", "}"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/smarty/function_feature.test b/package/src/prism/tests/languages/smarty/function_feature.test new file mode 100644 index 00000000..da0f0b56 --- /dev/null +++ b/package/src/prism/tests/languages/smarty/function_feature.test @@ -0,0 +1,41 @@ +{if count($foo)} + {$foo|@count} + {$bar|lower} +{/if} + +---------------------------------------------------- + +[ + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["function", "count"], + ["punctuation", "("], + ["variable", "$foo"], + ["punctuation", ")"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["operator", "|"], + ["function", "@count"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$bar"], + ["operator", "|"], + ["function", "lower"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{/"], + ["keyword", "if"], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for tags, filters and functions. diff --git a/package/src/prism/tests/languages/smarty/keyword_feature.test b/package/src/prism/tests/languages/smarty/keyword_feature.test new file mode 100644 index 00000000..a3d30f14 --- /dev/null +++ b/package/src/prism/tests/languages/smarty/keyword_feature.test @@ -0,0 +1,33 @@ +{if count($foo)} +{/if} + +{* PHP function *} +{time()} + +---------------------------------------------------- + +[ + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["function", "count"], + ["punctuation", "("], + ["variable", "$foo"], + ["punctuation", ")"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{/"], + ["keyword", "if"], + ["delimiter", "}"] + ]], + + ["smarty-comment", "{* PHP function *}"], + ["smarty", [ + ["delimiter", "{"], + ["function", "time"], + ["punctuation", "("], + ["punctuation", ")"], + ["delimiter", "}"] + ]] +] diff --git a/package/src/prism/tests/languages/smarty/number_feature.test b/package/src/prism/tests/languages/smarty/number_feature.test new file mode 100644 index 00000000..bdfc254c --- /dev/null +++ b/package/src/prism/tests/languages/smarty/number_feature.test @@ -0,0 +1,45 @@ +{0xBadFace} +{42} +{3.14159} +{4e7} +{5.4E-3} +{2.0e+10} + +---------------------------------------------------- + +[ + ["smarty", [ + ["delimiter", "{"], + ["number", "0xBadFace"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["number", "42"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["number", "3.14159"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["number", "4e7"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["number", "5.4E-3"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["number", "2.0e+10"], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/smarty/operator_feature.test b/package/src/prism/tests/languages/smarty/operator_feature.test new file mode 100644 index 00000000..ac5ae178 --- /dev/null +++ b/package/src/prism/tests/languages/smarty/operator_feature.test @@ -0,0 +1,185 @@ +{if $a + $b - $c == $d} +{if $e * $f / $g % $h === $i} +{if $j < $k and $l > $m eq $n <= $o and $p >= $q} +{if !$r != $s && $t || $u} +{if $v is not even by 3 or $v is even} +{if $w is div by 2 or $w is not div by 3} +{if $x is not odd or $x is odd by 4} +{if $y ne $z or $a neq $b} +{if $c gt $d or $e lt $f} +{if $g gte $h or $i ge $j or $k lte $l or $m le $n} +{if not $o and $p mod 4} +{foo bar=baz} +{$foo|upper} + +---------------------------------------------------- + +[ + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["variable", "$a"], + ["operator", "+"], + ["variable", "$b"], + ["operator", "-"], + ["variable", "$c"], + ["operator", "=="], + ["variable", "$d"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["variable", "$e"], + ["operator", "*"], + ["variable", "$f"], + ["operator", "/"], + ["variable", "$g"], + ["operator", "%"], + ["variable", "$h"], + ["operator", "==="], + ["variable", "$i"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["variable", "$j"], + ["operator", "<"], + ["variable", "$k"], + ["operator", "and"], + ["variable", "$l"], + ["operator", ">"], + ["variable", "$m"], + ["operator", "eq"], + ["variable", "$n"], + ["operator", "<="], + ["variable", "$o"], + ["operator", "and"], + ["variable", "$p"], + ["operator", ">="], + ["variable", "$q"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["operator", "!"], + ["variable", "$r"], + ["operator", "!="], + ["variable", "$s"], + ["operator", "&&"], + ["variable", "$t"], + ["operator", "||"], + ["variable", "$u"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["variable", "$v"], + ["operator", "is not even by"], + ["number", "3"], + ["operator", "or"], + ["variable", "$v"], + ["operator", "is even"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["variable", "$w"], + ["operator", "is div by"], + ["number", "2"], + ["operator", "or"], + ["variable", "$w"], + ["operator", "is not div by"], + ["number", "3"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["variable", "$x"], + ["operator", "is not odd"], + ["operator", "or"], + ["variable", "$x"], + ["operator", "is odd by"], + ["number", "4"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["variable", "$y"], + ["operator", "ne"], + ["variable", "$z"], + ["operator", "or"], + ["variable", "$a"], + ["operator", "neq"], + ["variable", "$b"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["variable", "$c"], + ["operator", "gt"], + ["variable", "$d"], + ["operator", "or"], + ["variable", "$e"], + ["operator", "lt"], + ["variable", "$f"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["variable", "$g"], + ["operator", "gte"], + ["variable", "$h"], + ["operator", "or"], + ["variable", "$i"], + ["operator", "ge"], + ["variable", "$j"], + ["operator", "or"], + ["variable", "$k"], + ["operator", "lte"], + ["variable", "$l"], + ["operator", "or"], + ["variable", "$m"], + ["operator", "le"], + ["variable", "$n"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "if"], + ["operator", "not"], + ["variable", "$o"], + ["operator", "and"], + ["variable", "$p"], + ["operator", "mod"], + ["number", "4"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "foo"], + ["attr-name", "bar"], + ["operator", "="], + ["variable", "baz"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["operator", "|"], + ["function", "upper"], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for all operators. diff --git a/package/src/prism/tests/languages/smarty/php_feature.test b/package/src/prism/tests/languages/smarty/php_feature.test new file mode 100644 index 00000000..fc8a912c --- /dev/null +++ b/package/src/prism/tests/languages/smarty/php_feature.test @@ -0,0 +1,66 @@ +{php} + // including a php script directly from the template. + include('/path/to/display_weather.php'); +{/php} + +{* this template includes a {php} block that assign's the variable $varX *} +{php} + global $foo, $bar; + if($foo == $bar){ + echo 'This will be sent to browser'; + } + // assign a variable to Smarty + $this->assign('varX','Toffee'); +{/php} +{* output the variable *} +{$varX} is my fav ice cream :-) + +---------------------------------------------------- + +[ + ["smarty", [ + ["delimiter", "{"], + ["keyword", "php"], + ["delimiter", "}"] + ]], + ["embedded-php", "\n // including a php script directly from the template.\n include('/path/to/display_weather.php');\n"], + ["smarty", [ + ["delimiter", "{/"], + ["keyword", "php"], + ["delimiter", "}"] + ]], + + ["smarty-comment", "{* this template includes a {php} block that assign's the variable $varX *}"], + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "php"], + ["delimiter", "}"] + ]], + ["embedded-php", "\n global $foo, $bar;\n if($foo == $bar){\n echo 'This will be sent to browser';\n }\n // assign a variable to Smarty\n $this->assign('varX','Toffee');\n"], + ["smarty", [ + ["delimiter", "{/"], + ["keyword", "php"], + ["delimiter", "}"] + ]], + + ["smarty-comment", "{* output the variable *}"], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["strong"]], + ["punctuation", ">"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$varX"], + ["delimiter", "}"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + " is my fav ice cream :-", + ["markup-bracket", ")"] +] diff --git a/package/src/prism/tests/languages/smarty/punctuation_feature.test b/package/src/prism/tests/languages/smarty/punctuation_feature.test new file mode 100644 index 00000000..ca485e88 --- /dev/null +++ b/package/src/prism/tests/languages/smarty/punctuation_feature.test @@ -0,0 +1,33 @@ +{foo + +( ) [ ] { } +. : , +` +-> + +} + +---------------------------------------------------- + +[ + ["smarty", [ + ["delimiter", "{"], ["keyword", "foo"], + + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["punctuation", "."], + ["punctuation", ":"], + ["punctuation", ","], + + ["punctuation", "`"], + + ["punctuation", "->"], + + ["delimiter", "}"] + ]] +] diff --git a/package/src/prism/tests/languages/smarty/smarty_in_markup_feature.test b/package/src/prism/tests/languages/smarty/smarty_in_markup_feature.test new file mode 100644 index 00000000..f464bddd --- /dev/null +++ b/package/src/prism/tests/languages/smarty/smarty_in_markup_feature.test @@ -0,0 +1,51 @@ +
    {$foo}
    +
    +___SMARTY1___{$foo} + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["delimiter", "}"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["delimiter", "}"] + ]], + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + + "\n___SMARTY1___", + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for Smarty inside Markup. diff --git a/package/src/prism/tests/languages/smarty/string_feature.test b/package/src/prism/tests/languages/smarty/string_feature.test new file mode 100644 index 00000000..62bc918c --- /dev/null +++ b/package/src/prism/tests/languages/smarty/string_feature.test @@ -0,0 +1,374 @@ +{""} +{"fo\"obar"} +{''} +{'fo\'obar'} +{$foo="this is message {counter}"} + +{func var="test $foo test"} // sees $foo +{func var="test $foo_bar test"} // sees $foo_bar +{func var="test `$foo[0]` test"} // sees $foo[0] +{func var="test `$foo[bar]` test"} // sees $foo[bar] +{func var="test $foo.bar test"} // sees $foo (not $foo.bar) +{func var="test `$foo.bar` test"} // sees $foo.bar +{func var="test `$foo.bar` test"|escape} // modifiers outside quotes! +{func var="test {$foo|escape} test"} // modifiers inside quotes! +{func var="test {time()} test"} // PHP function result +{func var="test {counter} test"} // plugin result + +{* will replace $tpl_name with value *} +{include file="subdir/$tpl_name.tpl"} + +{* does NOT replace $tpl_name *} +{include file='subdir/$tpl_name.tpl'} // vars require double quotes! + +{* must have backticks as it contains a dot "." *} +{cycle values="one,two,`$smarty.config.myval`"} + +{* must have backticks as it contains a dot "." *} +{include file="`$module.contact`.tpl"} + +{* can use variable with dot syntax *} +{include file="`$module.$view`.tpl"} + +---------------------------------------------------- + +[ + ["smarty", [ + ["delimiter", "{"], + ["string", ["\"\""]], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["string", ["\"fo\\\"obar\""]], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["string", "''"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["string", "'fo\\'obar'"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["operator", "="], + ["string", [ + "\"this is message ", + ["interpolation", [ + ["interpolation-punctuation", "{"], + ["expression", ["counter"]], + ["interpolation-punctuation", "}"] + ]], + "\"" + ]], + ["delimiter", "}"] + ]], + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "func"], + ["attr-name", "var"], + ["operator", "="], + ["string", [ + "\"test ", + ["variable", "$foo"], + " test\"" + ]], + ["delimiter", "}"] + ]], + " // sees $foo\n", + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "func"], + ["attr-name", "var"], + ["operator", "="], + ["string", [ + "\"test ", + ["variable", "$foo_bar"], + " test\"" + ]], + ["delimiter", "}"] + ]], + " // sees $foo_bar\n", + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "func"], + ["attr-name", "var"], + ["operator", "="], + ["string", [ + "\"test ", + ["interpolation", [ + ["interpolation-punctuation", "`"], + ["expression", [ + ["variable", "$foo"], + ["punctuation", "["], + ["number", "0"], + ["punctuation", "]"] + ]], + ["interpolation-punctuation", "`"] + ]], + " test\"" + ]], + ["delimiter", "}"] + ]], + " // sees $foo", + ["markup-bracket", "["], + "0", + ["markup-bracket", "]"], + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "func"], + ["attr-name", "var"], + ["operator", "="], + ["string", [ + "\"test ", + ["interpolation", [ + ["interpolation-punctuation", "`"], + ["expression", [ + ["variable", "$foo"], + ["punctuation", "["], + ["variable", "bar"], + ["punctuation", "]"] + ]], + ["interpolation-punctuation", "`"] + ]], + " test\"" + ]], + ["delimiter", "}"] + ]], + " // sees $foo", + ["markup-bracket", "["], + "bar", + ["markup-bracket", "]"], + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "func"], + ["attr-name", "var"], + ["operator", "="], + ["string", [ + "\"test ", + ["variable", "$foo"], + ".bar test\"" + ]], + ["delimiter", "}"] + ]], + " // sees $foo ", + ["markup-bracket", "("], + "not $foo.bar", + ["markup-bracket", ")"], + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "func"], + ["attr-name", "var"], + ["operator", "="], + ["string", [ + "\"test ", + ["interpolation", [ + ["interpolation-punctuation", "`"], + ["expression", [ + ["variable", "$foo"], + ["punctuation", "."], + ["variable", "bar"] + ]], + ["interpolation-punctuation", "`"] + ]], + " test\"" + ]], + ["delimiter", "}"] + ]], + " // sees $foo.bar\n", + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "func"], + ["attr-name", "var"], + ["operator", "="], + ["string", [ + "\"test ", + ["interpolation", [ + ["interpolation-punctuation", "`"], + ["expression", [ + ["variable", "$foo"], + ["punctuation", "."], + ["variable", "bar"] + ]], + ["interpolation-punctuation", "`"] + ]], + " test\"" + ]], + ["operator", "|"], + ["function", "escape"], + ["delimiter", "}"] + ]], + " // modifiers outside quotes!\n", + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "func"], + ["attr-name", "var"], + ["operator", "="], + ["string", [ + "\"test ", + ["interpolation", [ + ["interpolation-punctuation", "{"], + ["expression", [ + ["variable", "$foo"], + ["operator", "|"], + ["function", "escape"] + ]], + ["interpolation-punctuation", "}"] + ]], + " test\"" + ]], + ["delimiter", "}"] + ]], + " // modifiers inside quotes!\n", + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "func"], + ["attr-name", "var"], + ["operator", "="], + ["string", [ + "\"test ", + ["interpolation", [ + ["interpolation-punctuation", "{"], + ["expression", [ + ["function", "time"], + ["punctuation", "("], + ["punctuation", ")"] + ]], + ["interpolation-punctuation", "}"] + ]], + " test\"" + ]], + ["delimiter", "}"] + ]], + " // PHP function result\n", + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "func"], + ["attr-name", "var"], + ["operator", "="], + ["string", [ + "\"test ", + ["interpolation", [ + ["interpolation-punctuation", "{"], + ["expression", ["counter"]], + ["interpolation-punctuation", "}"] + ]], + " test\"" + ]], + ["delimiter", "}"] + ]], + " // plugin result\n\n", + + ["smarty-comment", "{* will replace $tpl_name with value *}"], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "include"], + ["attr-name", "file"], + ["operator", "="], + ["string", [ + "\"subdir/", + ["variable", "$tpl_name"], + ".tpl\"" + ]], + ["delimiter", "}"] + ]], + + ["smarty-comment", "{* does NOT replace $tpl_name *}"], + + ["smarty", [ + ["delimiter", "{"], + ["keyword", "include"], + ["attr-name", "file"], + ["operator", "="], + ["string", "'subdir/$tpl_name.tpl'"], + ["delimiter", "}"] + ]], + " // vars require double quotes!\n\n", + + ["smarty-comment", "{* must have backticks as it contains a dot \".\" *}"], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "cycle"], + ["attr-name", "values"], + ["operator", "="], + ["string", [ + "\"one,two,", + ["interpolation", [ + ["interpolation-punctuation", "`"], + ["expression", [ + ["variable", "$smarty"], + ["punctuation", "."], + ["variable", "config"], + ["punctuation", "."], + ["variable", "myval"] + ]], + ["interpolation-punctuation", "`"] + ]], + "\"" + ]], + ["delimiter", "}"] + ]], + + ["smarty-comment", "{* must have backticks as it contains a dot \".\" *}"], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "include"], + ["attr-name", "file"], + ["operator", "="], + ["string", [ + "\"", + ["interpolation", [ + ["interpolation-punctuation", "`"], + ["expression", [ + ["variable", "$module"], + ["punctuation", "."], + ["variable", "contact"] + ]], + ["interpolation-punctuation", "`"] + ]], + ".tpl\"" + ]], + ["delimiter", "}"] + ]], + + ["smarty-comment", "{* can use variable with dot syntax *}"], + ["smarty", [ + ["delimiter", "{"], + ["keyword", "include"], + ["attr-name", "file"], + ["operator", "="], + ["string", [ + "\"", + ["interpolation", [ + ["interpolation-punctuation", "`"], + ["expression", [ + ["variable", "$module"], + ["punctuation", "."], + ["variable", "$view"] + ]], + ["interpolation-punctuation", "`"] + ]], + ".tpl\"" + ]], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/smarty/variable_feature.test b/package/src/prism/tests/languages/smarty/variable_feature.test new file mode 100644 index 00000000..a4139e2a --- /dev/null +++ b/package/src/prism/tests/languages/smarty/variable_feature.test @@ -0,0 +1,136 @@ +{$foo} +{$foo_bar42} +{#pageTitle#} +{$foo.bar.baz} +{$foo->bar->baz} +{$foo[row]} +{$foo[$x+$x]} +{$foo.a.$b.c} +{$foo.a.{$b+4}.c} +{$foo.a.{$b.c}} +{$foo={counter}+3} +{$foo->bar($baz,2,$bar)} + +---------------------------------------------------- + +[ + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo_bar42"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "#pageTitle#"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["punctuation", "."], + ["variable", "bar"], + ["punctuation", "."], + ["variable", "baz"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["punctuation", "->"], + ["variable", "bar"], + ["punctuation", "->"], + ["variable", "baz"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["punctuation", "["], + ["variable", "row"], + ["punctuation", "]"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["punctuation", "["], + ["variable", "$x"], + ["operator", "+"], + ["variable", "$x"], + ["punctuation", "]"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["punctuation", "."], + ["variable", "a"], + ["punctuation", "."], + ["variable", "$b"], + ["punctuation", "."], + ["variable", "c"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["punctuation", "."], + ["variable", "a"], + ["punctuation", "."], + ["punctuation", "{"], + ["variable", "$b"], + ["operator", "+"], + ["number", "4"], + ["punctuation", "}"], + ["punctuation", "."], + ["variable", "c"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["punctuation", "."], + ["variable", "a"], + ["punctuation", "."], + ["punctuation", "{"], + ["variable", "$b"], + ["punctuation", "."], + ["variable", "c"], + ["punctuation", "}"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["operator", "="], + ["punctuation", "{"], + "counter", + ["punctuation", "}"], + ["operator", "+"], + ["number", "3"], + ["delimiter", "}"] + ]], + ["smarty", [ + ["delimiter", "{"], + ["variable", "$foo"], + ["punctuation", "->"], + ["function", "bar"], + ["punctuation", "("], + ["variable", "$baz"], + ["punctuation", ","], + ["number", "2"], + ["punctuation", ","], + ["variable", "$bar"], + ["punctuation", ")"], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for variables. diff --git a/package/src/prism/tests/languages/sml/boolean_feature.test b/package/src/prism/tests/languages/sml/boolean_feature.test new file mode 100644 index 00000000..dedba45b --- /dev/null +++ b/package/src/prism/tests/languages/sml/boolean_feature.test @@ -0,0 +1,9 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/sml/classname_feature.test b/package/src/prism/tests/languages/sml/classname_feature.test new file mode 100644 index 00000000..e6a8b4c6 --- /dev/null +++ b/package/src/prism/tests/languages/sml/classname_feature.test @@ -0,0 +1,215 @@ +val FOO: (string list) * 'a * 'a -> (svalue,'a) token +val FOO: (string) * 'a * 'a -> (svalue,'a) token +val FOO: (int) * 'a * 'a -> (svalue,'a) token +val FOO: (string list) * 'a * 'a -> (svalue,'a) token +val FOO: 'a * 'a -> (svalue,'a) token + +datatype spec_ast = SPEC of {head : string list, + decls : decl_ast list, + rules : rule_ast list, + tail : string list} + +type out_state = { +tout : real, +dtout : real, +dtime : real, +strm : TextIO.outstream +} +val outState = ref (NONE : out_state option) + +val systemLines: string -> string list +val systemCleanLines: string -> string list +val systemStanzas: string -> string list list + +---------------------------------------------------- + +[ + ["keyword", "val"], + " FOO", + ["punctuation", ":"], + ["class-name", [ + ["punctuation", "("], + "string list", + ["punctuation", ")"], + ["operator", "*"], + ["variable", "'a"], + ["operator", "*"], + ["variable", "'a"], + ["operator", "->"], + ["punctuation", "("], + "svalue", + ["punctuation", ","], + ["variable", "'a"], + ["punctuation", ")"], + " token" + ]], + + ["keyword", "val"], + " FOO", + ["punctuation", ":"], + ["class-name", [ + ["punctuation", "("], + "string", + ["punctuation", ")"], + ["operator", "*"], + ["variable", "'a"], + ["operator", "*"], + ["variable", "'a"], + ["operator", "->"], + ["punctuation", "("], + "svalue", + ["punctuation", ","], + ["variable", "'a"], + ["punctuation", ")"], + " token" + ]], + + ["keyword", "val"], + " FOO", + ["punctuation", ":"], + ["class-name", [ + ["punctuation", "("], + "int", + ["punctuation", ")"], + ["operator", "*"], + ["variable", "'a"], + ["operator", "*"], + ["variable", "'a"], + ["operator", "->"], + ["punctuation", "("], + "svalue", + ["punctuation", ","], + ["variable", "'a"], + ["punctuation", ")"], + " token" + ]], + + ["keyword", "val"], + " FOO", + ["punctuation", ":"], + ["class-name", [ + ["punctuation", "("], + "string list", + ["punctuation", ")"], + ["operator", "*"], + ["variable", "'a"], + ["operator", "*"], + ["variable", "'a"], + ["operator", "->"], + ["punctuation", "("], + "svalue", + ["punctuation", ","], + ["variable", "'a"], + ["punctuation", ")"], + " token" + ]], + + ["keyword", "val"], + " FOO", + ["punctuation", ":"], + ["class-name", [ + ["variable", "'a"], + ["operator", "*"], + ["variable", "'a"], + ["operator", "->"], + ["punctuation", "("], + "svalue", + ["punctuation", ","], + ["variable", "'a"], + ["punctuation", ")"], + " token" + ]], + + ["keyword", "datatype"], + ["class-name", "spec_ast"], + ["operator", "="], + " SPEC ", + ["keyword", "of"], + ["punctuation", "{"], + "head ", + ["punctuation", ":"], + ["class-name", ["string list"]], + ["punctuation", ","], + + "\n decls ", + ["punctuation", ":"], + ["class-name", ["decl_ast list"]], + ["punctuation", ","], + + "\n rules ", + ["punctuation", ":"], + ["class-name", ["rule_ast list"]], + ["punctuation", ","], + + "\n tail ", + ["punctuation", ":"], + ["class-name", ["string list"]], + ["punctuation", "}"], + + ["keyword", "type"], + ["class-name", "out_state"], + ["operator", "="], + ["punctuation", "{"], + + "\ntout ", + ["punctuation", ":"], + ["class-name", ["real"]], + ["punctuation", ","], + + "\ndtout ", + ["punctuation", ":"], + ["class-name", ["real"]], + ["punctuation", ","], + + "\ndtime ", + ["punctuation", ":"], + ["class-name", ["real"]], + ["punctuation", ","], + + "\nstrm ", + ["punctuation", ":"], + ["class-name", [ + "TextIO", + ["punctuation", "."], + "outstream" + ]], + + ["punctuation", "}"], + + ["keyword", "val"], + " outState ", + ["operator", "="], + " ref ", + ["punctuation", "("], + "NONE ", + ["punctuation", ":"], + ["class-name", ["out_state option"]], + ["punctuation", ")"], + + ["keyword", "val"], + " systemLines", + ["punctuation", ":"], + ["class-name", [ + "string ", + ["operator", "->"], + " string list" + ]], + + ["keyword", "val"], + " systemCleanLines", + ["punctuation", ":"], + ["class-name", [ + "string ", + ["operator", "->"], + " string list" + ]], + + ["keyword", "val"], + " systemStanzas", + ["punctuation", ":"], + ["class-name", [ + "string ", + ["operator", "->"], + " string list list" + ]] +] diff --git a/package/src/prism/tests/languages/sml/comment_feature.test b/package/src/prism/tests/languages/sml/comment_feature.test new file mode 100644 index 00000000..c882efe7 --- /dev/null +++ b/package/src/prism/tests/languages/sml/comment_feature.test @@ -0,0 +1,11 @@ +(* comment *) +(* + (* nested comment *) +*) + +---------------------------------------------------- + +[ + ["comment", "(* comment *)"], + ["comment", "(*\n (* nested comment *)\n*)"] +] diff --git a/package/src/prism/tests/languages/sml/function_feature.test b/package/src/prism/tests/languages/sml/function_feature.test new file mode 100644 index 00000000..623f3f5d --- /dev/null +++ b/package/src/prism/tests/languages/sml/function_feature.test @@ -0,0 +1,13 @@ +fun foo x = x * 2 + +---------------------------------------------------- + +[ + ["keyword", "fun"], + ["function", "foo"], + " x ", + ["operator", "="], + " x ", + ["operator", "*"], + ["number", "2"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/sml/keyword_feature.test b/package/src/prism/tests/languages/sml/keyword_feature.test new file mode 100644 index 00000000..f19f8c32 --- /dev/null +++ b/package/src/prism/tests/languages/sml/keyword_feature.test @@ -0,0 +1,94 @@ +abstype +and +andalso +as +case +datatype; +do +else +end +eqtype +exception; +fn +fun; +functor; +handle +if +in +include +infix +infixr +let +local +nonfix +of +op +open +orelse +raise +rec +sharing +sig +signature; +struct +structure; +then +type; +val +where +while +with +withtype + +---------------------------------------------------- + +[ + ["keyword", "abstype"], + ["keyword", "and"], + ["keyword", "andalso"], + ["keyword", "as"], + ["keyword", "case"], + ["keyword", "datatype"], + ["punctuation", ";"], + ["keyword", "do"], + ["keyword", "else"], + ["keyword", "end"], + ["keyword", "eqtype"], + ["keyword", "exception"], + ["punctuation", ";"], + ["keyword", "fn"], + ["keyword", "fun"], + ["punctuation", ";"], + ["keyword", "functor"], + ["punctuation", ";"], + ["keyword", "handle"], + ["keyword", "if"], + ["keyword", "in"], + ["keyword", "include"], + ["keyword", "infix"], + ["keyword", "infixr"], + ["keyword", "let"], + ["keyword", "local"], + ["keyword", "nonfix"], + ["keyword", "of"], + ["keyword", "op"], + ["keyword", "open"], + ["keyword", "orelse"], + ["keyword", "raise"], + ["keyword", "rec"], + ["keyword", "sharing"], + ["keyword", "sig"], + ["keyword", "signature"], + ["punctuation", ";"], + ["keyword", "struct"], + ["keyword", "structure"], + ["punctuation", ";"], + ["keyword", "then"], + ["keyword", "type"], + ["punctuation", ";"], + ["keyword", "val"], + ["keyword", "where"], + ["keyword", "while"], + ["keyword", "with"], + ["keyword", "withtype"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/sml/number_feature.test b/package/src/prism/tests/languages/sml/number_feature.test new file mode 100644 index 00000000..f6f105d2 --- /dev/null +++ b/package/src/prism/tests/languages/sml/number_feature.test @@ -0,0 +1,21 @@ +123 +~123 +123.456 +~123.456 +123e~3 + +0xFF +~0xFF + +---------------------------------------------------- + +[ + ["number", "123"], + ["number", "~123"], + ["number", "123.456"], + ["number", "~123.456"], + ["number", "123e~3"], + + ["number", "0xFF"], + ["number", "~0xFF"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/sml/operator_feature.test b/package/src/prism/tests/languages/sml/operator_feature.test new file mode 100644 index 00000000..0805fa18 --- /dev/null +++ b/package/src/prism/tests/languages/sml/operator_feature.test @@ -0,0 +1,33 @@ +... +:: :> := += <> < <= > >= +=> -> +! + - * / ^ # | @ ~ + +---------------------------------------------------- + +[ + ["operator", "..."], + ["operator", "::"], + ["operator", ":>"], + ["operator", ":="], + ["operator", "="], + ["operator", "<"], + ["operator", ">"], + ["operator", "<"], + ["operator", "<="], + ["operator", ">"], + ["operator", ">="], + ["operator", "=>"], + ["operator", "->"], + ["operator", "!"], + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "^"], + ["operator", "#"], + ["operator", "|"], + ["operator", "@"], + ["operator", "~"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/sml/string_feature.test b/package/src/prism/tests/languages/sml/string_feature.test new file mode 100644 index 00000000..43889283 --- /dev/null +++ b/package/src/prism/tests/languages/sml/string_feature.test @@ -0,0 +1,14 @@ +"" +"foo" +"\tfoo +bar" +#"f" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foo\""], + ["string", "\"\\tfoo\nbar\""], + ["string", "#\"f\""] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/sml/word_feature.test b/package/src/prism/tests/languages/sml/word_feature.test new file mode 100644 index 00000000..71815ad9 --- /dev/null +++ b/package/src/prism/tests/languages/sml/word_feature.test @@ -0,0 +1,7 @@ +0w123 + +---------------------------------------------------- + +[ + ["word", "0w123"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/solidity/builtin_feature.test b/package/src/prism/tests/languages/solidity/builtin_feature.test new file mode 100644 index 00000000..aa25c87b --- /dev/null +++ b/package/src/prism/tests/languages/solidity/builtin_feature.test @@ -0,0 +1,126 @@ +address +bool +string +byte +bytes +int +uint + +bytes1 bytes2 bytes3 bytes4 bytes5 bytes6 bytes7 bytes8 bytes9 bytes10 bytes11 bytes12 bytes13 bytes14 bytes15 bytes16 bytes17 bytes18 bytes19 bytes20 bytes21 bytes22 bytes23 bytes24 bytes25 bytes26 bytes27 bytes28 bytes29 bytes30 bytes31 bytes32 +int8 int16 int24 int32 int40 int48 int56 int64 int72 int80 int88 int96 int104 int112 int120 int128 int136 int144 int152 int160 int168 int176 int184 int192 int200 int208 int216 int224 int232 int240 int248 int256 +uint8 uint16 uint24 uint32 uint40 uint48 uint56 uint64 uint72 uint80 uint88 uint96 uint104 uint112 uint120 uint128 uint136 uint144 uint152 uint160 uint168 uint176 uint184 uint192 uint200 uint208 uint216 uint224 uint232 uint240 uint248 uint256 + +---------------------------------------------------- + +[ + ["builtin", "address"], + ["builtin", "bool"], + ["builtin", "string"], + ["builtin", "byte"], + ["builtin", "bytes"], + ["builtin", "int"], + ["builtin", "uint"], + + ["builtin", "bytes1"], + ["builtin", "bytes2"], + ["builtin", "bytes3"], + ["builtin", "bytes4"], + ["builtin", "bytes5"], + ["builtin", "bytes6"], + ["builtin", "bytes7"], + ["builtin", "bytes8"], + ["builtin", "bytes9"], + ["builtin", "bytes10"], + ["builtin", "bytes11"], + ["builtin", "bytes12"], + ["builtin", "bytes13"], + ["builtin", "bytes14"], + ["builtin", "bytes15"], + ["builtin", "bytes16"], + ["builtin", "bytes17"], + ["builtin", "bytes18"], + ["builtin", "bytes19"], + ["builtin", "bytes20"], + ["builtin", "bytes21"], + ["builtin", "bytes22"], + ["builtin", "bytes23"], + ["builtin", "bytes24"], + ["builtin", "bytes25"], + ["builtin", "bytes26"], + ["builtin", "bytes27"], + ["builtin", "bytes28"], + ["builtin", "bytes29"], + ["builtin", "bytes30"], + ["builtin", "bytes31"], + ["builtin", "bytes32"], + + ["builtin", "int8"], + ["builtin", "int16"], + ["builtin", "int24"], + ["builtin", "int32"], + ["builtin", "int40"], + ["builtin", "int48"], + ["builtin", "int56"], + ["builtin", "int64"], + ["builtin", "int72"], + ["builtin", "int80"], + ["builtin", "int88"], + ["builtin", "int96"], + ["builtin", "int104"], + ["builtin", "int112"], + ["builtin", "int120"], + ["builtin", "int128"], + ["builtin", "int136"], + ["builtin", "int144"], + ["builtin", "int152"], + ["builtin", "int160"], + ["builtin", "int168"], + ["builtin", "int176"], + ["builtin", "int184"], + ["builtin", "int192"], + ["builtin", "int200"], + ["builtin", "int208"], + ["builtin", "int216"], + ["builtin", "int224"], + ["builtin", "int232"], + ["builtin", "int240"], + ["builtin", "int248"], + ["builtin", "int256"], + + ["builtin", "uint8"], + ["builtin", "uint16"], + ["builtin", "uint24"], + ["builtin", "uint32"], + ["builtin", "uint40"], + ["builtin", "uint48"], + ["builtin", "uint56"], + ["builtin", "uint64"], + ["builtin", "uint72"], + ["builtin", "uint80"], + ["builtin", "uint88"], + ["builtin", "uint96"], + ["builtin", "uint104"], + ["builtin", "uint112"], + ["builtin", "uint120"], + ["builtin", "uint128"], + ["builtin", "uint136"], + ["builtin", "uint144"], + ["builtin", "uint152"], + ["builtin", "uint160"], + ["builtin", "uint168"], + ["builtin", "uint176"], + ["builtin", "uint184"], + ["builtin", "uint192"], + ["builtin", "uint200"], + ["builtin", "uint208"], + ["builtin", "uint216"], + ["builtin", "uint224"], + ["builtin", "uint232"], + ["builtin", "uint240"], + ["builtin", "uint248"], + ["builtin", "uint256"] +] + +---------------------------------------------------- + +Checks for builtin types. diff --git a/package/src/prism/tests/languages/solidity/class-name_feature.test b/package/src/prism/tests/languages/solidity/class-name_feature.test new file mode 100644 index 00000000..534d6580 --- /dev/null +++ b/package/src/prism/tests/languages/solidity/class-name_feature.test @@ -0,0 +1,65 @@ +contract Foo {} +contract Foo is Bar {} +enum Foo { X, Y, Z } +interface Foo {} +library Foo {} +new Foo(); +struct Foo {} +using Foo for bar; + +---------------------------------------------------- + +[ + ["keyword", "contract"], + ["class-name", "Foo"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "contract"], + ["class-name", "Foo"], + ["keyword", "is"], + " Bar ", + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "enum"], + ["class-name", "Foo"], + ["punctuation", "{"], + " X", + ["punctuation", ","], + " Y", + ["punctuation", ","], + " Z ", + ["punctuation", "}"], + + ["keyword", "interface"], + ["class-name", "Foo"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "library"], + ["class-name", "Foo"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "new"], + ["class-name", "Foo"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "struct"], + ["class-name", "Foo"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "using"], + ["class-name", "Foo"], + ["keyword", "for"], + " bar", + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for class names. diff --git a/package/src/prism/tests/languages/solidity/comment_feature.test b/package/src/prism/tests/languages/solidity/comment_feature.test new file mode 100644 index 00000000..8e7678a7 --- /dev/null +++ b/package/src/prism/tests/languages/solidity/comment_feature.test @@ -0,0 +1,15 @@ +// foo +/* +bar +*/ + +---------------------------------------------------- + +[ + ["comment", "// foo"], + ["comment", "/*\nbar\n*/"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/solidity/keyword_feature.test b/package/src/prism/tests/languages/solidity/keyword_feature.test new file mode 100644 index 00000000..a0077d58 --- /dev/null +++ b/package/src/prism/tests/languages/solidity/keyword_feature.test @@ -0,0 +1,128 @@ +_ +anonymous +as +assembly +assert +break +calldata +case +constant +constructor +continue +contract; +default +delete +do +else +emit +enum; +event +external +for +from +function +if +import +indexed +inherited +interface; +internal +is +let +library; +mapping +memory +modifier +new; +payable +pragma +private +public +pure +require +return +returns +revert +selfdestruct +solidity +storage +struct; +suicide +switch +this +throw +using; +view +while + +---------------------------------------------------- + +[ + ["keyword", "_"], + ["keyword", "anonymous"], + ["keyword", "as"], + ["keyword", "assembly"], + ["keyword", "assert"], + ["keyword", "break"], + ["keyword", "calldata"], + ["keyword", "case"], + ["keyword", "constant"], + ["keyword", "constructor"], + ["keyword", "continue"], + ["keyword", "contract"], + ["punctuation", ";"], + ["keyword", "default"], + ["keyword", "delete"], + ["keyword", "do"], + ["keyword", "else"], + ["keyword", "emit"], + ["keyword", "enum"], + ["punctuation", ";"], + ["keyword", "event"], + ["keyword", "external"], + ["keyword", "for"], + ["keyword", "from"], + ["keyword", "function"], + ["keyword", "if"], + ["keyword", "import"], + ["keyword", "indexed"], + ["keyword", "inherited"], + ["keyword", "interface"], + ["punctuation", ";"], + ["keyword", "internal"], + ["keyword", "is"], + ["keyword", "let"], + ["keyword", "library"], + ["punctuation", ";"], + ["keyword", "mapping"], + ["keyword", "memory"], + ["keyword", "modifier"], + ["keyword", "new"], + ["punctuation", ";"], + ["keyword", "payable"], + ["keyword", "pragma"], + ["keyword", "private"], + ["keyword", "public"], + ["keyword", "pure"], + ["keyword", "require"], + ["keyword", "return"], + ["keyword", "returns"], + ["keyword", "revert"], + ["keyword", "selfdestruct"], + ["keyword", "solidity"], + ["keyword", "storage"], + ["keyword", "struct"], + ["punctuation", ";"], + ["keyword", "suicide"], + ["keyword", "switch"], + ["keyword", "this"], + ["keyword", "throw"], + ["keyword", "using"], + ["punctuation", ";"], + ["keyword", "view"], + ["keyword", "while"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/solidity/operator_feature.test b/package/src/prism/tests/languages/solidity/operator_feature.test new file mode 100644 index 00000000..0d292017 --- /dev/null +++ b/package/src/prism/tests/languages/solidity/operator_feature.test @@ -0,0 +1,68 @@ ++ - * / % ++= -= *= /= %= + +^ & | ~ +^= &= |= + +>> << >>= <<= + +&& || ! + += +>= <= > < != == + +=> -> := =: + +? + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + ["operator", "%="], + + ["operator", "^"], + ["operator", "&"], + ["operator", "|"], + ["operator", "~"], + ["operator", "^="], + ["operator", "&="], + ["operator", "|="], + + ["operator", ">>"], + ["operator", "<<"], + ["operator", ">>="], + ["operator", "<<="], + + ["operator", "&&"], + ["operator", "||"], + ["operator", "!"], + + ["operator", "="], + + ["operator", ">="], + ["operator", "<="], + ["operator", ">"], + ["operator", "<"], + ["operator", "!="], + ["operator", "=="], + + ["operator", "=>"], + ["operator", "->"], + ["operator", ":="], + ["operator", "=:"], + + ["operator", "?"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/solidity/punctuation_feature.test b/package/src/prism/tests/languages/solidity/punctuation_feature.test new file mode 100644 index 00000000..5f934ffd --- /dev/null +++ b/package/src/prism/tests/languages/solidity/punctuation_feature.test @@ -0,0 +1,21 @@ +() [] {} +. : , ; + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "."], + ["punctuation", ":"], + ["punctuation", ","], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for punctuation. diff --git a/package/src/prism/tests/languages/solidity/string_feature.test b/package/src/prism/tests/languages/solidity/string_feature.test new file mode 100644 index 00000000..4f550963 --- /dev/null +++ b/package/src/prism/tests/languages/solidity/string_feature.test @@ -0,0 +1,18 @@ +"foo\"\'" +'bar\'\"' + +"\n\"\'\\abc\ +def" + +---------------------------------------------------- + +[ + ["string", "\"foo\\\"\\'\""], + ["string", "'bar\\'\\\"'"], + + ["string", "\"\\n\\\"\\'\\\\abc\\\ndef\""] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/solidity/version_feature.test b/package/src/prism/tests/languages/solidity/version_feature.test new file mode 100644 index 00000000..c24ccd9d --- /dev/null +++ b/package/src/prism/tests/languages/solidity/version_feature.test @@ -0,0 +1,24 @@ +pragma solidity >=0.4.0 <0.7.0; +pragma solidity ^0.5.0; + +---------------------------------------------------- + +[ + ["keyword", "pragma"], + ["keyword", "solidity"], + ["operator", ">="], + ["version", "0.4.0"], + ["operator", "<"], + ["version", "0.7.0"], + ["punctuation", ";"], + + ["keyword", "pragma"], + ["keyword", "solidity"], + ["operator", "^"], + ["version", "0.5.0"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for version literals. diff --git a/package/src/prism/tests/languages/solution-file/boolean_feature.test b/package/src/prism/tests/languages/solution-file/boolean_feature.test new file mode 100644 index 00000000..d3a2f5d6 --- /dev/null +++ b/package/src/prism/tests/languages/solution-file/boolean_feature.test @@ -0,0 +1,13 @@ +TRUE +FALSE + +---------------------------------------------------- + +[ + ["boolean", "TRUE"], + ["boolean", "FALSE"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/solution-file/comment_feature.test b/package/src/prism/tests/languages/solution-file/comment_feature.test new file mode 100644 index 00000000..d6d40f17 --- /dev/null +++ b/package/src/prism/tests/languages/solution-file/comment_feature.test @@ -0,0 +1,11 @@ +# comment + +---------------------------------------------------- + +[ + ["comment", "# comment"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/solution-file/guid_feature.test b/package/src/prism/tests/languages/solution-file/guid_feature.test new file mode 100644 index 00000000..1dbcfcb2 --- /dev/null +++ b/package/src/prism/tests/languages/solution-file/guid_feature.test @@ -0,0 +1,63 @@ +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Project1", "Project1.vbproj", "{8CDD8387-B905-44A8-B5D5-07BB50E05BEA}" + {8CDD8387-B905-44A8-B5D5-07BB50E05BEA}.Foo = Bar +EndProject +Foo = {F184B08F-C81C-45F6-A57F-5ABD9991F28F} + +---------------------------------------------------- + +[ + ["object", "Project"], + ["punctuation", "("], + ["string", [ + "\"", + ["guid", [ + ["punctuation", "{"], + "F184B08F-C81C-45F6-A57F-5ABD9991F28F", + ["punctuation", "}"] + ]], + "\"" + ]], + ["punctuation", ")"], + ["operator", "="], + ["string", [ + "\"Project1\"" + ]], + ["punctuation", ","], + ["string", [ + "\"Project1.vbproj\"" + ]], + ["punctuation", ","], + ["string", [ + "\"", + ["guid", [ + ["punctuation", "{"], + "8CDD8387-B905-44A8-B5D5-07BB50E05BEA", + ["punctuation", "}"] + ]], + "\"" + ]], + ["property", [ + ["guid", [ + ["punctuation", "{"], + "8CDD8387-B905-44A8-B5D5-07BB50E05BEA", + ["punctuation", "}"] + ]], + ".Foo" + ]], + ["operator", "="], + " Bar\n", + ["object", "EndProject"], + ["property", [ + "Foo" + ]], + ["operator", "="], + ["guid", [ + ["punctuation", "{"], + "F184B08F-C81C-45F6-A57F-5ABD9991F28F", + ["punctuation", "}"] + ]] +] + +---------------------------------------------------- + +Checks for global unique identifiers. diff --git a/package/src/prism/tests/languages/solution-file/object_feature.test b/package/src/prism/tests/languages/solution-file/object_feature.test new file mode 100644 index 00000000..cbd94f1d --- /dev/null +++ b/package/src/prism/tests/languages/solution-file/object_feature.test @@ -0,0 +1,101 @@ +Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "Project1", "Project1.vbproj", "{8CDD8387-B905-44A8-B5D5-07BB50E05BEA}" +EndProject + +Global + GlobalSection(ProjectConfiguration) = postSolution + {8CDD8387-B905-44A8-B5D5-07BB50E05BEA}.Debug.ActiveCfg = Debug|x86 + {8CDD8387-B905-44A8-B5D5-07BB50E05BEA}.Debug.Build.0 = Debug|x86 + {8CDD8387-B905-44A8-B5D5-07BB50E05BEA}.Release.ActiveCfg = Release|x86 + {8CDD8387-B905-44A8-B5D5-07BB50E05BEA}.Release.Build.0 = Release|x86 + EndGlobalSection +EndGlobal + +---------------------------------------------------- + +[ + ["object", "Project"], + ["punctuation", "("], + ["string", [ + "\"", + ["guid", [ + ["punctuation", "{"], + "F184B08F-C81C-45F6-A57F-5ABD9991F28F", + ["punctuation", "}"] + ]], + "\"" + ]], + ["punctuation", ")"], + ["operator", "="], + ["string", [ + "\"Project1\"" + ]], + ["punctuation", ","], + ["string", [ + "\"Project1.vbproj\"" + ]], + ["punctuation", ","], + ["string", [ + "\"", + ["guid", [ + ["punctuation", "{"], + "8CDD8387-B905-44A8-B5D5-07BB50E05BEA", + ["punctuation", "}"] + ]], + "\"" + ]], + ["object", "EndProject"], + + ["object", "Global"], + ["object", "GlobalSection"], + ["punctuation", "("], + "ProjectConfiguration", + ["punctuation", ")"], + ["operator", "="], + " postSolution\n\t\t", + ["property", [ + ["guid", [ + ["punctuation", "{"], + "8CDD8387-B905-44A8-B5D5-07BB50E05BEA", + ["punctuation", "}"] + ]], + ".Debug.ActiveCfg" + ]], + ["operator", "="], + " Debug|x86\n\t\t", + ["property", [ + ["guid", [ + ["punctuation", "{"], + "8CDD8387-B905-44A8-B5D5-07BB50E05BEA", + ["punctuation", "}"] + ]], + ".Debug.Build.0" + ]], + ["operator", "="], + " Debug|x86\n\t\t", + ["property", [ + ["guid", [ + ["punctuation", "{"], + "8CDD8387-B905-44A8-B5D5-07BB50E05BEA", + ["punctuation", "}"] + ]], + ".Release.ActiveCfg" + ]], + ["operator", "="], + " Release|x86\n\t\t", + ["property", [ + ["guid", [ + ["punctuation", "{"], + "8CDD8387-B905-44A8-B5D5-07BB50E05BEA", + ["punctuation", "}"] + ]], + ".Release.Build.0" + ]], + ["operator", "="], + " Release|x86\n\t", + ["object", "EndGlobalSection"], + ["object", "EndGlobal"] +] + +---------------------------------------------------- + +Checks for objects. diff --git a/package/src/prism/tests/languages/solution-file/property_feature.test b/package/src/prism/tests/languages/solution-file/property_feature.test new file mode 100644 index 00000000..c0c5ee90 --- /dev/null +++ b/package/src/prism/tests/languages/solution-file/property_feature.test @@ -0,0 +1,32 @@ +README.md = README.md +Debug|Any CPU = Debug|Any CPU +{D86DD040-BA41-47FA-91D3-EF62F23AF867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + +---------------------------------------------------- + +[ + ["property", [ + "README.md" + ]], + ["operator", "="], + " README.md\n", + ["property", [ + "Debug|Any CPU" + ]], + ["operator", "="], + " Debug|Any CPU\n", + ["property", [ + ["guid", [ + ["punctuation", "{"], + "D86DD040-BA41-47FA-91D3-EF62F23AF867", + ["punctuation", "}"] + ]], + ".Debug|Any CPU.ActiveCfg" + ]], + ["operator", "="], + " Debug|Any CPU" +] + +---------------------------------------------------- + +Checks for properties. diff --git a/package/src/prism/tests/languages/solution-file/string_feature.test b/package/src/prism/tests/languages/solution-file/string_feature.test new file mode 100644 index 00000000..8753da89 --- /dev/null +++ b/package/src/prism/tests/languages/solution-file/string_feature.test @@ -0,0 +1,17 @@ +"foo" +'bar' + +---------------------------------------------------- + +[ + ["string", [ + "\"foo\"" + ]], + ["string", [ + "'bar'" + ]] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/soy/boolean_feature.test b/package/src/prism/tests/languages/soy/boolean_feature.test new file mode 100644 index 00000000..42c100e5 --- /dev/null +++ b/package/src/prism/tests/languages/soy/boolean_feature.test @@ -0,0 +1,27 @@ +{param visible: true /} +{param visible:false/} + +---------------------------------------------------- + +[ + ["soy", [ + ["delimiter", "{"], + ["keyword", "param"], + ["parameter", "visible"], + ["punctuation", ":"], + ["boolean", "true"], + ["delimiter", "/}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "param"], + ["parameter", "visible"], + ["punctuation", ":"], + ["boolean", "false"], + ["delimiter", "/}"] + ]] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/soy/command-arg.test b/package/src/prism/tests/languages/soy/command-arg.test new file mode 100644 index 00000000..63947813 --- /dev/null +++ b/package/src/prism/tests/languages/soy/command-arg.test @@ -0,0 +1,84 @@ +{alias long.namespace.root.projectx.foomodule.utils as fooUtils} +{call myfeature.myTemplate /} +{delcall aaa.bbb.myButton /} +{delpackage MyExperiment} +{deltemplate aaa.bbb.myButton} +{namespace ns} +{template .example} + +---------------------------------------------------- + +[ + ["soy", [ + ["delimiter", "{"], + ["keyword", "alias"], + ["command-arg", [ + "long", + ["punctuation", "."], "namespace", + ["punctuation", "."], "root", + ["punctuation", "."], "projectx", + ["punctuation", "."], "foomodule", + ["punctuation", "."], "utils" + ]], + ["keyword", "as"], + " fooUtils", + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "call"], + ["command-arg", [ + "myfeature", + ["punctuation", "."], "myTemplate" + ]], + ["delimiter", "/}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "delcall"], + ["command-arg", [ + "aaa", + ["punctuation", "."], "bbb", + ["punctuation", "."], "myButton" + ]], + ["delimiter", "/}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "delpackage"], + ["command-arg", [ + "MyExperiment" + ]], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "deltemplate"], + ["command-arg", [ + "aaa", + ["punctuation", "."], "bbb", + ["punctuation", "."], "myButton" + ]], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "namespace"], + ["command-arg", [ + "ns" + ]], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "template"], + ["command-arg", [ + ["punctuation", "."], "example" + ]], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for command argument. \ No newline at end of file diff --git a/package/src/prism/tests/languages/soy/comment_feature.test b/package/src/prism/tests/languages/soy/comment_feature.test new file mode 100644 index 00000000..dac66cce --- /dev/null +++ b/package/src/prism/tests/languages/soy/comment_feature.test @@ -0,0 +1,25 @@ +/**/ +/* Foo "bar" */ +/* Foo //bar +baz */ +// +// Foo /* bar */ +//
    +/*
    +
    */ + +---------------------------------------------------- + +[ + ["soy", [["comment", "/**/"]]], + ["soy", [["comment", "/* Foo \"bar\" */"]]], + ["soy", [["comment", "/* Foo //bar\nbaz */"]]], + ["soy", [["comment", "//"]]], + ["soy", [["comment", "// Foo /* bar */"]]], + ["soy", [["comment", "//
    "]]], + ["soy", [["comment", "/*
    \n
    */"]]] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/soy/function_feature.test b/package/src/prism/tests/languages/soy/function_feature.test new file mode 100644 index 00000000..91e0c917 --- /dev/null +++ b/package/src/prism/tests/languages/soy/function_feature.test @@ -0,0 +1,86 @@ +{if not isLast($additionalName)} +{if length($items) > 5} +{$x|noAutoescape} +{elseif round($pi) == 3} +{for $i in range($numLines)} +{$foo|changeNewLineToBr|bidiSpanWrap} +{$bar | truncate : 4 , false} + +---------------------------------------------------- + +[ + ["soy", [ + ["delimiter", "{"], + ["keyword", "if"], + ["operator", "not"], + ["function", "isLast"], + ["punctuation", "("], + ["variable", ["$additionalName"]], + ["punctuation", ")"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "if"], + ["function", "length"], + ["punctuation", "("], + ["variable", ["$items"]], + ["punctuation", ")"], + ["operator", ">"], + ["number", "5"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["variable", ["$x"]], + ["punctuation", "|"], + ["function", "noAutoescape"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "elseif"], + ["function", "round"], + ["punctuation", "("], + ["variable", ["$pi"]], + ["punctuation", ")"], + ["operator", "=="], + ["number", "3"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "for"], + ["variable", ["$i"]], + ["keyword", "in"], + ["function", "range"], + ["punctuation", "("], + ["variable", ["$numLines"]], + ["punctuation", ")"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["variable", ["$foo"]], + ["punctuation", "|"], + ["function", "changeNewLineToBr"], + ["punctuation", "|"], + ["function", "bidiSpanWrap"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["variable", ["$bar"]], + ["punctuation", "|"], + ["function", "truncate"], + ["punctuation", ":"], + ["number", "4"], + ["punctuation", ","], + ["boolean", "false"], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for functions and print directives. \ No newline at end of file diff --git a/package/src/prism/tests/languages/soy/keyword_feature.test b/package/src/prism/tests/languages/soy/keyword_feature.test new file mode 100644 index 00000000..3419d64b --- /dev/null +++ b/package/src/prism/tests/languages/soy/keyword_feature.test @@ -0,0 +1,338 @@ +{\n} +{\r} +{\t} +{alias foo as bar} +{call} +{case} +{css} +{default} +{delcall} +{delpackage} +{deltemplate} +{else} +{elseif} +{fallbackmsg} +{for} +{foreach $i in $foo} +{if} +{ifempty} +{lb} +{let} +{literal}{/literal} +{msg} +{namespace} +{nil} +{param} +{@param} +{@param?} +{rb} +{sp} +{switch} +{template} +{xid} +{@param foo: any} +{@param foo: attributes} +{@param foo: bool} +{@param foo: css} +{@param foo: float} +{@param foo: int} +{@param foo: js} +{@param foo: html} +{@param foo: list} +{@param foo: map} +{@param foo: null} +{@param foo: number} +{@param foo: string} +{@param foo: uri} + +---------------------------------------------------- + +[ + ["soy", [ + ["delimiter", "{"], + ["keyword", "\\n"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "\\r"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "\\t"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "alias"], + ["command-arg", ["foo"]], + ["keyword", "as"], + " bar", + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "call"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "case"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "css"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "default"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "delcall"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "delpackage"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "deltemplate"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "else"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "elseif"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "fallbackmsg"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "for"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "foreach"], + ["variable", ["$i"]], + ["keyword", "in"], + ["variable", ["$foo"]], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "if"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "ifempty"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "lb"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "let"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "literal"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{/"], + ["keyword", "literal"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "msg"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "namespace"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "nil"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "param"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param?"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "rb"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "sp"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "switch"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "template"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "xid"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "any"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "attributes"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "bool"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "css"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "float"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "int"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "js"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "html"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "list"], ["operator", "<"], ["keyword", "int"], ["operator", ">"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "map"], ["operator", "<"], ["keyword", "int"], ["punctuation", ","], ["keyword", "string"], ["operator", ">"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "null"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "number"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "string"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["keyword", "uri"], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/soy/literal_feature.test b/package/src/prism/tests/languages/soy/literal_feature.test new file mode 100644 index 00000000..b412b525 --- /dev/null +++ b/package/src/prism/tests/languages/soy/literal_feature.test @@ -0,0 +1,83 @@ +{literal}{$noHighlight}{/literal} +{$highlight}{literal}
    +{if $bar}{$bar}{/if}
    +{/literal} +{literal}/* even comments */{/literal} + +---------------------------------------------------- + +[ + ["soy", [ + ["delimiter", "{"], + ["keyword", "literal"], + ["delimiter", "}"] + ]], + ["markup-bracket", "{"], + "$noHighlight", + ["markup-bracket", "}"], + ["soy", [ + ["delimiter", "{/"], + ["keyword", "literal"], + ["delimiter", "}"] + ]], + + ["soy", [ + ["delimiter", "{"], + ["variable", ["$highlight"]], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "literal"], + ["delimiter", "}"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "{$foo}", + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + + ["markup-bracket", "{"], + "if $bar", + ["markup-bracket", "}"], + ["markup-bracket", "{"], + "$bar", + ["markup-bracket", "}"], + ["markup-bracket", "{"], + "/if", + ["markup-bracket", "}"], + ["tag", [ + ["punctuation", ""] + ]], + + ["soy", [ + ["delimiter", "{/"], + ["keyword", "literal"], + ["delimiter", "}"] + ]], + + ["soy", [ + ["delimiter", "{"], + ["keyword", "literal"], + ["delimiter", "}"] + ]], + "/* even comments */", + ["soy", [ + ["delimiter", "{/"], + ["keyword", "literal"], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for {literal} command. diff --git a/package/src/prism/tests/languages/soy/number_feature.test b/package/src/prism/tests/languages/soy/number_feature.test new file mode 100644 index 00000000..a0592c62 --- /dev/null +++ b/package/src/prism/tests/languages/soy/number_feature.test @@ -0,0 +1,63 @@ +{param foo: 42} +{param foo: 3.14159} +{param foo: 0.0} +{param foo: 7e+8} +{param foo: 2.5E-14} +{param foo: 0x42BADFACE} + +---------------------------------------------------- + +[ + ["soy", [ + ["delimiter", "{"], + ["keyword", "param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["number", "42"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["number", "3.14159"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["number", "0.0"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["number", "7e+8"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["number", "2.5E-14"], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "param"], + ["parameter", "foo"], + ["punctuation", ":"], + ["number", "0x42BADFACE"], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for decimal and hexadecimal numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/soy/operator_feature.test b/package/src/prism/tests/languages/soy/operator_feature.test new file mode 100644 index 00000000..02e70043 --- /dev/null +++ b/package/src/prism/tests/languages/soy/operator_feature.test @@ -0,0 +1,121 @@ +{let $foo: $a ? 0 : 1 /} +{let $foo: $a ?: 1 /} +{let $foo: 1 < 2 and 2 <= 3 /} +{let $foo: 1 > 2 or 2 >= 3 /} +{let $foo: 1 == 1 and 1 != 2 /} +{let $foo: ((1 + 2) / 3 * 4) % 5 - 6 /} +{let $foo: not $bar /} +{let $foo kind="text"} + +---------------------------------------------------- + +[ + ["soy", [ + ["delimiter", "{"], + ["keyword", "let"], + ["variable", ["$foo"]], + ["punctuation", ":"], + ["variable", ["$a"]], + ["operator", "?"], + ["number", "0"], + ["punctuation", ":"], + ["number", "1"], + ["delimiter", "/}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "let"], + ["variable", ["$foo"]], + ["punctuation", ":"], + ["variable", ["$a"]], + ["operator", "?:"], + ["number", "1"], + ["delimiter", "/}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "let"], + ["variable", ["$foo"]], + ["punctuation", ":"], + ["number", "1"], + ["operator", "<"], + ["number", "2"], + ["operator", "and"], + ["number", "2"], + ["operator", "<="], + ["number", "3"], + ["delimiter", "/}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "let"], + ["variable", ["$foo"]], + ["punctuation", ":"], + ["number", "1"], + ["operator", ">"], + ["number", "2"], + ["operator", "or"], + ["number", "2"], + ["operator", ">="], + ["number", "3"], + ["delimiter", "/}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "let"], + ["variable", ["$foo"]], + ["punctuation", ":"], + ["number", "1"], + ["operator", "=="], + ["number", "1"], + ["operator", "and"], + ["number", "1"], + ["operator", "!="], + ["number", "2"], + ["delimiter", "/}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "let"], + ["variable", ["$foo"]], + ["punctuation", ":"], + ["punctuation", "("], + ["punctuation", "("], + ["number", "1"], + ["operator", "+"], + ["number", "2"], + ["punctuation", ")"], + ["operator", "/"], + ["number", "3"], + ["operator", "*"], + ["number", "4"], + ["punctuation", ")"], + ["operator", "%"], + ["number", "5"], + ["operator", "-"], + ["number", "6"], + ["delimiter", "/}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "let"], + ["variable", ["$foo"]], + ["punctuation", ":"], + ["operator", "not"], + ["variable", ["$bar"]], + ["delimiter", "/}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "let"], + ["variable", ["$foo"]], + ["property", "kind"], + ["operator", "="], + ["string", "\"text\""], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/soy/parameter_feature.test b/package/src/prism/tests/languages/soy/parameter_feature.test new file mode 100644 index 00000000..c6394a27 --- /dev/null +++ b/package/src/prism/tests/languages/soy/parameter_feature.test @@ -0,0 +1,73 @@ +{param visible: true /} +{param content kind="html"} + {$message} +{/param} +{@param name: string} +{@param? height: int} + +---------------------------------------------------- + +[ + ["soy", [ + ["delimiter", "{"], + ["keyword", "param"], + ["parameter", "visible"], + ["punctuation", ":"], + ["boolean", "true"], + ["delimiter", "/}"] + ]], + + ["soy", [ + ["delimiter", "{"], + ["keyword", "param"], + ["parameter", "content"], + ["property", "kind"], + ["operator", "="], + ["string", "\"html\""], + ["delimiter", "}"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["b"]], + ["punctuation", ">"] + ]], + ["soy", [ + ["delimiter", "{"], + ["variable", ["$message"]], + ["delimiter", "}"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["soy", [ + ["delimiter", "{/"], + ["keyword", "param"], + ["delimiter", "}"] + ]], + + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param"], + ["parameter", "name"], + ["punctuation", ":"], + ["keyword", "string"], + ["delimiter", "}"] + ]], + + ["soy", [ + ["delimiter", "{"], + ["keyword", "@param?"], + ["parameter", "height"], + ["punctuation", ":"], + ["keyword", "int"], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for parameters name. diff --git a/package/src/prism/tests/languages/soy/property_feature.test b/package/src/prism/tests/languages/soy/property_feature.test new file mode 100644 index 00000000..74956048 --- /dev/null +++ b/package/src/prism/tests/languages/soy/property_feature.test @@ -0,0 +1,54 @@ +{msg meaning="noun" desc="The word 'Archive' used as a noun, i.e. an information store."} +{param content kind="html"} +{let $message kind="text"} +{template .googleUri autoescape="strict" kind="uri"} + +---------------------------------------------------- + +[ + ["soy", [ + ["delimiter", "{"], + ["keyword", "msg"], + ["property", "meaning"], + ["operator", "="], + ["string", "\"noun\""], + ["property", "desc"], + ["operator", "="], + ["string", "\"The word 'Archive' used as a noun, i.e. an information store.\""], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "param"], + ["parameter", "content"], + ["property", "kind"], + ["operator", "="], + ["string", "\"html\""], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "let"], + ["variable", ["$message"]], + ["property", "kind"], + ["operator", "="], + ["string", "\"text\""], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "template"], + ["command-arg", [["punctuation", "."], "googleUri"]], + ["property", "autoescape"], + ["operator", "="], + ["string", "\"strict\""], + ["property", "kind"], + ["operator", "="], + ["string", "\"uri\""], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for command properties. \ No newline at end of file diff --git a/package/src/prism/tests/languages/soy/soy_in_markup_feature.test b/package/src/prism/tests/languages/soy/soy_in_markup_feature.test new file mode 100644 index 00000000..bf4169c1 --- /dev/null +++ b/package/src/prism/tests/languages/soy/soy_in_markup_feature.test @@ -0,0 +1,65 @@ +
    {$msg}
    +
    + +___SOY1___{$foo} + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["soy", [ + ["delimiter", "{"], + ["variable", ["$msg"]], + ["delimiter", "}"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["soy", [ + ["delimiter", "{"], + ["variable", ["$msg"]], + ["delimiter", "}"] + ]], + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", [ + "h", + ["soy", [ + ["delimiter", "{"], + ["variable", ["$headingLevel"]], + ["delimiter", "}"] + ]] + ]], + ["punctuation", ">"] + ]], + + "\n___SOY1___", + ["soy", [ + ["delimiter", "{"], + ["variable", ["$foo"]], + ["delimiter", "}"] + ]] +] + +---------------------------------------------------- + +Checks for Soy inside Markup. diff --git a/package/src/prism/tests/languages/soy/string_feature.test b/package/src/prism/tests/languages/soy/string_feature.test new file mode 100644 index 00000000..387c5435 --- /dev/null +++ b/package/src/prism/tests/languages/soy/string_feature.test @@ -0,0 +1,47 @@ +{msg desc=""} +{msg desc="Foo \"bar\" 'baz'"} +{$foo['bar\'baz\"\"\'']} +{{msg desc="Example: The set of prime numbers is {2, 3, 5, 7, 11, 13, ...}."}} + +---------------------------------------------------- + +[ + ["soy", [ + ["delimiter", "{"], + ["keyword", "msg"], + ["property", "desc"], + ["operator", "="], + ["string", "\"\""], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "msg"], + ["property", "desc"], + ["operator", "="], + ["string", "\"Foo \\\"bar\\\" 'baz'\""], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["variable", [ + "$foo", + ["punctuation", "["], + ["string", "'bar\\'baz\\\"\\\"\\''"], + ["punctuation", "]"] + ]], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{{"], + ["keyword", "msg"], + ["property", "desc"], + ["operator", "="], + ["string", "\"Example: The set of prime numbers is {2, 3, 5, 7, 11, 13, ...}.\""], + ["delimiter", "}}"] + ]] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/soy/variable_feature.test b/package/src/prism/tests/languages/soy/variable_feature.test new file mode 100644 index 00000000..82403c9d --- /dev/null +++ b/package/src/prism/tests/languages/soy/variable_feature.test @@ -0,0 +1,86 @@ +{$name} +{$folders.0.name} +{$folders[0].name} +{$folders[0]['name']} +{$aaa?.bbb.ccc?[0]} +{let $category: $categoryList[0] /} +{let $isEnabled: $isAaa and not $isBbb and $ccc == $ddd + $eee /} + +---------------------------------------------------- + +[ + ["soy", [ + ["delimiter", "{"], + ["variable", ["$name"]], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["variable", [ + "$folders", + ["punctuation", "."], ["number", "0"], + ["punctuation", "."], "name" + ]], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["variable", [ + "$folders", + ["punctuation", "["], ["number", "0"], ["punctuation", "]"], + ["punctuation", "."], "name" + ]], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["variable", [ + "$folders", + ["punctuation", "["], ["number", "0"], ["punctuation", "]"], + ["punctuation", "["], ["string", "'name'"], ["punctuation", "]"] + ]], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["variable", [ + "$aaa", ["punctuation", "?"], + ["punctuation", "."], "bbb", + ["punctuation", "."], "ccc", ["punctuation", "?"], + ["punctuation", "["], ["number", "0"], ["punctuation", "]"] + ]], + ["delimiter", "}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "let"], + ["variable", ["$category"]], + ["punctuation", ":"], + ["variable", [ + "$categoryList", + ["punctuation", "["], ["number", "0"], ["punctuation", "]"] + ]], + ["delimiter", "/}"] + ]], + ["soy", [ + ["delimiter", "{"], + ["keyword", "let"], + ["variable", ["$isEnabled"]], + ["punctuation", ":"], + ["variable", ["$isAaa"]], + ["operator", "and"], + ["operator", "not"], + ["variable", ["$isBbb"]], + ["operator", "and"], + ["variable", ["$ccc"]], + ["operator", "=="], + ["variable", ["$ddd"]], + ["operator", "+"], + ["variable", ["$eee"]], + ["delimiter", "/}"] + ]] +] + +---------------------------------------------------- + +Checks for variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/sparql/boolean_feature.test b/package/src/prism/tests/languages/sparql/boolean_feature.test new file mode 100644 index 00000000..abe9614f --- /dev/null +++ b/package/src/prism/tests/languages/sparql/boolean_feature.test @@ -0,0 +1,14 @@ +true +FALSE + + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "FALSE"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/sparql/comment_feature.test b/package/src/prism/tests/languages/sparql/comment_feature.test new file mode 100644 index 00000000..59494fec --- /dev/null +++ b/package/src/prism/tests/languages/sparql/comment_feature.test @@ -0,0 +1,13 @@ +# +# foo + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# foo"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/sparql/function_feature.test b/package/src/prism/tests/languages/sparql/function_feature.test new file mode 100644 index 00000000..f1a7f8c4 --- /dev/null +++ b/package/src/prism/tests/languages/sparql/function_feature.test @@ -0,0 +1,87 @@ +foo:bar +foo: +:bar +foo:ba1 +foo:1ba +foo:bar:bar +foo:bar%20bar +foo:bar.bar +foo-2: +foo.-: + + +---------------------------------------------------- + +[ + ["function", [ + ["prefix", [ + "foo", + ["punctuation", ":"] + ]], + ["local-name", "bar"] + ]], + ["function", [ + ["prefix", [ + "foo", + ["punctuation", ":"] + ]] + ]], + ["function", [ + ["prefix", [ + ["punctuation", ":"] + ]], + ["local-name", "bar"] + ]], + ["function", [ + ["prefix", [ + "foo", + ["punctuation", ":"] + ]], + ["local-name", "ba1"] + ]], + ["function", [ + ["prefix", [ + "foo", + ["punctuation", ":"] + ]], + ["local-name", "1ba"] + ]], + ["function", [ + ["prefix", [ + "foo", + ["punctuation", ":"] + ]], + ["local-name", "bar:bar"] + ]], + ["function", [ + ["prefix", [ + "foo", + ["punctuation", ":"] + ]], + ["local-name", "bar%20bar"] + ]], + ["function", [ + ["prefix", [ + "foo", + ["punctuation", ":"] + ]], + ["local-name", "bar.bar"] + ]], + ["function", [ + ["prefix", [ + "foo-2", + ["punctuation", ":"] + ]] + ]], + ["function", [ + ["prefix", [ + "foo.-", + ["punctuation", ":"] + ]] + ]] +] + + +---------------------------------------------------- + +Checks for PrefixedName. diff --git a/package/src/prism/tests/languages/sparql/keyword_feature.test b/package/src/prism/tests/languages/sparql/keyword_feature.test new file mode 100644 index 00000000..7a63d59a --- /dev/null +++ b/package/src/prism/tests/languages/sparql/keyword_feature.test @@ -0,0 +1,223 @@ +A +ADD +ALL +AS +ASC +ASK +BNODE +BY +CLEAR +CONSTRUCT +COPY +CREATE +DATA +DEFAULT +DELETE +DESC +DESCRIBE +DISTINCT +DROP +EXISTS +FILTER +FROM +GROUP +HAVING +INSERT +INTO +LIMIT +LOAD +MINUS +MOVE +NAMED +NOT +NOW +OFFSET +OPTIONAL +ORDER +RAND +REDUCED +SELECT +SEPARATOR +SERVICE +SILENT +STRUUID +UNION +USING +UUID +VALUES +WHERE +ABS( +AVG( +BIND( +BOUND( +CEIL( +COALESCE( +CONCAT( +CONTAINS( +COUNT( +DATATYPE( +DAY( +ENCODE_FOR_URI( +FLOOR( +GROUP_CONCAT( +HOURS( +IF( +IRI( +isBLANK( +isIRI( +isLITERAL( +isNUMERIC( +isURI( +LANG( +LANGMATCHES( +LCASE( +MAX( +MD5( +MIN( +MINUTES( +MONTH( +ROUND( +REGEX( +REPLACE( +sameTerm( +SAMPLE( +SECONDS( +SHA1( +SHA256( +SHA384( +SHA512( +STR( +STRAFTER( +STRBEFORE( +STRDT( +STRENDS( +STRLANG( +STRLEN( +STRSTARTS( +SUBSTR( +SUM( +TIMEZONE( +TZ( +UCASE( +URI( +YEAR( + +GRAPH +BASE +PREFIX + +---------------------------------------------------- + +[ + ["keyword", "A"], + ["keyword", "ADD"], + ["keyword", "ALL"], + ["keyword", "AS"], + ["keyword", "ASC"], + ["keyword", "ASK"], + ["keyword", "BNODE"], + ["keyword", "BY"], + ["keyword", "CLEAR"], + ["keyword", "CONSTRUCT"], + ["keyword", "COPY"], + ["keyword", "CREATE"], + ["keyword", "DATA"], + ["keyword", "DEFAULT"], + ["keyword", "DELETE"], + ["keyword", "DESC"], + ["keyword", "DESCRIBE"], + ["keyword", "DISTINCT"], + ["keyword", "DROP"], + ["keyword", "EXISTS"], + ["keyword", "FILTER"], + ["keyword", "FROM"], + ["keyword", "GROUP"], + ["keyword", "HAVING"], + ["keyword", "INSERT"], + ["keyword", "INTO"], + ["keyword", "LIMIT"], + ["keyword", "LOAD"], + ["keyword", "MINUS"], + ["keyword", "MOVE"], + ["keyword", "NAMED"], + ["keyword", "NOT"], + ["keyword", "NOW"], + ["keyword", "OFFSET"], + ["keyword", "OPTIONAL"], + ["keyword", "ORDER"], + ["keyword", "RAND"], + ["keyword", "REDUCED"], + ["keyword", "SELECT"], + ["keyword", "SEPARATOR"], + ["keyword", "SERVICE"], + ["keyword", "SILENT"], + ["keyword", "STRUUID"], + ["keyword", "UNION"], + ["keyword", "USING"], + ["keyword", "UUID"], + ["keyword", "VALUES"], + ["keyword", "WHERE"], + ["keyword", "ABS"], ["punctuation", "("], + ["keyword", "AVG"], ["punctuation", "("], + ["keyword", "BIND"], ["punctuation", "("], + ["keyword", "BOUND"], ["punctuation", "("], + ["keyword", "CEIL"], ["punctuation", "("], + ["keyword", "COALESCE"], ["punctuation", "("], + ["keyword", "CONCAT"], ["punctuation", "("], + ["keyword", "CONTAINS"], ["punctuation", "("], + ["keyword", "COUNT"], ["punctuation", "("], + ["keyword", "DATATYPE"], ["punctuation", "("], + ["keyword", "DAY"], ["punctuation", "("], + ["keyword", "ENCODE_FOR_URI"], ["punctuation", "("], + ["keyword", "FLOOR"], ["punctuation", "("], + ["keyword", "GROUP_CONCAT"], ["punctuation", "("], + ["keyword", "HOURS"], ["punctuation", "("], + ["keyword", "IF"], ["punctuation", "("], + ["keyword", "IRI"], ["punctuation", "("], + ["keyword", "isBLANK"], ["punctuation", "("], + ["keyword", "isIRI"], ["punctuation", "("], + ["keyword", "isLITERAL"], ["punctuation", "("], + ["keyword", "isNUMERIC"], ["punctuation", "("], + ["keyword", "isURI"], ["punctuation", "("], + ["keyword", "LANG"], ["punctuation", "("], + ["keyword", "LANGMATCHES"], ["punctuation", "("], + ["keyword", "LCASE"], ["punctuation", "("], + ["keyword", "MAX"], ["punctuation", "("], + ["keyword", "MD5"], ["punctuation", "("], + ["keyword", "MIN"], ["punctuation", "("], + ["keyword", "MINUTES"], ["punctuation", "("], + ["keyword", "MONTH"], ["punctuation", "("], + ["keyword", "ROUND"], ["punctuation", "("], + ["keyword", "REGEX"], ["punctuation", "("], + ["keyword", "REPLACE"], ["punctuation", "("], + ["keyword", "sameTerm"], ["punctuation", "("], + ["keyword", "SAMPLE"], ["punctuation", "("], + ["keyword", "SECONDS"], ["punctuation", "("], + ["keyword", "SHA1"], ["punctuation", "("], + ["keyword", "SHA256"], ["punctuation", "("], + ["keyword", "SHA384"], ["punctuation", "("], + ["keyword", "SHA512"], ["punctuation", "("], + ["keyword", "STR"], ["punctuation", "("], + ["keyword", "STRAFTER"], ["punctuation", "("], + ["keyword", "STRBEFORE"], ["punctuation", "("], + ["keyword", "STRDT"], ["punctuation", "("], + ["keyword", "STRENDS"], ["punctuation", "("], + ["keyword", "STRLANG"], ["punctuation", "("], + ["keyword", "STRLEN"], ["punctuation", "("], + ["keyword", "STRSTARTS"], ["punctuation", "("], + ["keyword", "SUBSTR"], ["punctuation", "("], + ["keyword", "SUM"], ["punctuation", "("], + ["keyword", "TIMEZONE"], ["punctuation", "("], + ["keyword", "TZ"], ["punctuation", "("], + ["keyword", "UCASE"], ["punctuation", "("], + ["keyword", "URI"], ["punctuation", "("], + ["keyword", "YEAR"], ["punctuation", "("], + + ["keyword", "GRAPH"], + ["keyword", "BASE"], + ["keyword", "PREFIX"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/sparql/number_feature.test b/package/src/prism/tests/languages/sparql/number_feature.test new file mode 100644 index 00000000..7a1aa5a3 --- /dev/null +++ b/package/src/prism/tests/languages/sparql/number_feature.test @@ -0,0 +1,31 @@ +42 ++42 +-42 +42.42 +-42.42 ++42.42 +42.42e42 +-42.42e+42 ++42.42e-42 +0.42e42 +0.42e+42 +0.42e-42 +---------------------------------------------------- +[ + ["number", "42"], + ["number", "+42"], + ["number", "-42"], + ["number", "42.42"], + ["number", "-42.42"], + ["number", "+42.42"], + ["number", "42.42e42"], + ["number", "-42.42e+42"], + ["number", "+42.42e-42"], + ["number", "0.42e42"], + ["number", "0.42e+42"], + ["number", "0.42e-42"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/sparql/string_feature.test b/package/src/prism/tests/languages/sparql/string_feature.test new file mode 100644 index 00000000..ec37949d --- /dev/null +++ b/package/src/prism/tests/languages/sparql/string_feature.test @@ -0,0 +1,40 @@ +"" +'' +'''''' +"""""" +'foo bar' +"Foo bar" +"""foo +"bar" +foobar""" +''' +foobar +"bar" +'foo' +foobar +''' + +---------------------------------------------------- +[ + ["string", "\"\""], + ["string", "''"], + ["multiline-string", [ + "''''''" + ]], + ["multiline-string", [ + "\"\"\"\"\"\"" + ]], + ["string", "'foo bar'"], + ["string", "\"Foo bar\""], + ["multiline-string", [ + "\"\"\"foo\n\"bar\"\nfoobar\"\"\"" + ]], + ["multiline-string", [ + "'''\nfoobar\n\"bar\"\n'foo'\nfoobar\n'''" + ]] +] + + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/sparql/tag_feature.test b/package/src/prism/tests/languages/sparql/tag_feature.test new file mode 100644 index 00000000..4d58c26b --- /dev/null +++ b/package/src/prism/tests/languages/sparql/tag_feature.test @@ -0,0 +1,42 @@ +@ne +@ned-nl +@ne-nl +@ne-01 +@ne-JA +@ne-NE01 + + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "@"], + "ne" + ]], + ["tag", [ + ["punctuation", "@"], + "ned-nl" + ]], + ["tag", [ + ["punctuation", "@"], + "ne-nl" + ]], + ["tag", [ + ["punctuation", "@"], + "ne" + ]], + ["number", "-01"], + ["tag", [ + ["punctuation", "@"], + "ne-JA" + ]], + ["tag", [ + ["punctuation", "@"], + "ne-NE01" + ]] +] + + +---------------------------------------------------- + +Checks for languagetags. diff --git a/package/src/prism/tests/languages/sparql/url_feature.test b/package/src/prism/tests/languages/sparql/url_feature.test new file mode 100644 index 00000000..2ac71937 --- /dev/null +++ b/package/src/prism/tests/languages/sparql/url_feature.test @@ -0,0 +1,234 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +---------------------------------------------------- + +[ + ["url", [ + ["punctuation", "<"], + "http://foo.com/blah_blah", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://foo.com/blah_blah/", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://foo.com/blah_blah_(wikipedia)", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://foo.com/blah_blah_(wikipedia)_(again)", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://www.example.com/wpstyle/?p=364", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "https://www.example.com/foo/?bar=baz&inga=42&quux", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://✪df.ws/123", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://userid:password@example.com:8080", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://userid:password@example.com:8080/", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://userid@example.com", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://userid@example.com/", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://userid@example.com:8080", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://userid@example.com:8080/", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://userid:password@example.com", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://userid:password@example.com/", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://142.42.1.1/", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://142.42.1.1:8080/", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://➡.ws/䨹", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://⌘.ws", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://⌘.ws/", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://foo.com/blah_(wikipedia)#cite-1", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://foo.com/blah_(wikipedia)_blah#cite-1", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://foo.com/unicode_(✪)_in_parens", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://foo.com/(something)?after=parens", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://☺.damowmow.com/", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://code.google.com/events/#&product=browser", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://j.mp", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "ftp://foo.bar/baz", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://foo.bar/?q=Test%20URL-encoded%20stuff", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://مثال.إختبار", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://例子.测试", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://उदाहरण.परीक्षा", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://-.~_!$&'()*+,;=:%40:80%2f::::::@example.com", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://1337.net", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://a.b-c.de", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://223.255.255.254", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "https://foo_bar.example.com/", + ["punctuation", ">"] + ]] +] + + +---------------------------------------------------- + +Checks for IRI's. diff --git a/package/src/prism/tests/languages/sparql/variable_feature.test b/package/src/prism/tests/languages/sparql/variable_feature.test new file mode 100644 index 00000000..f8d69853 --- /dev/null +++ b/package/src/prism/tests/languages/sparql/variable_feature.test @@ -0,0 +1,18 @@ +?name +$name +?name0 +$name0 + + +---------------------------------------------------- + +[ + ["variable", "?name"], + ["variable", "$name"], + ["variable", "?name0"], + ["variable", "$name0"] +] + +---------------------------------------------------- + +Checks for variables. diff --git a/package/src/prism/tests/languages/splunk-spl/boolean_feature.test b/package/src/prism/tests/languages/splunk-spl/boolean_feature.test new file mode 100644 index 00000000..22b8d387 --- /dev/null +++ b/package/src/prism/tests/languages/splunk-spl/boolean_feature.test @@ -0,0 +1,9 @@ +T F +true false + +---------------------------------------------------- + +[ + ["boolean", "T"], ["boolean", "F"], + ["boolean", "true"], ["boolean", "false"] +] diff --git a/package/src/prism/tests/languages/splunk-spl/comment_feature.test b/package/src/prism/tests/languages/splunk-spl/comment_feature.test new file mode 100644 index 00000000..cf525064 --- /dev/null +++ b/package/src/prism/tests/languages/splunk-spl/comment_feature.test @@ -0,0 +1,16 @@ +`comment("This is a comment")` +`comment("This is too +but on more than one line")` +`comment("| stats sum(b) BY index")` + +---------------------------------------------------- + +[ + ["comment", "`comment(\"This is a comment\")`"], + ["comment", "`comment(\"This is too\nbut on more than one line\")`"], + ["comment", "`comment(\"| stats sum(b) BY index\")`"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/splunk-spl/date_feature.test b/package/src/prism/tests/languages/splunk-spl/date_feature.test new file mode 100644 index 00000000..edc67d29 --- /dev/null +++ b/package/src/prism/tests/languages/splunk-spl/date_feature.test @@ -0,0 +1,13 @@ +1/1/1970 +12/31/1999:23:59:59 + +---------------------------------------------------- + +[ + ["date", "1/1/1970"], + ["date", "12/31/1999:23:59:59"] +] + +---------------------------------------------------- + +Checks for dates. diff --git a/package/src/prism/tests/languages/splunk-spl/keyword_feature.test b/package/src/prism/tests/languages/splunk-spl/keyword_feature.test new file mode 100644 index 00000000..e1df7d7e --- /dev/null +++ b/package/src/prism/tests/languages/splunk-spl/keyword_feature.test @@ -0,0 +1,303 @@ +abstract +accum +addcoltotals +addinfo +addtotals +analyzefields +anomalies +anomalousvalue +anomalydetection +append +appendcols +appendcsv +appendlookup +appendpipe +arules +associate +audit +autoregress +bin +bucket +bucketdir +chart +cluster +cofilter +collect +concurrency +contingency +convert +correlate +datamodel +dbinspect +dedup +delete +delta +diff +erex +eval +eventcount +eventstats +extract +fieldformat +fields +fieldsummary +filldown +fillnull +findtypes +folderize +foreach +format +from +gauge +gentimes +geom +geomfilter +geostats +head +highlight +history +iconify +input +inputcsv +inputlookup +iplocation +join +kmeans +kv +kvform +loadjob +localize +localop +lookup +makecontinuous +makemv +makeresults +map +mcollect +metadata +metasearch +meventcollect +mstats +multikv +multisearch +mvcombine +mvexpand +nomv +outlier +outputcsv +outputlookup +outputtext +overlap +pivot +predict +rangemap +rare +regex +relevancy +reltime +rename +replace +rest +return +reverse +rex +rtorder +run +savedsearch +script +scrub +search +searchtxn +selfjoin +sendemail +set +setfields +sichart +sirare +sistats +sitimechart +sitop +sort +spath +stats +strcat +streamstats +table +tags +tail +timechart +timewrap +top +transaction +transpose +trendline +tscollect +tstats +typeahead +typelearner +typer +union +uniq +untable +where +x11 +xmlkv +xmlunescape +xpath +xyseries + +---------------------------------------------------- + +[ + ["keyword", "abstract"], + ["keyword", "accum"], + ["keyword", "addcoltotals"], + ["keyword", "addinfo"], + ["keyword", "addtotals"], + ["keyword", "analyzefields"], + ["keyword", "anomalies"], + ["keyword", "anomalousvalue"], + ["keyword", "anomalydetection"], + ["keyword", "append"], + ["keyword", "appendcols"], + ["keyword", "appendcsv"], + ["keyword", "appendlookup"], + ["keyword", "appendpipe"], + ["keyword", "arules"], + ["keyword", "associate"], + ["keyword", "audit"], + ["keyword", "autoregress"], + ["keyword", "bin"], + ["keyword", "bucket"], + ["keyword", "bucketdir"], + ["keyword", "chart"], + ["keyword", "cluster"], + ["keyword", "cofilter"], + ["keyword", "collect"], + ["keyword", "concurrency"], + ["keyword", "contingency"], + ["keyword", "convert"], + ["keyword", "correlate"], + ["keyword", "datamodel"], + ["keyword", "dbinspect"], + ["keyword", "dedup"], + ["keyword", "delete"], + ["keyword", "delta"], + ["keyword", "diff"], + ["keyword", "erex"], + ["keyword", "eval"], + ["keyword", "eventcount"], + ["keyword", "eventstats"], + ["keyword", "extract"], + ["keyword", "fieldformat"], + ["keyword", "fields"], + ["keyword", "fieldsummary"], + ["keyword", "filldown"], + ["keyword", "fillnull"], + ["keyword", "findtypes"], + ["keyword", "folderize"], + ["keyword", "foreach"], + ["keyword", "format"], + ["keyword", "from"], + ["keyword", "gauge"], + ["keyword", "gentimes"], + ["keyword", "geom"], + ["keyword", "geomfilter"], + ["keyword", "geostats"], + ["keyword", "head"], + ["keyword", "highlight"], + ["keyword", "history"], + ["keyword", "iconify"], + ["keyword", "input"], + ["keyword", "inputcsv"], + ["keyword", "inputlookup"], + ["keyword", "iplocation"], + ["keyword", "join"], + ["keyword", "kmeans"], + ["keyword", "kv"], + ["keyword", "kvform"], + ["keyword", "loadjob"], + ["keyword", "localize"], + ["keyword", "localop"], + ["keyword", "lookup"], + ["keyword", "makecontinuous"], + ["keyword", "makemv"], + ["keyword", "makeresults"], + ["keyword", "map"], + ["keyword", "mcollect"], + ["keyword", "metadata"], + ["keyword", "metasearch"], + ["keyword", "meventcollect"], + ["keyword", "mstats"], + ["keyword", "multikv"], + ["keyword", "multisearch"], + ["keyword", "mvcombine"], + ["keyword", "mvexpand"], + ["keyword", "nomv"], + ["keyword", "outlier"], + ["keyword", "outputcsv"], + ["keyword", "outputlookup"], + ["keyword", "outputtext"], + ["keyword", "overlap"], + ["keyword", "pivot"], + ["keyword", "predict"], + ["keyword", "rangemap"], + ["keyword", "rare"], + ["keyword", "regex"], + ["keyword", "relevancy"], + ["keyword", "reltime"], + ["keyword", "rename"], + ["keyword", "replace"], + ["keyword", "rest"], + ["keyword", "return"], + ["keyword", "reverse"], + ["keyword", "rex"], + ["keyword", "rtorder"], + ["keyword", "run"], + ["keyword", "savedsearch"], + ["keyword", "script"], + ["keyword", "scrub"], + ["keyword", "search"], + ["keyword", "searchtxn"], + ["keyword", "selfjoin"], + ["keyword", "sendemail"], + ["keyword", "set"], + ["keyword", "setfields"], + ["keyword", "sichart"], + ["keyword", "sirare"], + ["keyword", "sistats"], + ["keyword", "sitimechart"], + ["keyword", "sitop"], + ["keyword", "sort"], + ["keyword", "spath"], + ["keyword", "stats"], + ["keyword", "strcat"], + ["keyword", "streamstats"], + ["keyword", "table"], + ["keyword", "tags"], + ["keyword", "tail"], + ["keyword", "timechart"], + ["keyword", "timewrap"], + ["keyword", "top"], + ["keyword", "transaction"], + ["keyword", "transpose"], + ["keyword", "trendline"], + ["keyword", "tscollect"], + ["keyword", "tstats"], + ["keyword", "typeahead"], + ["keyword", "typelearner"], + ["keyword", "typer"], + ["keyword", "union"], + ["keyword", "uniq"], + ["keyword", "untable"], + ["keyword", "where"], + ["keyword", "x11"], + ["keyword", "xmlkv"], + ["keyword", "xmlunescape"], + ["keyword", "xpath"], + ["keyword", "xyseries"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/splunk-spl/number_feature.test b/package/src/prism/tests/languages/splunk-spl/number_feature.test new file mode 100644 index 00000000..3275c604 --- /dev/null +++ b/package/src/prism/tests/languages/splunk-spl/number_feature.test @@ -0,0 +1,13 @@ +123 +123.456 + +---------------------------------------------------- + +[ + ["number", "123"], + ["number", "123.456"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/splunk-spl/operator_feature.test b/package/src/prism/tests/languages/splunk-spl/operator_feature.test new file mode 100644 index 00000000..39cf70c8 --- /dev/null +++ b/package/src/prism/tests/languages/splunk-spl/operator_feature.test @@ -0,0 +1,44 @@ += +== >= <= > < ++ - * / % +| + +and not or xor AND NOT OR XOR +as by AS BY + +---------------------------------------------------- + +[ + ["operator", "="], + + ["operator", "=="], + ["operator", ">="], + ["operator", "<="], + ["operator", ">"], + ["operator", "<"], + + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + ["operator", "|"], + + ["operator-word", "and"], + ["operator-word", "not"], + ["operator-word", "or"], + ["operator-word", "xor"], + ["operator-word", "AND"], + ["operator-word", "NOT"], + ["operator-word", "OR"], + ["operator-word", "XOR"], + + ["operator-word", "as"], + ["operator-word", "by"], + ["operator-word", "AS"], + ["operator-word", "BY"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/splunk-spl/property_feature.test b/package/src/prism/tests/languages/splunk-spl/property_feature.test new file mode 100644 index 00000000..abf1af31 --- /dev/null +++ b/package/src/prism/tests/languages/splunk-spl/property_feature.test @@ -0,0 +1,9 @@ +host="mailsecure_log" + +---------------------------------------------------- + +[ + ["property", "host"], + ["operator", "="], + ["string", "\"mailsecure_log\""] +] diff --git a/package/src/prism/tests/languages/splunk-spl/punctuation_feature.test b/package/src/prism/tests/languages/splunk-spl/punctuation_feature.test new file mode 100644 index 00000000..553ff08f --- /dev/null +++ b/package/src/prism/tests/languages/splunk-spl/punctuation_feature.test @@ -0,0 +1,11 @@ +( ) [ ] , + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", ","] +] diff --git a/package/src/prism/tests/languages/splunk-spl/string_feature.test b/package/src/prism/tests/languages/splunk-spl/string_feature.test new file mode 100644 index 00000000..2b5da155 --- /dev/null +++ b/package/src/prism/tests/languages/splunk-spl/string_feature.test @@ -0,0 +1,13 @@ +"foo" +"\"foo\"" + +---------------------------------------------------- + +[ + ["string", "\"foo\""], + ["string", "\"\\\"foo\\\"\""] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/sqf/boolean_feature.test b/package/src/prism/tests/languages/sqf/boolean_feature.test new file mode 100644 index 00000000..ca34f181 --- /dev/null +++ b/package/src/prism/tests/languages/sqf/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/sqf/comment_feature.test b/package/src/prism/tests/languages/sqf/comment_feature.test new file mode 100644 index 00000000..a939474d --- /dev/null +++ b/package/src/prism/tests/languages/sqf/comment_feature.test @@ -0,0 +1,15 @@ +// comment +/* + comment + */ + +---------------------------------------------------- + +[ + ["comment", "// comment"], + ["comment", "/*\n comment\n */"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/sqf/constant_feature.test b/package/src/prism/tests/languages/sqf/constant_feature.test new file mode 100644 index 00000000..5d218d16 --- /dev/null +++ b/package/src/prism/tests/languages/sqf/constant_feature.test @@ -0,0 +1,21 @@ +// examples of direct input keycodes +DIK_0 +DIK_1 +DIK_APPS +DIK_BACKSLASH +DIK_CAPITAL + +---------------------------------------------------- + +[ + ["comment", "// examples of direct input keycodes"], + ["constant", "DIK_0"], + ["constant", "DIK_1"], + ["constant", "DIK_APPS"], + ["constant", "DIK_BACKSLASH"], + ["constant", "DIK_CAPITAL"] +] + +---------------------------------------------------- + +Checks for constants. diff --git a/package/src/prism/tests/languages/sqf/function_feature.test b/package/src/prism/tests/languages/sqf/function_feature.test new file mode 100644 index 00000000..8e45bb8f --- /dev/null +++ b/package/src/prism/tests/languages/sqf/function_feature.test @@ -0,0 +1,4397 @@ +abs +accTime +acos +action +actionIDs +actionKeys +actionKeysImages +actionKeysNames +actionKeysNamesArray +actionName +actionParams +activateAddons +activatedAddons +activateKey +add3DENConnection +add3DENEventHandler +add3DENLayer +addAction +addBackpack +addBackpackCargo +addBackpackCargoGlobal +addBackpackGlobal +addCamShake +addCuratorAddons +addCuratorCameraArea +addCuratorEditableObjects +addCuratorEditingArea +addCuratorPoints +addEditorObject +addEventHandler +addForce +addForceGeneratorRTD +addGoggles +addGroupIcon +addHandgunItem +addHeadgear +addItem +addItemCargo +addItemCargoGlobal +addItemPool +addItemToBackpack +addItemToUniform +addItemToVest +addLiveStats +addMagazine +addMagazineAmmoCargo +addMagazineCargo +addMagazineCargoGlobal +addMagazineGlobal +addMagazinePool +addMagazines +addMagazineTurret +addMenu +addMenuItem +addMissionEventHandler +addMPEventHandler +addMusicEventHandler +addOwnedMine +addPlayerScores +addPrimaryWeaponItem +addPublicVariableEventHandler +addRating +addResources +addScore +addScoreSide +addSecondaryWeaponItem +addSwitchableUnit +addTeamMember +addToRemainsCollector +addTorque +addUniform +addVehicle +addVest +addWaypoint +addWeapon +addWeaponCargo +addWeaponCargoGlobal +addWeaponGlobal +addWeaponItem +addWeaponPool +addWeaponTurret +admin +agent +agents +AGLToASL +aimedAtTarget +aimPos +airDensityCurveRTD +airDensityRTD +airplaneThrottle +airportSide +AISFinishHeal +alive +all3DENEntities +allAirports +allControls +allCurators +allCutLayers +allDead +allDeadMen +allDisplays +allGroups +allMapMarkers +allMines +allMissionObjects +allow3DMode +allowCrewInImmobile +allowCuratorLogicIgnoreAreas +allowDamage +allowDammage +allowFileOperations +allowFleeing +allowGetIn +allowSprint +allPlayers +allSimpleObjects +allSites +allTurrets +allUnits +allUnitsUAV +allVariables +ammo +ammoOnPylon +animate +animateBay +animateDoor +animatePylon +animateSource +animationNames +animationPhase +animationSourcePhase +animationState +append +apply +armoryPoints +arrayIntersect +asin +ASLToAGL +ASLToATL +assert +assignAsCargo +assignAsCargoIndex +assignAsCommander +assignAsDriver +assignAsGunner +assignAsTurret +assignCurator +assignedCargo +assignedCommander +assignedDriver +assignedGunner +assignedItems +assignedTarget +assignedTeam +assignedVehicle +assignedVehicleRole +assignItem +assignTeam +assignToAirport +atan +atan2 +atg +ATLToASL +attachedObject +attachedObjects +attachedTo +attachObject +attachTo +attackEnabled +backpack +backpackCargo +backpackContainer +backpackItems +backpackMagazines +backpackSpaceFor +behaviour +benchmark +binocular +blufor +boundingBox +boundingBoxReal +boundingCenter +briefingName +buildingExit +buildingPos +buldozer_EnableRoadDiag +buldozer_IsEnabledRoadDiag +buldozer_LoadNewRoads +buldozer_reloadOperMap +buttonAction +buttonSetAction +cadetMode +callExtension +camCommand +camCommit +camCommitPrepared +camCommitted +camConstuctionSetParams +camCreate +camDestroy +cameraEffect +cameraEffectEnableHUD +cameraInterest +cameraOn +cameraView +campaignConfigFile +camPreload +camPreloaded +camPrepareBank +camPrepareDir +camPrepareDive +camPrepareFocus +camPrepareFov +camPrepareFovRange +camPreparePos +camPrepareRelPos +camPrepareTarget +camSetBank +camSetDir +camSetDive +camSetFocus +camSetFov +camSetFovRange +camSetPos +camSetRelPos +camSetTarget +camTarget +camUseNVG +canAdd +canAddItemToBackpack +canAddItemToUniform +canAddItemToVest +cancelSimpleTaskDestination +canFire +canMove +canSlingLoad +canStand +canSuspend +canTriggerDynamicSimulation +canUnloadInCombat +canVehicleCargo +captive +captiveNum +cbChecked +cbSetChecked +ceil +channelEnabled +cheatsEnabled +checkAIFeature +checkVisibility +civilian +className +clear3DENAttribute +clear3DENInventory +clearAllItemsFromBackpack +clearBackpackCargo +clearBackpackCargoGlobal +clearForcesRTD +clearGroupIcons +clearItemCargo +clearItemCargoGlobal +clearItemPool +clearMagazineCargo +clearMagazineCargoGlobal +clearMagazinePool +clearOverlay +clearRadio +clearVehicleInit +clearWeaponCargo +clearWeaponCargoGlobal +clearWeaponPool +clientOwner +closeDialog +closeDisplay +closeOverlay +collapseObjectTree +collect3DENHistory +collectiveRTD +combatMode +commandArtilleryFire +commandChat +commander +commandFire +commandFollow +commandFSM +commandGetOut +commandingMenu +commandMove +commandRadio +commandStop +commandSuppressiveFire +commandTarget +commandWatch +comment +commitOverlay +compile +compileFinal +completedFSM +composeText +configClasses +configFile +configHierarchy +configName +configNull +configProperties +configSourceAddonList +configSourceMod +configSourceModList +confirmSensorTarget +connectTerminalToUAV +controlNull +controlsGroupCtrl +copyFromClipboard +copyToClipboard +copyWaypoints +cos +count +countEnemy +countFriendly +countSide +countType +countUnknown +create3DENComposition +create3DENEntity +createAgent +createCenter +createDialog +createDiaryLink +createDiaryRecord +createDiarySubject +createDisplay +createGearDialog +createGroup +createGuardedPoint +createLocation +createMarker +createMarkerLocal +createMenu +createMine +createMissionDisplay +createMPCampaignDisplay +createSimpleObject +createSimpleTask +createSite +createSoundSource +createTask +createTeam +createTrigger +createUnit +createVehicle +createVehicleCrew +createVehicleLocal +crew +ctAddHeader +ctAddRow +ctClear +ctCurSel +ctData +ctFindHeaderRows +ctFindRowHeader +ctHeaderControls +ctHeaderCount +ctRemoveHeaders +ctRemoveRows +ctrlActivate +ctrlAddEventHandler +ctrlAngle +ctrlAutoScrollDelay +ctrlAutoScrollRewind +ctrlAutoScrollSpeed +ctrlChecked +ctrlClassName +ctrlCommit +ctrlCommitted +ctrlCreate +ctrlDelete +ctrlEnable +ctrlEnabled +ctrlFade +ctrlHTMLLoaded +ctrlIDC +ctrlIDD +ctrlMapAnimAdd +ctrlMapAnimClear +ctrlMapAnimCommit +ctrlMapAnimDone +ctrlMapCursor +ctrlMapMouseOver +ctrlMapScale +ctrlMapScreenToWorld +ctrlMapWorldToScreen +ctrlModel +ctrlModelDirAndUp +ctrlModelScale +ctrlParent +ctrlParentControlsGroup +ctrlPosition +ctrlRemoveAllEventHandlers +ctrlRemoveEventHandler +ctrlScale +ctrlSetActiveColor +ctrlSetAngle +ctrlSetAutoScrollDelay +ctrlSetAutoScrollRewind +ctrlSetAutoScrollSpeed +ctrlSetBackgroundColor +ctrlSetChecked +ctrlSetDisabledColor +ctrlSetEventHandler +ctrlSetFade +ctrlSetFocus +ctrlSetFont +ctrlSetFontH1 +ctrlSetFontH1B +ctrlSetFontH2 +ctrlSetFontH2B +ctrlSetFontH3 +ctrlSetFontH3B +ctrlSetFontH4 +ctrlSetFontH4B +ctrlSetFontH5 +ctrlSetFontH5B +ctrlSetFontH6 +ctrlSetFontH6B +ctrlSetFontHeight +ctrlSetFontHeightH1 +ctrlSetFontHeightH2 +ctrlSetFontHeightH3 +ctrlSetFontHeightH4 +ctrlSetFontHeightH5 +ctrlSetFontHeightH6 +ctrlSetFontHeightSecondary +ctrlSetFontP +ctrlSetFontPB +ctrlSetFontSecondary +ctrlSetForegroundColor +ctrlSetModel +ctrlSetModelDirAndUp +ctrlSetModelScale +ctrlSetPixelPrecision +ctrlSetPosition +ctrlSetScale +ctrlSetStructuredText +ctrlSetText +ctrlSetTextColor +ctrlSetTextColorSecondary +ctrlSetTextSecondary +ctrlSetTooltip +ctrlSetTooltipColorBox +ctrlSetTooltipColorShade +ctrlSetTooltipColorText +ctrlShow +ctrlShown +ctrlText +ctrlTextHeight +ctrlTextSecondary +ctrlTextWidth +ctrlType +ctrlVisible +ctRowControls +ctRowCount +ctSetCurSel +ctSetData +ctSetHeaderTemplate +ctSetRowTemplate +ctSetValue +ctValue +curatorAddons +curatorCamera +curatorCameraArea +curatorCameraAreaCeiling +curatorCoef +curatorEditableObjects +curatorEditingArea +curatorEditingAreaType +curatorMouseOver +curatorPoints +curatorRegisteredObjects +curatorSelected +curatorWaypointCost +current3DENOperation +currentChannel +currentCommand +currentMagazine +currentMagazineDetail +currentMagazineDetailTurret +currentMagazineTurret +currentMuzzle +currentNamespace +currentTask +currentTasks +currentThrowable +currentVisionMode +currentWaypoint +currentWeapon +currentWeaponMode +currentWeaponTurret +currentZeroing +cursorObject +cursorTarget +customChat +customRadio +cutFadeOut +cutObj +cutRsc +cutText +damage +date +dateToNumber +daytime +deActivateKey +debriefingText +debugFSM +debugLog +deg +delete3DENEntities +deleteAt +deleteCenter +deleteCollection +deleteEditorObject +deleteGroup +deleteGroupWhenEmpty +deleteIdentity +deleteLocation +deleteMarker +deleteMarkerLocal +deleteRange +deleteResources +deleteSite +deleteStatus +deleteTeam +deleteVehicle +deleteVehicleCrew +deleteWaypoint +detach +detectedMines +diag_activeMissionFSMs +diag_activeScripts +diag_activeSQFScripts +diag_activeSQSScripts +diag_captureFrame +diag_captureFrameToFile +diag_captureSlowFrame +diag_codePerformance +diag_drawMode +diag_dynamicSimulationEnd +diag_enable +diag_enabled +diag_fps +diag_fpsMin +diag_frameNo +diag_lightNewLoad +diag_list +diag_log +diag_logSlowFrame +diag_mergeConfigFile +diag_recordTurretLimits +diag_setLightNew +diag_tickTime +diag_toggle +dialog +diarySubjectExists +didJIP +didJIPOwner +difficulty +difficultyEnabled +difficultyEnabledRTD +difficultyOption +direction +directSay +disableAI +disableCollisionWith +disableConversation +disableDebriefingStats +disableMapIndicators +disableNVGEquipment +disableRemoteSensors +disableSerialization +disableTIEquipment +disableUAVConnectability +disableUserInput +displayAddEventHandler +displayCtrl +displayNull +displayParent +displayRemoveAllEventHandlers +displayRemoveEventHandler +displaySetEventHandler +dissolveTeam +distance +distance2D +distanceSqr +distributionRegion +do3DENAction +doArtilleryFire +doFire +doFollow +doFSM +doGetOut +doMove +doorPhase +doStop +doSuppressiveFire +doTarget +doWatch +drawArrow +drawEllipse +drawIcon +drawIcon3D +drawLine +drawLine3D +drawLink +drawLocation +drawPolygon +drawRectangle +drawTriangle +driver +drop +dynamicSimulationDistance +dynamicSimulationDistanceCoef +dynamicSimulationEnabled +dynamicSimulationSystemEnabled +east +edit3DENMissionAttributes +editObject +editorSetEventHandler +effectiveCommander +emptyPositions +enableAI +enableAIFeature +enableAimPrecision +enableAttack +enableAudioFeature +enableAutoStartUpRTD +enableAutoTrimRTD +enableCamShake +enableCaustics +enableChannel +enableCollisionWith +enableCopilot +enableDebriefingStats +enableDiagLegend +enableDynamicSimulation +enableDynamicSimulationSystem +enableEndDialog +enableEngineArtillery +enableEnvironment +enableFatigue +enableGunLights +enableInfoPanelComponent +enableIRLasers +enableMimics +enablePersonTurret +enableRadio +enableReload +enableRopeAttach +enableSatNormalOnDetail +enableSaving +enableSentences +enableSimulation +enableSimulationGlobal +enableStamina +enableStressDamage +enableTeamSwitch +enableTraffic +enableUAVConnectability +enableUAVWaypoints +enableVehicleCargo +enableVehicleSensor +enableWeaponDisassembly +endl +endLoadingScreen +endMission +engineOn +enginesIsOnRTD +enginesPowerRTD +enginesRpmRTD +enginesTorqueRTD +entities +environmentEnabled +estimatedEndServerTime +estimatedTimeLeft +evalObjectArgument +everyBackpack +everyContainer +exec +execEditorScript +exp +expectedDestination +exportJIPMessages +eyeDirection +eyePos +face +faction +fadeMusic +fadeRadio +fadeSound +fadeSpeech +failMission +fillWeaponsFromPool +find +findCover +findDisplay +findEditorObject +findEmptyPosition +findEmptyPositionReady +findIf +findNearestEnemy +finishMissionInit +finite +fire +fireAtTarget +firstBackpack +flag +flagAnimationPhase +flagOwner +flagSide +flagTexture +fleeing +floor +flyInHeight +flyInHeightASL +fog +fogForecast +fogParams +forceAddUniform +forceAtPositionRTD +forcedMap +forceEnd +forceFlagTexture +forceFollowRoad +forceGeneratorRTD +forceMap +forceRespawn +forceSpeed +forceWalk +forceWeaponFire +forceWeatherChange +forgetTarget +format +formation +formationDirection +formationLeader +formationMembers +formationPosition +formationTask +formatText +formLeader +freeLook +fromEditor +fuel +fullCrew +gearIDCAmmoCount +gearSlotAmmoCount +gearSlotData +get3DENActionState +get3DENAttribute +get3DENCamera +get3DENConnections +get3DENEntity +get3DENEntityID +get3DENGrid +get3DENIconsVisible +get3DENLayerEntities +get3DENLinesVisible +get3DENMissionAttribute +get3DENMouseOver +get3DENSelected +getAimingCoef +getAllEnvSoundControllers +getAllHitPointsDamage +getAllOwnedMines +getAllSoundControllers +getAmmoCargo +getAnimAimPrecision +getAnimSpeedCoef +getArray +getArtilleryAmmo +getArtilleryComputerSettings +getArtilleryETA +getAssignedCuratorLogic +getAssignedCuratorUnit +getBackpackCargo +getBleedingRemaining +getBurningValue +getCameraViewDirection +getCargoIndex +getCenterOfMass +getClientState +getClientStateNumber +getCompatiblePylonMagazines +getConnectedUAV +getContainerMaxLoad +getCursorObjectParams +getCustomAimCoef +getDammage +getDescription +getDir +getDirVisual +getDLCAssetsUsage +getDLCAssetsUsageByName +getDLCs +getDLCUsageTime +getEditorCamera +getEditorMode +getEditorObjectScope +getElevationOffset +getEngineTargetRpmRTD +getEnvSoundController +getFatigue +getFieldManualStartPage +getForcedFlagTexture +getFriend +getFSMVariable +getFuelCargo +getGroupIcon +getGroupIconParams +getGroupIcons +getHideFrom +getHit +getHitIndex +getHitPointDamage +getItemCargo +getMagazineCargo +getMarkerColor +getMarkerPos +getMarkerSize +getMarkerType +getMass +getMissionConfig +getMissionConfigValue +getMissionDLCs +getMissionLayerEntities +getMissionLayers +getModelInfo +getMousePosition +getMusicPlayedTime +getNumber +getObjectArgument +getObjectChildren +getObjectDLC +getObjectMaterials +getObjectProxy +getObjectTextures +getObjectType +getObjectViewDistance +getOxygenRemaining +getPersonUsedDLCs +getPilotCameraDirection +getPilotCameraPosition +getPilotCameraRotation +getPilotCameraTarget +getPlateNumber +getPlayerChannel +getPlayerScores +getPlayerUID +getPlayerUIDOld +getPos +getPosASL +getPosASLVisual +getPosASLW +getPosATL +getPosATLVisual +getPosVisual +getPosWorld +getPylonMagazines +getRelDir +getRelPos +getRemoteSensorsDisabled +getRepairCargo +getResolution +getRotorBrakeRTD +getShadowDistance +getShotParents +getSlingLoad +getSoundController +getSoundControllerResult +getSpeed +getStamina +getStatValue +getSuppression +getTerrainGrid +getTerrainHeightASL +getText +getTotalDLCUsageTime +getTrimOffsetRTD +getUnitLoadout +getUnitTrait +getUserMFDText +getUserMFDValue +getVariable +getVehicleCargo +getWeaponCargo +getWeaponSway +getWingsOrientationRTD +getWingsPositionRTD +getWPPos +glanceAt +globalChat +globalRadio +goggles +group +groupChat +groupFromNetId +groupIconSelectable +groupIconsVisible +groupId +groupOwner +groupRadio +groupSelectedUnits +groupSelectUnit +grpNull +gunner +gusts +halt +handgunItems +handgunMagazine +handgunWeapon +handsHit +hasInterface +hasPilotCamera +hasWeapon +hcAllGroups +hcGroupParams +hcLeader +hcRemoveAllGroups +hcRemoveGroup +hcSelected +hcSelectGroup +hcSetGroup +hcShowBar +hcShownBar +headgear +hideBody +hideObject +hideObjectGlobal +hideSelection +hint +hintC +hintCadet +hintSilent +hmd +hostMission +htmlLoad +HUDMovementLevels +humidity +image +importAllGroups +importance +in +inArea +inAreaArray +incapacitatedState +independent +inflame +inflamed +infoPanel +infoPanelComponentEnabled +infoPanelComponents +infoPanels +inGameUISetEventHandler +inheritsFrom +initAmbientLife +inPolygon +inputAction +inRangeOfArtillery +insertEditorObject +intersect +is3DEN +is3DENMultiplayer +isAbleToBreathe +isAgent +isAimPrecisionEnabled +isArray +isAutoHoverOn +isAutonomous +isAutoStartUpEnabledRTD +isAutotest +isAutoTrimOnRTD +isBleeding +isBurning +isClass +isCollisionLightOn +isCopilotEnabled +isDamageAllowed +isDedicated +isDLCAvailable +isEngineOn +isEqualTo +isEqualType +isEqualTypeAll +isEqualTypeAny +isEqualTypeArray +isEqualTypeParams +isFilePatchingEnabled +isFlashlightOn +isFlatEmpty +isForcedWalk +isFormationLeader +isGroupDeletedWhenEmpty +isHidden +isInRemainsCollector +isInstructorFigureEnabled +isIRLaserOn +isKeyActive +isKindOf +isLaserOn +isLightOn +isLocalized +isManualFire +isMarkedForCollection +isMultiplayer +isMultiplayerSolo +isNil +isNull +isNumber +isObjectHidden +isObjectRTD +isOnRoad +isPipEnabled +isPlayer +isRealTime +isRemoteExecuted +isRemoteExecutedJIP +isServer +isShowing3DIcons +isSimpleObject +isSprintAllowed +isStaminaEnabled +isSteamMission +isStreamFriendlyUIEnabled +isStressDamageEnabled +isText +isTouchingGround +isTurnedOut +isTutHintsEnabled +isUAVConnectable +isUAVConnected +isUIContext +isUniformAllowed +isVehicleCargo +isVehicleRadarOn +isVehicleSensorEnabled +isWalking +isWeaponDeployed +isWeaponRested +itemCargo +items +itemsWithMagazines +join +joinAs +joinAsSilent +joinSilent +joinString +kbAddDatabase +kbAddDatabaseTargets +kbAddTopic +kbHasTopic +kbReact +kbRemoveTopic +kbTell +kbWasSaid +keyImage +keyName +knowsAbout +land +landAt +landResult +language +laserTarget +lbAdd +lbClear +lbColor +lbColorRight +lbCurSel +lbData +lbDelete +lbIsSelected +lbPicture +lbPictureRight +lbSelection +lbSetColor +lbSetColorRight +lbSetCurSel +lbSetData +lbSetPicture +lbSetPictureColor +lbSetPictureColorDisabled +lbSetPictureColorSelected +lbSetPictureRight +lbSetPictureRightColor +lbSetPictureRightColorDisabled +lbSetPictureRightColorSelected +lbSetSelectColor +lbSetSelectColorRight +lbSetSelected +lbSetText +lbSetTextRight +lbSetTooltip +lbSetValue +lbSize +lbSort +lbSortByValue +lbText +lbTextRight +lbValue +leader +leaderboardDeInit +leaderboardGetRows +leaderboardInit +leaderboardRequestRowsFriends +leaderboardRequestRowsGlobal +leaderboardRequestRowsGlobalAroundUser +leaderboardsRequestUploadScore +leaderboardsRequestUploadScoreKeepBest +leaderboardState +leaveVehicle +libraryCredits +libraryDisclaimers +lifeState +lightAttachObject +lightDetachObject +lightIsOn +lightnings +limitSpeed +linearConversion +lineBreak +lineIntersects +lineIntersectsObjs +lineIntersectsSurfaces +lineIntersectsWith +linkItem +list +listObjects +listRemoteTargets +listVehicleSensors +ln +lnbAddArray +lnbAddColumn +lnbAddRow +lnbClear +lnbColor +lnbColorRight +lnbCurSelRow +lnbData +lnbDeleteColumn +lnbDeleteRow +lnbGetColumnsPosition +lnbPicture +lnbPictureRight +lnbSetColor +lnbSetColorRight +lnbSetColumnsPos +lnbSetCurSelRow +lnbSetData +lnbSetPicture +lnbSetPictureColor +lnbSetPictureColorRight +lnbSetPictureColorSelected +lnbSetPictureColorSelectedRight +lnbSetPictureRight +lnbSetText +lnbSetTextRight +lnbSetValue +lnbSize +lnbSort +lnbSortByValue +lnbText +lnbTextRight +lnbValue +load +loadAbs +loadBackpack +loadFile +loadGame +loadIdentity +loadMagazine +loadOverlay +loadStatus +loadUniform +loadVest +local +localize +locationNull +locationPosition +lock +lockCameraTo +lockCargo +lockDriver +locked +lockedCargo +lockedDriver +lockedTurret +lockIdentity +lockTurret +lockWP +log +logEntities +logNetwork +logNetworkTerminate +lookAt +lookAtPos +magazineCargo +magazines +magazinesAllTurrets +magazinesAmmo +magazinesAmmoCargo +magazinesAmmoFull +magazinesDetail +magazinesDetailBackpack +magazinesDetailUniform +magazinesDetailVest +magazinesTurret +magazineTurretAmmo +mapAnimAdd +mapAnimClear +mapAnimCommit +mapAnimDone +mapCenterOnCamera +mapGridPosition +markAsFinishedOnSteam +markerAlpha +markerBrush +markerColor +markerDir +markerPos +markerShape +markerSize +markerText +markerType +max +members +menuAction +menuAdd +menuChecked +menuClear +menuCollapse +menuData +menuDelete +menuEnable +menuEnabled +menuExpand +menuHover +menuPicture +menuSetAction +menuSetCheck +menuSetData +menuSetPicture +menuSetValue +menuShortcut +menuShortcutText +menuSize +menuSort +menuText +menuURL +menuValue +min +mineActive +mineDetectedBy +missionConfigFile +missionDifficulty +missionName +missionNamespace +missionStart +missionVersion +modelToWorld +modelToWorldVisual +modelToWorldVisualWorld +modelToWorldWorld +modParams +moonIntensity +moonPhase +morale +move +move3DENCamera +moveInAny +moveInCargo +moveInCommander +moveInDriver +moveInGunner +moveInTurret +moveObjectToEnd +moveOut +moveTime +moveTo +moveToCompleted +moveToFailed +musicVolume +name +nameSound +nearEntities +nearestBuilding +nearestLocation +nearestLocations +nearestLocationWithDubbing +nearestObject +nearestObjects +nearestTerrainObjects +nearObjects +nearObjectsReady +nearRoads +nearSupplies +nearTargets +needReload +netId +netObjNull +newOverlay +nextMenuItemIndex +nextWeatherChange +nMenuItems +numberOfEnginesRTD +numberToDate +objectCurators +objectFromNetId +objectParent +objNull +objStatus +onBriefingGear +onBriefingGroup +onBriefingNotes +onBriefingPlan +onBriefingTeamSwitch +onCommandModeChanged +onDoubleClick +onEachFrame +onGroupIconClick +onGroupIconOverEnter +onGroupIconOverLeave +onHCGroupSelectionChanged +onMapSingleClick +onPlayerConnected +onPlayerDisconnected +onPreloadFinished +onPreloadStarted +onShowNewObject +onTeamSwitch +openCuratorInterface +openDLCPage +openDSInterface +openMap +openSteamApp +openYoutubeVideo +opfor +orderGetIn +overcast +overcastForecast +owner +param +params +parseNumber +parseSimpleArray +parseText +parsingNamespace +particlesQuality +pi +pickWeaponPool +pitch +pixelGrid +pixelGridBase +pixelGridNoUIScale +pixelH +pixelW +playableSlotsNumber +playableUnits +playAction +playActionNow +player +playerRespawnTime +playerSide +playersNumber +playGesture +playMission +playMove +playMoveNow +playMusic +playScriptedMission +playSound +playSound3D +position +positionCameraToWorld +posScreenToWorld +posWorldToScreen +ppEffectAdjust +ppEffectCommit +ppEffectCommitted +ppEffectCreate +ppEffectDestroy +ppEffectEnable +ppEffectEnabled +ppEffectForceInNVG +precision +preloadCamera +preloadObject +preloadSound +preloadTitleObj +preloadTitleRsc +primaryWeapon +primaryWeaponItems +primaryWeaponMagazine +priority +processDiaryLink +processInitCommands +productVersion +profileName +profileNamespace +profileNameSteam +progressLoadingScreen +progressPosition +progressSetPosition +publicVariable +publicVariableClient +publicVariableServer +pushBack +pushBackUnique +putWeaponPool +queryItemsPool +queryMagazinePool +queryWeaponPool +rad +radioChannelAdd +radioChannelCreate +radioChannelRemove +radioChannelSetCallSign +radioChannelSetLabel +radioVolume +rain +rainbow +random +rank +rankId +rating +rectangular +registeredTasks +registerTask +reload +reloadEnabled +remoteControl +remoteExec +remoteExecCall +remoteExecutedOwner +remove3DENConnection +remove3DENEventHandler +remove3DENLayer +removeAction +removeAll3DENEventHandlers +removeAllActions +removeAllAssignedItems +removeAllContainers +removeAllCuratorAddons +removeAllCuratorCameraAreas +removeAllCuratorEditingAreas +removeAllEventHandlers +removeAllHandgunItems +removeAllItems +removeAllItemsWithMagazines +removeAllMissionEventHandlers +removeAllMPEventHandlers +removeAllMusicEventHandlers +removeAllOwnedMines +removeAllPrimaryWeaponItems +removeAllWeapons +removeBackpack +removeBackpackGlobal +removeCuratorAddons +removeCuratorCameraArea +removeCuratorEditableObjects +removeCuratorEditingArea +removeDrawIcon +removeDrawLinks +removeEventHandler +removeFromRemainsCollector +removeGoggles +removeGroupIcon +removeHandgunItem +removeHeadgear +removeItem +removeItemFromBackpack +removeItemFromUniform +removeItemFromVest +removeItems +removeMagazine +removeMagazineGlobal +removeMagazines +removeMagazinesTurret +removeMagazineTurret +removeMenuItem +removeMissionEventHandler +removeMPEventHandler +removeMusicEventHandler +removeOwnedMine +removePrimaryWeaponItem +removeSecondaryWeaponItem +removeSimpleTask +removeSwitchableUnit +removeTeamMember +removeUniform +removeVest +removeWeapon +removeWeaponAttachmentCargo +removeWeaponCargo +removeWeaponGlobal +removeWeaponTurret +reportRemoteTarget +requiredVersion +resetCamShake +resetSubgroupDirection +resistance +resize +resources +respawnVehicle +restartEditorCamera +reveal +revealMine +reverse +reversedMouseY +roadAt +roadsConnectedTo +roleDescription +ropeAttachedObjects +ropeAttachedTo +ropeAttachEnabled +ropeAttachTo +ropeCreate +ropeCut +ropeDestroy +ropeDetach +ropeEndPosition +ropeLength +ropes +ropeUnwind +ropeUnwound +rotorsForcesRTD +rotorsRpmRTD +round +runInitScript +safeZoneH +safeZoneW +safeZoneWAbs +safeZoneX +safeZoneXAbs +safeZoneY +save3DENInventory +saveGame +saveIdentity +saveJoysticks +saveOverlay +saveProfileNamespace +saveStatus +saveVar +savingEnabled +say +say2D +say3D +score +scoreSide +screenshot +screenToWorld +scriptDone +scriptName +scriptNull +scudState +secondaryWeapon +secondaryWeaponItems +secondaryWeaponMagazine +select +selectBestPlaces +selectDiarySubject +selectedEditorObjects +selectEditorObject +selectionNames +selectionPosition +selectLeader +selectMax +selectMin +selectNoPlayer +selectPlayer +selectRandom +selectRandomWeighted +selectWeapon +selectWeaponTurret +sendAUMessage +sendSimpleCommand +sendTask +sendTaskResult +sendUDPMessage +serverCommand +serverCommandAvailable +serverCommandExecutable +serverName +serverTime +set +set3DENAttribute +set3DENAttributes +set3DENGrid +set3DENIconsVisible +set3DENLayer +set3DENLinesVisible +set3DENLogicType +set3DENMissionAttribute +set3DENMissionAttributes +set3DENModelsVisible +set3DENObjectType +set3DENSelected +setAccTime +setActualCollectiveRTD +setAirplaneThrottle +setAirportSide +setAmmo +setAmmoCargo +setAmmoOnPylon +setAnimSpeedCoef +setAperture +setApertureNew +setArmoryPoints +setAttributes +setAutonomous +setBehaviour +setBleedingRemaining +setBrakesRTD +setCameraInterest +setCamShakeDefParams +setCamShakeParams +setCamUseTI +setCaptive +setCenterOfMass +setCollisionLight +setCombatMode +setCompassOscillation +setConvoySeparation +setCuratorCameraAreaCeiling +setCuratorCoef +setCuratorEditingAreaType +setCuratorWaypointCost +setCurrentChannel +setCurrentTask +setCurrentWaypoint +setCustomAimCoef +setCustomWeightRTD +setDamage +setDammage +setDate +setDebriefingText +setDefaultCamera +setDestination +setDetailMapBlendPars +setDir +setDirection +setDrawIcon +setDriveOnPath +setDropInterval +setDynamicSimulationDistance +setDynamicSimulationDistanceCoef +setEditorMode +setEditorObjectScope +setEffectCondition +setEngineRpmRTD +setFace +setFaceAnimation +setFatigue +setFeatureType +setFlagAnimationPhase +setFlagOwner +setFlagSide +setFlagTexture +setFog +setForceGeneratorRTD +setFormation +setFormationTask +setFormDir +setFriend +setFromEditor +setFSMVariable +setFuel +setFuelCargo +setGroupIcon +setGroupIconParams +setGroupIconsSelectable +setGroupIconsVisible +setGroupId +setGroupIdGlobal +setGroupOwner +setGusts +setHideBehind +setHit +setHitIndex +setHitPointDamage +setHorizonParallaxCoef +setHUDMovementLevels +setIdentity +setImportance +setInfoPanel +setLeader +setLightAmbient +setLightAttenuation +setLightBrightness +setLightColor +setLightDayLight +setLightFlareMaxDistance +setLightFlareSize +setLightIntensity +setLightnings +setLightUseFlare +setLocalWindParams +setMagazineTurretAmmo +setMarkerAlpha +setMarkerAlphaLocal +setMarkerBrush +setMarkerBrushLocal +setMarkerColor +setMarkerColorLocal +setMarkerDir +setMarkerDirLocal +setMarkerPos +setMarkerPosLocal +setMarkerShape +setMarkerShapeLocal +setMarkerSize +setMarkerSizeLocal +setMarkerText +setMarkerTextLocal +setMarkerType +setMarkerTypeLocal +setMass +setMimic +setMousePosition +setMusicEffect +setMusicEventHandler +setName +setNameSound +setObjectArguments +setObjectMaterial +setObjectMaterialGlobal +setObjectProxy +setObjectTexture +setObjectTextureGlobal +setObjectViewDistance +setOvercast +setOwner +setOxygenRemaining +setParticleCircle +setParticleClass +setParticleFire +setParticleParams +setParticleRandom +setPilotCameraDirection +setPilotCameraRotation +setPilotCameraTarget +setPilotLight +setPiPEffect +setPitch +setPlateNumber +setPlayable +setPlayerRespawnTime +setPos +setPosASL +setPosASL2 +setPosASLW +setPosATL +setPosition +setPosWorld +setPylonLoadOut +setPylonsPriority +setRadioMsg +setRain +setRainbow +setRandomLip +setRank +setRectangular +setRepairCargo +setRotorBrakeRTD +setShadowDistance +setShotParents +setSide +setSimpleTaskAlwaysVisible +setSimpleTaskCustomData +setSimpleTaskDescription +setSimpleTaskDestination +setSimpleTaskTarget +setSimpleTaskType +setSimulWeatherLayers +setSize +setSkill +setSlingLoad +setSoundEffect +setSpeaker +setSpeech +setSpeedMode +setStamina +setStaminaScheme +setStatValue +setSuppression +setSystemOfUnits +setTargetAge +setTaskMarkerOffset +setTaskResult +setTaskState +setTerrainGrid +setText +setTimeMultiplier +setTitleEffect +setToneMapping +setToneMappingParams +setTrafficDensity +setTrafficDistance +setTrafficGap +setTrafficSpeed +setTriggerActivation +setTriggerArea +setTriggerStatements +setTriggerText +setTriggerTimeout +setTriggerType +setType +setUnconscious +setUnitAbility +setUnitLoadout +setUnitPos +setUnitPosWeak +setUnitRank +setUnitRecoilCoefficient +setUnitTrait +setUnloadInCombat +setUserActionText +setUserMFDText +setUserMFDValue +setVariable +setVectorDir +setVectorDirAndUp +setVectorUp +setVehicleAmmo +setVehicleAmmoDef +setVehicleArmor +setVehicleCargo +setVehicleId +setVehicleInit +setVehicleLock +setVehiclePosition +setVehicleRadar +setVehicleReceiveRemoteTargets +setVehicleReportOwnPosition +setVehicleReportRemoteTargets +setVehicleTIPars +setVehicleVarName +setVelocity +setVelocityModelSpace +setVelocityTransformation +setViewDistance +setVisibleIfTreeCollapsed +setWantedRpmRTD +setWaves +setWaypointBehaviour +setWaypointCombatMode +setWaypointCompletionRadius +setWaypointDescription +setWaypointForceBehaviour +setWaypointFormation +setWaypointHousePosition +setWaypointLoiterRadius +setWaypointLoiterType +setWaypointName +setWaypointPosition +setWaypointScript +setWaypointSpeed +setWaypointStatements +setWaypointTimeout +setWaypointType +setWaypointVisible +setWeaponReloadingTime +setWind +setWindDir +setWindForce +setWindStr +setWingForceScaleRTD +setWPPos +show3DIcons +showChat +showCinemaBorder +showCommandingMenu +showCompass +showCuratorCompass +showGPS +showHUD +showLegend +showMap +shownArtilleryComputer +shownChat +shownCompass +shownCuratorCompass +showNewEditorObject +shownGPS +shownHUD +shownMap +shownPad +shownRadio +shownScoretable +shownUAVFeed +shownWarrant +shownWatch +showPad +showRadio +showScoretable +showSubtitles +showUAVFeed +showWarrant +showWatch +showWaypoint +showWaypoints +side +sideAmbientLife +sideChat +sideEmpty +sideEnemy +sideFriendly +sideLogic +sideRadio +sideUnknown +simpleTasks +simulationEnabled +simulCloudDensity +simulCloudOcclusion +simulInClouds +simulWeatherSync +sin +size +sizeOf +skill +skillFinal +skipTime +sleep +sliderPosition +sliderRange +sliderSetPosition +sliderSetRange +sliderSetSpeed +sliderSpeed +slingLoadAssistantShown +soldierMagazines +someAmmo +sort +soundVolume +speaker +speed +speedMode +splitString +sqrt +squadParams +stance +startLoadingScreen +stop +stopEngineRTD +stopped +str +sunOrMoon +supportInfo +suppressFor +surfaceIsWater +surfaceNormal +surfaceType +swimInDepth +switchableUnits +switchAction +switchCamera +switchGesture +switchLight +switchMove +synchronizedObjects +synchronizedTriggers +synchronizedWaypoints +synchronizeObjectsAdd +synchronizeObjectsRemove +synchronizeTrigger +synchronizeWaypoint +systemChat +systemOfUnits +tan +targetKnowledge +targets +targetsAggregate +targetsQuery +taskAlwaysVisible +taskChildren +taskCompleted +taskCustomData +taskDescription +taskDestination +taskHint +taskMarkerOffset +taskNull +taskParent +taskResult +taskState +taskType +teamMember +teamMemberNull +teamName +teams +teamSwitch +teamSwitchEnabled +teamType +terminate +terrainIntersect +terrainIntersectASL +terrainIntersectAtASL +text +textLog +textLogFormat +tg +time +timeMultiplier +titleCut +titleFadeOut +titleObj +titleRsc +titleText +toArray +toFixed +toLower +toString +toUpper +triggerActivated +triggerActivation +triggerArea +triggerAttachedVehicle +triggerAttachObject +triggerAttachVehicle +triggerDynamicSimulation +triggerStatements +triggerText +triggerTimeout +triggerTimeoutCurrent +triggerType +turretLocal +turretOwner +turretUnit +tvAdd +tvClear +tvCollapse +tvCollapseAll +tvCount +tvCurSel +tvData +tvDelete +tvExpand +tvExpandAll +tvPicture +tvPictureRight +tvSetColor +tvSetCurSel +tvSetData +tvSetPicture +tvSetPictureColor +tvSetPictureColorDisabled +tvSetPictureColorSelected +tvSetPictureRight +tvSetPictureRightColor +tvSetPictureRightColorDisabled +tvSetPictureRightColorSelected +tvSetSelectColor +tvSetText +tvSetTooltip +tvSetValue +tvSort +tvSortByValue +tvText +tvTooltip +tvValue +type +typeName +typeOf +UAVControl +uiNamespace +uiSleep +unassignCurator +unassignItem +unassignTeam +unassignVehicle +underwater +uniform +uniformContainer +uniformItems +uniformMagazines +unitAddons +unitAimPosition +unitAimPositionVisual +unitBackpack +unitIsUAV +unitPos +unitReady +unitRecoilCoefficient +units +unitsBelowHeight +unlinkItem +unlockAchievement +unregisterTask +updateDrawIcon +updateMenuItem +updateObjectTree +useAIOperMapObstructionTest +useAISteeringComponent +useAudioTimeForMoves +userInputDisabled +vectorAdd +vectorCos +vectorCrossProduct +vectorDiff +vectorDir +vectorDirVisual +vectorDistance +vectorDistanceSqr +vectorDotProduct +vectorFromTo +vectorMagnitude +vectorMagnitudeSqr +vectorModelToWorld +vectorModelToWorldVisual +vectorMultiply +vectorNormalized +vectorUp +vectorUpVisual +vectorWorldToModel +vectorWorldToModelVisual +vehicle +vehicleCargoEnabled +vehicleChat +vehicleRadio +vehicleReceiveRemoteTargets +vehicleReportOwnPosition +vehicleReportRemoteTargets +vehicles +vehicleVarName +velocity +velocityModelSpace +verifySignature +vest +vestContainer +vestItems +vestMagazines +viewDistance +visibleCompass +visibleGPS +visibleMap +visiblePosition +visiblePositionASL +visibleScoretable +visibleWatch +waitUntil +waves +waypointAttachedObject +waypointAttachedVehicle +waypointAttachObject +waypointAttachVehicle +waypointBehaviour +waypointCombatMode +waypointCompletionRadius +waypointDescription +waypointForceBehaviour +waypointFormation +waypointHousePosition +waypointLoiterRadius +waypointLoiterType +waypointName +waypointPosition +waypoints +waypointScript +waypointsEnabledUAV +waypointShow +waypointSpeed +waypointStatements +waypointTimeout +waypointTimeoutCurrent +waypointType +waypointVisible +weaponAccessories +weaponAccessoriesCargo +weaponCargo +weaponDirection +weaponInertia +weaponLowered +weapons +weaponsItems +weaponsItemsCargo +weaponState +weaponsTurret +weightRTD +west +WFSideText +wind +windDir +windRTD +windStr +wingsForcesRTD +worldName +worldSize +worldToModel +worldToModelVisual +worldToScreen + +---------------------------------------------------- + +[ + ["function", "abs"], + ["function", "accTime"], + ["function", "acos"], + ["function", "action"], + ["function", "actionIDs"], + ["function", "actionKeys"], + ["function", "actionKeysImages"], + ["function", "actionKeysNames"], + ["function", "actionKeysNamesArray"], + ["function", "actionName"], + ["function", "actionParams"], + ["function", "activateAddons"], + ["function", "activatedAddons"], + ["function", "activateKey"], + ["function", "add3DENConnection"], + ["function", "add3DENEventHandler"], + ["function", "add3DENLayer"], + ["function", "addAction"], + ["function", "addBackpack"], + ["function", "addBackpackCargo"], + ["function", "addBackpackCargoGlobal"], + ["function", "addBackpackGlobal"], + ["function", "addCamShake"], + ["function", "addCuratorAddons"], + ["function", "addCuratorCameraArea"], + ["function", "addCuratorEditableObjects"], + ["function", "addCuratorEditingArea"], + ["function", "addCuratorPoints"], + ["function", "addEditorObject"], + ["function", "addEventHandler"], + ["function", "addForce"], + ["function", "addForceGeneratorRTD"], + ["function", "addGoggles"], + ["function", "addGroupIcon"], + ["function", "addHandgunItem"], + ["function", "addHeadgear"], + ["function", "addItem"], + ["function", "addItemCargo"], + ["function", "addItemCargoGlobal"], + ["function", "addItemPool"], + ["function", "addItemToBackpack"], + ["function", "addItemToUniform"], + ["function", "addItemToVest"], + ["function", "addLiveStats"], + ["function", "addMagazine"], + ["function", "addMagazineAmmoCargo"], + ["function", "addMagazineCargo"], + ["function", "addMagazineCargoGlobal"], + ["function", "addMagazineGlobal"], + ["function", "addMagazinePool"], + ["function", "addMagazines"], + ["function", "addMagazineTurret"], + ["function", "addMenu"], + ["function", "addMenuItem"], + ["function", "addMissionEventHandler"], + ["function", "addMPEventHandler"], + ["function", "addMusicEventHandler"], + ["function", "addOwnedMine"], + ["function", "addPlayerScores"], + ["function", "addPrimaryWeaponItem"], + ["function", "addPublicVariableEventHandler"], + ["function", "addRating"], + ["function", "addResources"], + ["function", "addScore"], + ["function", "addScoreSide"], + ["function", "addSecondaryWeaponItem"], + ["function", "addSwitchableUnit"], + ["function", "addTeamMember"], + ["function", "addToRemainsCollector"], + ["function", "addTorque"], + ["function", "addUniform"], + ["function", "addVehicle"], + ["function", "addVest"], + ["function", "addWaypoint"], + ["function", "addWeapon"], + ["function", "addWeaponCargo"], + ["function", "addWeaponCargoGlobal"], + ["function", "addWeaponGlobal"], + ["function", "addWeaponItem"], + ["function", "addWeaponPool"], + ["function", "addWeaponTurret"], + ["function", "admin"], + ["function", "agent"], + ["function", "agents"], + ["function", "AGLToASL"], + ["function", "aimedAtTarget"], + ["function", "aimPos"], + ["function", "airDensityCurveRTD"], + ["function", "airDensityRTD"], + ["function", "airplaneThrottle"], + ["function", "airportSide"], + ["function", "AISFinishHeal"], + ["function", "alive"], + ["function", "all3DENEntities"], + ["function", "allAirports"], + ["function", "allControls"], + ["function", "allCurators"], + ["function", "allCutLayers"], + ["function", "allDead"], + ["function", "allDeadMen"], + ["function", "allDisplays"], + ["function", "allGroups"], + ["function", "allMapMarkers"], + ["function", "allMines"], + ["function", "allMissionObjects"], + ["function", "allow3DMode"], + ["function", "allowCrewInImmobile"], + ["function", "allowCuratorLogicIgnoreAreas"], + ["function", "allowDamage"], + ["function", "allowDammage"], + ["function", "allowFileOperations"], + ["function", "allowFleeing"], + ["function", "allowGetIn"], + ["function", "allowSprint"], + ["function", "allPlayers"], + ["function", "allSimpleObjects"], + ["function", "allSites"], + ["function", "allTurrets"], + ["function", "allUnits"], + ["function", "allUnitsUAV"], + ["function", "allVariables"], + ["function", "ammo"], + ["function", "ammoOnPylon"], + ["function", "animate"], + ["function", "animateBay"], + ["function", "animateDoor"], + ["function", "animatePylon"], + ["function", "animateSource"], + ["function", "animationNames"], + ["function", "animationPhase"], + ["function", "animationSourcePhase"], + ["function", "animationState"], + ["function", "append"], + ["function", "apply"], + ["function", "armoryPoints"], + ["function", "arrayIntersect"], + ["function", "asin"], + ["function", "ASLToAGL"], + ["function", "ASLToATL"], + ["function", "assert"], + ["function", "assignAsCargo"], + ["function", "assignAsCargoIndex"], + ["function", "assignAsCommander"], + ["function", "assignAsDriver"], + ["function", "assignAsGunner"], + ["function", "assignAsTurret"], + ["function", "assignCurator"], + ["function", "assignedCargo"], + ["function", "assignedCommander"], + ["function", "assignedDriver"], + ["function", "assignedGunner"], + ["function", "assignedItems"], + ["function", "assignedTarget"], + ["function", "assignedTeam"], + ["function", "assignedVehicle"], + ["function", "assignedVehicleRole"], + ["function", "assignItem"], + ["function", "assignTeam"], + ["function", "assignToAirport"], + ["function", "atan"], + ["function", "atan2"], + ["function", "atg"], + ["function", "ATLToASL"], + ["function", "attachedObject"], + ["function", "attachedObjects"], + ["function", "attachedTo"], + ["function", "attachObject"], + ["function", "attachTo"], + ["function", "attackEnabled"], + ["function", "backpack"], + ["function", "backpackCargo"], + ["function", "backpackContainer"], + ["function", "backpackItems"], + ["function", "backpackMagazines"], + ["function", "backpackSpaceFor"], + ["function", "behaviour"], + ["function", "benchmark"], + ["function", "binocular"], + ["function", "blufor"], + ["function", "boundingBox"], + ["function", "boundingBoxReal"], + ["function", "boundingCenter"], + ["function", "briefingName"], + ["function", "buildingExit"], + ["function", "buildingPos"], + ["function", "buldozer_EnableRoadDiag"], + ["function", "buldozer_IsEnabledRoadDiag"], + ["function", "buldozer_LoadNewRoads"], + ["function", "buldozer_reloadOperMap"], + ["function", "buttonAction"], + ["function", "buttonSetAction"], + ["function", "cadetMode"], + ["function", "callExtension"], + ["function", "camCommand"], + ["function", "camCommit"], + ["function", "camCommitPrepared"], + ["function", "camCommitted"], + ["function", "camConstuctionSetParams"], + ["function", "camCreate"], + ["function", "camDestroy"], + ["function", "cameraEffect"], + ["function", "cameraEffectEnableHUD"], + ["function", "cameraInterest"], + ["function", "cameraOn"], + ["function", "cameraView"], + ["function", "campaignConfigFile"], + ["function", "camPreload"], + ["function", "camPreloaded"], + ["function", "camPrepareBank"], + ["function", "camPrepareDir"], + ["function", "camPrepareDive"], + ["function", "camPrepareFocus"], + ["function", "camPrepareFov"], + ["function", "camPrepareFovRange"], + ["function", "camPreparePos"], + ["function", "camPrepareRelPos"], + ["function", "camPrepareTarget"], + ["function", "camSetBank"], + ["function", "camSetDir"], + ["function", "camSetDive"], + ["function", "camSetFocus"], + ["function", "camSetFov"], + ["function", "camSetFovRange"], + ["function", "camSetPos"], + ["function", "camSetRelPos"], + ["function", "camSetTarget"], + ["function", "camTarget"], + ["function", "camUseNVG"], + ["function", "canAdd"], + ["function", "canAddItemToBackpack"], + ["function", "canAddItemToUniform"], + ["function", "canAddItemToVest"], + ["function", "cancelSimpleTaskDestination"], + ["function", "canFire"], + ["function", "canMove"], + ["function", "canSlingLoad"], + ["function", "canStand"], + ["function", "canSuspend"], + ["function", "canTriggerDynamicSimulation"], + ["function", "canUnloadInCombat"], + ["function", "canVehicleCargo"], + ["function", "captive"], + ["function", "captiveNum"], + ["function", "cbChecked"], + ["function", "cbSetChecked"], + ["function", "ceil"], + ["function", "channelEnabled"], + ["function", "cheatsEnabled"], + ["function", "checkAIFeature"], + ["function", "checkVisibility"], + ["function", "civilian"], + ["function", "className"], + ["function", "clear3DENAttribute"], + ["function", "clear3DENInventory"], + ["function", "clearAllItemsFromBackpack"], + ["function", "clearBackpackCargo"], + ["function", "clearBackpackCargoGlobal"], + ["function", "clearForcesRTD"], + ["function", "clearGroupIcons"], + ["function", "clearItemCargo"], + ["function", "clearItemCargoGlobal"], + ["function", "clearItemPool"], + ["function", "clearMagazineCargo"], + ["function", "clearMagazineCargoGlobal"], + ["function", "clearMagazinePool"], + ["function", "clearOverlay"], + ["function", "clearRadio"], + ["function", "clearVehicleInit"], + ["function", "clearWeaponCargo"], + ["function", "clearWeaponCargoGlobal"], + ["function", "clearWeaponPool"], + ["function", "clientOwner"], + ["function", "closeDialog"], + ["function", "closeDisplay"], + ["function", "closeOverlay"], + ["function", "collapseObjectTree"], + ["function", "collect3DENHistory"], + ["function", "collectiveRTD"], + ["function", "combatMode"], + ["function", "commandArtilleryFire"], + ["function", "commandChat"], + ["function", "commander"], + ["function", "commandFire"], + ["function", "commandFollow"], + ["function", "commandFSM"], + ["function", "commandGetOut"], + ["function", "commandingMenu"], + ["function", "commandMove"], + ["function", "commandRadio"], + ["function", "commandStop"], + ["function", "commandSuppressiveFire"], + ["function", "commandTarget"], + ["function", "commandWatch"], + ["function", "comment"], + ["function", "commitOverlay"], + ["function", "compile"], + ["function", "compileFinal"], + ["function", "completedFSM"], + ["function", "composeText"], + ["function", "configClasses"], + ["function", "configFile"], + ["function", "configHierarchy"], + ["function", "configName"], + ["function", "configNull"], + ["function", "configProperties"], + ["function", "configSourceAddonList"], + ["function", "configSourceMod"], + ["function", "configSourceModList"], + ["function", "confirmSensorTarget"], + ["function", "connectTerminalToUAV"], + ["function", "controlNull"], + ["function", "controlsGroupCtrl"], + ["function", "copyFromClipboard"], + ["function", "copyToClipboard"], + ["function", "copyWaypoints"], + ["function", "cos"], + ["function", "count"], + ["function", "countEnemy"], + ["function", "countFriendly"], + ["function", "countSide"], + ["function", "countType"], + ["function", "countUnknown"], + ["function", "create3DENComposition"], + ["function", "create3DENEntity"], + ["function", "createAgent"], + ["function", "createCenter"], + ["function", "createDialog"], + ["function", "createDiaryLink"], + ["function", "createDiaryRecord"], + ["function", "createDiarySubject"], + ["function", "createDisplay"], + ["function", "createGearDialog"], + ["function", "createGroup"], + ["function", "createGuardedPoint"], + ["function", "createLocation"], + ["function", "createMarker"], + ["function", "createMarkerLocal"], + ["function", "createMenu"], + ["function", "createMine"], + ["function", "createMissionDisplay"], + ["function", "createMPCampaignDisplay"], + ["function", "createSimpleObject"], + ["function", "createSimpleTask"], + ["function", "createSite"], + ["function", "createSoundSource"], + ["function", "createTask"], + ["function", "createTeam"], + ["function", "createTrigger"], + ["function", "createUnit"], + ["function", "createVehicle"], + ["function", "createVehicleCrew"], + ["function", "createVehicleLocal"], + ["function", "crew"], + ["function", "ctAddHeader"], + ["function", "ctAddRow"], + ["function", "ctClear"], + ["function", "ctCurSel"], + ["function", "ctData"], + ["function", "ctFindHeaderRows"], + ["function", "ctFindRowHeader"], + ["function", "ctHeaderControls"], + ["function", "ctHeaderCount"], + ["function", "ctRemoveHeaders"], + ["function", "ctRemoveRows"], + ["function", "ctrlActivate"], + ["function", "ctrlAddEventHandler"], + ["function", "ctrlAngle"], + ["function", "ctrlAutoScrollDelay"], + ["function", "ctrlAutoScrollRewind"], + ["function", "ctrlAutoScrollSpeed"], + ["function", "ctrlChecked"], + ["function", "ctrlClassName"], + ["function", "ctrlCommit"], + ["function", "ctrlCommitted"], + ["function", "ctrlCreate"], + ["function", "ctrlDelete"], + ["function", "ctrlEnable"], + ["function", "ctrlEnabled"], + ["function", "ctrlFade"], + ["function", "ctrlHTMLLoaded"], + ["function", "ctrlIDC"], + ["function", "ctrlIDD"], + ["function", "ctrlMapAnimAdd"], + ["function", "ctrlMapAnimClear"], + ["function", "ctrlMapAnimCommit"], + ["function", "ctrlMapAnimDone"], + ["function", "ctrlMapCursor"], + ["function", "ctrlMapMouseOver"], + ["function", "ctrlMapScale"], + ["function", "ctrlMapScreenToWorld"], + ["function", "ctrlMapWorldToScreen"], + ["function", "ctrlModel"], + ["function", "ctrlModelDirAndUp"], + ["function", "ctrlModelScale"], + ["function", "ctrlParent"], + ["function", "ctrlParentControlsGroup"], + ["function", "ctrlPosition"], + ["function", "ctrlRemoveAllEventHandlers"], + ["function", "ctrlRemoveEventHandler"], + ["function", "ctrlScale"], + ["function", "ctrlSetActiveColor"], + ["function", "ctrlSetAngle"], + ["function", "ctrlSetAutoScrollDelay"], + ["function", "ctrlSetAutoScrollRewind"], + ["function", "ctrlSetAutoScrollSpeed"], + ["function", "ctrlSetBackgroundColor"], + ["function", "ctrlSetChecked"], + ["function", "ctrlSetDisabledColor"], + ["function", "ctrlSetEventHandler"], + ["function", "ctrlSetFade"], + ["function", "ctrlSetFocus"], + ["function", "ctrlSetFont"], + ["function", "ctrlSetFontH1"], + ["function", "ctrlSetFontH1B"], + ["function", "ctrlSetFontH2"], + ["function", "ctrlSetFontH2B"], + ["function", "ctrlSetFontH3"], + ["function", "ctrlSetFontH3B"], + ["function", "ctrlSetFontH4"], + ["function", "ctrlSetFontH4B"], + ["function", "ctrlSetFontH5"], + ["function", "ctrlSetFontH5B"], + ["function", "ctrlSetFontH6"], + ["function", "ctrlSetFontH6B"], + ["function", "ctrlSetFontHeight"], + ["function", "ctrlSetFontHeightH1"], + ["function", "ctrlSetFontHeightH2"], + ["function", "ctrlSetFontHeightH3"], + ["function", "ctrlSetFontHeightH4"], + ["function", "ctrlSetFontHeightH5"], + ["function", "ctrlSetFontHeightH6"], + ["function", "ctrlSetFontHeightSecondary"], + ["function", "ctrlSetFontP"], + ["function", "ctrlSetFontPB"], + ["function", "ctrlSetFontSecondary"], + ["function", "ctrlSetForegroundColor"], + ["function", "ctrlSetModel"], + ["function", "ctrlSetModelDirAndUp"], + ["function", "ctrlSetModelScale"], + ["function", "ctrlSetPixelPrecision"], + ["function", "ctrlSetPosition"], + ["function", "ctrlSetScale"], + ["function", "ctrlSetStructuredText"], + ["function", "ctrlSetText"], + ["function", "ctrlSetTextColor"], + ["function", "ctrlSetTextColorSecondary"], + ["function", "ctrlSetTextSecondary"], + ["function", "ctrlSetTooltip"], + ["function", "ctrlSetTooltipColorBox"], + ["function", "ctrlSetTooltipColorShade"], + ["function", "ctrlSetTooltipColorText"], + ["function", "ctrlShow"], + ["function", "ctrlShown"], + ["function", "ctrlText"], + ["function", "ctrlTextHeight"], + ["function", "ctrlTextSecondary"], + ["function", "ctrlTextWidth"], + ["function", "ctrlType"], + ["function", "ctrlVisible"], + ["function", "ctRowControls"], + ["function", "ctRowCount"], + ["function", "ctSetCurSel"], + ["function", "ctSetData"], + ["function", "ctSetHeaderTemplate"], + ["function", "ctSetRowTemplate"], + ["function", "ctSetValue"], + ["function", "ctValue"], + ["function", "curatorAddons"], + ["function", "curatorCamera"], + ["function", "curatorCameraArea"], + ["function", "curatorCameraAreaCeiling"], + ["function", "curatorCoef"], + ["function", "curatorEditableObjects"], + ["function", "curatorEditingArea"], + ["function", "curatorEditingAreaType"], + ["function", "curatorMouseOver"], + ["function", "curatorPoints"], + ["function", "curatorRegisteredObjects"], + ["function", "curatorSelected"], + ["function", "curatorWaypointCost"], + ["function", "current3DENOperation"], + ["function", "currentChannel"], + ["function", "currentCommand"], + ["function", "currentMagazine"], + ["function", "currentMagazineDetail"], + ["function", "currentMagazineDetailTurret"], + ["function", "currentMagazineTurret"], + ["function", "currentMuzzle"], + ["function", "currentNamespace"], + ["function", "currentTask"], + ["function", "currentTasks"], + ["function", "currentThrowable"], + ["function", "currentVisionMode"], + ["function", "currentWaypoint"], + ["function", "currentWeapon"], + ["function", "currentWeaponMode"], + ["function", "currentWeaponTurret"], + ["function", "currentZeroing"], + ["function", "cursorObject"], + ["function", "cursorTarget"], + ["function", "customChat"], + ["function", "customRadio"], + ["function", "cutFadeOut"], + ["function", "cutObj"], + ["function", "cutRsc"], + ["function", "cutText"], + ["function", "damage"], + ["function", "date"], + ["function", "dateToNumber"], + ["function", "daytime"], + ["function", "deActivateKey"], + ["function", "debriefingText"], + ["function", "debugFSM"], + ["function", "debugLog"], + ["function", "deg"], + ["function", "delete3DENEntities"], + ["function", "deleteAt"], + ["function", "deleteCenter"], + ["function", "deleteCollection"], + ["function", "deleteEditorObject"], + ["function", "deleteGroup"], + ["function", "deleteGroupWhenEmpty"], + ["function", "deleteIdentity"], + ["function", "deleteLocation"], + ["function", "deleteMarker"], + ["function", "deleteMarkerLocal"], + ["function", "deleteRange"], + ["function", "deleteResources"], + ["function", "deleteSite"], + ["function", "deleteStatus"], + ["function", "deleteTeam"], + ["function", "deleteVehicle"], + ["function", "deleteVehicleCrew"], + ["function", "deleteWaypoint"], + ["function", "detach"], + ["function", "detectedMines"], + ["function", "diag_activeMissionFSMs"], + ["function", "diag_activeScripts"], + ["function", "diag_activeSQFScripts"], + ["function", "diag_activeSQSScripts"], + ["function", "diag_captureFrame"], + ["function", "diag_captureFrameToFile"], + ["function", "diag_captureSlowFrame"], + ["function", "diag_codePerformance"], + ["function", "diag_drawMode"], + ["function", "diag_dynamicSimulationEnd"], + ["function", "diag_enable"], + ["function", "diag_enabled"], + ["function", "diag_fps"], + ["function", "diag_fpsMin"], + ["function", "diag_frameNo"], + ["function", "diag_lightNewLoad"], + ["function", "diag_list"], + ["function", "diag_log"], + ["function", "diag_logSlowFrame"], + ["function", "diag_mergeConfigFile"], + ["function", "diag_recordTurretLimits"], + ["function", "diag_setLightNew"], + ["function", "diag_tickTime"], + ["function", "diag_toggle"], + ["function", "dialog"], + ["function", "diarySubjectExists"], + ["function", "didJIP"], + ["function", "didJIPOwner"], + ["function", "difficulty"], + ["function", "difficultyEnabled"], + ["function", "difficultyEnabledRTD"], + ["function", "difficultyOption"], + ["function", "direction"], + ["function", "directSay"], + ["function", "disableAI"], + ["function", "disableCollisionWith"], + ["function", "disableConversation"], + ["function", "disableDebriefingStats"], + ["function", "disableMapIndicators"], + ["function", "disableNVGEquipment"], + ["function", "disableRemoteSensors"], + ["function", "disableSerialization"], + ["function", "disableTIEquipment"], + ["function", "disableUAVConnectability"], + ["function", "disableUserInput"], + ["function", "displayAddEventHandler"], + ["function", "displayCtrl"], + ["function", "displayNull"], + ["function", "displayParent"], + ["function", "displayRemoveAllEventHandlers"], + ["function", "displayRemoveEventHandler"], + ["function", "displaySetEventHandler"], + ["function", "dissolveTeam"], + ["function", "distance"], + ["function", "distance2D"], + ["function", "distanceSqr"], + ["function", "distributionRegion"], + ["function", "do3DENAction"], + ["function", "doArtilleryFire"], + ["function", "doFire"], + ["function", "doFollow"], + ["function", "doFSM"], + ["function", "doGetOut"], + ["function", "doMove"], + ["function", "doorPhase"], + ["function", "doStop"], + ["function", "doSuppressiveFire"], + ["function", "doTarget"], + ["function", "doWatch"], + ["function", "drawArrow"], + ["function", "drawEllipse"], + ["function", "drawIcon"], + ["function", "drawIcon3D"], + ["function", "drawLine"], + ["function", "drawLine3D"], + ["function", "drawLink"], + ["function", "drawLocation"], + ["function", "drawPolygon"], + ["function", "drawRectangle"], + ["function", "drawTriangle"], + ["function", "driver"], + ["function", "drop"], + ["function", "dynamicSimulationDistance"], + ["function", "dynamicSimulationDistanceCoef"], + ["function", "dynamicSimulationEnabled"], + ["function", "dynamicSimulationSystemEnabled"], + ["function", "east"], + ["function", "edit3DENMissionAttributes"], + ["function", "editObject"], + ["function", "editorSetEventHandler"], + ["function", "effectiveCommander"], + ["function", "emptyPositions"], + ["function", "enableAI"], + ["function", "enableAIFeature"], + ["function", "enableAimPrecision"], + ["function", "enableAttack"], + ["function", "enableAudioFeature"], + ["function", "enableAutoStartUpRTD"], + ["function", "enableAutoTrimRTD"], + ["function", "enableCamShake"], + ["function", "enableCaustics"], + ["function", "enableChannel"], + ["function", "enableCollisionWith"], + ["function", "enableCopilot"], + ["function", "enableDebriefingStats"], + ["function", "enableDiagLegend"], + ["function", "enableDynamicSimulation"], + ["function", "enableDynamicSimulationSystem"], + ["function", "enableEndDialog"], + ["function", "enableEngineArtillery"], + ["function", "enableEnvironment"], + ["function", "enableFatigue"], + ["function", "enableGunLights"], + ["function", "enableInfoPanelComponent"], + ["function", "enableIRLasers"], + ["function", "enableMimics"], + ["function", "enablePersonTurret"], + ["function", "enableRadio"], + ["function", "enableReload"], + ["function", "enableRopeAttach"], + ["function", "enableSatNormalOnDetail"], + ["function", "enableSaving"], + ["function", "enableSentences"], + ["function", "enableSimulation"], + ["function", "enableSimulationGlobal"], + ["function", "enableStamina"], + ["function", "enableStressDamage"], + ["function", "enableTeamSwitch"], + ["function", "enableTraffic"], + ["function", "enableUAVConnectability"], + ["function", "enableUAVWaypoints"], + ["function", "enableVehicleCargo"], + ["function", "enableVehicleSensor"], + ["function", "enableWeaponDisassembly"], + ["function", "endl"], + ["function", "endLoadingScreen"], + ["function", "endMission"], + ["function", "engineOn"], + ["function", "enginesIsOnRTD"], + ["function", "enginesPowerRTD"], + ["function", "enginesRpmRTD"], + ["function", "enginesTorqueRTD"], + ["function", "entities"], + ["function", "environmentEnabled"], + ["function", "estimatedEndServerTime"], + ["function", "estimatedTimeLeft"], + ["function", "evalObjectArgument"], + ["function", "everyBackpack"], + ["function", "everyContainer"], + ["function", "exec"], + ["function", "execEditorScript"], + ["function", "exp"], + ["function", "expectedDestination"], + ["function", "exportJIPMessages"], + ["function", "eyeDirection"], + ["function", "eyePos"], + ["function", "face"], + ["function", "faction"], + ["function", "fadeMusic"], + ["function", "fadeRadio"], + ["function", "fadeSound"], + ["function", "fadeSpeech"], + ["function", "failMission"], + ["function", "fillWeaponsFromPool"], + ["function", "find"], + ["function", "findCover"], + ["function", "findDisplay"], + ["function", "findEditorObject"], + ["function", "findEmptyPosition"], + ["function", "findEmptyPositionReady"], + ["function", "findIf"], + ["function", "findNearestEnemy"], + ["function", "finishMissionInit"], + ["function", "finite"], + ["function", "fire"], + ["function", "fireAtTarget"], + ["function", "firstBackpack"], + ["function", "flag"], + ["function", "flagAnimationPhase"], + ["function", "flagOwner"], + ["function", "flagSide"], + ["function", "flagTexture"], + ["function", "fleeing"], + ["function", "floor"], + ["function", "flyInHeight"], + ["function", "flyInHeightASL"], + ["function", "fog"], + ["function", "fogForecast"], + ["function", "fogParams"], + ["function", "forceAddUniform"], + ["function", "forceAtPositionRTD"], + ["function", "forcedMap"], + ["function", "forceEnd"], + ["function", "forceFlagTexture"], + ["function", "forceFollowRoad"], + ["function", "forceGeneratorRTD"], + ["function", "forceMap"], + ["function", "forceRespawn"], + ["function", "forceSpeed"], + ["function", "forceWalk"], + ["function", "forceWeaponFire"], + ["function", "forceWeatherChange"], + ["function", "forgetTarget"], + ["function", "format"], + ["function", "formation"], + ["function", "formationDirection"], + ["function", "formationLeader"], + ["function", "formationMembers"], + ["function", "formationPosition"], + ["function", "formationTask"], + ["function", "formatText"], + ["function", "formLeader"], + ["function", "freeLook"], + ["function", "fromEditor"], + ["function", "fuel"], + ["function", "fullCrew"], + ["function", "gearIDCAmmoCount"], + ["function", "gearSlotAmmoCount"], + ["function", "gearSlotData"], + ["function", "get3DENActionState"], + ["function", "get3DENAttribute"], + ["function", "get3DENCamera"], + ["function", "get3DENConnections"], + ["function", "get3DENEntity"], + ["function", "get3DENEntityID"], + ["function", "get3DENGrid"], + ["function", "get3DENIconsVisible"], + ["function", "get3DENLayerEntities"], + ["function", "get3DENLinesVisible"], + ["function", "get3DENMissionAttribute"], + ["function", "get3DENMouseOver"], + ["function", "get3DENSelected"], + ["function", "getAimingCoef"], + ["function", "getAllEnvSoundControllers"], + ["function", "getAllHitPointsDamage"], + ["function", "getAllOwnedMines"], + ["function", "getAllSoundControllers"], + ["function", "getAmmoCargo"], + ["function", "getAnimAimPrecision"], + ["function", "getAnimSpeedCoef"], + ["function", "getArray"], + ["function", "getArtilleryAmmo"], + ["function", "getArtilleryComputerSettings"], + ["function", "getArtilleryETA"], + ["function", "getAssignedCuratorLogic"], + ["function", "getAssignedCuratorUnit"], + ["function", "getBackpackCargo"], + ["function", "getBleedingRemaining"], + ["function", "getBurningValue"], + ["function", "getCameraViewDirection"], + ["function", "getCargoIndex"], + ["function", "getCenterOfMass"], + ["function", "getClientState"], + ["function", "getClientStateNumber"], + ["function", "getCompatiblePylonMagazines"], + ["function", "getConnectedUAV"], + ["function", "getContainerMaxLoad"], + ["function", "getCursorObjectParams"], + ["function", "getCustomAimCoef"], + ["function", "getDammage"], + ["function", "getDescription"], + ["function", "getDir"], + ["function", "getDirVisual"], + ["function", "getDLCAssetsUsage"], + ["function", "getDLCAssetsUsageByName"], + ["function", "getDLCs"], + ["function", "getDLCUsageTime"], + ["function", "getEditorCamera"], + ["function", "getEditorMode"], + ["function", "getEditorObjectScope"], + ["function", "getElevationOffset"], + ["function", "getEngineTargetRpmRTD"], + ["function", "getEnvSoundController"], + ["function", "getFatigue"], + ["function", "getFieldManualStartPage"], + ["function", "getForcedFlagTexture"], + ["function", "getFriend"], + ["function", "getFSMVariable"], + ["function", "getFuelCargo"], + ["function", "getGroupIcon"], + ["function", "getGroupIconParams"], + ["function", "getGroupIcons"], + ["function", "getHideFrom"], + ["function", "getHit"], + ["function", "getHitIndex"], + ["function", "getHitPointDamage"], + ["function", "getItemCargo"], + ["function", "getMagazineCargo"], + ["function", "getMarkerColor"], + ["function", "getMarkerPos"], + ["function", "getMarkerSize"], + ["function", "getMarkerType"], + ["function", "getMass"], + ["function", "getMissionConfig"], + ["function", "getMissionConfigValue"], + ["function", "getMissionDLCs"], + ["function", "getMissionLayerEntities"], + ["function", "getMissionLayers"], + ["function", "getModelInfo"], + ["function", "getMousePosition"], + ["function", "getMusicPlayedTime"], + ["function", "getNumber"], + ["function", "getObjectArgument"], + ["function", "getObjectChildren"], + ["function", "getObjectDLC"], + ["function", "getObjectMaterials"], + ["function", "getObjectProxy"], + ["function", "getObjectTextures"], + ["function", "getObjectType"], + ["function", "getObjectViewDistance"], + ["function", "getOxygenRemaining"], + ["function", "getPersonUsedDLCs"], + ["function", "getPilotCameraDirection"], + ["function", "getPilotCameraPosition"], + ["function", "getPilotCameraRotation"], + ["function", "getPilotCameraTarget"], + ["function", "getPlateNumber"], + ["function", "getPlayerChannel"], + ["function", "getPlayerScores"], + ["function", "getPlayerUID"], + ["function", "getPlayerUIDOld"], + ["function", "getPos"], + ["function", "getPosASL"], + ["function", "getPosASLVisual"], + ["function", "getPosASLW"], + ["function", "getPosATL"], + ["function", "getPosATLVisual"], + ["function", "getPosVisual"], + ["function", "getPosWorld"], + ["function", "getPylonMagazines"], + ["function", "getRelDir"], + ["function", "getRelPos"], + ["function", "getRemoteSensorsDisabled"], + ["function", "getRepairCargo"], + ["function", "getResolution"], + ["function", "getRotorBrakeRTD"], + ["function", "getShadowDistance"], + ["function", "getShotParents"], + ["function", "getSlingLoad"], + ["function", "getSoundController"], + ["function", "getSoundControllerResult"], + ["function", "getSpeed"], + ["function", "getStamina"], + ["function", "getStatValue"], + ["function", "getSuppression"], + ["function", "getTerrainGrid"], + ["function", "getTerrainHeightASL"], + ["function", "getText"], + ["function", "getTotalDLCUsageTime"], + ["function", "getTrimOffsetRTD"], + ["function", "getUnitLoadout"], + ["function", "getUnitTrait"], + ["function", "getUserMFDText"], + ["function", "getUserMFDValue"], + ["function", "getVariable"], + ["function", "getVehicleCargo"], + ["function", "getWeaponCargo"], + ["function", "getWeaponSway"], + ["function", "getWingsOrientationRTD"], + ["function", "getWingsPositionRTD"], + ["function", "getWPPos"], + ["function", "glanceAt"], + ["function", "globalChat"], + ["function", "globalRadio"], + ["function", "goggles"], + ["function", "group"], + ["function", "groupChat"], + ["function", "groupFromNetId"], + ["function", "groupIconSelectable"], + ["function", "groupIconsVisible"], + ["function", "groupId"], + ["function", "groupOwner"], + ["function", "groupRadio"], + ["function", "groupSelectedUnits"], + ["function", "groupSelectUnit"], + ["function", "grpNull"], + ["function", "gunner"], + ["function", "gusts"], + ["function", "halt"], + ["function", "handgunItems"], + ["function", "handgunMagazine"], + ["function", "handgunWeapon"], + ["function", "handsHit"], + ["function", "hasInterface"], + ["function", "hasPilotCamera"], + ["function", "hasWeapon"], + ["function", "hcAllGroups"], + ["function", "hcGroupParams"], + ["function", "hcLeader"], + ["function", "hcRemoveAllGroups"], + ["function", "hcRemoveGroup"], + ["function", "hcSelected"], + ["function", "hcSelectGroup"], + ["function", "hcSetGroup"], + ["function", "hcShowBar"], + ["function", "hcShownBar"], + ["function", "headgear"], + ["function", "hideBody"], + ["function", "hideObject"], + ["function", "hideObjectGlobal"], + ["function", "hideSelection"], + ["function", "hint"], + ["function", "hintC"], + ["function", "hintCadet"], + ["function", "hintSilent"], + ["function", "hmd"], + ["function", "hostMission"], + ["function", "htmlLoad"], + ["function", "HUDMovementLevels"], + ["function", "humidity"], + ["function", "image"], + ["function", "importAllGroups"], + ["function", "importance"], + ["function", "in"], + ["function", "inArea"], + ["function", "inAreaArray"], + ["function", "incapacitatedState"], + ["function", "independent"], + ["function", "inflame"], + ["function", "inflamed"], + ["function", "infoPanel"], + ["function", "infoPanelComponentEnabled"], + ["function", "infoPanelComponents"], + ["function", "infoPanels"], + ["function", "inGameUISetEventHandler"], + ["function", "inheritsFrom"], + ["function", "initAmbientLife"], + ["function", "inPolygon"], + ["function", "inputAction"], + ["function", "inRangeOfArtillery"], + ["function", "insertEditorObject"], + ["function", "intersect"], + ["function", "is3DEN"], + ["function", "is3DENMultiplayer"], + ["function", "isAbleToBreathe"], + ["function", "isAgent"], + ["function", "isAimPrecisionEnabled"], + ["function", "isArray"], + ["function", "isAutoHoverOn"], + ["function", "isAutonomous"], + ["function", "isAutoStartUpEnabledRTD"], + ["function", "isAutotest"], + ["function", "isAutoTrimOnRTD"], + ["function", "isBleeding"], + ["function", "isBurning"], + ["function", "isClass"], + ["function", "isCollisionLightOn"], + ["function", "isCopilotEnabled"], + ["function", "isDamageAllowed"], + ["function", "isDedicated"], + ["function", "isDLCAvailable"], + ["function", "isEngineOn"], + ["function", "isEqualTo"], + ["function", "isEqualType"], + ["function", "isEqualTypeAll"], + ["function", "isEqualTypeAny"], + ["function", "isEqualTypeArray"], + ["function", "isEqualTypeParams"], + ["function", "isFilePatchingEnabled"], + ["function", "isFlashlightOn"], + ["function", "isFlatEmpty"], + ["function", "isForcedWalk"], + ["function", "isFormationLeader"], + ["function", "isGroupDeletedWhenEmpty"], + ["function", "isHidden"], + ["function", "isInRemainsCollector"], + ["function", "isInstructorFigureEnabled"], + ["function", "isIRLaserOn"], + ["function", "isKeyActive"], + ["function", "isKindOf"], + ["function", "isLaserOn"], + ["function", "isLightOn"], + ["function", "isLocalized"], + ["function", "isManualFire"], + ["function", "isMarkedForCollection"], + ["function", "isMultiplayer"], + ["function", "isMultiplayerSolo"], + ["function", "isNil"], + ["function", "isNull"], + ["function", "isNumber"], + ["function", "isObjectHidden"], + ["function", "isObjectRTD"], + ["function", "isOnRoad"], + ["function", "isPipEnabled"], + ["function", "isPlayer"], + ["function", "isRealTime"], + ["function", "isRemoteExecuted"], + ["function", "isRemoteExecutedJIP"], + ["function", "isServer"], + ["function", "isShowing3DIcons"], + ["function", "isSimpleObject"], + ["function", "isSprintAllowed"], + ["function", "isStaminaEnabled"], + ["function", "isSteamMission"], + ["function", "isStreamFriendlyUIEnabled"], + ["function", "isStressDamageEnabled"], + ["function", "isText"], + ["function", "isTouchingGround"], + ["function", "isTurnedOut"], + ["function", "isTutHintsEnabled"], + ["function", "isUAVConnectable"], + ["function", "isUAVConnected"], + ["function", "isUIContext"], + ["function", "isUniformAllowed"], + ["function", "isVehicleCargo"], + ["function", "isVehicleRadarOn"], + ["function", "isVehicleSensorEnabled"], + ["function", "isWalking"], + ["function", "isWeaponDeployed"], + ["function", "isWeaponRested"], + ["function", "itemCargo"], + ["function", "items"], + ["function", "itemsWithMagazines"], + ["function", "join"], + ["function", "joinAs"], + ["function", "joinAsSilent"], + ["function", "joinSilent"], + ["function", "joinString"], + ["function", "kbAddDatabase"], + ["function", "kbAddDatabaseTargets"], + ["function", "kbAddTopic"], + ["function", "kbHasTopic"], + ["function", "kbReact"], + ["function", "kbRemoveTopic"], + ["function", "kbTell"], + ["function", "kbWasSaid"], + ["function", "keyImage"], + ["function", "keyName"], + ["function", "knowsAbout"], + ["function", "land"], + ["function", "landAt"], + ["function", "landResult"], + ["function", "language"], + ["function", "laserTarget"], + ["function", "lbAdd"], + ["function", "lbClear"], + ["function", "lbColor"], + ["function", "lbColorRight"], + ["function", "lbCurSel"], + ["function", "lbData"], + ["function", "lbDelete"], + ["function", "lbIsSelected"], + ["function", "lbPicture"], + ["function", "lbPictureRight"], + ["function", "lbSelection"], + ["function", "lbSetColor"], + ["function", "lbSetColorRight"], + ["function", "lbSetCurSel"], + ["function", "lbSetData"], + ["function", "lbSetPicture"], + ["function", "lbSetPictureColor"], + ["function", "lbSetPictureColorDisabled"], + ["function", "lbSetPictureColorSelected"], + ["function", "lbSetPictureRight"], + ["function", "lbSetPictureRightColor"], + ["function", "lbSetPictureRightColorDisabled"], + ["function", "lbSetPictureRightColorSelected"], + ["function", "lbSetSelectColor"], + ["function", "lbSetSelectColorRight"], + ["function", "lbSetSelected"], + ["function", "lbSetText"], + ["function", "lbSetTextRight"], + ["function", "lbSetTooltip"], + ["function", "lbSetValue"], + ["function", "lbSize"], + ["function", "lbSort"], + ["function", "lbSortByValue"], + ["function", "lbText"], + ["function", "lbTextRight"], + ["function", "lbValue"], + ["function", "leader"], + ["function", "leaderboardDeInit"], + ["function", "leaderboardGetRows"], + ["function", "leaderboardInit"], + ["function", "leaderboardRequestRowsFriends"], + ["function", "leaderboardRequestRowsGlobal"], + ["function", "leaderboardRequestRowsGlobalAroundUser"], + ["function", "leaderboardsRequestUploadScore"], + ["function", "leaderboardsRequestUploadScoreKeepBest"], + ["function", "leaderboardState"], + ["function", "leaveVehicle"], + ["function", "libraryCredits"], + ["function", "libraryDisclaimers"], + ["function", "lifeState"], + ["function", "lightAttachObject"], + ["function", "lightDetachObject"], + ["function", "lightIsOn"], + ["function", "lightnings"], + ["function", "limitSpeed"], + ["function", "linearConversion"], + ["function", "lineBreak"], + ["function", "lineIntersects"], + ["function", "lineIntersectsObjs"], + ["function", "lineIntersectsSurfaces"], + ["function", "lineIntersectsWith"], + ["function", "linkItem"], + ["function", "list"], + ["function", "listObjects"], + ["function", "listRemoteTargets"], + ["function", "listVehicleSensors"], + ["function", "ln"], + ["function", "lnbAddArray"], + ["function", "lnbAddColumn"], + ["function", "lnbAddRow"], + ["function", "lnbClear"], + ["function", "lnbColor"], + ["function", "lnbColorRight"], + ["function", "lnbCurSelRow"], + ["function", "lnbData"], + ["function", "lnbDeleteColumn"], + ["function", "lnbDeleteRow"], + ["function", "lnbGetColumnsPosition"], + ["function", "lnbPicture"], + ["function", "lnbPictureRight"], + ["function", "lnbSetColor"], + ["function", "lnbSetColorRight"], + ["function", "lnbSetColumnsPos"], + ["function", "lnbSetCurSelRow"], + ["function", "lnbSetData"], + ["function", "lnbSetPicture"], + ["function", "lnbSetPictureColor"], + ["function", "lnbSetPictureColorRight"], + ["function", "lnbSetPictureColorSelected"], + ["function", "lnbSetPictureColorSelectedRight"], + ["function", "lnbSetPictureRight"], + ["function", "lnbSetText"], + ["function", "lnbSetTextRight"], + ["function", "lnbSetValue"], + ["function", "lnbSize"], + ["function", "lnbSort"], + ["function", "lnbSortByValue"], + ["function", "lnbText"], + ["function", "lnbTextRight"], + ["function", "lnbValue"], + ["function", "load"], + ["function", "loadAbs"], + ["function", "loadBackpack"], + ["function", "loadFile"], + ["function", "loadGame"], + ["function", "loadIdentity"], + ["function", "loadMagazine"], + ["function", "loadOverlay"], + ["function", "loadStatus"], + ["function", "loadUniform"], + ["function", "loadVest"], + ["function", "local"], + ["function", "localize"], + ["function", "locationNull"], + ["function", "locationPosition"], + ["function", "lock"], + ["function", "lockCameraTo"], + ["function", "lockCargo"], + ["function", "lockDriver"], + ["function", "locked"], + ["function", "lockedCargo"], + ["function", "lockedDriver"], + ["function", "lockedTurret"], + ["function", "lockIdentity"], + ["function", "lockTurret"], + ["function", "lockWP"], + ["function", "log"], + ["function", "logEntities"], + ["function", "logNetwork"], + ["function", "logNetworkTerminate"], + ["function", "lookAt"], + ["function", "lookAtPos"], + ["function", "magazineCargo"], + ["function", "magazines"], + ["function", "magazinesAllTurrets"], + ["function", "magazinesAmmo"], + ["function", "magazinesAmmoCargo"], + ["function", "magazinesAmmoFull"], + ["function", "magazinesDetail"], + ["function", "magazinesDetailBackpack"], + ["function", "magazinesDetailUniform"], + ["function", "magazinesDetailVest"], + ["function", "magazinesTurret"], + ["function", "magazineTurretAmmo"], + ["function", "mapAnimAdd"], + ["function", "mapAnimClear"], + ["function", "mapAnimCommit"], + ["function", "mapAnimDone"], + ["function", "mapCenterOnCamera"], + ["function", "mapGridPosition"], + ["function", "markAsFinishedOnSteam"], + ["function", "markerAlpha"], + ["function", "markerBrush"], + ["function", "markerColor"], + ["function", "markerDir"], + ["function", "markerPos"], + ["function", "markerShape"], + ["function", "markerSize"], + ["function", "markerText"], + ["function", "markerType"], + ["function", "max"], + ["function", "members"], + ["function", "menuAction"], + ["function", "menuAdd"], + ["function", "menuChecked"], + ["function", "menuClear"], + ["function", "menuCollapse"], + ["function", "menuData"], + ["function", "menuDelete"], + ["function", "menuEnable"], + ["function", "menuEnabled"], + ["function", "menuExpand"], + ["function", "menuHover"], + ["function", "menuPicture"], + ["function", "menuSetAction"], + ["function", "menuSetCheck"], + ["function", "menuSetData"], + ["function", "menuSetPicture"], + ["function", "menuSetValue"], + ["function", "menuShortcut"], + ["function", "menuShortcutText"], + ["function", "menuSize"], + ["function", "menuSort"], + ["function", "menuText"], + ["function", "menuURL"], + ["function", "menuValue"], + ["function", "min"], + ["function", "mineActive"], + ["function", "mineDetectedBy"], + ["function", "missionConfigFile"], + ["function", "missionDifficulty"], + ["function", "missionName"], + ["function", "missionNamespace"], + ["function", "missionStart"], + ["function", "missionVersion"], + ["function", "modelToWorld"], + ["function", "modelToWorldVisual"], + ["function", "modelToWorldVisualWorld"], + ["function", "modelToWorldWorld"], + ["function", "modParams"], + ["function", "moonIntensity"], + ["function", "moonPhase"], + ["function", "morale"], + ["function", "move"], + ["function", "move3DENCamera"], + ["function", "moveInAny"], + ["function", "moveInCargo"], + ["function", "moveInCommander"], + ["function", "moveInDriver"], + ["function", "moveInGunner"], + ["function", "moveInTurret"], + ["function", "moveObjectToEnd"], + ["function", "moveOut"], + ["function", "moveTime"], + ["function", "moveTo"], + ["function", "moveToCompleted"], + ["function", "moveToFailed"], + ["function", "musicVolume"], + ["function", "name"], + ["function", "nameSound"], + ["function", "nearEntities"], + ["function", "nearestBuilding"], + ["function", "nearestLocation"], + ["function", "nearestLocations"], + ["function", "nearestLocationWithDubbing"], + ["function", "nearestObject"], + ["function", "nearestObjects"], + ["function", "nearestTerrainObjects"], + ["function", "nearObjects"], + ["function", "nearObjectsReady"], + ["function", "nearRoads"], + ["function", "nearSupplies"], + ["function", "nearTargets"], + ["function", "needReload"], + ["function", "netId"], + ["function", "netObjNull"], + ["function", "newOverlay"], + ["function", "nextMenuItemIndex"], + ["function", "nextWeatherChange"], + ["function", "nMenuItems"], + ["function", "numberOfEnginesRTD"], + ["function", "numberToDate"], + ["function", "objectCurators"], + ["function", "objectFromNetId"], + ["function", "objectParent"], + ["function", "objNull"], + ["function", "objStatus"], + ["function", "onBriefingGear"], + ["function", "onBriefingGroup"], + ["function", "onBriefingNotes"], + ["function", "onBriefingPlan"], + ["function", "onBriefingTeamSwitch"], + ["function", "onCommandModeChanged"], + ["function", "onDoubleClick"], + ["function", "onEachFrame"], + ["function", "onGroupIconClick"], + ["function", "onGroupIconOverEnter"], + ["function", "onGroupIconOverLeave"], + ["function", "onHCGroupSelectionChanged"], + ["function", "onMapSingleClick"], + ["function", "onPlayerConnected"], + ["function", "onPlayerDisconnected"], + ["function", "onPreloadFinished"], + ["function", "onPreloadStarted"], + ["function", "onShowNewObject"], + ["function", "onTeamSwitch"], + ["function", "openCuratorInterface"], + ["function", "openDLCPage"], + ["function", "openDSInterface"], + ["function", "openMap"], + ["function", "openSteamApp"], + ["function", "openYoutubeVideo"], + ["function", "opfor"], + ["function", "orderGetIn"], + ["function", "overcast"], + ["function", "overcastForecast"], + ["function", "owner"], + ["function", "param"], + ["function", "params"], + ["function", "parseNumber"], + ["function", "parseSimpleArray"], + ["function", "parseText"], + ["function", "parsingNamespace"], + ["function", "particlesQuality"], + ["function", "pi"], + ["function", "pickWeaponPool"], + ["function", "pitch"], + ["function", "pixelGrid"], + ["function", "pixelGridBase"], + ["function", "pixelGridNoUIScale"], + ["function", "pixelH"], + ["function", "pixelW"], + ["function", "playableSlotsNumber"], + ["function", "playableUnits"], + ["function", "playAction"], + ["function", "playActionNow"], + ["function", "player"], + ["function", "playerRespawnTime"], + ["function", "playerSide"], + ["function", "playersNumber"], + ["function", "playGesture"], + ["function", "playMission"], + ["function", "playMove"], + ["function", "playMoveNow"], + ["function", "playMusic"], + ["function", "playScriptedMission"], + ["function", "playSound"], + ["function", "playSound3D"], + ["function", "position"], + ["function", "positionCameraToWorld"], + ["function", "posScreenToWorld"], + ["function", "posWorldToScreen"], + ["function", "ppEffectAdjust"], + ["function", "ppEffectCommit"], + ["function", "ppEffectCommitted"], + ["function", "ppEffectCreate"], + ["function", "ppEffectDestroy"], + ["function", "ppEffectEnable"], + ["function", "ppEffectEnabled"], + ["function", "ppEffectForceInNVG"], + ["function", "precision"], + ["function", "preloadCamera"], + ["function", "preloadObject"], + ["function", "preloadSound"], + ["function", "preloadTitleObj"], + ["function", "preloadTitleRsc"], + ["function", "primaryWeapon"], + ["function", "primaryWeaponItems"], + ["function", "primaryWeaponMagazine"], + ["function", "priority"], + ["function", "processDiaryLink"], + ["function", "processInitCommands"], + ["function", "productVersion"], + ["function", "profileName"], + ["function", "profileNamespace"], + ["function", "profileNameSteam"], + ["function", "progressLoadingScreen"], + ["function", "progressPosition"], + ["function", "progressSetPosition"], + ["function", "publicVariable"], + ["function", "publicVariableClient"], + ["function", "publicVariableServer"], + ["function", "pushBack"], + ["function", "pushBackUnique"], + ["function", "putWeaponPool"], + ["function", "queryItemsPool"], + ["function", "queryMagazinePool"], + ["function", "queryWeaponPool"], + ["function", "rad"], + ["function", "radioChannelAdd"], + ["function", "radioChannelCreate"], + ["function", "radioChannelRemove"], + ["function", "radioChannelSetCallSign"], + ["function", "radioChannelSetLabel"], + ["function", "radioVolume"], + ["function", "rain"], + ["function", "rainbow"], + ["function", "random"], + ["function", "rank"], + ["function", "rankId"], + ["function", "rating"], + ["function", "rectangular"], + ["function", "registeredTasks"], + ["function", "registerTask"], + ["function", "reload"], + ["function", "reloadEnabled"], + ["function", "remoteControl"], + ["function", "remoteExec"], + ["function", "remoteExecCall"], + ["function", "remoteExecutedOwner"], + ["function", "remove3DENConnection"], + ["function", "remove3DENEventHandler"], + ["function", "remove3DENLayer"], + ["function", "removeAction"], + ["function", "removeAll3DENEventHandlers"], + ["function", "removeAllActions"], + ["function", "removeAllAssignedItems"], + ["function", "removeAllContainers"], + ["function", "removeAllCuratorAddons"], + ["function", "removeAllCuratorCameraAreas"], + ["function", "removeAllCuratorEditingAreas"], + ["function", "removeAllEventHandlers"], + ["function", "removeAllHandgunItems"], + ["function", "removeAllItems"], + ["function", "removeAllItemsWithMagazines"], + ["function", "removeAllMissionEventHandlers"], + ["function", "removeAllMPEventHandlers"], + ["function", "removeAllMusicEventHandlers"], + ["function", "removeAllOwnedMines"], + ["function", "removeAllPrimaryWeaponItems"], + ["function", "removeAllWeapons"], + ["function", "removeBackpack"], + ["function", "removeBackpackGlobal"], + ["function", "removeCuratorAddons"], + ["function", "removeCuratorCameraArea"], + ["function", "removeCuratorEditableObjects"], + ["function", "removeCuratorEditingArea"], + ["function", "removeDrawIcon"], + ["function", "removeDrawLinks"], + ["function", "removeEventHandler"], + ["function", "removeFromRemainsCollector"], + ["function", "removeGoggles"], + ["function", "removeGroupIcon"], + ["function", "removeHandgunItem"], + ["function", "removeHeadgear"], + ["function", "removeItem"], + ["function", "removeItemFromBackpack"], + ["function", "removeItemFromUniform"], + ["function", "removeItemFromVest"], + ["function", "removeItems"], + ["function", "removeMagazine"], + ["function", "removeMagazineGlobal"], + ["function", "removeMagazines"], + ["function", "removeMagazinesTurret"], + ["function", "removeMagazineTurret"], + ["function", "removeMenuItem"], + ["function", "removeMissionEventHandler"], + ["function", "removeMPEventHandler"], + ["function", "removeMusicEventHandler"], + ["function", "removeOwnedMine"], + ["function", "removePrimaryWeaponItem"], + ["function", "removeSecondaryWeaponItem"], + ["function", "removeSimpleTask"], + ["function", "removeSwitchableUnit"], + ["function", "removeTeamMember"], + ["function", "removeUniform"], + ["function", "removeVest"], + ["function", "removeWeapon"], + ["function", "removeWeaponAttachmentCargo"], + ["function", "removeWeaponCargo"], + ["function", "removeWeaponGlobal"], + ["function", "removeWeaponTurret"], + ["function", "reportRemoteTarget"], + ["function", "requiredVersion"], + ["function", "resetCamShake"], + ["function", "resetSubgroupDirection"], + ["function", "resistance"], + ["function", "resize"], + ["function", "resources"], + ["function", "respawnVehicle"], + ["function", "restartEditorCamera"], + ["function", "reveal"], + ["function", "revealMine"], + ["function", "reverse"], + ["function", "reversedMouseY"], + ["function", "roadAt"], + ["function", "roadsConnectedTo"], + ["function", "roleDescription"], + ["function", "ropeAttachedObjects"], + ["function", "ropeAttachedTo"], + ["function", "ropeAttachEnabled"], + ["function", "ropeAttachTo"], + ["function", "ropeCreate"], + ["function", "ropeCut"], + ["function", "ropeDestroy"], + ["function", "ropeDetach"], + ["function", "ropeEndPosition"], + ["function", "ropeLength"], + ["function", "ropes"], + ["function", "ropeUnwind"], + ["function", "ropeUnwound"], + ["function", "rotorsForcesRTD"], + ["function", "rotorsRpmRTD"], + ["function", "round"], + ["function", "runInitScript"], + ["function", "safeZoneH"], + ["function", "safeZoneW"], + ["function", "safeZoneWAbs"], + ["function", "safeZoneX"], + ["function", "safeZoneXAbs"], + ["function", "safeZoneY"], + ["function", "save3DENInventory"], + ["function", "saveGame"], + ["function", "saveIdentity"], + ["function", "saveJoysticks"], + ["function", "saveOverlay"], + ["function", "saveProfileNamespace"], + ["function", "saveStatus"], + ["function", "saveVar"], + ["function", "savingEnabled"], + ["function", "say"], + ["function", "say2D"], + ["function", "say3D"], + ["function", "score"], + ["function", "scoreSide"], + ["function", "screenshot"], + ["function", "screenToWorld"], + ["function", "scriptDone"], + ["function", "scriptName"], + ["function", "scriptNull"], + ["function", "scudState"], + ["function", "secondaryWeapon"], + ["function", "secondaryWeaponItems"], + ["function", "secondaryWeaponMagazine"], + ["function", "select"], + ["function", "selectBestPlaces"], + ["function", "selectDiarySubject"], + ["function", "selectedEditorObjects"], + ["function", "selectEditorObject"], + ["function", "selectionNames"], + ["function", "selectionPosition"], + ["function", "selectLeader"], + ["function", "selectMax"], + ["function", "selectMin"], + ["function", "selectNoPlayer"], + ["function", "selectPlayer"], + ["function", "selectRandom"], + ["function", "selectRandomWeighted"], + ["function", "selectWeapon"], + ["function", "selectWeaponTurret"], + ["function", "sendAUMessage"], + ["function", "sendSimpleCommand"], + ["function", "sendTask"], + ["function", "sendTaskResult"], + ["function", "sendUDPMessage"], + ["function", "serverCommand"], + ["function", "serverCommandAvailable"], + ["function", "serverCommandExecutable"], + ["function", "serverName"], + ["function", "serverTime"], + ["function", "set"], + ["function", "set3DENAttribute"], + ["function", "set3DENAttributes"], + ["function", "set3DENGrid"], + ["function", "set3DENIconsVisible"], + ["function", "set3DENLayer"], + ["function", "set3DENLinesVisible"], + ["function", "set3DENLogicType"], + ["function", "set3DENMissionAttribute"], + ["function", "set3DENMissionAttributes"], + ["function", "set3DENModelsVisible"], + ["function", "set3DENObjectType"], + ["function", "set3DENSelected"], + ["function", "setAccTime"], + ["function", "setActualCollectiveRTD"], + ["function", "setAirplaneThrottle"], + ["function", "setAirportSide"], + ["function", "setAmmo"], + ["function", "setAmmoCargo"], + ["function", "setAmmoOnPylon"], + ["function", "setAnimSpeedCoef"], + ["function", "setAperture"], + ["function", "setApertureNew"], + ["function", "setArmoryPoints"], + ["function", "setAttributes"], + ["function", "setAutonomous"], + ["function", "setBehaviour"], + ["function", "setBleedingRemaining"], + ["function", "setBrakesRTD"], + ["function", "setCameraInterest"], + ["function", "setCamShakeDefParams"], + ["function", "setCamShakeParams"], + ["function", "setCamUseTI"], + ["function", "setCaptive"], + ["function", "setCenterOfMass"], + ["function", "setCollisionLight"], + ["function", "setCombatMode"], + ["function", "setCompassOscillation"], + ["function", "setConvoySeparation"], + ["function", "setCuratorCameraAreaCeiling"], + ["function", "setCuratorCoef"], + ["function", "setCuratorEditingAreaType"], + ["function", "setCuratorWaypointCost"], + ["function", "setCurrentChannel"], + ["function", "setCurrentTask"], + ["function", "setCurrentWaypoint"], + ["function", "setCustomAimCoef"], + ["function", "setCustomWeightRTD"], + ["function", "setDamage"], + ["function", "setDammage"], + ["function", "setDate"], + ["function", "setDebriefingText"], + ["function", "setDefaultCamera"], + ["function", "setDestination"], + ["function", "setDetailMapBlendPars"], + ["function", "setDir"], + ["function", "setDirection"], + ["function", "setDrawIcon"], + ["function", "setDriveOnPath"], + ["function", "setDropInterval"], + ["function", "setDynamicSimulationDistance"], + ["function", "setDynamicSimulationDistanceCoef"], + ["function", "setEditorMode"], + ["function", "setEditorObjectScope"], + ["function", "setEffectCondition"], + ["function", "setEngineRpmRTD"], + ["function", "setFace"], + ["function", "setFaceAnimation"], + ["function", "setFatigue"], + ["function", "setFeatureType"], + ["function", "setFlagAnimationPhase"], + ["function", "setFlagOwner"], + ["function", "setFlagSide"], + ["function", "setFlagTexture"], + ["function", "setFog"], + ["function", "setForceGeneratorRTD"], + ["function", "setFormation"], + ["function", "setFormationTask"], + ["function", "setFormDir"], + ["function", "setFriend"], + ["function", "setFromEditor"], + ["function", "setFSMVariable"], + ["function", "setFuel"], + ["function", "setFuelCargo"], + ["function", "setGroupIcon"], + ["function", "setGroupIconParams"], + ["function", "setGroupIconsSelectable"], + ["function", "setGroupIconsVisible"], + ["function", "setGroupId"], + ["function", "setGroupIdGlobal"], + ["function", "setGroupOwner"], + ["function", "setGusts"], + ["function", "setHideBehind"], + ["function", "setHit"], + ["function", "setHitIndex"], + ["function", "setHitPointDamage"], + ["function", "setHorizonParallaxCoef"], + ["function", "setHUDMovementLevels"], + ["function", "setIdentity"], + ["function", "setImportance"], + ["function", "setInfoPanel"], + ["function", "setLeader"], + ["function", "setLightAmbient"], + ["function", "setLightAttenuation"], + ["function", "setLightBrightness"], + ["function", "setLightColor"], + ["function", "setLightDayLight"], + ["function", "setLightFlareMaxDistance"], + ["function", "setLightFlareSize"], + ["function", "setLightIntensity"], + ["function", "setLightnings"], + ["function", "setLightUseFlare"], + ["function", "setLocalWindParams"], + ["function", "setMagazineTurretAmmo"], + ["function", "setMarkerAlpha"], + ["function", "setMarkerAlphaLocal"], + ["function", "setMarkerBrush"], + ["function", "setMarkerBrushLocal"], + ["function", "setMarkerColor"], + ["function", "setMarkerColorLocal"], + ["function", "setMarkerDir"], + ["function", "setMarkerDirLocal"], + ["function", "setMarkerPos"], + ["function", "setMarkerPosLocal"], + ["function", "setMarkerShape"], + ["function", "setMarkerShapeLocal"], + ["function", "setMarkerSize"], + ["function", "setMarkerSizeLocal"], + ["function", "setMarkerText"], + ["function", "setMarkerTextLocal"], + ["function", "setMarkerType"], + ["function", "setMarkerTypeLocal"], + ["function", "setMass"], + ["function", "setMimic"], + ["function", "setMousePosition"], + ["function", "setMusicEffect"], + ["function", "setMusicEventHandler"], + ["function", "setName"], + ["function", "setNameSound"], + ["function", "setObjectArguments"], + ["function", "setObjectMaterial"], + ["function", "setObjectMaterialGlobal"], + ["function", "setObjectProxy"], + ["function", "setObjectTexture"], + ["function", "setObjectTextureGlobal"], + ["function", "setObjectViewDistance"], + ["function", "setOvercast"], + ["function", "setOwner"], + ["function", "setOxygenRemaining"], + ["function", "setParticleCircle"], + ["function", "setParticleClass"], + ["function", "setParticleFire"], + ["function", "setParticleParams"], + ["function", "setParticleRandom"], + ["function", "setPilotCameraDirection"], + ["function", "setPilotCameraRotation"], + ["function", "setPilotCameraTarget"], + ["function", "setPilotLight"], + ["function", "setPiPEffect"], + ["function", "setPitch"], + ["function", "setPlateNumber"], + ["function", "setPlayable"], + ["function", "setPlayerRespawnTime"], + ["function", "setPos"], + ["function", "setPosASL"], + ["function", "setPosASL2"], + ["function", "setPosASLW"], + ["function", "setPosATL"], + ["function", "setPosition"], + ["function", "setPosWorld"], + ["function", "setPylonLoadOut"], + ["function", "setPylonsPriority"], + ["function", "setRadioMsg"], + ["function", "setRain"], + ["function", "setRainbow"], + ["function", "setRandomLip"], + ["function", "setRank"], + ["function", "setRectangular"], + ["function", "setRepairCargo"], + ["function", "setRotorBrakeRTD"], + ["function", "setShadowDistance"], + ["function", "setShotParents"], + ["function", "setSide"], + ["function", "setSimpleTaskAlwaysVisible"], + ["function", "setSimpleTaskCustomData"], + ["function", "setSimpleTaskDescription"], + ["function", "setSimpleTaskDestination"], + ["function", "setSimpleTaskTarget"], + ["function", "setSimpleTaskType"], + ["function", "setSimulWeatherLayers"], + ["function", "setSize"], + ["function", "setSkill"], + ["function", "setSlingLoad"], + ["function", "setSoundEffect"], + ["function", "setSpeaker"], + ["function", "setSpeech"], + ["function", "setSpeedMode"], + ["function", "setStamina"], + ["function", "setStaminaScheme"], + ["function", "setStatValue"], + ["function", "setSuppression"], + ["function", "setSystemOfUnits"], + ["function", "setTargetAge"], + ["function", "setTaskMarkerOffset"], + ["function", "setTaskResult"], + ["function", "setTaskState"], + ["function", "setTerrainGrid"], + ["function", "setText"], + ["function", "setTimeMultiplier"], + ["function", "setTitleEffect"], + ["function", "setToneMapping"], + ["function", "setToneMappingParams"], + ["function", "setTrafficDensity"], + ["function", "setTrafficDistance"], + ["function", "setTrafficGap"], + ["function", "setTrafficSpeed"], + ["function", "setTriggerActivation"], + ["function", "setTriggerArea"], + ["function", "setTriggerStatements"], + ["function", "setTriggerText"], + ["function", "setTriggerTimeout"], + ["function", "setTriggerType"], + ["function", "setType"], + ["function", "setUnconscious"], + ["function", "setUnitAbility"], + ["function", "setUnitLoadout"], + ["function", "setUnitPos"], + ["function", "setUnitPosWeak"], + ["function", "setUnitRank"], + ["function", "setUnitRecoilCoefficient"], + ["function", "setUnitTrait"], + ["function", "setUnloadInCombat"], + ["function", "setUserActionText"], + ["function", "setUserMFDText"], + ["function", "setUserMFDValue"], + ["function", "setVariable"], + ["function", "setVectorDir"], + ["function", "setVectorDirAndUp"], + ["function", "setVectorUp"], + ["function", "setVehicleAmmo"], + ["function", "setVehicleAmmoDef"], + ["function", "setVehicleArmor"], + ["function", "setVehicleCargo"], + ["function", "setVehicleId"], + ["function", "setVehicleInit"], + ["function", "setVehicleLock"], + ["function", "setVehiclePosition"], + ["function", "setVehicleRadar"], + ["function", "setVehicleReceiveRemoteTargets"], + ["function", "setVehicleReportOwnPosition"], + ["function", "setVehicleReportRemoteTargets"], + ["function", "setVehicleTIPars"], + ["function", "setVehicleVarName"], + ["function", "setVelocity"], + ["function", "setVelocityModelSpace"], + ["function", "setVelocityTransformation"], + ["function", "setViewDistance"], + ["function", "setVisibleIfTreeCollapsed"], + ["function", "setWantedRpmRTD"], + ["function", "setWaves"], + ["function", "setWaypointBehaviour"], + ["function", "setWaypointCombatMode"], + ["function", "setWaypointCompletionRadius"], + ["function", "setWaypointDescription"], + ["function", "setWaypointForceBehaviour"], + ["function", "setWaypointFormation"], + ["function", "setWaypointHousePosition"], + ["function", "setWaypointLoiterRadius"], + ["function", "setWaypointLoiterType"], + ["function", "setWaypointName"], + ["function", "setWaypointPosition"], + ["function", "setWaypointScript"], + ["function", "setWaypointSpeed"], + ["function", "setWaypointStatements"], + ["function", "setWaypointTimeout"], + ["function", "setWaypointType"], + ["function", "setWaypointVisible"], + ["function", "setWeaponReloadingTime"], + ["function", "setWind"], + ["function", "setWindDir"], + ["function", "setWindForce"], + ["function", "setWindStr"], + ["function", "setWingForceScaleRTD"], + ["function", "setWPPos"], + ["function", "show3DIcons"], + ["function", "showChat"], + ["function", "showCinemaBorder"], + ["function", "showCommandingMenu"], + ["function", "showCompass"], + ["function", "showCuratorCompass"], + ["function", "showGPS"], + ["function", "showHUD"], + ["function", "showLegend"], + ["function", "showMap"], + ["function", "shownArtilleryComputer"], + ["function", "shownChat"], + ["function", "shownCompass"], + ["function", "shownCuratorCompass"], + ["function", "showNewEditorObject"], + ["function", "shownGPS"], + ["function", "shownHUD"], + ["function", "shownMap"], + ["function", "shownPad"], + ["function", "shownRadio"], + ["function", "shownScoretable"], + ["function", "shownUAVFeed"], + ["function", "shownWarrant"], + ["function", "shownWatch"], + ["function", "showPad"], + ["function", "showRadio"], + ["function", "showScoretable"], + ["function", "showSubtitles"], + ["function", "showUAVFeed"], + ["function", "showWarrant"], + ["function", "showWatch"], + ["function", "showWaypoint"], + ["function", "showWaypoints"], + ["function", "side"], + ["function", "sideAmbientLife"], + ["function", "sideChat"], + ["function", "sideEmpty"], + ["function", "sideEnemy"], + ["function", "sideFriendly"], + ["function", "sideLogic"], + ["function", "sideRadio"], + ["function", "sideUnknown"], + ["function", "simpleTasks"], + ["function", "simulationEnabled"], + ["function", "simulCloudDensity"], + ["function", "simulCloudOcclusion"], + ["function", "simulInClouds"], + ["function", "simulWeatherSync"], + ["function", "sin"], + ["function", "size"], + ["function", "sizeOf"], + ["function", "skill"], + ["function", "skillFinal"], + ["function", "skipTime"], + ["function", "sleep"], + ["function", "sliderPosition"], + ["function", "sliderRange"], + ["function", "sliderSetPosition"], + ["function", "sliderSetRange"], + ["function", "sliderSetSpeed"], + ["function", "sliderSpeed"], + ["function", "slingLoadAssistantShown"], + ["function", "soldierMagazines"], + ["function", "someAmmo"], + ["function", "sort"], + ["function", "soundVolume"], + ["function", "speaker"], + ["function", "speed"], + ["function", "speedMode"], + ["function", "splitString"], + ["function", "sqrt"], + ["function", "squadParams"], + ["function", "stance"], + ["function", "startLoadingScreen"], + ["function", "stop"], + ["function", "stopEngineRTD"], + ["function", "stopped"], + ["function", "str"], + ["function", "sunOrMoon"], + ["function", "supportInfo"], + ["function", "suppressFor"], + ["function", "surfaceIsWater"], + ["function", "surfaceNormal"], + ["function", "surfaceType"], + ["function", "swimInDepth"], + ["function", "switchableUnits"], + ["function", "switchAction"], + ["function", "switchCamera"], + ["function", "switchGesture"], + ["function", "switchLight"], + ["function", "switchMove"], + ["function", "synchronizedObjects"], + ["function", "synchronizedTriggers"], + ["function", "synchronizedWaypoints"], + ["function", "synchronizeObjectsAdd"], + ["function", "synchronizeObjectsRemove"], + ["function", "synchronizeTrigger"], + ["function", "synchronizeWaypoint"], + ["function", "systemChat"], + ["function", "systemOfUnits"], + ["function", "tan"], + ["function", "targetKnowledge"], + ["function", "targets"], + ["function", "targetsAggregate"], + ["function", "targetsQuery"], + ["function", "taskAlwaysVisible"], + ["function", "taskChildren"], + ["function", "taskCompleted"], + ["function", "taskCustomData"], + ["function", "taskDescription"], + ["function", "taskDestination"], + ["function", "taskHint"], + ["function", "taskMarkerOffset"], + ["function", "taskNull"], + ["function", "taskParent"], + ["function", "taskResult"], + ["function", "taskState"], + ["function", "taskType"], + ["function", "teamMember"], + ["function", "teamMemberNull"], + ["function", "teamName"], + ["function", "teams"], + ["function", "teamSwitch"], + ["function", "teamSwitchEnabled"], + ["function", "teamType"], + ["function", "terminate"], + ["function", "terrainIntersect"], + ["function", "terrainIntersectASL"], + ["function", "terrainIntersectAtASL"], + ["function", "text"], + ["function", "textLog"], + ["function", "textLogFormat"], + ["function", "tg"], + ["function", "time"], + ["function", "timeMultiplier"], + ["function", "titleCut"], + ["function", "titleFadeOut"], + ["function", "titleObj"], + ["function", "titleRsc"], + ["function", "titleText"], + ["function", "toArray"], + ["function", "toFixed"], + ["function", "toLower"], + ["function", "toString"], + ["function", "toUpper"], + ["function", "triggerActivated"], + ["function", "triggerActivation"], + ["function", "triggerArea"], + ["function", "triggerAttachedVehicle"], + ["function", "triggerAttachObject"], + ["function", "triggerAttachVehicle"], + ["function", "triggerDynamicSimulation"], + ["function", "triggerStatements"], + ["function", "triggerText"], + ["function", "triggerTimeout"], + ["function", "triggerTimeoutCurrent"], + ["function", "triggerType"], + ["function", "turretLocal"], + ["function", "turretOwner"], + ["function", "turretUnit"], + ["function", "tvAdd"], + ["function", "tvClear"], + ["function", "tvCollapse"], + ["function", "tvCollapseAll"], + ["function", "tvCount"], + ["function", "tvCurSel"], + ["function", "tvData"], + ["function", "tvDelete"], + ["function", "tvExpand"], + ["function", "tvExpandAll"], + ["function", "tvPicture"], + ["function", "tvPictureRight"], + ["function", "tvSetColor"], + ["function", "tvSetCurSel"], + ["function", "tvSetData"], + ["function", "tvSetPicture"], + ["function", "tvSetPictureColor"], + ["function", "tvSetPictureColorDisabled"], + ["function", "tvSetPictureColorSelected"], + ["function", "tvSetPictureRight"], + ["function", "tvSetPictureRightColor"], + ["function", "tvSetPictureRightColorDisabled"], + ["function", "tvSetPictureRightColorSelected"], + ["function", "tvSetSelectColor"], + ["function", "tvSetText"], + ["function", "tvSetTooltip"], + ["function", "tvSetValue"], + ["function", "tvSort"], + ["function", "tvSortByValue"], + ["function", "tvText"], + ["function", "tvTooltip"], + ["function", "tvValue"], + ["function", "type"], + ["function", "typeName"], + ["function", "typeOf"], + ["function", "UAVControl"], + ["function", "uiNamespace"], + ["function", "uiSleep"], + ["function", "unassignCurator"], + ["function", "unassignItem"], + ["function", "unassignTeam"], + ["function", "unassignVehicle"], + ["function", "underwater"], + ["function", "uniform"], + ["function", "uniformContainer"], + ["function", "uniformItems"], + ["function", "uniformMagazines"], + ["function", "unitAddons"], + ["function", "unitAimPosition"], + ["function", "unitAimPositionVisual"], + ["function", "unitBackpack"], + ["function", "unitIsUAV"], + ["function", "unitPos"], + ["function", "unitReady"], + ["function", "unitRecoilCoefficient"], + ["function", "units"], + ["function", "unitsBelowHeight"], + ["function", "unlinkItem"], + ["function", "unlockAchievement"], + ["function", "unregisterTask"], + ["function", "updateDrawIcon"], + ["function", "updateMenuItem"], + ["function", "updateObjectTree"], + ["function", "useAIOperMapObstructionTest"], + ["function", "useAISteeringComponent"], + ["function", "useAudioTimeForMoves"], + ["function", "userInputDisabled"], + ["function", "vectorAdd"], + ["function", "vectorCos"], + ["function", "vectorCrossProduct"], + ["function", "vectorDiff"], + ["function", "vectorDir"], + ["function", "vectorDirVisual"], + ["function", "vectorDistance"], + ["function", "vectorDistanceSqr"], + ["function", "vectorDotProduct"], + ["function", "vectorFromTo"], + ["function", "vectorMagnitude"], + ["function", "vectorMagnitudeSqr"], + ["function", "vectorModelToWorld"], + ["function", "vectorModelToWorldVisual"], + ["function", "vectorMultiply"], + ["function", "vectorNormalized"], + ["function", "vectorUp"], + ["function", "vectorUpVisual"], + ["function", "vectorWorldToModel"], + ["function", "vectorWorldToModelVisual"], + ["function", "vehicle"], + ["function", "vehicleCargoEnabled"], + ["function", "vehicleChat"], + ["function", "vehicleRadio"], + ["function", "vehicleReceiveRemoteTargets"], + ["function", "vehicleReportOwnPosition"], + ["function", "vehicleReportRemoteTargets"], + ["function", "vehicles"], + ["function", "vehicleVarName"], + ["function", "velocity"], + ["function", "velocityModelSpace"], + ["function", "verifySignature"], + ["function", "vest"], + ["function", "vestContainer"], + ["function", "vestItems"], + ["function", "vestMagazines"], + ["function", "viewDistance"], + ["function", "visibleCompass"], + ["function", "visibleGPS"], + ["function", "visibleMap"], + ["function", "visiblePosition"], + ["function", "visiblePositionASL"], + ["function", "visibleScoretable"], + ["function", "visibleWatch"], + ["function", "waitUntil"], + ["function", "waves"], + ["function", "waypointAttachedObject"], + ["function", "waypointAttachedVehicle"], + ["function", "waypointAttachObject"], + ["function", "waypointAttachVehicle"], + ["function", "waypointBehaviour"], + ["function", "waypointCombatMode"], + ["function", "waypointCompletionRadius"], + ["function", "waypointDescription"], + ["function", "waypointForceBehaviour"], + ["function", "waypointFormation"], + ["function", "waypointHousePosition"], + ["function", "waypointLoiterRadius"], + ["function", "waypointLoiterType"], + ["function", "waypointName"], + ["function", "waypointPosition"], + ["function", "waypoints"], + ["function", "waypointScript"], + ["function", "waypointsEnabledUAV"], + ["function", "waypointShow"], + ["function", "waypointSpeed"], + ["function", "waypointStatements"], + ["function", "waypointTimeout"], + ["function", "waypointTimeoutCurrent"], + ["function", "waypointType"], + ["function", "waypointVisible"], + ["function", "weaponAccessories"], + ["function", "weaponAccessoriesCargo"], + ["function", "weaponCargo"], + ["function", "weaponDirection"], + ["function", "weaponInertia"], + ["function", "weaponLowered"], + ["function", "weapons"], + ["function", "weaponsItems"], + ["function", "weaponsItemsCargo"], + ["function", "weaponState"], + ["function", "weaponsTurret"], + ["function", "weightRTD"], + ["function", "west"], + ["function", "WFSideText"], + ["function", "wind"], + ["function", "windDir"], + ["function", "windRTD"], + ["function", "windStr"], + ["function", "wingsForcesRTD"], + ["function", "worldName"], + ["function", "worldSize"], + ["function", "worldToModel"], + ["function", "worldToModelVisual"], + ["function", "worldToScreen"] +] diff --git a/package/src/prism/tests/languages/sqf/keyword_feature.test b/package/src/prism/tests/languages/sqf/keyword_feature.test new file mode 100644 index 00000000..5500d707 --- /dev/null +++ b/package/src/prism/tests/languages/sqf/keyword_feature.test @@ -0,0 +1,77 @@ +breakOut +breakTo +call +case +catch +default +do +echo +else +execVM +execFSM +exitWith +for +forEach +forEachMember +forEachMemberAgent +forEachMemberTeam +from +goto +if +nil +preprocessFile +preprocessFileLineNumbers +private +scopeName +spawn +step +switch +then +throw +to +try +while +with + +---------------------------------------------------- + +[ + ["keyword", "breakOut"], + ["keyword", "breakTo"], + ["keyword", "call"], + ["keyword", "case"], + ["keyword", "catch"], + ["keyword", "default"], + ["keyword", "do"], + ["keyword", "echo"], + ["keyword", "else"], + ["keyword", "execVM"], + ["keyword", "execFSM"], + ["keyword", "exitWith"], + ["keyword", "for"], + ["keyword", "forEach"], + ["keyword", "forEachMember"], + ["keyword", "forEachMemberAgent"], + ["keyword", "forEachMemberTeam"], + ["keyword", "from"], + ["keyword", "goto"], + ["keyword", "if"], + ["keyword", "nil"], + ["keyword", "preprocessFile"], + ["keyword", "preprocessFileLineNumbers"], + ["keyword", "private"], + ["keyword", "scopeName"], + ["keyword", "spawn"], + ["keyword", "step"], + ["keyword", "switch"], + ["keyword", "then"], + ["keyword", "throw"], + ["keyword", "to"], + ["keyword", "try"], + ["keyword", "while"], + ["keyword", "with"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/sqf/macro_feature.test b/package/src/prism/tests/languages/sqf/macro_feature.test new file mode 100644 index 00000000..558a0da5 --- /dev/null +++ b/package/src/prism/tests/languages/sqf/macro_feature.test @@ -0,0 +1,65 @@ +#define FOO 3 +#define HINTARG(ARG) hint ("Passed argument: " + str ARG) +#define DRAWBUTTON(NAME)\ + __EXEC(idcNav = idcNav + 4) + +#undef NAME + +#ifdef NAME +#ifndef NAME +#else +#endif + +#include "file.hpp" +#include // Brackets are equivalent to quotation marks and may be used in their place. + +---------------------------------------------------- + +[ + ["macro", [ + ["directive", "#define"], + " FOO 3" + ]], + ["macro", [ + ["directive", "#define"], + " HINTARG(ARG) hint (\"Passed argument: \" + str ARG)" + ]], + ["macro", [ + ["directive", "#define"], + " DRAWBUTTON(NAME)\\\n\t__EXEC(idcNav = idcNav + 4)" + ]], + + ["macro", [ + ["directive", "#undef"], + " NAME" + ]], + + ["macro", [ + ["directive", "#ifdef"], + " NAME" + ]], + ["macro", [ + ["directive", "#ifndef"], + " NAME" + ]], + ["macro", [ + ["directive", "#else"] + ]], + ["macro", [ + ["directive", "#endif"] + ]], + + ["macro", [ + ["directive", "#include"], + " \"file.hpp\"" + ]], + ["macro", [ + ["directive", "#include"], + " ", + ["comment", "// Brackets are equivalent to quotation marks and may be used in their place."] + ]] +] + +---------------------------------------------------- + +Checks for macros. diff --git a/package/src/prism/tests/languages/sqf/magic-variable_feature.test b/package/src/prism/tests/languages/sqf/magic-variable_feature.test new file mode 100644 index 00000000..b3f0248c --- /dev/null +++ b/package/src/prism/tests/languages/sqf/magic-variable_feature.test @@ -0,0 +1,33 @@ +_exception +_fnc_scriptName +_fnc_scriptNameParent +_forEachIndex +_this +_thisEventHandler +_thisFSM +_thisScript +_x +this +thisList +thisTrigger + +---------------------------------------------------- + +[ + ["magic-variable", "_exception"], + ["magic-variable", "_fnc_scriptName"], + ["magic-variable", "_fnc_scriptNameParent"], + ["magic-variable", "_forEachIndex"], + ["magic-variable", "_this"], + ["magic-variable", "_thisEventHandler"], + ["magic-variable", "_thisFSM"], + ["magic-variable", "_thisScript"], + ["magic-variable", "_x"], + ["magic-variable", "this"], + ["magic-variable", "thisList"], + ["magic-variable", "thisTrigger"] +] + +---------------------------------------------------- + +Checks for magic variables. diff --git a/package/src/prism/tests/languages/sqf/number_feature.test b/package/src/prism/tests/languages/sqf/number_feature.test new file mode 100644 index 00000000..f9fb8988 --- /dev/null +++ b/package/src/prism/tests/languages/sqf/number_feature.test @@ -0,0 +1,35 @@ +5.197 +0.47 +16.0 +.8314 +12345 + +1.23E4 +5e-2 + +0xa5 +$5C +$FFFFFF +0x123ABC + +---------------------------------------------------- + +[ + ["number", "5.197"], + ["number", "0.47"], + ["number", "16.0"], + ["number", ".8314"], + ["number", "12345"], + + ["number", "1.23E4"], + ["number", "5e-2"], + + ["number", "0xa5"], + ["number", "$5C"], + ["number", "$FFFFFF"], + ["number", "0x123ABC"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/sqf/operator_feature.test b/package/src/prism/tests/languages/sqf/operator_feature.test new file mode 100644 index 00000000..0881c7e8 --- /dev/null +++ b/package/src/prism/tests/languages/sqf/operator_feature.test @@ -0,0 +1,47 @@ ++ - * / % ^ # + +!= == >= <= > < + +! && || += + +>> ## + +mod +and or not + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + ["operator", "^"], + ["operator", "#"], + + ["operator", "!="], + ["operator", "=="], + ["operator", ">="], + ["operator", "<="], + ["operator", ">"], + ["operator", "<"], + + ["operator", "!"], + ["operator", "&&"], + ["operator", "||"], + ["operator", "="], + + ["operator", ">>"], + ["operator", "##"], + + ["operator", "mod"], + ["operator", "and"], + ["operator", "or"], + ["operator", "not"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/sqf/string_feature.test b/package/src/prism/tests/languages/sqf/string_feature.test new file mode 100644 index 00000000..48ad352c --- /dev/null +++ b/package/src/prism/tests/languages/sqf/string_feature.test @@ -0,0 +1,23 @@ +"foo" +"foo""bar" +"foo +bar" + +'foo' +'foo +bar' + +---------------------------------------------------- + +[ + ["string", "\"foo\""], + ["string", "\"foo\"\"bar\""], + ["string", "\"foo\nbar\""], + + ["string", "'foo'"], + ["string", "'foo\nbar'"] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/sql+js-templates+javascript/sql_inclusion.test b/package/src/prism/tests/languages/sql+js-templates+javascript/sql_inclusion.test new file mode 100644 index 00000000..e1f6d9b5 --- /dev/null +++ b/package/src/prism/tests/languages/sql+js-templates+javascript/sql_inclusion.test @@ -0,0 +1,36 @@ +const users = await sql` + SELECT * FROM users WHERE id = ${id} +`; + +---------------------------------------------------- + +[ + ["keyword", "const"], + " users ", + ["operator", "="], + ["keyword", "await"], + " sql", + ["template-string", [ + ["template-punctuation", "`"], + ["language-sql", [ + ["keyword", "SELECT"], + ["operator", "*"], + ["keyword", "FROM"], + " users ", + ["keyword", "WHERE"], + " id ", + ["operator", "="], + ["interpolation", [ + ["interpolation-punctuation", "${"], + "id", + ["interpolation-punctuation", "}"] + ]] + ]], + ["template-punctuation", "`"] + ]], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for tagged template literals containing SQL code. diff --git a/package/src/prism/tests/languages/sql+sas/sql_inclusion.test b/package/src/prism/tests/languages/sql+sas/sql_inclusion.test new file mode 100644 index 00000000..e42d0298 --- /dev/null +++ b/package/src/prism/tests/languages/sql+sas/sql_inclusion.test @@ -0,0 +1,274 @@ +proc sql; +select * + from proclib.paylist; +proc print; + +proc sql outobs=10; + title 'Proclib.Payroll'; + select * from proclib.payroll; + title; +quit; + +proc sql; + select BookingDate, + ReleaseDate, + ReleaseCode + from SASclass.Bookings; +quit; + +proc sql; + select BookingDate, + ReleaseDate, + ReleaseCode + from SASclass.Bookings; +quit; + +libname proclib 'SAS-library'; +proc sql; + create view proclib.jobs(pw-red) as + select Jobcode, + count(jobcode) as number label='Number', + avg(int(today()-birth/365.25)) as avgage + format=2. label='Average Salary' + from Payroll + group by Jobcode + having avage ge 30; + title1 'Current Summary Information for Each Job category'; + title2 'Average Age Greater Than or Equal to 30'; + select * form proclib.jobs(pw=red); +title + +proc sql; + connect to oracle as ora2 (user=user-id password=password); + select * from connection to ora2 (select lname, fname, state from staff); + disconnect from ora2; +quit; + +---------------------------------------------------- + +[ + ["step", "proc sql"], + ["punctuation", ";"], + ["proc-sql", [ + ["sql", [ + ["keyword", "select"], + ["operator", "*"], + + ["keyword", "from"], + " proclib", + ["punctuation", "."], + "paylist", + ["punctuation", ";"] + ]] + ]], + ["step", "proc print"], + ["punctuation", ";"], + + ["step", "proc sql"], + ["proc-args", [ + ["arg", "outobs"], + ["operator", "="], + ["number", "10"], + ["punctuation", ";"] + ]], + ["proc-sql", [ + ["global-statements", "title"], + ["string", "'Proclib.Payroll'"], + ["punctuation", ";"], + + ["sql", [ + ["keyword", "select"], + ["operator", "*"], + ["keyword", "from"], + " proclib", + ["punctuation", "."], + "payroll", + ["punctuation", ";"] + ]], + + ["global-statements", "title"], + ["punctuation", ";"] + ]], + ["step", "quit"], + ["punctuation", ";"], + + ["step", "proc sql"], + ["punctuation", ";"], + ["proc-sql", [ + ["sql", [ + ["keyword", "select"], + " BookingDate", + ["punctuation", ","], + + "\n\tReleaseDate", + ["punctuation", ","], + + "\n\tReleaseCode\n\t", + + ["keyword", "from"], + " SASclass", + ["punctuation", "."], + "Bookings", + ["punctuation", ";"] + ]] + ]], + ["step", "quit"], + ["punctuation", ";"], + + ["step", "proc sql"], + ["punctuation", ";"], + ["proc-sql", [ + ["sql", [ + ["keyword", "select"], + " BookingDate", + ["punctuation", ","], + + "\n\tReleaseDate", + ["punctuation", ","], + + "\n\tReleaseCode\n\t", + + ["keyword", "from"], + " SASclass", + ["punctuation", "."], + "Bookings", + ["punctuation", ";"] + ]] + ]], + ["step", "quit"], + ["punctuation", ";"], + + ["keyword", "libname"], + " proclib ", + ["string", "'SAS-library'"], + ["punctuation", ";"], + + ["step", "proc sql"], + ["punctuation", ";"], + ["proc-sql", [ + ["sql", [ + ["keyword", "create"], + ["keyword", "view"], + " proclib", + ["punctuation", "."], + "jobs", + ["punctuation", "("], + "pw", + ["operator", "-"], + "red", + ["punctuation", ")"], + ["keyword", "as"], + + ["keyword", "select"], + " Jobcode", + ["punctuation", ","], + + ["function", "count"], + ["punctuation", "("], + "jobcode", + ["punctuation", ")"], + ["keyword", "as"], + " number label", + ["operator", "="], + ["string", "'Number'"], + ["punctuation", ","], + + ["function", "avg"], + ["punctuation", "("], + ["keyword", "int"], + ["punctuation", "("], + "today", + ["punctuation", "("], + ["punctuation", ")"], + ["operator", "-"], + "birth", + ["operator", "/"], + ["number", "365.25"], + ["punctuation", ")"], + ["punctuation", ")"], + ["keyword", "as"], + " avgage\n\t\t\tformat", + ["operator", "="], + ["number", "2."], + " label", + ["operator", "="], + ["string", "'Average Salary'"], + + ["keyword", "from"], + " Payroll\n\t", + + ["keyword", "group"], + ["keyword", "by"], + " Jobcode\n\t", + + ["keyword", "having"], + " avage ge ", + ["number", "30"], + ["punctuation", ";"] + ]], + + ["global-statements", "title1"], + ["string", "'Current Summary Information for Each Job category'"], + ["punctuation", ";"], + + ["global-statements", "title2"], + ["string", "'Average Age Greater Than or Equal to 30'"], + ["punctuation", ";"], + + ["sql", [ + ["keyword", "select"], + ["operator", "*"], + " form proclib", + ["punctuation", "."], + "jobs", + ["punctuation", "("], + "pw", + ["operator", "="], + "red", + ["punctuation", ")"], + ["punctuation", ";"] + ]], + + ["global-statements", "title"] + ]], + ["step", "proc sql"], + ["punctuation", ";"], + ["proc-sql", [ + "\n\tconnect to oracle as ora2 ", + ["punctuation", "("], + "user=user-id password=password", + ["punctuation", ")"], + ["punctuation", ";"], + + ["sql", [ + ["keyword", "select"], + ["operator", "*"], + ["keyword", "from"], + " connection ", + ["keyword", "to"], + " ora2 ", + ["punctuation", "("], + ["keyword", "select"], + " lname", + ["punctuation", ","], + " fname", + ["punctuation", ","], + " state ", + ["keyword", "from"], + " staff", + ["punctuation", ")"], + ["punctuation", ";"] + ]], + + ["sql-statements", "disconnect from"], + " ora2", + ["punctuation", ";"] + ]], + ["step", "quit"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks that SQL captures SAS language elements and leverages +SQL language support for nested SQL. diff --git a/package/src/prism/tests/languages/sql/boolean_feature.test b/package/src/prism/tests/languages/sql/boolean_feature.test new file mode 100644 index 00000000..52091c4d --- /dev/null +++ b/package/src/prism/tests/languages/sql/boolean_feature.test @@ -0,0 +1,15 @@ +TRUE +FALSE +NULL + +---------------------------------------------------- + +[ + ["boolean", "TRUE"], + ["boolean", "FALSE"], + ["boolean", "NULL"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/sql/comment_feature.test b/package/src/prism/tests/languages/sql/comment_feature.test new file mode 100644 index 00000000..4f8416ca --- /dev/null +++ b/package/src/prism/tests/languages/sql/comment_feature.test @@ -0,0 +1,26 @@ +/**/ +/* foo +bar */ +-- +-- foo +// +// foo +# +# foo + +---------------------------------------------------- + +[ + ["comment", "/**/"], + ["comment", "/* foo\nbar */"], + ["comment", "--"], + ["comment", "-- foo"], + ["comment", "//"], + ["comment", "// foo"], + ["comment", "#"], + ["comment", "# foo"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/sql/function_feature.test b/package/src/prism/tests/languages/sql/function_feature.test new file mode 100644 index 00000000..03095ce0 --- /dev/null +++ b/package/src/prism/tests/languages/sql/function_feature.test @@ -0,0 +1,39 @@ +AVG ( +COUNT( +FIRST( +FORMAT( +LAST( +LCASE( +LEN( +MAX( +MID( +MIN( +MOD( +NOW( +ROUND( +SUM( +UCASE( + +---------------------------------------------------- + +[ + ["function", "AVG"], ["punctuation", "("], + ["function", "COUNT"], ["punctuation", "("], + ["function", "FIRST"], ["punctuation", "("], + ["function", "FORMAT"], ["punctuation", "("], + ["function", "LAST"], ["punctuation", "("], + ["function", "LCASE"], ["punctuation", "("], + ["function", "LEN"], ["punctuation", "("], + ["function", "MAX"], ["punctuation", "("], + ["function", "MID"], ["punctuation", "("], + ["function", "MIN"], ["punctuation", "("], + ["function", "MOD"], ["punctuation", "("], + ["function", "NOW"], ["punctuation", "("], + ["function", "ROUND"], ["punctuation", "("], + ["function", "SUM"], ["punctuation", "("], + ["function", "UCASE"], ["punctuation", "("] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/sql/identifier_feature.test b/package/src/prism/tests/languages/sql/identifier_feature.test new file mode 100644 index 00000000..de1a2d98 --- /dev/null +++ b/package/src/prism/tests/languages/sql/identifier_feature.test @@ -0,0 +1,41 @@ +`5Customers` +`tableName~` +` SELECT ` +foo.`GROUP` +`a``b` + +---------------------------------------------------- + +[ + ["identifier", [ + ["punctuation", "`"], + "5Customers", + ["punctuation", "`"] + ]], + + ["identifier", [ + ["punctuation", "`"], + "tableName~", + ["punctuation", "`"] + ]], + + ["identifier", [ + ["punctuation", "`"], + " SELECT ", + ["punctuation", "`"] + ]], + + "\nfoo", + ["punctuation", "."], + ["identifier", [ + ["punctuation", "`"], + "GROUP", + ["punctuation", "`"] + ]], + + ["identifier", [ + ["punctuation", "`"], + "a``b", + ["punctuation", "`"] + ]] +] diff --git a/package/src/prism/tests/languages/sql/issue3140.test b/package/src/prism/tests/languages/sql/issue3140.test new file mode 100644 index 00000000..0f969c7a --- /dev/null +++ b/package/src/prism/tests/languages/sql/issue3140.test @@ -0,0 +1,72 @@ +select + `t`.`col1`, `t`.`col2`, `t`.`col3`, `t`.`col4` +from + `test_table` as `t` + +---------------------------------------------------- + +[ + ["keyword", "select"], + + ["identifier", [ + ["punctuation", "`"], + "t", + ["punctuation", "`"] + ]], + ["punctuation", "."], + ["identifier", [ + ["punctuation", "`"], + "col1", + ["punctuation", "`"] + ]], + ["punctuation", ","], + ["identifier", [ + ["punctuation", "`"], + "t", + ["punctuation", "`"] + ]], + ["punctuation", "."], + ["identifier", [ + ["punctuation", "`"], + "col2", + ["punctuation", "`"] + ]], + ["punctuation", ","], + ["identifier", [ + ["punctuation", "`"], + "t", + ["punctuation", "`"] + ]], + ["punctuation", "."], + ["identifier", [ + ["punctuation", "`"], + "col3", + ["punctuation", "`"] + ]], + ["punctuation", ","], + ["identifier", [ + ["punctuation", "`"], + "t", + ["punctuation", "`"] + ]], + ["punctuation", "."], + ["identifier", [ + ["punctuation", "`"], + "col4", + ["punctuation", "`"] + ]], + + ["keyword", "from"], + + ["identifier", [ + ["punctuation", "`"], + "test_table", + ["punctuation", "`"] + ]], + ["keyword", "as"], + ["identifier", [ + ["punctuation", "`"], + "t", + ["punctuation", "`"] + ]] +] diff --git a/package/src/prism/tests/languages/sql/keyword_feature.test b/package/src/prism/tests/languages/sql/keyword_feature.test new file mode 100644 index 00000000..b0e37075 --- /dev/null +++ b/package/src/prism/tests/languages/sql/keyword_feature.test @@ -0,0 +1,719 @@ +ACTION +ADD +AFTER +ALGORITHM +ALL +ALTER +ANALYZE +ANY +APPLY +AS +ASC +AUTHORIZATION +AUTO_INCREMENT +BACKUP +BDB +BEGIN +BERKELEYDB +BIGINT +BINARY +BIT +BLOB +BOOL +BOOLEAN +BREAK +BROWSE +BTREE +BULK +BY +CALL +CASCADE +CASCADED +CASE +CHAIN +CHAR +CHARACTER +CHARSET +CHECK +CHECKPOINT +CLOSE +CLUSTERED +COALESCE +COLLATE +COLUMN +COLUMNS +COMMENT +COMMIT +COMMITTED +COMPUTE +CONNECT +CONSISTENT +CONSTRAINT +CONTAINS +CONTAINSTABLE +CONTINUE +CONVERT +CREATE +CROSS +CURRENT +CURRENT_DATE +CURRENT_TIME +CURRENT_TIMESTAMP +CURRENT_USER +CURSOR +CYCLE +DATA +DATABASE +DATABASES +DATE +DATETIME +DAY +DBCC +DEALLOCATE +DEC +DECIMAL +DECLARE +DEFAULT +DEFINER +DELAYED +DELETE +DELIMITER +DELIMITERS +DENY +DESC +DESCRIBE +DETERMINISTIC +DISABLE +DISCARD +DISK +DISTINCT +DISTINCTROW +DISTRIBUTED +DO +DOUBLE +DROP +DUMMY +DUMP +DUMPFILE +DUPLICATE +ELSE +ELSEIF +ENABLE +ENCLOSED +END +ENGINE +ENUM +ERRLVL +ERRORS +ESCAPE +ESCAPED +EXCEPT +EXEC +EXECUTE +EXISTS +EXIT +EXPLAIN +EXTENDED +FETCH +FIELDS +FILE +FILLFACTOR +FIRST +FIXED +FLOAT +FOLLOWING +FOR +FOR EACH ROW +FORCE +FOREIGN +FREETEXT +FREETEXTTABLE +FROM +FULL +FUNCTION +GEOMETRY +GEOMETRYCOLLECTION +GLOBAL +GOTO +GRANT +GROUP +HANDLER +HASH +HAVING +HOLDLOCK +HOUR +IDENTITY +IDENTITY_INSERT +IDENTITYCOL +IF +IGNORE +IMPORT +INDEX +INFILE +INNER +INNODB +INOUT +INSERT +INT +INTEGER +INTERSECT +INTERVAL +INTO +INVOKER +ISOLATION +ITERATE +JOIN +KEY +KEYS +KILL +LANGUAGE +LAST +LEAVE +LEFT +LEVEL +LIMIT +LINENO +LINES +LINESTRING +LOAD +LOCAL +LOCK +LONGBLOB +LONGTEXT +LOOP +MATCH +MATCHED +MEDIUMBLOB +MEDIUMINT +MEDIUMTEXT +MERGE +MIDDLEINT +MINUTE +MODE +MODIFIES +MODIFY +MONTH +MULTILINESTRING +MULTIPOINT +MULTIPOLYGON +NATIONAL +NATURAL +NCHAR +NEXT +NO +NONCLUSTERED +NULLIF +NUMERIC +OF +OFF +OFFSET +OFFSETS +ON +OPEN +OPENDATASOURCE +OPENQUERY +OPENROWSET +OPTIMIZE +OPTION +OPTIONALLY +ORDER +OUT +OUTER +OUTFILE +OVER +PARTIAL +PARTITION +PERCENT +PIVOT +PLAN +POINT +POLYGON +PRECEDING +PRECISION +PREPARE +PREV +PRIMARY +PRINT +PRIVILEGES +PROC +PROCEDURE +PUBLIC +PURGE +QUICK +RAISERROR +READ +READS +REAL +RECONFIGURE +REFERENCES +RELEASE +RENAME +REPEAT +REPEATABLE +REPLACE +REPLICATION +REQUIRE +RESIGNAL +RESTORE +RESTRICT +RETURN +RETURNS +RETURNING +REVOKE +RIGHT +ROLLBACK +ROUTINE +ROW +ROWCOUNT +ROWGUIDCOL +ROWS +RTREE +RULE +SAVE +SAVEPOINT +SCHEMA +SECOND +SELECT +SERIAL +SERIALIZABLE +SESSION +SESSION_USER +SET +SETUSER +SHARE +SHOW +SHUTDOWN +SIMPLE +SMALLINT +SNAPSHOT +SOME +SONAME +SQL +START +STARTING +STATISTICS +STATUS +STRIPED +SYSTEM_USER +TABLE +TABLES +TABLESPACE +TEMP +TEMPORARY +TEMPTABLE +TERMINATED +TEXT +TEXTSIZE +THEN +TIME +TIMESTAMP +TINYBLOB +TINYINT +TINYTEXT +TO +TOP +TRAN +TRANSACTION +TRANSACTIONS +TRIGGER +TRUNCATE +TSEQUAL +TYPE +TYPES +UNBOUNDED +UNCOMMITTED +UNDEFINED +UNION +UNIQUE +UNLOCK +UNPIVOT +UNSIGNED +UPDATE +UPDATETEXT +USAGE +USE +USER +USING +VALUE +VALUES +VARBINARY +VARCHAR +VARCHARACTER +VARYING +VIEW +WAITFOR +WARNINGS +WHEN +WHERE +WHILE +WITH +WITH ROLLUP +WITHIN +WORK +WRITE +WRITETEXT +YEAR + +---------------------------------------------------- + +[ + ["keyword", "ACTION"], + ["keyword", "ADD"], + ["keyword", "AFTER"], + ["keyword", "ALGORITHM"], + ["keyword", "ALL"], + ["keyword", "ALTER"], + ["keyword", "ANALYZE"], + ["keyword", "ANY"], + ["keyword", "APPLY"], + ["keyword", "AS"], + ["keyword", "ASC"], + ["keyword", "AUTHORIZATION"], + ["keyword", "AUTO_INCREMENT"], + ["keyword", "BACKUP"], + ["keyword", "BDB"], + ["keyword", "BEGIN"], + ["keyword", "BERKELEYDB"], + ["keyword", "BIGINT"], + ["keyword", "BINARY"], + ["keyword", "BIT"], + ["keyword", "BLOB"], + ["keyword", "BOOL"], + ["keyword", "BOOLEAN"], + ["keyword", "BREAK"], + ["keyword", "BROWSE"], + ["keyword", "BTREE"], + ["keyword", "BULK"], + ["keyword", "BY"], + ["keyword", "CALL"], + ["keyword", "CASCADE"], + ["keyword", "CASCADED"], + ["keyword", "CASE"], + ["keyword", "CHAIN"], + ["keyword", "CHAR"], + ["keyword", "CHARACTER"], + ["keyword", "CHARSET"], + ["keyword", "CHECK"], + ["keyword", "CHECKPOINT"], + ["keyword", "CLOSE"], + ["keyword", "CLUSTERED"], + ["keyword", "COALESCE"], + ["keyword", "COLLATE"], + ["keyword", "COLUMN"], + ["keyword", "COLUMNS"], + ["keyword", "COMMENT"], + ["keyword", "COMMIT"], + ["keyword", "COMMITTED"], + ["keyword", "COMPUTE"], + ["keyword", "CONNECT"], + ["keyword", "CONSISTENT"], + ["keyword", "CONSTRAINT"], + ["keyword", "CONTAINS"], + ["keyword", "CONTAINSTABLE"], + ["keyword", "CONTINUE"], + ["keyword", "CONVERT"], + ["keyword", "CREATE"], + ["keyword", "CROSS"], + ["keyword", "CURRENT"], + ["keyword", "CURRENT_DATE"], + ["keyword", "CURRENT_TIME"], + ["keyword", "CURRENT_TIMESTAMP"], + ["keyword", "CURRENT_USER"], + ["keyword", "CURSOR"], + ["keyword", "CYCLE"], + ["keyword", "DATA"], + ["keyword", "DATABASE"], + ["keyword", "DATABASES"], + ["keyword", "DATE"], + ["keyword", "DATETIME"], + ["keyword", "DAY"], + ["keyword", "DBCC"], + ["keyword", "DEALLOCATE"], + ["keyword", "DEC"], + ["keyword", "DECIMAL"], + ["keyword", "DECLARE"], + ["keyword", "DEFAULT"], + ["keyword", "DEFINER"], + ["keyword", "DELAYED"], + ["keyword", "DELETE"], + ["keyword", "DELIMITER"], + ["keyword", "DELIMITERS"], + ["keyword", "DENY"], + ["keyword", "DESC"], + ["keyword", "DESCRIBE"], + ["keyword", "DETERMINISTIC"], + ["keyword", "DISABLE"], + ["keyword", "DISCARD"], + ["keyword", "DISK"], + ["keyword", "DISTINCT"], + ["keyword", "DISTINCTROW"], + ["keyword", "DISTRIBUTED"], + ["keyword", "DO"], + ["keyword", "DOUBLE"], + ["keyword", "DROP"], + ["keyword", "DUMMY"], + ["keyword", "DUMP"], + ["keyword", "DUMPFILE"], + ["keyword", "DUPLICATE"], + ["keyword", "ELSE"], + ["keyword", "ELSEIF"], + ["keyword", "ENABLE"], + ["keyword", "ENCLOSED"], + ["keyword", "END"], + ["keyword", "ENGINE"], + ["keyword", "ENUM"], + ["keyword", "ERRLVL"], + ["keyword", "ERRORS"], + ["keyword", "ESCAPE"], + ["keyword", "ESCAPED"], + ["keyword", "EXCEPT"], + ["keyword", "EXEC"], + ["keyword", "EXECUTE"], + ["keyword", "EXISTS"], + ["keyword", "EXIT"], + ["keyword", "EXPLAIN"], + ["keyword", "EXTENDED"], + ["keyword", "FETCH"], + ["keyword", "FIELDS"], + ["keyword", "FILE"], + ["keyword", "FILLFACTOR"], + ["keyword", "FIRST"], + ["keyword", "FIXED"], + ["keyword", "FLOAT"], + ["keyword", "FOLLOWING"], + ["keyword", "FOR"], + ["keyword", "FOR EACH ROW"], + ["keyword", "FORCE"], + ["keyword", "FOREIGN"], + ["keyword", "FREETEXT"], + ["keyword", "FREETEXTTABLE"], + ["keyword", "FROM"], + ["keyword", "FULL"], + ["keyword", "FUNCTION"], + ["keyword", "GEOMETRY"], + ["keyword", "GEOMETRYCOLLECTION"], + ["keyword", "GLOBAL"], + ["keyword", "GOTO"], + ["keyword", "GRANT"], + ["keyword", "GROUP"], + ["keyword", "HANDLER"], + ["keyword", "HASH"], + ["keyword", "HAVING"], + ["keyword", "HOLDLOCK"], + ["keyword", "HOUR"], + ["keyword", "IDENTITY"], + ["keyword", "IDENTITY_INSERT"], + ["keyword", "IDENTITYCOL"], + ["keyword", "IF"], + ["keyword", "IGNORE"], + ["keyword", "IMPORT"], + ["keyword", "INDEX"], + ["keyword", "INFILE"], + ["keyword", "INNER"], + ["keyword", "INNODB"], + ["keyword", "INOUT"], + ["keyword", "INSERT"], + ["keyword", "INT"], + ["keyword", "INTEGER"], + ["keyword", "INTERSECT"], + ["keyword", "INTERVAL"], + ["keyword", "INTO"], + ["keyword", "INVOKER"], + ["keyword", "ISOLATION"], + ["keyword", "ITERATE"], + ["keyword", "JOIN"], + ["keyword", "KEY"], + ["keyword", "KEYS"], + ["keyword", "KILL"], + ["keyword", "LANGUAGE"], + ["keyword", "LAST"], + ["keyword", "LEAVE"], + ["keyword", "LEFT"], + ["keyword", "LEVEL"], + ["keyword", "LIMIT"], + ["keyword", "LINENO"], + ["keyword", "LINES"], + ["keyword", "LINESTRING"], + ["keyword", "LOAD"], + ["keyword", "LOCAL"], + ["keyword", "LOCK"], + ["keyword", "LONGBLOB"], + ["keyword", "LONGTEXT"], + ["keyword", "LOOP"], + ["keyword", "MATCH"], + ["keyword", "MATCHED"], + ["keyword", "MEDIUMBLOB"], + ["keyword", "MEDIUMINT"], + ["keyword", "MEDIUMTEXT"], + ["keyword", "MERGE"], + ["keyword", "MIDDLEINT"], + ["keyword", "MINUTE"], + ["keyword", "MODE"], + ["keyword", "MODIFIES"], + ["keyword", "MODIFY"], + ["keyword", "MONTH"], + ["keyword", "MULTILINESTRING"], + ["keyword", "MULTIPOINT"], + ["keyword", "MULTIPOLYGON"], + ["keyword", "NATIONAL"], + ["keyword", "NATURAL"], + ["keyword", "NCHAR"], + ["keyword", "NEXT"], + ["keyword", "NO"], + ["keyword", "NONCLUSTERED"], + ["keyword", "NULLIF"], + ["keyword", "NUMERIC"], + ["keyword", "OF"], + ["keyword", "OFF"], + ["keyword", "OFFSET"], + ["keyword", "OFFSETS"], + ["keyword", "ON"], + ["keyword", "OPEN"], + ["keyword", "OPENDATASOURCE"], + ["keyword", "OPENQUERY"], + ["keyword", "OPENROWSET"], + ["keyword", "OPTIMIZE"], + ["keyword", "OPTION"], + ["keyword", "OPTIONALLY"], + ["keyword", "ORDER"], + ["keyword", "OUT"], + ["keyword", "OUTER"], + ["keyword", "OUTFILE"], + ["keyword", "OVER"], + ["keyword", "PARTIAL"], + ["keyword", "PARTITION"], + ["keyword", "PERCENT"], + ["keyword", "PIVOT"], + ["keyword", "PLAN"], + ["keyword", "POINT"], + ["keyword", "POLYGON"], + ["keyword", "PRECEDING"], + ["keyword", "PRECISION"], + ["keyword", "PREPARE"], + ["keyword", "PREV"], + ["keyword", "PRIMARY"], + ["keyword", "PRINT"], + ["keyword", "PRIVILEGES"], + ["keyword", "PROC"], + ["keyword", "PROCEDURE"], + ["keyword", "PUBLIC"], + ["keyword", "PURGE"], + ["keyword", "QUICK"], + ["keyword", "RAISERROR"], + ["keyword", "READ"], + ["keyword", "READS"], + ["keyword", "REAL"], + ["keyword", "RECONFIGURE"], + ["keyword", "REFERENCES"], + ["keyword", "RELEASE"], + ["keyword", "RENAME"], + ["keyword", "REPEAT"], + ["keyword", "REPEATABLE"], + ["keyword", "REPLACE"], + ["keyword", "REPLICATION"], + ["keyword", "REQUIRE"], + ["keyword", "RESIGNAL"], + ["keyword", "RESTORE"], + ["keyword", "RESTRICT"], + ["keyword", "RETURN"], + ["keyword", "RETURNS"], + ["keyword", "RETURNING"], + ["keyword", "REVOKE"], + ["keyword", "RIGHT"], + ["keyword", "ROLLBACK"], + ["keyword", "ROUTINE"], + ["keyword", "ROW"], + ["keyword", "ROWCOUNT"], + ["keyword", "ROWGUIDCOL"], + ["keyword", "ROWS"], + ["keyword", "RTREE"], + ["keyword", "RULE"], + ["keyword", "SAVE"], + ["keyword", "SAVEPOINT"], + ["keyword", "SCHEMA"], + ["keyword", "SECOND"], + ["keyword", "SELECT"], + ["keyword", "SERIAL"], + ["keyword", "SERIALIZABLE"], + ["keyword", "SESSION"], + ["keyword", "SESSION_USER"], + ["keyword", "SET"], + ["keyword", "SETUSER"], + ["keyword", "SHARE"], + ["keyword", "SHOW"], + ["keyword", "SHUTDOWN"], + ["keyword", "SIMPLE"], + ["keyword", "SMALLINT"], + ["keyword", "SNAPSHOT"], + ["keyword", "SOME"], + ["keyword", "SONAME"], + ["keyword", "SQL"], + ["keyword", "START"], + ["keyword", "STARTING"], + ["keyword", "STATISTICS"], + ["keyword", "STATUS"], + ["keyword", "STRIPED"], + ["keyword", "SYSTEM_USER"], + ["keyword", "TABLE"], + ["keyword", "TABLES"], + ["keyword", "TABLESPACE"], + ["keyword", "TEMP"], + ["keyword", "TEMPORARY"], + ["keyword", "TEMPTABLE"], + ["keyword", "TERMINATED"], + ["keyword", "TEXT"], + ["keyword", "TEXTSIZE"], + ["keyword", "THEN"], + ["keyword", "TIME"], + ["keyword", "TIMESTAMP"], + ["keyword", "TINYBLOB"], + ["keyword", "TINYINT"], + ["keyword", "TINYTEXT"], + ["keyword", "TO"], + ["keyword", "TOP"], + ["keyword", "TRAN"], + ["keyword", "TRANSACTION"], + ["keyword", "TRANSACTIONS"], + ["keyword", "TRIGGER"], + ["keyword", "TRUNCATE"], + ["keyword", "TSEQUAL"], + ["keyword", "TYPE"], + ["keyword", "TYPES"], + ["keyword", "UNBOUNDED"], + ["keyword", "UNCOMMITTED"], + ["keyword", "UNDEFINED"], + ["keyword", "UNION"], + ["keyword", "UNIQUE"], + ["keyword", "UNLOCK"], + ["keyword", "UNPIVOT"], + ["keyword", "UNSIGNED"], + ["keyword", "UPDATE"], + ["keyword", "UPDATETEXT"], + ["keyword", "USAGE"], + ["keyword", "USE"], + ["keyword", "USER"], + ["keyword", "USING"], + ["keyword", "VALUE"], + ["keyword", "VALUES"], + ["keyword", "VARBINARY"], + ["keyword", "VARCHAR"], + ["keyword", "VARCHARACTER"], + ["keyword", "VARYING"], + ["keyword", "VIEW"], + ["keyword", "WAITFOR"], + ["keyword", "WARNINGS"], + ["keyword", "WHEN"], + ["keyword", "WHERE"], + ["keyword", "WHILE"], + ["keyword", "WITH"], + ["keyword", "WITH ROLLUP"], + ["keyword", "WITHIN"], + ["keyword", "WORK"], + ["keyword", "WRITE"], + ["keyword", "WRITETEXT"], + ["keyword", "YEAR"] +] + +---------------------------------------------------- + +Checks for all keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/sql/number_feature.test b/package/src/prism/tests/languages/sql/number_feature.test new file mode 100644 index 00000000..0728cf92 --- /dev/null +++ b/package/src/prism/tests/languages/sql/number_feature.test @@ -0,0 +1,15 @@ +42 +0.154 +0xBadFace + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "0.154"], + ["number", "0xBadFace"] +] + +---------------------------------------------------- + +Checks for decimal and hexadecimal numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/sql/operator_feature.test b/package/src/prism/tests/languages/sql/operator_feature.test new file mode 100644 index 00000000..2ad17686 --- /dev/null +++ b/package/src/prism/tests/languages/sql/operator_feature.test @@ -0,0 +1,51 @@ ++ - * / += % ^ ~ +| || +& && +! != +< <= << <> <=> +> >= >> + +AND +BETWEEN +IN +ILIKE +LIKE +NOT +OR +IS +DIV +REGEXP +RLIKE +SOUNDS LIKE +XOR + +---------------------------------------------------- + +[ + ["operator", "+"], ["operator", "-"], ["operator", "*"], ["operator", "/"], + ["operator", "="], ["operator", "%"], ["operator", "^"], ["operator", "~"], + ["operator", "|"], ["operator", "||"], + ["operator", "&"], ["operator", "&&"], + ["operator", "!"], ["operator", "!="], + ["operator", "<"], ["operator", "<="], ["operator", "<<"], ["operator", "<>"], ["operator", "<=>"], + ["operator", ">"], ["operator", ">="], ["operator", ">>"], + + ["operator", "AND"], + ["operator", "BETWEEN"], + ["operator", "IN"], + ["operator", "ILIKE"], + ["operator", "LIKE"], + ["operator", "NOT"], + ["operator", "OR"], + ["operator", "IS"], + ["operator", "DIV"], + ["operator", "REGEXP"], + ["operator", "RLIKE"], + ["operator", "SOUNDS LIKE"], + ["operator", "XOR"] +] + +---------------------------------------------------- + +Checks for all operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/sql/string_feature.test b/package/src/prism/tests/languages/sql/string_feature.test new file mode 100644 index 00000000..023d4695 --- /dev/null +++ b/package/src/prism/tests/languages/sql/string_feature.test @@ -0,0 +1,27 @@ +"" +"fo\"obar" +"foo +bar" +'' +'fo\'obar' +'foo +bar' +'foo''s bar' +"foo's ""bar""" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""], + ["string", "\"foo\nbar\""], + ["string", "''"], + ["string", "'fo\\'obar'"], + ["string", "'foo\nbar'"], + ["string", "'foo''s bar'"], + ["string", "\"foo's \"\"bar\"\"\""] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/sql/variable_feature.test b/package/src/prism/tests/languages/sql/variable_feature.test new file mode 100644 index 00000000..6f07b3ef --- /dev/null +++ b/package/src/prism/tests/languages/sql/variable_feature.test @@ -0,0 +1,26 @@ +@foo +@foo_bar_42 +@"fo\"o-b +ar" +@'fo\'o-b +ar' +@`fo\`o-b +ar` +@'foo' +@'bar' + +---------------------------------------------------- + +[ + ["variable", "@foo"], + ["variable", "@foo_bar_42"], + ["variable", "@\"fo\\\"o-b\nar\""], + ["variable", "@'fo\\'o-b\nar'"], + ["variable", "@`fo\\`o-b\nar`"], + ["variable", "@'foo'"], + ["variable", "@'bar'"] +] + +---------------------------------------------------- + +Checks for variables. diff --git a/package/src/prism/tests/languages/squirrel/attribute_feature.test b/package/src/prism/tests/languages/squirrel/attribute_feature.test new file mode 100644 index 00000000..42b16686 --- /dev/null +++ b/package/src/prism/tests/languages/squirrel/attribute_feature.test @@ -0,0 +1,93 @@ +class Foo { + //attributes of PrintTesty + function PrintTesty() + { + foreach(i,val in testy) + { + ::print("idx = "+i+" = "+val+" \n"); + } + } + //attributes of testy + testy = null; +} + +---------------------------------------------------- + +[ + ["keyword", "class"], + ["class-name", ["Foo"]], + ["attribute-punctuation", ""], + ["punctuation", "{"], + + ["attribute-punctuation", ""], + ["comment", "//attributes of PrintTesty"], + + ["keyword", "function"], + ["function", "PrintTesty"], + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "{"], + + ["keyword", "foreach"], + ["punctuation", "("], + "i", + ["punctuation", ","], + "val ", + ["keyword", "in"], + " testy", + ["punctuation", ")"], + + ["punctuation", "{"], + + ["operator", "::"], + ["function", "print"], + ["punctuation", "("], + ["string", "\"idx = \""], + ["operator", "+"], + "i", + ["operator", "+"], + ["string", "\" = \""], + ["operator", "+"], + "val", + ["operator", "+"], + ["string", "\" \\n\""], + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["punctuation", "}"], + + ["attribute-punctuation", ""], + ["comment", "//attributes of testy"], + + "\n testy ", + ["operator", "="], + ["keyword", "null"], + ["punctuation", ";"], + + ["punctuation", "}"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/squirrel/boolean_feature.test b/package/src/prism/tests/languages/squirrel/boolean_feature.test new file mode 100644 index 00000000..7b251d07 --- /dev/null +++ b/package/src/prism/tests/languages/squirrel/boolean_feature.test @@ -0,0 +1,9 @@ +false +true + +---------------------------------------------------- + +[ + ["boolean", "false"], + ["boolean", "true"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/squirrel/char_feature.test b/package/src/prism/tests/languages/squirrel/char_feature.test new file mode 100644 index 00000000..2c05d279 --- /dev/null +++ b/package/src/prism/tests/languages/squirrel/char_feature.test @@ -0,0 +1,11 @@ +'w' +'\'' +'\x41' '\u0041' '\U00000041' + +---------------------------------------------------- + +[ + ["char", "'w'"], + ["char", "'\\''"], + ["char", "'\\x41'"], ["char", "'\\u0041'"], ["char", "'\\U00000041'"] +] diff --git a/package/src/prism/tests/languages/squirrel/class-name_feature.test b/package/src/prism/tests/languages/squirrel/class-name_feature.test new file mode 100644 index 00000000..8e449e52 --- /dev/null +++ b/package/src/prism/tests/languages/squirrel/class-name_feature.test @@ -0,0 +1,45 @@ +class Foo {} +class FakeNamespace.Utils.SuperClass {} +class SuperFoo extends Foo {} +log(b instanceof Kid); +enum Stuff {} + +---------------------------------------------------- + +[ + ["keyword", "class"], + ["class-name", ["Foo"]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "class"], + ["class-name", [ + "FakeNamespace", + ["punctuation", "."], + "Utils", + ["punctuation", "."], + "SuperClass" + ]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "class"], + ["class-name", ["SuperFoo"]], + ["keyword", "extends"], + ["class-name", ["Foo"]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["function", "log"], + ["punctuation", "("], + "b ", + ["keyword", "instanceof"], + ["class-name", ["Kid"]], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "enum"], + ["class-name", ["Stuff"]], + ["punctuation", "{"], + ["punctuation", "}"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/squirrel/comment_feature.test b/package/src/prism/tests/languages/squirrel/comment_feature.test new file mode 100644 index 00000000..1d7ff9b7 --- /dev/null +++ b/package/src/prism/tests/languages/squirrel/comment_feature.test @@ -0,0 +1,15 @@ +/* +this is +a multiline comment. +this lines will be ignored by the compiler +*/ +//this is a single line comment. this line will be ignored by the compiler +# this is also a single line comment. + +---------------------------------------------------- + +[ + ["comment", "/*\nthis is\na multiline comment.\nthis lines will be ignored by the compiler\n*/"], + ["comment", "//this is a single line comment. this line will be ignored by the compiler"], + ["comment", "# this is also a single line comment."] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/squirrel/function_feature.test b/package/src/prism/tests/languages/squirrel/function_feature.test new file mode 100644 index 00000000..93d2e800 --- /dev/null +++ b/package/src/prism/tests/languages/squirrel/function_feature.test @@ -0,0 +1,44 @@ +function abc(a,b,c) {} +function(a,b,c) {} +local myexp = @(a,b) a + b; + +---------------------------------------------------- + +[ + ["keyword", "function"], + ["function", "abc"], + ["punctuation", "("], + "a", + ["punctuation", ","], + "b", + ["punctuation", ","], + "c", + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "function"], + ["punctuation", "("], + "a", + ["punctuation", ","], + "b", + ["punctuation", ","], + "c", + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "local"], + " myexp ", + ["operator", "="], + ["lambda", "@"], + ["punctuation", "("], + "a", + ["punctuation", ","], + "b", + ["punctuation", ")"], + " a ", + ["operator", "+"], + " b", + ["punctuation", ";"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/squirrel/keyword_feature.test b/package/src/prism/tests/languages/squirrel/keyword_feature.test new file mode 100644 index 00000000..99194839 --- /dev/null +++ b/package/src/prism/tests/languages/squirrel/keyword_feature.test @@ -0,0 +1,75 @@ +base; +break; +case; +catch; +class; +clone; +const; +constructor; +continue; +default; +delete; +else; +enum; +extends; +for; +foreach; +function; +if; +in; +instanceof; +local; +null; +resume; +return; +static; +switch; +this; +throw; +try; +typeof; +while; +yield; + +__LINE__ +__FILE__ + +---------------------------------------------------- + +[ + ["keyword", "base"], ["punctuation", ";"], + ["keyword", "break"], ["punctuation", ";"], + ["keyword", "case"], ["punctuation", ";"], + ["keyword", "catch"], ["punctuation", ";"], + ["keyword", "class"], ["punctuation", ";"], + ["keyword", "clone"], ["punctuation", ";"], + ["keyword", "const"], ["punctuation", ";"], + ["keyword", "constructor"], ["punctuation", ";"], + ["keyword", "continue"], ["punctuation", ";"], + ["keyword", "default"], ["punctuation", ";"], + ["keyword", "delete"], ["punctuation", ";"], + ["keyword", "else"], ["punctuation", ";"], + ["keyword", "enum"], ["punctuation", ";"], + ["keyword", "extends"], ["punctuation", ";"], + ["keyword", "for"], ["punctuation", ";"], + ["keyword", "foreach"], ["punctuation", ";"], + ["keyword", "function"], ["punctuation", ";"], + ["keyword", "if"], ["punctuation", ";"], + ["keyword", "in"], ["punctuation", ";"], + ["keyword", "instanceof"], ["punctuation", ";"], + ["keyword", "local"], ["punctuation", ";"], + ["keyword", "null"], ["punctuation", ";"], + ["keyword", "resume"], ["punctuation", ";"], + ["keyword", "return"], ["punctuation", ";"], + ["keyword", "static"], ["punctuation", ";"], + ["keyword", "switch"], ["punctuation", ";"], + ["keyword", "this"], ["punctuation", ";"], + ["keyword", "throw"], ["punctuation", ";"], + ["keyword", "try"], ["punctuation", ";"], + ["keyword", "typeof"], ["punctuation", ";"], + ["keyword", "while"], ["punctuation", ";"], + ["keyword", "yield"], ["punctuation", ";"], + + ["keyword", "__LINE__"], + ["keyword", "__FILE__"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/squirrel/number_feature.test b/package/src/prism/tests/languages/squirrel/number_feature.test new file mode 100644 index 00000000..95f933d5 --- /dev/null +++ b/package/src/prism/tests/languages/squirrel/number_feature.test @@ -0,0 +1,21 @@ +0 +34 +0xFF00A120 +0753 +1.52 +0.234 +1.e2 +1.e-2 + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "34"], + ["number", "0xFF00A120"], + ["number", "0753"], + ["number", "1.52"], + ["number", "0.234"], + ["number", "1.e2"], + ["number", "1.e-2"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/squirrel/operator_feature.test b/package/src/prism/tests/languages/squirrel/operator_feature.test new file mode 100644 index 00000000..92d78cb5 --- /dev/null +++ b/package/src/prism/tests/languages/squirrel/operator_feature.test @@ -0,0 +1,46 @@ +! != || == && >= <= > <=> + ++ - / * % ++= -= /= *= %= +++ -- + +<- = +& ^ | ~ +>> << >>> + +: :: + +---------------------------------------------------- + +[ + ["operator", "!"], + ["operator", "!="], + ["operator", "||"], + ["operator", "=="], + ["operator", "&&"], + ["operator", ">="], + ["operator", "<="], + ["operator", ">"], + ["operator", "<=>"], + + ["operator", "+"], + ["operator", "-"], + ["operator", "/"], + ["operator", "*"], + ["operator", "%"], + + ["operator", "+="], + ["operator", "-="], + ["operator", "/="], + ["operator", "*="], + ["operator", "%="], + + ["operator", "++"], + ["operator", "--"], + + ["operator", "<-"], ["operator", "="], + ["operator", "&"], ["operator", "^"], ["operator", "|"], ["operator", "~"], + ["operator", ">>"], ["operator", "<<"], ["operator", ">>>"], + + ["operator", ":"], ["operator", "::"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/squirrel/punctuation_feature.test b/package/src/prism/tests/languages/squirrel/punctuation_feature.test new file mode 100644 index 00000000..29fe52a1 --- /dev/null +++ b/package/src/prism/tests/languages/squirrel/punctuation_feature.test @@ -0,0 +1,17 @@ +{ } [ ] ( ) +, ; . + +---------------------------------------------------- + +[ + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", "."] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/squirrel/string_feature.test b/package/src/prism/tests/languages/squirrel/string_feature.test new file mode 100644 index 00000000..c485b5b1 --- /dev/null +++ b/package/src/prism/tests/languages/squirrel/string_feature.test @@ -0,0 +1,29 @@ +"" +"I'm a string" +"I'm a wonderful string\n" + +@"" +@"I'm a verbatim string" +@" I'm a +multiline verbatim string +" + +@" + this is a multiline string + it will ""embed"" all the new line + characters +" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"I'm a string\""], + ["string", "\"I'm a wonderful string\\n\""], + + ["string", "@\"\""], + ["string", "@\"I'm a verbatim string\""], + ["string", "@\" I'm a\nmultiline verbatim string\n\""], + + ["string", "@\"\n this is a multiline string\n it will \"\"embed\"\" all the new line\n characters\n\""] +] diff --git a/package/src/prism/tests/languages/stan/comment_feature.test b/package/src/prism/tests/languages/stan/comment_feature.test new file mode 100644 index 00000000..eaad573d --- /dev/null +++ b/package/src/prism/tests/languages/stan/comment_feature.test @@ -0,0 +1,17 @@ +# comment +// comment +/* +comment +*/ + +---------------------------------------------------- + +[ + ["comment", "# comment"], + ["comment", "// comment"], + ["comment", "/*\ncomment\n*/"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/stan/constraint_feature.test b/package/src/prism/tests/languages/stan/constraint_feature.test new file mode 100644 index 00000000..7d75b436 --- /dev/null +++ b/package/src/prism/tests/languages/stan/constraint_feature.test @@ -0,0 +1,176 @@ +real b; + +real theta; + +int T; + +matrix[3, 4] B; + +row_vector[10] u; + +row_vector[3] u; + +real phi; + +real x; + +---------------------------------------------------- + +[ + ["keyword", "real"], + ["constraint", [ + ["punctuation", "<"], + ["property", "lower"], + ["operator", "="], + ["expression", [ + "a" + ]], + ["punctuation", ">"] + ]], + " b", + ["punctuation", ";"], + + ["keyword", "real"], + ["constraint", [ + ["punctuation", "<"], + ["property", "lower"], + ["operator", "="], + ["expression", [ + "a" + ]], + ["punctuation", ","], + ["property", "upper"], + ["operator", "="], + ["expression", [ + "b" + ]], + ["punctuation", ">"] + ]], + " theta", + ["punctuation", ";"], + + ["keyword", "int"], + ["constraint", [ + ["punctuation", "<"], + ["property", "lower"], + ["operator", "="], + ["expression", [ + ["number", "1"] + ]], + ["punctuation", ">"] + ]], + " T", + ["punctuation", ";"], + + ["keyword", "matrix"], + ["constraint", [ + ["punctuation", "<"], + ["property", "multiplier"], + ["operator", "="], + ["expression", [ + ["number", "5"] + ]], + ["punctuation", ">"] + ]], + ["punctuation", "["], + ["number", "3"], + ["punctuation", ","], + ["number", "4"], + ["punctuation", "]"], + " B", + ["punctuation", ";"], + + ["keyword", "row_vector"], + ["constraint", [ + ["punctuation", "<"], + ["property", "lower"], + ["operator", "="], + ["expression", [ + ["operator", "-"], + ["number", "1"] + ]], + ["punctuation", ","], + ["property", "upper"], + ["operator", "="], + ["expression", [ + ["number", "1"] + ]], + ["punctuation", ">"] + ]], + ["punctuation", "["], + ["number", "10"], + ["punctuation", "]"], + " u", + ["punctuation", ";"], + + ["keyword", "row_vector"], + ["constraint", [ + ["punctuation", "<"], + ["property", "offset"], + ["operator", "="], + ["expression", [ + ["operator", "-"], + ["number", "42"] + ]], + ["punctuation", ","], + ["property", "multiplier"], + ["operator", "="], + ["expression", [ + ["number", "3"] + ]], + ["punctuation", ">"] + ]], + ["punctuation", "["], + ["number", "3"], + ["punctuation", "]"], + " u", + ["punctuation", ";"], + + ["keyword", "real"], + ["constraint", [ + ["punctuation", "<"], + ["property", "lower"], + ["operator", "="], + ["expression", [ + ["function", "min"], + ["punctuation", "("], + "y", + ["punctuation", ")"] + ]], + ["punctuation", ","], + ["property", "upper"], + ["operator", "="], + ["expression", [ + ["function", "max"], + ["punctuation", "("], + "y", + ["punctuation", ")"] + ]], + ["punctuation", ">"] + ]], + " phi", + ["punctuation", ";"], + + ["keyword", "real"], + ["constraint", [ + ["punctuation", "<"], + ["property", "offset"], + ["operator", "="], + ["expression", [ + "mu" + ]], + ["punctuation", ","], + ["property", "multiplier"], + ["operator", "="], + ["expression", [ + "sigma" + ]], + ["punctuation", ">"] + ]], + " x", + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for type constraints. diff --git a/package/src/prism/tests/languages/stan/directive_feature.test b/package/src/prism/tests/languages/stan/directive_feature.test new file mode 100644 index 00000000..0ee53910 --- /dev/null +++ b/package/src/prism/tests/languages/stan/directive_feature.test @@ -0,0 +1,14 @@ +#include my-std-normal.stan // definition of standard normal + #include my-std-normal.stan + +---------------------------------------------------- + +[ + ["directive", "#include my-std-normal.stan "], + ["comment", "// definition of standard normal"], + ["directive", "#include my-std-normal.stan"] +] + +---------------------------------------------------- + +Checks for include directives. diff --git a/package/src/prism/tests/languages/stan/function-arg_feature.test b/package/src/prism/tests/languages/stan/function-arg_feature.test new file mode 100644 index 00000000..5ddf974c --- /dev/null +++ b/package/src/prism/tests/languages/stan/function-arg_feature.test @@ -0,0 +1,21 @@ +y = algebra_solver(system, y_guess, theta, x_r, x_i); + +---------------------------------------------------- + +[ + "y ", + ["operator", "="], + ["keyword", "algebra_solver"], + ["punctuation", "("], + ["function-arg", "system"], + ["punctuation", ","], + " y_guess", + ["punctuation", ","], + " theta", + ["punctuation", ","], + " x_r", + ["punctuation", ","], + " x_i", + ["punctuation", ")"], + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/stan/keyword_feature.test b/package/src/prism/tests/languages/stan/keyword_feature.test new file mode 100644 index 00000000..13994187 --- /dev/null +++ b/package/src/prism/tests/languages/stan/keyword_feature.test @@ -0,0 +1,117 @@ +array +break +cholesky_factor_corr +cholesky_factor_cov +complex +continue +corr_matrix +cov_matrix +data +else +for +functions +generated +if +in +increment_log_prob +int +matrix +model +ordered +parameters +positive_ordered +print +quantities +real +reject +return +row_vector +simplex +target +transformed +unit_vector +vector +void +while + +algebra_solver +algebra_solver_newton +integrate_1d +integrate_ode +integrate_ode_bdf +integrate_ode_rk45 +map_rect +ode_adams +ode_adams_tol +ode_adjoint_tol_ctl +ode_bdf +ode_bdf_tol +ode_ckrk +ode_ckrk_tol +ode_rk45 +ode_rk45_tol +reduce_sum +reduce_sum_static + +---------------------------------------------------- + +[ + ["keyword", "array"], + ["keyword", "break"], + ["keyword", "cholesky_factor_corr"], + ["keyword", "cholesky_factor_cov"], + ["keyword", "complex"], + ["keyword", "continue"], + ["keyword", "corr_matrix"], + ["keyword", "cov_matrix"], + ["keyword", "data"], + ["keyword", "else"], + ["keyword", "for"], + ["keyword", "functions"], + ["keyword", "generated"], + ["keyword", "if"], + ["keyword", "in"], + ["keyword", "increment_log_prob"], + ["keyword", "int"], + ["keyword", "matrix"], + ["keyword", "model"], + ["keyword", "ordered"], + ["keyword", "parameters"], + ["keyword", "positive_ordered"], + ["keyword", "print"], + ["keyword", "quantities"], + ["keyword", "real"], + ["keyword", "reject"], + ["keyword", "return"], + ["keyword", "row_vector"], + ["keyword", "simplex"], + ["keyword", "target"], + ["keyword", "transformed"], + ["keyword", "unit_vector"], + ["keyword", "vector"], + ["keyword", "void"], + ["keyword", "while"], + + ["keyword", "algebra_solver"], + ["keyword", "algebra_solver_newton"], + ["keyword", "integrate_1d"], + ["keyword", "integrate_ode"], + ["keyword", "integrate_ode_bdf"], + ["keyword", "integrate_ode_rk45"], + ["keyword", "map_rect"], + ["keyword", "ode_adams"], + ["keyword", "ode_adams_tol"], + ["keyword", "ode_adjoint_tol_ctl"], + ["keyword", "ode_bdf"], + ["keyword", "ode_bdf_tol"], + ["keyword", "ode_ckrk"], + ["keyword", "ode_ckrk_tol"], + ["keyword", "ode_rk45"], + ["keyword", "ode_rk45_tol"], + ["keyword", "reduce_sum"], + ["keyword", "reduce_sum_static"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/stan/number_feature.test b/package/src/prism/tests/languages/stan/number_feature.test new file mode 100644 index 00000000..4741a872 --- /dev/null +++ b/package/src/prism/tests/languages/stan/number_feature.test @@ -0,0 +1,41 @@ +0 +1 +24567898765 +24_56_78_98_765 + +0.0 +1.0 +3.14 +2.7e3 +2E-5 +1.23e+3 +3.14i +40e-3i +1e10i +0i +1_2.3_4e5_6i + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "1"], + ["number", "24567898765"], + ["number", "24_56_78_98_765"], + + ["number", "0.0"], + ["number", "1.0"], + ["number", "3.14"], + ["number", "2.7e3"], + ["number", "2E-5"], + ["number", "1.23e+3"], + ["number", "3.14i"], + ["number", "40e-3i"], + ["number", "1e10i"], + ["number", "0i"], + ["number", "1_2.3_4e5_6i"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/stan/operator_feature.test b/package/src/prism/tests/languages/stan/operator_feature.test new file mode 100644 index 00000000..15e30e0a --- /dev/null +++ b/package/src/prism/tests/languages/stan/operator_feature.test @@ -0,0 +1,52 @@ ++ - * / ++= -= *= /= + +== != < <= > >= +! || && + +<- = +.* .*= ./ ./= + +| ' ^ % ~ ? : + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + + ["operator", "=="], + ["operator", "!="], + ["operator", "<"], + ["operator", "<="], + ["operator", ">"], + ["operator", ">="], + ["operator", "!"], + ["operator", "||"], + ["operator", "&&"], + + ["operator", "<-"], + ["operator", "="], + ["operator", ".*"], + ["operator", ".*="], + ["operator", "./"], + ["operator", "./="], + + ["operator", "|"], + ["operator", "'"], + ["operator", "^"], + ["operator", "%"], + ["operator", "~"], + ["operator", "?"], + ["operator", ":"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/stan/program-block_feature.html.test b/package/src/prism/tests/languages/stan/program-block_feature.html.test new file mode 100644 index 00000000..0c64fdce --- /dev/null +++ b/package/src/prism/tests/languages/stan/program-block_feature.html.test @@ -0,0 +1,76 @@ +functions { + // ... function declarations and definitions ... +} +data { + // ... declarations ... +} +transformed data { + // ... declarations ... statements ... +} +parameters { + // ... declarations ... +} +transformed parameters { + // ... declarations ... statements ... +} +model { + // ... declarations ... statements ... +} +generated quantities { + // ... declarations ... statements ... +} + +// data-only quantifiers +real foo(data real x) { + return x^2; +} + +---------------------------------------------------- + +functions +{ +// ... function declarations and definitions ... +} +data +{ +// ... declarations ... +} +transformed +data +{ +// ... declarations ... statements ... +} +parameters +{ +// ... declarations ... +} +transformed +parameters +{ +// ... declarations ... statements ... +} +model +{ +// ... declarations ... statements ... +} +generated +quantities +{ +// ... declarations ... statements ... +} + +// data-only quantifiers +real +foo +( +data +real +x +) +{ +return +x +^ +2 +; +} diff --git a/package/src/prism/tests/languages/stan/punctuation_feature.test b/package/src/prism/tests/languages/stan/punctuation_feature.test new file mode 100644 index 00000000..a5c3d4db --- /dev/null +++ b/package/src/prism/tests/languages/stan/punctuation_feature.test @@ -0,0 +1,19 @@ +( ) [ ] { } +, ; + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ","], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for punctuation. diff --git a/package/src/prism/tests/languages/stan/string_feature.test b/package/src/prism/tests/languages/stan/string_feature.test new file mode 100644 index 00000000..f483002b --- /dev/null +++ b/package/src/prism/tests/languages/stan/string_feature.test @@ -0,0 +1,40 @@ +"" +"foo bar" + +print("log density before =", target()); +print("u[", n, "] = ", u[n]); + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foo bar\""], + + ["keyword", "print"], + ["punctuation", "("], + ["string", "\"log density before =\""], + ["punctuation", ","], + ["keyword", "target"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ")"], + ["punctuation", ";"], + ["keyword", "print"], + ["punctuation", "("], + ["string", "\"u[\""], + ["punctuation", ","], + " n", + ["punctuation", ","], + ["string", "\"] = \""], + ["punctuation", ","], + " u", + ["punctuation", "["], + "n", + ["punctuation", "]"], + ["punctuation", ")"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/stata/boolean_feature.test b/package/src/prism/tests/languages/stata/boolean_feature.test new file mode 100644 index 00000000..885cac77 --- /dev/null +++ b/package/src/prism/tests/languages/stata/boolean_feature.test @@ -0,0 +1,9 @@ +set foo on +set foo off + +---------------------------------------------------- + +[ + ["command", "set"], " foo ", ["boolean", "on"], + ["command", "set"], " foo ", ["boolean", "off"] +] diff --git a/package/src/prism/tests/languages/stata/command_feature.test b/package/src/prism/tests/languages/stata/command_feature.test new file mode 100644 index 00000000..2cae028d --- /dev/null +++ b/package/src/prism/tests/languages/stata/command_feature.test @@ -0,0 +1,9 @@ +quietly regress foo +quietly: regress foo + +---------------------------------------------------- + +[ + ["keyword", "quietly"], ["command", "regress"], " foo\n", + ["keyword", "quietly"], ["punctuation", ":"], ["command", "regress"], " foo" +] diff --git a/package/src/prism/tests/languages/stata/comment_feature.test b/package/src/prism/tests/languages/stata/comment_feature.test new file mode 100644 index 00000000..f2f8ac2f --- /dev/null +++ b/package/src/prism/tests/languages/stata/comment_feature.test @@ -0,0 +1,49 @@ +* comment +// comment +/* +comment +*/ + +* a sample analysis job +version 17.0 +use census +/* obtain the summary statistics */ +tabulate region // there are 4 regions in this dataset +summarize marriage +* a sample analysis job +version 17.0 +use /* obtain the summary statistics */ census +tabulate region +// there are 4 regions in this dataset +summarize marriage + +---------------------------------------------------- + +[ + ["comment", "* comment"], + ["comment", "// comment"], + ["comment", "/*\ncomment\n*/"], + + ["comment", "* a sample analysis job"], + ["command", "version"], + ["number", "17.0"], + ["command", "use"], + " census\n", + ["comment", "/* obtain the summary statistics */"], + ["command", "tabulate"], + " region ", + ["comment", "// there are 4 regions in this dataset"], + ["command", "summarize"], + " marriage\n", + ["comment", "* a sample analysis job"], + ["command", "version"], + ["number", "17.0"], + ["command", "use"], + ["comment", "/* obtain the summary statistics */"], + " census\n", + ["command", "tabulate"], + " region\n", + ["comment", "// there are 4 regions in this dataset"], + ["command", "summarize"], + " marriage" +] diff --git a/package/src/prism/tests/languages/stata/java_inclusion.test b/package/src/prism/tests/languages/stata/java_inclusion.test new file mode 100644 index 00000000..1459a6d9 --- /dev/null +++ b/package/src/prism/tests/languages/stata/java_inclusion.test @@ -0,0 +1,61 @@ +program java_program + version 17 + java: printX(); +end +java: + int x = 123; + void printX() { + System.out.println("x: " + x); + } +end + +---------------------------------------------------- + +[ + ["command", "program"], + " java_program\n\t", + + ["command", "version"], + ["number", "17"], + + ["command", "java"], + ["punctuation", ":"], + ["java", [ + ["function", "printX"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"] + ]], + ["command", "end"], + + ["command", "java"], + ["punctuation", ":"], + ["java", [ + ["keyword", "int"], + " x ", + ["operator", "="], + ["number", "123"], + ["punctuation", ";"], + + ["keyword", "void"], + ["function", "printX"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + + ["class-name", ["System"]], + ["punctuation", "."], + "out", + ["punctuation", "."], + ["function", "println"], + ["punctuation", "("], + ["string", "\"x: \""], + ["operator", "+"], + " x", + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "}"] + ]], + ["command", "end"] +] diff --git a/package/src/prism/tests/languages/stata/keyword_feature.test b/package/src/prism/tests/languages/stata/keyword_feature.test new file mode 100644 index 00000000..aefcfa46 --- /dev/null +++ b/package/src/prism/tests/languages/stata/keyword_feature.test @@ -0,0 +1,63 @@ +foo bayes +foo bootstrap +foo by +foo bysort +foo capture +foo clear +foo collect +foo fmm +foo fp +foo frame +foo if +foo in +foo jackknife +foo mfp +foo mi estimate +foo nestreg +foo noisily +foo of +foo permute +foo quietly +foo rolling +foo simulate +foo sort +foo statsby +foo stepwise +foo svy +foo varlist +foo version +foo xi + +---------------------------------------------------- + +[ + ["command", "foo"], ["keyword", "bayes"], + ["command", "foo"], ["keyword", "bootstrap"], + ["command", "foo"], ["keyword", "by"], + ["command", "foo"], ["keyword", "bysort"], + ["command", "foo"], ["keyword", "capture"], + ["command", "foo"], ["keyword", "clear"], + ["command", "foo"], ["keyword", "collect"], + ["command", "foo"], ["keyword", "fmm"], + ["command", "foo"], ["keyword", "fp"], + ["command", "foo"], ["keyword", "frame"], + ["command", "foo"], ["keyword", "if"], + ["command", "foo"], ["keyword", "in"], + ["command", "foo"], ["keyword", "jackknife"], + ["command", "foo"], ["keyword", "mfp"], + ["command", "foo"], ["keyword", "mi estimate"], + ["command", "foo"], ["keyword", "nestreg"], + ["command", "foo"], ["keyword", "noisily"], + ["command", "foo"], ["keyword", "of"], + ["command", "foo"], ["keyword", "permute"], + ["command", "foo"], ["keyword", "quietly"], + ["command", "foo"], ["keyword", "rolling"], + ["command", "foo"], ["keyword", "simulate"], + ["command", "foo"], ["keyword", "sort"], + ["command", "foo"], ["keyword", "statsby"], + ["command", "foo"], ["keyword", "stepwise"], + ["command", "foo"], ["keyword", "svy"], + ["command", "foo"], ["keyword", "varlist"], + ["command", "foo"], ["keyword", "version"], + ["command", "foo"], ["keyword", "xi"] +] diff --git a/package/src/prism/tests/languages/stata/mata_inclusion.test b/package/src/prism/tests/languages/stata/mata_inclusion.test new file mode 100644 index 00000000..b0277cc0 --- /dev/null +++ b/package/src/prism/tests/languages/stata/mata_inclusion.test @@ -0,0 +1,84 @@ +version 17.0 +include limits.matah +mata: +real matrix inpivot(real matrix X) +{ + real matrix y1, yz + real scalar n + if (rows(X)>‘MAXDIM’ | cols(X)>‘MAXDIM’) { + errprintf("inpivot: matrix too large\n") + exit(1000) + } + ... +} +end + +---------------------------------------------------- + +[ + ["command", "version"], + ["number", "17.0"], + + ["command", "include"], + " limits.matah\n", + + ["command", "mata"], + ["punctuation", ":"], + + ["mata", [ + ["type", ["real matrix"]], + ["function", "inpivot"], + ["punctuation", "("], + ["type", ["real matrix"]], + " X", + ["punctuation", ")"], + + ["punctuation", "{"], + + ["type", ["real matrix"]], + " y1", + ["punctuation", ","], + " yz\n\t", + + ["type", ["real scalar"]], + " n\n\t", + + ["keyword", "if"], + ["punctuation", "("], + ["function", "rows"], + ["punctuation", "("], + "X", + ["punctuation", ")"], + ["operator", ">"], + "‘MAXDIM", + ["operator", "’"], + ["operator", "|"], + ["function", "cols"], + ["punctuation", "("], + "X", + ["punctuation", ")"], + ["operator", ">"], + "‘MAXDIM", + ["operator", "’"], + ["punctuation", ")"], + ["punctuation", "{"], + + ["function", "errprintf"], + ["punctuation", "("], + ["string", "\"inpivot: matrix too large\\n\""], + ["punctuation", ")"], + + ["function", "exit"], + ["punctuation", "("], + ["number", "1000"], + ["punctuation", ")"], + + ["punctuation", "}"], + + ["operator", ".."], + ["punctuation", "."], + + ["punctuation", "}"] + ]], + ["command", "end"] +] diff --git a/package/src/prism/tests/languages/stata/number_feature.test b/package/src/prism/tests/languages/stata/number_feature.test new file mode 100644 index 00000000..666a5723 --- /dev/null +++ b/package/src/prism/tests/languages/stata/number_feature.test @@ -0,0 +1,11 @@ +123 +123.456 +.123 + +---------------------------------------------------- + +[ + ["number", "123"], + ["number", "123.456"], + ["number", ".123"] +] diff --git a/package/src/prism/tests/languages/stata/operator_feature.test b/package/src/prism/tests/languages/stata/operator_feature.test new file mode 100644 index 00000000..73ef78a6 --- /dev/null +++ b/package/src/prism/tests/languages/stata/operator_feature.test @@ -0,0 +1,36 @@ ++ - * / ^ +++ -- + +< <= > >= == != ~= += + +& | ! ~ + +# ## + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "^"], + + ["operator", "++"], + ["operator", "--"], + + ["operator", "<"], + ["operator", "<="], + ["operator", ">"], + ["operator", ">="], + ["operator", "=="], + ["operator", "!="], + ["operator", "~="], + + ["operator", "="], + + ["operator", "&"], ["operator", "|"], ["operator", "!"], ["operator", "~"], + + ["operator", "#"], ["operator", "##"] +] diff --git a/package/src/prism/tests/languages/stata/python_inclusion.test b/package/src/prism/tests/languages/stata/python_inclusion.test new file mode 100644 index 00000000..e39e598d --- /dev/null +++ b/package/src/prism/tests/languages/stata/python_inclusion.test @@ -0,0 +1,70 @@ +version 17.0 +local a = 2 +local b = 3 +python: +from sfi import Scalar +def calcsum(num1, num2): + res = num1 + num2 + Scalar.setValue("result", res) +calcsum(‘a’, ‘b’) +end +display result + +---------------------------------------------------- + +[ + ["command", "version"], + ["number", "17.0"], + + ["command", "local"], + " a ", + ["operator", "="], + ["number", "2"], + + ["command", "local"], + " b ", + ["operator", "="], + ["number", "3"], + + ["command", "python"], + ["punctuation", ":"], + ["python", [ + ["keyword", "from"], + " sfi ", + ["keyword", "import"], + " Scalar\n", + + ["keyword", "def"], + ["function", "calcsum"], + ["punctuation", "("], + "num1", + ["punctuation", ","], + " num2", + ["punctuation", ")"], + ["punctuation", ":"], + + "\n\tres ", + ["operator", "="], + " num1 ", + ["operator", "+"], + " num2\n\tScalar", + ["punctuation", "."], + "setValue", + ["punctuation", "("], + ["string", "\"result\""], + ["punctuation", ","], + " res", + ["punctuation", ")"], + + "\ncalcsum", + ["punctuation", "("], + "‘a’", + ["punctuation", ","], + " ‘b’", + ["punctuation", ")"] + ]], + ["command", "end"], + + ["command", "display"], + " result" +] diff --git a/package/src/prism/tests/languages/stata/string_feature.test b/package/src/prism/tests/languages/stata/string_feature.test new file mode 100644 index 00000000..c8647a4e --- /dev/null +++ b/package/src/prism/tests/languages/stata/string_feature.test @@ -0,0 +1,51 @@ +"" +"foo" +"${datadir}householdmembers" +"‘ins’" +"‘mpg[one]’" + +`"ysc(r(0 80)) xtitle("Health Status", size(medlarge))"' + +---------------------------------------------------- + +[ + ["string-literal", [ + ["string", "\"\""] + ]], + ["string-literal", [ + ["string", "\"foo\""] + ]], + ["string-literal", [ + ["string", "\""], + ["interpolation", [ + ["punctuation", "${"], + ["expression", [ + ["command", "datadir"] + ]], + ["punctuation", "}"] + ]], + ["string", "householdmembers\""] + ]], + ["string-literal", [ + ["string", "\""], + ["interpolation", [ + ["expression", [ + ["variable", "‘ins’"] + ]] + ]], + ["string", "\""] + ]], + ["string-literal", [ + ["string", "\""], + ["interpolation", [ + ["expression", [ + ["variable", "‘mpg[one]’"] + ]] + ]], + ["string", "\""] + ]], + + ["string-literal", [ + ["string", "`\"ysc(r(0 80)) xtitle(\"Health Status\", size(medlarge))\"'"] + ]] +] diff --git a/package/src/prism/tests/languages/stata/variable_feature.test b/package/src/prism/tests/languages/stata/variable_feature.test new file mode 100644 index 00000000..8bdbe09d --- /dev/null +++ b/package/src/prism/tests/languages/stata/variable_feature.test @@ -0,0 +1,7 @@ +$histoption + +---------------------------------------------------- + +[ + ["variable", "$histoption"] +] diff --git a/package/src/prism/tests/languages/stylus+pug/stylus_inclusion.test b/package/src/prism/tests/languages/stylus+pug/stylus_inclusion.test new file mode 100644 index 00000000..e68e91dd --- /dev/null +++ b/package/src/prism/tests/languages/stylus+pug/stylus_inclusion.test @@ -0,0 +1,22 @@ +:stylus + font-size = 14px + +---------------------------------------------------- + +[ + ["filter-stylus", [ + ["filter-name", ":stylus"], + ["text", [ + ["variable-declaration", [ + ["variable", "font-size"], + ["operator", "="], + ["number", "14"], + ["unit", "px"] + ]] + ]] + ]] +] + +---------------------------------------------------- + +Checks for stylus filter in pug. diff --git a/package/src/prism/tests/languages/stylus/atrule-declaration_feature.test b/package/src/prism/tests/languages/stylus/atrule-declaration_feature.test new file mode 100644 index 00000000..f01f441a --- /dev/null +++ b/package/src/prism/tests/languages/stylus/atrule-declaration_feature.test @@ -0,0 +1,44 @@ +@media print +@import "reset.css" +@font-face { +@keyframes { +@media (max-{foo}: bar) +@namespace url(http://www.w3.org/1999/xhtml) // comment +@namespace svg url(http://www.w3.org/2000/svg) // comment + +---------------------------------------------------- + +[ + ["atrule-declaration", [["atrule", "@media"], " print"]], + ["atrule-declaration", [["atrule", "@import"], ["string", "\"reset.css\""]]], + ["atrule-declaration", [["atrule", "@font-face"], ["punctuation", "{"]]], + ["atrule-declaration", [["atrule", "@keyframes"], ["punctuation", "{"]]], + ["atrule-declaration", [ + ["atrule", "@media"], + ["punctuation", "("], + "max-", + ["interpolation", [ + ["delimiter", "{"], + "foo", + ["delimiter", "}"] + ]], + ["punctuation", ":"], + " bar", + ["punctuation", ")"] + ]], + ["atrule-declaration", [ + ["atrule", "@namespace"], + ["url", "url(http://www.w3.org/1999/xhtml)"], + ["comment", "// comment"] + ]], + ["atrule-declaration", [ + ["atrule", "@namespace"], + " svg ", + ["url", "url(http://www.w3.org/2000/svg)"], + ["comment", "// comment"] + ]] +] + +---------------------------------------------------- + +Checks for at-rules. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/boolean_feature.test b/package/src/prism/tests/languages/stylus/boolean_feature.test new file mode 100644 index 00000000..23fc65f0 --- /dev/null +++ b/package/src/prism/tests/languages/stylus/boolean_feature.test @@ -0,0 +1,21 @@ +a = true +b = false + +---------------------------------------------------- + +[ + ["variable-declaration", [ + ["variable", "a"], + ["operator", "="], + ["boolean", "true"] + ]], + ["variable-declaration", [ + ["variable", "b"], + ["operator", "="], + ["boolean", "false"] + ]] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/comment_feature.test b/package/src/prism/tests/languages/stylus/comment_feature.test new file mode 100644 index 00000000..719441b3 --- /dev/null +++ b/package/src/prism/tests/languages/stylus/comment_feature.test @@ -0,0 +1,18 @@ +/**/ +/* foo +bar */ +// +// foobar + +---------------------------------------------------- + +[ + ["comment", "/**/"], + ["comment", "/* foo\nbar */"], + ["comment", "//"], + ["comment", "// foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/func_feature.test b/package/src/prism/tests/languages/stylus/func_feature.test new file mode 100644 index 00000000..91e7be25 --- /dev/null +++ b/package/src/prism/tests/languages/stylus/func_feature.test @@ -0,0 +1,51 @@ +border-radius(n) + -webkit-border-radius n + -moz-border-radius n + border-radius n + +form input[type=button] + border-radius(5px) + color foo() + +---------------------------------------------------- + +[ + ["func", [ + ["function", "border-radius"], + ["punctuation", "("], + "n", + ["punctuation", ")"] + ]], + ["property-declaration", [ + ["property", ["-webkit-border-radius"]], + " n" + ]], + ["property-declaration", [ + ["property", ["-moz-border-radius"]], + " n" + ]], + ["property-declaration", [ + ["property", ["border-radius"]], + " n" + ]], + ["selector", ["form input[type=button]"]], + ["func", [ + ["function", "border-radius"], + ["punctuation", "("], + ["number", "5"], + ["unit", "px"], + ["punctuation", ")"] + ]], + ["property-declaration", [ + ["property", ["color"]], + ["func", [ + ["function", "foo"], + ["punctuation", "("], + ["punctuation", ")"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/hexcode_feature.test b/package/src/prism/tests/languages/stylus/hexcode_feature.test new file mode 100644 index 00000000..4d89f777 --- /dev/null +++ b/package/src/prism/tests/languages/stylus/hexcode_feature.test @@ -0,0 +1,29 @@ +color: #fff +color: #FA3 +color: #f7c111 +color: #9F4ABB + +---------------------------------------------------- + +[ + ["property-declaration", [ + ["property", ["color"]], ["punctuation", ":"], + ["hexcode", "#fff"] + ]], + ["property-declaration", [ + ["property", ["color"]], ["punctuation", ":"], + ["hexcode", "#FA3"] + ]], + ["property-declaration", [ + ["property", ["color"]], ["punctuation", ":"], + ["hexcode", "#f7c111"] + ]], + ["property-declaration", [ + ["property", ["color"]], ["punctuation", ":"], + ["hexcode", "#9F4ABB"] + ]] +] + +---------------------------------------------------- + +Checks for hexadecimal values. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/important_feature.test b/package/src/prism/tests/languages/stylus/important_feature.test new file mode 100644 index 00000000..134795e2 --- /dev/null +++ b/package/src/prism/tests/languages/stylus/important_feature.test @@ -0,0 +1,22 @@ +color: red !important +@extend foo !optional + +---------------------------------------------------- + +[ + ["property-declaration", [ + ["property", ["color"]], + ["punctuation", ":"], + ["color", "red"], + ["important", "!important"] + ]], + ["atrule-declaration", [ + ["atrule", "@extend"], + " foo ", + ["important", "!optional"] + ]] +] + +---------------------------------------------------- + +Checks for !important and !optional. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/keyword_feature.test b/package/src/prism/tests/languages/stylus/keyword_feature.test new file mode 100644 index 00000000..5f366c00 --- /dev/null +++ b/package/src/prism/tests/languages/stylus/keyword_feature.test @@ -0,0 +1,52 @@ +for i in 1..5 +if a == 3 +z-index: 1 unless @z-index; +return pair[1] if pair[0] == key for pair in hash +if url == "http://example.com" // comment + +---------------------------------------------------- + +[ + ["statement", [ + ["keyword", "for"], + " i ", + ["operator", "in"], + ["number", "1"], + ["operator", ".."], + ["number", "5"] + ]], + ["statement", [ + ["keyword", "if"], + " a ", + ["operator", "=="], + ["number", "3"] + ]], + ["property-declaration", [ + ["property", ["z-index"]], + ["punctuation", ":"], + ["number", "1"], + ["keyword", "unless"], + ["keyword", "@z-index"], + ["punctuation", ";"] + ]], + ["statement", [ + ["keyword", "return"], " pair", + ["punctuation", "["], ["number", "1"], ["punctuation", "]"], + ["keyword", "if"], " pair", + ["punctuation", "["], ["number", "0"], ["punctuation", "]"], + ["operator", "=="], " key ", + ["keyword", "for"], " pair ", + ["operator", "in"], " hash" + ]], + ["statement", [ + ["keyword", "if"], + " url ", + ["operator", "=="], + ["string", "\"http://example.com\""], + ["comment", "// comment"] + ]] +] + +---------------------------------------------------- + +Checks for statements and keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/number_feature.test b/package/src/prism/tests/languages/stylus/number_feature.test new file mode 100644 index 00000000..160c8748 --- /dev/null +++ b/package/src/prism/tests/languages/stylus/number_feature.test @@ -0,0 +1,34 @@ +z-index 42 +foo = 3.14159 +width: 23% +bar = 1.5% + +---------------------------------------------------- + +[ + ["property-declaration", [ + ["property", ["z-index"]], + ["number", "42"] + ]], + ["variable-declaration", [ + ["variable", "foo"], + ["operator", "="], + ["number", "3.14159"] + ]], + ["property-declaration", [ + ["property", ["width"]], + ["punctuation", ":"], + ["number", "23"], + ["unit", "%"] + ]], + ["variable-declaration", [ + ["variable", "bar"], + ["operator", "="], + ["number", "1.5"], + ["unit", "%"] + ]] +] + +---------------------------------------------------- + +Checks for numbers and percentages. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/operator_feature.test b/package/src/prism/tests/languages/stylus/operator_feature.test new file mode 100644 index 00000000..11ef9c16 --- /dev/null +++ b/package/src/prism/tests/languages/stylus/operator_feature.test @@ -0,0 +1,273 @@ +a = !b +b = b != a +c = ~b +d = c + b +d += a +e = d - c +e -= b +f = a * b +g = c ** d +g *= f +h = g / f +h /= e +i = h % g +i %= f +j = 1..5 +k = 1...5 +l = k < j +m = l <= k +n = m > l +o = n >= m +p = o ? n : m +q ?= p +r = q == p +s := r +t = s && r +u = t || s +v = u and t +w = v or u +x = 1 in w +y = true is true +z = true is not false +aa = z isnt y +ab = #fff is a 'rgba' +ac = ab is defined +ad = not ac + +---------------------------------------------------- + +[ + ["variable-declaration", [ + ["variable", "a"], + ["operator", "="], + ["operator", "!"], + "b" + ]], + ["variable-declaration", [ + ["variable", "b"], + ["operator", "="], + " b ", + ["operator", "!="], + " a" + ]], + ["variable-declaration", [ + ["variable", "c"], + ["operator", "="], + ["operator", "~"], + "b" + ]], + ["variable-declaration", [ + ["variable", "d"], + ["operator", "="], + " c ", + ["operator", "+"], + " b" + ]], + ["variable-declaration", [ + ["variable", "d"], + ["operator", "+="], + " a" + ]], + ["variable-declaration", [ + ["variable", "e"], + ["operator", "="], + " d ", + ["operator", "-"], + " c" + ]], + ["variable-declaration", [ + ["variable", "e"], + ["operator", "-="], + " b" + ]], + ["variable-declaration", [ + ["variable", "f"], + ["operator", "="], + " a ", + ["operator", "*"], + " b" + ]], + ["variable-declaration", [ + ["variable", "g"], + ["operator", "="], + " c ", + ["operator", "**"], + " d" + ]], + ["variable-declaration", [ + ["variable", "g"], + ["operator", "*="], + " f" + ]], + ["variable-declaration", [ + ["variable", "h"], + ["operator", "="], + " g ", + ["operator", "/"], + " f" + ]], + ["variable-declaration", [ + ["variable", "h"], + ["operator", "/="], + " e" + ]], + ["variable-declaration", [ + ["variable", "i"], + ["operator", "="], + " h ", + ["operator", "%"], + " g" + ]], + ["variable-declaration", [ + ["variable", "i"], + ["operator", "%="], + " f" + ]], + ["variable-declaration", [ + ["variable", "j"], + ["operator", "="], + ["number", "1"], + ["operator", ".."], + ["number", "5"] + ]], + ["variable-declaration", [ + ["variable", "k"], + ["operator", "="], + ["number", "1"], + ["operator", "..."], + ["number", "5"] + ]], + ["variable-declaration", [ + ["variable", "l"], + ["operator", "="], + " k ", + ["operator", "<"], + " j" + ]], + ["variable-declaration", [ + ["variable", "m"], + ["operator", "="], + " l ", + ["operator", "<="], + " k" + ]], + ["variable-declaration", [ + ["variable", "n"], + ["operator", "="], + " m ", + ["operator", ">"], + " l" + ]], + ["variable-declaration", [ + ["variable", "o"], + ["operator", "="], + " n ", + ["operator", ">="], + " m" + ]], + ["variable-declaration", [ + ["variable", "p"], + ["operator", "="], + " o ", + ["operator", "?"], + " n ", + ["punctuation", ":"], + " m" + ]], + ["variable-declaration", [ + ["variable", "q"], + ["operator", "?="], + " p" + ]], + ["variable-declaration", [ + ["variable", "r"], + ["operator", "="], + " q ", + ["operator", "=="], + " p" + ]], + ["variable-declaration", [ + ["variable", "s"], + ["operator", ":="], + " r" + ]], + ["variable-declaration", [ + ["variable", "t"], + ["operator", "="], + " s ", + ["operator", "&&"], + " r" + ]], + ["variable-declaration", [ + ["variable", "u"], + ["operator", "="], + " t ", + ["operator", "||"], + " s" + ]], + ["variable-declaration", [ + ["variable", "v"], + ["operator", "="], + " u ", + ["operator", "and"], + " t" + ]], + ["variable-declaration", [ + ["variable", "w"], + ["operator", "="], + " v ", + ["operator", "or"], + " u" + ]], + ["variable-declaration", [ + ["variable", "x"], + ["operator", "="], + ["number", "1"], + ["operator", "in"], + " w" + ]], + ["variable-declaration", [ + ["variable", "y"], + ["operator", "="], + ["boolean", "true"], + ["operator", "is"], + ["boolean", "true"] + ]], + ["variable-declaration", [ + ["variable", "z"], + ["operator", "="], + ["boolean", "true"], + ["operator", "is not"], + ["boolean", "false"] + ]], + ["variable-declaration", [ + ["variable", "aa"], + ["operator", "="], + " z ", + ["operator", "isnt"], + " y" + ]], + ["variable-declaration", [ + ["variable", "ab"], + ["operator", "="], + ["hexcode", "#fff"], + ["operator", "is a"], + ["string", "'rgba'"] + ]], + ["variable-declaration", [ + ["variable", "ac"], + ["operator", "="], + " ab ", + ["operator", "is defined"] + ]], + ["variable-declaration", [ + ["variable", "ad"], + ["operator", "="], + ["operator", "not"], + " ac" + ]] +] + +---------------------------------------------------- + +Checks for all operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/property-declaration_feature.test b/package/src/prism/tests/languages/stylus/property-declaration_feature.test new file mode 100644 index 00000000..95ce21af --- /dev/null +++ b/package/src/prism/tests/languages/stylus/property-declaration_feature.test @@ -0,0 +1,82 @@ +div + width 40px + color: red + background: blue; + animation-name test1, animation4 + +div { +background-{foo}: bar; +} + +div + {foo} bar + +comment + content 'http://www.example.com' // comment + background url(http://example.com) /* comment */ + background /* comment */ url("http://example.com") + content '/* this is string not comment */' + +---------------------------------------------------- + +[ + ["selector", ["div"]], + ["property-declaration", [ + ["property", ["width"]], ["number", "40"], ["unit", "px"] + ]], + ["property-declaration", [ + ["property", ["color"]], ["punctuation", ":"], ["color", "red"] + ]], + ["property-declaration", [ + ["property", ["background"]], ["punctuation", ":"], ["color", "blue"], ["punctuation", ";"] + ]], + ["property-declaration", [ + ["property", ["animation-name"]], " test1", ["punctuation", ","], " animation4"]], + ["selector", ["div ", ["punctuation", "{"]]], + ["property-declaration", [ + ["property", [ + "background-", + ["interpolation", [ + ["delimiter", "{"], "foo", ["delimiter", "}"] + ]] + ]], + ["punctuation", ":"], + " bar", + ["punctuation", ";"] + ]], + ["punctuation", "}"], + ["selector", ["div"]], + ["property-declaration", [ + ["property", [ + ["interpolation", [ + ["delimiter", "{"], "foo", ["delimiter", "}"] + ]] + ]], + " bar" + ]], + + ["selector", ["comment"]], + ["property-declaration", [ + ["property", ["content"]], + ["string", "'http://www.example.com'"], + ["comment", "// comment"] + ]], + ["property-declaration", [ + ["property", ["background"]], + ["url", "url(http://example.com)"], + ["comment", "/* comment */"] + ]], + ["property-declaration", [ + ["property", ["background"]], + ["comment", "/* comment */"], + ["url", "url(\"http://example.com\")"] + ]], + ["property-declaration", [ + ["property", ["content"]], + ["string", "'/* this is string not comment */'"] + ]] +] + +---------------------------------------------------- + +Checks for property declarations. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/selector_feature.test b/package/src/prism/tests/languages/stylus/selector_feature.test new file mode 100644 index 00000000..bf402d51 --- /dev/null +++ b/package/src/prism/tests/languages/stylus/selector_feature.test @@ -0,0 +1,54 @@ +div +span[foo=bar] + color red + +div input, +input:nth-child(2n) + color red + +#foo + .bar::before + color red + +#foo + .bar { +color red +} + +{foo} {bar}:hover + color red + +div // comment + display inline-block // comment + +---------------------------------------------------- + +[ + ["selector", ["div\nspan[foo=bar]"]], + ["property-declaration", [["property", ["color"]], ["color", "red"]]], + ["selector", ["div input", ["punctuation", ","], "\ninput:nth-child(2n)"]], + ["property-declaration", [["property", ["color"]], ["color", "red"]]], + ["selector", ["#foo"]], + ["selector", [".bar::before"]], + ["property-declaration", [["property", ["color"]], ["color", "red"]]], + ["selector", ["#foo"]], + ["selector", [".bar ", ["punctuation", "{"]]], + ["property-declaration", [["property", ["color"]], ["color", "red"]]], + ["punctuation", "}"], + ["selector", [ + ["interpolation", [ + ["delimiter", "{"], "foo", ["delimiter", "}"] + ]], + ["interpolation", [ + ["delimiter", "{"], "bar", ["delimiter", "}"] + ]], + ":hover" + ]], + ["property-declaration", [["property", ["color"]], ["color", "red"]]], + ["selector", ["div ", ["comment", "// comment"]]], + ["property-declaration", [["property", ["display"]], " inline-block ", ["comment", "// comment"]]] +] + +---------------------------------------------------- + +Checks for selectors. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/string_feature.test b/package/src/prism/tests/languages/stylus/string_feature.test new file mode 100644 index 00000000..35860914 --- /dev/null +++ b/package/src/prism/tests/languages/stylus/string_feature.test @@ -0,0 +1,33 @@ +content: "" +content: "foo" +content: '' +content: 'foo' + +---------------------------------------------------- + +[ + ["property-declaration", [ + ["property", ["content"]], + ["punctuation", ":"], + ["string", "\"\""] + ]], + ["property-declaration", [ + ["property", ["content"]], + ["punctuation", ":"], + ["string", "\"foo\""] + ]], + ["property-declaration", [ + ["property", ["content"]], + ["punctuation", ":"], + ["string", "''"] + ]], + ["property-declaration", [ + ["property", ["content"]], + ["punctuation", ":"], + ["string", "'foo'"] + ]] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/url_feature.test b/package/src/prism/tests/languages/stylus/url_feature.test new file mode 100644 index 00000000..e770c7d6 --- /dev/null +++ b/package/src/prism/tests/languages/stylus/url_feature.test @@ -0,0 +1,21 @@ +background: url('foo.png') +background: url("foo/bar.jpg") + +---------------------------------------------------- + +[ + ["property-declaration", [ + ["property", ["background"]], + ["punctuation", ":"], + ["url", "url('foo.png')"] + ]], + ["property-declaration", [ + ["property", ["background"]], + ["punctuation", ":"], + ["url", "url(\"foo/bar.jpg\")"] + ]] +] + +---------------------------------------------------- + +Checks for urls. \ No newline at end of file diff --git a/package/src/prism/tests/languages/stylus/variable-declaration_feature.test b/package/src/prism/tests/languages/stylus/variable-declaration_feature.test new file mode 100644 index 00000000..cb6f7df4 --- /dev/null +++ b/package/src/prism/tests/languages/stylus/variable-declaration_feature.test @@ -0,0 +1,40 @@ +foo = 'bar' +a = 4 +bar-baz = 5 +a += 8 +url = "http://example.com" // comment + +---------------------------------------------------- + +[ + ["variable-declaration", [ + ["variable", "foo"], + ["operator", "="], + ["string", "'bar'"] + ]], + ["variable-declaration", [ + ["variable", "a"], + ["operator", "="], + ["number", "4"] + ]], + ["variable-declaration", [ + ["variable", "bar-baz"], + ["operator", "="], + ["number", "5"] + ]], + ["variable-declaration", [ + ["variable", "a"], + ["operator", "+="], + ["number", "8"] + ]], + ["variable-declaration", [ + ["variable", "url"], + ["operator", "="], + ["string", "\"http://example.com\""], + ["comment", "// comment"] + ]] +] + +---------------------------------------------------- + +Checks for variable declarations. \ No newline at end of file diff --git a/package/src/prism/tests/languages/supercollider/boolean_feature.test b/package/src/prism/tests/languages/supercollider/boolean_feature.test new file mode 100644 index 00000000..d342140d --- /dev/null +++ b/package/src/prism/tests/languages/supercollider/boolean_feature.test @@ -0,0 +1,9 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] diff --git a/package/src/prism/tests/languages/supercollider/char_feature.test b/package/src/prism/tests/languages/supercollider/char_feature.test new file mode 100644 index 00000000..76569254 --- /dev/null +++ b/package/src/prism/tests/languages/supercollider/char_feature.test @@ -0,0 +1,29 @@ +$A +$B +$C +$. +$$ + +$\t // tab (horizontal tab) +$\f // form feed +$\v // vertical tab +$\n // newline (linefeed) +$\r // return +$\\ // backslash` + +---------------------------------------------------- + +[ + ["char", "$A"], + ["char", "$B"], + ["char", "$C"], + ["char", "$."], + ["char", "$$"], + + ["char", "$\\t"], ["comment", "// tab (horizontal tab)"], + ["char", "$\\f"], ["comment", "// form feed"], + ["char", "$\\v"], ["comment", "// vertical tab"], + ["char", "$\\n"], ["comment", "// newline (linefeed)"], + ["char", "$\\r"], ["comment", "// return"], + ["char", "$\\\\"], ["comment", "// backslash`"] +] diff --git a/package/src/prism/tests/languages/supercollider/class-name_feature.test b/package/src/prism/tests/languages/supercollider/class-name_feature.test new file mode 100644 index 00000000..690bc4b6 --- /dev/null +++ b/package/src/prism/tests/languages/supercollider/class-name_feature.test @@ -0,0 +1,13 @@ +Foo +SynthDef +Set[] +List[] + +---------------------------------------------------- + +[ + ["class-name", "Foo"], + ["class-name", "SynthDef"], + ["class-name", "Set"], ["punctuation", "["], ["punctuation", "]"], + ["class-name", "List"], ["punctuation", "["], ["punctuation", "]"] +] diff --git a/package/src/prism/tests/languages/supercollider/comment_feature.test b/package/src/prism/tests/languages/supercollider/comment_feature.test new file mode 100644 index 00000000..81bc2d91 --- /dev/null +++ b/package/src/prism/tests/languages/supercollider/comment_feature.test @@ -0,0 +1,19 @@ +// single line comment + +/* + multi + line + comment +*/ + +/* Unlike C, you can have /* nested */ comments */ + +---------------------------------------------------- + +[ + ["comment", "// single line comment"], + + ["comment", "/*\n multi\n line\n comment\n*/"], + + ["comment", "/* Unlike C, you can have /* nested */ comments */"] +] diff --git a/package/src/prism/tests/languages/supercollider/keyword_feature.test b/package/src/prism/tests/languages/supercollider/keyword_feature.test new file mode 100644 index 00000000..2df8e116 --- /dev/null +++ b/package/src/prism/tests/languages/supercollider/keyword_feature.test @@ -0,0 +1,19 @@ +_ +arg +classvar +const +nil +var +while + +---------------------------------------------------- + +[ + ["keyword", "_"], + ["keyword", "arg"], + ["keyword", "classvar"], + ["keyword", "const"], + ["keyword", "nil"], + ["keyword", "var"], + ["keyword", "while"] +] diff --git a/package/src/prism/tests/languages/supercollider/label_feature.test b/package/src/prism/tests/languages/supercollider/label_feature.test new file mode 100644 index 00000000..915092cf --- /dev/null +++ b/package/src/prism/tests/languages/supercollider/label_feature.test @@ -0,0 +1,16 @@ +foo(a: 5, bar: 7) + +---------------------------------------------------- + +[ + "foo", + ["punctuation", "("], + ["label", "a"], + ["punctuation", ":"], + ["number", "5"], + ["punctuation", ","], + ["label", "bar"], + ["punctuation", ":"], + ["number", "7"], + ["punctuation", ")"] +] diff --git a/package/src/prism/tests/languages/supercollider/number_feature.test b/package/src/prism/tests/languages/supercollider/number_feature.test new file mode 100644 index 00000000..a77b55ae --- /dev/null +++ b/package/src/prism/tests/languages/supercollider/number_feature.test @@ -0,0 +1,145 @@ +-13 +666 +2112 +96 +0xa // 10 +-0xd // -13 +0x29A // 666 +0x840 // 2112 +0x60 // 96 + +0.39 +98.6 +1.0 +-0.5 +1.2e4 +1E-4 + +pi +2pi +0.5pi +-0.25pi + +inf // and beyond! +-inf + +16rF // 15 +16ra9 // 169 +36rZIGZAG // 2147341480 +2r01101011 +12r4a.abc // wrong +12r4a.ABC // works +12r4A.ABC // better + +2s == 2.1 // scale degree two, sharp +2b == 1.9 // scale degree two, flat +2ss == 2.2 // scale degree two, double sharp +2bb == 1.8 // scale degree two, double flat +2ssss == 2.4 +2bbbb == 1.6 +-2s == -1.9 +-2b == -2.1 +-2ss == -1.8 +-2bb == -2.2 + +2b50 == 1.95 // scale degree two, fifty cents flat +2s204 == 2.204 // scale degree two, 204 cents sharp + +---------------------------------------------------- + +[ + ["operator", "-"], ["number", "13"], + ["number", "666"], + ["number", "2112"], + ["number", "96"], + ["number", "0xa"], ["comment", "// 10"], + ["operator", "-"], ["number", "0xd"], ["comment", "// -13"], + ["number", "0x29A"], ["comment", "// 666"], + ["number", "0x840"], ["comment", "// 2112"], + ["number", "0x60"], ["comment", "// 96"], + + ["number", "0.39"], + ["number", "98.6"], + ["number", "1.0"], + ["operator", "-"], ["number", "0.5"], + ["number", "1.2e4"], + ["number", "1E-4"], + + ["number", "pi"], + ["number", "2pi"], + ["number", "0.5pi"], + ["operator", "-"], ["number", "0.25pi"], + + ["number", "inf"], ["comment", "// and beyond!"], + ["operator", "-"], ["number", "inf"], + + ["number", "16rF"], ["comment", "// 15"], + ["number", "16ra9"], ["comment", "// 169"], + ["number", "36rZIGZAG"], ["comment", "// 2147341480"], + ["number", "2r01101011"], + ["number", "12r4a.abc"], ["comment", "// wrong"], + ["number", "12r4a.ABC"], ["comment", "// works"], + ["number", "12r4A.ABC"], ["comment", "// better"], + + ["number", "2s"], + ["operator", "=="], + ["number", "2.1"], + ["comment", "// scale degree two, sharp"], + + ["number", "2b"], + ["operator", "=="], + ["number", "1.9"], + ["comment", "// scale degree two, flat"], + + ["number", "2ss"], + ["operator", "=="], + ["number", "2.2"], + ["comment", "// scale degree two, double sharp"], + + ["number", "2bb"], + ["operator", "=="], + ["number", "1.8"], + ["comment", "// scale degree two, double flat"], + + ["number", "2ssss"], + ["operator", "=="], + ["number", "2.4"], + + ["number", "2bbbb"], + ["operator", "=="], + ["number", "1.6"], + + ["operator", "-"], + ["number", "2s"], + ["operator", "=="], + ["operator", "-"], + ["number", "1.9"], + + ["operator", "-"], + ["number", "2b"], + ["operator", "=="], + ["operator", "-"], + ["number", "2.1"], + + ["operator", "-"], + ["number", "2ss"], + ["operator", "=="], + ["operator", "-"], + ["number", "1.8"], + + ["operator", "-"], + ["number", "2bb"], + ["operator", "=="], + ["operator", "-"], + ["number", "2.2"], + + ["number", "2b50"], + ["operator", "=="], + ["number", "1.95"], + ["comment", "// scale degree two, fifty cents flat"], + + ["number", "2s204"], + ["operator", "=="], + ["number", "2.204"], + ["comment", "// scale degree two, 204 cents sharp"] +] diff --git a/package/src/prism/tests/languages/supercollider/operator_feature.test b/package/src/prism/tests/languages/supercollider/operator_feature.test new file mode 100644 index 00000000..b02f4de1 --- /dev/null +++ b/package/src/prism/tests/languages/supercollider/operator_feature.test @@ -0,0 +1,82 @@ ++ - * / % ** +& | << >> +>> + +< <= > => == != === !== +|==| |!=| +&& || + +++ +++ @ @@ @|@ |@| +& | - -- + +<< <<* <<< <<<* +? ?? !? + +! -> + +.. ... +# += +` + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + ["operator", "**"], + + ["operator", "&"], + ["operator", "|"], + ["operator", "<<"], + ["operator", ">>"], + ["operator", "+>>"], + + ["operator", "<"], + ["operator", "<="], + ["operator", ">"], + ["operator", "=>"], + ["operator", "=="], + ["operator", "!="], + ["operator", "==="], + ["operator", "!=="], + + ["operator", "|==|"], + ["operator", "|!=|"], + + ["operator", "&&"], + ["operator", "||"], + + ["operator", "++"], + ["operator", "+++"], + ["operator", "@"], + ["operator", "@@"], + ["operator", "@|@"], + ["operator", "|@|"], + + ["operator", "&"], + ["operator", "|"], + ["operator", "-"], + ["operator", "--"], + + ["operator", "<<"], + ["operator", "<<*"], + ["operator", "<<<"], + ["operator", "<<<*"], + + ["operator", "?"], + ["operator", "??"], + ["operator", "!?"], + + ["operator", "!"], + ["operator", "->"], + ["operator", ""], + + ["operator", ".."], ["operator", "..."], + ["operator", "#"], + ["operator", "="], + ["operator", "`"] +] diff --git a/package/src/prism/tests/languages/supercollider/punctuation_feature.test b/package/src/prism/tests/languages/supercollider/punctuation_feature.test new file mode 100644 index 00000000..4b2c1266 --- /dev/null +++ b/package/src/prism/tests/languages/supercollider/punctuation_feature.test @@ -0,0 +1,25 @@ +( ) [ ] { } +, ; . : + +#[ ] #{ } + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", "."], + ["punctuation", ":"], + + ["punctuation", "#["], + ["punctuation", "]"], + ["punctuation", "#{"], + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/supercollider/string_feature.test b/package/src/prism/tests/languages/supercollider/string_feature.test new file mode 100644 index 00000000..c0af5af9 --- /dev/null +++ b/package/src/prism/tests/languages/supercollider/string_feature.test @@ -0,0 +1,17 @@ +"" +"foo" +"\"" +" +f +o +o +" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foo\""], + ["string", "\"\\\"\""], + ["string", "\"\nf\no\no\n\""] +] diff --git a/package/src/prism/tests/languages/supercollider/symbol_feature.test b/package/src/prism/tests/languages/supercollider/symbol_feature.test new file mode 100644 index 00000000..e45652eb --- /dev/null +++ b/package/src/prism/tests/languages/supercollider/symbol_feature.test @@ -0,0 +1,27 @@ +\x +\aiff +\Big_Swifty_And_Assoc + +'x' +'aiff' +'BigSwiftyAndAssoc' +'nowhere here' +'somewhere there' +'.+o*o+.' +'\'symbol_within_a_symbol\'' + +---------------------------------------------------- + +[ + ["symbol", "\\x"], + ["symbol", "\\aiff"], + ["symbol", "\\Big_Swifty_And_Assoc"], + + ["symbol", "'x'"], + ["symbol", "'aiff'"], + ["symbol", "'BigSwiftyAndAssoc'"], + ["symbol", "'nowhere here'"], + ["symbol", "'somewhere there'"], + ["symbol", "'.+o*o+.'"], + ["symbol", "'\\'symbol_within_a_symbol\\''"] +] diff --git a/package/src/prism/tests/languages/swift/attribute_feature.test b/package/src/prism/tests/languages/swift/attribute_feature.test new file mode 100644 index 00000000..ac67e2be --- /dev/null +++ b/package/src/prism/tests/languages/swift/attribute_feature.test @@ -0,0 +1,39 @@ +@IBOutlet +@IBDesignable +@IBAction +@IBInspectable +@class_protocol +@exported +@globalActor +@MainActor +@noreturn +@NSCopying +@NSManaged +@objc +@propertyWrapper +@UIApplicationMain +@auto_closure + +@SomeCustomName + +---------------------------------------------------- + +[ + ["attribute", "@IBOutlet"], + ["attribute", "@IBDesignable"], + ["attribute", "@IBAction"], + ["attribute", "@IBInspectable"], + ["attribute", "@class_protocol"], + ["attribute", "@exported"], + ["attribute", "@globalActor"], + ["attribute", "@MainActor"], + ["attribute", "@noreturn"], + ["attribute", "@NSCopying"], + ["attribute", "@NSManaged"], + ["attribute", "@objc"], + ["attribute", "@propertyWrapper"], + ["attribute", "@UIApplicationMain"], + ["attribute", "@auto_closure"], + + ["attribute", "@SomeCustomName"] +] diff --git a/package/src/prism/tests/languages/swift/class-name_feature.test b/package/src/prism/tests/languages/swift/class-name_feature.test new file mode 100644 index 00000000..82ae664c --- /dev/null +++ b/package/src/prism/tests/languages/swift/class-name_feature.test @@ -0,0 +1,41 @@ +struct SomeStructure {} +enum SomeEnumeration {} +class SomeClass: SomeSuperclass { + class var overrideableComputedTypeProperty: Int { + return 107 + } +} + +---------------------------------------------------- + +[ + ["keyword", "struct"], + ["class-name", "SomeStructure"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "enum"], + ["class-name", "SomeEnumeration"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "class"], + ["class-name", "SomeClass"], + ["punctuation", ":"], + ["class-name", "SomeSuperclass"], + ["punctuation", "{"], + + ["keyword", "class"], + ["keyword", "var"], + " overrideableComputedTypeProperty", + ["punctuation", ":"], + ["class-name", "Int"], + ["punctuation", "{"], + + ["keyword", "return"], + ["number", "107"], + + ["punctuation", "}"], + + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/swift/comment_feature.test b/package/src/prism/tests/languages/swift/comment_feature.test new file mode 100644 index 00000000..04ce6871 --- /dev/null +++ b/package/src/prism/tests/languages/swift/comment_feature.test @@ -0,0 +1,23 @@ +// foo +/**/ +/* foo */ +/* + foo +*/ + +/* +/* + foo +*/ +*/ + +---------------------------------------------------- + +[ + ["comment", "// foo"], + ["comment", "/**/"], + ["comment", "/* foo */"], + ["comment", "/*\n foo\n*/"], + + ["comment", "/*\n/*\n foo\n*/\n*/"] +] diff --git a/package/src/prism/tests/languages/swift/constant_feature.test b/package/src/prism/tests/languages/swift/constant_feature.test new file mode 100644 index 00000000..b956e391 --- /dev/null +++ b/package/src/prism/tests/languages/swift/constant_feature.test @@ -0,0 +1,19 @@ +nil +AB +FOO_BAR +kAb +kFoo_bar + +---------------------------------------------------- + +[ + ["nil", "nil"], + ["constant", "AB"], + ["constant", "FOO_BAR"], + ["constant", "kAb"], + ["constant", "kFoo_bar"] +] + +---------------------------------------------------- + +Checks for constants. diff --git a/package/src/prism/tests/languages/swift/directive_feature.test b/package/src/prism/tests/languages/swift/directive_feature.test new file mode 100644 index 00000000..c95ae949 --- /dev/null +++ b/package/src/prism/tests/languages/swift/directive_feature.test @@ -0,0 +1,138 @@ +#if os(tvOS) +#if !DEBUG && ENABLE_INTERNAL_TOOLS +#if SWIFTUI_PROFILE +#if compiler(>=5) +#if compiler(>=5) && swift(<5) + +#elseif compiler(>=5) +#else +#endif + +#sourceLocation(file: "foo", line: 42) +#sourceLocation() + +#error("error message") +#warning("warning message") + +#available(iOS 13, *) + +#selector(SomeClass.doSomething(_:)) + +#keyPath(SomeClass.someProperty) + +---------------------------------------------------- + +[ + ["directive", [ + ["directive-name", "#if"], + " os", + ["punctuation", "("], + "tvOS", + ["punctuation", ")"] + ]], + ["directive", [ + ["directive-name", "#if"], + ["operator", "!"], + "DEBUG ", + ["operator", "&&"], + " ENABLE_INTERNAL_TOOLS" + ]], + ["directive", [ + ["directive-name", "#if"], + " SWIFTUI_PROFILE" + ]], + ["directive", [ + ["directive-name", "#if"], + " compiler", + ["punctuation", "("], + ["operator", ">="], + ["number", "5"], + ["punctuation", ")"] + ]], + ["directive", [ + ["directive-name", "#if"], + " compiler", + ["punctuation", "("], + ["operator", ">="], + ["number", "5"], + ["punctuation", ")"], + ["operator", "&&"], + " swift", + ["punctuation", "("], + ["operator", "<"], + ["number", "5"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["directive-name", "#elseif"], + " compiler", + ["punctuation", "("], + ["operator", ">="], + ["number", "5"], + ["punctuation", ")"] + ]], + ["directive", [ + ["directive-name", "#else"] + ]], + ["directive", [ + ["directive-name", "#endif"] + ]], + + ["other-directive", "#sourceLocation"], + ["punctuation", "("], + "file", + ["punctuation", ":"], + ["string-literal", [ + ["string", "\"foo\""] + ]], + ["punctuation", ","], + " line", + ["punctuation", ":"], + ["number", "42"], + ["punctuation", ")"], + + ["other-directive", "#sourceLocation"], + ["punctuation", "("], + ["punctuation", ")"], + + ["other-directive", "#error"], + ["punctuation", "("], + ["string-literal", [ + ["string", "\"error message\""] + ]], + ["punctuation", ")"], + + ["other-directive", "#warning"], + ["punctuation", "("], + ["string-literal", [ + ["string", "\"warning message\""] + ]], + ["punctuation", ")"], + + ["other-directive", "#available"], + ["punctuation", "("], + "iOS ", + ["number", "13"], + ["punctuation", ","], + ["operator", "*"], + ["punctuation", ")"], + + ["other-directive", "#selector"], + ["punctuation", "("], + ["class-name", "SomeClass"], + ["punctuation", "."], + ["function", "doSomething"], + ["punctuation", "("], + ["omit", "_"], + ["punctuation", ":"], + ["punctuation", ")"], + ["punctuation", ")"], + + ["other-directive", "#keyPath"], + ["punctuation", "("], + ["class-name", "SomeClass"], + ["punctuation", "."], + "someProperty", + ["punctuation", ")"] +] diff --git a/package/src/prism/tests/languages/swift/function_feature.test b/package/src/prism/tests/languages/swift/function_feature.test new file mode 100644 index 00000000..3084f70d --- /dev/null +++ b/package/src/prism/tests/languages/swift/function_feature.test @@ -0,0 +1,105 @@ +func greetAgain(person: String) -> String { + return "Hello again, " + person + "!" +} +print(greetAgain(person: "Anna")) +func someFunction(someT: T, someU: U) { + // function body goes here +} + + +// none of the below are functions +subscript(index: Int) -> Int { + get {} + set(newValue) {} +} + +---------------------------------------------------- + +[ + ["keyword", "func"], + ["function-definition", "greetAgain"], + ["punctuation", "("], + "person", + ["punctuation", ":"], + ["class-name", "String"], + ["punctuation", ")"], + ["operator", "->"], + ["class-name", "String"], + ["punctuation", "{"], + + ["keyword", "return"], + ["string-literal", [ + ["string", "\"Hello again, \""] + ]], + ["operator", "+"], + " person ", + ["operator", "+"], + ["string-literal", [ + ["string", "\"!\""] + ]], + + ["punctuation", "}"], + + ["function", "print"], + ["punctuation", "("], + ["function", "greetAgain"], + ["punctuation", "("], + "person", + ["punctuation", ":"], + ["string-literal", [ + ["string", "\"Anna\""] + ]], + ["punctuation", ")"], + ["punctuation", ")"], + + ["keyword", "func"], + ["function-definition", "someFunction"], + ["operator", "<"], + ["class-name", "T"], + ["punctuation", ":"], + ["class-name", "SomeClass"], + ["punctuation", ","], + ["class-name", "U"], + ["punctuation", ":"], + ["class-name", "SomeProtocol"], + ["operator", ">"], + ["punctuation", "("], + "someT", + ["punctuation", ":"], + ["class-name", "T"], + ["punctuation", ","], + " someU", + ["punctuation", ":"], + ["class-name", "U"], + ["punctuation", ")"], + ["punctuation", "{"], + + ["comment", "// function body goes here"], + + ["punctuation", "}"], + + ["comment", "// none of the below are functions"], + + ["keyword", "subscript"], + ["punctuation", "("], + "index", + ["punctuation", ":"], + ["class-name", "Int"], + ["punctuation", ")"], + ["operator", "->"], + ["class-name", "Int"], + ["punctuation", "{"], + + ["keyword", "get"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "set"], + ["punctuation", "("], + "newValue", + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/swift/keyword_feature.test b/package/src/prism/tests/languages/swift/keyword_feature.test new file mode 100644 index 00000000..2fd06c0e --- /dev/null +++ b/package/src/prism/tests/languages/swift/keyword_feature.test @@ -0,0 +1,183 @@ +Any +Protocol +Self +Type +actor +as +assignment +associatedtype +associativity +async +await +break; +case +catch +class; +continue; +convenience +default +defer +deinit +didSet +do +dynamic +else +enum +extension +fallthrough +fileprivate +final +for +func; +get +guard +higherThan +if +import +in +indirect +infix +init +inout +internal +is +isolated +lazy +left +let +lowerThan +mutating +none +nonisolated +nonmutating +open +operator +optional +override +postfix +precedencegroup +prefix +private +protocol +public +repeat +required +rethrows +return +right +safe +self +set +some +static +struct +subscript +super +switch +throw +throws +try +typealias +unowned +unsafe +var +weak +where +while +willSet + +---------------------------------------------------- + +[ + ["keyword", "Any"], + ["keyword", "Protocol"], + ["keyword", "Self"], + ["keyword", "Type"], + ["keyword", "actor"], + ["keyword", "as"], + ["keyword", "assignment"], + ["keyword", "associatedtype"], + ["keyword", "associativity"], + ["keyword", "async"], + ["keyword", "await"], + ["keyword", "break"], ["punctuation", ";"], + ["keyword", "case"], + ["keyword", "catch"], + ["keyword", "class"], ["punctuation", ";"], + ["keyword", "continue"], ["punctuation", ";"], + ["keyword", "convenience"], + ["keyword", "default"], + ["keyword", "defer"], + ["keyword", "deinit"], + ["keyword", "didSet"], + ["keyword", "do"], + ["keyword", "dynamic"], + ["keyword", "else"], + ["keyword", "enum"], + ["keyword", "extension"], + ["keyword", "fallthrough"], + ["keyword", "fileprivate"], + ["keyword", "final"], + ["keyword", "for"], + ["keyword", "func"], ["punctuation", ";"], + ["keyword", "get"], + ["keyword", "guard"], + ["keyword", "higherThan"], + ["keyword", "if"], + ["keyword", "import"], + ["keyword", "in"], + ["keyword", "indirect"], + ["keyword", "infix"], + ["keyword", "init"], + ["keyword", "inout"], + ["keyword", "internal"], + ["keyword", "is"], + ["keyword", "isolated"], + ["keyword", "lazy"], + ["keyword", "left"], + ["keyword", "let"], + ["keyword", "lowerThan"], + ["keyword", "mutating"], + ["keyword", "none"], + ["keyword", "nonisolated"], + ["keyword", "nonmutating"], + ["keyword", "open"], + ["keyword", "operator"], + ["keyword", "optional"], + ["keyword", "override"], + ["keyword", "postfix"], + ["keyword", "precedencegroup"], + ["keyword", "prefix"], + ["keyword", "private"], + ["keyword", "protocol"], + ["keyword", "public"], + ["keyword", "repeat"], + ["keyword", "required"], + ["keyword", "rethrows"], + ["keyword", "return"], + ["keyword", "right"], + ["keyword", "safe"], + ["keyword", "self"], + ["keyword", "set"], + ["keyword", "some"], + ["keyword", "static"], + ["keyword", "struct"], + ["keyword", "subscript"], + ["keyword", "super"], + ["keyword", "switch"], + ["keyword", "throw"], + ["keyword", "throws"], + ["keyword", "try"], + ["keyword", "typealias"], + ["keyword", "unowned"], + ["keyword", "unsafe"], + ["keyword", "var"], + ["keyword", "weak"], + ["keyword", "where"], + ["keyword", "while"], + ["keyword", "willSet"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/swift/label_feature.test b/package/src/prism/tests/languages/swift/label_feature.test new file mode 100644 index 00000000..22b23a94 --- /dev/null +++ b/package/src/prism/tests/languages/swift/label_feature.test @@ -0,0 +1,24 @@ +gameLoop: while square != finalSquare { + break gameLoop + continue gameLoop +} + +---------------------------------------------------- + +[ + ["label", "gameLoop"], + ["punctuation", ":"], + ["keyword", "while"], + " square ", + ["operator", "!="], + " finalSquare ", + ["punctuation", "{"], + + ["keyword", "break"], + ["label", " gameLoop"], + + ["keyword", "continue"], + ["label", " gameLoop"], + + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/swift/literal_feature.test b/package/src/prism/tests/languages/swift/literal_feature.test new file mode 100644 index 00000000..6d1b499f --- /dev/null +++ b/package/src/prism/tests/languages/swift/literal_feature.test @@ -0,0 +1,60 @@ +#file +#fileID +#filePath +#line +#column +#function +#dsohandle + +#colorLiteral(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0) +#fileLiteral(resourceName: "foo") +#imageLiteral(resourceName: "foo") + +---------------------------------------------------- + +[ + ["literal", "#file"], + ["literal", "#fileID"], + ["literal", "#filePath"], + ["literal", "#line"], + ["literal", "#column"], + ["literal", "#function"], + ["literal", "#dsohandle"], + + ["literal", "#colorLiteral"], + ["punctuation", "("], + "red", + ["punctuation", ":"], + ["number", "1.0"], + ["punctuation", ","], + " green", + ["punctuation", ":"], + ["number", "1.0"], + ["punctuation", ","], + " blue", + ["punctuation", ":"], + ["number", "1.0"], + ["punctuation", ","], + " alpha", + ["punctuation", ":"], + ["number", "1.0"], + ["punctuation", ")"], + + ["literal", "#fileLiteral"], + ["punctuation", "("], + "resourceName", + ["punctuation", ":"], + ["string-literal", [ + ["string", "\"foo\""] + ]], + ["punctuation", ")"], + + ["literal", "#imageLiteral"], + ["punctuation", "("], + "resourceName", + ["punctuation", ":"], + ["string-literal", [ + ["string", "\"foo\""] + ]], + ["punctuation", ")"] +] diff --git a/package/src/prism/tests/languages/swift/number_feature.test b/package/src/prism/tests/languages/swift/number_feature.test new file mode 100644 index 00000000..13fb0308 --- /dev/null +++ b/package/src/prism/tests/languages/swift/number_feature.test @@ -0,0 +1,25 @@ +42 +42_000 +3.1415_9 +4.2e14 +0xBaf_Face +0xFF47.AB_61p2 +0b0000_1111 +0o147_654 + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "42_000"], + ["number", "3.1415_9"], + ["number", "4.2e14"], + ["number", "0xBaf_Face"], + ["number", "0xFF47.AB_61p2"], + ["number", "0b0000_1111"], + ["number", "0o147_654"] +] + +---------------------------------------------------- + +Checks for decimal, hexadecimal, octal and binary numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/swift/omit_feature.test b/package/src/prism/tests/languages/swift/omit_feature.test new file mode 100644 index 00000000..2aee1a87 --- /dev/null +++ b/package/src/prism/tests/languages/swift/omit_feature.test @@ -0,0 +1,7 @@ +_ + +---------------------------------------------------- + +[ + ["omit", "_"] +] diff --git a/package/src/prism/tests/languages/swift/operator_feature.test b/package/src/prism/tests/languages/swift/operator_feature.test new file mode 100644 index 00000000..35adb25e --- /dev/null +++ b/package/src/prism/tests/languages/swift/operator_feature.test @@ -0,0 +1,115 @@ ++ - * / % ++= -= *= /= %= + +~ & | ^ << >> +~= &= |= ^= <<= >>= + +&+ &- &* &<< &>> +&+= &-= &*= &<<= &>>= + += +== != === !== <= >= < > +! && || + +..< ... + +-> + +?? + +// custom operators ++++ +prefix func +++ (vector: inout Vector2D) -> Vector2D {} + +// dot operators (SIMD) +.!= .== .< .> .<= .>= + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + ["operator", "%="], + + ["operator", "~"], + ["operator", "&"], + ["operator", "|"], + ["operator", "^"], + ["operator", "<<"], + ["operator", ">>"], + + ["operator", "~="], + ["operator", "&="], + ["operator", "|="], + ["operator", "^="], + ["operator", "<<="], + ["operator", ">>="], + + ["operator", "&+"], + ["operator", "&-"], + ["operator", "&*"], + ["operator", "&<<"], + ["operator", "&>>"], + + ["operator", "&+="], + ["operator", "&-="], + ["operator", "&*="], + ["operator", "&<<="], + ["operator", "&>>="], + + ["operator", "="], + + ["operator", "=="], + ["operator", "!="], + ["operator", "==="], + ["operator", "!=="], + ["operator", "<="], + ["operator", ">="], + ["operator", "<"], + ["operator", ">"], + + ["operator", "!"], + ["operator", "&&"], + ["operator", "||"], + + ["operator", "..<"], ["operator", "..."], + + ["operator", "->"], + + ["operator", "??"], + + ["comment", "// custom operators"], + + ["operator", "+++"], + + ["keyword", "prefix"], + ["keyword", "func"], + ["operator", "+++"], + ["punctuation", "("], + "vector", + ["punctuation", ":"], + ["keyword", "inout"], + ["class-name", "Vector2D"], + ["punctuation", ")"], + ["operator", "->"], + ["class-name", "Vector2D"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["comment", "// dot operators (SIMD)"], + + ["operator", ".!="], + ["operator", ".=="], + ["operator", ".<"], + ["operator", ".>"], + ["operator", ".<="], + ["operator", ".>="] +] diff --git a/package/src/prism/tests/languages/swift/punctuation_feature.test b/package/src/prism/tests/languages/swift/punctuation_feature.test new file mode 100644 index 00000000..475e7897 --- /dev/null +++ b/package/src/prism/tests/languages/swift/punctuation_feature.test @@ -0,0 +1,21 @@ +{ } [ ] ( ) +; , . : +\ + +---------------------------------------------------- + +[ + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", ";"], + ["punctuation", ","], + ["punctuation", "."], + ["punctuation", ":"], + + ["punctuation", "\\"] +] diff --git a/package/src/prism/tests/languages/swift/short-argument_feature.test b/package/src/prism/tests/languages/swift/short-argument_feature.test new file mode 100644 index 00000000..79d52895 --- /dev/null +++ b/package/src/prism/tests/languages/swift/short-argument_feature.test @@ -0,0 +1,20 @@ +reversedNames = names.sorted(by: { $0 > $1 } ) + +---------------------------------------------------- + +[ + "reversedNames ", + ["operator", "="], + " names", + ["punctuation", "."], + ["function", "sorted"], + ["punctuation", "("], + "by", + ["punctuation", ":"], + ["punctuation", "{"], + ["short-argument", "$0"], + ["operator", ">"], + ["short-argument", "$1"], + ["punctuation", "}"], + ["punctuation", ")"] +] diff --git a/package/src/prism/tests/languages/swift/string_feature.test b/package/src/prism/tests/languages/swift/string_feature.test new file mode 100644 index 00000000..1b812ae7 --- /dev/null +++ b/package/src/prism/tests/languages/swift/string_feature.test @@ -0,0 +1,134 @@ +"" +"fo\"o" +"foo\ +bar" + +"foo /* not a comment */ bar" +"foo\ +/* not a comment */\ +bar" + +let softWrappedQuotation = """ +The White Rabbit put on his spectacles. "Where shall I begin, \ +please your Majesty?" he asked. + +"Begin at the beginning," the King said gravely, "and go on \ +till you come to the end; then stop." +""" + +let threeMoreDoubleQuotationMarks = #""" +Here are three more double quotes: """ +"""# +#"Write an interpolated string in Swift using \(multiplier)."# + + +"foo \(42)" +"foo \(f("bar"))" +"\(multiplier) times 2.5 is \(Double(multiplier) * 2.5)" +#"6 times 7 is \#(6 * 7)."# + +---------------------------------------------------- + +[ + ["string-literal", [ + ["string", "\"\""] + ]], + ["string-literal", [ + ["string", "\"fo\\\"o\""] + ]], + ["string-literal", [ + ["string", "\"foo"], + ["punctuation", "\\"], + ["string", "\nbar\""] + ]], + + ["string-literal", [ + ["string", "\"foo /* not a comment */ bar\""] + ]], + ["string-literal", [ + ["string", "\"foo"], + ["punctuation", "\\"], + ["string", "\n/* not a comment */"], + ["punctuation", "\\"], + ["string", "\nbar\""] + ]], + + ["keyword", "let"], + " softWrappedQuotation ", + ["operator", "="], + ["string-literal", [ + ["string", "\"\"\"\nThe White Rabbit put on his spectacles. \"Where shall I begin, "], + ["punctuation", "\\"], + ["string", "\nplease your Majesty?\" he asked.\n\n\"Begin at the beginning,\" the King said gravely, \"and go on "], + ["punctuation", "\\"], + ["string", "\ntill you come to the end; then stop.\"\n\"\"\""] + ]], + + ["keyword", "let"], + " threeMoreDoubleQuotationMarks ", + ["operator", "="], + ["string-literal", [ + ["string", "#\"\"\"\nHere are three more double quotes: \"\"\"\n\"\"\"#"] + ]], + + ["string-literal", [ + ["string", "#\"Write an interpolated string in Swift using \\(multiplier).\"#"] + ]], + + ["string-literal", [ + ["string", "\"foo "], + ["interpolation-punctuation", "\\("], + ["interpolation", [ + ["number", "42"] + ]], + ["interpolation-punctuation", ")"], + ["string", "\""] + ]], + ["string-literal", [ + ["string", "\"foo "], + ["interpolation-punctuation", "\\("], + ["interpolation", [ + ["function", "f"], + ["punctuation", "("], + ["string-literal", [ + ["string", "\"bar\""] + ]], + ["punctuation", ")"] + ]], + ["interpolation-punctuation", ")"], + ["string", "\""] + ]], + ["string-literal", [ + ["string", "\""], + ["interpolation-punctuation", "\\("], + ["interpolation", ["multiplier"]], + ["interpolation-punctuation", ")"], + ["string", " times 2.5 is "], + ["interpolation-punctuation", "\\("], + ["interpolation", [ + ["class-name", "Double"], + ["punctuation", "("], + "multiplier", + ["punctuation", ")"], + ["operator", "*"], + ["number", "2.5"] + ]], + ["interpolation-punctuation", ")"], + ["string", "\""] + ]], + ["string-literal", [ + ["string", "#\"6 times 7 is "], + ["interpolation-punctuation", "\\#("], + ["interpolation", [ + ["number", "6"], + ["operator", "*"], + ["number", "7"] + ]], + ["interpolation-punctuation", ")"], + ["string", ".\"#"] + ]] +] + +---------------------------------------------------- + +Checks for strings and string interpolation. diff --git a/package/src/prism/tests/languages/systemd/boolean_feature.test b/package/src/prism/tests/languages/systemd/boolean_feature.test new file mode 100644 index 00000000..743dd8e1 --- /dev/null +++ b/package/src/prism/tests/languages/systemd/boolean_feature.test @@ -0,0 +1,46 @@ +foo=on +foo=true +foo=yes +foo=off +foo=false +foo=no + +---------------------------------------------------- + +[ + ["key", "foo"], + ["punctuation", "="], + ["value", [ + ["boolean", "on"] + ]], + + ["key", "foo"], + ["punctuation", "="], + ["value", [ + ["boolean", "true"] + ]], + + ["key", "foo"], + ["punctuation", "="], + ["value", [ + ["boolean", "yes"] + ]], + + ["key", "foo"], + ["punctuation", "="], + ["value", [ + ["boolean", "off"] + ]], + + ["key", "foo"], + ["punctuation", "="], + ["value", [ + ["boolean", "false"] + ]], + + ["key", "foo"], + ["punctuation", "="], + ["value", [ + ["boolean", "no"] + ]] +] diff --git a/package/src/prism/tests/languages/systemd/comment_feature.test b/package/src/prism/tests/languages/systemd/comment_feature.test new file mode 100644 index 00000000..d564a17a --- /dev/null +++ b/package/src/prism/tests/languages/systemd/comment_feature.test @@ -0,0 +1,9 @@ +# comment +; comment + +---------------------------------------------------- + +[ + ["comment", "# comment"], + ["comment", "; comment"] +] diff --git a/package/src/prism/tests/languages/systemd/key_feature.test b/package/src/prism/tests/languages/systemd/key_feature.test new file mode 100644 index 00000000..92d95c27 --- /dev/null +++ b/package/src/prism/tests/languages/systemd/key_feature.test @@ -0,0 +1,9 @@ +foo= +foo = + +---------------------------------------------------- + +[ + ["key", "foo"], ["punctuation", "="], + ["key", "foo"], ["punctuation", "="] +] diff --git a/package/src/prism/tests/languages/systemd/section_feature.test b/package/src/prism/tests/languages/systemd/section_feature.test new file mode 100644 index 00000000..9c6a00b5 --- /dev/null +++ b/package/src/prism/tests/languages/systemd/section_feature.test @@ -0,0 +1,11 @@ +[Section Foo] + +---------------------------------------------------- + +[ + ["section", [ + ["punctuation", "["], + ["section-name", "Section Foo"], + ["punctuation", "]"] + ]] +] diff --git a/package/src/prism/tests/languages/systemd/value_feature.test b/package/src/prism/tests/languages/systemd/value_feature.test new file mode 100644 index 00000000..43ba519b --- /dev/null +++ b/package/src/prism/tests/languages/systemd/value_feature.test @@ -0,0 +1,49 @@ +foo= value 2 + +foo="something" "some thing" "…" +foo= "something" "some thing" "…" +foo=value 2 \ + value 2 continued + +foo=value 3\ +# this line is ignored +; this line is ignored too + value 3 continued + +---------------------------------------------------- + +[ + ["key", "foo"], ["punctuation", "="], ["value", ["value 2"]], + + ["key", "foo"], + ["punctuation", "="], + ["value", [ + ["quoted", "\"something\""], + ["quoted", "\"some thing\""], + ["quoted", "\"…\""] + ]], + + ["key", "foo"], + ["punctuation", "="], + ["value", [ + ["quoted", "\"something\""], + ["quoted", "\"some thing\""], + ["quoted", "\"…\""] + ]], + + ["key", "foo"], + ["punctuation", "="], + ["value", [ + "value 2 ", ["punctuation", "\\"], + "\n value 2 continued" + ]], + + ["key", "foo"], + ["punctuation", "="], + ["value", [ + "value 3", ["punctuation", "\\"], + ["comment", "# this line is ignored"], + ["comment", "; this line is ignored too"], + "\n value 3 continued" + ]] +] diff --git a/package/src/prism/tests/languages/t4-cs/block_class-feature_feature.test b/package/src/prism/tests/languages/t4-cs/block_class-feature_feature.test new file mode 100644 index 00000000..2bb03b5a --- /dev/null +++ b/package/src/prism/tests/languages/t4-cs/block_class-feature_feature.test @@ -0,0 +1,27 @@ +Foo +<#+ +public class Bar {} +#> + +---------------------------------------------------- + +[ + "Foo\n", + ["block", [ + ["class-feature", [ + ["delimiter", "<#+"], + ["content", [ + ["keyword", "public"], + ["keyword", "class"], + ["class-name", ["Bar"]], + ["punctuation", "{"], + ["punctuation", "}"] + ]], + ["delimiter", "#>"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for class feature control blocks. diff --git a/package/src/prism/tests/languages/t4-cs/block_directive_feature.test b/package/src/prism/tests/languages/t4-cs/block_directive_feature.test new file mode 100644 index 00000000..f2c6a5a8 --- /dev/null +++ b/package/src/prism/tests/languages/t4-cs/block_directive_feature.test @@ -0,0 +1,149 @@ +<#@ template debug="false" hostspecific="false" language="C#" #> +<#@ assembly name="System" #> +<#@ assembly name="System.Core" #> +<#@ import namespace="System.Linq" #> +<#@ output extension=".cs" #> +<#@ include file="Foo.t4" #> +<#@ CleanupBehavior processor="T4VSHost" CleanupAfterProcessingtemplate="true" #> + +---------------------------------------------------- + +[ + ["block", [ + ["directive", [ + ["delimiter", "<#@"], + ["content", [ + ["keyword", "template"], + ["attr-name", "debug"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + "false", + ["punctuation", "\""] + ]], + ["attr-name", "hostspecific"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + "false", + ["punctuation", "\""] + ]], + ["attr-name", "language"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + "C#", + ["punctuation", "\""] + ]] + ]], + ["delimiter", "#>"] + ]] + ]], + ["block", [ + ["directive", [ + ["delimiter", "<#@"], + ["content", [ + ["keyword", "assembly"], + ["attr-name", "name"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + "System", + ["punctuation", "\""] + ]] + ]], + ["delimiter", "#>"] + ]] + ]], + ["block", [ + ["directive", [ + ["delimiter", "<#@"], + ["content", [ + ["keyword", "assembly"], + ["attr-name", "name"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + "System.Core", + ["punctuation", "\""] + ]] + ]], + ["delimiter", "#>"] + ]] + ]], + ["block", [ + ["directive", [ + ["delimiter", "<#@"], + ["content", [ + ["keyword", "import"], + ["attr-name", "namespace"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + "System.Linq", + ["punctuation", "\""] + ]] + ]], + ["delimiter", "#>"] + ]] + ]], + ["block", [ + ["directive", [ + ["delimiter", "<#@"], + ["content", [ + ["keyword", "output"], + ["attr-name", "extension"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + ".cs", + ["punctuation", "\""] + ]] + ]], + ["delimiter", "#>"] + ]] + ]], + ["block", [ + ["directive", [ + ["delimiter", "<#@"], + ["content", [ + ["keyword", "include"], + ["attr-name", "file"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + "Foo.t4", + ["punctuation", "\""] + ]] + ]], + ["delimiter", "#>"] + ]] + ]], + ["block", [ + ["directive", [ + ["delimiter", "<#@"], + ["content", [ + ["keyword", "CleanupBehavior"], + ["attr-name", "processor"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + "T4VSHost", + ["punctuation", "\""] + ]], + ["attr-name", "CleanupAfterProcessingtemplate"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + "true", + ["punctuation", "\""] + ]] + ]], + ["delimiter", "#>"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for text template directives. diff --git a/package/src/prism/tests/languages/t4-cs/block_expression_feature.test b/package/src/prism/tests/languages/t4-cs/block_expression_feature.test new file mode 100644 index 00000000..d1c241d8 --- /dev/null +++ b/package/src/prism/tests/languages/t4-cs/block_expression_feature.test @@ -0,0 +1,48 @@ +var a = <#= name + "abc" #>; +var b = new int[] { <#= + String.Join(", ", number.Select(Transformation)) + #> }; + +---------------------------------------------------- + +[ + "var a = ", + ["block", [ + ["expression", [ + ["delimiter", "<#="], + ["content", [ + " name ", + ["operator", "+"], + ["string", "\"abc\""] + ]], + ["delimiter", "#>"] + ]] + ]], + ";\nvar b = new int[] { ", + ["block", [ + ["expression", [ + ["delimiter", "<#="], + ["content", [ + "\n\tString", + ["punctuation", "."], + ["function", "Join"], + ["punctuation", "("], + ["string", "\", \""], + ["punctuation", ","], + " number", + ["punctuation", "."], + ["function", "Select"], + ["punctuation", "("], + "Transformation", + ["punctuation", ")"], + ["punctuation", ")"] + ]], + ["delimiter", "#>"] + ]] + ]], + " };" +] + +---------------------------------------------------- + +Checks for expression control blocks. diff --git a/package/src/prism/tests/languages/t4-cs/block_standard_feature.test b/package/src/prism/tests/languages/t4-cs/block_standard_feature.test new file mode 100644 index 00000000..223f0f2d --- /dev/null +++ b/package/src/prism/tests/languages/t4-cs/block_standard_feature.test @@ -0,0 +1,78 @@ +<# + for (var i = 0; i < 10; i++) + { + if (i % 2 == 0) + { +#> +The number <#= i #> is even. +<# + } + } +#> + +---------------------------------------------------- + +[ + ["block", [ + ["standard", [ + ["delimiter", "<#"], + ["content", [ + ["keyword", "for"], + ["punctuation", "("], + ["class-name", [ + ["keyword", "var"] + ]], + " i ", + ["operator", "="], + ["number", "0"], + ["punctuation", ";"], + " i ", + ["operator", "<"], + ["number", "10"], + ["punctuation", ";"], + " i", + ["operator", "++"], + ["punctuation", ")"], + + ["punctuation", "{"], + + ["keyword", "if"], + ["punctuation", "("], + "i ", + ["operator", "%"], + ["number", "2"], + ["operator", "=="], + ["number", "0"], + ["punctuation", ")"], + + ["punctuation", "{"] + ]], + ["delimiter", "#>"] + ]] + ]], + + "\nThe number ", + ["block", [ + ["expression", [ + ["delimiter", "<#="], + ["content", [" i "]], + ["delimiter", "#>"] + ]] + ]], + " is even.\n", + + ["block", [ + ["standard", [ + ["delimiter", "<#"], + ["content", [ + ["punctuation", "}"], + ["punctuation", "}"] + ]], + ["delimiter", "#>"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for standard control blocks. diff --git a/package/src/prism/tests/languages/t4-vb/block_feature.test b/package/src/prism/tests/languages/t4-vb/block_feature.test new file mode 100644 index 00000000..8365057d --- /dev/null +++ b/package/src/prism/tests/languages/t4-vb/block_feature.test @@ -0,0 +1,112 @@ +<#@ template debug="false" hostspecific="false" language="VB" #> + +<#+ +Public Class Bar +End Class +#> + +<# + For i As Integer = 0 To 9 + If i Mod 2 = 0 Then +#> +The number <#= i #> is even. +<# + End If + Next i +#> + +---------------------------------------------------- + +[ + ["block", [ + ["directive", [ + ["delimiter", "<#@"], + ["content", [ + ["keyword", "template"], + ["attr-name", "debug"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + "false", + ["punctuation", "\""] + ]], + ["attr-name", "hostspecific"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + "false", + ["punctuation", "\""] + ]], + ["attr-name", "language"], + ["attr-value", [ + ["punctuation", "="], + ["punctuation", "\""], + "VB", + ["punctuation", "\""] + ]] + ]], + ["delimiter", "#>"] + ]] + ]], + + ["block", [ + ["class-feature", [ + ["delimiter", "<#+"], + ["content", [ + ["keyword", "Public"], ["keyword", "Class"], " Bar\n", + ["keyword", "End"], ["keyword", "Class"] + ]], + ["delimiter", "#>"] + ]] + ]], + + ["block", [ + ["standard", [ + ["delimiter", "<#"], + ["content", [ + ["keyword", "For"], + " i ", + ["keyword", "As"], + ["keyword", "Integer"], + ["operator", "="], + ["number", "0"], + ["keyword", "To"], + ["number", "9"], + + ["keyword", "If"], + " i ", + ["keyword", "Mod"], + ["number", "2"], + ["operator", "="], + ["number", "0"], + ["keyword", "Then"] + ]], + ["delimiter", "#>"] + ]] + ]], + + "\nThe number ", + ["block", [ + ["expression", [ + ["delimiter", "<#="], + ["content", [" i "]], + ["delimiter", "#>"] + ]] + ]], + " is even.\n", + + ["block", [ + ["standard", [ + ["delimiter", "<#"], + ["content", [ + ["keyword", "End"], ["keyword", "If"], + ["keyword", "Next"], " i\n" + ]], + ["delimiter", "#>"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for standard control blocks. diff --git a/package/src/prism/tests/languages/tap/bail_out_feature.test b/package/src/prism/tests/languages/tap/bail_out_feature.test new file mode 100644 index 00000000..eba81647 --- /dev/null +++ b/package/src/prism/tests/languages/tap/bail_out_feature.test @@ -0,0 +1,13 @@ +Bail out! Couldn't connect to database. +bail out! Failed to call API. + +---------------------------------------------------- + +[ + ["bailout", "Bail out! Couldn't connect to database."], + ["bailout", "bail out! Failed to call API."] +] + +---------------------------------------------------- + +Checks bail out diff --git a/package/src/prism/tests/languages/tap/directive_feature.test b/package/src/prism/tests/languages/tap/directive_feature.test new file mode 100644 index 00000000..5a3ff910 --- /dev/null +++ b/package/src/prism/tests/languages/tap/directive_feature.test @@ -0,0 +1,15 @@ +ok # SKIP test not written +ok 42 this is the description # TODO write test + +---------------------------------------------------- + +[ + ["pass", "ok " ], + ["directive", "# SKIP test not written"], + ["pass", "ok 42 this is the description "], + ["directive", "# TODO write test"] +] + +---------------------------------------------------- + +Checks directives diff --git a/package/src/prism/tests/languages/tap/pass_fail_feature.test b/package/src/prism/tests/languages/tap/pass_fail_feature.test new file mode 100644 index 00000000..d0782990 --- /dev/null +++ b/package/src/prism/tests/languages/tap/pass_fail_feature.test @@ -0,0 +1,17 @@ +not ok +not ok 42 this is the description of the test +ok +ok 42 this is the description of the test + +---------------------------------------------------- + +[ + ["fail", "not ok" ], + ["fail", "not ok 42 this is the description of the test"], + ["pass", "ok" ], + ["pass", "ok 42 this is the description of the test"] +] + +---------------------------------------------------- + +Checks test pass & fail together correctly diff --git a/package/src/prism/tests/languages/tap/plan_feature.test b/package/src/prism/tests/languages/tap/plan_feature.test new file mode 100644 index 00000000..8bdcd4e7 --- /dev/null +++ b/package/src/prism/tests/languages/tap/plan_feature.test @@ -0,0 +1,13 @@ +1..10 +1..10 # directive + +---------------------------------------------------- + +[ + ["plan", "1..10" ], + ["plan", "1..10 # directive" ] +] + +---------------------------------------------------- + +Checks TAP plan diff --git a/package/src/prism/tests/languages/tap/pragma_feature.test b/package/src/prism/tests/languages/tap/pragma_feature.test new file mode 100644 index 00000000..7775f2e5 --- /dev/null +++ b/package/src/prism/tests/languages/tap/pragma_feature.test @@ -0,0 +1,13 @@ +pragma +strict +pragma -strict + +---------------------------------------------------- + +[ + ["pragma", "pragma +strict"], + ["pragma", "pragma -strict"] +] + +---------------------------------------------------- + +Checks pragma diff --git a/package/src/prism/tests/languages/tap/subtest_feature.test b/package/src/prism/tests/languages/tap/subtest_feature.test new file mode 100644 index 00000000..14b1339a --- /dev/null +++ b/package/src/prism/tests/languages/tap/subtest_feature.test @@ -0,0 +1,7 @@ +# Subtest + +---------------------------------------------------- + +[ + ["subtest", "# Subtest"] +] diff --git a/package/src/prism/tests/languages/tap/version_feature.test b/package/src/prism/tests/languages/tap/version_feature.test new file mode 100644 index 00000000..333f0b8c --- /dev/null +++ b/package/src/prism/tests/languages/tap/version_feature.test @@ -0,0 +1,11 @@ +TAP version 13 + +---------------------------------------------------- + +[ + ["version", "TAP version 13" ] +] + +---------------------------------------------------- + +Checks TAP version diff --git a/package/src/prism/tests/languages/tap/yamlish_feature.test b/package/src/prism/tests/languages/tap/yamlish_feature.test new file mode 100644 index 00000000..ab2cf599 --- /dev/null +++ b/package/src/prism/tests/languages/tap/yamlish_feature.test @@ -0,0 +1,61 @@ +ok + --- + message: "Failed with error 'hostname peebles.example.com not found'" + severity: fail + data: + got: + hostname: 'peebles.example.com' + address: ~ + expected: + hostname: 'peebles.example.com' + address: '85.193.201.85' + ... + +---------------------------------------------------- + +[ + ["pass", "ok"], + + ["yamlish", [ + ["punctuation", "---"], + + ["key", "message"], + ["punctuation", ":"], + ["string", "\"Failed with error 'hostname peebles.example.com not found'\""], + + ["key", "severity"], + ["punctuation", ":"], + " fail\n ", + + ["key", "data"], + ["punctuation", ":"], + + ["key", "got"], + ["punctuation", ":"], + + ["key", "hostname"], + ["punctuation", ":"], + ["string", "'peebles.example.com'"], + + ["key", "address"], + ["punctuation", ":"], + ["null", "~"], + + ["key", "expected"], + ["punctuation", ":"], + + ["key", "hostname"], + ["punctuation", ":"], + ["string", "'peebles.example.com'"], + + ["key", "address"], + ["punctuation", ":"], + ["string", "'85.193.201.85'"], + + ["punctuation", "..."] + ]] +] + +---------------------------------------------------- + +Checks yaml embedding diff --git a/package/src/prism/tests/languages/tcl/builtin_feature.test b/package/src/prism/tests/languages/tcl/builtin_feature.test new file mode 100644 index 00000000..e212483f --- /dev/null +++ b/package/src/prism/tests/languages/tcl/builtin_feature.test @@ -0,0 +1,35 @@ +proc +return +class +error +eval +exit +for +foreach +if elseif else +switch +while +break +continue + +---------------------------------------------------- + +[ + ["builtin", "proc"], + ["builtin", "return"], + ["builtin", "class"], + ["builtin", "error"], + ["builtin", "eval"], + ["builtin", "exit"], + ["builtin", "for"], + ["builtin", "foreach"], + ["builtin", "if"], ["builtin", "elseif"], ["builtin", "else"], + ["builtin", "switch"], + ["builtin", "while"], + ["builtin", "break"], + ["builtin", "continue"] +] + +---------------------------------------------------- + +Checks for builtins. \ No newline at end of file diff --git a/package/src/prism/tests/languages/tcl/comment_feature.test b/package/src/prism/tests/languages/tcl/comment_feature.test new file mode 100644 index 00000000..710014b8 --- /dev/null +++ b/package/src/prism/tests/languages/tcl/comment_feature.test @@ -0,0 +1,13 @@ +# +# foobar + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/tcl/function_feature.test b/package/src/prism/tests/languages/tcl/function_feature.test new file mode 100644 index 00000000..d062385d --- /dev/null +++ b/package/src/prism/tests/languages/tcl/function_feature.test @@ -0,0 +1,15 @@ +proc foo +proc Foobar +proc foo_bar_42 + +---------------------------------------------------- + +[ + ["builtin", "proc"], ["function", "foo"], + ["builtin", "proc"], ["function", "Foobar"], + ["builtin", "proc"], ["function", "foo_bar_42"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/tcl/keyword_feature.test b/package/src/prism/tests/languages/tcl/keyword_feature.test new file mode 100644 index 00000000..d8dbb5d0 --- /dev/null +++ b/package/src/prism/tests/languages/tcl/keyword_feature.test @@ -0,0 +1,213 @@ +after +append +apply +array +auto_execok +auto_import +auto_load +auto_mkindex +auto_qualify +auto_reset +automkindex_old +bgerror +binary +catch +cd +chan +clock +close +concat +dde +dict +encoding +eof +exec +expr +fblocked +fconfigure +fcopy +file +fileevent +filename +flush +gets +glob +history +http +incr +info +interp +join +lappend +lassign +lindex +linsert +list +llength +load +lrange +lrepeat +lreplace +lreverse +lsearch +lset +lsort +mathfunc +mathop +memory +msgcat +namespace +open +package +parray +pid +pkg_mkIndex +platform +puts +pwd +re_syntax +read +refchan +regexp +registry +regsub +rename +Safe_Base +scan +seek +set +socket +source +split +string +subst +Tcl +tcl_endOfWord +tcl_findLibrary +tclstartOfNextWord +tclstartOfPreviousWord +tclwordBreakAfter +tclwordBreakBefore +tcltest +tclvars +tell +time +tm +trace +unknown +unload +unset +update +uplevel +vwait + +---------------------------------------------------- + +[ + ["keyword", "after"], + ["keyword", "append"], + ["keyword", "apply"], + ["keyword", "array"], + ["keyword", "auto_execok"], + ["keyword", "auto_import"], + ["keyword", "auto_load"], + ["keyword", "auto_mkindex"], + ["keyword", "auto_qualify"], + ["keyword", "auto_reset"], + ["keyword", "automkindex_old"], + ["keyword", "bgerror"], + ["keyword", "binary"], + ["keyword", "catch"], + ["keyword", "cd"], + ["keyword", "chan"], + ["keyword", "clock"], + ["keyword", "close"], + ["keyword", "concat"], + ["keyword", "dde"], + ["keyword", "dict"], + ["keyword", "encoding"], + ["keyword", "eof"], + ["keyword", "exec"], + ["keyword", "expr"], + ["keyword", "fblocked"], + ["keyword", "fconfigure"], + ["keyword", "fcopy"], + ["keyword", "file"], + ["keyword", "fileevent"], + ["keyword", "filename"], + ["keyword", "flush"], + ["keyword", "gets"], + ["keyword", "glob"], + ["keyword", "history"], + ["keyword", "http"], + ["keyword", "incr"], + ["keyword", "info"], + ["keyword", "interp"], + ["keyword", "join"], + ["keyword", "lappend"], + ["keyword", "lassign"], + ["keyword", "lindex"], + ["keyword", "linsert"], + ["keyword", "list"], + ["keyword", "llength"], + ["keyword", "load"], + ["keyword", "lrange"], + ["keyword", "lrepeat"], + ["keyword", "lreplace"], + ["keyword", "lreverse"], + ["keyword", "lsearch"], + ["keyword", "lset"], + ["keyword", "lsort"], + ["keyword", "mathfunc"], + ["keyword", "mathop"], + ["keyword", "memory"], + ["keyword", "msgcat"], + ["keyword", "namespace"], + ["keyword", "open"], + ["keyword", "package"], + ["keyword", "parray"], + ["keyword", "pid"], + ["keyword", "pkg_mkIndex"], + ["keyword", "platform"], + ["keyword", "puts"], + ["keyword", "pwd"], + ["keyword", "re_syntax"], + ["keyword", "read"], + ["keyword", "refchan"], + ["keyword", "regexp"], + ["keyword", "registry"], + ["keyword", "regsub"], + ["keyword", "rename"], + ["keyword", "Safe_Base"], + ["keyword", "scan"], + ["keyword", "seek"], + ["keyword", "set"], + ["keyword", "socket"], + ["keyword", "source"], + ["keyword", "split"], + ["keyword", "string"], + ["keyword", "subst"], + ["keyword", "Tcl"], + ["keyword", "tcl_endOfWord"], + ["keyword", "tcl_findLibrary"], + ["keyword", "tclstartOfNextWord"], + ["keyword", "tclstartOfPreviousWord"], + ["keyword", "tclwordBreakAfter"], + ["keyword", "tclwordBreakBefore"], + ["keyword", "tcltest"], + ["keyword", "tclvars"], + ["keyword", "tell"], + ["keyword", "time"], + ["keyword", "tm"], + ["keyword", "trace"], + ["keyword", "unknown"], + ["keyword", "unload"], + ["keyword", "unset"], + ["keyword", "update"], + ["keyword", "uplevel"], + ["keyword", "vwait"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/tcl/operator_feature.test b/package/src/prism/tests/languages/tcl/operator_feature.test new file mode 100644 index 00000000..25426b41 --- /dev/null +++ b/package/src/prism/tests/languages/tcl/operator_feature.test @@ -0,0 +1,45 @@ ++ +- +~ +! != +* ** +/ +% +< <= << +> >= >> +== +& && +| || +? +^ +eq +ne +in +ni + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "~"], + ["operator", "!"], ["operator", "!="], + ["operator", "*"], ["operator", "**"], + ["operator", "/"], + ["operator", "%"], + ["operator", "<"], ["operator", "<="], ["operator", "<<"], + ["operator", ">"], ["operator", ">="], ["operator", ">>"], + ["operator", "=="], + ["operator", "&"], ["operator", "&&"], + ["operator", "|"], ["operator", "||"], + ["operator", "?"], + ["operator", "^"], + ["operator", "eq"], + ["operator", "ne"], + ["operator", "in"], + ["operator", "ni"] +] + +---------------------------------------------------- + +Checks for all operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/tcl/punctuation_feature.test b/package/src/prism/tests/languages/tcl/punctuation_feature.test new file mode 100644 index 00000000..62fc1d09 --- /dev/null +++ b/package/src/prism/tests/languages/tcl/punctuation_feature.test @@ -0,0 +1,12 @@ +{ } ( ) [ ] + +---------------------------------------------------- + +[ + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"] +] diff --git a/package/src/prism/tests/languages/tcl/scope_feature.test b/package/src/prism/tests/languages/tcl/scope_feature.test new file mode 100644 index 00000000..178e8775 --- /dev/null +++ b/package/src/prism/tests/languages/tcl/scope_feature.test @@ -0,0 +1,15 @@ +global +upvar +variable + +---------------------------------------------------- + +[ + ["scope", "global"], + ["scope", "upvar"], + ["scope", "variable"] +] + +---------------------------------------------------- + +Checks for scopes. \ No newline at end of file diff --git a/package/src/prism/tests/languages/tcl/string_feature.test b/package/src/prism/tests/languages/tcl/string_feature.test new file mode 100644 index 00000000..888cfcec --- /dev/null +++ b/package/src/prism/tests/languages/tcl/string_feature.test @@ -0,0 +1,16 @@ +"" +"fo\"obar" +"fo\"o\ +bar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""], + ["string", "\"fo\\\"o\\\nbar\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/tcl/variable_feature.test b/package/src/prism/tests/languages/tcl/variable_feature.test new file mode 100644 index 00000000..4271636d --- /dev/null +++ b/package/src/prism/tests/languages/tcl/variable_feature.test @@ -0,0 +1,31 @@ +$foo +$Foobar_42 +$::foo +$foo::bar42 + +${foobar} + +set foo bar +set Foobar_42 baz +set ::foo bar +set foo::bar42 baz + +---------------------------------------------------- + +[ + "$", ["variable", "foo"], + "\n$", ["variable", "Foobar_42"], + "\n$", ["variable", "::foo"], + "\n$", ["variable", "foo::bar42"], + + "\n\n$", ["variable", "{foobar}"], + + ["keyword", "set"], ["variable", "foo"], " bar\n", + ["keyword", "set"], ["variable", "Foobar_42"], " baz\n", + ["keyword", "set"], ["variable", "::foo"], " bar\n", + ["keyword", "set"], ["variable", "foo::bar42"], " baz" +] + +---------------------------------------------------- + +Checks for variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/textile+haml/textile_inclusion.test b/package/src/prism/tests/languages/textile+haml/textile_inclusion.test new file mode 100644 index 00000000..50e1f374 --- /dev/null +++ b/package/src/prism/tests/languages/textile+haml/textile_inclusion.test @@ -0,0 +1,42 @@ +:textile +
    + +~ + :textile +
    + +---------------------------------------------------- + +[ + ["filter-textile", [ + ["filter-name", ":textile"], + ["text", [ + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", ""] + ]] + ]] + ]], + ["punctuation", "~"], + ["filter-textile", [ + ["filter-name", ":textile"], + ["text", [ + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", ""] + ]] + ]] + ]] +] diff --git a/package/src/prism/tests/languages/textile/acronym_feature.test b/package/src/prism/tests/languages/textile/acronym_feature.test new file mode 100644 index 00000000..af50f41e --- /dev/null +++ b/package/src/prism/tests/languages/textile/acronym_feature.test @@ -0,0 +1,15 @@ +CSS(Cascading Style Sheet) +HTML(HyperText Markup Language) + +---------------------------------------------------- + +[ + ["phrase", [ + ["acronym", ["CSS", ["punctuation", "("], ["comment", "Cascading Style Sheet"], ["punctuation", ")"]]], + ["acronym", ["HTML", ["punctuation", "("], ["comment", "HyperText Markup Language"], ["punctuation", ")"]]] + ]] +] + +---------------------------------------------------- + +Checks for acronyms. \ No newline at end of file diff --git a/package/src/prism/tests/languages/textile/block-tag_feature.test b/package/src/prism/tests/languages/textile/block-tag_feature.test new file mode 100644 index 00000000..eee26eb1 --- /dev/null +++ b/package/src/prism/tests/languages/textile/block-tag_feature.test @@ -0,0 +1,171 @@ +h1. Header 1 + +h2>. Header 2 + +bq. A block quotation + +p<. Foo + +p=. Bar + +p<>. Baz + +p(. Foobar +baz + +p))). Foo + +h1(foo). Foo + +h2[en]. Bar + +h3{color: red}. Baz + +h4[fr]{text-decoration:underline;}(#bar). Foobar + +---------------------------------------------------- + +[ + ["phrase", [ + ["block-tag", [ + ["tag", "h1"], + ["punctuation", "."] + ]], + " Header 1" + ]], + + ["phrase", [ + ["block-tag", [ + ["tag", "h2"], + ["modifier", [ + ["punctuation", ">"] + ]], + ["punctuation", "."] + ]], + " Header 2" + ]], + + ["phrase", [ + ["block-tag", [ + ["tag", "bq"], + ["punctuation", "."] + ]], + " A block quotation" + ]], + + ["phrase", [ + ["block-tag", [ + ["tag", "p"], + ["modifier", [ + ["punctuation", "<"] + ]], + ["punctuation", "."] + ]], + " Foo" + ]], + + ["phrase", [ + ["block-tag", [ + ["tag", "p"], + ["modifier", [ + ["punctuation", "="] + ]], + ["punctuation", "."] + ]], + " Bar" + ]], + + ["phrase", [ + ["block-tag", [ + ["tag", "p"], + ["modifier", [ + ["punctuation", "<"], + ["punctuation", ">"] + ]], + ["punctuation", "."] + ]], + " Baz" + ]], + + ["phrase", [ + ["block-tag", [ + ["tag", "p"], + ["modifier", [ + ["punctuation", "("] + ]], + ["punctuation", "."] + ]], + " Foobar\nbaz" + ]], + + ["phrase", [ + ["block-tag", [ + ["tag", "p"], + ["modifier", [ + ["punctuation", ")"], + ["punctuation", ")"], + ["punctuation", ")"] + ]], + ["punctuation", "."] + ]], + " Foo" + ]], + + ["phrase", [ + ["block-tag", [ + ["tag", "h1"], + ["modifier", [ + ["punctuation", "("], + ["class-id", "foo"], + ["punctuation", ")"] + ]], + ["punctuation", "."] + ]], + " Foo" + ]], + + ["phrase", [ + ["block-tag", [ + ["tag", "h2"], + ["modifier", [ + ["punctuation", "["], + ["lang", "en"], + ["punctuation", "]"] + ]], + ["punctuation", "."] + ]], + " Bar" + ]], + + ["phrase", [ + ["block-tag", [ + ["tag", "h3"], + ["modifier", [ + ["css", "{color: red}"] + ]], + ["punctuation", "."] + ]], + " Baz" + ]], + + ["phrase", [ + ["block-tag", [ + ["tag", "h4"], + ["modifier", [ + ["punctuation", "["], + ["lang", "fr"], + ["punctuation", "]"], + ["css", "{text-decoration:underline;}"], + ["punctuation", "("], + ["class-id", "#bar"], + ["punctuation", ")"] + ]], + ["punctuation", "."] + ]], + " Foobar" + ]] +] + +---------------------------------------------------- + +Checks for tags at the beginning of a block and alignment modifiers. diff --git a/package/src/prism/tests/languages/textile/footnote_feature.test b/package/src/prism/tests/languages/textile/footnote_feature.test new file mode 100644 index 00000000..5aa064b2 --- /dev/null +++ b/package/src/prism/tests/languages/textile/footnote_feature.test @@ -0,0 +1,15 @@ +Foo[1] +Bar[42] + +---------------------------------------------------- + +[ + ["phrase", [ + "Foo", ["footnote", [["punctuation", "["], "1", ["punctuation", "]"]]], + "\nBar", ["footnote", [["punctuation", "["], "42", ["punctuation", "]"]]] + ]] +] + +---------------------------------------------------- + +Checks for footnotes. \ No newline at end of file diff --git a/package/src/prism/tests/languages/textile/image_feature.test b/package/src/prism/tests/languages/textile/image_feature.test new file mode 100644 index 00000000..0507e820 --- /dev/null +++ b/package/src/prism/tests/languages/textile/image_feature.test @@ -0,0 +1,76 @@ +!foo.png! +!bar.jpg(Foo bar)! +!foo.png!:http://prismjs.com +!bar.jpg(Foo bar)!:http://www.example.com + +!bar.jpg! +!(foo)[en]{border:1px solid #ccc}foo.png! + +---------------------------------------------------- + +[ + ["phrase", [ + ["image", [ + ["punctuation", "!"], + ["source", "foo.png"], + ["punctuation", "!"] + ]], + ["image", [ + ["punctuation", "!"], + ["source", "bar.jpg(Foo bar)"], + ["punctuation", "!"] + ]], + ["image", [ + ["punctuation", "!"], + ["source", "foo.png"], + ["punctuation", "!"], + ["punctuation", ":"], + ["url", "http://prismjs.com"] + ]], + ["image", [ + ["punctuation", "!"], + ["source", "bar.jpg(Foo bar)"], + ["punctuation", "!"], + ["punctuation", ":"], + ["url", "http://www.example.com"] + ]] + ]], + + ["phrase", [ + ["image", [ + ["punctuation", "!"], + ["modifier", [ + ["punctuation", "<"] + ]], + ["source", "foo.png"], + ["punctuation", "!"] + ]], + ["image", [ + ["punctuation", "!"], + ["modifier", [ + ["punctuation", ">"] + ]], + ["source", "bar.jpg"], + ["punctuation", "!"] + ]], + + ["image", [ + ["punctuation", "!"], + ["modifier", [ + ["punctuation", "("], + ["class-id", "foo"], + ["punctuation", ")"], + ["punctuation", "["], + ["lang", "en"], + ["punctuation", "]"], + ["css", "{border:1px solid #ccc}"] + ]], + ["source", "foo.png"], + ["punctuation", "!"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for images. diff --git a/package/src/prism/tests/languages/textile/inline_feature.test b/package/src/prism/tests/languages/textile/inline_feature.test new file mode 100644 index 00000000..b4ff73c0 --- /dev/null +++ b/package/src/prism/tests/languages/textile/inline_feature.test @@ -0,0 +1,512 @@ +*bold* +**bold** +_italic_ +__italic__ +??cite?? +@code@ ++inserted+ +-deleted- +%span% +^superscript^ +~subscript~ + +*{color:red}bold* +__(foo#bar)[fr]italique__ +%{text-decoration:underline}span *[en]bold*% + +*_a_ __b__ ??c?? @d@ +e+ -f- %g% ^h^ ~i~* +**_a_ __b__ ??c?? @d@ +e+ -f- %g% ^h^ ~i~** +_*a* **b** ??c?? @d@ +e+ -f- %g% ^h^ ~i~_ +__*a* **b** ??c?? @d@ +e+ -f- %g% ^h^ ~i~__ ++*a* **b** _c_ __d__ ??e?? @f@ -g- %h% ^i^ ~j~+ +-*a* **b** _c_ __d__ ??e?? @f@ +g+ %h% ^i^ ~j~- +%*a* **b** _c_ __d__ ??e?? @f@ +g+ -h- ^i^ ~j~% + +not_italic_ _this_either + +---------------------------------------------------- + +[ + ["phrase", [ + ["inline", [ + ["punctuation", "*"], + ["bold", ["bold"]], + ["punctuation", "*"] + ]], + ["inline", [ + ["punctuation", "**"], + ["bold", ["bold"]], + ["punctuation", "**"] + ]], + ["inline", [ + ["punctuation", "_"], + ["italic", ["italic"]], + ["punctuation", "_"] + ]], + ["inline", [ + ["punctuation", "__"], + ["italic", ["italic"]], + ["punctuation", "__"] + ]], + ["inline", [ + ["punctuation", "??"], + ["cite", "cite"], + ["punctuation", "??"] + ]], + ["inline", [ + ["punctuation", "@"], + ["code", "code"], + ["punctuation", "@"] + ]], + ["inline", [ + ["punctuation", "+"], + ["inserted", ["inserted"]], + ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "-"], + ["deleted", ["deleted"]], + ["punctuation", "-"] + ]], + ["inline", [ + ["punctuation", "%"], + ["span", ["span"]], + ["punctuation", "%"] + ]], + ["inline", [ + ["punctuation", "^"], + "superscript", + ["punctuation", "^"] + ]], + ["inline", [ + ["punctuation", "~"], + "subscript", + ["punctuation", "~"] + ]] + ]], + + ["phrase", [ + ["inline", [ + ["punctuation", "*"], + ["modifier", [ + ["css", "{color:red}"] + ]], + ["bold", ["bold"]], + ["punctuation", "*"] + ]], + ["inline", [ + ["punctuation", "__"], + ["modifier", [ + ["punctuation", "("], + ["class-id", "foo#bar"], + ["punctuation", ")"], + ["punctuation", "["], + ["lang", "fr"], + ["punctuation", "]"] + ]], + ["italic", ["italique"]], + ["punctuation", "__"] + ]], + ["inline", [ + ["punctuation", "%"], + ["modifier", [ + ["css", "{text-decoration:underline}"] + ]], + ["span", [ + "span ", + ["inline", [ + ["punctuation", "*"], + ["modifier", [ + ["punctuation", "["], + ["lang", "en"], + ["punctuation", "]"] + ]], + ["bold", ["bold"]], + ["punctuation", "*"] + ]] + ]], + ["punctuation", "%"] + ]] + ]], + + ["phrase", [ + ["inline", [ + ["punctuation", "*"], + ["bold", [ + ["inline", [ + ["punctuation", "_"], + ["italic", ["a"]], + ["punctuation", "_"] + ]], + ["inline", [ + ["punctuation", "__"], + ["italic", ["b"]], + ["punctuation", "__"] + ]], + ["inline", [ + ["punctuation", "??"], + ["cite", "c"], + ["punctuation", "??"] + ]], + ["inline", [ + ["punctuation", "@"], + ["code", "d"], + ["punctuation", "@"] + ]], + ["inline", [ + ["punctuation", "+"], + ["inserted", ["e"]], + ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "-"], + ["deleted", ["f"]], + ["punctuation", "-"] + ]], + ["inline", [ + ["punctuation", "%"], + ["span", ["g"]], + ["punctuation", "%"] + ]], + ["inline", [ + ["punctuation", "^"], + "h", + ["punctuation", "^"] + ]], + ["inline", [ + ["punctuation", "~"], + "i", + ["punctuation", "~"] + ]] + ]], + ["punctuation", "*"] + ]], + ["inline", [ + ["punctuation", "**"], + ["bold", [ + ["inline", [ + ["punctuation", "_"], + ["italic", ["a"]], + ["punctuation", "_"] + ]], + ["inline", [ + ["punctuation", "__"], + ["italic", ["b"]], + ["punctuation", "__"] + ]], + ["inline", [ + ["punctuation", "??"], + ["cite", "c"], + ["punctuation", "??"] + ]], + ["inline", [ + ["punctuation", "@"], + ["code", "d"], + ["punctuation", "@"] + ]], + ["inline", [ + ["punctuation", "+"], + ["inserted", ["e"]], + ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "-"], + ["deleted", ["f"]], + ["punctuation", "-"] + ]], + ["inline", [ + ["punctuation", "%"], + ["span", ["g"]], + ["punctuation", "%"] + ]], + ["inline", [ + ["punctuation", "^"], + "h", + ["punctuation", "^"] + ]], + ["inline", [ + ["punctuation", "~"], + "i", + ["punctuation", "~"] + ]] + ]], + ["punctuation", "**"] + ]], + ["inline", [ + ["punctuation", "_"], + ["italic", [ + ["inline", [ + ["punctuation", "*"], + ["bold", ["a"]], + ["punctuation", "*"] + ]], + ["inline", [ + ["punctuation", "**"], + ["bold", ["b"]], + ["punctuation", "**"] + ]], + ["inline", [ + ["punctuation", "??"], + ["cite", "c"], + ["punctuation", "??"] + ]], + ["inline", [ + ["punctuation", "@"], + ["code", "d"], + ["punctuation", "@"] + ]], + ["inline", [ + ["punctuation", "+"], + ["inserted", ["e"]], + ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "-"], + ["deleted", ["f"]], + ["punctuation", "-"] + ]], + ["inline", [ + ["punctuation", "%"], + ["span", ["g"]], + ["punctuation", "%"] + ]], + ["inline", [ + ["punctuation", "^"], + "h", + ["punctuation", "^"] + ]], + ["inline", [ + ["punctuation", "~"], + "i", + ["punctuation", "~"] + ]] + ]], + ["punctuation", "_"] + ]], + ["inline", [ + ["punctuation", "__"], + ["italic", [ + ["inline", [ + ["punctuation", "*"], + ["bold", ["a"]], + ["punctuation", "*"] + ]], + ["inline", [ + ["punctuation", "**"], + ["bold", ["b"]], + ["punctuation", "**"] + ]], + ["inline", [ + ["punctuation", "??"], + ["cite", "c"], + ["punctuation", "??"] + ]], + ["inline", [ + ["punctuation", "@"], + ["code", "d"], + ["punctuation", "@"] + ]], + ["inline", [ + ["punctuation", "+"], + ["inserted", ["e"]], + ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "-"], + ["deleted", ["f"]], + ["punctuation", "-"] + ]], + ["inline", [ + ["punctuation", "%"], + ["span", ["g"]], + ["punctuation", "%"] + ]], + ["inline", [ + ["punctuation", "^"], + "h", + ["punctuation", "^"] + ]], + ["inline", [ + ["punctuation", "~"], + "i", + ["punctuation", "~"] + ]] + ]], + ["punctuation", "__"] + ]], + ["inline", [ + ["punctuation", "+"], + ["inserted", [ + ["inline", [ + ["punctuation", "*"], + ["bold", ["a"]], + ["punctuation", "*"] + ]], + ["inline", [ + ["punctuation", "**"], + ["bold", ["b"]], + ["punctuation", "**"] + ]], + ["inline", [ + ["punctuation", "_"], + ["italic", ["c"]], + ["punctuation", "_"] + ]], + ["inline", [ + ["punctuation", "__"], + ["italic", ["d"]], + ["punctuation", "__"] + ]], + ["inline", [ + ["punctuation", "??"], + ["cite", "e"], + ["punctuation", "??"] + ]], + ["inline", [ + ["punctuation", "@"], + ["code", "f"], + ["punctuation", "@"] + ]], + ["inline", [ + ["punctuation", "-"], + ["deleted", ["g"]], + ["punctuation", "-"] + ]], + ["inline", [ + ["punctuation", "%"], + ["span", ["h"]], + ["punctuation", "%"] + ]], + ["inline", [ + ["punctuation", "^"], + "i", + ["punctuation", "^"] + ]], + ["inline", [ + ["punctuation", "~"], + "j", + ["punctuation", "~"] + ]] + ]], + ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "-"], + ["deleted", [ + ["inline", [ + ["punctuation", "*"], + ["bold", ["a"]], + ["punctuation", "*"] + ]], + ["inline", [ + ["punctuation", "**"], + ["bold", ["b"]], + ["punctuation", "**"] + ]], + ["inline", [ + ["punctuation", "_"], + ["italic", ["c"]], + ["punctuation", "_"] + ]], + ["inline", [ + ["punctuation", "__"], + ["italic", ["d"]], + ["punctuation", "__"] + ]], + ["inline", [ + ["punctuation", "??"], + ["cite", "e"], + ["punctuation", "??"] + ]], + ["inline", [ + ["punctuation", "@"], + ["code", "f"], + ["punctuation", "@"] + ]], + ["inline", [ + ["punctuation", "+"], + ["inserted", ["g"]], + ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "%"], + ["span", ["h"]], + ["punctuation", "%"] + ]], + ["inline", [ + ["punctuation", "^"], + "i", + ["punctuation", "^"] + ]], + ["inline", [ + ["punctuation", "~"], + "j", + ["punctuation", "~"] + ]] + ]], + ["punctuation", "-"] + ]], + ["inline", [ + ["punctuation", "%"], + ["span", [ + ["inline", [ + ["punctuation", "*"], + ["bold", ["a"]], + ["punctuation", "*"] + ]], + ["inline", [ + ["punctuation", "**"], + ["bold", ["b"]], + ["punctuation", "**"] + ]], + ["inline", [ + ["punctuation", "_"], + ["italic", ["c"]], + ["punctuation", "_"] + ]], + ["inline", [ + ["punctuation", "__"], + ["italic", ["d"]], + ["punctuation", "__"] + ]], + ["inline", [ + ["punctuation", "??"], + ["cite", "e"], + ["punctuation", "??"] + ]], + ["inline", [ + ["punctuation", "@"], + ["code", "f"], + ["punctuation", "@"] + ]], + ["inline", [ + ["punctuation", "+"], + ["inserted", ["g"]], + ["punctuation", "+"] + ]], + ["inline", [ + ["punctuation", "-"], + ["deleted", ["h"]], + ["punctuation", "-"] + ]], + ["inline", [ + ["punctuation", "^"], + "i", + ["punctuation", "^"] + ]], + ["inline", [ + ["punctuation", "~"], + "j", + ["punctuation", "~"] + ]] + ]], + ["punctuation", "%"] + ]] + ]], + + ["phrase", ["not_italic_ _this_either"]] +] + +---------------------------------------------------- + +Checks for inline styles and nesting. diff --git a/package/src/prism/tests/languages/textile/link-ref_feature.test b/package/src/prism/tests/languages/textile/link-ref_feature.test new file mode 100644 index 00000000..9036f640 --- /dev/null +++ b/package/src/prism/tests/languages/textile/link-ref_feature.test @@ -0,0 +1,25 @@ +[foo]http://prismjs.com +[bar]http://www.example.com + +---------------------------------------------------- + +[ + ["phrase", [ + ["link-ref", [ + ["punctuation", "["], + ["string", "foo"], + ["punctuation", "]"], + ["url", "http://prismjs.com"] + ]], + ["link-ref", [ + ["punctuation", "["], + ["string", "bar"], + ["punctuation", "]"], + ["url", "http://www.example.com"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for links references. \ No newline at end of file diff --git a/package/src/prism/tests/languages/textile/link_feature.test b/package/src/prism/tests/languages/textile/link_feature.test new file mode 100644 index 00000000..694c8920 --- /dev/null +++ b/package/src/prism/tests/languages/textile/link_feature.test @@ -0,0 +1,52 @@ +"Foo bar":http://prismjs.com +"Baz":foo +"Foobar":link-ref +"(foo)[en]{color:blue;}Foo":bar + +---------------------------------------------------- + +[ + ["phrase", [ + ["link", [ + ["punctuation", "\""], + ["text", "Foo bar"], + ["punctuation", "\""], + ["punctuation", ":"], + ["url", "http://prismjs.com"] + ]], + ["link", [ + ["punctuation", "\""], + ["text", "Baz"], + ["punctuation", "\""], + ["punctuation", ":"], + ["url", "foo"] + ]], + ["link", [ + ["punctuation", "\""], + ["text", "Foobar"], + ["punctuation", "\""], + ["punctuation", ":"], + ["url", "link-ref"] + ]], + ["link", [ + ["punctuation", "\""], + ["modifier", [ + ["punctuation", "("], + ["class-id", "foo"], + ["punctuation", ")"], + ["punctuation", "["], + ["lang", "en"], + ["punctuation", "]"], + ["css", "{color:blue;}"] + ]], + ["text", "Foo"], + ["punctuation", "\""], + ["punctuation", ":"], + ["url", "bar"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for links. diff --git a/package/src/prism/tests/languages/textile/list_feature.test b/package/src/prism/tests/languages/textile/list_feature.test new file mode 100644 index 00000000..1257fe14 --- /dev/null +++ b/package/src/prism/tests/languages/textile/list_feature.test @@ -0,0 +1,59 @@ +# foo +# bar +## baz +#[fr](#foo){background:pink} Foobar + +* foo +** bar +*** baz + +---------------------------------------------------- + +[ + ["phrase", [ + ["list", [ + ["punctuation", "#"], + " foo" + ]], + ["list", [ + ["punctuation", "#"], + " bar" + ]], + ["list", [ + ["punctuation", "##"], + " baz" + ]], + ["list", [ + ["punctuation", "#"], + ["modifier", [ + ["punctuation", "["], + ["lang", "fr"], + ["punctuation", "]"], + ["punctuation", "("], + ["class-id", "#foo"], + ["punctuation", ")"], + ["css", "{background:pink}"] + ]], + " Foobar" + ]] + ]], + + ["phrase", [ + ["list", [ + ["punctuation", "*"], + " foo" + ]], + ["list", [ + ["punctuation", "**"], + " bar" + ]], + ["list", [ + ["punctuation", "***"], + " baz" + ]] + ]] +] + +---------------------------------------------------- + +Checks for list items. diff --git a/package/src/prism/tests/languages/textile/mark_feature.test b/package/src/prism/tests/languages/textile/mark_feature.test new file mode 100644 index 00000000..1c2808d0 --- /dev/null +++ b/package/src/prism/tests/languages/textile/mark_feature.test @@ -0,0 +1,17 @@ +Prism(C) +Foo(TM) +Foobar(R) + +---------------------------------------------------- + +[ + ["phrase", [ + "Prism", ["mark", [["punctuation", "("], "C", ["punctuation", ")"]]], + "\nFoo", ["mark", [["punctuation", "("], "TM", ["punctuation", ")"]]], + "\nFoobar", ["mark", [["punctuation", "("], "R", ["punctuation", ")"]]] + ]] +] + +---------------------------------------------------- + +Checks for marks symbols. \ No newline at end of file diff --git a/package/src/prism/tests/languages/textile/table_feature.test b/package/src/prism/tests/languages/textile/table_feature.test new file mode 100644 index 00000000..31f7a8fe --- /dev/null +++ b/package/src/prism/tests/languages/textile/table_feature.test @@ -0,0 +1,318 @@ +|_. foo |<_. bar |>_. baz | +|<>. foo |(((. bar |)). baz | +|~. foo |^. bar |=. baz | +|/2. bar |\2. foo +bar +baz | +|\2~>. foobarbaz | + +(foo).|(bar).Baz| +(#foo).|(#bar).Baz| +[fr].|[en].Baz| +{color: blue}.|{font-weight:bold}.Baz| +(foo#bar){font-style:italic}[fr].|{background:red;}(bar#baz)[en].Baz| + +|*bold*|**bold**|_italic_|__italic__| +|??cite??|@code@|+inserted+|-deleted-| +|%span%|"foo":http://example.com|!foo.jpg!|bar[2]| +|\2.CSS(Cascading Style Sheet)|\2.Foo(TM)| + +---------------------------------------------------- + +[ + ["phrase", [ + ["table", [ + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "_"] + ]], + ["punctuation", "."], + " foo ", + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "<"], + ["punctuation", "_"] + ]], + ["punctuation", "."], + " bar ", + ["punctuation", "|"], + ["modifier", [ + ["punctuation", ">"], + ["punctuation", "_"] + ]], + ["punctuation", "."], + " baz ", + ["punctuation", "|"], + + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "<"], + ["punctuation", ">"] + ]], + ["punctuation", "."], + " foo ", + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "("], + ["punctuation", "("], + ["punctuation", "("] + ]], + ["punctuation", "."], + " bar ", + ["punctuation", "|"], + ["modifier", [ + ["punctuation", ")"], + ["punctuation", ")"] + ]], + ["punctuation", "."], + " baz ", + ["punctuation", "|"], + + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "~"] + ]], + ["punctuation", "."], + " foo ", + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "^"] + ]], + ["punctuation", "."], + " bar ", + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "="] + ]], + ["punctuation", "."], + " baz ", + ["punctuation", "|"], + + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "/2"] + ]], + ["punctuation", "."], + " bar ", + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "\\2"] + ]], + ["punctuation", "."], + " foo\nbar\nbaz ", + ["punctuation", "|"], + + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "\\2"], + ["punctuation", "~"], + ["punctuation", ">"] + ]], + ["punctuation", "."], + " foobarbaz ", + ["punctuation", "|"] + ]] + ]], + + ["phrase", [ + ["table", [ + ["modifier", [ + ["punctuation", "("], + ["class-id", "foo"], + ["punctuation", ")"] + ]], + ["punctuation", "."], + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "("], + ["class-id", "bar"], + ["punctuation", ")"] + ]], + ["punctuation", "."], + "Baz", + ["punctuation", "|"], + + ["modifier", [ + ["punctuation", "("], + ["class-id", "#foo"], + ["punctuation", ")"] + ]], + ["punctuation", "."], + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "("], + ["class-id", "#bar"], + ["punctuation", ")"] + ]], + ["punctuation", "."], + "Baz", + ["punctuation", "|"], + + ["modifier", [ + ["punctuation", "["], + ["lang", "fr"], + ["punctuation", "]"] + ]], + ["punctuation", "."], + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "["], + ["lang", "en"], + ["punctuation", "]"] + ]], + ["punctuation", "."], + "Baz", + ["punctuation", "|"], + + ["modifier", [ + ["css", "{color: blue}"] + ]], + ["punctuation", "."], + ["punctuation", "|"], + ["modifier", [ + ["css", "{font-weight:bold}"] + ]], + ["punctuation", "."], + "Baz", + ["punctuation", "|"], + + ["modifier", [ + ["punctuation", "("], + ["class-id", "foo#bar"], + ["punctuation", ")"], + ["css", "{font-style:italic}"], + ["punctuation", "["], + ["lang", "fr"], + ["punctuation", "]"] + ]], + ["punctuation", "."], + ["punctuation", "|"], + ["modifier", [ + ["css", "{background:red;}"], + ["punctuation", "("], + ["class-id", "bar#baz"], + ["punctuation", ")"], + ["punctuation", "["], + ["lang", "en"], + ["punctuation", "]"] + ]], + ["punctuation", "."], + "Baz", + ["punctuation", "|"] + ]] + ]], + + ["phrase", [ + ["table", [ + ["punctuation", "|"], + ["inline", [ + ["punctuation", "*"], + ["bold", ["bold"]], + ["punctuation", "*"] + ]], + ["punctuation", "|"], + ["inline", [ + ["punctuation", "**"], + ["bold", ["bold"]], + ["punctuation", "**"] + ]], + ["punctuation", "|"], + ["inline", [ + ["punctuation", "_"], + ["italic", ["italic"]], + ["punctuation", "_"] + ]], + ["punctuation", "|"], + ["inline", [ + ["punctuation", "__"], + ["italic", ["italic"]], + ["punctuation", "__"] + ]], + ["punctuation", "|"], + + ["punctuation", "|"], + ["inline", [ + ["punctuation", "??"], + ["cite", "cite"], + ["punctuation", "??"] + ]], + ["punctuation", "|"], + ["inline", [ + ["punctuation", "@"], + ["code", "code"], + ["punctuation", "@"] + ]], + ["punctuation", "|"], + ["inline", [ + ["punctuation", "+"], + ["inserted", ["inserted"]], + ["punctuation", "+"] + ]], + ["punctuation", "|"], + ["inline", [ + ["punctuation", "-"], + ["deleted", ["deleted"]], + ["punctuation", "-"] + ]], + ["punctuation", "|"], + + ["punctuation", "|"], + ["inline", [ + ["punctuation", "%"], + ["span", ["span"]], + ["punctuation", "%"] + ]], + ["punctuation", "|"], + ["link", [ + ["punctuation", "\""], + ["text", "foo"], + ["punctuation", "\""], + ["punctuation", ":"], + ["url", "http://example.com"] + ]], + ["punctuation", "|"], + ["image", [ + ["punctuation", "!"], + ["source", "foo.jpg"], + ["punctuation", "!"] + ]], + ["punctuation", "|"], + "bar", + ["footnote", [ + ["punctuation", "["], + "2", + ["punctuation", "]"] + ]], + ["punctuation", "|"], + + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "\\2"] + ]], + ["punctuation", "."], + ["acronym", [ + "CSS", + ["punctuation", "("], + ["comment", "Cascading Style Sheet"], + ["punctuation", ")"] + ]], + ["punctuation", "|"], + ["modifier", [ + ["punctuation", "\\2"] + ]], + ["punctuation", "."], + "Foo", + ["mark", [ + ["punctuation", "("], + "TM", + ["punctuation", ")"] + ]], + ["punctuation", "|"] + ]] + ]] +] + +---------------------------------------------------- + +Checks for tables with alignment modifiers and spanning. +Also checks for nesting inline styles. diff --git a/package/src/prism/tests/languages/textile/tag_feature.test b/package/src/prism/tests/languages/textile/tag_feature.test new file mode 100644 index 00000000..048d7216 --- /dev/null +++ b/package/src/prism/tests/languages/textile/tag_feature.test @@ -0,0 +1,16 @@ +
    + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["details"]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", ""] + ]] +] diff --git a/package/src/prism/tests/languages/toml/boolean_feature.test b/package/src/prism/tests/languages/toml/boolean_feature.test new file mode 100644 index 00000000..ca34f181 --- /dev/null +++ b/package/src/prism/tests/languages/toml/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/toml/comment_feature.test b/package/src/prism/tests/languages/toml/comment_feature.test new file mode 100644 index 00000000..190fa48b --- /dev/null +++ b/package/src/prism/tests/languages/toml/comment_feature.test @@ -0,0 +1,11 @@ +# I'm a comment, you're not. + +---------------------------------------------------- + +[ + ["comment", "# I'm a comment, you're not."] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/toml/date_feature.test b/package/src/prism/tests/languages/toml/date_feature.test new file mode 100644 index 00000000..2956efd8 --- /dev/null +++ b/package/src/prism/tests/languages/toml/date_feature.test @@ -0,0 +1,33 @@ +1979-05-27T07:32:00Z +1979-05-27T00:32:00-07:00 +1979-05-27T00:32:00.999999-07:00 +1979-05-27 07:32:00Z + +1979-05-27T07:32:00 +1979-05-27T00:32:00.999999 + +1979-05-27 + +07:32:00 +00:32:00.999999 + +---------------------------------------------------- + +[ + ["date", "1979-05-27T07:32:00Z"], + ["date", "1979-05-27T00:32:00-07:00"], + ["date", "1979-05-27T00:32:00.999999-07:00"], + ["date", "1979-05-27 07:32:00Z"], + + ["date", "1979-05-27T07:32:00"], + ["date", "1979-05-27T00:32:00.999999"], + + ["date", "1979-05-27"], + + ["date", "07:32:00"], + ["date", "00:32:00.999999"] +] + +---------------------------------------------------- + +Checks for dates. diff --git a/package/src/prism/tests/languages/toml/key_feature.test b/package/src/prism/tests/languages/toml/key_feature.test new file mode 100644 index 00000000..a03e11d2 --- /dev/null +++ b/package/src/prism/tests/languages/toml/key_feature.test @@ -0,0 +1,42 @@ +abc = "abc" +"abc" = "abc" +"abc".'a"b"c'.abc = "abc" + a . b . c = "abc" + +a = { b = "b", c = "c" } + +---------------------------------------------------- + +[ + ["key", "abc"], + ["punctuation", "="], + ["string", "\"abc\""], + + ["key", "\"abc\""], + ["punctuation", "="], + ["string", "\"abc\""], + + ["key", "\"abc\".'a\"b\"c'.abc"], + ["punctuation", "="], + ["string", "\"abc\""], + + ["key", "a . b . c"], + ["punctuation", "="], + ["string", "\"abc\""], + + ["key", "a"], + ["punctuation", "="], + ["punctuation", "{"], + ["key", "b"], + ["punctuation", "="], + ["string", "\"b\""], + ["punctuation", ","], + ["key", "c"], + ["punctuation", "="], + ["string", "\"c\""], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for keys. diff --git a/package/src/prism/tests/languages/toml/number_feature.test b/package/src/prism/tests/languages/toml/number_feature.test new file mode 100644 index 00000000..a94fb4cb --- /dev/null +++ b/package/src/prism/tests/languages/toml/number_feature.test @@ -0,0 +1,79 @@ +42 +0 ++0 +-0 ++99 +-17 + +1_000 +5_349_221 + +0xDEADBEEF +0xdeadbeef +0xdead_beef + +0o0123_4567 +0o755 + +0b1101_0110 + ++1.0 +3.1415 +-0.01 +5e+22 +1e6 +1e1_000 +-2E-2 +6.626e-34 +9_224_617.445_991_228_313 + +inf ++inf +-inf +nan ++nan +-nan + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "0"], + ["number", "+0"], + ["number", "-0"], + ["number", "+99"], + ["number", "-17"], + + ["number", "1_000"], + ["number", "5_349_221"], + + ["number", "0xDEADBEEF"], + ["number", "0xdeadbeef"], + ["number", "0xdead_beef"], + + ["number", "0o0123_4567"], + ["number", "0o755"], + + ["number", "0b1101_0110"], + + ["number", "+1.0"], + ["number", "3.1415"], + ["number", "-0.01"], + ["number", "5e+22"], + ["number", "1e6"], + ["number", "1e1_000"], + ["number", "-2E-2"], + ["number", "6.626e-34"], + ["number", "9_224_617.445_991_228_313"], + + ["number", "inf"], + ["number", "+inf"], + ["number", "-inf"], + ["number", "nan"], + ["number", "+nan"], + ["number", "-nan"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/toml/string_feature.test b/package/src/prism/tests/languages/toml/string_feature.test new file mode 100644 index 00000000..fa87009b --- /dev/null +++ b/package/src/prism/tests/languages/toml/string_feature.test @@ -0,0 +1,29 @@ +"" +"abc" +"\"" +'' +'#' +'"abc"' +""" + abc + """ +''' + abc + ''' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"abc\""], + ["string", "\"\\\"\""], + ["string", "''"], + ["string", "'#'"], + ["string", "'\"abc\"'"], + ["string", "\"\"\"\n\tabc\n\t\"\"\""], + ["string", "'''\n\tabc\n\t'''"] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/toml/table_feature.test b/package/src/prism/tests/languages/toml/table_feature.test new file mode 100644 index 00000000..4fbce4e8 --- /dev/null +++ b/package/src/prism/tests/languages/toml/table_feature.test @@ -0,0 +1,31 @@ +[table] +[[array]] + +# not a table +foo = [ "bar" ] + +---------------------------------------------------- + +[ + ["punctuation", "["], + ["table", "table"], + ["punctuation", "]"], + + ["punctuation", "["], + ["punctuation", "["], + ["table", "array"], + ["punctuation", "]"], + ["punctuation", "]"], + + ["comment", "# not a table"], + + ["key", "foo"], + ["punctuation", "="], + ["punctuation", "["], + ["string", "\"bar\""], + ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for tables. diff --git a/package/src/prism/tests/languages/tremor/boolean_feature.test b/package/src/prism/tests/languages/tremor/boolean_feature.test new file mode 100644 index 00000000..7994a0c8 --- /dev/null +++ b/package/src/prism/tests/languages/tremor/boolean_feature.test @@ -0,0 +1,15 @@ +true +false +null + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"], + ["boolean", "null"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/tremor/comment_feature.test b/package/src/prism/tests/languages/tremor/comment_feature.test new file mode 100644 index 00000000..91a30216 --- /dev/null +++ b/package/src/prism/tests/languages/tremor/comment_feature.test @@ -0,0 +1,15 @@ +# +## foobar +### snot badger + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "## foobar"], + ["comment", "### snot badger"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/tremor/extractor_feature.test b/package/src/prism/tests/languages/tremor/extractor_feature.test new file mode 100644 index 00000000..b3271550 --- /dev/null +++ b/package/src/prism/tests/languages/tremor/extractor_feature.test @@ -0,0 +1,15 @@ +re|^(?Pbat.*)$| +datetime|%Y-%m-%d %H:%M| + +---------------------------------------------------- + +[ + ["extractor", [ + ["function", "re"], + ["regex", "|^(?Pbat.*)$|"] + ]], + ["extractor", [ + ["function", "datetime"], + ["value", "|%Y-%m-%d %H:%M|"] + ]] +] diff --git a/package/src/prism/tests/languages/tremor/function_feature.test b/package/src/prism/tests/languages/tremor/function_feature.test new file mode 100644 index 00000000..896990e8 --- /dev/null +++ b/package/src/prism/tests/languages/tremor/function_feature.test @@ -0,0 +1,9 @@ +foo() + +---------------------------------------------------- + +[ + ["function", "foo"], + ["punctuation", "("], + ["punctuation", ")"] +] diff --git a/package/src/prism/tests/languages/tremor/identifier_feature.test b/package/src/prism/tests/languages/tremor/identifier_feature.test new file mode 100644 index 00000000..08771906 --- /dev/null +++ b/package/src/prism/tests/languages/tremor/identifier_feature.test @@ -0,0 +1,12 @@ +foo +foo_bar_42 +`foo` +`bar` + +---------------------------------------------------- + +[ + "foo\nfoo_bar_42\n", + ["identifier", "`foo`"], + ["identifier", "`bar`"] +] diff --git a/package/src/prism/tests/languages/tremor/keyword_escape_feature.test b/package/src/prism/tests/languages/tremor/keyword_escape_feature.test new file mode 100644 index 00000000..bd1ec9fb --- /dev/null +++ b/package/src/prism/tests/languages/tremor/keyword_escape_feature.test @@ -0,0 +1,115 @@ +`args` +`as` +`by` +`case` +`config` +`connect` +`connector` +`const` +`copy` +`create` +`default` +`define` +`deploy` +`drop` +`each` +`emit` +`end` +`erase` +`event` +`flow` +`fn` +`for` +`from` +`group` +`having` +`insert` +`into` +`intrinsic` +`let` +`links` +`match` +`merge` +`mod` +`move` +`of` +`operator` +`patch` +`pipeline` +`recur` +`script` +`select` +`set` +`sliding` +`state` +`stream` +`to` +`tumbling` +`update` +`use` +`when` +`where` +`window` +`with` + +---------------------------------------------------- + +[ + ["identifier", "`args`"], + ["identifier", "`as`"], + ["identifier", "`by`"], + ["identifier", "`case`"], + ["identifier", "`config`"], + ["identifier", "`connect`"], + ["identifier", "`connector`"], + ["identifier", "`const`"], + ["identifier", "`copy`"], + ["identifier", "`create`"], + ["identifier", "`default`"], + ["identifier", "`define`"], + ["identifier", "`deploy`"], + ["identifier", "`drop`"], + ["identifier", "`each`"], + ["identifier", "`emit`"], + ["identifier", "`end`"], + ["identifier", "`erase`"], + ["identifier", "`event`"], + ["identifier", "`flow`"], + ["identifier", "`fn`"], + ["identifier", "`for`"], + ["identifier", "`from`"], + ["identifier", "`group`"], + ["identifier", "`having`"], + ["identifier", "`insert`"], + ["identifier", "`into`"], + ["identifier", "`intrinsic`"], + ["identifier", "`let`"], + ["identifier", "`links`"], + ["identifier", "`match`"], + ["identifier", "`merge`"], + ["identifier", "`mod`"], + ["identifier", "`move`"], + ["identifier", "`of`"], + ["identifier", "`operator`"], + ["identifier", "`patch`"], + ["identifier", "`pipeline`"], + ["identifier", "`recur`"], + ["identifier", "`script`"], + ["identifier", "`select`"], + ["identifier", "`set`"], + ["identifier", "`sliding`"], + ["identifier", "`state`"], + ["identifier", "`stream`"], + ["identifier", "`to`"], + ["identifier", "`tumbling`"], + ["identifier", "`update`"], + ["identifier", "`use`"], + ["identifier", "`when`"], + ["identifier", "`where`"], + ["identifier", "`window`"], + ["identifier", "`with`"] +] + +---------------------------------------------------- + +Checks for variables. diff --git a/package/src/prism/tests/languages/tremor/keyword_feature.test b/package/src/prism/tests/languages/tremor/keyword_feature.test new file mode 100644 index 00000000..e65df8c8 --- /dev/null +++ b/package/src/prism/tests/languages/tremor/keyword_feature.test @@ -0,0 +1,115 @@ +args +as +by +case +config +connect +connector +const +copy +create +default +define +deploy +drop +each +emit +end +erase +event +flow +fn +for +from +group +having +insert +into +intrinsic +let +links +match +merge +mod +move +of +operator +patch +pipeline +recur +script +select +set +sliding +state +stream +to +tumbling +update +use +when +where +window +with + +---------------------------------------------------- + +[ + ["keyword", "args"], + ["keyword", "as"], + ["keyword", "by"], + ["keyword", "case"], + ["keyword", "config"], + ["keyword", "connect"], + ["keyword", "connector"], + ["keyword", "const"], + ["keyword", "copy"], + ["keyword", "create"], + ["keyword", "default"], + ["keyword", "define"], + ["keyword", "deploy"], + ["keyword", "drop"], + ["keyword", "each"], + ["keyword", "emit"], + ["keyword", "end"], + ["keyword", "erase"], + ["keyword", "event"], + ["keyword", "flow"], + ["keyword", "fn"], + ["keyword", "for"], + ["keyword", "from"], + ["keyword", "group"], + ["keyword", "having"], + ["keyword", "insert"], + ["keyword", "into"], + ["keyword", "intrinsic"], + ["keyword", "let"], + ["keyword", "links"], + ["keyword", "match"], + ["keyword", "merge"], + ["keyword", "mod"], + ["keyword", "move"], + ["keyword", "of"], + ["keyword", "operator"], + ["keyword", "patch"], + ["keyword", "pipeline"], + ["keyword", "recur"], + ["keyword", "script"], + ["keyword", "select"], + ["keyword", "set"], + ["keyword", "sliding"], + ["keyword", "state"], + ["keyword", "stream"], + ["keyword", "to"], + ["keyword", "tumbling"], + ["keyword", "update"], + ["keyword", "use"], + ["keyword", "when"], + ["keyword", "where"], + ["keyword", "window"], + ["keyword", "with"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/tremor/modularity_feature.test b/package/src/prism/tests/languages/tremor/modularity_feature.test new file mode 100644 index 00000000..086bb3c2 --- /dev/null +++ b/package/src/prism/tests/languages/tremor/modularity_feature.test @@ -0,0 +1,36 @@ +foo +foo::bar +foo::bar::baz +`foo`::bar::`baz` +`foo` +`foo`::`bar`::`baz` + +---------------------------------------------------- + +[ + "foo\nfoo", + ["punctuation", "::"], + "bar\nfoo", + ["punctuation", "::"], + "bar", + ["punctuation", "::"], + "baz\n", + + ["identifier", "`foo`"], + ["punctuation", "::"], + "bar", + ["punctuation", "::"], + ["identifier", "`baz`"], + + ["identifier", "`foo`"], + + ["identifier", "`foo`"], + ["punctuation", "::"], + ["identifier", "`bar`"], + ["punctuation", "::"], + ["identifier", "`baz`"] +] + +---------------------------------------------------- + +Checks modularity and references for bare/namespaced variables diff --git a/package/src/prism/tests/languages/tremor/number_feature.test b/package/src/prism/tests/languages/tremor/number_feature.test new file mode 100644 index 00000000..cc80672c --- /dev/null +++ b/package/src/prism/tests/languages/tremor/number_feature.test @@ -0,0 +1,19 @@ +42 +0.154 +0xBadFace +0b10101010 +1_000_000_000 + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "0.154"], + ["number", "0xBadFace"], + ["number", "0b10101010"], + ["number", "1_000_000_000"] +] + +---------------------------------------------------- + +Checks for decimal and hexadecimal numbers. diff --git a/package/src/prism/tests/languages/tremor/operator_feature.test b/package/src/prism/tests/languages/tremor/operator_feature.test new file mode 100644 index 00000000..226189cd --- /dev/null +++ b/package/src/prism/tests/languages/tremor/operator_feature.test @@ -0,0 +1,61 @@ ++ - / * % ~ ^ & | ++= -= /= *= %= ~= ^= &= |= +== != < > <= >= += => + +! && || + +<< >> >>> +<<= >>= >>>= + +not and or xor present absent + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "/"], + ["operator", "*"], + ["operator", "%"], + ["operator", "~"], + ["operator", "^"], + ["operator", "&"], + ["operator", "|"], + + ["operator", "+="], + ["operator", "-="], + ["operator", "/="], + ["operator", "*="], + ["operator", "%="], + ["operator", "~="], + ["operator", "^="], + ["operator", "&="], + ["operator", "|="], + + ["operator", "=="], + ["operator", "!="], + ["operator", "<"], + ["operator", ">"], + ["operator", "<="], + ["operator", ">="], + + ["operator", "="], + ["operator", "=>"], + + ["operator", "!"], ["operator", "&&"], ["operator", "||"], + + ["operator", "<<"], ["operator", ">>"], ["operator", ">>>"], + ["operator", "<<="], ["operator", ">>="], ["operator", ">>>="], + + ["operator", "not"], + ["operator", "and"], + ["operator", "or"], + ["operator", "xor"], + ["operator", "present"], + ["operator", "absent"] +] + +---------------------------------------------------- + +Checks for operators diff --git a/package/src/prism/tests/languages/tremor/punctuation_feature.test b/package/src/prism/tests/languages/tremor/punctuation_feature.test new file mode 100644 index 00000000..57cd9ac3 --- /dev/null +++ b/package/src/prism/tests/languages/tremor/punctuation_feature.test @@ -0,0 +1,29 @@ +( ) [ ] { } +, ; . : +%( ) %[ ] %{ } + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", "."], + ["punctuation", ":"], + + ["pattern-punctuation", "%"], + ["punctuation", "("], + ["punctuation", ")"], + ["pattern-punctuation", "%"], + ["punctuation", "["], + ["punctuation", "]"], + ["pattern-punctuation", "%"], + ["punctuation", "{"], + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/tremor/string_feature.test b/package/src/prism/tests/languages/tremor/string_feature.test new file mode 100644 index 00000000..34c540f4 --- /dev/null +++ b/package/src/prism/tests/languages/tremor/string_feature.test @@ -0,0 +1,87 @@ +"" +"" "" +""" +""" +"fo\"obar" +"foo\ +bar" +""" +multiline +""" +"snot#{badger}badger" +""" + I am + a + long + multi-line + string with #{ "#{a+1} interpolation" } +""" + +---------------------------------------------------- + +[ + ["interpolated-string", [ + ["string", "\"\""] + ]], + + ["interpolated-string", [ + ["string", "\"\""] + ]], + ["interpolated-string", [ + ["string", "\"\""] + ]], + + ["interpolated-string", [ + ["string", "\"\"\"\n\"\"\""] + ]], + + ["interpolated-string", [ + ["string", "\"fo\\\"obar\""] + ]], + + ["interpolated-string", [ + ["string", "\"foo\\\nbar\""] + ]], + + ["interpolated-string", [ + ["string", "\"\"\"\nmultiline\n\"\"\""] + ]], + + ["interpolated-string", [ + ["string", "\"snot"], + ["interpolation", [ + ["punctuation", "#{"], + ["expression", ["badger"]], + ["punctuation", "}"] + ]], + ["string", "badger\""] + ]], + + ["interpolated-string", [ + ["string", "\"\"\"\n I am\n a\n long\n multi-line\n string with "], + ["interpolation", [ + ["punctuation", "#{"], + ["expression", [ + ["interpolated-string", [ + ["string", "\""], + ["interpolation", [ + ["punctuation", "#{"], + ["expression", [ + "a", + ["operator", "+"], + ["number", "1"] + ]], + ["punctuation", "}"] + ]], + ["string", " interpolation\""] + ]] + ]], + ["punctuation", "}"] + ]], + ["string", "\n\"\"\""] + ]] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/tsx/issue2594.test b/package/src/prism/tests/languages/tsx/issue2594.test new file mode 100644 index 00000000..819d2ae1 --- /dev/null +++ b/package/src/prism/tests/languages/tsx/issue2594.test @@ -0,0 +1,230 @@ +function Add1(a, b) { return
    a + b
    } + +type Bar = Foo; + +function Add2(a, b) { return
    a + b
    } + +function handleSubmit(event: FormEvent) { + event.preventDefault(); +} + +function handleChange(event: ChangeEvent) { + console.log(event.target.value); +} + +function handleClick(event: MouseEvent) { + console.log(event.button); +} + +export default function Form() { + return ( +
    + + +
    + ); +} + +---------------------------------------------------- + +[ + ["keyword", "function"], + ["function", [ + ["maybe-class-name", "Add1"] + ]], + ["punctuation", "("], + "a", + ["punctuation", ","], + " b", + ["punctuation", ")"], + ["punctuation", "{"], + ["keyword", "return"], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["plain-text", "a + b"], + ["tag", [ + ["punctuation", ""] + ]], + ["punctuation", "}"], + + ["keyword", "type"], + ["class-name", ["Bar"]], + ["operator", "="], + ["maybe-class-name", "Foo"], + ["operator", "<"], + ["builtin", "string"], + ["operator", ">"], + ["punctuation", ";"], + + ["keyword", "function"], + ["function", [ + ["maybe-class-name", "Add2"] + ]], + ["punctuation", "("], + "a", + ["punctuation", ","], + " b", + ["punctuation", ")"], + ["punctuation", "{"], + ["keyword", "return"], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["plain-text", "a + b"], + ["tag", [ + ["punctuation", ""] + ]], + ["punctuation", "}"], + + ["keyword", "function"], + ["function", ["handleSubmit"]], + ["punctuation", "("], + "event", + ["operator", ":"], + ["maybe-class-name", "FormEvent"], + ["operator", "<"], + ["maybe-class-name", "HTMLFormElement"], + ["operator", ">"], + ["punctuation", ")"], + ["punctuation", "{"], + + "\n event", + ["punctuation", "."], + ["function", ["preventDefault"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["keyword", "function"], + ["function", ["handleChange"]], + ["punctuation", "("], + "event", + ["operator", ":"], + ["maybe-class-name", "ChangeEvent"], + ["operator", "<"], + ["maybe-class-name", "HTMLInputElement"], + ["operator", ">"], + ["punctuation", ")"], + ["punctuation", "{"], + + "\n console", + ["punctuation", "."], + ["function", ["log"]], + ["punctuation", "("], + "event", + ["punctuation", "."], + ["property-access", ["target"]], + ["punctuation", "."], + ["property-access", ["value"]], + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["keyword", "function"], + ["function", ["handleClick"]], + ["punctuation", "("], + "event", + ["operator", ":"], + ["maybe-class-name", "MouseEvent"], + ["punctuation", ")"], + ["punctuation", "{"], + + "\n console", + ["punctuation", "."], + ["function", ["log"]], + ["punctuation", "("], + "event", + ["punctuation", "."], + ["property-access", ["button"]], + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["keyword", "export"], + ["keyword", "default"], + ["keyword", "function"], + ["function", [ + ["maybe-class-name", "Form"] + ]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + + ["keyword", "return"], + ["punctuation", "("], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["form"]], + ["attr-name", ["onSubmit"]], + ["attr-equals", "="], + ["script", [ + ["punctuation", "{"], + "handleSubmit", + ["punctuation", "}"] + ]], + ["punctuation", ">"] + ]], + ["plain-text", "\n "], + ["tag", [ + ["punctuation", "<"], + ["tag", ["input"]], + ["attr-name", ["onChange"]], + ["attr-equals", "="], + ["script", [ + ["punctuation", "{"], + "handleChange", + ["punctuation", "}"] + ]], + ["attr-name", ["placeholder"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "Name", + ["punctuation", "\""] + ]], + ["punctuation", "/>"] + ]], + ["plain-text", "\n "], + ["tag", [ + ["punctuation", "<"], + ["tag", ["button"]], + ["attr-name", ["onClick"]], + ["attr-equals", "="], + ["script", [ + ["punctuation", "{"], + "handleClick", + ["punctuation", "}"] + ]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + ["plain-text", "\n "], + ["tag", [ + ["punctuation", ""] + ]], + + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/tsx/issue3089.test b/package/src/prism/tests/languages/tsx/issue3089.test new file mode 100644 index 00000000..643dd8bb --- /dev/null +++ b/package/src/prism/tests/languages/tsx/issue3089.test @@ -0,0 +1,31 @@ +// react tsx +function log(msg: string): void { + console.log(msg); +} + +---------------------------------------------------- + +[ + ["comment", "// react tsx"], + + ["keyword", "function"], + ["function", ["log"]], + ["punctuation", "("], + "msg", + ["operator", ":"], + ["builtin", "string"], + ["punctuation", ")"], + ["operator", ":"], + ["keyword", "void"], + ["punctuation", "{"], + + "\n console", + ["punctuation", "."], + ["function", ["log"]], + ["punctuation", "("], + "msg", + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/tsx/tag_feature.test b/package/src/prism/tests/languages/tsx/tag_feature.test new file mode 100644 index 00000000..dd47a221 --- /dev/null +++ b/package/src/prism/tests/languages/tsx/tag_feature.test @@ -0,0 +1,125 @@ +var myDivElement =
    ; +var myElement = ; +
    + +class Test extends Component { + render() { + return

    Hello world.

    ; + } +} + +---------------------------------------------------- + +[ + ["keyword", "var"], + " myDivElement ", + ["operator", "="], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["className"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "foo", + ["punctuation", "\""] + ]], + ["punctuation", "/>"] + ]], + ["punctuation", ";"], + + ["keyword", "var"], + " myElement ", + ["operator", "="], + ["tag", [ + ["punctuation", "<"], + ["tag", [ + ["class-name", "MyComponent"] + ]], + ["attr-name", ["someProperty"]], + ["attr-equals", "="], + ["script", [ + ["punctuation", "{"], + ["boolean", "true"], + ["punctuation", "}"] + ]], + ["punctuation", "/>"] + ]], + ["punctuation", ";"], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["spread", [ + ["punctuation", "{"], + ["operator", "..."], + "foo", + ["punctuation", "}"] + ]], + ["punctuation", "/>"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", [ + ["class-name", "Tree.TreeNode.Item"] + ]], + ["attr-name", ["leaf"]], + ["attr-equals", "="], + ["script", [ + ["punctuation", "{"], + ["boolean", "true"], + ["punctuation", "}"] + ]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["keyword", "class"], + ["class-name", ["Test"]], + ["keyword", "extends"], + ["class-name", ["Component"]], + ["punctuation", "{"], + + ["function", ["render"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + + ["keyword", "return"], + ["tag", [ + ["punctuation", "<"], + ["tag", ["p"]], + ["attr-name", ["onClick"]], + ["attr-equals", "="], + ["script", [ + ["punctuation", "{"], + ["keyword", "this"], + ["punctuation", "."], + ["property-access", ["clickHandler"]], + ["punctuation", "}"] + ]], + ["punctuation", ">"] + ]], + ["plain-text", "Hello world."], + ["tag", [ + ["punctuation", ""] + ]], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for TSX tags. diff --git a/package/src/prism/tests/languages/tt2/comment_feature.test b/package/src/prism/tests/languages/tt2/comment_feature.test new file mode 100644 index 00000000..172beaa9 --- /dev/null +++ b/package/src/prism/tests/languages/tt2/comment_feature.test @@ -0,0 +1,36 @@ +[%# this entire directive is ignored no + matter how many lines it wraps onto +%] +[% # this is a comment + theta = 20 # so is this + rho = 30 # me too! +%] + +---------------------------------------------------- + +[ + ["tt2", + [ + ["comment", "[%# this entire directive is ignored no\n matter how many lines it wraps onto\n%]" ] + ] + ], + ["tt2", + [ + ["delimiter", "[%"], + ["comment", "# this is a comment" ], + ["variable", "theta"], + ["operator", "="], + ["number", "20"], + ["comment", "# so is this" ], + ["variable", "rho"], + ["operator", "="], + ["number", "30"], + ["comment", "# me too!"], + ["delimiter", "%]"] + ] + ] +] + +---------------------------------------------------- + +Checks for single-line and multi-line comments. diff --git a/package/src/prism/tests/languages/tt2/delimiter_feature.test b/package/src/prism/tests/languages/tt2/delimiter_feature.test new file mode 100644 index 00000000..238105cf --- /dev/null +++ b/package/src/prism/tests/languages/tt2/delimiter_feature.test @@ -0,0 +1,18 @@ +[%- %] +[% -%] +[%- -%] + [% + %] + +---------------------------------------------------- + +[ + ["tt2", [["delimiter", "[%-"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["delimiter", "-%]"]]], + ["tt2", [["delimiter", "[%-"], ["delimiter", "-%]"]]], + ["tt2", [["delimiter", "[%"], ["delimiter", "%]"]]] +] + +---------------------------------------------------- + +Checks for delimiters. diff --git a/package/src/prism/tests/languages/tt2/keyword_feature.test b/package/src/prism/tests/languages/tt2/keyword_feature.test new file mode 100644 index 00000000..c487084b --- /dev/null +++ b/package/src/prism/tests/languages/tt2/keyword_feature.test @@ -0,0 +1,130 @@ +[% BLOCK header %] +[% CALL dbi.disconnect %] +[% CASE 23 %] +[% CATCH the.ball %] +[% CLEAR %] +[% DEBUG on %] +[% DEBUG off %] +[% DEFAULT answer = 42 %] +[% ELSE %] +[% ELSIF bar %] +[% END %] +[% FILTER html %] +[% FINAL breathe %] +[% FOREACH project IN time %] +[% GET foo %] +[% IF foo %] +[% IN %] +[% INCLUDE "$inc" %] +[% INSERT filename.html %] +[% LAST IF exhausted %] +[% MACRO header INCLUDE header %] +[% META title = 'Hello!' %] +[% NEXT IF client %] +[% PERL %] +[% PROCESS "functions.tt" %] +[% RAWPERL %] +[% RETURN %] +[% SET answer = 42 %] +[% STOP %] +[% SWITCH mday %] +[% TAGS [@ @] %] +[% THROW up %] +[% TRY %] +[% UNLESS fear %] +[% USE Plugin %] +[% WHILE my.guitar.gently.weeps %] +[% WRAPPER 'html5.html' %] + +---------------------------------------------------- + +[ + ["tt2", [["delimiter", "[%"], ["keyword", "BLOCK"], + ["variable", "header"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "CALL"], + ["variable", "dbi.disconnect"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "CASE"], + ["number", "23"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "CATCH"], + ["variable", "the.ball"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "CLEAR"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "DEBUG"], + ["variable", "on"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "DEBUG"], + ["variable", "off"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "DEFAULT"], + ["variable", "answer"], ["operator", "="], ["number", "42"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "ELSE"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "ELSIF"], ["variable", "bar"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "END"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "FILTER"], ["variable", "html"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "FINAL"], + ["variable", "breathe"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "FOREACH"], + ["variable", "project"], ["keyword", "IN"], ["variable", "time"] , + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "GET"], + ["variable", "foo"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "IF"], ["variable", "foo"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "IN"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "INCLUDE"], + ["double-quoted-string", ["\"", ["variable", "$inc"], "\""]], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "INSERT"], + ["variable", "filename.html"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "LAST"], + ["keyword", "IF"], ["variable", "exhausted"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "MACRO"], ["variable", "header"], + ["keyword", "INCLUDE"], ["variable", "header"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "META"], + ["variable", "title"], ["operator", "="], ["single-quoted-string", "'Hello!'"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "NEXT"], + ["keyword", "IF"], ["variable", "client"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "PERL"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "PROCESS"], + ["double-quoted-string", ["\"functions.tt\""]], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "RAWPERL"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "RETURN"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "SET"], + ["variable", "answer"], ["operator", "="], ["number", "42"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "STOP"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "SWITCH"], ["variable", "mday"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "TAGS"], + ["punctuation", "["], "@ @", ["punctuation", "]"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "THROW"], + ["variable", "up"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "TRY"], ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "UNLESS"], ["variable", "fear"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "USE"], ["variable", "Plugin"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "WHILE"], + ["variable", "my.guitar.gently.weeps"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], ["keyword", "WRAPPER"], + ["single-quoted-string", "'html5.html'"], + ["delimiter", "%]"]]] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/tt2/operator_feature.test b/package/src/prism/tests/languages/tt2/operator_feature.test new file mode 100644 index 00000000..0b91dcbe --- /dev/null +++ b/package/src/prism/tests/languages/tt2/operator_feature.test @@ -0,0 +1,69 @@ +[% fat => comma %] +[% foo == bar %] +[% foo != bar %] +[% foo < bar %] +[% foo <= bar %] +[% foo > bar %] +[% foo >= bar %] +[% foo = bar %] +[% foo && bar %] +[% foo || bar %] +[% foo | bar %] +[% foo ! bar %] +[% penthouse and pavement %] +[% sooner or later %] +[% love not war %] + +---------------------------------------------------- + +[ + ["tt2", [["delimiter", "[%"], + ["variable", "fat"], ["operator", "=>"], ["variable", "comma"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "foo"], ["operator", "=="], ["variable", "bar"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "foo"], ["operator", "!="], ["variable", "bar"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "foo"], ["operator", "<"], ["variable", "bar"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "foo"], ["operator", "<="], ["variable", "bar"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "foo"], ["operator", ">"], ["variable", "bar"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "foo"], ["operator", ">="], ["variable", "bar"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "foo"], ["operator", "="], ["variable", "bar"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "foo"], ["operator", "&&"], ["variable", "bar"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "foo"], ["operator", "||"], ["variable", "bar"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "foo"], ["operator", "|"], ["variable", "bar"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "foo"], ["operator", "!"], ["variable", "bar"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "penthouse"], ["operator", "and"], ["variable", "pavement"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "sooner"], ["operator", "or"], ["variable", "later"], + ["delimiter", "%]"]]], + ["tt2", [["delimiter", "[%"], + ["variable", "love"], ["operator", "not"], ["variable", "war"], + ["delimiter", "%]"]]] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/tt2/string-interpolation_feature.test b/package/src/prism/tests/languages/tt2/string-interpolation_feature.test new file mode 100644 index 00000000..0c850d0f --- /dev/null +++ b/package/src/prism/tests/languages/tt2/string-interpolation_feature.test @@ -0,0 +1,21 @@ +[% "Hello, $name!" %] + +---------------------------------------------------- + +[ + ["tt2", + [ + ["delimiter", "[%"], + ["double-quoted-string", [ + "\"Hello, ", + ["variable", "$name"], + "!\""] + ], + ["delimiter", "%]"] + ] + ] +] + +---------------------------------------------------- + +Checks for interpolation inside strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/tt2/string_feature.test b/package/src/prism/tests/languages/tt2/string_feature.test new file mode 100644 index 00000000..104b1a4a --- /dev/null +++ b/package/src/prism/tests/languages/tt2/string_feature.test @@ -0,0 +1,35 @@ +[% +"https://example.com/" +" # not a comment" +"multi-line +string" +"escaped \"quotes\"\nwork\twell" +'https://example.com/' +' # not a comment' +'multi-line +string' +'escaped \'quotes\' work' +%] + +---------------------------------------------------- + +[ + ["tt2", + [ + ["delimiter", "[%"], + ["double-quoted-string", ["\"https://example.com/\""]], + ["double-quoted-string", ["\" # not a comment\""]], + ["double-quoted-string", ["\"multi-line\nstring\""]], + ["double-quoted-string", ["\"escaped \\\"quotes\\\"\\nwork\\twell\""]], + ["single-quoted-string", "'https://example.com/'"], + ["single-quoted-string", "' # not a comment'"], + ["single-quoted-string", "'multi-line\nstring'"], + ["single-quoted-string", "'escaped \\'quotes\\' work'"], + ["delimiter", "%]"] + ] + ] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/tt2/variable_feature.test b/package/src/prism/tests/languages/tt2/variable_feature.test new file mode 100644 index 00000000..e5164b8d --- /dev/null +++ b/package/src/prism/tests/languages/tt2/variable_feature.test @@ -0,0 +1,36 @@ +[% + foo + foo.bar + foo.2 + foo.1.bar.2.baz.3 + foo.$index + foo + . + bar + world + hands + knots +%] +---------------------------------------------------- + +[ + ["tt2", + [ + ["delimiter", "[%"], + ["variable", "foo"], + ["variable", "foo.bar"], + ["variable", "foo.2"], + ["variable", "foo.1.bar.2.baz.3"], + ["variable", "foo.$index"], + ["variable", "foo\n\t\t.\n\t\t\tbar"], + ["variable", "world"], + ["variable", "hands"], + ["variable", "knots"], + ["delimiter", "%]"] + ] + ] +] + +---------------------------------------------------- + +Checks for simple variables. diff --git a/package/src/prism/tests/languages/turtle/blank-node_feature.test b/package/src/prism/tests/languages/turtle/blank-node_feature.test new file mode 100644 index 00000000..85872616 --- /dev/null +++ b/package/src/prism/tests/languages/turtle/blank-node_feature.test @@ -0,0 +1,75 @@ + "RDF/XML Syntax Specification (Revised)" . + _:bnode . + _:bnode "Dave Beckett" . + _:bnode . + +---------------------------------------------------- + +[ + ["url", [ + ["punctuation", "<"], + "http://www.w3.org/TR/rdf-syntax-grammar", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://purl.org/dc/elements/1.1/title", + ["punctuation", ">"] + ]], + ["string", "\"RDF/XML Syntax Specification (Revised)\""], + ["punctuation", "."], + ["url", [ + ["punctuation", "<"], + "http://www.w3.org/TR/rdf-syntax-grammar", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://example.org/stuff/1.0/editor", + ["punctuation", ">"] + ]], + ["function", [ + ["prefix", [ + "_", + ["punctuation", ":"] + ]], + ["local-name", "bnode"] + ]], + ["punctuation", "."], + ["function", [ + ["prefix", [ + "_", + ["punctuation", ":"] + ]], + ["local-name", "bnode"] + ]], + ["url", [ + ["punctuation", "<"], + "http://example.org/stuff/1.0/fullname", + ["punctuation", ">"] + ]], + ["string", "\"Dave Beckett\""], + ["punctuation", "."], + ["function", [ + ["prefix", [ + "_", + ["punctuation", ":"] + ]], + ["local-name", "bnode"] + ]], + ["url", [ + ["punctuation", "<"], + "http://example.org/stuff/1.0/homePage", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "http://purl.org/net/dajobe/", + ["punctuation", ">"] + ]], + ["punctuation", "."] +] + +---------------------------------------------------- + +Checks blank node underscore prefixes. \ No newline at end of file diff --git a/package/src/prism/tests/languages/turtle/keyword_feature.test b/package/src/prism/tests/languages/turtle/keyword_feature.test new file mode 100644 index 00000000..6be18e34 --- /dev/null +++ b/package/src/prism/tests/languages/turtle/keyword_feature.test @@ -0,0 +1,87 @@ +@base . +BASE . +@prefix rdf: . +PREFIX rdfs: . + +GRAPH { + a rdfs:Class ; + = . +} + +---------------------------------------------------- + +[ + ["keyword", "@base"], + ["url", [ + ["punctuation", "<"], + "http://example.org/", + ["punctuation", ">"] + ]], + ["punctuation", "."], + ["keyword", "BASE"], + ["url", [ + ["punctuation", "<"], + "http://example.org/", + ["punctuation", ">"] + ]], + ["punctuation", "."], + ["keyword", "@prefix"], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]] + ]], + ["url", [ + ["punctuation", "<"], + "http://www.w3.org/1999/02/22-rdf-syntax-ns#", + ["punctuation", ">"] + ]], + ["punctuation", "."], + ["keyword", "PREFIX"], + ["function", [ + ["prefix", [ + "rdfs", + ["punctuation", ":"] + ]] + ]], + ["url", [ + ["punctuation", "<"], + "http://www.w3.org/2000/01/rdf-schema#", + ["punctuation", ">"] + ]], + ["punctuation", "."], + ["keyword", "GRAPH"], + ["url", [ + ["punctuation", "<"], + "urn:newGraph", + ["punctuation", ">"] + ]], + ["punctuation", "{"], + ["url", [ + ["punctuation", "<"], + "urn:myClass", + ["punctuation", ">"] + ]], + ["keyword", "a"], + ["function", [ + ["prefix", [ + "rdfs", + ["punctuation", ":"] + ]], + ["local-name", "Class"] + ]], + ["punctuation", ";"], + ["keyword", "="], + ["url", [ + ["punctuation", "<"], + "urn:equivalentClass", + ["punctuation", ">"] + ]], + ["punctuation", "."], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for all keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/turtle/language-tag_feature.test b/package/src/prism/tests/languages/turtle/language-tag_feature.test new file mode 100644 index 00000000..d8a48d1b --- /dev/null +++ b/package/src/prism/tests/languages/turtle/language-tag_feature.test @@ -0,0 +1,63 @@ +show:218 show:localName "That Seventies Show"@en, "test"@en-t-es-t0-abcd . +show:218 show:localName 'Cette Série des Années Soixante-dix'@fr, "Cette Série des Années Septante"@fr-be . + +---------------------------------------------------- + +[ + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "218"] + ]], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "localName"] + ]], + ["string", "\"That Seventies Show\""], + ["tag", [ + ["punctuation", "@"], + "en" + ]], + ["punctuation", ","], + ["string", "\"test\""], + ["tag", [ + ["punctuation", "@"], + "en-t-es-t0-abcd" + ]], + ["punctuation", "."], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "218"] + ]], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "localName"] + ]], + ["string", "'Cette Série des Années Soixante-dix'"], + ["tag", [ + ["punctuation", "@"], + "fr" + ]], + ["punctuation", ","], + ["string", "\"Cette Série des Années Septante\""], + ["tag", [ + ["punctuation", "@"], + "fr-be" + ]], + ["punctuation", "."] +] + +---------------------------------------------------- + +Checks language tags. \ No newline at end of file diff --git a/package/src/prism/tests/languages/turtle/local-name-with-colons_feature.test b/package/src/prism/tests/languages/turtle/local-name-with-colons_feature.test new file mode 100644 index 00000000..9e8abdf1 --- /dev/null +++ b/package/src/prism/tests/languages/turtle/local-name-with-colons_feature.test @@ -0,0 +1,16 @@ +:foo:bar:baz + +---------------------------------------------------- + +[ + ["function", [ + ["prefix", [ + ["punctuation", ":"] + ]], + ["local-name", "foo:bar:baz"] + ]] +] + +---------------------------------------------------- + +Checks that local name containing colons is parsed correctly. \ No newline at end of file diff --git a/package/src/prism/tests/languages/turtle/number_feature.test b/package/src/prism/tests/languages/turtle/number_feature.test new file mode 100644 index 00000000..33c565e3 --- /dev/null +++ b/package/src/prism/tests/languages/turtle/number_feature.test @@ -0,0 +1,143 @@ +<1.1> rdf:value 1 . +<1.2> rdf:value +1 . +<1.3> rdf:value -1 . +<2.1> rdf:value 1.13 . +<2.2> rdf:value +1.13 . +<2.3> rdf:value -1.13 . +<3.1> rdf:value 1e3 . +<3.2> rdf:value +1e3 . +<3.3> rdf:value -1e3 . + +---------------------------------------------------- + +[ + ["url", [ + ["punctuation", "<"], + "1.1", + ["punctuation", ">"] + ]], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]], + ["local-name", "value"] + ]], + ["number", "1"], + ["punctuation", "."], + ["url", [ + ["punctuation", "<"], + "1.2", + ["punctuation", ">"] + ]], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]], + ["local-name", "value"] + ]], + ["number", "+1"], + ["punctuation", "."], + ["url", [ + ["punctuation", "<"], + "1.3", + ["punctuation", ">"] + ]], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]], + ["local-name", "value"] + ]], + ["number", "-1"], + ["punctuation", "."], + ["url", [ + ["punctuation", "<"], + "2.1", + ["punctuation", ">"] + ]], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]], + ["local-name", "value"] + ]], + ["number", "1.13"], + ["punctuation", "."], + ["url", [ + ["punctuation", "<"], + "2.2", + ["punctuation", ">"] + ]], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]], + ["local-name", "value"] + ]], + ["number", "+1.13"], + ["punctuation", "."], + ["url", [ + ["punctuation", "<"], + "2.3", + ["punctuation", ">"] + ]], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]], + ["local-name", "value"] + ]], + ["number", "-1.13"], + ["punctuation", "."], + ["url", [ + ["punctuation", "<"], + "3.1", + ["punctuation", ">"] + ]], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]], + ["local-name", "value"] + ]], + ["number", "1e3"], + ["punctuation", "."], + ["url", [ + ["punctuation", "<"], + "3.2", + ["punctuation", ">"] + ]], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]], + ["local-name", "value"] + ]], + ["number", "+1e3"], + ["punctuation", "."], + ["url", [ + ["punctuation", "<"], + "3.3", + ["punctuation", ">"] + ]], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]], + ["local-name", "value"] + ]], + ["number", "-1e3"], + ["punctuation", "."] +] +---------------------------------------------------- + +Checks for supported numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/turtle/punctuation_feature.test b/package/src/prism/tests/languages/turtle/punctuation_feature.test new file mode 100644 index 00000000..36a993aa --- /dev/null +++ b/package/src/prism/tests/languages/turtle/punctuation_feature.test @@ -0,0 +1,122 @@ +@base . + +GRAPH { + a rdfs:Class, ; + = . + a rdf:List ; + rdf:value [ a ; + rdf:value ( () [] ) + ] ; + . +} + +---------------------------------------------------- + +[ + ["keyword", "@base"], + ["url", [ + ["punctuation", "<"], + "http://example.org/", + ["punctuation", ">"] + ]], + ["punctuation", "."], + ["keyword", "GRAPH"], + ["url", [ + ["punctuation", "<"], + "urn:newGraph", + ["punctuation", ">"] + ]], + ["punctuation", "{"], + ["url", [ + ["punctuation", "<"], + "urn:myClass", + ["punctuation", ">"] + ]], + ["keyword", "a"], + ["function", [ + ["prefix", [ + "rdfs", + ["punctuation", ":"] + ]], + ["local-name", "Class"] + ]], + ["punctuation", ","], + ["url", [ + ["punctuation", "<"], + "other-class", + ["punctuation", ">"] + ]], + ["punctuation", ";"], + ["keyword", "="], + ["url", [ + ["punctuation", "<"], + "urn:equivalentClass", + ["punctuation", ">"] + ]], + ["punctuation", "."], + ["url", [ + ["punctuation", "<"], + "urn:myList", + ["punctuation", ">"] + ]], + ["keyword", "a"], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]], + ["local-name", "List"] + ]], + ["punctuation", ";"], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]], + ["local-name", "value"] + ]], + ["punctuation", "["], + ["keyword", "a"], + ["url", [ + ["punctuation", "<"], + "blankNode", + ["punctuation", ">"] + ]], + ["punctuation", ";"], + ["function", [ + ["prefix", [ + "rdf", + ["punctuation", ":"] + ]], + ["local-name", "value"] + ]], + ["punctuation", "("], + ["url", [ + ["punctuation", "<"], + "list", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "of", + ["punctuation", ">"] + ]], + ["url", [ + ["punctuation", "<"], + "things", + ["punctuation", ">"] + ]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", ")"], + ["punctuation", "]"], + ["punctuation", ";"], + ["punctuation", "."], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for all types of punctuation. \ No newline at end of file diff --git a/package/src/prism/tests/languages/turtle/string_feature.test b/package/src/prism/tests/languages/turtle/string_feature.test new file mode 100644 index 00000000..21c6dabc --- /dev/null +++ b/package/src/prism/tests/languages/turtle/string_feature.test @@ -0,0 +1,189 @@ +show:218 rdfs:label "That Seventies Show"^^xsd:string . # literal with XML Schema string datatype +show:218 rdfs:label "That Seventies Show"^^ . # same as above +show:218 rdfs:label "That Seventies Show" . # same again +show:218 show:localName "That Seventies Show"@en . # literal with a language tag +show:218 show:localName 'Cette Série des Années Soixante-dix'@fr . # literal delimited by single quote +show:218 show:localName "Cette Série des Années Septante"@fr-be . # literal with a region subtag +show:218 show:blurb '''This is a multi-line # literal with embedded new lines and quotes +literal with many quotes (""""") +and up to two sequential apostrophes ('').''' . +show:218 show:blurb """This is a multi-line # literal with embedded new lines and apostrophes +literal with many apostrophes (''''') +and up to two sequential quotes ("").""" . + +---------------------------------------------------- + +[ + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "218"] + ]], + ["function", [ + ["prefix", [ + "rdfs", + ["punctuation", ":"] + ]], + ["local-name", "label"] + ]], + ["string", "\"That Seventies Show\""], + ["punctuation", "^^"], + ["function", [ + ["prefix", [ + "xsd", + ["punctuation", ":"] + ]], + ["local-name", "string"] + ]], + ["punctuation", "."], + ["comment", "# literal with XML Schema string datatype"], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "218"] + ]], + ["function", [ + ["prefix", [ + "rdfs", + ["punctuation", ":"] + ]], + ["local-name", "label"] + ]], + ["string", "\"That Seventies Show\""], + ["punctuation", "^^"], + ["url", [ + ["punctuation", "<"], + "http://www.w3.org/2001/XMLSchema#string", + ["punctuation", ">"] + ]], + ["punctuation", "."], + ["comment", "# same as above"], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "218"] + ]], + ["function", [ + ["prefix", [ + "rdfs", + ["punctuation", ":"] + ]], + ["local-name", "label"] + ]], + ["string", "\"That Seventies Show\""], + ["punctuation", "."], + ["comment", "# same again"], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "218"] + ]], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "localName"] + ]], + ["string", "\"That Seventies Show\""], + ["tag", [ + ["punctuation", "@"], + "en" + ]], + ["punctuation", "."], + ["comment", "# literal with a language tag"], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "218"] + ]], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "localName"] + ]], + ["string", "'Cette Série des Années Soixante-dix'"], + ["tag", [ + ["punctuation", "@"], + "fr" + ]], + ["punctuation", "."], + ["comment", "# literal delimited by single quote"], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "218"] + ]], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "localName"] + ]], + ["string", "\"Cette Série des Années Septante\""], + ["tag", [ + ["punctuation", "@"], + "fr-be" + ]], + ["punctuation", "."], + ["comment", "# literal with a region subtag"], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "218"] + ]], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "blurb"] + ]], + ["multiline-string", [ + "'''This is a multi-line ", + ["comment", "# literal with embedded new lines and quotes"], + "\nliteral with many quotes (\"\"\"\"\")\nand up to two sequential apostrophes ('').'''" + ]], + ["punctuation", "."], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "218"] + ]], + ["function", [ + ["prefix", [ + "show", + ["punctuation", ":"] + ]], + ["local-name", "blurb"] + ]], + ["multiline-string", [ + "\"\"\"This is a multi-line ", + ["comment", "# literal with embedded new lines and apostrophes"], + "\nliteral with many apostrophes (''''')\nand up to two sequential quotes (\"\").\"\"\"" + ]], + ["punctuation", "."] +] + +---------------------------------------------------- + +Checks for all keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/twig+pug/twig_inclusion.test b/package/src/prism/tests/languages/twig+pug/twig_inclusion.test new file mode 100644 index 00000000..0e333186 --- /dev/null +++ b/package/src/prism/tests/languages/twig+pug/twig_inclusion.test @@ -0,0 +1,21 @@ +:atpl + {{42}} + +---------------------------------------------------- + +[ + ["filter-atpl", [ + ["filter-name", ":atpl"], + ["text", [ + ["twig", [ + ["delimiter", "{{"], + ["number", "42"], + ["delimiter", "}}"] + ]] + ]] + ]] +] + +---------------------------------------------------- + +Checks for atpl filter (Twig) in pug. diff --git a/package/src/prism/tests/languages/twig/boolean_feature.test b/package/src/prism/tests/languages/twig/boolean_feature.test new file mode 100644 index 00000000..604c83e8 --- /dev/null +++ b/package/src/prism/tests/languages/twig/boolean_feature.test @@ -0,0 +1,27 @@ +{{ null }} +{{- true -}} +{{ false }} + +---------------------------------------------------- + +[ + ["twig", [ + ["delimiter", "{{"], + ["boolean", "null"], + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{-"], + ["boolean", "true"], + ["delimiter", "-}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + ["boolean", "false"], + ["delimiter", "}}"] + ]] +] + +---------------------------------------------------- + +Checks for booleans and null. diff --git a/package/src/prism/tests/languages/twig/comment_feature.test b/package/src/prism/tests/languages/twig/comment_feature.test new file mode 100644 index 00000000..2098d0ae --- /dev/null +++ b/package/src/prism/tests/languages/twig/comment_feature.test @@ -0,0 +1,16 @@ +{##} +{# foo #} +{# foo +bar #} + +---------------------------------------------------- + +[ + ["twig-comment", "{##}"], + ["twig-comment", "{# foo #}"], + ["twig-comment", "{# foo\nbar #}"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/twig/keyword_feature.test b/package/src/prism/tests/languages/twig/keyword_feature.test new file mode 100644 index 00000000..7e7d9849 --- /dev/null +++ b/package/src/prism/tests/languages/twig/keyword_feature.test @@ -0,0 +1,68 @@ +{% for foo in bar if baz %}{% endfor %} +{%- if foo() -%}{%- endif -%} +{% macro foobar() %}{% endmacro %} +{{ foo is even or bar is odd }} + +---------------------------------------------------- + +[ + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "for"], + " foo ", + ["operator", "in"], + " bar ", + ["keyword", "if"], + " baz ", + ["delimiter", "%}"] + ]], + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "endfor"], + ["delimiter", "%}"] + ]], + + ["twig", [ + ["delimiter", "{%-"], + ["tag-name", "if"], + " foo", + ["punctuation", "("], + ["punctuation", ")"], + ["delimiter", "-%}"] + ]], + ["twig", [ + ["delimiter", "{%-"], + ["tag-name", "endif"], + ["delimiter", "-%}"] + ]], + + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "macro"], + " foobar", + ["punctuation", "("], + ["punctuation", ")"], + ["delimiter", "%}"] + ]], + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "endmacro"], + ["delimiter", "%}"] + ]], + + ["twig", [ + ["delimiter", "{{"], + " foo ", + ["operator", "is"], + ["keyword", "even"], + ["operator", "or"], + " bar ", + ["operator", "is"], + ["keyword", "odd"], + ["delimiter", "}}"] + ]] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/twig/markup_feature.test b/package/src/prism/tests/languages/twig/markup_feature.test new file mode 100644 index 00000000..06f30d58 --- /dev/null +++ b/package/src/prism/tests/languages/twig/markup_feature.test @@ -0,0 +1,168 @@ + + + + My Webpage + + + + +

    My Webpage

    + {{ a_variable }} + + + +---------------------------------------------------- + +[ + ["doctype", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["html"]], + ["punctuation", ">"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["head"]], + ["punctuation", ">"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["title"]], + ["punctuation", ">"] + ]], + "My Webpage", + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["body"]], + ["punctuation", ">"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["ul"]], + ["attr-name", ["id"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "navigation", + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "for"], + " item ", + ["operator", "in"], + " navigation ", + ["delimiter", "%}"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["li"]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["a"]], + ["attr-name", ["href"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["twig", [ + ["delimiter", "{{"], + " item", + ["punctuation", "."], + "href ", + ["delimiter", "}}"] + ]], + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + ["twig", [ + ["delimiter", "{{"], + " item", + ["punctuation", "."], + "caption ", + ["delimiter", "}}"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "endfor"], + ["delimiter", "%}"] + ]], + + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["h1"]], + ["punctuation", ">"] + ]], + "My Webpage", + ["tag", [ + ["punctuation", ""] + ]], + + ["twig", [ + ["delimiter", "{{"], + " a_variable ", + ["delimiter", "}}"] + ]], + + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", ""] + ]] +] diff --git a/package/src/prism/tests/languages/twig/number_feature.test b/package/src/prism/tests/languages/twig/number_feature.test new file mode 100644 index 00000000..d61f3be3 --- /dev/null +++ b/package/src/prism/tests/languages/twig/number_feature.test @@ -0,0 +1,45 @@ +{{ 0xBadFace }} +{{ 42 }} +{{ 3.14159 }} +{{ 3e15 }} +{{ 4.5E-4 }} +{{ 0.2e+8 }} + +---------------------------------------------------- + +[ + ["twig", [ + ["delimiter", "{{"], + ["number", "0xBadFace"], + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + ["number", "42"], + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + ["number", "3.14159"], + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + ["number", "3e15"], + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + ["number", "4.5E-4"], + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + ["number", "0.2e+8"], + ["delimiter", "}}"] + ]] +] + +---------------------------------------------------- + +Checks for hexadecimal and decimal numbers. diff --git a/package/src/prism/tests/languages/twig/operator_feature.test b/package/src/prism/tests/languages/twig/operator_feature.test new file mode 100644 index 00000000..59b27439 --- /dev/null +++ b/package/src/prism/tests/languages/twig/operator_feature.test @@ -0,0 +1,252 @@ +{% set a = 4 %} +{{ a == 4 }} +{{ b != c }} +{{ c < d }} +{{ d <= e }} +{{ e > f }} +{{ f >= g }} +{{ g + h }} +{{ h - i }} +{{ i ~ j }} +{{ j * k }} +{{ k ** l }} +{{ l / m }} +{{ m // n }} +{{ n % o }} +{{ o|default('foo') }} +{{ p ? q : r }} +{{ s ?: t }} + +{% if a and b or not c %} +{% for p in foo %} +{% if d b-and e and f b-xor g or h b-or i %} +{% if j starts with 'h' %} +{% if i ends with 'j' %} +{% if k is same as false %} +{% if l matches '/f[o]{2,}(?:bar)?' %} + +---------------------------------------------------- + +[ + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "set"], + " a ", + ["operator", "="], + ["number", "4"], + ["delimiter", "%}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " a ", + ["operator", "=="], + ["number", "4"], + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " b ", + ["operator", "!="], + " c ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " c ", + ["operator", "<"], + " d ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " d ", + ["operator", "<="], + " e ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " e ", + ["operator", ">"], + " f ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " f ", + ["operator", ">="], + " g ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " g ", + ["operator", "+"], + " h ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " h ", + ["operator", "-"], + " i ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " i ", + ["operator", "~"], + " j ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " j ", + ["operator", "*"], + " k ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " k ", + ["operator", "**"], + " l ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " l ", + ["operator", "/"], + " m ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " m ", + ["operator", "//"], + " n ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " n ", + ["operator", "%"], + " o ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " o", + ["operator", "|"], + "default", + ["punctuation", "("], + ["string", [ + ["punctuation", "'"], + "foo", + ["punctuation", "'"] + ]], + ["punctuation", ")"], + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " p ", + ["operator", "?"], + " q ", + ["punctuation", ":"], + " r ", + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + " s ", + ["operator", "?:"], + " t ", + ["delimiter", "}}"] + ]], + + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "if"], + " a ", + ["operator", "and"], + " b ", + ["operator", "or"], + ["operator", "not"], + " c ", + ["delimiter", "%}"] + ]], + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "for"], + " p ", + ["operator", "in"], + " foo ", + ["delimiter", "%}"] + ]], + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "if"], + " d ", + ["operator", "b-and"], + " e ", + ["operator", "and"], + " f ", + ["operator", "b-xor"], + " g ", + ["operator", "or"], + " h ", + ["operator", "b-or"], + " i ", + ["delimiter", "%}"] + ]], + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "if"], + " j ", + ["operator", "starts with"], + ["string", [ + ["punctuation", "'"], + "h", + ["punctuation", "'"] + ]], + ["delimiter", "%}"] + ]], + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "if"], + " i ", + ["operator", "ends with"], + ["string", [ + ["punctuation", "'"], + "j", + ["punctuation", "'"] + ]], + ["delimiter", "%}"] + ]], + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "if"], + " k ", + ["operator", "is"], + ["operator", "same as"], + ["boolean", "false"], + ["delimiter", "%}"] + ]], + ["twig", [ + ["delimiter", "{%"], + ["tag-name", "if"], + " l ", + ["operator", "matches"], + ["string", [ + ["punctuation", "'"], + "/f[o]{2,}(?:bar)?", + ["punctuation", "'"] + ]], + ["delimiter", "%}"] + ]] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/twig/string_feature.test b/package/src/prism/tests/languages/twig/string_feature.test new file mode 100644 index 00000000..9bf79016 --- /dev/null +++ b/package/src/prism/tests/languages/twig/string_feature.test @@ -0,0 +1,47 @@ +{{ '' }} +{{ "" }} +{{ "ba\"r" }} +{{ 'ba\'z' }} + +---------------------------------------------------- + +[ + ["twig", [ + ["delimiter", "{{"], + ["string", [ + ["punctuation", "'"], + ["punctuation", "'"] + ]], + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + ["string", [ + ["punctuation", "\""], + ["punctuation", "\""] + ]], + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + ["string", [ + ["punctuation", "\""], + "ba\\\"r", + ["punctuation", "\""] + ]], + ["delimiter", "}}"] + ]], + ["twig", [ + ["delimiter", "{{"], + ["string", [ + ["punctuation", "'"], + "ba\\'z", + ["punctuation", "'"] + ]], + ["delimiter", "}}"] + ]] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/typescript/builtin_feature.test b/package/src/prism/tests/languages/typescript/builtin_feature.test new file mode 100644 index 00000000..34081a33 --- /dev/null +++ b/package/src/prism/tests/languages/typescript/builtin_feature.test @@ -0,0 +1,31 @@ +string +Function +any +number +boolean +Array +symbol +console +Promise +unknown +never + +---------------------------------------------------- + +[ + ["builtin", "string"], + ["builtin", "Function"], + ["builtin", "any"], + ["builtin", "number"], + ["builtin", "boolean"], + ["builtin", "Array"], + ["builtin", "symbol"], + "\nconsole\n", + ["builtin", "Promise"], + ["builtin", "unknown"], + ["builtin", "never"] +] + +---------------------------------------------------- + +Checks for builtins. diff --git a/package/src/prism/tests/languages/typescript/class-name_feature.test b/package/src/prism/tests/languages/typescript/class-name_feature.test new file mode 100644 index 00000000..6d3cf039 --- /dev/null +++ b/package/src/prism/tests/languages/typescript/class-name_feature.test @@ -0,0 +1,125 @@ +interface Dictionary { + [key: string]: T; +} + +interface Foo extends Dictionary {} + +class Bar extends Baz implements FooBar {} + +type Record = { + [P in K]: T; +} +type Diff = T extends U ? never : T; + +---------------------------------------------------- + +[ + ["keyword", "interface"], + ["class-name", [ + "Dictionary", + ["operator", "<"], + ["constant", "T"], + ["operator", ">"] + ]], + ["punctuation", "{"], + ["punctuation", "["], + "key", + ["operator", ":"], + ["builtin", "string"], + ["punctuation", "]"], + ["operator", ":"], + ["constant", "T"], + ["punctuation", ";"], + ["punctuation", "}"], + + ["keyword", "interface"], + ["class-name", [ + "Foo" + ]], + ["keyword", "extends"], + ["class-name", [ + "Dictionary", + ["operator", "<"], + ["builtin", "number"], + ["operator", ">"] + ]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "class"], + ["class-name", [ + "Bar", + ["operator", "<"], + ["constant", "T"], + ["operator", ">"] + ]], + ["keyword", "extends"], + ["class-name", [ + "Baz", + ["operator", "<"], + ["constant", "T"], + ["operator", ">"] + ]], + ["keyword", "implements"], + ["class-name", [ + "FooBar", + ["operator", "<"], + ["builtin", "number"], + ["punctuation", ","], + ["constant", "T"], + ["operator", "|"], + ["keyword", "null"], + ["operator", ">"] + ]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "type"], + ["class-name", [ + "Record", + ["operator", "<"], + ["constant", "K"], + ["keyword", "extends"], + ["keyword", "keyof"], + ["builtin", "any"], + ["punctuation", ","], + ["constant", "T"], + ["operator", ">"] + ]], + ["operator", "="], + ["punctuation", "{"], + ["punctuation", "["], + ["constant", "P"], + ["keyword", "in"], + ["constant", "K"], + ["punctuation", "]"], + ["operator", ":"], + ["constant", "T"], + ["punctuation", ";"], + ["punctuation", "}"], + + ["keyword", "type"], + ["class-name", [ + "Diff", + ["operator", "<"], + ["constant", "T"], + ["punctuation", ","], + ["constant", "U"], + ["operator", ">"] + ]], + ["operator", "="], + ["constant", "T"], + ["keyword", "extends"], + ["class-name", [ + ["constant", "U"] + ]], + ["operator", "?"], + ["builtin", "never"], + ["operator", ":"], + ["constant", "T"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for class, interface, and other type names. diff --git a/package/src/prism/tests/languages/typescript/decorator_feature.test b/package/src/prism/tests/languages/typescript/decorator_feature.test new file mode 100644 index 00000000..272628f1 --- /dev/null +++ b/package/src/prism/tests/languages/typescript/decorator_feature.test @@ -0,0 +1,121 @@ +@f @g x + +@f +@g +x + +@sealed +class ExampleClass { + + @first() + @second() + method() {} + + @enumerable(false) + greet() { + return "Hello, " + this.greeting; + } + + @configurable(false) + get y() { + return this._y; + } + +} + +---------------------------------------------------- + +[ + ["decorator", [ + ["at", "@"], + ["function", "f"] + ]], + ["decorator", [ + ["at", "@"], + ["function", "g"] + ]], + " x\n\n", + + ["decorator", [ + ["at", "@"], + ["function", "f"] + ]], + ["decorator", [ + ["at", "@"], + ["function", "g"] + ]], + "\nx\n\n", + + ["decorator", [ + ["at", "@"], + ["function", "sealed"] + ]], + ["keyword", "class"], ["class-name", ["ExampleClass"]], ["punctuation", "{"], + + ["decorator", [ + ["at", "@"], + ["function", "first"] + ]], + ["punctuation", "("], + ["punctuation", ")"], + + ["decorator", [ + ["at", "@"], + ["function", "second"] + ]], + ["punctuation", "("], + ["punctuation", ")"], + + ["function", ["method"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["decorator", [ + ["at", "@"], + ["function", "enumerable"] + ]], + ["punctuation", "("], + ["boolean", "false"], + ["punctuation", ")"], + + ["function", ["greet"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + + ["keyword", "return"], + ["string", "\"Hello, \""], + ["operator", "+"], + ["keyword", "this"], + ["punctuation", "."], + ["property-access", ["greeting"]], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["decorator", [ + ["at", "@"], + ["function", "configurable"] + ]], + ["punctuation", "("], + ["boolean", "false"], + ["punctuation", ")"], + + ["keyword", "get"], + ["function", ["y"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + + ["keyword", "return"], + ["keyword", "this"], + ["punctuation", "."], + ["property-access", ["_y"]], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/typescript/function_feature.test b/package/src/prism/tests/languages/typescript/function_feature.test new file mode 100644 index 00000000..81586b6a --- /dev/null +++ b/package/src/prism/tests/languages/typescript/function_feature.test @@ -0,0 +1,91 @@ +function getProperty(o: T, propertyName: K): T[K] { } + +declare function f(x: T): T extends true ? string : number; + +function assert(condition: any, msg?: string): asserts condition { } + +---------------------------------------------------- + +[ + ["keyword", "function"], + ["generic-function", [ + ["function", "getProperty"], + ["generic", [ + ["operator", "<"], + ["constant", "T"], + ["punctuation", ","], + ["constant", "K"], + ["keyword", "extends"], + ["keyword", "keyof"], + ["constant", "T"], + ["operator", ">"] + ]] + ]], + ["punctuation", "("], + "o", + ["operator", ":"], + ["constant", "T"], + ["punctuation", ","], + " propertyName", + ["operator", ":"], + ["constant", "K"], + ["punctuation", ")"], + ["operator", ":"], + ["constant", "T"], + ["punctuation", "["], + ["constant", "K"], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "declare"], + ["keyword", "function"], + ["generic-function", [ + ["function", "f"], + ["generic", [ + ["operator", "<"], + ["constant", "T"], + ["keyword", "extends"], + ["builtin", "boolean"], + ["operator", ">"] + ]] + ]], + ["punctuation", "("], + "x", + ["operator", ":"], + ["constant", "T"], + ["punctuation", ")"], + ["operator", ":"], + ["constant", "T"], + ["keyword", "extends"], + ["class-name", [ + ["boolean", "true"] + ]], + ["operator", "?"], + ["builtin", "string"], + ["operator", ":"], + ["builtin", "number"], + ["punctuation", ";"], + + ["keyword", "function"], + ["function", ["assert"]], + ["punctuation", "("], + "condition", + ["operator", ":"], + ["builtin", "any"], + ["punctuation", ","], + " msg", + ["operator", "?"], + ["operator", ":"], + ["builtin", "string"], + ["punctuation", ")"], + ["operator", ":"], + ["keyword", "asserts"], + " condition ", + ["punctuation", "{"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for functions. diff --git a/package/src/prism/tests/languages/typescript/issue2819.test b/package/src/prism/tests/languages/typescript/issue2819.test new file mode 100644 index 00000000..1a1517b5 --- /dev/null +++ b/package/src/prism/tests/languages/typescript/issue2819.test @@ -0,0 +1,38 @@ +@Component({ + selector: 'my-app', + template: `
    Hello World!
    ` +}) +export class AppComponent {} + +---------------------------------------------------- + +[ + ["decorator", [ + ["at", "@"], + ["function", "Component"] + ]], + ["punctuation", "("], + ["punctuation", "{"], + + "\n selector", + ["operator", ":"], + ["string", "'my-app'"], + ["punctuation", ","], + + "\n template", + ["operator", ":"], + ["template-string", [ + ["template-punctuation", "`"], + ["string", "
    Hello World!
    "], + ["template-punctuation", "`"] + ]], + + ["punctuation", "}"], + ["punctuation", ")"], + + ["keyword", "export"], + ["keyword", "class"], + ["class-name", ["AppComponent"]], + ["punctuation", "{"], + ["punctuation", "}"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/typescript/issue2860.test b/package/src/prism/tests/languages/typescript/issue2860.test new file mode 100644 index 00000000..3d6b56c8 --- /dev/null +++ b/package/src/prism/tests/languages/typescript/issue2860.test @@ -0,0 +1,37 @@ +export interface R { + data: T; + total: number; + type?: string; +} + +---------------------------------------------------- + +[ + ["keyword", "export"], + ["keyword", "interface"], + ["class-name", [ + ["constant", "R"], + ["operator", "<"], + ["constant", "T"], + ["operator", ">"] + ]], + ["punctuation", "{"], + + "\n data", + ["operator", ":"], + ["constant", "T"], + ["punctuation", ";"], + + "\n total", + ["operator", ":"], + ["builtin", "number"], + ["punctuation", ";"], + + "\n type", + ["operator", "?"], + ["operator", ":"], + ["builtin", "string"], + ["punctuation", ";"], + + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/typescript/issue3000.test b/package/src/prism/tests/languages/typescript/issue3000.test new file mode 100644 index 00000000..0617bd2e --- /dev/null +++ b/package/src/prism/tests/languages/typescript/issue3000.test @@ -0,0 +1,51 @@ +import { infer, inference, infer } from 'module' +// ~~~~~ ✅ + +import { type, typeDefs, type } from 'module' +// ~~~~ ✅ + +import { const, constants, const } from 'module' +// ~~~~~ ✅ + +---------------------------------------------------- + +[ + ["keyword", "import"], + ["punctuation", "{"], + " infer", + ["punctuation", ","], + " inference", + ["punctuation", ","], + " infer ", + ["punctuation", "}"], + ["keyword", "from"], + ["string", "'module'"], + + ["comment", "// ~~~~~ ✅"], + + ["keyword", "import"], + ["punctuation", "{"], + " type", + ["punctuation", ","], + " typeDefs", + ["punctuation", ","], + " type ", + ["punctuation", "}"], + ["keyword", "from"], + ["string", "'module'"], + + ["comment", "// ~~~~ ✅"], + + ["keyword", "import"], + ["punctuation", "{"], + ["keyword", "const"], + ["punctuation", ","], + " constants", + ["punctuation", ","], + ["keyword", "const"], + ["punctuation", "}"], + ["keyword", "from"], + ["string", "'module'"], + + ["comment", "// ~~~~~ ✅"] +] diff --git a/package/src/prism/tests/languages/typescript/keyword_feature.test b/package/src/prism/tests/languages/typescript/keyword_feature.test new file mode 100644 index 00000000..be604446 --- /dev/null +++ b/package/src/prism/tests/languages/typescript/keyword_feature.test @@ -0,0 +1,285 @@ +as; +await; +break; +case; +class; +const; +continue; +debugger; +default; +delete; +do; +else; +enum; +export; +extends; +for; +if; +implements; +import; +in; +instanceof; +interface; +let; +new; +null; +of; +package; +private; +protected; +public; +return; +static; +super; +switch; +this; +throw; +try; +typeof; +undefined; +var; +void; +while; +with; +yield; + +// contextual keywords + +try {} catch {} finally {} +try {} catch (e) {} finally {} +async function (){} +async a => {} +async (a,b,c) => {} +import {} from "foo" +import {} from 'foo' +class { get foo(){} set baz(){} get [value](){} } + +// variables, not keywords + +const { async, from, to } = bar; +promise.catch(foo).finally(bar); + +// TypeScript keywords + +abstract; +as; +declare; +implements; +is; +keyof; +readonly; +require; + +// contextual keywords + +asserts foo; +infer foo; +interface foo; +module foo; +namespace foo; +type foo; + +import type { Component } from "react"; +import type *, {} + +---------------------------------------------------- + +[ + ["keyword", "as"], ["punctuation", ";"], + ["keyword", "await"], ["punctuation", ";"], + ["keyword", "break"], ["punctuation", ";"], + ["keyword", "case"], ["punctuation", ";"], + ["keyword", "class"], ["punctuation", ";"], + ["keyword", "const"], ["punctuation", ";"], + ["keyword", "continue"], ["punctuation", ";"], + ["keyword", "debugger"], ["punctuation", ";"], + ["keyword", "default"], ["punctuation", ";"], + ["keyword", "delete"], ["punctuation", ";"], + ["keyword", "do"], ["punctuation", ";"], + ["keyword", "else"], ["punctuation", ";"], + ["keyword", "enum"], ["punctuation", ";"], + ["keyword", "export"], ["punctuation", ";"], + ["keyword", "extends"], ["punctuation", ";"], + ["keyword", "for"], ["punctuation", ";"], + ["keyword", "if"], ["punctuation", ";"], + ["keyword", "implements"], ["punctuation", ";"], + ["keyword", "import"], ["punctuation", ";"], + ["keyword", "in"], ["punctuation", ";"], + ["keyword", "instanceof"], ["punctuation", ";"], + ["keyword", "interface"], ["punctuation", ";"], + ["keyword", "let"], ["punctuation", ";"], + ["keyword", "new"], ["punctuation", ";"], + ["keyword", "null"], ["punctuation", ";"], + ["keyword", "of"], ["punctuation", ";"], + ["keyword", "package"], ["punctuation", ";"], + ["keyword", "private"], ["punctuation", ";"], + ["keyword", "protected"], ["punctuation", ";"], + ["keyword", "public"], ["punctuation", ";"], + ["keyword", "return"], ["punctuation", ";"], + ["keyword", "static"], ["punctuation", ";"], + ["keyword", "super"], ["punctuation", ";"], + ["keyword", "switch"], ["punctuation", ";"], + ["keyword", "this"], ["punctuation", ";"], + ["keyword", "throw"], ["punctuation", ";"], + ["keyword", "try"], ["punctuation", ";"], + ["keyword", "typeof"], ["punctuation", ";"], + ["keyword", "undefined"], ["punctuation", ";"], + ["keyword", "var"], ["punctuation", ";"], + ["keyword", "void"], ["punctuation", ";"], + ["keyword", "while"], ["punctuation", ";"], + ["keyword", "with"], ["punctuation", ";"], + ["keyword", "yield"], ["punctuation", ";"], + + ["comment", "// contextual keywords"], + + ["keyword", "try"], + ["punctuation", "{"], + ["punctuation", "}"], + ["keyword", "catch"], + ["punctuation", "{"], + ["punctuation", "}"], + ["keyword", "finally"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "try"], + ["punctuation", "{"], + ["punctuation", "}"], + ["keyword", "catch"], + ["punctuation", "("], + "e", + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["keyword", "finally"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "async"], + ["keyword", "function"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "async"], + " a ", + ["operator", "=>"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "async"], + ["punctuation", "("], + "a", + ["punctuation", ","], + "b", + ["punctuation", ","], + "c", + ["punctuation", ")"], + ["operator", "=>"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "import"], + ["punctuation", "{"], + ["punctuation", "}"], + ["keyword", "from"], + ["string", "\"foo\""], + + ["keyword", "import"], + ["punctuation", "{"], + ["punctuation", "}"], + ["keyword", "from"], + ["string", "'foo'"], + + ["keyword", "class"], + ["punctuation", "{"], + ["keyword", "get"], + ["function", ["foo"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["keyword", "set"], + ["function", ["baz"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["keyword", "get"], + ["punctuation", "["], + "value", + ["punctuation", "]"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "}"], + + ["comment", "// variables, not keywords"], + + ["keyword", "const"], + ["punctuation", "{"], + " async", + ["punctuation", ","], + " from", + ["punctuation", ","], + " to ", + ["punctuation", "}"], + ["operator", "="], + " bar", + ["punctuation", ";"], + + "\npromise", + ["punctuation", "."], + ["function", ["catch"]], + ["punctuation", "("], + "foo", + ["punctuation", ")"], + ["punctuation", "."], + ["function", ["finally"]], + ["punctuation", "("], + "bar", + ["punctuation", ")"], + ["punctuation", ";"], + + ["comment", "// TypeScript keywords"], + + ["keyword", "abstract"], ["punctuation", ";"], + ["keyword", "as"], ["punctuation", ";"], + ["keyword", "declare"], ["punctuation", ";"], + ["keyword", "implements"], ["punctuation", ";"], + ["keyword", "is"], ["punctuation", ";"], + ["keyword", "keyof"], ["punctuation", ";"], + ["keyword", "readonly"], ["punctuation", ";"], + ["keyword", "require"], ["punctuation", ";"], + + ["comment", "// contextual keywords"], + + ["keyword", "asserts"], " foo", ["punctuation", ";"], + ["keyword", "infer"], " foo", ["punctuation", ";"], + ["keyword", "interface"], ["class-name", ["foo"]], ["punctuation", ";"], + ["keyword", "module"], " foo", ["punctuation", ";"], + ["keyword", "namespace"], " foo", ["punctuation", ";"], + ["keyword", "type"], ["class-name", ["foo"]], ["punctuation", ";"], + + ["keyword", "import"], + ["keyword", "type"], + ["punctuation", "{"], + ["maybe-class-name", "Component"], + ["punctuation", "}"], + ["keyword", "from"], + ["string", "\"react\""], + ["punctuation", ";"], + + ["keyword", "import"], + ["keyword", "type"], + ["operator", "*"], + ["punctuation", ","], + ["punctuation", "{"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/typoscript/comment_feature.test b/package/src/prism/tests/languages/typoscript/comment_feature.test new file mode 100644 index 00000000..5d744f44 --- /dev/null +++ b/package/src/prism/tests/languages/typoscript/comment_feature.test @@ -0,0 +1,23 @@ +// comment +# comment +text // comment +/* +comment +*/ +foo = bar // comment +baz = //url + +---------------------------------------------------- + +[ + ["comment", "// comment"], + ["comment", "# comment"], + ["tag", ["text"]], ["comment", "// comment"], + ["comment", "/*\ncomment\n*/"], + ["tag", ["foo"]], ["operator", "="], ["string", ["bar "]], ["comment", "// comment"], + ["tag", ["baz"]], ["operator", "="], ["string", ["//url"]] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/typoscript/function_feature.test b/package/src/prism/tests/languages/typoscript/function_feature.test new file mode 100644 index 00000000..75faf212 --- /dev/null +++ b/package/src/prism/tests/languages/typoscript/function_feature.test @@ -0,0 +1,15 @@ +@import 'foo' +@import "bar" + + +---------------------------------------------------- + +[ + ["function", ["@import ", ["string", "'foo'"]]], + ["function", ["@import ", ["string", "\"bar\""]]], + ["function", ["<", ["keyword", "INCLUDE_TYPOSCRIPT"], ": source=", ["string", ["\"", ["keyword", "FILE"], ":", ["keyword", "EXT"], ":baz.typoscript\""]], ">"]] +] + +---------------------------------------------------- + +Checks for import functions. diff --git a/package/src/prism/tests/languages/typoscript/keyword_feature.test b/package/src/prism/tests/languages/typoscript/keyword_feature.test new file mode 100644 index 00000000..e5b12419 --- /dev/null +++ b/package/src/prism/tests/languages/typoscript/keyword_feature.test @@ -0,0 +1,69 @@ +TEXT LLL EXT _GIFBUILDER CARRAY CASE CLEARGIF COA COA_INT CONSTANTS CONTENT +EDITPANEL EFFECT FILE FORM FRAME FRAMESET FLUIDTEMPLATE GIFBUILDER +global globalString globalVar GMENU GMENU_FOLDOUT GMENU_LAYERS GP +HMENU HRULER HTML IENV IMAGE IMG_RESOURCE IMGMENU IMGMENUITEM IMGTEXT +JSMENU JSMENUITEM LOAD_REGISTER PAGE RECORDS RESTORE_REGISTER TEMPLATE +TMENU TMENU_LAYERS TMENUITEM USER USER_INT INCLUDE_TYPOSCRIPT NO ACT +IFSUB ACTIFSUB CUR + +---------------------------------------------------- + +[ + ["keyword", "TEXT"], + ["keyword", "LLL"], + ["keyword", "EXT"], + ["keyword", "_GIFBUILDER"], + ["keyword", "CARRAY"], + ["keyword", "CASE"], + ["keyword", "CLEARGIF"], + ["keyword", "COA"], + ["keyword", "COA_INT"], + ["keyword", "CONSTANTS"], + ["keyword", "CONTENT"], + ["keyword", "EDITPANEL"], + ["keyword", "EFFECT"], + ["keyword", "FILE"], + ["keyword", "FORM"], + ["keyword", "FRAME"], + ["keyword", "FRAMESET"], + ["keyword", "FLUIDTEMPLATE"], + ["keyword", "GIFBUILDER"], + ["keyword", "global"], + ["keyword", "globalString"], + ["keyword", "globalVar"], + ["keyword", "GMENU"], + ["keyword", "GMENU_FOLDOUT"], + ["keyword", "GMENU_LAYERS"], + ["keyword", "GP"], + ["keyword", "HMENU"], + ["keyword", "HRULER"], + ["keyword", "HTML"], + ["keyword", "IENV"], + ["keyword", "IMAGE"], + ["keyword", "IMG_RESOURCE"], + ["keyword", "IMGMENU"], + ["keyword", "IMGMENUITEM"], + ["keyword", "IMGTEXT"], + ["keyword", "JSMENU"], + ["keyword", "JSMENUITEM"], + ["keyword", "LOAD_REGISTER"], + ["keyword", "PAGE"], + ["keyword", "RECORDS"], + ["keyword", "RESTORE_REGISTER"], + ["keyword", "TEMPLATE"], + ["keyword", "TMENU"], + ["keyword", "TMENU_LAYERS"], + ["keyword", "TMENUITEM"], + ["keyword", "USER"], + ["keyword", "USER_INT"], + ["keyword", "INCLUDE_TYPOSCRIPT"], + ["keyword", "NO"], + ["keyword", "ACT"], + ["keyword", "IFSUB"], + ["keyword", "ACTIFSUB"], + ["keyword", "CUR"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/typoscript/number_feature.test b/package/src/prism/tests/languages/typoscript/number_feature.test new file mode 100644 index 00000000..ea3eb9cb --- /dev/null +++ b/package/src/prism/tests/languages/typoscript/number_feature.test @@ -0,0 +1,32 @@ +foo = 423 +bar=1 +baz.10 = + +---------------------------------------------------- + +[ + ["tag", ["foo"]], + ["operator", "="], + ["string", [ + ["number", "423"] + ]], + + ["tag", ["bar"]], + ["operator", "="], + ["string", [ + ["number", "1"] + ]], + + ["tag", [ + "baz", + ["punctuation", "."] + ]], + ["number", [ + "10 ", + ["operator", "="] + ]] +] + +---------------------------------------------------- + +Checks for import functions. diff --git a/package/src/prism/tests/languages/typoscript/tag_string_feature.test b/package/src/prism/tests/languages/typoscript/tag_string_feature.test new file mode 100644 index 00000000..fde4c48e --- /dev/null +++ b/package/src/prism/tests/languages/typoscript/tag_string_feature.test @@ -0,0 +1,37 @@ +foo.bar.baz = HMENU +foo.bar.baz { + baz.foo = bar + bar = {$const.foo} + foo = LLL:EXT:str + IFSUB < .NO + IFSUB = 1 + IFSUB { + foo = bar + } +} +Namespace\Classes\Test { + baz.foo = bar +} + +---------------------------------------------------- + +[ + ["tag", ["foo",["punctuation", "."]]], ["tag", ["bar", ["punctuation", "."]]],["tag", ["baz"]], ["operator", "="], ["string", [["keyword", "HMENU"]]], + ["tag", ["foo", ["punctuation", "."]]], ["tag", ["bar", ["punctuation", "."]]], ["tag", ["baz"]], ["punctuation", "{"], + ["tag", ["baz", ["punctuation", "."]]], ["tag", ["foo"]], ["operator", "="], ["string", ["bar"]], + ["tag", ["bar"]], ["operator", "="], ["string", [["function", "{$const.foo}"]]], + ["tag", ["foo"]],["operator", "="], ["string", [["keyword", "LLL"], ["punctuation", ":"], ["keyword", "EXT"], ["punctuation", ":"], "str"]], + ["keyword", "IFSUB"], ["operator", "<"], ["punctuation", "."],["keyword", "NO"], + ["keyword", "IFSUB"], ["operator", "="], ["string", [["number", "1"]]], + ["keyword", "IFSUB"], ["punctuation", "{"], + ["tag", ["foo"]], ["operator", "="], ["string", ["bar"]], + ["punctuation", "}"], + ["punctuation", "}"], + ["tag", ["Namespace\\Classes\\Test"]], ["punctuation", "{"], + ["tag", ["baz", ["punctuation", "."]]], ["tag", ["foo"]], ["operator", "="], ["string", ["bar"]], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for tags and string. diff --git a/package/src/prism/tests/languages/unrealscript/boolean_feature.test b/package/src/prism/tests/languages/unrealscript/boolean_feature.test new file mode 100644 index 00000000..c653fdbe --- /dev/null +++ b/package/src/prism/tests/languages/unrealscript/boolean_feature.test @@ -0,0 +1,13 @@ +false +true + +---------------------------------------------------- + +[ + ["boolean", "false"], + ["boolean", "true"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/unrealscript/category_feature.test b/package/src/prism/tests/languages/unrealscript/category_feature.test new file mode 100644 index 00000000..dd215ce8 --- /dev/null +++ b/package/src/prism/tests/languages/unrealscript/category_feature.test @@ -0,0 +1,52 @@ +// MyBool is visible but not editable in UnrealEd +var(MyCategory) editconst bool MyBool; + +// MyBool is visible but not editable in UnrealEd and +// not changeable in script +var(MyCategory) const editconst bool MyBool; + +// MyBool is visible and can be set in UnrealEd but +// not changeable in script +var(MyCategory) const bool MyBool; + +---------------------------------------------------- + +[ + ["comment", "// MyBool is visible but not editable in UnrealEd"], + + ["keyword", "var"], + ["punctuation", "("], + ["category", "MyCategory"], + ["punctuation", ")"], + ["keyword", "editconst"], + ["keyword", "bool"], + " MyBool", + ["punctuation", ";"], + + ["comment", "// MyBool is visible but not editable in UnrealEd and"], + + ["comment", "// not changeable in script"], + + ["keyword", "var"], + ["punctuation", "("], + ["category", "MyCategory"], + ["punctuation", ")"], + ["keyword", "const"], + ["keyword", "editconst"], + ["keyword", "bool"], + " MyBool", + ["punctuation", ";"], + + ["comment", "// MyBool is visible and can be set in UnrealEd but"], + + ["comment", "// not changeable in script"], + + ["keyword", "var"], + ["punctuation", "("], + ["category", "MyCategory"], + ["punctuation", ")"], + ["keyword", "const"], + ["keyword", "bool"], + " MyBool", + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/unrealscript/class-name_feature.test b/package/src/prism/tests/languages/unrealscript/class-name_feature.test new file mode 100644 index 00000000..182dd62b --- /dev/null +++ b/package/src/prism/tests/languages/unrealscript/class-name_feature.test @@ -0,0 +1,51 @@ +class Foo extends Bar; +struct Baz {}; +enum FooBar {}; +interface IFoo extends IBar; + +state Action {} +state() Defense {} + +---------------------------------------------------- + +[ + ["keyword", "class"], + ["class-name", "Foo"], + ["keyword", "extends"], + ["class-name", "Bar"], + ["punctuation", ";"], + + ["keyword", "struct"], + ["class-name", "Baz"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "enum"], + ["class-name", "FooBar"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "interface"], + ["class-name", "IFoo"], + ["keyword", "extends"], + ["class-name", "IBar"], + ["punctuation", ";"], + + ["keyword", "state"], + ["class-name", "Action"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "state"], + ["punctuation", "("], + ["punctuation", ")"], + ["class-name", "Defense"], + ["punctuation", "{"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for class names. diff --git a/package/src/prism/tests/languages/unrealscript/comment_feature.test b/package/src/prism/tests/languages/unrealscript/comment_feature.test new file mode 100644 index 00000000..d9769fcc --- /dev/null +++ b/package/src/prism/tests/languages/unrealscript/comment_feature.test @@ -0,0 +1,16 @@ +// comment + +/* + comment +*/ + +---------------------------------------------------- + +[ + ["comment", "// comment"], + ["comment", "/*\n comment\n*/"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/unrealscript/keyword_feature.test b/package/src/prism/tests/languages/unrealscript/keyword_feature.test new file mode 100644 index 00000000..a926fa69 --- /dev/null +++ b/package/src/prism/tests/languages/unrealscript/keyword_feature.test @@ -0,0 +1,204 @@ +abstract +actor +array +auto +autoexpandcategories +bool +break +byte +case +class; +classgroup +client +coerce +collapsecategories +config +const +continue +default +defaultproperties +delegate +dependson +deprecated +do +dontcollapsecategories +editconst +editinlinenew +else +enum; +event +exec +export +extends; +final +float +for +forcescriptorder +foreach +function +goto +guid +hidecategories +hidedropdown +if +ignores +implements +inherits +input +int +interface; +iterator +latent +local +material +name +native +nativereplication +noexport +nontransient +noteditinlinenew +notplaceable +operator +optional +out +pawn +perobjectconfig +perobjectlocalized +placeable +postoperator +preoperator +private +protected +reliable +replication +return +server +showcategories +simulated +singular +state; +static +string +struct; +structdefault +structdefaultproperties +switch +texture +transient +travel +unreliable +until +var +vector +while +within; + +---------------------------------------------------- + +[ + ["keyword", "abstract"], + ["keyword", "actor"], + ["keyword", "array"], + ["keyword", "auto"], + ["keyword", "autoexpandcategories"], + ["keyword", "bool"], + ["keyword", "break"], + ["keyword", "byte"], + ["keyword", "case"], + ["keyword", "class"], + ["punctuation", ";"], + ["keyword", "classgroup"], + ["keyword", "client"], + ["keyword", "coerce"], + ["keyword", "collapsecategories"], + ["keyword", "config"], + ["keyword", "const"], + ["keyword", "continue"], + ["keyword", "default"], + ["keyword", "defaultproperties"], + ["keyword", "delegate"], + ["keyword", "dependson"], + ["keyword", "deprecated"], + ["keyword", "do"], + ["keyword", "dontcollapsecategories"], + ["keyword", "editconst"], + ["keyword", "editinlinenew"], + ["keyword", "else"], + ["keyword", "enum"], + ["punctuation", ";"], + ["keyword", "event"], + ["keyword", "exec"], + ["keyword", "export"], + ["keyword", "extends"], + ["punctuation", ";"], + ["keyword", "final"], + ["keyword", "float"], + ["keyword", "for"], + ["keyword", "forcescriptorder"], + ["keyword", "foreach"], + ["keyword", "function"], + ["keyword", "goto"], + ["keyword", "guid"], + ["keyword", "hidecategories"], + ["keyword", "hidedropdown"], + ["keyword", "if"], + ["keyword", "ignores"], + ["keyword", "implements"], + ["keyword", "inherits"], + ["keyword", "input"], + ["keyword", "int"], + ["keyword", "interface"], + ["punctuation", ";"], + ["keyword", "iterator"], + ["keyword", "latent"], + ["keyword", "local"], + ["keyword", "material"], + ["keyword", "name"], + ["keyword", "native"], + ["keyword", "nativereplication"], + ["keyword", "noexport"], + ["keyword", "nontransient"], + ["keyword", "noteditinlinenew"], + ["keyword", "notplaceable"], + ["keyword", "operator"], + ["keyword", "optional"], + ["keyword", "out"], + ["keyword", "pawn"], + ["keyword", "perobjectconfig"], + ["keyword", "perobjectlocalized"], + ["keyword", "placeable"], + ["keyword", "postoperator"], + ["keyword", "preoperator"], + ["keyword", "private"], + ["keyword", "protected"], + ["keyword", "reliable"], + ["keyword", "replication"], + ["keyword", "return"], + ["keyword", "server"], + ["keyword", "showcategories"], + ["keyword", "simulated"], + ["keyword", "singular"], + ["keyword", "state"], + ["punctuation", ";"], + ["keyword", "static"], + ["keyword", "string"], + ["keyword", "struct"], + ["punctuation", ";"], + ["keyword", "structdefault"], + ["keyword", "structdefaultproperties"], + ["keyword", "switch"], + ["keyword", "texture"], + ["keyword", "transient"], + ["keyword", "travel"], + ["keyword", "unreliable"], + ["keyword", "until"], + ["keyword", "var"], + ["keyword", "vector"], + ["keyword", "while"], + ["keyword", "within"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/unrealscript/macro_feature.test b/package/src/prism/tests/languages/unrealscript/macro_feature.test new file mode 100644 index 00000000..474eaac0 --- /dev/null +++ b/package/src/prism/tests/languages/unrealscript/macro_feature.test @@ -0,0 +1,15 @@ +`log("foo"); + +---------------------------------------------------- + +[ + ["macro", "`log"], + ["punctuation", "("], + ["string", "\"foo\""], + ["punctuation", ")"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for macros. diff --git a/package/src/prism/tests/languages/unrealscript/metadata_feature.test b/package/src/prism/tests/languages/unrealscript/metadata_feature.test new file mode 100644 index 00000000..3e0bf933 --- /dev/null +++ b/package/src/prism/tests/languages/unrealscript/metadata_feature.test @@ -0,0 +1,87 @@ +var float MyVar; + +enum EMyEnum +{ + EME_ValA, + EME_ValB, +}; + +var() LinearColor DrawColor; + + +// not metadata +var array> Bar; + +---------------------------------------------------- + +[ + ["keyword", "var"], + ["keyword", "float"], + " MyVar", + ["metadata", [ + ["punctuation", "<"], + ["property", "TAG"], + ["operator", "="], + "VALUE", + ["punctuation", ">"] + ]], + ["punctuation", ";"], + + ["keyword", "enum"], + ["class-name", "EMyEnum"], + ["punctuation", "{"], + "\n\tEME_ValA", + ["metadata", [ + ["punctuation", "<"], + ["property", "TAG"], + ["operator", "="], + "VALUE", + ["punctuation", ">"] + ]], + ["punctuation", ","], + "\n\tEME_ValB", + ["metadata", [ + ["punctuation", "<"], + ["property", "TAG"], + ["operator", "="], + "VALUE", + ["punctuation", ">"] + ]], + ["punctuation", ","], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "var"], + ["punctuation", "("], + ["punctuation", ")"], + " LinearColor DrawColor", + ["metadata", [ + ["punctuation", "<"], + ["property", "DisplayName"], + ["operator", "="], + "Draw Color", + ["punctuation", "|"], + ["property", "EditCondition"], + ["operator", "="], + "bOverrideDrawColor", + ["punctuation", ">"] + ]], + ["punctuation", ";"], + + + ["comment", "// not metadata"], + + ["keyword", "var"], + ["keyword", "array"], + ["operator", "<"], + ["keyword", "class"], + ["operator", "<"], + "Foo", + ["operator", ">>"], + " Bar", + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for metadata. diff --git a/package/src/prism/tests/languages/unrealscript/number_feature.test b/package/src/prism/tests/languages/unrealscript/number_feature.test new file mode 100644 index 00000000..73d9e2ef --- /dev/null +++ b/package/src/prism/tests/languages/unrealscript/number_feature.test @@ -0,0 +1,16 @@ +123 +123e+5 + +0xFFFF + +---------------------------------------------------- + +[ + ["number", "123"], + ["number", "123e+5"], + ["number", "0xFFFF"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/unrealscript/operator_feature.test b/package/src/prism/tests/languages/unrealscript/operator_feature.test new file mode 100644 index 00000000..e8c0c623 --- /dev/null +++ b/package/src/prism/tests/languages/unrealscript/operator_feature.test @@ -0,0 +1,70 @@ ++ - * / % ** ++= -= *= /= +++ -- +~ && || ^^ +! & | ^ << >> + +> >= < <= == != ~= +$ $= @ @= += + +? : + +Cross Dot ClockwiseFrom + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + ["operator", "**"], + + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + + ["operator", "++"], + ["operator", "--"], + + ["operator", "~"], + ["operator", "&&"], + ["operator", "||"], + ["operator", "^^"], + + ["operator", "!"], + ["operator", "&"], + ["operator", "|"], + ["operator", "^"], + ["operator", "<<"], + ["operator", ">>"], + + ["operator", ">"], + ["operator", ">="], + ["operator", "<"], + ["operator", "<="], + ["operator", "=="], + ["operator", "!="], + ["operator", "~="], + + ["operator", "$"], + ["operator", "$="], + ["operator", "@"], + ["operator", "@="], + + ["operator", "="], + + ["operator", "?"], + ["operator", ":"], + + ["operator", "Cross"], + ["operator", "Dot"], + ["operator", "ClockwiseFrom"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/unrealscript/string_feature.test b/package/src/prism/tests/languages/unrealscript/string_feature.test new file mode 100644 index 00000000..37e0e621 --- /dev/null +++ b/package/src/prism/tests/languages/unrealscript/string_feature.test @@ -0,0 +1,19 @@ +"" +"foo" + +'' +'foo' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foo\""], + + ["string", "''"], + ["string", "'foo'"] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/uorazor/boolean_feature.test b/package/src/prism/tests/languages/uorazor/boolean_feature.test new file mode 100644 index 00000000..7ff56484 --- /dev/null +++ b/package/src/prism/tests/languages/uorazor/boolean_feature.test @@ -0,0 +1,13 @@ +false +true + +---------------------------------------------------- + +[ + ["boolean", "false"], + ["boolean", "true"] +] + +---------------------------------------------------- + +Checks for boolean values diff --git a/package/src/prism/tests/languages/uorazor/breakdown_script_example_feature.test b/package/src/prism/tests/languages/uorazor/breakdown_script_example_feature.test new file mode 100644 index 00000000..fca19b44 --- /dev/null +++ b/package/src/prism/tests/languages/uorazor/breakdown_script_example_feature.test @@ -0,0 +1,54 @@ +setvar "my_training_target" +while skill "anatomy" < 100 + useskill "anatomy" + wft 500 + target "my_training_target" + wait 2000 +endwhile + +---------------------------------------------------- + +[ + ["source-commands", "setvar"], + ["string", [ + ["punctuation", "\""], + "my_training_target", + ["punctuation", "\""] + ]], + + ["keyword", "while"], + ["function", "skill"], + ["string", [ + ["punctuation", "\""], + "anatomy", + ["punctuation", "\""] + ]], + ["operator", "<"], + ["number", "100"], + + ["source-commands", "useskill"], + ["string", [ + ["punctuation", "\""], + "anatomy", + ["punctuation", "\""] + ]], + + ["source-commands", "wft"], + ["number", "500"], + + ["source-commands", "target"], + ["string", [ + ["punctuation", "\""], + "my_training_target", + ["punctuation", "\""] + ]], + + ["source-commands", "wait"], + ["number", "2000"], + + ["keyword", "endwhile"] +] + +---------------------------------------------------- + +Checks for each type of syntax breakdown diff --git a/package/src/prism/tests/languages/uorazor/commands_feature.test b/package/src/prism/tests/languages/uorazor/commands_feature.test new file mode 100644 index 00000000..85e70b05 --- /dev/null +++ b/package/src/prism/tests/languages/uorazor/commands_feature.test @@ -0,0 +1,153 @@ +alliance +attack +cast +clearall +clearignore +clearjournal +clearlist +clearsysmsg +createlist +createtimer +dclick +dclicktype +dclickvar +dress +dressconfig +drop +droprelloc +emote +getlabel +guild +gumpclose +gumpresponse +hotkey +ignore +lasttarget +lift +lifttype +menu +menuresponse +msg +org +organize +organizer +overhead +pause +poplist +potion +promptresponse +pushlist +removelist +removetimer +rename +restock +say +scav +scavenger +script +setability +setlasttarget +setskill +settimer +sysmsg +targetloc +targetrelloc +targettype +undress +unignore +unsetvar +useobject +useonce +usetype +virtue +waitforgump +waitformenu +waitforprompt +waitforstat +waitforsysmsg +waitfortarget +walk +wfsysmsg +whisper +yell + +---------------------------------------------------- + +[ + ["source-commands", "alliance"], + ["source-commands", "attack"], + ["source-commands", "cast"], + ["source-commands", "clearall"], + ["source-commands", "clearignore"], + ["source-commands", "clearjournal"], + ["source-commands", "clearlist"], + ["source-commands", "clearsysmsg"], + ["source-commands", "createlist"], + ["source-commands", "createtimer"], + ["source-commands", "dclick"], + ["source-commands", "dclicktype"], + ["source-commands", "dclickvar"], + ["source-commands", "dress"], + ["source-commands", "dressconfig"], + ["source-commands", "drop"], + ["source-commands", "droprelloc"], + ["source-commands", "emote"], + ["source-commands", "getlabel"], + ["source-commands", "guild"], + ["source-commands", "gumpclose"], + ["source-commands", "gumpresponse"], + ["source-commands", "hotkey"], + ["source-commands", "ignore"], + ["source-commands", "lasttarget"], + ["source-commands", "lift"], + ["source-commands", "lifttype"], + ["source-commands", "menu"], + ["source-commands", "menuresponse"], + ["source-commands", "msg"], + ["source-commands", "org"], + ["source-commands", "organize"], + ["source-commands", "organizer"], + ["source-commands", "overhead"], + ["source-commands", "pause"], + ["source-commands", "poplist"], + ["source-commands", "potion"], + ["source-commands", "promptresponse"], + ["source-commands", "pushlist"], + ["source-commands", "removelist"], + ["source-commands", "removetimer"], + ["source-commands", "rename"], + ["source-commands", "restock"], + ["source-commands", "say"], + ["source-commands", "scav"], + ["source-commands", "scavenger"], + ["source-commands", "script"], + ["source-commands", "setability"], + ["source-commands", "setlasttarget"], + ["source-commands", "setskill"], + ["source-commands", "settimer"], + ["source-commands", "sysmsg"], + ["source-commands", "targetloc"], + ["source-commands", "targetrelloc"], + ["source-commands", "targettype"], + ["source-commands", "undress"], + ["source-commands", "unignore"], + ["source-commands", "unsetvar"], + ["source-commands", "useobject"], + ["source-commands", "useonce"], + ["source-commands", "usetype"], + ["source-commands", "virtue"], + ["source-commands", "waitforgump"], + ["source-commands", "waitformenu"], + ["source-commands", "waitforprompt"], + ["source-commands", "waitforstat"], + ["source-commands", "waitforsysmsg"], + ["source-commands", "waitfortarget"], + ["source-commands", "walk"], + ["source-commands", "wfsysmsg"], + ["source-commands", "whisper"], + ["source-commands", "yell"] +] + +---------------------------------------------------- + +Checks for commands. diff --git a/package/src/prism/tests/languages/uorazor/comment_feature.test b/package/src/prism/tests/languages/uorazor/comment_feature.test new file mode 100644 index 00000000..9d69aa2b --- /dev/null +++ b/package/src/prism/tests/languages/uorazor/comment_feature.test @@ -0,0 +1,13 @@ +# This is a comment +// so is this + +---------------------------------------------------- + +[ + ["comment-hash", "# This is a comment"], + ["comment-slash", "// so is this"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/uorazor/functions_feature.test b/package/src/prism/tests/languages/uorazor/functions_feature.test new file mode 100644 index 00000000..8982e15e --- /dev/null +++ b/package/src/prism/tests/languages/uorazor/functions_feature.test @@ -0,0 +1,74 @@ +atlist close closest count counter counttype dead dex diffhits diffmana diffstam diffweight find findbuff finddebuff findlayer findtype findtypelist followers gumpexists hidden hits hp hue human humanoid ingump inlist insysmessage insysmsg int invul lhandempty list listexists mana maxhits maxhp maxmana maxstam maxweight monster mounted name next noto paralyzed poisoned position prev previous queued rand random rhandempty skill stam str targetexists timer timerexists varexist warmode weight + +---------------------------------------------------- + +[ + ["function", "atlist"], + ["function", "close"], + ["function", "closest"], + ["function", "count"], + ["function", "counter"], + ["function", "counttype"], + ["function", "dead"], + ["function", "dex"], + ["function", "diffhits"], + ["function", "diffmana"], + ["function", "diffstam"], + ["function", "diffweight"], + ["function", "find"], + ["function", "findbuff"], + ["function", "finddebuff"], + ["function", "findlayer"], + ["function", "findtype"], + ["function", "findtypelist"], + ["function", "followers"], + ["function", "gumpexists"], + ["function", "hidden"], + ["function", "hits"], + ["function", "hp"], + ["function", "hue"], + ["function", "human"], + ["function", "humanoid"], + ["function", "ingump"], + ["function", "inlist"], + ["function", "insysmessage"], + ["function", "insysmsg"], + ["function", "int"], + ["function", "invul"], + ["function", "lhandempty"], + ["function", "list"], + ["function", "listexists"], + ["function", "mana"], + ["function", "maxhits"], + ["function", "maxhp"], + ["function", "maxmana"], + ["function", "maxstam"], + ["function", "maxweight"], + ["function", "monster"], + ["function", "mounted"], + ["function", "name"], + ["function", "next"], + ["function", "noto"], + ["function", "paralyzed"], + ["function", "poisoned"], + ["function", "position"], + ["function", "prev"], + ["function", "previous"], + ["function", "queued"], + ["function", "rand"], + ["function", "random"], + ["function", "rhandempty"], + ["function", "skill"], + ["function", "stam"], + ["function", "str"], + ["function", "targetexists"], + ["function", "timer"], + ["function", "timerexists"], + ["function", "varexist"], + ["function", "warmode"], + ["function", "weight"] +] + +---------------------------------------------------- + +Checks for functions. diff --git a/package/src/prism/tests/languages/uorazor/keyword_feature.test b/package/src/prism/tests/languages/uorazor/keyword_feature.test new file mode 100644 index 00000000..0c6a20f0 --- /dev/null +++ b/package/src/prism/tests/languages/uorazor/keyword_feature.test @@ -0,0 +1,39 @@ +and +as +break +continue +else +elseif +endfor +endif +for +if +loop +not +or +replay +stop + +---------------------------------------------------- + +[ + ["keyword", "and"], + ["keyword", "as"], + ["keyword", "break"], + ["keyword", "continue"], + ["keyword", "else"], + ["keyword", "elseif"], + ["keyword", "endfor"], + ["keyword", "endif"], + ["keyword", "for"], + ["keyword", "if"], + ["keyword", "loop"], + ["keyword", "not"], + ["keyword", "or"], + ["keyword", "replay"], + ["keyword", "stop"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/uorazor/source_layers_feature.test b/package/src/prism/tests/languages/uorazor/source_layers_feature.test new file mode 100644 index 00000000..51d1f560 --- /dev/null +++ b/package/src/prism/tests/languages/uorazor/source_layers_feature.test @@ -0,0 +1,87 @@ +backpack +gloves +self +ARMS +BLUE +BRACELET +CANCEL +CLEAR +CLOAK +CRIMINAL +EARRINGS +ENEMY +FACIALHAIR +FRIEND +FRIENDLY +GRAY +GREY +GROUND +HAIR +HEAD +INNERLEGS +INNERTORSO +INNOCENT +LEFTHAND +MIDDLETORSO +MURDERER +NECK +NONFRIENDLY +ONEHANDEDSECONDARY +OUTERLEGS +OUTERTORSO +PANTS +RED +RIGHTHAND +RING +SHIRT +SHOES +TALISMAN +WAIST + +---------------------------------------------------- + +[ + ["source-layers", "backpack"], + ["source-layers", "gloves"], + ["source-layers", "self"], + ["source-layers", "ARMS"], + ["source-layers", "BLUE"], + ["source-layers", "BRACELET"], + ["source-layers", "CANCEL"], + ["source-layers", "CLEAR"], + ["source-layers", "CLOAK"], + ["source-layers", "CRIMINAL"], + ["source-layers", "EARRINGS"], + ["source-layers", "ENEMY"], + ["source-layers", "FACIALHAIR"], + ["source-layers", "FRIEND"], + ["source-layers", "FRIENDLY"], + ["source-layers", "GRAY"], + ["source-layers", "GREY"], + ["source-layers", "GROUND"], + ["source-layers", "HAIR"], + ["source-layers", "HEAD"], + ["source-layers", "INNERLEGS"], + ["source-layers", "INNERTORSO"], + ["source-layers", "INNOCENT"], + ["source-layers", "LEFTHAND"], + ["source-layers", "MIDDLETORSO"], + ["source-layers", "MURDERER"], + ["source-layers", "NECK"], + ["source-layers", "NONFRIENDLY"], + ["source-layers", "ONEHANDEDSECONDARY"], + ["source-layers", "OUTERLEGS"], + ["source-layers", "OUTERTORSO"], + ["source-layers", "PANTS"], + ["source-layers", "RED"], + ["source-layers", "RIGHTHAND"], + ["source-layers", "RING"], + ["source-layers", "SHIRT"], + ["source-layers", "SHOES"], + ["source-layers", "TALISMAN"], + ["source-layers", "WAIST"] +] + +---------------------------------------------------- + +Checks for source layers. diff --git a/package/src/prism/tests/languages/uri/authority_feature.test b/package/src/prism/tests/languages/uri/authority_feature.test new file mode 100644 index 00000000..86ad3a32 --- /dev/null +++ b/package/src/prism/tests/languages/uri/authority_feature.test @@ -0,0 +1,109 @@ +https://john.doe@www.example.com:123/forum/questions +ftp://ftp.is.co.za/rfc/rfc1808.txt +ldap://[2001:db8::7]/ +https://[v1.foo]/ +//192.0.2.16:80/ +//example.com/path/resource.txt + +---------------------------------------------------- + +[ + ["scheme", [ + "https", + ["scheme-delimiter", ":"] + ]], + ["authority", [ + ["authority-delimiter", "//"], + ["user-info-segment", [ + ["user-info", "john.doe"], + ["user-info-delimiter", "@"] + ]], + ["host", ["www.example.com"]], + ["port-segment", [ + ["port-delimiter", ":"], + ["port", "123"] + ]] + ]], + ["path", [ + ["path-separator", "/"], + "forum", + ["path-separator", "/"], + "questions" + ]], + + ["scheme", [ + "ftp", + ["scheme-delimiter", ":"] + ]], + ["authority", [ + ["authority-delimiter", "//"], + ["host", ["ftp.is.co.za"]] + ]], + ["path", [ + ["path-separator", "/"], + "rfc", + ["path-separator", "/"], + "rfc1808.txt" + ]], + + ["scheme", [ + "ldap", + ["scheme-delimiter", ":"] + ]], + ["authority", [ + ["authority-delimiter", "//"], + ["host", [ + ["ip-literal", [ + ["ip-literal-delimiter", "["], + ["ipv6-address", "2001:db8::7"], + ["ip-literal-delimiter", "]"] + ]] + ]] + ]], + ["path", [ + ["path-separator", "/"] + ]], + + ["scheme", [ + "https", + ["scheme-delimiter", ":"] + ]], + ["authority", [ + ["authority-delimiter", "//"], + ["host", [ + ["ip-literal", [ + ["ip-literal-delimiter", "["], + ["ipv-future", "v1.foo"], + ["ip-literal-delimiter", "]"] + ]] + ]] + ]], + ["path", [ + ["path-separator", "/"] + ]], + + ["authority", [ + ["authority-delimiter", "//"], + ["host", [ + ["ipv4-address", "192.0.2.16"] + ]], + ["port-segment", [ + ["port-delimiter", ":"], + ["port", "80"] + ]] + ]], + ["path", [ + ["path-separator", "/"] + ]], + + ["authority", [ + ["authority-delimiter", "//"], + ["host", ["example.com"]] + ]], + ["path", [ + ["path-separator", "/"], + "path", + ["path-separator", "/"], + "resource.txt" + ]] +] diff --git a/package/src/prism/tests/languages/uri/full.test b/package/src/prism/tests/languages/uri/full.test new file mode 100644 index 00000000..f9859731 --- /dev/null +++ b/package/src/prism/tests/languages/uri/full.test @@ -0,0 +1,126 @@ +https://john.doe@www.example.com:123/forum/questions/?tag=networking&order=newest#top +ldap://[2001:db8::7]/c=GB?objectClass?one +mailto:John.Doe@example.com +news:comp.infosystems.www.servers.unix +telnet://192.0.2.16:80/ +https://example.com/path/resource.txt#fragment + +---------------------------------------------------- + +[ + ["scheme", [ + "https", + ["scheme-delimiter", ":"] + ]], + ["authority", [ + ["authority-delimiter", "//"], + ["user-info-segment", [ + ["user-info", "john.doe"], + ["user-info-delimiter", "@"] + ]], + ["host", ["www.example.com"]], + ["port-segment", [ + ["port-delimiter", ":"], + ["port", "123"] + ]] + ]], + ["path", [ + ["path-separator", "/"], + "forum", + ["path-separator", "/"], + "questions", + ["path-separator", "/"] + ]], + ["query", [ + ["query-delimiter", "?"], + ["pair", [ + ["key", "tag"], + "=", + ["value", "networking"] + ]], + ["pair-delimiter", "&"], + ["pair", [ + ["key", "order"], + "=", + ["value", "newest"] + ]] + ]], + ["fragment", [ + ["fragment-delimiter", "#"], + "top" + ]], + + ["scheme", [ + "ldap", + ["scheme-delimiter", ":"] + ]], + ["authority", [ + ["authority-delimiter", "//"], + ["host", [ + ["ip-literal", [ + ["ip-literal-delimiter", "["], + ["ipv6-address", "2001:db8::7"], + ["ip-literal-delimiter", "]"] + ]] + ]] + ]], + ["path", [ + ["path-separator", "/"], + "c=GB" + ]], + ["query", [ + ["query-delimiter", "?"], + ["pair", [ + ["key", "objectClass?one"] + ]] + ]], + + ["scheme", [ + "mailto", + ["scheme-delimiter", ":"] + ]], + ["path", ["John.Doe@example.com"]], + + ["scheme", [ + "news", + ["scheme-delimiter", ":"] + ]], + ["path", ["comp.infosystems.www.servers.unix"]], + + ["scheme", [ + "telnet", + ["scheme-delimiter", ":"] + ]], + ["authority", [ + ["authority-delimiter", "//"], + ["host", [ + ["ipv4-address", "192.0.2.16"] + ]], + ["port-segment", [ + ["port-delimiter", ":"], + ["port", "80"] + ]] + ]], + ["path", [ + ["path-separator", "/"] + ]], + + ["scheme", [ + "https", + ["scheme-delimiter", ":"] + ]], + ["authority", [ + ["authority-delimiter", "//"], + ["host", ["example.com"]] + ]], + ["path", [ + ["path-separator", "/"], + "path", + ["path-separator", "/"], + "resource.txt" + ]], + ["fragment", [ + ["fragment-delimiter", "#"], + "fragment" + ]] +] diff --git a/package/src/prism/tests/languages/uri/query_feature.test b/package/src/prism/tests/languages/uri/query_feature.test new file mode 100644 index 00000000..55d554d4 --- /dev/null +++ b/package/src/prism/tests/languages/uri/query_feature.test @@ -0,0 +1,78 @@ +?tag=networking&order=newest#top +?objectClass?one +?title=Query_string&action=edit +http://example.com/kb/index.php?cat=1;id=23 + +---------------------------------------------------- + +[ + ["query", [ + ["query-delimiter", "?"], + ["pair", [ + ["key", "tag"], + "=", + ["value", "networking"] + ]], + ["pair-delimiter", "&"], + ["pair", [ + ["key", "order"], + "=", + ["value", "newest"] + ]] + ]], + ["fragment", [ + ["fragment-delimiter", "#"], + "top" + ]], + + ["query", [ + ["query-delimiter", "?"], + ["pair", [ + ["key", "objectClass?one"] + ]] + ]], + + ["query", [ + ["query-delimiter", "?"], + ["pair", [ + ["key", "title"], + "=", + ["value", "Query_string"] + ]], + ["pair-delimiter", "&"], + ["pair", [ + ["key", "action"], + "=", + ["value", "edit"] + ]] + ]], + + ["scheme", [ + "http", + ["scheme-delimiter", ":"] + ]], + ["authority", [ + ["authority-delimiter", "//"], + ["host", ["example.com"]] + ]], + ["path", [ + ["path-separator", "/"], + "kb", + ["path-separator", "/"], + "index.php" + ]], + ["query", [ + ["query-delimiter", "?"], + ["pair", [ + ["key", "cat"], + "=", + ["value", "1"] + ]], + ["pair-delimiter", ";"], + ["pair", [ + ["key", "id"], + "=", + ["value", "23"] + ]] + ]] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/uri/relative.test b/package/src/prism/tests/languages/uri/relative.test new file mode 100644 index 00000000..07bcbf96 --- /dev/null +++ b/package/src/prism/tests/languages/uri/relative.test @@ -0,0 +1,54 @@ +//example.com/path/resource.txt +/path/resource.txt +path/resource.txt +../resource.txt +./resource.txt +resource.txt +#fragment + +---------------------------------------------------- + +[ + ["authority", [ + ["authority-delimiter", "//"], + ["host", ["example.com"]] + ]], + ["path", [ + ["path-separator", "/"], + "path", + ["path-separator", "/"], + "resource.txt" + ]], + + ["path", [ + ["path-separator", "/"], + "path", + ["path-separator", "/"], + "resource.txt" + ]], + + ["path", [ + "path", + ["path-separator", "/"], + "resource.txt" + ]], + + ["path", [ + "..", + ["path-separator", "/"], + "resource.txt" + ]], + + ["path", [ + ".", + ["path-separator", "/"], + "resource.txt" + ]], + + ["path", ["resource.txt"]], + + ["fragment", [ + ["fragment-delimiter", "#"], + "fragment" + ]] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/uri/scheme_feature.test b/package/src/prism/tests/languages/uri/scheme_feature.test new file mode 100644 index 00000000..e46f7204 --- /dev/null +++ b/package/src/prism/tests/languages/uri/scheme_feature.test @@ -0,0 +1,45 @@ +ftp://ftp.is.co.za/rfc/rfc1808.txt +tel:+1-816-555-1212 +urn:oasis:names:specification:docbook:dtd:xml:4.1.2 +data:text/vnd-example+xyz;foo=bar;base64,R0lGODdh + +---------------------------------------------------- + +[ + ["scheme", [ + "ftp", + ["scheme-delimiter", ":"] + ]], + ["authority", [ + ["authority-delimiter", "//"], + ["host", ["ftp.is.co.za"]] + ]], + ["path", [ + ["path-separator", "/"], + "rfc", + ["path-separator", "/"], + "rfc1808.txt" + ]], + + ["scheme", [ + "tel", + ["scheme-delimiter", ":"] + ]], + ["path", ["+1-816-555-1212"]], + + ["scheme", [ + "urn", + ["scheme-delimiter", ":"] + ]], + ["path", ["oasis:names:specification:docbook:dtd:xml:4.1.2"]], + + ["scheme", [ + "data", + ["scheme-delimiter", ":"] + ]], + ["path", [ + "text", + ["path-separator", "/"], + "vnd-example+xyz;foo=bar;base64,R0lGODdh" + ]] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/v/attribute_feature.test b/package/src/prism/tests/languages/v/attribute_feature.test new file mode 100644 index 00000000..877e2b86 --- /dev/null +++ b/package/src/prism/tests/languages/v/attribute_feature.test @@ -0,0 +1,59 @@ +[deprecated] +[unsafe_fn] +[typedef] +[live] +[inline] +[flag] +[ref_only] +[windows_stdcall] +[direct_array_access] + +---------------------------------------------------- + +[ + ["attribute", [ + ["punctuation", "["], + ["keyword", "deprecated"], + ["punctuation", "]"] + ]], + ["attribute", [ + ["punctuation", "["], + ["keyword", "unsafe_fn"], + ["punctuation", "]"] + ]], + ["attribute", [ + ["punctuation", "["], + ["keyword", "typedef"], + ["punctuation", "]"] + ]], + ["attribute", [ + ["punctuation", "["], + ["keyword", "live"], + ["punctuation", "]"] + ]], + ["attribute", [ + ["punctuation", "["], + ["keyword", "inline"], + ["punctuation", "]"] + ]], + ["attribute", [ + ["punctuation", "["], + ["keyword", "flag"], + ["punctuation", "]"] + ]], + ["attribute", [ + ["punctuation", "["], + ["keyword", "ref_only"], + ["punctuation", "]"] + ]], + ["attribute", [ + ["punctuation", "["], + ["keyword", "windows_stdcall"], + ["punctuation", "]"] + ]], + ["attribute", [ + ["punctuation", "["], + ["keyword", "direct_array_access"], + ["punctuation", "]"] + ]] +] diff --git a/package/src/prism/tests/languages/v/boolean_feature.test b/package/src/prism/tests/languages/v/boolean_feature.test new file mode 100644 index 00000000..b5c6580c --- /dev/null +++ b/package/src/prism/tests/languages/v/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Check for boolean \ No newline at end of file diff --git a/package/src/prism/tests/languages/v/char_feature.test b/package/src/prism/tests/languages/v/char_feature.test new file mode 100644 index 00000000..6ee54861 --- /dev/null +++ b/package/src/prism/tests/languages/v/char_feature.test @@ -0,0 +1,11 @@ +`🚀` +`\`` +`Not a Rune` + +---------------------------------------------------- + +[ + ["char", "`🚀`"], + ["char", "`\\``"], + "\n`Not a Rune`" +] diff --git a/package/src/prism/tests/languages/v/class-name_feature.test b/package/src/prism/tests/languages/v/class-name_feature.test new file mode 100644 index 00000000..0bd24c69 --- /dev/null +++ b/package/src/prism/tests/languages/v/class-name_feature.test @@ -0,0 +1,41 @@ +struct Abc { } +type Alphabet = Abc | Xyz +enum Token { } +interface Speaker { } +struct Repo { } + +---------------------------------------------------- + +[ + ["keyword", "struct"], + ["class-name", "Abc"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "type"], + ["class-name", "Alphabet"], + ["operator", "="], + " Abc ", + ["operator", "|"], + " Xyz\n", + + ["keyword", "enum"], + ["class-name", "Token"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "interface"], + ["class-name", "Speaker"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "struct"], + ["class-name", "Repo"], + ["generic", [ + ["punctuation", "<"], + ["class-name", "T"], + ["punctuation", ">"] + ]], + ["punctuation", "{"], + ["punctuation", "}"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/v/function_feature.test b/package/src/prism/tests/languages/v/function_feature.test new file mode 100644 index 00000000..a3e785b0 --- /dev/null +++ b/package/src/prism/tests/languages/v/function_feature.test @@ -0,0 +1,120 @@ +fn init() { } +fn add(x int, y int) int { } +fn sum(a ...int) int { } +fn (mut t MyTime) century() int { } +fn (d Dog) speak() string { } +fn (r Repo) find_user_by_id(id int) ?User { } +fn new_repo(db DB) Repo { } +fn (r Repo) find_by_id(id int) ?T { } + +---------------------------------------------------- + +[ + ["keyword", "fn"], + ["function", "init"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "fn"], + ["function", "add"], + ["punctuation", "("], + "x ", + ["builtin", "int"], + ["punctuation", ","], + " y ", + ["builtin", "int"], + ["punctuation", ")"], + ["builtin", "int"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "fn"], + ["function", "sum"], + ["punctuation", "("], + "a ", + ["operator", "..."], + ["builtin", "int"], + ["punctuation", ")"], + ["builtin", "int"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "fn"], + ["punctuation", "("], + ["keyword", "mut"], + " t MyTime", + ["punctuation", ")"], + ["function", "century"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "int"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "fn"], + ["punctuation", "("], + "d Dog", + ["punctuation", ")"], + ["function", "speak"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "string"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "fn"], + ["punctuation", "("], + "r Repo", + ["punctuation", ")"], + ["function", "find_user_by_id"], + ["punctuation", "("], + "id ", + ["builtin", "int"], + ["punctuation", ")"], + ["operator", "?"], + "User ", + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "fn"], + ["generic-function", [ + ["function", "new_repo"], + ["generic", [ + ["punctuation", "<"], + ["class-name", "T"], + ["punctuation", ">"] + ]] + ]], + ["punctuation", "("], + "db DB", + ["punctuation", ")"], + " Repo", + ["generic", [ + ["punctuation", "<"], + ["class-name", "T"], + ["punctuation", ">"] + ]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "fn"], + ["punctuation", "("], + "r Repo", + ["generic", [ + ["punctuation", "<"], + ["class-name", "T"], + ["punctuation", ">"] + ]], + ["punctuation", ")"], + ["function", "find_by_id"], + ["punctuation", "("], + "id ", + ["builtin", "int"], + ["punctuation", ")"], + ["operator", "?"], + "T ", + ["punctuation", "{"], + ["punctuation", "}"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/v/keyword_feature.test b/package/src/prism/tests/languages/v/keyword_feature.test new file mode 100644 index 00000000..c44f8c40 --- /dev/null +++ b/package/src/prism/tests/languages/v/keyword_feature.test @@ -0,0 +1,93 @@ +as; +asm; +assert; +atomic; +break; +const; +continue; +defer; +else; +embed; +enum;; +fn; +for; +__global; +go; +goto; +if; +import; +in; +interface; +is; +lock; +match; +module; +mut; +none; +or; +pub; +return; +rlock; +select; +shared; +sizeof; +static; +struct; +type;; +typeof; +union; +unsafe; +$if; +$else; +$for; +#include; +#flag; + +---------------------------------------------------- + +[ + ["keyword", "as"], ["punctuation", ";"], + ["keyword", "asm"], ["punctuation", ";"], + ["keyword", "assert"], ["punctuation", ";"], + ["keyword", "atomic"], ["punctuation", ";"], + ["keyword", "break"], ["punctuation", ";"], + ["keyword", "const"], ["punctuation", ";"], + ["keyword", "continue"], ["punctuation", ";"], + ["keyword", "defer"], ["punctuation", ";"], + ["keyword", "else"], ["punctuation", ";"], + ["keyword", "embed"], ["punctuation", ";"], + ["keyword", "enum"], ["punctuation", ";"], ["punctuation", ";"], + ["keyword", "fn"], ["punctuation", ";"], + ["keyword", "for"], ["punctuation", ";"], + ["keyword", "__global"], ["punctuation", ";"], + ["keyword", "go"], ["punctuation", ";"], + ["keyword", "goto"], ["punctuation", ";"], + ["keyword", "if"], ["punctuation", ";"], + ["keyword", "import"], ["punctuation", ";"], + ["keyword", "in"], ["punctuation", ";"], + ["keyword", "interface"], ["punctuation", ";"], + ["keyword", "is"], ["punctuation", ";"], + ["keyword", "lock"], ["punctuation", ";"], + ["keyword", "match"], ["punctuation", ";"], + ["keyword", "module"], ["punctuation", ";"], + ["keyword", "mut"], ["punctuation", ";"], + ["keyword", "none"], ["punctuation", ";"], + ["keyword", "or"], ["punctuation", ";"], + ["keyword", "pub"], ["punctuation", ";"], + ["keyword", "return"], ["punctuation", ";"], + ["keyword", "rlock"], ["punctuation", ";"], + ["keyword", "select"], ["punctuation", ";"], + ["keyword", "shared"], ["punctuation", ";"], + ["keyword", "sizeof"], ["punctuation", ";"], + ["keyword", "static"], ["punctuation", ";"], + ["keyword", "struct"], ["punctuation", ";"], + ["keyword", "type"], ["punctuation", ";"], ["punctuation", ";"], + ["keyword", "typeof"], ["punctuation", ";"], + ["keyword", "union"], ["punctuation", ";"], + ["keyword", "unsafe"], ["punctuation", ";"], + ["keyword", "$if"], ["punctuation", ";"], + ["keyword", "$else"], ["punctuation", ";"], + ["keyword", "$for"], ["punctuation", ";"], + ["keyword", "#include"], ["punctuation", ";"], + ["keyword", "#flag"], ["punctuation", ";"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/v/number_feature.test b/package/src/prism/tests/languages/v/number_feature.test new file mode 100644 index 00000000..d11d5907 --- /dev/null +++ b/package/src/prism/tests/languages/v/number_feature.test @@ -0,0 +1,25 @@ +123 +0x7B +0b01111011 +0o173 +1_000_000 +0xF_F +072.40 +2.71828 + +---------------------------------------------------- + +[ + ["number", "123"], + ["number", "0x7B"], + ["number", "0b01111011"], + ["number", "0o173"], + ["number", "1_000_000"], + ["number", "0xF_F"], + ["number", "072.40"], + ["number", "2.71828"] +] + +---------------------------------------------------- + +Check for numbers \ No newline at end of file diff --git a/package/src/prism/tests/languages/v/operator_feature.test b/package/src/prism/tests/languages/v/operator_feature.test new file mode 100644 index 00000000..d242aef2 --- /dev/null +++ b/package/src/prism/tests/languages/v/operator_feature.test @@ -0,0 +1,67 @@ ++ +- +* +/ +% +~ +& +| +^ +! +&& +|| +!= +<< +>> +== +< +<= +> +>= ++= +-= +*= +/= +%= +&= +|= +^= +>>= +<<= +:= + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + ["operator", "~"], + ["operator", "&"], + ["operator", "|"], + ["operator", "^"], + ["operator", "!"], + ["operator", "&&"], + ["operator", "||"], + ["operator", "!="], + ["operator", "<<"], + ["operator", ">>"], + ["operator", "=="], + ["operator", "<"], + ["operator", "<="], + ["operator", ">"], + ["operator", ">="], + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + ["operator", "%="], + ["operator", "&="], + ["operator", "|="], + ["operator", "^="], + ["operator", ">>="], + ["operator", "<<="], + ["operator", ":="] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/v/string_feature.test b/package/src/prism/tests/languages/v/string_feature.test new file mode 100644 index 00000000..59f89b4a --- /dev/null +++ b/package/src/prism/tests/languages/v/string_feature.test @@ -0,0 +1,41 @@ +"https://example.com" +'single quote' +'age = $user.age' +'[${int(x):-10}]' +r'hello\nworld' + +---------------------------------------------------- + +[ + ["string", ["\"https://example.com\""]], + ["string", ["'single quote'"]], + ["string", [ + "'age = ", + ["interpolation", [ + ["interpolation-variable", "$user.age"] + ]], + "'" + ]], + ["string", [ + "'[", + ["interpolation", [ + ["interpolation-punctuation", "${"], + ["interpolation-expression", [ + ["function", "int"], + ["punctuation", "("], + "x", + ["punctuation", ")"], + ["punctuation", ":"], + ["operator", "-"], + ["number", "10"] + ]], + ["interpolation-punctuation", "}"] + ]], + "]'" + ]], + ["string", ["r'hello\\nworld'"]] +] + +---------------------------------------------------- + +Check for strings and string interpolation diff --git a/package/src/prism/tests/languages/vala/class-name_feature.test b/package/src/prism/tests/languages/vala/class-name_feature.test new file mode 100644 index 00000000..57162850 --- /dev/null +++ b/package/src/prism/tests/languages/vala/class-name_feature.test @@ -0,0 +1,37 @@ +class Foo +enum Bar +interface BarBaz +class Foo : Bar +[Foobar] +void Foo(Bar bar, Baz baz) + +---------------------------------------------------- + +[ + ["keyword", "class"], + ["class-name", ["Foo"]], + ["keyword", "enum"], + ["class-name", ["Bar"]], + ["keyword", "interface"], + ["class-name", ["BarBaz"]], + ["keyword", "class"], + ["class-name", ["Foo"]], + ["punctuation", ":"], + ["class-name", ["Bar"]], + ["punctuation", "["], + ["class-name", ["Foobar"]], + ["punctuation", "]"], + ["keyword", "void"], + ["function", "Foo"], + ["punctuation", "("], + ["class-name", ["Bar"]], + " bar", + ["punctuation", ","], + ["class-name", ["Baz"]], + " baz", + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for class names. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vala/constant_feature.test b/package/src/prism/tests/languages/vala/constant_feature.test new file mode 100644 index 00000000..49adc667 --- /dev/null +++ b/package/src/prism/tests/languages/vala/constant_feature.test @@ -0,0 +1,7 @@ +FOO + +---------------------------------------------------- + +[ + ["constant", "FOO"] +] diff --git a/package/src/prism/tests/languages/vala/keyword_feature.test b/package/src/prism/tests/languages/vala/keyword_feature.test new file mode 100644 index 00000000..14170b24 --- /dev/null +++ b/package/src/prism/tests/languages/vala/keyword_feature.test @@ -0,0 +1,189 @@ +bool +char +double +float +null +size_t +ssize_t +string +unichar +void +int +int8 +int16 +int32 +int64 +long +short +uchar +uint +uint8 +uint16 +uint32 +uint64 +ulong +ushort +class +delegate +enum +errordomain +interface +namespace +struct +break +continue +do +for +foreach +return +while +else +if +switch +assert +case +default +abstract +const +dynamic +ensures +extern +inline +internal +override +private +protected +public +requires +signal +static +virtual +volatile +weak +async +owned +unowned +try +catch +finally +throw +as +base +construct +delete +get +in +is +lock +new +out +params +ref +sizeof +set +this +throws +typeof +using +value +var +yield + +---------------------------------------------------- + +[ + ["keyword", "bool"], + ["keyword", "char"], + ["keyword", "double"], + ["keyword", "float"], + ["keyword", "null"], + ["keyword", "size_t"], + ["keyword", "ssize_t"], + ["keyword", "string"], + ["keyword", "unichar"], + ["keyword", "void"], + ["keyword", "int"], + ["keyword", "int8"], + ["keyword", "int16"], + ["keyword", "int32"], + ["keyword", "int64"], + ["keyword", "long"], + ["keyword", "short"], + ["keyword", "uchar"], + ["keyword", "uint"], + ["keyword", "uint8"], + ["keyword", "uint16"], + ["keyword", "uint32"], + ["keyword", "uint64"], + ["keyword", "ulong"], + ["keyword", "ushort"], + ["keyword", "class"], + ["keyword", "delegate"], + ["keyword", "enum"], + ["keyword", "errordomain"], + ["keyword", "interface"], + ["keyword", "namespace"], + ["keyword", "struct"], + ["keyword", "break"], + ["keyword", "continue"], + ["keyword", "do"], + ["keyword", "for"], + ["keyword", "foreach"], + ["keyword", "return"], + ["keyword", "while"], + ["keyword", "else"], + ["keyword", "if"], + ["keyword", "switch"], + ["keyword", "assert"], + ["keyword", "case"], + ["keyword", "default"], + ["keyword", "abstract"], + ["keyword", "const"], + ["keyword", "dynamic"], + ["keyword", "ensures"], + ["keyword", "extern"], + ["keyword", "inline"], + ["keyword", "internal"], + ["keyword", "override"], + ["keyword", "private"], + ["keyword", "protected"], + ["keyword", "public"], + ["keyword", "requires"], + ["keyword", "signal"], + ["keyword", "static"], + ["keyword", "virtual"], + ["keyword", "volatile"], + ["keyword", "weak"], + ["keyword", "async"], + ["keyword", "owned"], + ["keyword", "unowned"], + ["keyword", "try"], + ["keyword", "catch"], + ["keyword", "finally"], + ["keyword", "throw"], + ["keyword", "as"], + ["keyword", "base"], + ["keyword", "construct"], + ["keyword", "delete"], + ["keyword", "get"], + ["keyword", "in"], + ["keyword", "is"], + ["keyword", "lock"], + ["keyword", "new"], + ["keyword", "out"], + ["keyword", "params"], + ["keyword", "ref"], + ["keyword", "sizeof"], + ["keyword", "set"], + ["keyword", "this"], + ["keyword", "throws"], + ["keyword", "typeof"], + ["keyword", "using"], + ["keyword", "value"], + ["keyword", "var"], + ["keyword", "yield"] +] + +---------------------------------------------------- + +Checks for all keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vala/number_feature.test b/package/src/prism/tests/languages/vala/number_feature.test new file mode 100644 index 00000000..91900d60 --- /dev/null +++ b/package/src/prism/tests/languages/vala/number_feature.test @@ -0,0 +1,27 @@ +42 +3.14159 +5ul +0.75f +4e10 +2.1e-10 +0.4e+2 +0xbabe +0xBABE + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "3.14159"], + ["number", "5ul"], + ["number", "0.75f"], + ["number", "4e10"], + ["number", "2.1e-10"], + ["number", "0.4e+2"], + ["number", "0xbabe"], + ["number", "0xBABE"] +] + +---------------------------------------------------- + +Checks for decimal numbers and hexadecimal numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vala/operator_feature.test b/package/src/prism/tests/languages/vala/operator_feature.test new file mode 100644 index 00000000..5ab1717d --- /dev/null +++ b/package/src/prism/tests/languages/vala/operator_feature.test @@ -0,0 +1,63 @@ ++ - * / % -- ++ +>> << +~ & | ^ ++= -= *= /= %= >>= <<= &= |= ^= +! && || += == != < > <= >= => +? ?? +... +-> + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + ["operator", "--"], + ["operator", "++"], + + ["operator", ">>"], + ["operator", "<<"], + + ["operator", "~"], + ["operator", "&"], + ["operator", "|"], + ["operator", "^"], + + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + ["operator", "%="], + ["operator", ">>="], + ["operator", "<<="], + ["operator", "&="], + ["operator", "|="], + ["operator", "^="], + + ["operator", "!"], + ["operator", "&&"], + ["operator", "||"], + + ["operator", "="], + ["operator", "=="], + ["operator", "!="], + ["operator", "<"], + ["operator", ">"], + ["operator", "<="], + ["operator", ">="], + ["operator", "=>"], + + ["operator", "?"], + ["operator", "??"], + + ["operator", "..."], + ["operator", "->"] +] + +---------------------------------------------------- + +Checks for all operators. diff --git a/package/src/prism/tests/languages/vala/punctuation_feature.test b/package/src/prism/tests/languages/vala/punctuation_feature.test new file mode 100644 index 00000000..4772f37d --- /dev/null +++ b/package/src/prism/tests/languages/vala/punctuation_feature.test @@ -0,0 +1,22 @@ +. , ; : +[ ] { } ( ) + +---------------------------------------------------- + +[ + ["punctuation", "."], + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", ":"], + + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "("], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for punctuation. diff --git a/package/src/prism/tests/languages/vala/regex_feature.test b/package/src/prism/tests/languages/vala/regex_feature.test new file mode 100644 index 00000000..6f77366e --- /dev/null +++ b/package/src/prism/tests/languages/vala/regex_feature.test @@ -0,0 +1,11 @@ +/(\d+\.\d+\.\d+)/ + +---------------------------------------------------- + +[ + ["regex", [ + ["regex-delimiter", "/"], + ["regex-source", "(\\d+\\.\\d+\\.\\d+)"], + ["regex-delimiter", "/"] + ]] +] diff --git a/package/src/prism/tests/languages/vala/string_feature.test b/package/src/prism/tests/languages/vala/string_feature.test new file mode 100644 index 00000000..14c380c0 --- /dev/null +++ b/package/src/prism/tests/languages/vala/string_feature.test @@ -0,0 +1,64 @@ +"" +"fo\"o" + +"""Multi line +string""" + +@"foo $bar" +@"foo $(bar)" + +'a' +'\'' +'\\' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"o\""], + + ["raw-string", "\"\"\"Multi line\nstring\"\"\""], + ["template-string", + [ + ["string", "@\"foo "], + [ + "interpolation", + [ + [ + "delimiter", "$" + ], + "bar" + ] + ], + ["string", "\""] + ] + ], + ["template-string", + [ + ["string", "@\"foo "], + [ + "interpolation", + [ + [ + "delimiter", + "$(" + ], + "bar", + [ + "delimiter", + ")" + ] + ] + ], + ["string", "\""] + ] + ], + ["string", "'a'"], + ["string", "'\\''"], + ["string", "'\\\\'"] +] + +---------------------------------------------------- + +Checks for normal and verbatim strings. +Also checks for single quoted characters. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vbnet!+xml-doc/inclusion.test b/package/src/prism/tests/languages/vbnet!+xml-doc/inclusion.test new file mode 100644 index 00000000..08523a39 --- /dev/null +++ b/package/src/prism/tests/languages/vbnet!+xml-doc/inclusion.test @@ -0,0 +1,51 @@ +''' +''' Class level summary documentation goes here. +''' +''' +''' Longer comments can be associated with a type or member through +''' the remarks tag. +''' + +---------------------------------------------------- + +[ + ["doc-comment", [ + "''' ", + ["tag", [ + ["punctuation", "<"], + ["tag", ["summary"]], + ["punctuation", ">"] + ]] + ]], + ["doc-comment", ["''' Class level summary documentation goes here."]], + ["doc-comment", [ + "''' ", + ["tag", [ + ["punctuation", ""] + ]] + ]], + ["doc-comment", [ + "''' ", + ["tag", [ + ["punctuation", "<"], + ["tag", ["remarks"]], + ["punctuation", ">"] + ]] + ]], + ["doc-comment", ["''' Longer comments can be associated with a type or member through"]], + ["doc-comment", ["''' the remarks tag."]], + ["doc-comment", [ + "''' ", + ["tag", [ + ["punctuation", ""] + ]] + ]] +] + +---------------------------------------------------- + +Checks for XML documentation comments. diff --git a/package/src/prism/tests/languages/vbnet/comment_feature.test b/package/src/prism/tests/languages/vbnet/comment_feature.test new file mode 100644 index 00000000..22292cdd --- /dev/null +++ b/package/src/prism/tests/languages/vbnet/comment_feature.test @@ -0,0 +1,18 @@ +!foobar +REM foobar + +' +'foobar + +---------------------------------------------------- + +[ + ["comment", ["!foobar"]], + ["comment", [["keyword", "REM"], " foobar"]], + ["comment", "'"], + ["comment", "'foobar"] +] + +---------------------------------------------------- + +Checks for comments \ No newline at end of file diff --git a/package/src/prism/tests/languages/vbnet/issue2781.test b/package/src/prism/tests/languages/vbnet/issue2781.test new file mode 100644 index 00000000..393aca7d --- /dev/null +++ b/package/src/prism/tests/languages/vbnet/issue2781.test @@ -0,0 +1,24 @@ +bob = new SqlCommand("Select * from test Where Code=@Code"); +bob = new SqlCommand("Select * from test Where Code=Code"); + +---------------------------------------------------- + +[ + "bob ", + ["operator", "="], + ["keyword", "new"], + " SqlCommand", + ["punctuation", "("], + ["string", "\"Select * from test Where Code=@Code\""], + ["punctuation", ")"], + ["punctuation", ";"], + + "\nbob ", + ["operator", "="], + ["keyword", "new"], + " SqlCommand", + ["punctuation", "("], + ["string", "\"Select * from test Where Code=Code\""], + ["punctuation", ")"], + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/vbnet/keyword_feature.test b/package/src/prism/tests/languages/vbnet/keyword_feature.test new file mode 100644 index 00000000..44ce8c87 --- /dev/null +++ b/package/src/prism/tests/languages/vbnet/keyword_feature.test @@ -0,0 +1,443 @@ +ADDHANDLER +ADDRESSOF +ALIAS +AND +ANDALSO +AS +BEEP +BLOAD +BOOLEAN +BSAVE +BYREF +BYTE +BYVAL +CALL +CALL ABSOLUTE +CASE +CATCH +CBOOL +CBYTE +CCHAR +CDATE +CDEC +CDBL +CHAIN +CHAR +CHDIR +CINT +CLASS +CLEAR +CLNG +CLOSE +CLS +COBJ +COM +COMMON +CONST +CONTINUE +CSBYTE +CSHORT +CSNG +CSTR +CTYPE +CUINT +CULNG +CUSHORT +DATA +DATE +DECIMAL +DECLARE +DEFAULT +DEF FN +DEF SEG +DEFDBL +DEFINT +DEFLNG +DEFSNG +DEFSTR +DELEGATE +DIM +DIRECTCAST +DO +DOUBLE +ELSE +ELSEIF +END +ENUM +ENVIRON +ERASE +ERROR +EVENT +EXIT +FALSE +FIELD +FILES +FINALLY +FOR +FOR EACH +FRIEND +FUNCTION +GET +GETTYPE +GETXMLNAMESPACE +GLOBAL +GOSUB +GOTO +HANDLES +IF +IMPLEMENTS +IMPORTS +IN +INHERITS +INPUT +INTEGER +INTERFACE +IOCTL +IS +ISNOT +KEY +KILL +LINE INPUT +LET +LIB +LIKE +LOCATE +LOCK +LONG +LOOP +LSET +ME +MKDIR +MOD +MODULE +MUSTINHERIT +MUSTOVERRIDE +MYBASE +MYCLASS +NAME +NAMESPACE +NARROWING +NEW +NEXT +NOT +NOTHING +NOTINHERITABLE +NOTOVERRIDABLE +OBJECT +OF +OFF +ON +ON COM +ON ERROR +ON KEY +ON TIMER +OPERATOR +OPEN +OPTION +OPTION BASE +OPTIONAL +OR +ORELSE +OUT +OVERLOADS +OVERRIDABLE +OVERRIDES +PARAMARRAY +PARTIAL +POKE +PRIVATE +PROPERTY +PROTECTED +PUBLIC +PUT +RAISEEVENT +READ +READONLY +REDIM +REM +REMOVEHANDLER +RESTORE +RESUME +RETURN +RMDIR +RSET +RUN +SBYTE +SELECT +SELECT CASE +SET +SHADOWS +SHARED +SHORT +SINGLE +SHELL +SLEEP +STATIC +STEP +STOP +STRING +STRUCTURE +SUB +SYNCLOCK +SWAP +SYSTEM +THEN +THROW +TIMER +TO +TROFF +TRON +TRUE +TRY +TRYCAST +TYPE +TYPEOF +UINTEGER +ULONG +UNLOCK +UNTIL +USHORT +USING +VIEW PRINT +WAIT +WEND +WHEN +WHILE +WIDENING +WITH +WITHEVENTS +WRITE +WRITEONLY +XOR +#CONST +#ELSE +#ELSE +#ELSEIF +#END +#IF + +---------------------------------------------------- + +[ + ["keyword", "ADDHANDLER"], + ["keyword", "ADDRESSOF"], + ["keyword", "ALIAS"], + ["keyword", "AND"], + ["keyword", "ANDALSO"], + ["keyword", "AS"], + ["keyword", "BEEP"], + ["keyword", "BLOAD"], + ["keyword", "BOOLEAN"], + ["keyword", "BSAVE"], + ["keyword", "BYREF"], + ["keyword", "BYTE"], + ["keyword", "BYVAL"], + ["keyword", "CALL"], + ["keyword", "CALL ABSOLUTE"], + ["keyword", "CASE"], + ["keyword", "CATCH"], + ["keyword", "CBOOL"], + ["keyword", "CBYTE"], + ["keyword", "CCHAR"], + ["keyword", "CDATE"], + ["keyword", "CDEC"], + ["keyword", "CDBL"], + ["keyword", "CHAIN"], + ["keyword", "CHAR"], + ["keyword", "CHDIR"], + ["keyword", "CINT"], + ["keyword", "CLASS"], + ["keyword", "CLEAR"], + ["keyword", "CLNG"], + ["keyword", "CLOSE"], + ["keyword", "CLS"], + ["keyword", "COBJ"], + ["keyword", "COM"], + ["keyword", "COMMON"], + ["keyword", "CONST"], + ["keyword", "CONTINUE"], + ["keyword", "CSBYTE"], + ["keyword", "CSHORT"], + ["keyword", "CSNG"], + ["keyword", "CSTR"], + ["keyword", "CTYPE"], + ["keyword", "CUINT"], + ["keyword", "CULNG"], + ["keyword", "CUSHORT"], + ["keyword", "DATA"], + ["keyword", "DATE"], + ["keyword", "DECIMAL"], + ["keyword", "DECLARE"], + ["keyword", "DEFAULT"], + ["keyword", "DEF FN"], + ["keyword", "DEF SEG"], + ["keyword", "DEFDBL"], + ["keyword", "DEFINT"], + ["keyword", "DEFLNG"], + ["keyword", "DEFSNG"], + ["keyword", "DEFSTR"], + ["keyword", "DELEGATE"], + ["keyword", "DIM"], + ["keyword", "DIRECTCAST"], + ["keyword", "DO"], + ["keyword", "DOUBLE"], + ["keyword", "ELSE"], + ["keyword", "ELSEIF"], + ["keyword", "END"], + ["keyword", "ENUM"], + ["keyword", "ENVIRON"], + ["keyword", "ERASE"], + ["keyword", "ERROR"], + ["keyword", "EVENT"], + ["keyword", "EXIT"], + ["keyword", "FALSE"], + ["keyword", "FIELD"], + ["keyword", "FILES"], + ["keyword", "FINALLY"], + ["keyword", "FOR"], + ["keyword", "FOR EACH"], + ["keyword", "FRIEND"], + ["keyword", "FUNCTION"], + ["keyword", "GET"], + ["keyword", "GETTYPE"], + ["keyword", "GETXMLNAMESPACE"], + ["keyword", "GLOBAL"], + ["keyword", "GOSUB"], + ["keyword", "GOTO"], + ["keyword", "HANDLES"], + ["keyword", "IF"], + ["keyword", "IMPLEMENTS"], + ["keyword", "IMPORTS"], + ["keyword", "IN"], + ["keyword", "INHERITS"], + ["keyword", "INPUT"], + ["keyword", "INTEGER"], + ["keyword", "INTERFACE"], + ["keyword", "IOCTL"], + ["keyword", "IS"], + ["keyword", "ISNOT"], + ["keyword", "KEY"], + ["keyword", "KILL"], + ["keyword", "LINE INPUT"], + ["keyword", "LET"], + ["keyword", "LIB"], + ["keyword", "LIKE"], + ["keyword", "LOCATE"], + ["keyword", "LOCK"], + ["keyword", "LONG"], + ["keyword", "LOOP"], + ["keyword", "LSET"], + ["keyword", "ME"], + ["keyword", "MKDIR"], + ["keyword", "MOD"], + ["keyword", "MODULE"], + ["keyword", "MUSTINHERIT"], + ["keyword", "MUSTOVERRIDE"], + ["keyword", "MYBASE"], + ["keyword", "MYCLASS"], + ["keyword", "NAME"], + ["keyword", "NAMESPACE"], + ["keyword", "NARROWING"], + ["keyword", "NEW"], + ["keyword", "NEXT"], + ["keyword", "NOT"], + ["keyword", "NOTHING"], + ["keyword", "NOTINHERITABLE"], + ["keyword", "NOTOVERRIDABLE"], + ["keyword", "OBJECT"], + ["keyword", "OF"], + ["keyword", "OFF"], + ["keyword", "ON"], + ["keyword", "ON COM"], + ["keyword", "ON ERROR"], + ["keyword", "ON KEY"], + ["keyword", "ON TIMER"], + ["keyword", "OPERATOR"], + ["keyword", "OPEN"], + ["keyword", "OPTION"], + ["keyword", "OPTION BASE"], + ["keyword", "OPTIONAL"], + ["keyword", "OR"], + ["keyword", "ORELSE"], + ["keyword", "OUT"], + ["keyword", "OVERLOADS"], + ["keyword", "OVERRIDABLE"], + ["keyword", "OVERRIDES"], + ["keyword", "PARAMARRAY"], + ["keyword", "PARTIAL"], + ["keyword", "POKE"], + ["keyword", "PRIVATE"], + ["keyword", "PROPERTY"], + ["keyword", "PROTECTED"], + ["keyword", "PUBLIC"], + ["keyword", "PUT"], + ["keyword", "RAISEEVENT"], + ["keyword", "READ"], + ["keyword", "READONLY"], + ["keyword", "REDIM"], + ["keyword", "REM"], + ["keyword", "REMOVEHANDLER"], + ["keyword", "RESTORE"], + ["keyword", "RESUME"], + ["keyword", "RETURN"], + ["keyword", "RMDIR"], + ["keyword", "RSET"], + ["keyword", "RUN"], + ["keyword", "SBYTE"], + ["keyword", "SELECT"], + ["keyword", "SELECT CASE"], + ["keyword", "SET"], + ["keyword", "SHADOWS"], + ["keyword", "SHARED"], + ["keyword", "SHORT"], + ["keyword", "SINGLE"], + ["keyword", "SHELL"], + ["keyword", "SLEEP"], + ["keyword", "STATIC"], + ["keyword", "STEP"], + ["keyword", "STOP"], + ["keyword", "STRING"], + ["keyword", "STRUCTURE"], + ["keyword", "SUB"], + ["keyword", "SYNCLOCK"], + ["keyword", "SWAP"], + ["keyword", "SYSTEM"], + ["keyword", "THEN"], + ["keyword", "THROW"], + ["keyword", "TIMER"], + ["keyword", "TO"], + ["keyword", "TROFF"], + ["keyword", "TRON"], + ["keyword", "TRUE"], + ["keyword", "TRY"], + ["keyword", "TRYCAST"], + ["keyword", "TYPE"], + ["keyword", "TYPEOF"], + ["keyword", "UINTEGER"], + ["keyword", "ULONG"], + ["keyword", "UNLOCK"], + ["keyword", "UNTIL"], + ["keyword", "USHORT"], + ["keyword", "USING"], + ["keyword", "VIEW PRINT"], + ["keyword", "WAIT"], + ["keyword", "WEND"], + ["keyword", "WHEN"], + ["keyword", "WHILE"], + ["keyword", "WIDENING"], + ["keyword", "WITH"], + ["keyword", "WITHEVENTS"], + ["keyword", "WRITE"], + ["keyword", "WRITEONLY"], + ["keyword", "XOR"], + ["keyword", "#CONST"], + ["keyword", "#ELSE"], + ["keyword", "#ELSE"], + ["keyword", "#ELSEIF"], + ["keyword", "#END"], + ["keyword", "#IF"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vbnet/punctuation_feature.test b/package/src/prism/tests/languages/vbnet/punctuation_feature.test new file mode 100644 index 00000000..762103bc --- /dev/null +++ b/package/src/prism/tests/languages/vbnet/punctuation_feature.test @@ -0,0 +1,15 @@ +, ; : +( ) { } + +---------------------------------------------------- + +[ + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", ":"], + + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"] +] \ No newline at end of file diff --git a/package/src/prism/tests/languages/vbnet/string_feature.test b/package/src/prism/tests/languages/vbnet/string_feature.test new file mode 100644 index 00000000..e910c07d --- /dev/null +++ b/package/src/prism/tests/languages/vbnet/string_feature.test @@ -0,0 +1,20 @@ +Dim x = "hello +world" + +Console.WriteLine("Message: {0}", message) + +---------------------------------------------------- + +[ + ["keyword", "Dim"], + " x ", + ["operator", "="], + ["string", "\"hello\nworld\""], + + "\n\nConsole.WriteLine", + ["punctuation", "("], + ["string", "\"Message: {0}\""], + ["punctuation", ","], + " message", + ["punctuation", ")"] +] diff --git a/package/src/prism/tests/languages/velocity/directive_feature.test b/package/src/prism/tests/languages/velocity/directive_feature.test new file mode 100644 index 00000000..8235fddf --- /dev/null +++ b/package/src/prism/tests/languages/velocity/directive_feature.test @@ -0,0 +1,524 @@ +#foreach($mud in $mudsOnSpecial) +#if($customer.hasPurchased($mud)) +#set($a = "Velocity") +#set($foo.bar[1] = 3) +#{set}($map["apple"] = "orange") +#if($foo == $bar)#end +#if (!$foo)#end +#if ($foo && $foo.bar)#end +#{if}($foo1 || $foo2)#end +#set( $monkey.Say = ["Not", $my, "fault"] ) +#set( $monkey.Map = {"banana" : "good", "roast beef" : "bad"}) +#set( $result = $query.criteria("address") ) +#set( $result = true ) +#set( $result = false ) +#if( $foo < 10 ) +#elseif( $foo == 10 ) +#else +#end +#if( $foo == $bar)it's true!#{else}it's not!#end +#include( "greetings.txt", $seasonalstock ) +#parse( "me.vm" ) +#{parse}( "me.vm" ) +#break +#{break} +#break($macro.topmost) +#stop('$foo was not in context') +#{stop} +#evaluate($dynamicsource) +#macro( d ) + +#end +#d() +#@d()Hello!#end +\#include( "a.txt" ) +\\#include ( "a.txt" ) +#set($foo=["$10 and ","a pie"])#foreach($a in $foo)$a#end +#set( $foo = $bar + 3 ) +#set( $foo = $bar - 4 ) +#set( $foo = $bar * 6 ) +#set( $foo = $bar / 2 ) +#set( $foo = $bar % 5 ) +#foreach( $foo in [1..5] ) + +---------------------------------------------------- + +[ + ["directive", [ + ["keyword", ["#foreach"]], + ["punctuation", "("], + ["variable", ["$mud"]], + ["keyword", ["in"]], + ["variable", ["$mudsOnSpecial"]], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#if"]], + ["punctuation", "("], + ["variable", [ + "$customer", + ["punctuation", "."], + ["function", "hasPurchased"], + ["punctuation", "("], + "$mud", + ["punctuation", ")"] + ]], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", ["$a"]], + ["operator", "="], + ["string", "\"Velocity\""], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", [ + "$foo", + ["punctuation", "."], + "bar", + ["punctuation", "["], + ["number", "1"], + ["punctuation", "]"] + ]], + ["operator", "="], + ["number", "3"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", [ + "#", + ["punctuation", "{"], + "set", + ["punctuation", "}"] + ]], + ["punctuation", "("], + ["variable", [ + "$map", + ["punctuation", "["], + ["string", "\"apple\""], + ["punctuation", "]"] + ]], + ["operator", "="], + ["string", "\"orange\""], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#if"]], + ["punctuation", "("], + ["variable", ["$foo"]], + ["operator", "=="], + ["variable", ["$bar"]], + ["punctuation", ")"] + ]], + ["directive", [ + ["keyword", ["#end"]] + ]], + + ["directive", [ + ["keyword", ["#if"]], + ["punctuation", "("], + ["operator", "!"], + ["variable", ["$foo"]], + ["punctuation", ")"] + ]], + ["directive", [ + ["keyword", ["#end"]] + ]], + + ["directive", [ + ["keyword", ["#if"]], + ["punctuation", "("], + ["variable", ["$foo"]], + ["operator", "&&"], + ["variable", [ + "$foo", + ["punctuation", "."], + "bar" + ]], + ["punctuation", ")"] + ]], + ["directive", [ + ["keyword", ["#end"]] + ]], + + ["directive", [ + ["keyword", [ + "#", + ["punctuation", "{"], + "if", + ["punctuation", "}"] + ]], + ["punctuation", "("], + ["variable", ["$foo1"]], + ["operator", "||"], + ["variable", ["$foo2"]], + ["punctuation", ")"] + ]], + ["directive", [ + ["keyword", ["#end"]] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", [ + "$monkey", + ["punctuation", "."], + "Say" + ]], + ["operator", "="], + ["punctuation", "["], + ["string", "\"Not\""], + ["punctuation", ","], + ["variable", ["$my"]], + ["punctuation", ","], + ["string", "\"fault\""], + ["punctuation", "]"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", [ + "$monkey", + ["punctuation", "."], + "Map" + ]], + ["operator", "="], + ["punctuation", "{"], + ["string", "\"banana\""], + ["punctuation", ":"], + ["string", "\"good\""], + ["punctuation", ","], + ["string", "\"roast beef\""], + ["punctuation", ":"], + ["string", "\"bad\""], + ["punctuation", "}"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", ["$result"]], + ["operator", "="], + ["variable", [ + "$query", + ["punctuation", "."], + ["function", "criteria"], + ["punctuation", "("], + ["string", "\"address\""], + ["punctuation", ")"] + ]], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", ["$result"]], + ["operator", "="], + ["boolean", "true"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", ["$result"]], + ["operator", "="], + ["boolean", "false"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#if"]], + ["punctuation", "("], + ["variable", ["$foo"]], + ["operator", "<"], + ["number", "10"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#elseif"]], + ["punctuation", "("], + ["variable", ["$foo"]], + ["operator", "=="], + ["number", "10"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#else"]] + ]], + + ["directive", [ + ["keyword", ["#end"]] + ]], + + ["directive", [ + ["keyword", ["#if"]], + ["punctuation", "("], + ["variable", ["$foo"]], + ["operator", "=="], + ["variable", ["$bar"]], + ["punctuation", ")"] + ]], + "it's true!", + ["directive", [ + ["keyword", [ + "#", + ["punctuation", "{"], + "else", + ["punctuation", "}"] + ]] + ]], + "it's not!", + ["directive", [ + ["keyword", ["#end"]] + ]], + + ["directive", [ + ["keyword", ["#include"]], + ["punctuation", "("], + ["string", "\"greetings.txt\""], + ["punctuation", ","], + ["variable", ["$seasonalstock"]], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#parse"]], + ["punctuation", "("], + ["string", "\"me.vm\""], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", [ + "#", + ["punctuation", "{"], + "parse", + ["punctuation", "}"] + ]], + ["punctuation", "("], + ["string", "\"me.vm\""], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#break"]] + ]], + + ["directive", [ + ["keyword", [ + "#", + ["punctuation", "{"], + "break", + ["punctuation", "}"] + ]] + ]], + + ["directive", [ + ["keyword", ["#break"]], + ["punctuation", "("], + ["variable", [ + "$macro", + ["punctuation", "."], + "topmost" + ]], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#stop"]], + ["punctuation", "("], + ["string", "'$foo was not in context'"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", [ + "#", + ["punctuation", "{"], + "stop", + ["punctuation", "}"] + ]] + ]], + + ["directive", [ + ["keyword", ["#evaluate"]], + ["punctuation", "("], + ["variable", ["$dynamicsource"]], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#macro"]], + ["punctuation", "("], + " d ", + ["punctuation", ")"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["tr"]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["td"]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["directive", [ + ["keyword", ["#end"]] + ]], + + ["directive", [ + ["keyword", ["#d"]], + ["punctuation", "("], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#@d"]], + ["punctuation", "("], + ["punctuation", ")"] + ]], + "Hello!", + ["directive", [ + ["keyword", ["#end"]] + ]], + + "\n\\#include", + ["markup-bracket", "("], + " \"a.txt\" ", + ["markup-bracket", ")"], + + "\n\\\\", + ["directive", [ + ["keyword", ["#include"]], + ["punctuation", "("], + ["string", "\"a.txt\""], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", ["$foo"]], + ["operator", "="], + ["punctuation", "["], + ["string", "\"$10 and \""], + ["punctuation", ","], + ["string", "\"a pie\""], + ["punctuation", "]"], + ["punctuation", ")"] + ]], + ["directive", [ + ["keyword", ["#foreach"]], + ["punctuation", "("], + ["variable", ["$a"]], + ["keyword", ["in"]], + ["variable", ["$foo"]], + ["punctuation", ")"] + ]], + ["variable", ["$a"]], + ["directive", [ + ["keyword", ["#end"]] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", ["$foo"]], + ["operator", "="], + ["variable", ["$bar"]], + ["operator", "+"], + ["number", "3"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", ["$foo"]], + ["operator", "="], + ["variable", ["$bar"]], + ["operator", "-"], + ["number", "4"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", ["$foo"]], + ["operator", "="], + ["variable", ["$bar"]], + ["operator", "*"], + ["number", "6"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", ["$foo"]], + ["operator", "="], + ["variable", ["$bar"]], + ["operator", "/"], + ["number", "2"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#set"]], + ["punctuation", "("], + ["variable", ["$foo"]], + ["operator", "="], + ["variable", ["$bar"]], + ["operator", "%"], + ["number", "5"], + ["punctuation", ")"] + ]], + + ["directive", [ + ["keyword", ["#foreach"]], + ["punctuation", "("], + ["variable", ["$foo"]], + ["keyword", ["in"]], + ["punctuation", "["], + ["number", "1"], + ["operator", ".."], + ["number", "5"], + ["punctuation", "]"], + ["punctuation", ")"] + ]] +] + +---------------------------------------------------- + +Checks for directives. diff --git a/package/src/prism/tests/languages/velocity/unparsed_feature.test b/package/src/prism/tests/languages/velocity/unparsed_feature.test new file mode 100644 index 00000000..c82a019b --- /dev/null +++ b/package/src/prism/tests/languages/velocity/unparsed_feature.test @@ -0,0 +1,29 @@ +#[[]]# +#[[This is not parsed]]# +#[[#if("some quotes" 'some quotes') +## #* *# +$dollar +]]# + +---------------------------------------------------- + +[ + ["unparsed", [ + ["punctuation", "#[["], + ["punctuation", "]]#"] + ]], + ["unparsed", [ + ["punctuation", "#[["], + "This is not parsed", + ["punctuation", "]]#"] + ]], + ["unparsed", [ + ["punctuation", "#[["], + "#if(\"some quotes\" 'some quotes')\n## #* *#\n$dollar\n", + ["punctuation", "]]#"] + ]] +] + +---------------------------------------------------- + +Checks for unparsed sections. \ No newline at end of file diff --git a/package/src/prism/tests/languages/velocity/variable_feature.test b/package/src/prism/tests/languages/velocity/variable_feature.test new file mode 100644 index 00000000..592ab8e4 --- /dev/null +++ b/package/src/prism/tests/languages/velocity/variable_feature.test @@ -0,0 +1,212 @@ +$mud +$customer.Name +$flogger.getPromo( $mud ) +$mud-slinger +$mud_slinger +$mudSlinger1 +$!mudSlinger_9 +$person.setAttributes( ["Strange", false, "Excited"] ) +$foo[0] +$foo[$i] +$foo["bar"] +$foo.bar[1].junk +$foo.callMethod()[1] +$foo["apple"][4] +${mudSlinger} +$!{mudSlinger_9} +${customer.Address} +${purchase.getTotal()} + + +$\!foo +$\!{foo} +$\\!foo +$\\\!foo +\$foo +\$!foo +\$!{foo} +\\$!{foo} + +---------------------------------------------------- + +[ + ["variable", ["$mud"]], + + ["variable", [ + "$customer", + ["punctuation", "."], + "Name" + ]], + + ["variable", [ + "$flogger", + ["punctuation", "."], + ["function", "getPromo"], + ["punctuation", "("], + " $mud ", + ["punctuation", ")"] + ]], + + ["variable", ["$mud-slinger"]], + + ["variable", ["$mud_slinger"]], + + ["variable", ["$mudSlinger1"]], + + ["variable", ["$!mudSlinger_9"]], + + ["variable", [ + "$person", + ["punctuation", "."], + ["function", "setAttributes"], + ["punctuation", "("], + ["punctuation", "["], + ["string", "\"Strange\""], + ["punctuation", ","], + ["boolean", "false"], + ["punctuation", ","], + ["string", "\"Excited\""], + ["punctuation", "]"], + ["punctuation", ")"] + ]], + + ["variable", [ + "$foo", + ["punctuation", "["], + ["number", "0"], + ["punctuation", "]"] + ]], + + ["variable", [ + "$foo", + ["punctuation", "["], + "$i", + ["punctuation", "]"] + ]], + + ["variable", [ + "$foo", + ["punctuation", "["], + ["string", "\"bar\""], + ["punctuation", "]"] + ]], + + ["variable", [ + "$foo", + ["punctuation", "."], + "bar", + ["punctuation", "["], + ["number", "1"], + ["punctuation", "]"], + ["punctuation", "."], + "junk" + ]], + + ["variable", [ + "$foo", + ["punctuation", "."], + ["function", "callMethod"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["number", "1"], + ["punctuation", "]"] + ]], + + ["variable", [ + "$foo", + ["punctuation", "["], + ["string", "\"apple\""], + ["punctuation", "]"], + ["punctuation", "["], + ["number", "4"], + ["punctuation", "]"] + ]], + + ["variable", [ + "$", + ["punctuation", "{"], + "mudSlinger", + ["punctuation", "}"] + ]], + + ["variable", [ + "$!", + ["punctuation", "{"], + "mudSlinger_9", + ["punctuation", "}"] + ]], + + ["variable", [ + "$", + ["punctuation", "{"], + "customer", + ["punctuation", "."], + "Address", + ["punctuation", "}"] + ]], + + ["variable", [ + "$", + ["punctuation", "{"], + "purchase", + ["punctuation", "."], + ["function", "getTotal"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "}"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["input"]], + ["attr-name", ["value"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["variable", ["$email"]], + ["punctuation", "\""] + ]], + ["punctuation", "/>"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["input"]], + ["attr-name", ["value"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["variable", [ + "$!", + ["punctuation", "{"], + "email", + ["punctuation", "}"] + ]], + ["punctuation", "\""] + ]], + ["punctuation", "/>"] + ]], + + "\n$\\!foo\n$\\!", + ["markup-bracket", "{"], + "foo", + ["markup-bracket", "}"], + + "\n$\\\\!foo\n$\\\\\\!foo\n\\$foo\n\\$!foo\n\\$!", + ["markup-bracket", "{"], + "foo", + ["markup-bracket", "}"], + + "\n\\\\", + ["variable", [ + "$!", + ["punctuation", "{"], + "foo", + ["punctuation", "}"] + ]] +] + +---------------------------------------------------- + +Checks for variables. diff --git a/package/src/prism/tests/languages/velocity/velocity-comment_feature.test b/package/src/prism/tests/languages/velocity/velocity-comment_feature.test new file mode 100644 index 00000000..675e9f02 --- /dev/null +++ b/package/src/prism/tests/languages/velocity/velocity-comment_feature.test @@ -0,0 +1,18 @@ +#**# +#*Multiline
    +comment*# +## +## Single line comment
    + +---------------------------------------------------- + +[ + ["velocity-comment", "#**#"], + ["velocity-comment", "#*Multiline
    \ncomment*#"], + ["velocity-comment", "##"], + ["velocity-comment", "## Single line comment
    "] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/verilog/comment_feature.test b/package/src/prism/tests/languages/verilog/comment_feature.test new file mode 100644 index 00000000..20318c3d --- /dev/null +++ b/package/src/prism/tests/languages/verilog/comment_feature.test @@ -0,0 +1,18 @@ +// +// Foobar +/**/ +/* foo +bar */ + +---------------------------------------------------- + +[ + ["comment", "//"], + ["comment", "// Foobar"], + ["comment", "/**/"], + ["comment", "/* foo\nbar */"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/verilog/constant_feature.test b/package/src/prism/tests/languages/verilog/constant_feature.test new file mode 100644 index 00000000..33dc2bc3 --- /dev/null +++ b/package/src/prism/tests/languages/verilog/constant_feature.test @@ -0,0 +1,13 @@ +`define +`UNKNOWN + +---------------------------------------------------- + +[ + ["constant", "`define"], + ["constant", "`UNKNOWN"] +] + +---------------------------------------------------- + +Checks for user defined constants. \ No newline at end of file diff --git a/package/src/prism/tests/languages/verilog/function_feature.test b/package/src/prism/tests/languages/verilog/function_feature.test new file mode 100644 index 00000000..1d70542f --- /dev/null +++ b/package/src/prism/tests/languages/verilog/function_feature.test @@ -0,0 +1,15 @@ +foo() +foo_bar() +foo_BAR_42() + +---------------------------------------------------- + +[ + ["function", "foo"], ["punctuation", "("], ["punctuation", ")"], + ["function", "foo_bar"], ["punctuation", "("], ["punctuation", ")"], + ["function", "foo_BAR_42"], ["punctuation", "("], ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/verilog/important_feature.test b/package/src/prism/tests/languages/verilog/important_feature.test new file mode 100644 index 00000000..12008820 --- /dev/null +++ b/package/src/prism/tests/languages/verilog/important_feature.test @@ -0,0 +1,27 @@ +always_latch +always_comb +always_ff +always + +always_latch @ +always_comb @ +always_ff @ +always @ + +---------------------------------------------------- + +[ + ["important", "always_latch"], + ["important", "always_comb"], + ["important", "always_ff"], + ["important", "always"], + + ["important", "always_latch @"], + ["important", "always_comb @"], + ["important", "always_ff @"], + ["important", "always @"] +] + +---------------------------------------------------- + +Checks for logic blocks. \ No newline at end of file diff --git a/package/src/prism/tests/languages/verilog/kernel-function_feature.test b/package/src/prism/tests/languages/verilog/kernel-function_feature.test new file mode 100644 index 00000000..4ce28415 --- /dev/null +++ b/package/src/prism/tests/languages/verilog/kernel-function_feature.test @@ -0,0 +1,13 @@ +$display() + +---------------------------------------------------- + +[ + ["kernel-function", "$display"], + ["punctuation", "("], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for kernel functions. diff --git a/package/src/prism/tests/languages/verilog/keyword_feature.test b/package/src/prism/tests/languages/verilog/keyword_feature.test new file mode 100644 index 00000000..5d603ae1 --- /dev/null +++ b/package/src/prism/tests/languages/verilog/keyword_feature.test @@ -0,0 +1,443 @@ +alias +and +assert +assign +assume +automatic +before +begin +bind +bins +binsof +bit +break +buf +bufif0 +bufif1 +byte +class +case +casex +casez +cell +chandle +clocking +cmos +config +const +constraint +context +continue +cover +covergroup +coverpoint +cross +deassign +default +defparam +design +disable +dist +do +edge +else +end +endcase +endclass +endclocking +endconfig +endfunction +endgenerate +endgroup +endinterface +endmodule +endpackage +endprimitive +endprogram +endproperty +endspecify +endsequence +endtable +endtask +enum +event +expect +export +extends +extern +final +first_match +for +force +foreach +forever +fork +forkjoin +function +generate +genvar +highz0 +highz1 +if +iff +ifnone +ignore_bins +illegal_bins +import +incdir +include +initial +inout +input +inside +instance +int +integer +interface +intersect +join +join_any +join_none +large +liblist +library +local +localparam +logic +longint +macromodule +matches +medium +modport +module +nand +negedge +new +nmos +nor +noshowcancelled +not +notif0 +notif1 +null +or +output +package +packed +parameter +pmos +posedge +primitive +priority +program +property +protected +pull0 +pull1 +pulldown +pullup +pulsestyle_onevent +pulsestyle_ondetect +pure +rand +randc +randcase +randsequence +rcmos +real +realtime +ref +reg +release +repeat +return +rnmos +rpmos +rtran +rtranif0 +rtranif1 +scalared +sequence +shortint +shortreal +showcancelled +signed +small +solve +specify +specparam +static +string +strong0 +strong1 +struct +super +supply0 +supply1 +table +tagged +task +this +throughout +time +timeprecision +timeunit +tran +tranif0 +tranif1 +tri +tri0 +tri1 +triand +trior +trireg +type +typedef +union +unique +unsigned +use +uwire +var +vectored +virtual +void +wait +wait_order +wand +weak0 +weak1 +while +wildcard +wire +with +within +wor +xnor +xor + +---------------------------------------------------- + +[ + ["keyword", "alias"], + ["keyword", "and"], + ["keyword", "assert"], + ["keyword", "assign"], + ["keyword", "assume"], + ["keyword", "automatic"], + ["keyword", "before"], + ["keyword", "begin"], + ["keyword", "bind"], + ["keyword", "bins"], + ["keyword", "binsof"], + ["keyword", "bit"], + ["keyword", "break"], + ["keyword", "buf"], + ["keyword", "bufif0"], + ["keyword", "bufif1"], + ["keyword", "byte"], + ["keyword", "class"], + ["keyword", "case"], + ["keyword", "casex"], + ["keyword", "casez"], + ["keyword", "cell"], + ["keyword", "chandle"], + ["keyword", "clocking"], + ["keyword", "cmos"], + ["keyword", "config"], + ["keyword", "const"], + ["keyword", "constraint"], + ["keyword", "context"], + ["keyword", "continue"], + ["keyword", "cover"], + ["keyword", "covergroup"], + ["keyword", "coverpoint"], + ["keyword", "cross"], + ["keyword", "deassign"], + ["keyword", "default"], + ["keyword", "defparam"], + ["keyword", "design"], + ["keyword", "disable"], + ["keyword", "dist"], + ["keyword", "do"], + ["keyword", "edge"], + ["keyword", "else"], + ["keyword", "end"], + ["keyword", "endcase"], + ["keyword", "endclass"], + ["keyword", "endclocking"], + ["keyword", "endconfig"], + ["keyword", "endfunction"], + ["keyword", "endgenerate"], + ["keyword", "endgroup"], + ["keyword", "endinterface"], + ["keyword", "endmodule"], + ["keyword", "endpackage"], + ["keyword", "endprimitive"], + ["keyword", "endprogram"], + ["keyword", "endproperty"], + ["keyword", "endspecify"], + ["keyword", "endsequence"], + ["keyword", "endtable"], + ["keyword", "endtask"], + ["keyword", "enum"], + ["keyword", "event"], + ["keyword", "expect"], + ["keyword", "export"], + ["keyword", "extends"], + ["keyword", "extern"], + ["keyword", "final"], + ["keyword", "first_match"], + ["keyword", "for"], + ["keyword", "force"], + ["keyword", "foreach"], + ["keyword", "forever"], + ["keyword", "fork"], + ["keyword", "forkjoin"], + ["keyword", "function"], + ["keyword", "generate"], + ["keyword", "genvar"], + ["keyword", "highz0"], + ["keyword", "highz1"], + ["keyword", "if"], + ["keyword", "iff"], + ["keyword", "ifnone"], + ["keyword", "ignore_bins"], + ["keyword", "illegal_bins"], + ["keyword", "import"], + ["keyword", "incdir"], + ["keyword", "include"], + ["keyword", "initial"], + ["keyword", "inout"], + ["keyword", "input"], + ["keyword", "inside"], + ["keyword", "instance"], + ["keyword", "int"], + ["keyword", "integer"], + ["keyword", "interface"], + ["keyword", "intersect"], + ["keyword", "join"], + ["keyword", "join_any"], + ["keyword", "join_none"], + ["keyword", "large"], + ["keyword", "liblist"], + ["keyword", "library"], + ["keyword", "local"], + ["keyword", "localparam"], + ["keyword", "logic"], + ["keyword", "longint"], + ["keyword", "macromodule"], + ["keyword", "matches"], + ["keyword", "medium"], + ["keyword", "modport"], + ["keyword", "module"], + ["keyword", "nand"], + ["keyword", "negedge"], + ["keyword", "new"], + ["keyword", "nmos"], + ["keyword", "nor"], + ["keyword", "noshowcancelled"], + ["keyword", "not"], + ["keyword", "notif0"], + ["keyword", "notif1"], + ["keyword", "null"], + ["keyword", "or"], + ["keyword", "output"], + ["keyword", "package"], + ["keyword", "packed"], + ["keyword", "parameter"], + ["keyword", "pmos"], + ["keyword", "posedge"], + ["keyword", "primitive"], + ["keyword", "priority"], + ["keyword", "program"], + ["keyword", "property"], + ["keyword", "protected"], + ["keyword", "pull0"], + ["keyword", "pull1"], + ["keyword", "pulldown"], + ["keyword", "pullup"], + ["keyword", "pulsestyle_onevent"], + ["keyword", "pulsestyle_ondetect"], + ["keyword", "pure"], + ["keyword", "rand"], + ["keyword", "randc"], + ["keyword", "randcase"], + ["keyword", "randsequence"], + ["keyword", "rcmos"], + ["keyword", "real"], + ["keyword", "realtime"], + ["keyword", "ref"], + ["keyword", "reg"], + ["keyword", "release"], + ["keyword", "repeat"], + ["keyword", "return"], + ["keyword", "rnmos"], + ["keyword", "rpmos"], + ["keyword", "rtran"], + ["keyword", "rtranif0"], + ["keyword", "rtranif1"], + ["keyword", "scalared"], + ["keyword", "sequence"], + ["keyword", "shortint"], + ["keyword", "shortreal"], + ["keyword", "showcancelled"], + ["keyword", "signed"], + ["keyword", "small"], + ["keyword", "solve"], + ["keyword", "specify"], + ["keyword", "specparam"], + ["keyword", "static"], + ["keyword", "string"], + ["keyword", "strong0"], + ["keyword", "strong1"], + ["keyword", "struct"], + ["keyword", "super"], + ["keyword", "supply0"], + ["keyword", "supply1"], + ["keyword", "table"], + ["keyword", "tagged"], + ["keyword", "task"], + ["keyword", "this"], + ["keyword", "throughout"], + ["keyword", "time"], + ["keyword", "timeprecision"], + ["keyword", "timeunit"], + ["keyword", "tran"], + ["keyword", "tranif0"], + ["keyword", "tranif1"], + ["keyword", "tri"], + ["keyword", "tri0"], + ["keyword", "tri1"], + ["keyword", "triand"], + ["keyword", "trior"], + ["keyword", "trireg"], + ["keyword", "type"], + ["keyword", "typedef"], + ["keyword", "union"], + ["keyword", "unique"], + ["keyword", "unsigned"], + ["keyword", "use"], + ["keyword", "uwire"], + ["keyword", "var"], + ["keyword", "vectored"], + ["keyword", "virtual"], + ["keyword", "void"], + ["keyword", "wait"], + ["keyword", "wait_order"], + ["keyword", "wand"], + ["keyword", "weak0"], + ["keyword", "weak1"], + ["keyword", "while"], + ["keyword", "wildcard"], + ["keyword", "wire"], + ["keyword", "with"], + ["keyword", "within"], + ["keyword", "wor"], + ["keyword", "xnor"], + ["keyword", "xor"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/verilog/number_feature.test b/package/src/prism/tests/languages/verilog/number_feature.test new file mode 100644 index 00000000..3d2bf481 --- /dev/null +++ b/package/src/prism/tests/languages/verilog/number_feature.test @@ -0,0 +1,39 @@ +#1 +##42 + +'h 12 +6'h 12 +8'B0010_1010 +123 +8'o 77 +'h x +16'h ???? + +3.14159 +4e8 +3.2E-14 +0.7e+8 + +---------------------------------------------------- + +[ + ["number", "#1"], + ["number", "##42"], + + ["number", "'h 12"], + ["number", "6'h 12"], + ["number", "8'B0010_1010"], + ["number", "123"], + ["number", "8'o 77"], + ["number", "'h x"], + ["number", "16'h ????"], + + ["number", "3.14159"], + ["number", "4e8"], + ["number", "3.2E-14"], + ["number", "0.7e+8"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/verilog/operator_feature.test b/package/src/prism/tests/languages/verilog/operator_feature.test new file mode 100644 index 00000000..a19deb72 --- /dev/null +++ b/package/src/prism/tests/languages/verilog/operator_feature.test @@ -0,0 +1,39 @@ +! ~ & | +~& ~| ^ +~^ ^~ ++ - { } +* ** / % +<< >> <<< >>> +< <= > >= +== != === !== +==? !=? +&& || ? +-> <-> +++ -- ++= -= /= *= +%= &= |= ^= +<<= >>= <<<= >>>= + +---------------------------------------------------- + +[ + ["operator", "!"], ["operator", "~"], ["operator", "&"], ["operator", "|"], + ["operator", "~&"], ["operator", "~|"], ["operator", "^"], + ["operator", "~^"], ["operator", "^~"], + ["operator", "+"], ["operator", "-"], ["operator", "{"], ["operator", "}"], + ["operator", "*"], ["operator", "**"], ["operator", "/"], ["operator", "%"], + ["operator", "<<"], ["operator", ">>"], ["operator", "<<<"], ["operator", ">>>"], + ["operator", "<"], ["operator", "<="], ["operator", ">"], ["operator", ">="], + ["operator", "=="], ["operator", "!="], ["operator", "==="], ["operator", "!=="], + ["operator", "==?"], ["operator", "!=?"], + ["operator", "&&"], ["operator", "||"], ["operator", "?"], + ["operator", "->"], ["operator", "<->"], + ["operator", "++"], ["operator", "--"], + ["operator", "+="], ["operator", "-="], ["operator", "/="], ["operator", "*="], + ["operator", "%="], ["operator", "&="], ["operator", "|="], ["operator", "^="], + ["operator", "<<="], ["operator", ">>="], ["operator", "<<<="], ["operator", ">>>="] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/verilog/string_feature.test b/package/src/prism/tests/languages/verilog/string_feature.test new file mode 100644 index 00000000..a582bc88 --- /dev/null +++ b/package/src/prism/tests/languages/verilog/string_feature.test @@ -0,0 +1,16 @@ +"" +"fo\"obar" +"foo\ +bar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"obar\""], + ["string", "\"foo\\\nbar\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vhdl/attribute_feature.test b/package/src/prism/tests/languages/vhdl/attribute_feature.test new file mode 100644 index 00000000..8bb5dae2 --- /dev/null +++ b/package/src/prism/tests/languages/vhdl/attribute_feature.test @@ -0,0 +1,25 @@ +T'BASE +T'IMAGE(X) +A'RANGE +A'RANGE(N) +A'REVERSE_RANGE +A'REVERSE_RANGE(N) +S'DELAYED(t) +E'INSTANCE_NAME + +---------------------------------------------------- + +[ + "T", ["attribute", "'BASE"], + "\nT", ["attribute", "'IMAGE"], ["punctuation", "("], "X", ["punctuation", ")"], + "\nA", ["attribute", "'RANGE"], + "\nA", ["attribute", "'RANGE"], ["punctuation", "("], "N", ["punctuation", ")"], + "\nA", ["attribute", "'REVERSE_RANGE"], + "\nA", ["attribute", "'REVERSE_RANGE"], ["punctuation", "("], "N", ["punctuation", ")"], + "\nS", ["attribute", "'DELAYED"], ["punctuation", "("], "t", ["punctuation", ")"], + "\nE", ["attribute", "'INSTANCE_NAME"] +] + +---------------------------------------------------- + +Checks for attributes. diff --git a/package/src/prism/tests/languages/vhdl/boolean_feature.test b/package/src/prism/tests/languages/vhdl/boolean_feature.test new file mode 100644 index 00000000..a40f8d95 --- /dev/null +++ b/package/src/prism/tests/languages/vhdl/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vhdl/comment_feature.test b/package/src/prism/tests/languages/vhdl/comment_feature.test new file mode 100644 index 00000000..eaca8704 --- /dev/null +++ b/package/src/prism/tests/languages/vhdl/comment_feature.test @@ -0,0 +1,13 @@ +-- Foo +--foobar + +---------------------------------------------------- + +[ + ["comment", "-- Foo"], + ["comment", "--foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vhdl/function_feature.test b/package/src/prism/tests/languages/vhdl/function_feature.test new file mode 100644 index 00000000..397f428a --- /dev/null +++ b/package/src/prism/tests/languages/vhdl/function_feature.test @@ -0,0 +1,29 @@ +Bit_vector(7 downto 0) +DataBus(7) +function BOOL_TO_SL(X : boolean) +function "*"(a : resistance; b : capacitance) + +---------------------------------------------------- + +[ + ["function", "Bit_vector"], + ["punctuation", "("], ["number", "7"], + ["keyword", "downto"], ["number", "0"], ["punctuation", ")"], + + ["function", "DataBus"], + ["punctuation", "("], ["number", "7"], ["punctuation", ")"], + + ["keyword", "function"], ["function", "BOOL_TO_SL"], + ["punctuation", "("], "X ", + ["punctuation", ":"], " boolean", ["punctuation", ")"], + + ["keyword", "function"], ["quoted-function", "\"*\""], + ["punctuation", "("], "a ", + ["punctuation", ":"], " resistance", + ["punctuation", ";"], " b ", + ["punctuation", ":"], " capacitance", ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for functions and operator overloading. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vhdl/keyword_feature.test b/package/src/prism/tests/languages/vhdl/keyword_feature.test new file mode 100644 index 00000000..a6f92436 --- /dev/null +++ b/package/src/prism/tests/languages/vhdl/keyword_feature.test @@ -0,0 +1,175 @@ +access +after +alias +all +architecture +array +assert +attribute +begin +block +body +buffer +bus +case +component +configuration +constant +disconnect +downto +else +elsif +end +entity +exit +file +for +function +generate +generic +group +guarded +if +impure +in +inertial +inout +is +label +library +linkage +literal +loop +map +new +next +null +of +on +open +others +out +package +port +postponed +private +procedure +process +pure +range +record +register +reject +report +return +select +severity +shared +signal +subtype +then +to +transport +type +unaffected +units +until +use +variable +view +wait +when +while +with + +---------------------------------------------------- + +[ + ["keyword", "access"], + ["keyword", "after"], + ["keyword", "alias"], + ["keyword", "all"], + ["keyword", "architecture"], + ["keyword", "array"], + ["keyword", "assert"], + ["keyword", "attribute"], + ["keyword", "begin"], + ["keyword", "block"], + ["keyword", "body"], + ["keyword", "buffer"], + ["keyword", "bus"], + ["keyword", "case"], + ["keyword", "component"], + ["keyword", "configuration"], + ["keyword", "constant"], + ["keyword", "disconnect"], + ["keyword", "downto"], + ["keyword", "else"], + ["keyword", "elsif"], + ["keyword", "end"], + ["keyword", "entity"], + ["keyword", "exit"], + ["keyword", "file"], + ["keyword", "for"], + ["keyword", "function"], + ["keyword", "generate"], + ["keyword", "generic"], + ["keyword", "group"], + ["keyword", "guarded"], + ["keyword", "if"], + ["keyword", "impure"], + ["keyword", "in"], + ["keyword", "inertial"], + ["keyword", "inout"], + ["keyword", "is"], + ["keyword", "label"], + ["keyword", "library"], + ["keyword", "linkage"], + ["keyword", "literal"], + ["keyword", "loop"], + ["keyword", "map"], + ["keyword", "new"], + ["keyword", "next"], + ["keyword", "null"], + ["keyword", "of"], + ["keyword", "on"], + ["keyword", "open"], + ["keyword", "others"], + ["keyword", "out"], + ["keyword", "package"], + ["keyword", "port"], + ["keyword", "postponed"], + ["keyword", "private"], + ["keyword", "procedure"], + ["keyword", "process"], + ["keyword", "pure"], + ["keyword", "range"], + ["keyword", "record"], + ["keyword", "register"], + ["keyword", "reject"], + ["keyword", "report"], + ["keyword", "return"], + ["keyword", "select"], + ["keyword", "severity"], + ["keyword", "shared"], + ["keyword", "signal"], + ["keyword", "subtype"], + ["keyword", "then"], + ["keyword", "to"], + ["keyword", "transport"], + ["keyword", "type"], + ["keyword", "unaffected"], + ["keyword", "units"], + ["keyword", "until"], + ["keyword", "use"], + ["keyword", "variable"], + ["keyword", "view"], + ["keyword", "wait"], + ["keyword", "when"], + ["keyword", "while"], + ["keyword", "with"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/vhdl/number_feature.test b/package/src/prism/tests/languages/vhdl/number_feature.test new file mode 100644 index 00000000..374a804b --- /dev/null +++ b/package/src/prism/tests/languages/vhdl/number_feature.test @@ -0,0 +1,37 @@ +'0' +'1' +'x' +'z' + +42 +42_000 +3.14159 +2.4E8 +3.0e-2 +7.54e+24 + +2#1010_1010# +16#BadFace# + +---------------------------------------------------- + +[ + ["number", "'0'"], + ["number", "'1'"], + ["number", "'x'"], + ["number", "'z'"], + + ["number", "42"], + ["number", "42_000"], + ["number", "3.14159"], + ["number", "2.4E8"], + ["number", "3.0e-2"], + ["number", "7.54e+24"], + + ["number", "2#1010_1010#"], + ["number", "16#BadFace#"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vhdl/operator_feature.test b/package/src/prism/tests/languages/vhdl/operator_feature.test new file mode 100644 index 00000000..ad7e0c5b --- /dev/null +++ b/package/src/prism/tests/languages/vhdl/operator_feature.test @@ -0,0 +1,29 @@ +> >= +< <= +:= ++ - +* / +& = +abs not mod rem +sll srl sla sra +rol ror and or +nand xnor xor nor + +---------------------------------------------------- + +[ + ["operator", ">"], ["operator", ">="], + ["operator", "<"], ["operator", "<="], + ["operator", ":="], + ["operator", "+"], ["operator", "-"], + ["operator", "*"], ["operator", "/"], + ["operator", "&"], ["operator", "="], + ["operator", "abs"], ["operator", "not"], ["operator", "mod"], ["operator", "rem"], + ["operator", "sll"], ["operator", "srl"], ["operator", "sla"], ["operator", "sra"], + ["operator", "rol"], ["operator", "ror"], ["operator", "and"], ["operator", "or"], + ["operator", "nand"], ["operator", "xnor"], ["operator", "xor"], ["operator", "nor"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vhdl/string_feature.test b/package/src/prism/tests/languages/vhdl/string_feature.test new file mode 100644 index 00000000..77d3ea28 --- /dev/null +++ b/package/src/prism/tests/languages/vhdl/string_feature.test @@ -0,0 +1,16 @@ +"" +"fo\"o" +"fo\"o\ +bar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"fo\\\"o\""], + ["string", "\"fo\\\"o\\\nbar\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vhdl/vhdl-vectors_feature.test b/package/src/prism/tests/languages/vhdl/vhdl-vectors_feature.test new file mode 100644 index 00000000..51702580 --- /dev/null +++ b/package/src/prism/tests/languages/vhdl/vhdl-vectors_feature.test @@ -0,0 +1,21 @@ +B"1111_1111" +O"353" +X"AA55" +"010101" +"Z" +"X" + +---------------------------------------------------- + +[ + ["vhdl-vectors", "B\"1111_1111\""], + ["vhdl-vectors", "O\"353\""], + ["vhdl-vectors", "X\"AA55\""], + ["vhdl-vectors", "\"010101\""], + ["vhdl-vectors", "\"Z\""], + ["vhdl-vectors", "\"X\""] +] + +---------------------------------------------------- + +Checks for vectors \ No newline at end of file diff --git a/package/src/prism/tests/languages/vim/builtin_feature.test b/package/src/prism/tests/languages/vim/builtin_feature.test new file mode 100644 index 00000000..518af1d6 --- /dev/null +++ b/package/src/prism/tests/languages/vim/builtin_feature.test @@ -0,0 +1,2289 @@ +autocmd +acd +ai +akm +aleph +allowrevins +altkeymap +ambiwidth +ambw +anti +antialias +arab +arabic +arabicshape +ari +arshape +autochdir +autoindent +autoread +autowrite +autowriteall +aw +awa +background +backspace +backup +backupcopy +backupdir +backupext +backupskip +balloondelay +ballooneval +balloonexpr +bdir +bdlay +beval +bex +bexpr +bg +bh +bin +binary +biosk +bioskey +bk +bkc +bomb +breakat +brk +browsedir +bs +bsdir +bsk +bt +bufhidden +buflisted +buftype +casemap +ccv +cdpath +cedit +cfu +ch +charconvert +ci +cin +cindent +cink +cinkeys +cino +cinoptions +cinw +cinwords +clipboard +cmdheight +cmdwinheight +cmp +cms +columns +com +comments +commentstring +compatible +complete +completefunc +completeopt +consk +conskey +copyindent +cot +cpo +cpoptions +cpt +cscopepathcomp +cscopeprg +cscopequickfix +cscopetag +cscopetagorder +cscopeverbose +cspc +csprg +csqf +cst +csto +csverb +cuc +cul +cursorcolumn +cursorline +cwh +debug +deco +def +define +delcombine +dex +dg +dict +dictionary +diff +diffexpr +diffopt +digraph +dip +dir +directory +dy +ea +ead +eadirection +eb +ed +edcompatible +ef +efm +ei +ek +enc +encoding +endofline +eol +ep +equalalways +equalprg +errorbells +errorfile +errorformat +esckeys +et +eventignore +expandtab +exrc +fcl +fcs +fdc +fde +fdi +fdl +fdls +fdm +fdn +fdo +fdt +fen +fenc +fencs +fex +ff +ffs +fileencoding +fileencodings +fileformat +fileformats +fillchars +fk +fkmap +flp +fml +fmr +foldcolumn +foldenable +foldexpr +foldignore +foldlevel +foldlevelstart +foldmarker +foldmethod +foldminlines +foldnestmax +foldtext +formatexpr +formatlistpat +formatoptions +formatprg +fp +fs +fsync +ft +gcr +gd +gdefault +gfm +gfn +gfs +gfw +ghr +gp +grepformat +grepprg +gtl +gtt +guicursor +guifont +guifontset +guifontwide +guiheadroom +guioptions +guipty +guitablabel +guitabtooltip +helpfile +helpheight +helplang +hf +hh +hi +hidden +highlight +hk +hkmap +hkmapp +hkp +hl +hlg +hls +hlsearch +ic +icon +iconstring +ignorecase +im +imactivatekey +imak +imc +imcmdline +imd +imdisable +imi +iminsert +ims +imsearch +inc +include +includeexpr +incsearch +inde +indentexpr +indentkeys +indk +inex +inf +infercase +insertmode +isf +isfname +isi +isident +isk +iskeyword +isprint +joinspaces +js +key +keymap +keymodel +keywordprg +km +kmp +kp +langmap +langmenu +laststatus +lazyredraw +lbr +lcs +linebreak +lines +linespace +lisp +lispwords +listchars +loadplugins +lpl +lsp +lz +macatsui +magic +makeef +makeprg +matchpairs +matchtime +maxcombine +maxfuncdepth +maxmapdepth +maxmem +maxmempattern +maxmemtot +mco +mef +menuitems +mfd +mh +mis +mkspellmem +ml +mls +mm +mmd +mmp +mmt +modeline +modelines +modifiable +modified +more +mouse +mousef +mousefocus +mousehide +mousem +mousemodel +mouses +mouseshape +mouset +mousetime +mp +mps +msm +mzq +mzquantum +nf +nrformats +numberwidth +nuw +odev +oft +ofu +omnifunc +opendevice +operatorfunc +opfunc +osfiletype +pa +para +paragraphs +paste +pastetoggle +patchexpr +patchmode +path +pdev +penc +pex +pexpr +pfn +ph +pheader +pi +pm +pmbcs +pmbfn +popt +preserveindent +previewheight +previewwindow +printdevice +printencoding +printexpr +printfont +printheader +printmbcharset +printmbfont +printoptions +prompt +pt +pumheight +pvh +pvw +qe +quoteescape +readonly +remap +report +restorescreen +revins +rightleft +rightleftcmd +rl +rlc +ro +rs +rtp +ruf +ruler +rulerformat +runtimepath +sbo +sc +scb +scr +scroll +scrollbind +scrolljump +scrolloff +scrollopt +scs +sect +sections +secure +sel +selection +selectmode +sessionoptions +sft +shcf +shellcmdflag +shellpipe +shellquote +shellredir +shellslash +shelltemp +shelltype +shellxquote +shiftround +shiftwidth +shm +shortmess +shortname +showbreak +showcmd +showfulltag +showmatch +showmode +showtabline +shq +si +sidescroll +sidescrolloff +siso +sj +slm +smartcase +smartindent +smarttab +smc +smd +softtabstop +sol +spc +spell +spellcapcheck +spellfile +spelllang +spellsuggest +spf +spl +splitbelow +splitright +sps +sr +srr +ss +ssl +ssop +stal +startofline +statusline +stl +stmp +su +sua +suffixes +suffixesadd +sw +swapfile +swapsync +swb +swf +switchbuf +sws +sxq +syn +synmaxcol +syntax +tabline +tabpagemax +tabstop +tagbsearch +taglength +tagrelative +tagstack +tal +tb +tbi +tbidi +tbis +tbs +tenc +term +termbidi +termencoding +terse +textauto +textmode +textwidth +tgst +thesaurus +tildeop +timeout +timeoutlen +title +titlelen +titleold +titlestring +toolbar +toolbariconsize +top +tpm +tsl +tsr +ttimeout +ttimeoutlen +ttm +tty +ttybuiltin +ttyfast +ttym +ttymouse +ttyscroll +ttytype +tw +tx +uc +ul +undolevels +updatecount +updatetime +ut +vb +vbs +vdir +verbosefile +vfile +viewdir +viewoptions +viminfo +virtualedit +visualbell +vop +wak +warn +wb +wc +wcm +wd +weirdinvert +wfh +wfw +whichwrap +wi +wig +wildchar +wildcharm +wildignore +wildmenu +wildmode +wildoptions +wim +winaltkeys +window +winfixheight +winfixwidth +winheight +winminheight +winminwidth +winwidth +wiv +wiw +wm +wmh +wmnu +wmw +wop +wrap +wrapmargin +wrapscan +writeany +writebackup +writedelay +ww +noacd +noai +noakm +noallowrevins +noaltkeymap +noanti +noantialias +noar +noarab +noarabic +noarabicshape +noari +noarshape +noautochdir +noautoindent +noautoread +noautowrite +noautowriteall +noaw +noawa +nobackup +noballooneval +nobeval +nobin +nobinary +nobiosk +nobioskey +nobk +nobl +nobomb +nobuflisted +nocf +noci +nocin +nocindent +nocompatible +noconfirm +noconsk +noconskey +nocopyindent +nocp +nocscopetag +nocscopeverbose +nocst +nocsverb +nocuc +nocul +nocursorcolumn +nocursorline +nodeco +nodelcombine +nodg +nodiff +nodigraph +nodisable +noea +noeb +noed +noedcompatible +noek +noendofline +noeol +noequalalways +noerrorbells +noesckeys +noet +noex +noexpandtab +noexrc +nofen +nofk +nofkmap +nofoldenable +nogd +nogdefault +noguipty +nohid +nohidden +nohk +nohkmap +nohkmapp +nohkp +nohls +noic +noicon +noignorecase +noim +noimc +noimcmdline +noimd +noincsearch +noinf +noinfercase +noinsertmode +nois +nojoinspaces +nojs +nolazyredraw +nolbr +nolinebreak +nolisp +nolist +noloadplugins +nolpl +nolz +noma +nomacatsui +nomagic +nomh +noml +nomod +nomodeline +nomodifiable +nomodified +nomore +nomousef +nomousefocus +nomousehide +nonu +nonumber +noodev +noopendevice +nopaste +nopi +nopreserveindent +nopreviewwindow +noprompt +nopvw +noreadonly +noremap +norestorescreen +norevins +nori +norightleft +norightleftcmd +norl +norlc +noro +nors +noru +noruler +nosb +nosc +noscb +noscrollbind +noscs +nosecure +nosft +noshellslash +noshelltemp +noshiftround +noshortname +noshowcmd +noshowfulltag +noshowmatch +noshowmode +nosi +nosm +nosmartcase +nosmartindent +nosmarttab +nosmd +nosn +nosol +nospell +nosplitbelow +nosplitright +nospr +nosr +nossl +nosta +nostartofline +nostmp +noswapfile +noswf +nota +notagbsearch +notagrelative +notagstack +notbi +notbidi +notbs +notermbidi +noterse +notextauto +notextmode +notf +notgst +notildeop +notimeout +notitle +noto +notop +notr +nottimeout +nottybuiltin +nottyfast +notx +novb +novisualbell +nowa +nowarn +nowb +noweirdinvert +nowfh +nowfw +nowildmenu +nowinfixheight +nowinfixwidth +nowiv +nowmnu +nowrap +nowrapscan +nowrite +nowriteany +nowritebackup +nows +invacd +invai +invakm +invallowrevins +invaltkeymap +invanti +invantialias +invar +invarab +invarabic +invarabicshape +invari +invarshape +invautochdir +invautoindent +invautoread +invautowrite +invautowriteall +invaw +invawa +invbackup +invballooneval +invbeval +invbin +invbinary +invbiosk +invbioskey +invbk +invbl +invbomb +invbuflisted +invcf +invci +invcin +invcindent +invcompatible +invconfirm +invconsk +invconskey +invcopyindent +invcp +invcscopetag +invcscopeverbose +invcst +invcsverb +invcuc +invcul +invcursorcolumn +invcursorline +invdeco +invdelcombine +invdg +invdiff +invdigraph +invdisable +invea +inveb +inved +invedcompatible +invek +invendofline +inveol +invequalalways +inverrorbells +invesckeys +invet +invex +invexpandtab +invexrc +invfen +invfk +invfkmap +invfoldenable +invgd +invgdefault +invguipty +invhid +invhidden +invhk +invhkmap +invhkmapp +invhkp +invhls +invhlsearch +invic +invicon +invignorecase +invim +invimc +invimcmdline +invimd +invincsearch +invinf +invinfercase +invinsertmode +invis +invjoinspaces +invjs +invlazyredraw +invlbr +invlinebreak +invlisp +invlist +invloadplugins +invlpl +invlz +invma +invmacatsui +invmagic +invmh +invml +invmod +invmodeline +invmodifiable +invmodified +invmore +invmousef +invmousefocus +invmousehide +invnu +invnumber +invodev +invopendevice +invpaste +invpi +invpreserveindent +invpreviewwindow +invprompt +invpvw +invreadonly +invremap +invrestorescreen +invrevins +invri +invrightleft +invrightleftcmd +invrl +invrlc +invro +invrs +invru +invruler +invsb +invsc +invscb +invscrollbind +invscs +invsecure +invsft +invshellslash +invshelltemp +invshiftround +invshortname +invshowcmd +invshowfulltag +invshowmatch +invshowmode +invsi +invsm +invsmartcase +invsmartindent +invsmarttab +invsmd +invsn +invsol +invspell +invsplitbelow +invsplitright +invspr +invsr +invssl +invsta +invstartofline +invstmp +invswapfile +invswf +invta +invtagbsearch +invtagrelative +invtagstack +invtbi +invtbidi +invtbs +invtermbidi +invterse +invtextauto +invtextmode +invtf +invtgst +invtildeop +invtimeout +invtitle +invto +invtop +invtr +invttimeout +invttybuiltin +invttyfast +invtx +invvb +invvisualbell +invwa +invwarn +invwb +invweirdinvert +invwfh +invwfw +invwildmenu +invwinfixheight +invwinfixwidth +invwiv +invwmnu +invwrap +invwrapscan +invwrite +invwriteany +invwritebackup +invws +t_AB +t_AF +t_al +t_AL +t_bc +t_cd +t_ce +t_Ce +t_cl +t_cm +t_Co +t_cs +t_Cs +t_CS +t_CV +t_da +t_db +t_dl +t_DL +t_EI +t_F1 +t_F2 +t_F3 +t_F4 +t_F5 +t_F6 +t_F7 +t_F8 +t_F9 +t_fs +t_IE +t_IS +t_k1 +t_K1 +t_k2 +t_k3 +t_K3 +t_k4 +t_K4 +t_k5 +t_K5 +t_k6 +t_K6 +t_k7 +t_K7 +t_k8 +t_K8 +t_k9 +t_K9 +t_KA +t_kb +t_kB +t_KB +t_KC +t_kd +t_kD +t_KD +t_ke +t_KE +t_KF +t_KG +t_kh +t_KH +t_kI +t_KI +t_KJ +t_KK +t_kl +t_KL +t_kN +t_kP +t_kr +t_ks +t_ku +t_le +t_mb +t_md +t_me +t_mr +t_ms +t_nd +t_op +t_RI +t_RV +t_Sb +t_se +t_Sf +t_SI +t_so +t_sr +t_te +t_ti +t_ts +t_ue +t_us +t_ut +t_vb +t_ve +t_vi +t_vs +t_WP +t_WS +t_xs +t_ZH +t_ZR + +---------------------------------------------------- + +[ + ["builtin", "autocmd"], + ["builtin", "acd"], + ["builtin", "ai"], + ["builtin", "akm"], + ["builtin", "aleph"], + ["builtin", "allowrevins"], + ["builtin", "altkeymap"], + ["builtin", "ambiwidth"], + ["builtin", "ambw"], + ["builtin", "anti"], + ["builtin", "antialias"], + ["builtin", "arab"], + ["builtin", "arabic"], + ["builtin", "arabicshape"], + ["builtin", "ari"], + ["builtin", "arshape"], + ["builtin", "autochdir"], + ["builtin", "autoindent"], + ["builtin", "autoread"], + ["builtin", "autowrite"], + ["builtin", "autowriteall"], + ["builtin", "aw"], + ["builtin", "awa"], + ["builtin", "background"], + ["builtin", "backspace"], + ["builtin", "backup"], + ["builtin", "backupcopy"], + ["builtin", "backupdir"], + ["builtin", "backupext"], + ["builtin", "backupskip"], + ["builtin", "balloondelay"], + ["builtin", "ballooneval"], + ["builtin", "balloonexpr"], + ["builtin", "bdir"], + ["builtin", "bdlay"], + ["builtin", "beval"], + ["builtin", "bex"], + ["builtin", "bexpr"], + ["builtin", "bg"], + ["builtin", "bh"], + ["builtin", "bin"], + ["builtin", "binary"], + ["builtin", "biosk"], + ["builtin", "bioskey"], + ["builtin", "bk"], + ["builtin", "bkc"], + ["builtin", "bomb"], + ["builtin", "breakat"], + ["builtin", "brk"], + ["builtin", "browsedir"], + ["builtin", "bs"], + ["builtin", "bsdir"], + ["builtin", "bsk"], + ["builtin", "bt"], + ["builtin", "bufhidden"], + ["builtin", "buflisted"], + ["builtin", "buftype"], + ["builtin", "casemap"], + ["builtin", "ccv"], + ["builtin", "cdpath"], + ["builtin", "cedit"], + ["builtin", "cfu"], + ["builtin", "ch"], + ["builtin", "charconvert"], + ["builtin", "ci"], + ["builtin", "cin"], + ["builtin", "cindent"], + ["builtin", "cink"], + ["builtin", "cinkeys"], + ["builtin", "cino"], + ["builtin", "cinoptions"], + ["builtin", "cinw"], + ["builtin", "cinwords"], + ["builtin", "clipboard"], + ["builtin", "cmdheight"], + ["builtin", "cmdwinheight"], + ["builtin", "cmp"], + ["builtin", "cms"], + ["builtin", "columns"], + ["builtin", "com"], + ["builtin", "comments"], + ["builtin", "commentstring"], + ["builtin", "compatible"], + ["builtin", "complete"], + ["builtin", "completefunc"], + ["builtin", "completeopt"], + ["builtin", "consk"], + ["builtin", "conskey"], + ["builtin", "copyindent"], + ["builtin", "cot"], + ["builtin", "cpo"], + ["builtin", "cpoptions"], + ["builtin", "cpt"], + ["builtin", "cscopepathcomp"], + ["builtin", "cscopeprg"], + ["builtin", "cscopequickfix"], + ["builtin", "cscopetag"], + ["builtin", "cscopetagorder"], + ["builtin", "cscopeverbose"], + ["builtin", "cspc"], + ["builtin", "csprg"], + ["builtin", "csqf"], + ["builtin", "cst"], + ["builtin", "csto"], + ["builtin", "csverb"], + ["builtin", "cuc"], + ["builtin", "cul"], + ["builtin", "cursorcolumn"], + ["builtin", "cursorline"], + ["builtin", "cwh"], + ["builtin", "debug"], + ["builtin", "deco"], + ["builtin", "def"], + ["builtin", "define"], + ["builtin", "delcombine"], + ["builtin", "dex"], + ["builtin", "dg"], + ["builtin", "dict"], + ["builtin", "dictionary"], + ["builtin", "diff"], + ["builtin", "diffexpr"], + ["builtin", "diffopt"], + ["builtin", "digraph"], + ["builtin", "dip"], + ["builtin", "dir"], + ["builtin", "directory"], + ["builtin", "dy"], + ["builtin", "ea"], + ["builtin", "ead"], + ["builtin", "eadirection"], + ["builtin", "eb"], + ["builtin", "ed"], + ["builtin", "edcompatible"], + ["builtin", "ef"], + ["builtin", "efm"], + ["builtin", "ei"], + ["builtin", "ek"], + ["builtin", "enc"], + ["builtin", "encoding"], + ["builtin", "endofline"], + ["builtin", "eol"], + ["builtin", "ep"], + ["builtin", "equalalways"], + ["builtin", "equalprg"], + ["builtin", "errorbells"], + ["builtin", "errorfile"], + ["builtin", "errorformat"], + ["builtin", "esckeys"], + ["builtin", "et"], + ["builtin", "eventignore"], + ["builtin", "expandtab"], + ["builtin", "exrc"], + ["builtin", "fcl"], + ["builtin", "fcs"], + ["builtin", "fdc"], + ["builtin", "fde"], + ["builtin", "fdi"], + ["builtin", "fdl"], + ["builtin", "fdls"], + ["builtin", "fdm"], + ["builtin", "fdn"], + ["builtin", "fdo"], + ["builtin", "fdt"], + ["builtin", "fen"], + ["builtin", "fenc"], + ["builtin", "fencs"], + ["builtin", "fex"], + ["builtin", "ff"], + ["builtin", "ffs"], + ["builtin", "fileencoding"], + ["builtin", "fileencodings"], + ["builtin", "fileformat"], + ["builtin", "fileformats"], + ["builtin", "fillchars"], + ["builtin", "fk"], + ["builtin", "fkmap"], + ["builtin", "flp"], + ["builtin", "fml"], + ["builtin", "fmr"], + ["builtin", "foldcolumn"], + ["builtin", "foldenable"], + ["builtin", "foldexpr"], + ["builtin", "foldignore"], + ["builtin", "foldlevel"], + ["builtin", "foldlevelstart"], + ["builtin", "foldmarker"], + ["builtin", "foldmethod"], + ["builtin", "foldminlines"], + ["builtin", "foldnestmax"], + ["builtin", "foldtext"], + ["builtin", "formatexpr"], + ["builtin", "formatlistpat"], + ["builtin", "formatoptions"], + ["builtin", "formatprg"], + ["builtin", "fp"], + ["builtin", "fs"], + ["builtin", "fsync"], + ["builtin", "ft"], + ["builtin", "gcr"], + ["builtin", "gd"], + ["builtin", "gdefault"], + ["builtin", "gfm"], + ["builtin", "gfn"], + ["builtin", "gfs"], + ["builtin", "gfw"], + ["builtin", "ghr"], + ["builtin", "gp"], + ["builtin", "grepformat"], + ["builtin", "grepprg"], + ["builtin", "gtl"], + ["builtin", "gtt"], + ["builtin", "guicursor"], + ["builtin", "guifont"], + ["builtin", "guifontset"], + ["builtin", "guifontwide"], + ["builtin", "guiheadroom"], + ["builtin", "guioptions"], + ["builtin", "guipty"], + ["builtin", "guitablabel"], + ["builtin", "guitabtooltip"], + ["builtin", "helpfile"], + ["builtin", "helpheight"], + ["builtin", "helplang"], + ["builtin", "hf"], + ["builtin", "hh"], + ["builtin", "hi"], + ["builtin", "hidden"], + ["builtin", "highlight"], + ["builtin", "hk"], + ["builtin", "hkmap"], + ["builtin", "hkmapp"], + ["builtin", "hkp"], + ["builtin", "hl"], + ["builtin", "hlg"], + ["builtin", "hls"], + ["builtin", "hlsearch"], + ["builtin", "ic"], + ["builtin", "icon"], + ["builtin", "iconstring"], + ["builtin", "ignorecase"], + ["builtin", "im"], + ["builtin", "imactivatekey"], + ["builtin", "imak"], + ["builtin", "imc"], + ["builtin", "imcmdline"], + ["builtin", "imd"], + ["builtin", "imdisable"], + ["builtin", "imi"], + ["builtin", "iminsert"], + ["builtin", "ims"], + ["builtin", "imsearch"], + ["builtin", "inc"], + ["builtin", "include"], + ["builtin", "includeexpr"], + ["builtin", "incsearch"], + ["builtin", "inde"], + ["builtin", "indentexpr"], + ["builtin", "indentkeys"], + ["builtin", "indk"], + ["builtin", "inex"], + ["builtin", "inf"], + ["builtin", "infercase"], + ["builtin", "insertmode"], + ["builtin", "isf"], + ["builtin", "isfname"], + ["builtin", "isi"], + ["builtin", "isident"], + ["builtin", "isk"], + ["builtin", "iskeyword"], + ["builtin", "isprint"], + ["builtin", "joinspaces"], + ["builtin", "js"], + ["builtin", "key"], + ["builtin", "keymap"], + ["builtin", "keymodel"], + ["builtin", "keywordprg"], + ["builtin", "km"], + ["builtin", "kmp"], + ["builtin", "kp"], + ["builtin", "langmap"], + ["builtin", "langmenu"], + ["builtin", "laststatus"], + ["builtin", "lazyredraw"], + ["builtin", "lbr"], + ["builtin", "lcs"], + ["builtin", "linebreak"], + ["builtin", "lines"], + ["builtin", "linespace"], + ["builtin", "lisp"], + ["builtin", "lispwords"], + ["builtin", "listchars"], + ["builtin", "loadplugins"], + ["builtin", "lpl"], + ["builtin", "lsp"], + ["builtin", "lz"], + ["builtin", "macatsui"], + ["builtin", "magic"], + ["builtin", "makeef"], + ["builtin", "makeprg"], + ["builtin", "matchpairs"], + ["builtin", "matchtime"], + ["builtin", "maxcombine"], + ["builtin", "maxfuncdepth"], + ["builtin", "maxmapdepth"], + ["builtin", "maxmem"], + ["builtin", "maxmempattern"], + ["builtin", "maxmemtot"], + ["builtin", "mco"], + ["builtin", "mef"], + ["builtin", "menuitems"], + ["builtin", "mfd"], + ["builtin", "mh"], + ["builtin", "mis"], + ["builtin", "mkspellmem"], + ["builtin", "ml"], + ["builtin", "mls"], + ["builtin", "mm"], + ["builtin", "mmd"], + ["builtin", "mmp"], + ["builtin", "mmt"], + ["builtin", "modeline"], + ["builtin", "modelines"], + ["builtin", "modifiable"], + ["builtin", "modified"], + ["builtin", "more"], + ["builtin", "mouse"], + ["builtin", "mousef"], + ["builtin", "mousefocus"], + ["builtin", "mousehide"], + ["builtin", "mousem"], + ["builtin", "mousemodel"], + ["builtin", "mouses"], + ["builtin", "mouseshape"], + ["builtin", "mouset"], + ["builtin", "mousetime"], + ["builtin", "mp"], + ["builtin", "mps"], + ["builtin", "msm"], + ["builtin", "mzq"], + ["builtin", "mzquantum"], + ["builtin", "nf"], + ["builtin", "nrformats"], + ["builtin", "numberwidth"], + ["builtin", "nuw"], + ["builtin", "odev"], + ["builtin", "oft"], + ["builtin", "ofu"], + ["builtin", "omnifunc"], + ["builtin", "opendevice"], + ["builtin", "operatorfunc"], + ["builtin", "opfunc"], + ["builtin", "osfiletype"], + ["builtin", "pa"], + ["builtin", "para"], + ["builtin", "paragraphs"], + ["builtin", "paste"], + ["builtin", "pastetoggle"], + ["builtin", "patchexpr"], + ["builtin", "patchmode"], + ["builtin", "path"], + ["builtin", "pdev"], + ["builtin", "penc"], + ["builtin", "pex"], + ["builtin", "pexpr"], + ["builtin", "pfn"], + ["builtin", "ph"], + ["builtin", "pheader"], + ["builtin", "pi"], + ["builtin", "pm"], + ["builtin", "pmbcs"], + ["builtin", "pmbfn"], + ["builtin", "popt"], + ["builtin", "preserveindent"], + ["builtin", "previewheight"], + ["builtin", "previewwindow"], + ["builtin", "printdevice"], + ["builtin", "printencoding"], + ["builtin", "printexpr"], + ["builtin", "printfont"], + ["builtin", "printheader"], + ["builtin", "printmbcharset"], + ["builtin", "printmbfont"], + ["builtin", "printoptions"], + ["builtin", "prompt"], + ["builtin", "pt"], + ["builtin", "pumheight"], + ["builtin", "pvh"], + ["builtin", "pvw"], + ["builtin", "qe"], + ["builtin", "quoteescape"], + ["builtin", "readonly"], + ["builtin", "remap"], + ["builtin", "report"], + ["builtin", "restorescreen"], + ["builtin", "revins"], + ["builtin", "rightleft"], + ["builtin", "rightleftcmd"], + ["builtin", "rl"], + ["builtin", "rlc"], + ["builtin", "ro"], + ["builtin", "rs"], + ["builtin", "rtp"], + ["builtin", "ruf"], + ["builtin", "ruler"], + ["builtin", "rulerformat"], + ["builtin", "runtimepath"], + ["builtin", "sbo"], + ["builtin", "sc"], + ["builtin", "scb"], + ["builtin", "scr"], + ["builtin", "scroll"], + ["builtin", "scrollbind"], + ["builtin", "scrolljump"], + ["builtin", "scrolloff"], + ["builtin", "scrollopt"], + ["builtin", "scs"], + ["builtin", "sect"], + ["builtin", "sections"], + ["builtin", "secure"], + ["builtin", "sel"], + ["builtin", "selection"], + ["builtin", "selectmode"], + ["builtin", "sessionoptions"], + ["builtin", "sft"], + ["builtin", "shcf"], + ["builtin", "shellcmdflag"], + ["builtin", "shellpipe"], + ["builtin", "shellquote"], + ["builtin", "shellredir"], + ["builtin", "shellslash"], + ["builtin", "shelltemp"], + ["builtin", "shelltype"], + ["builtin", "shellxquote"], + ["builtin", "shiftround"], + ["builtin", "shiftwidth"], + ["builtin", "shm"], + ["builtin", "shortmess"], + ["builtin", "shortname"], + ["builtin", "showbreak"], + ["builtin", "showcmd"], + ["builtin", "showfulltag"], + ["builtin", "showmatch"], + ["builtin", "showmode"], + ["builtin", "showtabline"], + ["builtin", "shq"], + ["builtin", "si"], + ["builtin", "sidescroll"], + ["builtin", "sidescrolloff"], + ["builtin", "siso"], + ["builtin", "sj"], + ["builtin", "slm"], + ["builtin", "smartcase"], + ["builtin", "smartindent"], + ["builtin", "smarttab"], + ["builtin", "smc"], + ["builtin", "smd"], + ["builtin", "softtabstop"], + ["builtin", "sol"], + ["builtin", "spc"], + ["builtin", "spell"], + ["builtin", "spellcapcheck"], + ["builtin", "spellfile"], + ["builtin", "spelllang"], + ["builtin", "spellsuggest"], + ["builtin", "spf"], + ["builtin", "spl"], + ["builtin", "splitbelow"], + ["builtin", "splitright"], + ["builtin", "sps"], + ["builtin", "sr"], + ["builtin", "srr"], + ["builtin", "ss"], + ["builtin", "ssl"], + ["builtin", "ssop"], + ["builtin", "stal"], + ["builtin", "startofline"], + ["builtin", "statusline"], + ["builtin", "stl"], + ["builtin", "stmp"], + ["builtin", "su"], + ["builtin", "sua"], + ["builtin", "suffixes"], + ["builtin", "suffixesadd"], + ["builtin", "sw"], + ["builtin", "swapfile"], + ["builtin", "swapsync"], + ["builtin", "swb"], + ["builtin", "swf"], + ["builtin", "switchbuf"], + ["builtin", "sws"], + ["builtin", "sxq"], + ["builtin", "syn"], + ["builtin", "synmaxcol"], + ["builtin", "syntax"], + ["builtin", "tabline"], + ["builtin", "tabpagemax"], + ["builtin", "tabstop"], + ["builtin", "tagbsearch"], + ["builtin", "taglength"], + ["builtin", "tagrelative"], + ["builtin", "tagstack"], + ["builtin", "tal"], + ["builtin", "tb"], + ["builtin", "tbi"], + ["builtin", "tbidi"], + ["builtin", "tbis"], + ["builtin", "tbs"], + ["builtin", "tenc"], + ["builtin", "term"], + ["builtin", "termbidi"], + ["builtin", "termencoding"], + ["builtin", "terse"], + ["builtin", "textauto"], + ["builtin", "textmode"], + ["builtin", "textwidth"], + ["builtin", "tgst"], + ["builtin", "thesaurus"], + ["builtin", "tildeop"], + ["builtin", "timeout"], + ["builtin", "timeoutlen"], + ["builtin", "title"], + ["builtin", "titlelen"], + ["builtin", "titleold"], + ["builtin", "titlestring"], + ["builtin", "toolbar"], + ["builtin", "toolbariconsize"], + ["builtin", "top"], + ["builtin", "tpm"], + ["builtin", "tsl"], + ["builtin", "tsr"], + ["builtin", "ttimeout"], + ["builtin", "ttimeoutlen"], + ["builtin", "ttm"], + ["builtin", "tty"], + ["builtin", "ttybuiltin"], + ["builtin", "ttyfast"], + ["builtin", "ttym"], + ["builtin", "ttymouse"], + ["builtin", "ttyscroll"], + ["builtin", "ttytype"], + ["builtin", "tw"], + ["builtin", "tx"], + ["builtin", "uc"], + ["builtin", "ul"], + ["builtin", "undolevels"], + ["builtin", "updatecount"], + ["builtin", "updatetime"], + ["builtin", "ut"], + ["builtin", "vb"], + ["builtin", "vbs"], + ["builtin", "vdir"], + ["builtin", "verbosefile"], + ["builtin", "vfile"], + ["builtin", "viewdir"], + ["builtin", "viewoptions"], + ["builtin", "viminfo"], + ["builtin", "virtualedit"], + ["builtin", "visualbell"], + ["builtin", "vop"], + ["builtin", "wak"], + ["builtin", "warn"], + ["builtin", "wb"], + ["builtin", "wc"], + ["builtin", "wcm"], + ["builtin", "wd"], + ["builtin", "weirdinvert"], + ["builtin", "wfh"], + ["builtin", "wfw"], + ["builtin", "whichwrap"], + ["builtin", "wi"], + ["builtin", "wig"], + ["builtin", "wildchar"], + ["builtin", "wildcharm"], + ["builtin", "wildignore"], + ["builtin", "wildmenu"], + ["builtin", "wildmode"], + ["builtin", "wildoptions"], + ["builtin", "wim"], + ["builtin", "winaltkeys"], + ["builtin", "window"], + ["builtin", "winfixheight"], + ["builtin", "winfixwidth"], + ["builtin", "winheight"], + ["builtin", "winminheight"], + ["builtin", "winminwidth"], + ["builtin", "winwidth"], + ["builtin", "wiv"], + ["builtin", "wiw"], + ["builtin", "wm"], + ["builtin", "wmh"], + ["builtin", "wmnu"], + ["builtin", "wmw"], + ["builtin", "wop"], + ["builtin", "wrap"], + ["builtin", "wrapmargin"], + ["builtin", "wrapscan"], + ["builtin", "writeany"], + ["builtin", "writebackup"], + ["builtin", "writedelay"], + ["builtin", "ww"], + ["builtin", "noacd"], + ["builtin", "noai"], + ["builtin", "noakm"], + ["builtin", "noallowrevins"], + ["builtin", "noaltkeymap"], + ["builtin", "noanti"], + ["builtin", "noantialias"], + ["builtin", "noar"], + ["builtin", "noarab"], + ["builtin", "noarabic"], + ["builtin", "noarabicshape"], + ["builtin", "noari"], + ["builtin", "noarshape"], + ["builtin", "noautochdir"], + ["builtin", "noautoindent"], + ["builtin", "noautoread"], + ["builtin", "noautowrite"], + ["builtin", "noautowriteall"], + ["builtin", "noaw"], + ["builtin", "noawa"], + ["builtin", "nobackup"], + ["builtin", "noballooneval"], + ["builtin", "nobeval"], + ["builtin", "nobin"], + ["builtin", "nobinary"], + ["builtin", "nobiosk"], + ["builtin", "nobioskey"], + ["builtin", "nobk"], + ["builtin", "nobl"], + ["builtin", "nobomb"], + ["builtin", "nobuflisted"], + ["builtin", "nocf"], + ["builtin", "noci"], + ["builtin", "nocin"], + ["builtin", "nocindent"], + ["builtin", "nocompatible"], + ["builtin", "noconfirm"], + ["builtin", "noconsk"], + ["builtin", "noconskey"], + ["builtin", "nocopyindent"], + ["builtin", "nocp"], + ["builtin", "nocscopetag"], + ["builtin", "nocscopeverbose"], + ["builtin", "nocst"], + ["builtin", "nocsverb"], + ["builtin", "nocuc"], + ["builtin", "nocul"], + ["builtin", "nocursorcolumn"], + ["builtin", "nocursorline"], + ["builtin", "nodeco"], + ["builtin", "nodelcombine"], + ["builtin", "nodg"], + ["builtin", "nodiff"], + ["builtin", "nodigraph"], + ["builtin", "nodisable"], + ["builtin", "noea"], + ["builtin", "noeb"], + ["builtin", "noed"], + ["builtin", "noedcompatible"], + ["builtin", "noek"], + ["builtin", "noendofline"], + ["builtin", "noeol"], + ["builtin", "noequalalways"], + ["builtin", "noerrorbells"], + ["builtin", "noesckeys"], + ["builtin", "noet"], + ["builtin", "noex"], + ["builtin", "noexpandtab"], + ["builtin", "noexrc"], + ["builtin", "nofen"], + ["builtin", "nofk"], + ["builtin", "nofkmap"], + ["builtin", "nofoldenable"], + ["builtin", "nogd"], + ["builtin", "nogdefault"], + ["builtin", "noguipty"], + ["builtin", "nohid"], + ["builtin", "nohidden"], + ["builtin", "nohk"], + ["builtin", "nohkmap"], + ["builtin", "nohkmapp"], + ["builtin", "nohkp"], + ["builtin", "nohls"], + ["builtin", "noic"], + ["builtin", "noicon"], + ["builtin", "noignorecase"], + ["builtin", "noim"], + ["builtin", "noimc"], + ["builtin", "noimcmdline"], + ["builtin", "noimd"], + ["builtin", "noincsearch"], + ["builtin", "noinf"], + ["builtin", "noinfercase"], + ["builtin", "noinsertmode"], + ["builtin", "nois"], + ["builtin", "nojoinspaces"], + ["builtin", "nojs"], + ["builtin", "nolazyredraw"], + ["builtin", "nolbr"], + ["builtin", "nolinebreak"], + ["builtin", "nolisp"], + ["builtin", "nolist"], + ["builtin", "noloadplugins"], + ["builtin", "nolpl"], + ["builtin", "nolz"], + ["builtin", "noma"], + ["builtin", "nomacatsui"], + ["builtin", "nomagic"], + ["builtin", "nomh"], + ["builtin", "noml"], + ["builtin", "nomod"], + ["builtin", "nomodeline"], + ["builtin", "nomodifiable"], + ["builtin", "nomodified"], + ["builtin", "nomore"], + ["builtin", "nomousef"], + ["builtin", "nomousefocus"], + ["builtin", "nomousehide"], + ["builtin", "nonu"], + ["builtin", "nonumber"], + ["builtin", "noodev"], + ["builtin", "noopendevice"], + ["builtin", "nopaste"], + ["builtin", "nopi"], + ["builtin", "nopreserveindent"], + ["builtin", "nopreviewwindow"], + ["builtin", "noprompt"], + ["builtin", "nopvw"], + ["builtin", "noreadonly"], + ["builtin", "noremap"], + ["builtin", "norestorescreen"], + ["builtin", "norevins"], + ["builtin", "nori"], + ["builtin", "norightleft"], + ["builtin", "norightleftcmd"], + ["builtin", "norl"], + ["builtin", "norlc"], + ["builtin", "noro"], + ["builtin", "nors"], + ["builtin", "noru"], + ["builtin", "noruler"], + ["builtin", "nosb"], + ["builtin", "nosc"], + ["builtin", "noscb"], + ["builtin", "noscrollbind"], + ["builtin", "noscs"], + ["builtin", "nosecure"], + ["builtin", "nosft"], + ["builtin", "noshellslash"], + ["builtin", "noshelltemp"], + ["builtin", "noshiftround"], + ["builtin", "noshortname"], + ["builtin", "noshowcmd"], + ["builtin", "noshowfulltag"], + ["builtin", "noshowmatch"], + ["builtin", "noshowmode"], + ["builtin", "nosi"], + ["builtin", "nosm"], + ["builtin", "nosmartcase"], + ["builtin", "nosmartindent"], + ["builtin", "nosmarttab"], + ["builtin", "nosmd"], + ["builtin", "nosn"], + ["builtin", "nosol"], + ["builtin", "nospell"], + ["builtin", "nosplitbelow"], + ["builtin", "nosplitright"], + ["builtin", "nospr"], + ["builtin", "nosr"], + ["builtin", "nossl"], + ["builtin", "nosta"], + ["builtin", "nostartofline"], + ["builtin", "nostmp"], + ["builtin", "noswapfile"], + ["builtin", "noswf"], + ["builtin", "nota"], + ["builtin", "notagbsearch"], + ["builtin", "notagrelative"], + ["builtin", "notagstack"], + ["builtin", "notbi"], + ["builtin", "notbidi"], + ["builtin", "notbs"], + ["builtin", "notermbidi"], + ["builtin", "noterse"], + ["builtin", "notextauto"], + ["builtin", "notextmode"], + ["builtin", "notf"], + ["builtin", "notgst"], + ["builtin", "notildeop"], + ["builtin", "notimeout"], + ["builtin", "notitle"], + ["builtin", "noto"], + ["builtin", "notop"], + ["builtin", "notr"], + ["builtin", "nottimeout"], + ["builtin", "nottybuiltin"], + ["builtin", "nottyfast"], + ["builtin", "notx"], + ["builtin", "novb"], + ["builtin", "novisualbell"], + ["builtin", "nowa"], + ["builtin", "nowarn"], + ["builtin", "nowb"], + ["builtin", "noweirdinvert"], + ["builtin", "nowfh"], + ["builtin", "nowfw"], + ["builtin", "nowildmenu"], + ["builtin", "nowinfixheight"], + ["builtin", "nowinfixwidth"], + ["builtin", "nowiv"], + ["builtin", "nowmnu"], + ["builtin", "nowrap"], + ["builtin", "nowrapscan"], + ["builtin", "nowrite"], + ["builtin", "nowriteany"], + ["builtin", "nowritebackup"], + ["builtin", "nows"], + ["builtin", "invacd"], + ["builtin", "invai"], + ["builtin", "invakm"], + ["builtin", "invallowrevins"], + ["builtin", "invaltkeymap"], + ["builtin", "invanti"], + ["builtin", "invantialias"], + ["builtin", "invar"], + ["builtin", "invarab"], + ["builtin", "invarabic"], + ["builtin", "invarabicshape"], + ["builtin", "invari"], + ["builtin", "invarshape"], + ["builtin", "invautochdir"], + ["builtin", "invautoindent"], + ["builtin", "invautoread"], + ["builtin", "invautowrite"], + ["builtin", "invautowriteall"], + ["builtin", "invaw"], + ["builtin", "invawa"], + ["builtin", "invbackup"], + ["builtin", "invballooneval"], + ["builtin", "invbeval"], + ["builtin", "invbin"], + ["builtin", "invbinary"], + ["builtin", "invbiosk"], + ["builtin", "invbioskey"], + ["builtin", "invbk"], + ["builtin", "invbl"], + ["builtin", "invbomb"], + ["builtin", "invbuflisted"], + ["builtin", "invcf"], + ["builtin", "invci"], + ["builtin", "invcin"], + ["builtin", "invcindent"], + ["builtin", "invcompatible"], + ["builtin", "invconfirm"], + ["builtin", "invconsk"], + ["builtin", "invconskey"], + ["builtin", "invcopyindent"], + ["builtin", "invcp"], + ["builtin", "invcscopetag"], + ["builtin", "invcscopeverbose"], + ["builtin", "invcst"], + ["builtin", "invcsverb"], + ["builtin", "invcuc"], + ["builtin", "invcul"], + ["builtin", "invcursorcolumn"], + ["builtin", "invcursorline"], + ["builtin", "invdeco"], + ["builtin", "invdelcombine"], + ["builtin", "invdg"], + ["builtin", "invdiff"], + ["builtin", "invdigraph"], + ["builtin", "invdisable"], + ["builtin", "invea"], + ["builtin", "inveb"], + ["builtin", "inved"], + ["builtin", "invedcompatible"], + ["builtin", "invek"], + ["builtin", "invendofline"], + ["builtin", "inveol"], + ["builtin", "invequalalways"], + ["builtin", "inverrorbells"], + ["builtin", "invesckeys"], + ["builtin", "invet"], + ["builtin", "invex"], + ["builtin", "invexpandtab"], + ["builtin", "invexrc"], + ["builtin", "invfen"], + ["builtin", "invfk"], + ["builtin", "invfkmap"], + ["builtin", "invfoldenable"], + ["builtin", "invgd"], + ["builtin", "invgdefault"], + ["builtin", "invguipty"], + ["builtin", "invhid"], + ["builtin", "invhidden"], + ["builtin", "invhk"], + ["builtin", "invhkmap"], + ["builtin", "invhkmapp"], + ["builtin", "invhkp"], + ["builtin", "invhls"], + ["builtin", "invhlsearch"], + ["builtin", "invic"], + ["builtin", "invicon"], + ["builtin", "invignorecase"], + ["builtin", "invim"], + ["builtin", "invimc"], + ["builtin", "invimcmdline"], + ["builtin", "invimd"], + ["builtin", "invincsearch"], + ["builtin", "invinf"], + ["builtin", "invinfercase"], + ["builtin", "invinsertmode"], + ["builtin", "invis"], + ["builtin", "invjoinspaces"], + ["builtin", "invjs"], + ["builtin", "invlazyredraw"], + ["builtin", "invlbr"], + ["builtin", "invlinebreak"], + ["builtin", "invlisp"], + ["builtin", "invlist"], + ["builtin", "invloadplugins"], + ["builtin", "invlpl"], + ["builtin", "invlz"], + ["builtin", "invma"], + ["builtin", "invmacatsui"], + ["builtin", "invmagic"], + ["builtin", "invmh"], + ["builtin", "invml"], + ["builtin", "invmod"], + ["builtin", "invmodeline"], + ["builtin", "invmodifiable"], + ["builtin", "invmodified"], + ["builtin", "invmore"], + ["builtin", "invmousef"], + ["builtin", "invmousefocus"], + ["builtin", "invmousehide"], + ["builtin", "invnu"], + ["builtin", "invnumber"], + ["builtin", "invodev"], + ["builtin", "invopendevice"], + ["builtin", "invpaste"], + ["builtin", "invpi"], + ["builtin", "invpreserveindent"], + ["builtin", "invpreviewwindow"], + ["builtin", "invprompt"], + ["builtin", "invpvw"], + ["builtin", "invreadonly"], + ["builtin", "invremap"], + ["builtin", "invrestorescreen"], + ["builtin", "invrevins"], + ["builtin", "invri"], + ["builtin", "invrightleft"], + ["builtin", "invrightleftcmd"], + ["builtin", "invrl"], + ["builtin", "invrlc"], + ["builtin", "invro"], + ["builtin", "invrs"], + ["builtin", "invru"], + ["builtin", "invruler"], + ["builtin", "invsb"], + ["builtin", "invsc"], + ["builtin", "invscb"], + ["builtin", "invscrollbind"], + ["builtin", "invscs"], + ["builtin", "invsecure"], + ["builtin", "invsft"], + ["builtin", "invshellslash"], + ["builtin", "invshelltemp"], + ["builtin", "invshiftround"], + ["builtin", "invshortname"], + ["builtin", "invshowcmd"], + ["builtin", "invshowfulltag"], + ["builtin", "invshowmatch"], + ["builtin", "invshowmode"], + ["builtin", "invsi"], + ["builtin", "invsm"], + ["builtin", "invsmartcase"], + ["builtin", "invsmartindent"], + ["builtin", "invsmarttab"], + ["builtin", "invsmd"], + ["builtin", "invsn"], + ["builtin", "invsol"], + ["builtin", "invspell"], + ["builtin", "invsplitbelow"], + ["builtin", "invsplitright"], + ["builtin", "invspr"], + ["builtin", "invsr"], + ["builtin", "invssl"], + ["builtin", "invsta"], + ["builtin", "invstartofline"], + ["builtin", "invstmp"], + ["builtin", "invswapfile"], + ["builtin", "invswf"], + ["builtin", "invta"], + ["builtin", "invtagbsearch"], + ["builtin", "invtagrelative"], + ["builtin", "invtagstack"], + ["builtin", "invtbi"], + ["builtin", "invtbidi"], + ["builtin", "invtbs"], + ["builtin", "invtermbidi"], + ["builtin", "invterse"], + ["builtin", "invtextauto"], + ["builtin", "invtextmode"], + ["builtin", "invtf"], + ["builtin", "invtgst"], + ["builtin", "invtildeop"], + ["builtin", "invtimeout"], + ["builtin", "invtitle"], + ["builtin", "invto"], + ["builtin", "invtop"], + ["builtin", "invtr"], + ["builtin", "invttimeout"], + ["builtin", "invttybuiltin"], + ["builtin", "invttyfast"], + ["builtin", "invtx"], + ["builtin", "invvb"], + ["builtin", "invvisualbell"], + ["builtin", "invwa"], + ["builtin", "invwarn"], + ["builtin", "invwb"], + ["builtin", "invweirdinvert"], + ["builtin", "invwfh"], + ["builtin", "invwfw"], + ["builtin", "invwildmenu"], + ["builtin", "invwinfixheight"], + ["builtin", "invwinfixwidth"], + ["builtin", "invwiv"], + ["builtin", "invwmnu"], + ["builtin", "invwrap"], + ["builtin", "invwrapscan"], + ["builtin", "invwrite"], + ["builtin", "invwriteany"], + ["builtin", "invwritebackup"], + ["builtin", "invws"], + ["builtin", "t_AB"], + ["builtin", "t_AF"], + ["builtin", "t_al"], + ["builtin", "t_AL"], + ["builtin", "t_bc"], + ["builtin", "t_cd"], + ["builtin", "t_ce"], + ["builtin", "t_Ce"], + ["builtin", "t_cl"], + ["builtin", "t_cm"], + ["builtin", "t_Co"], + ["builtin", "t_cs"], + ["builtin", "t_Cs"], + ["builtin", "t_CS"], + ["builtin", "t_CV"], + ["builtin", "t_da"], + ["builtin", "t_db"], + ["builtin", "t_dl"], + ["builtin", "t_DL"], + ["builtin", "t_EI"], + ["builtin", "t_F1"], + ["builtin", "t_F2"], + ["builtin", "t_F3"], + ["builtin", "t_F4"], + ["builtin", "t_F5"], + ["builtin", "t_F6"], + ["builtin", "t_F7"], + ["builtin", "t_F8"], + ["builtin", "t_F9"], + ["builtin", "t_fs"], + ["builtin", "t_IE"], + ["builtin", "t_IS"], + ["builtin", "t_k1"], + ["builtin", "t_K1"], + ["builtin", "t_k2"], + ["builtin", "t_k3"], + ["builtin", "t_K3"], + ["builtin", "t_k4"], + ["builtin", "t_K4"], + ["builtin", "t_k5"], + ["builtin", "t_K5"], + ["builtin", "t_k6"], + ["builtin", "t_K6"], + ["builtin", "t_k7"], + ["builtin", "t_K7"], + ["builtin", "t_k8"], + ["builtin", "t_K8"], + ["builtin", "t_k9"], + ["builtin", "t_K9"], + ["builtin", "t_KA"], + ["builtin", "t_kb"], + ["builtin", "t_kB"], + ["builtin", "t_KB"], + ["builtin", "t_KC"], + ["builtin", "t_kd"], + ["builtin", "t_kD"], + ["builtin", "t_KD"], + ["builtin", "t_ke"], + ["builtin", "t_KE"], + ["builtin", "t_KF"], + ["builtin", "t_KG"], + ["builtin", "t_kh"], + ["builtin", "t_KH"], + ["builtin", "t_kI"], + ["builtin", "t_KI"], + ["builtin", "t_KJ"], + ["builtin", "t_KK"], + ["builtin", "t_kl"], + ["builtin", "t_KL"], + ["builtin", "t_kN"], + ["builtin", "t_kP"], + ["builtin", "t_kr"], + ["builtin", "t_ks"], + ["builtin", "t_ku"], + ["builtin", "t_le"], + ["builtin", "t_mb"], + ["builtin", "t_md"], + ["builtin", "t_me"], + ["builtin", "t_mr"], + ["builtin", "t_ms"], + ["builtin", "t_nd"], + ["builtin", "t_op"], + ["builtin", "t_RI"], + ["builtin", "t_RV"], + ["builtin", "t_Sb"], + ["builtin", "t_se"], + ["builtin", "t_Sf"], + ["builtin", "t_SI"], + ["builtin", "t_so"], + ["builtin", "t_sr"], + ["builtin", "t_te"], + ["builtin", "t_ti"], + ["builtin", "t_ts"], + ["builtin", "t_ue"], + ["builtin", "t_us"], + ["builtin", "t_ut"], + ["builtin", "t_vb"], + ["builtin", "t_ve"], + ["builtin", "t_vi"], + ["builtin", "t_vs"], + ["builtin", "t_WP"], + ["builtin", "t_WS"], + ["builtin", "t_xs"], + ["builtin", "t_ZH"], + ["builtin", "t_ZR"] +] + +---------------------------------------------------- + +Checks for builtins. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vim/comment_feature.test b/package/src/prism/tests/languages/vim/comment_feature.test new file mode 100644 index 00000000..c8dc92eb --- /dev/null +++ b/package/src/prism/tests/languages/vim/comment_feature.test @@ -0,0 +1,13 @@ +" +" Foobar + +---------------------------------------------------- + +[ + ["comment", "\""], + ["comment", "\" Foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vim/function_feature.test b/package/src/prism/tests/languages/vim/function_feature.test new file mode 100644 index 00000000..c09d2996 --- /dev/null +++ b/package/src/prism/tests/languages/vim/function_feature.test @@ -0,0 +1,13 @@ +has("mac") +exists("s:call_count") + +---------------------------------------------------- + +[ + ["function", "has"], ["punctuation", "("], ["string", "\"mac\""], ["punctuation", ")"], + ["function", "exists"], ["punctuation", "("], ["string", "\"s:call_count\""], ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vim/keyword_feature.test b/package/src/prism/tests/languages/vim/keyword_feature.test new file mode 100644 index 00000000..23fd7474 --- /dev/null +++ b/package/src/prism/tests/languages/vim/keyword_feature.test @@ -0,0 +1,1661 @@ +ab +abbreviate +abc +abclear +abo +aboveleft +al +all +arga +argadd +argd +argdelete +argdo +arge +argedit +argg +argglobal +argl +arglocal +ar +args +argu +argument +as +ascii +bad +badd +ba +ball +bd +bdelete +be +bel +belowright +bf +bfirst +bl +blast +bm +bmodified +bn +bnext +bN +bNext +bo +botright +bp +bprevious +brea +break +breaka +breakadd +breakd +breakdel +breakl +breaklist +br +brewind +bro +browse +bufdo +b +buffer +buffers +bun +bunload +bw +bwipeout +ca +cabbrev +cabc +cabclear +caddb +caddbuffer +cad +caddexpr +caddf +caddfile +cal +call +cat +catch +cb +cbuffer +cc +ccl +cclose +cd +ce +center +cex +cexpr +cf +cfile +cfir +cfirst +cgetb +cgetbuffer +cgete +cgetexpr +cg +cgetfile +c +change +changes +chd +chdir +che +checkpath +checkt +checktime +cla +clast +cl +clist +clo +close +cmapc +cmapclear +cnew +cnewer +cn +cnext +cN +cNext +cnf +cnfile +cNfcNfile +cnorea +cnoreabbrev +col +colder +colo +colorscheme +comc +comclear +comp +compiler +conf +confirm +con +continue +cope +copen +co +copy +cpf +cpfile +cp +cprevious +cq +cquit +cr +crewind +cuna +cunabbrev +cu +cunmap +cw +cwindow +debugg +debuggreedy +delc +delcommand +d +delete +delf +delfunction +delm +delmarks +diffg +diffget +diffoff +diffpatch +diffpu +diffput +diffsplit +diffthis +diffu +diffupdate +dig +digraphs +di +display +dj +djump +dl +dlist +dr +drop +ds +dsearch +dsp +dsplit +earlier +echoe +echoerr +echom +echomsg +echon +e +edit +el +else +elsei +elseif +em +emenu +endfo +endfor +endf +endfunction +endfun +en +endif +endt +endtry +endw +endwhile +ene +enew +ex +exi +exit +exu +exusage +f +file +files +filetype +fina +finally +fin +find +fini +finish +fir +first +fix +fixdel +fo +fold +foldc +foldclose +folddoc +folddoclosed +foldd +folddoopen +foldo +foldopen +for +fu +fun +function +go +goto +gr +grep +grepa +grepadd +ha +hardcopy +h +help +helpf +helpfind +helpg +helpgrep +helpt +helptags +hid +hide +his +history +ia +iabbrev +iabc +iabclear +if +ij +ijump +il +ilist +imapc +imapclear +in +inorea +inoreabbrev +isearch +isp +isplit +iuna +iunabbrev +iu +iunmap +j +join +ju +jumps +k +keepalt +keepj +keepjumps +kee +keepmarks +laddb +laddbuffer +lad +laddexpr +laddf +laddfile +lan +language +la +last +later +lb +lbuffer +lc +lcd +lch +lchdir +lcl +lclose +let +left +lefta +leftabove +lex +lexpr +lf +lfile +lfir +lfirst +lgetb +lgetbuffer +lgete +lgetexpr +lg +lgetfile +lgr +lgrep +lgrepa +lgrepadd +lh +lhelpgrep +l +list +ll +lla +llast +lli +llist +lmak +lmake +lm +lmap +lmapc +lmapclear +lnew +lnewer +lne +lnext +lN +lNext +lnf +lnfile +lNf +lNfile +ln +lnoremap +lo +loadview +loc +lockmarks +lockv +lockvar +lol +lolder +lop +lopen +lpf +lpfile +lp +lprevious +lr +lrewind +ls +lt +ltag +lu +lunmap +lv +lvimgrep +lvimgrepa +lvimgrepadd +lw +lwindow +mak +make +ma +mark +marks +mat +match +menut +menutranslate +mk +mkexrc +mks +mksession +mksp +mkspell +mkvie +mkview +mkv +mkvimrc +mod +mode +m +move +mzf +mzfile +mz +mzscheme +nbkey +new +n +next +N +Next +nmapc +nmapclear +noh +nohlsearch +norea +noreabbrev +nu +number +nun +nunmap +omapc +omapclear +on +only +o +open +opt +options +ou +ounmap +pc +pclose +ped +pedit +pe +perl +perld +perldo +po +pop +popu +popu +popup +pp +ppop +pre +preserve +prev +previous +p +print +P +Print +profd +profdel +prof +profile +promptf +promptfind +promptr +promptrepl +ps +psearch +pta +ptag +ptf +ptfirst +ptj +ptjump +ptl +ptlast +ptn +ptnext +ptN +ptNext +ptp +ptprevious +ptr +ptrewind +pts +ptselect +pu +put +pw +pwd +pyf +pyfile +py +python +qa +qall +q +quit +quita +quitall +r +read +rec +recover +redi +redir +red +redo +redr +redraw +redraws +redrawstatus +reg +registers +res +resize +ret +retab +retu +return +rew +rewind +ri +right +rightb +rightbelow +rub +ruby +rubyd +rubydo +rubyf +rubyfile +ru +runtime +rv +rviminfo +sal +sall +san +sandbox +sa +sargument +sav +saveas +sba +sball +sbf +sbfirst +sbl +sblast +sbm +sbmodified +sbn +sbnext +sbN +sbNext +sbp +sbprevious +sbr +sbrewind +sb +sbuffer +scripte +scriptencoding +scrip +scriptnames +se +set +setf +setfiletype +setg +setglobal +setl +setlocal +sf +sfind +sfir +sfirst +sh +shell +sign +sil +silent +sim +simalt +sla +slast +sl +sleep +sm +smagic +sm +smap +smapc +smapclear +sme +smenu +sn +snext +sN +sNext +sni +sniff +sno +snomagic +snor +snoremap +snoreme +snoremenu +sor +sort +so +source +spelld +spelldump +spe +spellgood +spelli +spellinfo +spellr +spellrepall +spellu +spellundo +spellw +spellwrong +sp +split +spr +sprevious +sre +srewind +sta +stag +startg +startgreplace +star +startinsert +startr +startreplace +stj +stjump +st +stop +stopi +stopinsert +sts +stselect +sun +sunhide +sunm +sunmap +sus +suspend +sv +sview +syncbind +t +tab +tabc +tabclose +tabd +tabdo +tabe +tabedit +tabf +tabfind +tabfir +tabfirst +tabl +tablast +tabm +tabmove +tabnew +tabn +tabnext +tabN +tabNext +tabo +tabonly +tabp +tabprevious +tabr +tabrewind +tabs +ta +tag +tags +tc +tcl +tcld +tcldo +tclf +tclfile +te +tearoff +tf +tfirst +th +throw +tj +tjump +tl +tlast +tm +tm +tmenu +tn +tnext +tN +tNext +to +topleft +tp +tprevious +tr +trewind +try +ts +tselect +tu +tu +tunmenu +una +unabbreviate +u +undo +undoj +undojoin +undol +undolist +unh +unhide +unlet +unlo +unlockvar +unm +unmap +up +update +verb +verbose +ve +version +vert +vertical +vie +view +vim +vimgrep +vimgrepa +vimgrepadd +vi +visual +viu +viusage +vmapc +vmapclear +vne +vnew +vs +vsplit +vu +vunmap +wa +wall +wh +while +winc +wincmd +windo +winp +winpos +win +winsize +wn +wnext +wN +wNext +wp +wprevious +wq +wqa +wqall +w +write +ws +wsverb +wv +wviminfo +X +xa +xall +x +xit +xm +xmap +xmapc +xmapclear +xme +xmenu +XMLent +XMLns +xn +xnoremap +xnoreme +xnoremenu +xu +xunmap +y +yank + +---------------------------------------------------- + +[ + ["keyword", "ab"], + ["keyword", "abbreviate"], + ["keyword", "abc"], + ["keyword", "abclear"], + ["keyword", "abo"], + ["keyword", "aboveleft"], + ["keyword", "al"], + ["keyword", "all"], + ["keyword", "arga"], + ["keyword", "argadd"], + ["keyword", "argd"], + ["keyword", "argdelete"], + ["keyword", "argdo"], + ["keyword", "arge"], + ["keyword", "argedit"], + ["keyword", "argg"], + ["keyword", "argglobal"], + ["keyword", "argl"], + ["keyword", "arglocal"], + ["keyword", "ar"], + ["keyword", "args"], + ["keyword", "argu"], + ["keyword", "argument"], + ["keyword", "as"], + ["keyword", "ascii"], + ["keyword", "bad"], + ["keyword", "badd"], + ["keyword", "ba"], + ["keyword", "ball"], + ["keyword", "bd"], + ["keyword", "bdelete"], + ["keyword", "be"], + ["keyword", "bel"], + ["keyword", "belowright"], + ["keyword", "bf"], + ["keyword", "bfirst"], + ["keyword", "bl"], + ["keyword", "blast"], + ["keyword", "bm"], + ["keyword", "bmodified"], + ["keyword", "bn"], + ["keyword", "bnext"], + ["keyword", "bN"], + ["keyword", "bNext"], + ["keyword", "bo"], + ["keyword", "botright"], + ["keyword", "bp"], + ["keyword", "bprevious"], + ["keyword", "brea"], + ["keyword", "break"], + ["keyword", "breaka"], + ["keyword", "breakadd"], + ["keyword", "breakd"], + ["keyword", "breakdel"], + ["keyword", "breakl"], + ["keyword", "breaklist"], + ["keyword", "br"], + ["keyword", "brewind"], + ["keyword", "bro"], + ["keyword", "browse"], + ["keyword", "bufdo"], + ["keyword", "b"], + ["keyword", "buffer"], + ["keyword", "buffers"], + ["keyword", "bun"], + ["keyword", "bunload"], + ["keyword", "bw"], + ["keyword", "bwipeout"], + ["keyword", "ca"], + ["keyword", "cabbrev"], + ["keyword", "cabc"], + ["keyword", "cabclear"], + ["keyword", "caddb"], + ["keyword", "caddbuffer"], + ["keyword", "cad"], + ["keyword", "caddexpr"], + ["keyword", "caddf"], + ["keyword", "caddfile"], + ["keyword", "cal"], + ["keyword", "call"], + ["keyword", "cat"], + ["keyword", "catch"], + ["keyword", "cb"], + ["keyword", "cbuffer"], + ["keyword", "cc"], + ["keyword", "ccl"], + ["keyword", "cclose"], + ["keyword", "cd"], + ["keyword", "ce"], + ["keyword", "center"], + ["keyword", "cex"], + ["keyword", "cexpr"], + ["keyword", "cf"], + ["keyword", "cfile"], + ["keyword", "cfir"], + ["keyword", "cfirst"], + ["keyword", "cgetb"], + ["keyword", "cgetbuffer"], + ["keyword", "cgete"], + ["keyword", "cgetexpr"], + ["keyword", "cg"], + ["keyword", "cgetfile"], + ["keyword", "c"], + ["keyword", "change"], + ["keyword", "changes"], + ["keyword", "chd"], + ["keyword", "chdir"], + ["keyword", "che"], + ["keyword", "checkpath"], + ["keyword", "checkt"], + ["keyword", "checktime"], + ["keyword", "cla"], + ["keyword", "clast"], + ["keyword", "cl"], + ["keyword", "clist"], + ["keyword", "clo"], + ["keyword", "close"], + ["keyword", "cmapc"], + ["keyword", "cmapclear"], + ["keyword", "cnew"], + ["keyword", "cnewer"], + ["keyword", "cn"], + ["keyword", "cnext"], + ["keyword", "cN"], + ["keyword", "cNext"], + ["keyword", "cnf"], + ["keyword", "cnfile"], + ["keyword", "cNfcNfile"], + ["keyword", "cnorea"], + ["keyword", "cnoreabbrev"], + ["keyword", "col"], + ["keyword", "colder"], + ["keyword", "colo"], + ["keyword", "colorscheme"], + ["keyword", "comc"], + ["keyword", "comclear"], + ["keyword", "comp"], + ["keyword", "compiler"], + ["keyword", "conf"], + ["keyword", "confirm"], + ["keyword", "con"], + ["keyword", "continue"], + ["keyword", "cope"], + ["keyword", "copen"], + ["keyword", "co"], + ["keyword", "copy"], + ["keyword", "cpf"], + ["keyword", "cpfile"], + ["keyword", "cp"], + ["keyword", "cprevious"], + ["keyword", "cq"], + ["keyword", "cquit"], + ["keyword", "cr"], + ["keyword", "crewind"], + ["keyword", "cuna"], + ["keyword", "cunabbrev"], + ["keyword", "cu"], + ["keyword", "cunmap"], + ["keyword", "cw"], + ["keyword", "cwindow"], + ["keyword", "debugg"], + ["keyword", "debuggreedy"], + ["keyword", "delc"], + ["keyword", "delcommand"], + ["keyword", "d"], + ["keyword", "delete"], + ["keyword", "delf"], + ["keyword", "delfunction"], + ["keyword", "delm"], + ["keyword", "delmarks"], + ["keyword", "diffg"], + ["keyword", "diffget"], + ["keyword", "diffoff"], + ["keyword", "diffpatch"], + ["keyword", "diffpu"], + ["keyword", "diffput"], + ["keyword", "diffsplit"], + ["keyword", "diffthis"], + ["keyword", "diffu"], + ["keyword", "diffupdate"], + ["keyword", "dig"], + ["keyword", "digraphs"], + ["keyword", "di"], + ["keyword", "display"], + ["keyword", "dj"], + ["keyword", "djump"], + ["keyword", "dl"], + ["keyword", "dlist"], + ["keyword", "dr"], + ["keyword", "drop"], + ["keyword", "ds"], + ["keyword", "dsearch"], + ["keyword", "dsp"], + ["keyword", "dsplit"], + ["keyword", "earlier"], + ["keyword", "echoe"], + ["keyword", "echoerr"], + ["keyword", "echom"], + ["keyword", "echomsg"], + ["keyword", "echon"], + ["keyword", "e"], + ["keyword", "edit"], + ["keyword", "el"], + ["keyword", "else"], + ["keyword", "elsei"], + ["keyword", "elseif"], + ["keyword", "em"], + ["keyword", "emenu"], + ["keyword", "endfo"], + ["keyword", "endfor"], + ["keyword", "endf"], + ["keyword", "endfunction"], + ["keyword", "endfun"], + ["keyword", "en"], + ["keyword", "endif"], + ["keyword", "endt"], + ["keyword", "endtry"], + ["keyword", "endw"], + ["keyword", "endwhile"], + ["keyword", "ene"], + ["keyword", "enew"], + ["keyword", "ex"], + ["keyword", "exi"], + ["keyword", "exit"], + ["keyword", "exu"], + ["keyword", "exusage"], + ["keyword", "f"], + ["keyword", "file"], + ["keyword", "files"], + ["keyword", "filetype"], + ["keyword", "fina"], + ["keyword", "finally"], + ["keyword", "fin"], + ["keyword", "find"], + ["keyword", "fini"], + ["keyword", "finish"], + ["keyword", "fir"], + ["keyword", "first"], + ["keyword", "fix"], + ["keyword", "fixdel"], + ["keyword", "fo"], + ["keyword", "fold"], + ["keyword", "foldc"], + ["keyword", "foldclose"], + ["keyword", "folddoc"], + ["keyword", "folddoclosed"], + ["keyword", "foldd"], + ["keyword", "folddoopen"], + ["keyword", "foldo"], + ["keyword", "foldopen"], + ["keyword", "for"], + ["keyword", "fu"], + ["keyword", "fun"], + ["keyword", "function"], + ["keyword", "go"], + ["keyword", "goto"], + ["keyword", "gr"], + ["keyword", "grep"], + ["keyword", "grepa"], + ["keyword", "grepadd"], + ["keyword", "ha"], + ["keyword", "hardcopy"], + ["keyword", "h"], + ["keyword", "help"], + ["keyword", "helpf"], + ["keyword", "helpfind"], + ["keyword", "helpg"], + ["keyword", "helpgrep"], + ["keyword", "helpt"], + ["keyword", "helptags"], + ["keyword", "hid"], + ["keyword", "hide"], + ["keyword", "his"], + ["keyword", "history"], + ["keyword", "ia"], + ["keyword", "iabbrev"], + ["keyword", "iabc"], + ["keyword", "iabclear"], + ["keyword", "if"], + ["keyword", "ij"], + ["keyword", "ijump"], + ["keyword", "il"], + ["keyword", "ilist"], + ["keyword", "imapc"], + ["keyword", "imapclear"], + ["keyword", "in"], + ["keyword", "inorea"], + ["keyword", "inoreabbrev"], + ["keyword", "isearch"], + ["keyword", "isp"], + ["keyword", "isplit"], + ["keyword", "iuna"], + ["keyword", "iunabbrev"], + ["keyword", "iu"], + ["keyword", "iunmap"], + ["keyword", "j"], + ["keyword", "join"], + ["keyword", "ju"], + ["keyword", "jumps"], + ["keyword", "k"], + ["keyword", "keepalt"], + ["keyword", "keepj"], + ["keyword", "keepjumps"], + ["keyword", "kee"], + ["keyword", "keepmarks"], + ["keyword", "laddb"], + ["keyword", "laddbuffer"], + ["keyword", "lad"], + ["keyword", "laddexpr"], + ["keyword", "laddf"], + ["keyword", "laddfile"], + ["keyword", "lan"], + ["keyword", "language"], + ["keyword", "la"], + ["keyword", "last"], + ["keyword", "later"], + ["keyword", "lb"], + ["keyword", "lbuffer"], + ["keyword", "lc"], + ["keyword", "lcd"], + ["keyword", "lch"], + ["keyword", "lchdir"], + ["keyword", "lcl"], + ["keyword", "lclose"], + ["keyword", "let"], + ["keyword", "left"], + ["keyword", "lefta"], + ["keyword", "leftabove"], + ["keyword", "lex"], + ["keyword", "lexpr"], + ["keyword", "lf"], + ["keyword", "lfile"], + ["keyword", "lfir"], + ["keyword", "lfirst"], + ["keyword", "lgetb"], + ["keyword", "lgetbuffer"], + ["keyword", "lgete"], + ["keyword", "lgetexpr"], + ["keyword", "lg"], + ["keyword", "lgetfile"], + ["keyword", "lgr"], + ["keyword", "lgrep"], + ["keyword", "lgrepa"], + ["keyword", "lgrepadd"], + ["keyword", "lh"], + ["keyword", "lhelpgrep"], + ["keyword", "l"], + ["keyword", "list"], + ["keyword", "ll"], + ["keyword", "lla"], + ["keyword", "llast"], + ["keyword", "lli"], + ["keyword", "llist"], + ["keyword", "lmak"], + ["keyword", "lmake"], + ["keyword", "lm"], + ["keyword", "lmap"], + ["keyword", "lmapc"], + ["keyword", "lmapclear"], + ["keyword", "lnew"], + ["keyword", "lnewer"], + ["keyword", "lne"], + ["keyword", "lnext"], + ["keyword", "lN"], + ["keyword", "lNext"], + ["keyword", "lnf"], + ["keyword", "lnfile"], + ["keyword", "lNf"], + ["keyword", "lNfile"], + ["keyword", "ln"], + ["keyword", "lnoremap"], + ["keyword", "lo"], + ["keyword", "loadview"], + ["keyword", "loc"], + ["keyword", "lockmarks"], + ["keyword", "lockv"], + ["keyword", "lockvar"], + ["keyword", "lol"], + ["keyword", "lolder"], + ["keyword", "lop"], + ["keyword", "lopen"], + ["keyword", "lpf"], + ["keyword", "lpfile"], + ["keyword", "lp"], + ["keyword", "lprevious"], + ["keyword", "lr"], + ["keyword", "lrewind"], + ["keyword", "ls"], + ["keyword", "lt"], + ["keyword", "ltag"], + ["keyword", "lu"], + ["keyword", "lunmap"], + ["keyword", "lv"], + ["keyword", "lvimgrep"], + ["keyword", "lvimgrepa"], + ["keyword", "lvimgrepadd"], + ["keyword", "lw"], + ["keyword", "lwindow"], + ["keyword", "mak"], + ["keyword", "make"], + ["keyword", "ma"], + ["keyword", "mark"], + ["keyword", "marks"], + ["keyword", "mat"], + ["keyword", "match"], + ["keyword", "menut"], + ["keyword", "menutranslate"], + ["keyword", "mk"], + ["keyword", "mkexrc"], + ["keyword", "mks"], + ["keyword", "mksession"], + ["keyword", "mksp"], + ["keyword", "mkspell"], + ["keyword", "mkvie"], + ["keyword", "mkview"], + ["keyword", "mkv"], + ["keyword", "mkvimrc"], + ["keyword", "mod"], + ["keyword", "mode"], + ["keyword", "m"], + ["keyword", "move"], + ["keyword", "mzf"], + ["keyword", "mzfile"], + ["keyword", "mz"], + ["keyword", "mzscheme"], + ["keyword", "nbkey"], + ["keyword", "new"], + ["keyword", "n"], + ["keyword", "next"], + ["keyword", "N"], + ["keyword", "Next"], + ["keyword", "nmapc"], + ["keyword", "nmapclear"], + ["keyword", "noh"], + ["keyword", "nohlsearch"], + ["keyword", "norea"], + ["keyword", "noreabbrev"], + ["keyword", "nu"], + ["keyword", "number"], + ["keyword", "nun"], + ["keyword", "nunmap"], + ["keyword", "omapc"], + ["keyword", "omapclear"], + ["keyword", "on"], + ["keyword", "only"], + ["keyword", "o"], + ["keyword", "open"], + ["keyword", "opt"], + ["keyword", "options"], + ["keyword", "ou"], + ["keyword", "ounmap"], + ["keyword", "pc"], + ["keyword", "pclose"], + ["keyword", "ped"], + ["keyword", "pedit"], + ["keyword", "pe"], + ["keyword", "perl"], + ["keyword", "perld"], + ["keyword", "perldo"], + ["keyword", "po"], + ["keyword", "pop"], + ["keyword", "popu"], + ["keyword", "popu"], + ["keyword", "popup"], + ["keyword", "pp"], + ["keyword", "ppop"], + ["keyword", "pre"], + ["keyword", "preserve"], + ["keyword", "prev"], + ["keyword", "previous"], + ["keyword", "p"], + ["keyword", "print"], + ["keyword", "P"], + ["keyword", "Print"], + ["keyword", "profd"], + ["keyword", "profdel"], + ["keyword", "prof"], + ["keyword", "profile"], + ["keyword", "promptf"], + ["keyword", "promptfind"], + ["keyword", "promptr"], + ["keyword", "promptrepl"], + ["keyword", "ps"], + ["keyword", "psearch"], + ["keyword", "pta"], + ["keyword", "ptag"], + ["keyword", "ptf"], + ["keyword", "ptfirst"], + ["keyword", "ptj"], + ["keyword", "ptjump"], + ["keyword", "ptl"], + ["keyword", "ptlast"], + ["keyword", "ptn"], + ["keyword", "ptnext"], + ["keyword", "ptN"], + ["keyword", "ptNext"], + ["keyword", "ptp"], + ["keyword", "ptprevious"], + ["keyword", "ptr"], + ["keyword", "ptrewind"], + ["keyword", "pts"], + ["keyword", "ptselect"], + ["keyword", "pu"], + ["keyword", "put"], + ["keyword", "pw"], + ["keyword", "pwd"], + ["keyword", "pyf"], + ["keyword", "pyfile"], + ["keyword", "py"], + ["keyword", "python"], + ["keyword", "qa"], + ["keyword", "qall"], + ["keyword", "q"], + ["keyword", "quit"], + ["keyword", "quita"], + ["keyword", "quitall"], + ["keyword", "r"], + ["keyword", "read"], + ["keyword", "rec"], + ["keyword", "recover"], + ["keyword", "redi"], + ["keyword", "redir"], + ["keyword", "red"], + ["keyword", "redo"], + ["keyword", "redr"], + ["keyword", "redraw"], + ["keyword", "redraws"], + ["keyword", "redrawstatus"], + ["keyword", "reg"], + ["keyword", "registers"], + ["keyword", "res"], + ["keyword", "resize"], + ["keyword", "ret"], + ["keyword", "retab"], + ["keyword", "retu"], + ["keyword", "return"], + ["keyword", "rew"], + ["keyword", "rewind"], + ["keyword", "ri"], + ["keyword", "right"], + ["keyword", "rightb"], + ["keyword", "rightbelow"], + ["keyword", "rub"], + ["keyword", "ruby"], + ["keyword", "rubyd"], + ["keyword", "rubydo"], + ["keyword", "rubyf"], + ["keyword", "rubyfile"], + ["keyword", "ru"], + ["keyword", "runtime"], + ["keyword", "rv"], + ["keyword", "rviminfo"], + ["keyword", "sal"], + ["keyword", "sall"], + ["keyword", "san"], + ["keyword", "sandbox"], + ["keyword", "sa"], + ["keyword", "sargument"], + ["keyword", "sav"], + ["keyword", "saveas"], + ["keyword", "sba"], + ["keyword", "sball"], + ["keyword", "sbf"], + ["keyword", "sbfirst"], + ["keyword", "sbl"], + ["keyword", "sblast"], + ["keyword", "sbm"], + ["keyword", "sbmodified"], + ["keyword", "sbn"], + ["keyword", "sbnext"], + ["keyword", "sbN"], + ["keyword", "sbNext"], + ["keyword", "sbp"], + ["keyword", "sbprevious"], + ["keyword", "sbr"], + ["keyword", "sbrewind"], + ["keyword", "sb"], + ["keyword", "sbuffer"], + ["keyword", "scripte"], + ["keyword", "scriptencoding"], + ["keyword", "scrip"], + ["keyword", "scriptnames"], + ["keyword", "se"], + ["keyword", "set"], + ["keyword", "setf"], + ["keyword", "setfiletype"], + ["keyword", "setg"], + ["keyword", "setglobal"], + ["keyword", "setl"], + ["keyword", "setlocal"], + ["keyword", "sf"], + ["keyword", "sfind"], + ["keyword", "sfir"], + ["keyword", "sfirst"], + ["keyword", "sh"], + ["keyword", "shell"], + ["keyword", "sign"], + ["keyword", "sil"], + ["keyword", "silent"], + ["keyword", "sim"], + ["keyword", "simalt"], + ["keyword", "sla"], + ["keyword", "slast"], + ["keyword", "sl"], + ["keyword", "sleep"], + ["keyword", "sm"], + ["keyword", "smagic"], + ["keyword", "sm"], + ["keyword", "smap"], + ["keyword", "smapc"], + ["keyword", "smapclear"], + ["keyword", "sme"], + ["keyword", "smenu"], + ["keyword", "sn"], + ["keyword", "snext"], + ["keyword", "sN"], + ["keyword", "sNext"], + ["keyword", "sni"], + ["keyword", "sniff"], + ["keyword", "sno"], + ["keyword", "snomagic"], + ["keyword", "snor"], + ["keyword", "snoremap"], + ["keyword", "snoreme"], + ["keyword", "snoremenu"], + ["keyword", "sor"], + ["keyword", "sort"], + ["keyword", "so"], + ["keyword", "source"], + ["keyword", "spelld"], + ["keyword", "spelldump"], + ["keyword", "spe"], + ["keyword", "spellgood"], + ["keyword", "spelli"], + ["keyword", "spellinfo"], + ["keyword", "spellr"], + ["keyword", "spellrepall"], + ["keyword", "spellu"], + ["keyword", "spellundo"], + ["keyword", "spellw"], + ["keyword", "spellwrong"], + ["keyword", "sp"], + ["keyword", "split"], + ["keyword", "spr"], + ["keyword", "sprevious"], + ["keyword", "sre"], + ["keyword", "srewind"], + ["keyword", "sta"], + ["keyword", "stag"], + ["keyword", "startg"], + ["keyword", "startgreplace"], + ["keyword", "star"], + ["keyword", "startinsert"], + ["keyword", "startr"], + ["keyword", "startreplace"], + ["keyword", "stj"], + ["keyword", "stjump"], + ["keyword", "st"], + ["keyword", "stop"], + ["keyword", "stopi"], + ["keyword", "stopinsert"], + ["keyword", "sts"], + ["keyword", "stselect"], + ["keyword", "sun"], + ["keyword", "sunhide"], + ["keyword", "sunm"], + ["keyword", "sunmap"], + ["keyword", "sus"], + ["keyword", "suspend"], + ["keyword", "sv"], + ["keyword", "sview"], + ["keyword", "syncbind"], + ["keyword", "t"], + ["keyword", "tab"], + ["keyword", "tabc"], + ["keyword", "tabclose"], + ["keyword", "tabd"], + ["keyword", "tabdo"], + ["keyword", "tabe"], + ["keyword", "tabedit"], + ["keyword", "tabf"], + ["keyword", "tabfind"], + ["keyword", "tabfir"], + ["keyword", "tabfirst"], + ["keyword", "tabl"], + ["keyword", "tablast"], + ["keyword", "tabm"], + ["keyword", "tabmove"], + ["keyword", "tabnew"], + ["keyword", "tabn"], + ["keyword", "tabnext"], + ["keyword", "tabN"], + ["keyword", "tabNext"], + ["keyword", "tabo"], + ["keyword", "tabonly"], + ["keyword", "tabp"], + ["keyword", "tabprevious"], + ["keyword", "tabr"], + ["keyword", "tabrewind"], + ["keyword", "tabs"], + ["keyword", "ta"], + ["keyword", "tag"], + ["keyword", "tags"], + ["keyword", "tc"], + ["keyword", "tcl"], + ["keyword", "tcld"], + ["keyword", "tcldo"], + ["keyword", "tclf"], + ["keyword", "tclfile"], + ["keyword", "te"], + ["keyword", "tearoff"], + ["keyword", "tf"], + ["keyword", "tfirst"], + ["keyword", "th"], + ["keyword", "throw"], + ["keyword", "tj"], + ["keyword", "tjump"], + ["keyword", "tl"], + ["keyword", "tlast"], + ["keyword", "tm"], + ["keyword", "tm"], + ["keyword", "tmenu"], + ["keyword", "tn"], + ["keyword", "tnext"], + ["keyword", "tN"], + ["keyword", "tNext"], + ["keyword", "to"], + ["keyword", "topleft"], + ["keyword", "tp"], + ["keyword", "tprevious"], + ["keyword", "tr"], + ["keyword", "trewind"], + ["keyword", "try"], + ["keyword", "ts"], + ["keyword", "tselect"], + ["keyword", "tu"], + ["keyword", "tu"], + ["keyword", "tunmenu"], + ["keyword", "una"], + ["keyword", "unabbreviate"], + ["keyword", "u"], + ["keyword", "undo"], + ["keyword", "undoj"], + ["keyword", "undojoin"], + ["keyword", "undol"], + ["keyword", "undolist"], + ["keyword", "unh"], + ["keyword", "unhide"], + ["keyword", "unlet"], + ["keyword", "unlo"], + ["keyword", "unlockvar"], + ["keyword", "unm"], + ["keyword", "unmap"], + ["keyword", "up"], + ["keyword", "update"], + ["keyword", "verb"], + ["keyword", "verbose"], + ["keyword", "ve"], + ["keyword", "version"], + ["keyword", "vert"], + ["keyword", "vertical"], + ["keyword", "vie"], + ["keyword", "view"], + ["keyword", "vim"], + ["keyword", "vimgrep"], + ["keyword", "vimgrepa"], + ["keyword", "vimgrepadd"], + ["keyword", "vi"], + ["keyword", "visual"], + ["keyword", "viu"], + ["keyword", "viusage"], + ["keyword", "vmapc"], + ["keyword", "vmapclear"], + ["keyword", "vne"], + ["keyword", "vnew"], + ["keyword", "vs"], + ["keyword", "vsplit"], + ["keyword", "vu"], + ["keyword", "vunmap"], + ["keyword", "wa"], + ["keyword", "wall"], + ["keyword", "wh"], + ["keyword", "while"], + ["keyword", "winc"], + ["keyword", "wincmd"], + ["keyword", "windo"], + ["keyword", "winp"], + ["keyword", "winpos"], + ["keyword", "win"], + ["keyword", "winsize"], + ["keyword", "wn"], + ["keyword", "wnext"], + ["keyword", "wN"], + ["keyword", "wNext"], + ["keyword", "wp"], + ["keyword", "wprevious"], + ["keyword", "wq"], + ["keyword", "wqa"], + ["keyword", "wqall"], + ["keyword", "w"], + ["keyword", "write"], + ["keyword", "ws"], + ["keyword", "wsverb"], + ["keyword", "wv"], + ["keyword", "wviminfo"], + ["keyword", "X"], + ["keyword", "xa"], + ["keyword", "xall"], + ["keyword", "x"], + ["keyword", "xit"], + ["keyword", "xm"], + ["keyword", "xmap"], + ["keyword", "xmapc"], + ["keyword", "xmapclear"], + ["keyword", "xme"], + ["keyword", "xmenu"], + ["keyword", "XMLent"], + ["keyword", "XMLns"], + ["keyword", "xn"], + ["keyword", "xnoremap"], + ["keyword", "xnoreme"], + ["keyword", "xnoremenu"], + ["keyword", "xu"], + ["keyword", "xunmap"], + ["keyword", "y"], + ["keyword", "yank"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vim/number_feature.test b/package/src/prism/tests/languages/vim/number_feature.test new file mode 100644 index 00000000..70b47e0b --- /dev/null +++ b/package/src/prism/tests/languages/vim/number_feature.test @@ -0,0 +1,15 @@ +0xBadFace +42 +3.14159 + +---------------------------------------------------- + +[ + ["number", "0xBadFace"], + ["number", "42"], + ["number", "3.14159"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vim/operator_feature.test b/package/src/prism/tests/languages/vim/operator_feature.test new file mode 100644 index 00000000..460b914c --- /dev/null +++ b/package/src/prism/tests/languages/vim/operator_feature.test @@ -0,0 +1,37 @@ +|| && +? * / % ++ += +- -= +. .= += == =~ +==# =~# ==? =~? +! != !~ +!=# !~# !=? !~? +< <= +<# <=# >= +># >=# >? >=? +is isnot + +---------------------------------------------------- + +[ + ["operator", "||"], ["operator", "&&"], + ["operator", "?"], ["operator", "*"], ["operator", "/"], ["operator", "%"], + ["operator", "+"], ["operator", "+="], + ["operator", "-"], ["operator", "-="], + ["operator", "."], ["operator", ".="], + ["operator", "="], ["operator", "=="], ["operator", "=~"], + ["operator", "==#"], ["operator", "=~#"], ["operator", "==?"], ["operator", "=~?"], + ["operator", "!"], ["operator", "!="], ["operator", "!~"], + ["operator", "!=#"], ["operator", "!~#"], ["operator", "!=?"], ["operator", "!~?"], + ["operator", "<"], ["operator", "<="], + ["operator", "<#"], ["operator", "<=#"], ["operator", ""], ["operator", ">="], + ["operator", ">#"], ["operator", ">=#"], ["operator", ">?"], ["operator", ">=?"], + ["operator", "is"], ["operator", "isnot"] +] + +---------------------------------------------------- + +Checks for all operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/vim/string_feature.test b/package/src/prism/tests/languages/vim/string_feature.test new file mode 100644 index 00000000..fe7400da --- /dev/null +++ b/package/src/prism/tests/languages/vim/string_feature.test @@ -0,0 +1,19 @@ +"" +"Fo\"ob'ar" +'' +'\' +'Foo''bar' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"Fo\\\"ob'ar\""], + ["string", "''"], + ["string", "'\\'"], + ["string", "'Foo''bar'"] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/visual-basic/boolean_feature.test b/package/src/prism/tests/languages/visual-basic/boolean_feature.test new file mode 100644 index 00000000..6a2979aa --- /dev/null +++ b/package/src/prism/tests/languages/visual-basic/boolean_feature.test @@ -0,0 +1,15 @@ +True +False +Nothing + +---------------------------------------------------- + +[ + ["boolean", "True"], + ["boolean", "False"], + ["boolean", "Nothing"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/visual-basic/comment_feature.test b/package/src/prism/tests/languages/visual-basic/comment_feature.test new file mode 100644 index 00000000..97d82c8e --- /dev/null +++ b/package/src/prism/tests/languages/visual-basic/comment_feature.test @@ -0,0 +1,29 @@ +' +' Foo "bar" +‘ +‘ Foobar +’ +’ Foobar +REM +REM Foobar + +' multi-line _ + comment + +---------------------------------------------------- + +[ + ["comment", ["'"]], + ["comment", ["' Foo \"bar\""]], + ["comment", ["‘"]], + ["comment", ["‘ Foobar"]], + ["comment", ["’"]], + ["comment", ["’ Foobar"]], + ["comment", [["keyword", "REM"]]], + ["comment", [["keyword", "REM"], " Foobar"]], + ["comment", ["' multi-line _\n comment"]] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/visual-basic/date_feature.test b/package/src/prism/tests/languages/visual-basic/date_feature.test new file mode 100644 index 00000000..996c115e --- /dev/null +++ b/package/src/prism/tests/languages/visual-basic/date_feature.test @@ -0,0 +1,23 @@ +# 8/23/1970 3:45:39AM # +#8/23/1970 # +# 3:45:39AM # +# 3:45:39# +# 13:45:39 # +# 1AM # +# 13:45:39PM # + +---------------------------------------------------- + +[ + ["date", "# 8/23/1970 3:45:39AM #"], + ["date", "#8/23/1970 #"], + ["date", "# 3:45:39AM #"], + ["date", "# 3:45:39#"], + ["date", "# 13:45:39 #"], + ["date", "# 1AM #"], + ["date", "# 13:45:39PM #"] +] + +---------------------------------------------------- + +Checks for dates and times. \ No newline at end of file diff --git a/package/src/prism/tests/languages/visual-basic/directive_feature.test b/package/src/prism/tests/languages/visual-basic/directive_feature.test new file mode 100644 index 00000000..70a18006 --- /dev/null +++ b/package/src/prism/tests/languages/visual-basic/directive_feature.test @@ -0,0 +1,23 @@ +#Const DebugCode = True +#If DebugCode Then +#End If +#ExternalSource("c:\wwwroot\inetpub\test.aspx", 30) +#End ExternalSource +#ExternalChecksum("c:\wwwroot\inetpub\test.aspx", _ + "{12345678-1234-1234-1234-123456789abc}", _ + "1a2b3c4e5f617239a49b9a9c0391849d34950f923fab9484") + +---------------------------------------------------- + +[ + ["directive", "#Const DebugCode = True"], + ["directive", "#If DebugCode Then"], + ["directive", "#End If"], + ["directive", "#ExternalSource(\"c:\\wwwroot\\inetpub\\test.aspx\", 30)"], + ["directive", "#End ExternalSource"], + ["directive", "#ExternalChecksum(\"c:\\wwwroot\\inetpub\\test.aspx\", _\n \"{12345678-1234-1234-1234-123456789abc}\", _\n \"1a2b3c4e5f617239a49b9a9c0391849d34950f923fab9484\")"] +] + +---------------------------------------------------- + +Checks for preprocessing directives. \ No newline at end of file diff --git a/package/src/prism/tests/languages/visual-basic/keyword_feature.test b/package/src/prism/tests/languages/visual-basic/keyword_feature.test new file mode 100644 index 00000000..54347a69 --- /dev/null +++ b/package/src/prism/tests/languages/visual-basic/keyword_feature.test @@ -0,0 +1,313 @@ +AddHandler +AddressOf +Alias +And +AndAlso +As +Boolean +ByRef +Byte +ByVal +Call +Case +Catch +CBool +CByte +CChar +CDate +CDbl +CDec +Char +CInt +Class +CLng +CObj +Const +Continue +CSByte +CShort +CSng +CStr +CType +CUInt +CULng +CUShort +Currency +Date +Decimal +Declare +Default +Delegate +Dim +DirectCast +Do +Double +Each +Else +ElseIf +End +EndIf +Enum +Erase +Error +Event +Exit +Finally +For +Friend +Function +Get +GetType +GetXMLNamespace +Global +GoSub +GoTo +Handles +If +Implements +Imports +In +Inherits +Integer +Interface +Is +IsNot +Let +Lib +Like +Long +Loop +Me +Mod +Module +MustInherit +MustOverride +MyBase +MyClass +Namespace +Narrowing +New +Next +Not +NotInheritable +NotOverridable +Object +Of +On +Operator +Option +Optional +Or +OrElse +Out +Overloads +Overridable +Overrides +ParamArray +Partial +Private +Property +Protected +Public +RaiseEvent +ReadOnly +ReDim +RemoveHandler +Resume +Return +SByte +Select +Set +Shadows +Shared +short +Single +Static +Step +Stop +String +Structure +Sub +SyncLock +Then +Throw +To +Try +TryCast +Type +TypeOf +UInteger +ULong +UShort +Using +Variant +Wend +When +While +Widening +With +WithEvents +WriteOnly +Until +Xor + +---------------------------------------------------- + +[ + ["keyword", "AddHandler"], + ["keyword", "AddressOf"], + ["keyword", "Alias"], + ["keyword", "And"], + ["keyword", "AndAlso"], + ["keyword", "As"], + ["keyword", "Boolean"], + ["keyword", "ByRef"], + ["keyword", "Byte"], + ["keyword", "ByVal"], + ["keyword", "Call"], + ["keyword", "Case"], + ["keyword", "Catch"], + ["keyword", "CBool"], + ["keyword", "CByte"], + ["keyword", "CChar"], + ["keyword", "CDate"], + ["keyword", "CDbl"], + ["keyword", "CDec"], + ["keyword", "Char"], + ["keyword", "CInt"], + ["keyword", "Class"], + ["keyword", "CLng"], + ["keyword", "CObj"], + ["keyword", "Const"], + ["keyword", "Continue"], + ["keyword", "CSByte"], + ["keyword", "CShort"], + ["keyword", "CSng"], + ["keyword", "CStr"], + ["keyword", "CType"], + ["keyword", "CUInt"], + ["keyword", "CULng"], + ["keyword", "CUShort"], + ["keyword", "Currency"], + ["keyword", "Date"], + ["keyword", "Decimal"], + ["keyword", "Declare"], + ["keyword", "Default"], + ["keyword", "Delegate"], + ["keyword", "Dim"], + ["keyword", "DirectCast"], + ["keyword", "Do"], + ["keyword", "Double"], + ["keyword", "Each"], + ["keyword", "Else"], + ["keyword", "ElseIf"], + ["keyword", "End"], + ["keyword", "EndIf"], + ["keyword", "Enum"], + ["keyword", "Erase"], + ["keyword", "Error"], + ["keyword", "Event"], + ["keyword", "Exit"], + ["keyword", "Finally"], + ["keyword", "For"], + ["keyword", "Friend"], + ["keyword", "Function"], + ["keyword", "Get"], + ["keyword", "GetType"], + ["keyword", "GetXMLNamespace"], + ["keyword", "Global"], + ["keyword", "GoSub"], + ["keyword", "GoTo"], + ["keyword", "Handles"], + ["keyword", "If"], + ["keyword", "Implements"], + ["keyword", "Imports"], + ["keyword", "In"], + ["keyword", "Inherits"], + ["keyword", "Integer"], + ["keyword", "Interface"], + ["keyword", "Is"], + ["keyword", "IsNot"], + ["keyword", "Let"], + ["keyword", "Lib"], + ["keyword", "Like"], + ["keyword", "Long"], + ["keyword", "Loop"], + ["keyword", "Me"], + ["keyword", "Mod"], + ["keyword", "Module"], + ["keyword", "MustInherit"], + ["keyword", "MustOverride"], + ["keyword", "MyBase"], + ["keyword", "MyClass"], + ["keyword", "Namespace"], + ["keyword", "Narrowing"], + ["keyword", "New"], + ["keyword", "Next"], + ["keyword", "Not"], + ["keyword", "NotInheritable"], + ["keyword", "NotOverridable"], + ["keyword", "Object"], + ["keyword", "Of"], + ["keyword", "On"], + ["keyword", "Operator"], + ["keyword", "Option"], + ["keyword", "Optional"], + ["keyword", "Or"], + ["keyword", "OrElse"], + ["keyword", "Out"], + ["keyword", "Overloads"], + ["keyword", "Overridable"], + ["keyword", "Overrides"], + ["keyword", "ParamArray"], + ["keyword", "Partial"], + ["keyword", "Private"], + ["keyword", "Property"], + ["keyword", "Protected"], + ["keyword", "Public"], + ["keyword", "RaiseEvent"], + ["keyword", "ReadOnly"], + ["keyword", "ReDim"], + ["keyword", "RemoveHandler"], + ["keyword", "Resume"], + ["keyword", "Return"], + ["keyword", "SByte"], + ["keyword", "Select"], + ["keyword", "Set"], + ["keyword", "Shadows"], + ["keyword", "Shared"], + ["keyword", "short"], + ["keyword", "Single"], + ["keyword", "Static"], + ["keyword", "Step"], + ["keyword", "Stop"], + ["keyword", "String"], + ["keyword", "Structure"], + ["keyword", "Sub"], + ["keyword", "SyncLock"], + ["keyword", "Then"], + ["keyword", "Throw"], + ["keyword", "To"], + ["keyword", "Try"], + ["keyword", "TryCast"], + ["keyword", "Type"], + ["keyword", "TypeOf"], + ["keyword", "UInteger"], + ["keyword", "ULong"], + ["keyword", "UShort"], + ["keyword", "Using"], + ["keyword", "Variant"], + ["keyword", "Wend"], + ["keyword", "When"], + ["keyword", "While"], + ["keyword", "Widening"], + ["keyword", "With"], + ["keyword", "WithEvents"], + ["keyword", "WriteOnly"], + ["keyword", "Until"], + ["keyword", "Xor"] +] + +---------------------------------------------------- + +Checks for all keywords. diff --git a/package/src/prism/tests/languages/visual-basic/number_feature.test b/package/src/prism/tests/languages/visual-basic/number_feature.test new file mode 100644 index 00000000..c45d3a09 --- /dev/null +++ b/package/src/prism/tests/languages/visual-basic/number_feature.test @@ -0,0 +1,37 @@ +42 +42S +42US +&O157I +&O157UI +&HBADFACE42L +&HBADFACE42UL +4F +0.4 +3.1415R +.24 +4E7D +12.87E-8 +.369E+14 + +---------------------------------------------------- + +[ + ["number", "42"], + ["number", "42S"], + ["number", "42US"], + ["number", "&O157I"], + ["number", "&O157UI"], + ["number", "&HBADFACE42L"], + ["number", "&HBADFACE42UL"], + ["number", "4F"], + ["number", "0.4"], + ["number", "3.1415R"], + ["number", ".24"], + ["number", "4E7D"], + ["number", "12.87E-8"], + ["number", ".369E+14"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/visual-basic/operator_feature.test b/package/src/prism/tests/languages/visual-basic/operator_feature.test new file mode 100644 index 00000000..813e3922 --- /dev/null +++ b/package/src/prism/tests/languages/visual-basic/operator_feature.test @@ -0,0 +1,37 @@ ++ - +* / +\ ^ +< = > +& # @ +$ % ! +Sub Print( _ + Param1 As Integer, _ + Param2 As Integer ) + +---------------------------------------------------- + +[ + ["operator", "+"], ["operator", "-"], + ["operator", "*"], ["operator", "/"], + ["operator", "\\"], ["operator", "^"], + ["operator", "<"], ["operator", "="], ["operator", ">"], + ["operator", "&"], ["operator", "#"], ["operator", "@"], + ["operator", "$"], ["operator", "%"], ["operator", "!"], + ["keyword", "Sub"], + " Print", + ["punctuation", "("], + ["operator", "_"], + "\n Param1 ", + ["keyword", "As"], + ["keyword", "Integer"], + ["punctuation", ","], + ["operator", "_"], + "\n Param2 ", + ["keyword", "As"], + ["keyword", "Integer"], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for operators and type characters. \ No newline at end of file diff --git a/package/src/prism/tests/languages/visual-basic/string_feature.test b/package/src/prism/tests/languages/visual-basic/string_feature.test new file mode 100644 index 00000000..9ddcad1f --- /dev/null +++ b/package/src/prism/tests/languages/visual-basic/string_feature.test @@ -0,0 +1,37 @@ +"" +"Foobar" +"Foo""bar" +“” +“Foo +bar” +“Foo""bar” +““ +”” +”“ +“" +"Foo”“ba +r" +"a"c +$"Foobar" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"Foobar\""], + ["string", "\"Foo\"\"bar\""], + ["string", "“”"], + ["string", "“Foo\nbar”"], + ["string", "“Foo\"\"bar”"], + ["string", "““"], + ["string", "””"], + ["string", "”“"], + ["string", "“\""], + ["string", "\"Foo”“ba\nr\""], + ["string", "\"a\"c"], + ["string", "$\"Foobar\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/warpscript/boolean_feature.test b/package/src/prism/tests/languages/warpscript/boolean_feature.test new file mode 100644 index 00000000..6a51565e --- /dev/null +++ b/package/src/prism/tests/languages/warpscript/boolean_feature.test @@ -0,0 +1,17 @@ +false +true +F +T + +---------------------------------------------------- + +[ + ["boolean", "false"], + ["boolean", "true"], + ["boolean", "F"], + ["boolean", "T"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/warpscript/comment_feature.test b/package/src/prism/tests/languages/warpscript/comment_feature.test new file mode 100644 index 00000000..6325471a --- /dev/null +++ b/package/src/prism/tests/languages/warpscript/comment_feature.test @@ -0,0 +1,19 @@ +# Python style comments, starting with a '#' and extending to the end of the line + +// Java style comments, extending to the end of the line after the '//' + +/* + C style block comments, possibly spanning multiple lines +*/ + +---------------------------------------------------- + +[ + ["comment", "# Python style comments, starting with a '#' and extending to the end of the line"], + ["comment", "// Java style comments, extending to the end of the line after the '//'"], + ["comment", "/*\n C style block comments, possibly spanning multiple lines\n*/"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/warpscript/keyword_feature.test b/package/src/prism/tests/languages/warpscript/keyword_feature.test new file mode 100644 index 00000000..fb1531b3 --- /dev/null +++ b/package/src/prism/tests/languages/warpscript/keyword_feature.test @@ -0,0 +1,49 @@ +BREAK +CHECKMACRO +CONTINUE +CUDF +DEFINED +DEFINEDMACRO +EVAL +FAIL +FOR +FOREACH +FORSTEP +IFT +IFTE +MSGFAIL +NRETURN +RETHROW +RETURN +SWITCH +TRY +UDF +UNTIL +WHILE + +---------------------------------------------------- + +[ + ["keyword", "BREAK"], + ["keyword", "CHECKMACRO"], + ["keyword", "CONTINUE"], + ["keyword", "CUDF"], + ["keyword", "DEFINED"], + ["keyword", "DEFINEDMACRO"], + ["keyword", "EVAL"], + ["keyword", "FAIL"], + ["keyword", "FOR"], + ["keyword", "FOREACH"], + ["keyword", "FORSTEP"], + ["keyword", "IFT"], + ["keyword", "IFTE"], + ["keyword", "MSGFAIL"], + ["keyword", "NRETURN"], + ["keyword", "RETHROW"], + ["keyword", "RETURN"], + ["keyword", "SWITCH"], + ["keyword", "TRY"], + ["keyword", "UDF"], + ["keyword", "UNTIL"], + ["keyword", "WHILE"] +] diff --git a/package/src/prism/tests/languages/warpscript/macro_feature.test b/package/src/prism/tests/languages/warpscript/macro_feature.test new file mode 100644 index 00000000..72b8c760 --- /dev/null +++ b/package/src/prism/tests/languages/warpscript/macro_feature.test @@ -0,0 +1,7 @@ +@foo + +---------------------------------------------------- + +[ + ["macro", "@foo"] +] diff --git a/package/src/prism/tests/languages/warpscript/number_feature.test b/package/src/prism/tests/languages/warpscript/number_feature.test new file mode 100644 index 00000000..221d58a0 --- /dev/null +++ b/package/src/prism/tests/languages/warpscript/number_feature.test @@ -0,0 +1,35 @@ +123 +-123 +5e4 +5e-4 +123.546 +123.546E-5 + +0xFFF +0b10101 + +NaN +Infinity +-Infinity + +---------------------------------------------------- + +[ + ["number", "123"], + ["number", "-123"], + ["number", "5e4"], + ["number", "5e-4"], + ["number", "123.546"], + ["number", "123.546E-5"], + + ["number", "0xFFF"], + ["number", "0b10101"], + + ["number", "NaN"], + ["number", "Infinity"], + ["number", "-Infinity"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/warpscript/operator_feature.test b/package/src/prism/tests/languages/warpscript/operator_feature.test new file mode 100644 index 00000000..ae4c514b --- /dev/null +++ b/package/src/prism/tests/languages/warpscript/operator_feature.test @@ -0,0 +1,45 @@ +!= < > ~= <= == >= +% * + - / ** +! && AND OR NOT || +& ^ | >>> ~ << >> ++! + +---------------------------------------------------- + +[ + ["operator", "!="], + ["operator", "<"], + ["operator", ">"], + ["operator", "~="], + ["operator", "<="], + ["operator", "=="], + ["operator", ">="], + + ["operator", "%"], + ["operator", "*"], + ["operator", "+"], + ["operator", "-"], + ["operator", "/"], + ["operator", "**"], + + ["operator", "!"], + ["operator", "&&"], + ["operator", "AND"], + ["operator", "OR"], + ["operator", "NOT"], + ["operator", "||"], + + ["operator", "&"], + ["operator", "^"], + ["operator", "|"], + ["operator", ">>>"], + ["operator", "~"], + ["operator", "<<"], + ["operator", ">>"], + + ["operator", "+!"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/warpscript/punctuation_feature.test b/package/src/prism/tests/languages/warpscript/punctuation_feature.test new file mode 100644 index 00000000..14ecba81 --- /dev/null +++ b/package/src/prism/tests/languages/warpscript/punctuation_feature.test @@ -0,0 +1,19 @@ +<% %> +( ) [ ] { } + +---------------------------------------------------- + +[ + ["punctuation", "<%"], + ["punctuation", "%>"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for punctuation. diff --git a/package/src/prism/tests/languages/warpscript/string_feature.test b/package/src/prism/tests/languages/warpscript/string_feature.test new file mode 100644 index 00000000..5ed86642 --- /dev/null +++ b/package/src/prism/tests/languages/warpscript/string_feature.test @@ -0,0 +1,19 @@ +'Caf%C3%A9' + +"foo" + +<' + foo +'> + +---------------------------------------------------- + +[ + ["string", "'Caf%C3%A9'"], + ["string", "\"foo\""], + ["string", "<'\n foo\n'>"] +] + +---------------------------------------------------- + +Checks for strings. diff --git a/package/src/prism/tests/languages/warpscript/variable_feature.test b/package/src/prism/tests/languages/warpscript/variable_feature.test new file mode 100644 index 00000000..fbb7a411 --- /dev/null +++ b/package/src/prism/tests/languages/warpscript/variable_feature.test @@ -0,0 +1,7 @@ +$foo + +---------------------------------------------------- + +[ + ["variable", "$foo"] +] diff --git a/package/src/prism/tests/languages/wasm/comment_feature.test b/package/src/prism/tests/languages/wasm/comment_feature.test new file mode 100644 index 00000000..1c34d320 --- /dev/null +++ b/package/src/prism/tests/languages/wasm/comment_feature.test @@ -0,0 +1,22 @@ +;; +;; Foobar +;; (; foobar ;) +(;;) +(;Foobar;) +(;Foo ;;bar +baz;) + +---------------------------------------------------- + +[ + ["comment", ";;"], + ["comment", ";; Foobar"], + ["comment", ";; (; foobar ;)"], + ["comment", "(;;)"], + ["comment", "(;Foobar;)"], + ["comment", "(;Foo ;;bar\nbaz;)"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/wasm/keyword_feature.test b/package/src/prism/tests/languages/wasm/keyword_feature.test new file mode 100644 index 00000000..96cd7030 --- /dev/null +++ b/package/src/prism/tests/languages/wasm/keyword_feature.test @@ -0,0 +1,407 @@ +align= +offset= + +f32 +f64 +i32 +i64 +i32.load +i64.load +f32.load +f64.load +i32.load8_s +i32.load8_u +i32.load16_s +i32.load16_u +i64.load8_s +i64.load8_u +i64.load16_s +i64.load16_u +i64.load32_s +i64.load32_u +i32.store +i64.store +f32.store +f64.store +i32.store8 +i32.store16 +i64.store8 +i64.store16 +i64.store32 +i32.const +i64.const +f32.const +f64.const +i32.clz +i32.ctz +i32.popcnt +i32.add +i32.sub +i32.mul +i32.div_s +i32.div_u +i32.rem_s +i32.rem_u +i32.and +i32.or +i32.xor +i32.shl +i32.shr_s +i32.shr_u +i32.rotl +i32.rotr +i64.clz +i64.ctz +i64.popcnt +i64.add +i64.sub +i64.mul +i64.div_s +i64.div_u +i64.rem_s +i64.rem_u +i64.and +i64.or +i64.xor +i64.shl +i64.shr_s +i64.shr_u +i64.rotl +i64.rotr +f32.abs +f32.neg +f32.ceil +f32.floor +f32.trunc +f32.nearest +f32.sqrt +f32.add +f32.sub +f32.mul +f32.div +f32.min +f32.max +f32.copysign +f64.abs +f64.neg +f64.ceil +f64.floor +f64.trunc +f64.nearest +f64.sqrt +f64.add +f64.sub +f64.mul +f64.div +f64.min +f64.max +f64.copysign +i32.eqz +i32.eq +i32.ne +i32.lt_s +i32.lt_u +i32.gt_s +i32.gt_u +i32.le_s +i32.le_u +i32.ge_s +i32.ge_u +i64.eqz +i64.eq +i64.ne +i64.lt_s +i64.lt_u +i64.gt_s +i64.gt_u +i64.le_s +i64.le_u +i64.ge_s +i64.ge_u +f32.eq +f32.ne +f32.lt +f32.gt +f32.le +f32.ge +f64.eq +f64.ne +f64.lt +f64.gt +f64.le +f64.ge +i32.wrap/i64 +i32.trunc_s/f32 +i32.trunc_u/f32 +i32.trunc_s/f64 +i32.trunc_u/f64 +i64.extend_s/i32 +i64.extend_u/i32 +i64.trunc_s/f32 +i64.trunc_u/f32 +i64.trunc_s/f64 +i64.trunc_u/f64 +f32.convert_s/i32 +f32.convert_u/i32 +f32.convert_s/i64 +f32.convert_u/i64 +f32.demote/f64 +f64.convert_s/i32 +f64.convert_u/i32 +f64.convert_s/i64 +f64.convert_u/i64 +f64.promote/f32 +i32.reinterpret/f32 +i64.reinterpret/f64 +f32.reinterpret/i32 +f64.reinterpret/i64 + +memory.size +memory.grow + +anyfunc +block +br +br_if +br_table +call +call_indirect +data +drop +elem +else +end +export +func +get_global +get_local +global +if +import +local +loop +memory +module +mut +nop +offset +param +result +return +select +set_global +set_local +start +table +tee_local +then +type +unreachable + +---------------------------------------------------- + +[ + ["keyword", ["align", ["operator", "="]]], + ["keyword", ["offset", ["operator", "="]]], + + ["keyword", ["f32"]], + ["keyword", ["f64"]], + ["keyword", ["i32"]], + ["keyword", ["i64"]], + ["keyword", ["i32", ["punctuation", "."], "load"]], + ["keyword", ["i64", ["punctuation", "."], "load"]], + ["keyword", ["f32", ["punctuation", "."], "load"]], + ["keyword", ["f64", ["punctuation", "."], "load"]], + ["keyword", ["i32", ["punctuation", "."], "load8_s"]], + ["keyword", ["i32", ["punctuation", "."], "load8_u"]], + ["keyword", ["i32", ["punctuation", "."], "load16_s"]], + ["keyword", ["i32", ["punctuation", "."], "load16_u"]], + ["keyword", ["i64", ["punctuation", "."], "load8_s"]], + ["keyword", ["i64", ["punctuation", "."], "load8_u"]], + ["keyword", ["i64", ["punctuation", "."], "load16_s"]], + ["keyword", ["i64", ["punctuation", "."], "load16_u"]], + ["keyword", ["i64", ["punctuation", "."], "load32_s"]], + ["keyword", ["i64", ["punctuation", "."], "load32_u"]], + ["keyword", ["i32", ["punctuation", "."], "store"]], + ["keyword", ["i64", ["punctuation", "."], "store"]], + ["keyword", ["f32", ["punctuation", "."], "store"]], + ["keyword", ["f64", ["punctuation", "."], "store"]], + ["keyword", ["i32", ["punctuation", "."], "store8"]], + ["keyword", ["i32", ["punctuation", "."], "store16"]], + ["keyword", ["i64", ["punctuation", "."], "store8"]], + ["keyword", ["i64", ["punctuation", "."], "store16"]], + ["keyword", ["i64", ["punctuation", "."], "store32"]], + ["keyword", ["i32", ["punctuation", "."], "const"]], + ["keyword", ["i64", ["punctuation", "."], "const"]], + ["keyword", ["f32", ["punctuation", "."], "const"]], + ["keyword", ["f64", ["punctuation", "."], "const"]], + ["keyword", ["i32", ["punctuation", "."], "clz"]], + ["keyword", ["i32", ["punctuation", "."], "ctz"]], + ["keyword", ["i32", ["punctuation", "."], "popcnt"]], + ["keyword", ["i32", ["punctuation", "."], "add"]], + ["keyword", ["i32", ["punctuation", "."], "sub"]], + ["keyword", ["i32", ["punctuation", "."], "mul"]], + ["keyword", ["i32", ["punctuation", "."], "div_s"]], + ["keyword", ["i32", ["punctuation", "."], "div_u"]], + ["keyword", ["i32", ["punctuation", "."], "rem_s"]], + ["keyword", ["i32", ["punctuation", "."], "rem_u"]], + ["keyword", ["i32", ["punctuation", "."], "and"]], + ["keyword", ["i32", ["punctuation", "."], "or"]], + ["keyword", ["i32", ["punctuation", "."], "xor"]], + ["keyword", ["i32", ["punctuation", "."], "shl"]], + ["keyword", ["i32", ["punctuation", "."], "shr_s"]], + ["keyword", ["i32", ["punctuation", "."], "shr_u"]], + ["keyword", ["i32", ["punctuation", "."], "rotl"]], + ["keyword", ["i32", ["punctuation", "."], "rotr"]], + ["keyword", ["i64", ["punctuation", "."], "clz"]], + ["keyword", ["i64", ["punctuation", "."], "ctz"]], + ["keyword", ["i64", ["punctuation", "."], "popcnt"]], + ["keyword", ["i64", ["punctuation", "."], "add"]], + ["keyword", ["i64", ["punctuation", "."], "sub"]], + ["keyword", ["i64", ["punctuation", "."], "mul"]], + ["keyword", ["i64", ["punctuation", "."], "div_s"]], + ["keyword", ["i64", ["punctuation", "."], "div_u"]], + ["keyword", ["i64", ["punctuation", "."], "rem_s"]], + ["keyword", ["i64", ["punctuation", "."], "rem_u"]], + ["keyword", ["i64", ["punctuation", "."], "and"]], + ["keyword", ["i64", ["punctuation", "."], "or"]], + ["keyword", ["i64", ["punctuation", "."], "xor"]], + ["keyword", ["i64", ["punctuation", "."], "shl"]], + ["keyword", ["i64", ["punctuation", "."], "shr_s"]], + ["keyword", ["i64", ["punctuation", "."], "shr_u"]], + ["keyword", ["i64", ["punctuation", "."], "rotl"]], + ["keyword", ["i64", ["punctuation", "."], "rotr"]], + ["keyword", ["f32", ["punctuation", "."], "abs"]], + ["keyword", ["f32", ["punctuation", "."], "neg"]], + ["keyword", ["f32", ["punctuation", "."], "ceil"]], + ["keyword", ["f32", ["punctuation", "."], "floor"]], + ["keyword", ["f32", ["punctuation", "."], "trunc"]], + ["keyword", ["f32", ["punctuation", "."], "nearest"]], + ["keyword", ["f32", ["punctuation", "."], "sqrt"]], + ["keyword", ["f32", ["punctuation", "."], "add"]], + ["keyword", ["f32", ["punctuation", "."], "sub"]], + ["keyword", ["f32", ["punctuation", "."], "mul"]], + ["keyword", ["f32", ["punctuation", "."], "div"]], + ["keyword", ["f32", ["punctuation", "."], "min"]], + ["keyword", ["f32", ["punctuation", "."], "max"]], + ["keyword", ["f32", ["punctuation", "."], "copysign"]], + ["keyword", ["f64", ["punctuation", "."], "abs"]], + ["keyword", ["f64", ["punctuation", "."], "neg"]], + ["keyword", ["f64", ["punctuation", "."], "ceil"]], + ["keyword", ["f64", ["punctuation", "."], "floor"]], + ["keyword", ["f64", ["punctuation", "."], "trunc"]], + ["keyword", ["f64", ["punctuation", "."], "nearest"]], + ["keyword", ["f64", ["punctuation", "."], "sqrt"]], + ["keyword", ["f64", ["punctuation", "."], "add"]], + ["keyword", ["f64", ["punctuation", "."], "sub"]], + ["keyword", ["f64", ["punctuation", "."], "mul"]], + ["keyword", ["f64", ["punctuation", "."], "div"]], + ["keyword", ["f64", ["punctuation", "."], "min"]], + ["keyword", ["f64", ["punctuation", "."], "max"]], + ["keyword", ["f64", ["punctuation", "."], "copysign"]], + ["keyword", ["i32", ["punctuation", "."], "eqz"]], + ["keyword", ["i32", ["punctuation", "."], "eq"]], + ["keyword", ["i32", ["punctuation", "."], "ne"]], + ["keyword", ["i32", ["punctuation", "."], "lt_s"]], + ["keyword", ["i32", ["punctuation", "."], "lt_u"]], + ["keyword", ["i32", ["punctuation", "."], "gt_s"]], + ["keyword", ["i32", ["punctuation", "."], "gt_u"]], + ["keyword", ["i32", ["punctuation", "."], "le_s"]], + ["keyword", ["i32", ["punctuation", "."], "le_u"]], + ["keyword", ["i32", ["punctuation", "."], "ge_s"]], + ["keyword", ["i32", ["punctuation", "."], "ge_u"]], + ["keyword", ["i64", ["punctuation", "."], "eqz"]], + ["keyword", ["i64", ["punctuation", "."], "eq"]], + ["keyword", ["i64", ["punctuation", "."], "ne"]], + ["keyword", ["i64", ["punctuation", "."], "lt_s"]], + ["keyword", ["i64", ["punctuation", "."], "lt_u"]], + ["keyword", ["i64", ["punctuation", "."], "gt_s"]], + ["keyword", ["i64", ["punctuation", "."], "gt_u"]], + ["keyword", ["i64", ["punctuation", "."], "le_s"]], + ["keyword", ["i64", ["punctuation", "."], "le_u"]], + ["keyword", ["i64", ["punctuation", "."], "ge_s"]], + ["keyword", ["i64", ["punctuation", "."], "ge_u"]], + ["keyword", ["f32", ["punctuation", "."], "eq"]], + ["keyword", ["f32", ["punctuation", "."], "ne"]], + ["keyword", ["f32", ["punctuation", "."], "lt"]], + ["keyword", ["f32", ["punctuation", "."], "gt"]], + ["keyword", ["f32", ["punctuation", "."], "le"]], + ["keyword", ["f32", ["punctuation", "."], "ge"]], + ["keyword", ["f64", ["punctuation", "."], "eq"]], + ["keyword", ["f64", ["punctuation", "."], "ne"]], + ["keyword", ["f64", ["punctuation", "."], "lt"]], + ["keyword", ["f64", ["punctuation", "."], "gt"]], + ["keyword", ["f64", ["punctuation", "."], "le"]], + ["keyword", ["f64", ["punctuation", "."], "ge"]], + ["keyword", ["i32", ["punctuation", "."], "wrap/i64"]], + ["keyword", ["i32", ["punctuation", "."], "trunc_s/f32"]], + ["keyword", ["i32", ["punctuation", "."], "trunc_u/f32"]], + ["keyword", ["i32", ["punctuation", "."], "trunc_s/f64"]], + ["keyword", ["i32", ["punctuation", "."], "trunc_u/f64"]], + ["keyword", ["i64", ["punctuation", "."], "extend_s/i32"]], + ["keyword", ["i64", ["punctuation", "."], "extend_u/i32"]], + ["keyword", ["i64", ["punctuation", "."], "trunc_s/f32"]], + ["keyword", ["i64", ["punctuation", "."], "trunc_u/f32"]], + ["keyword", ["i64", ["punctuation", "."], "trunc_s/f64"]], + ["keyword", ["i64", ["punctuation", "."], "trunc_u/f64"]], + ["keyword", ["f32", ["punctuation", "."], "convert_s/i32"]], + ["keyword", ["f32", ["punctuation", "."], "convert_u/i32"]], + ["keyword", ["f32", ["punctuation", "."], "convert_s/i64"]], + ["keyword", ["f32", ["punctuation", "."], "convert_u/i64"]], + ["keyword", ["f32", ["punctuation", "."], "demote/f64"]], + ["keyword", ["f64", ["punctuation", "."], "convert_s/i32"]], + ["keyword", ["f64", ["punctuation", "."], "convert_u/i32"]], + ["keyword", ["f64", ["punctuation", "."], "convert_s/i64"]], + ["keyword", ["f64", ["punctuation", "."], "convert_u/i64"]], + ["keyword", ["f64", ["punctuation", "."], "promote/f32"]], + ["keyword", ["i32", ["punctuation", "."], "reinterpret/f32"]], + ["keyword", ["i64", ["punctuation", "."], "reinterpret/f64"]], + ["keyword", ["f32", ["punctuation", "."], "reinterpret/i32"]], + ["keyword", ["f64", ["punctuation", "."], "reinterpret/i64"]], + + ["keyword", ["memory", ["punctuation", "."], "size"]], + ["keyword", ["memory", ["punctuation", "."], "grow"]], + + ["keyword", "anyfunc"], + ["keyword", "block"], + ["keyword", "br"], + ["keyword", "br_if"], + ["keyword", "br_table"], + ["keyword", "call"], + ["keyword", "call_indirect"], + ["keyword", "data"], + ["keyword", "drop"], + ["keyword", "elem"], + ["keyword", "else"], + ["keyword", "end"], + ["keyword", "export"], + ["keyword", "func"], + ["keyword", "get_global"], + ["keyword", "get_local"], + ["keyword", "global"], + ["keyword", "if"], + ["keyword", "import"], + ["keyword", "local"], + ["keyword", "loop"], + ["keyword", "memory"], + ["keyword", "module"], + ["keyword", "mut"], + ["keyword", "nop"], + ["keyword", "offset"], + ["keyword", "param"], + ["keyword", "result"], + ["keyword", "return"], + ["keyword", "select"], + ["keyword", "set_global"], + ["keyword", "set_local"], + ["keyword", "start"], + ["keyword", "table"], + ["keyword", "tee_local"], + ["keyword", "then"], + ["keyword", "type"], + ["keyword", "unreachable"] +] + +---------------------------------------------------- + +Checks for all keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/wasm/number_feature.test b/package/src/prism/tests/languages/wasm/number_feature.test new file mode 100644 index 00000000..39ed160e --- /dev/null +++ b/package/src/prism/tests/languages/wasm/number_feature.test @@ -0,0 +1,61 @@ +0 +42_147 ++42 ++4_2 +-3.1415 +-3.1_41_5 +4e2 +4_7e2 +-7E+8 +-7E+1_8 ++8.004e-12 ++8.0_04e-12 +0xBadFace +0xB_adF_a_c_e +-0x4E.F8d +-0x4_E.F8_d ++0xff +0xefp4 +0xe_fp4_2 ++0x5CP+12 ++0x5_CP+12 +-0xef.efp-7 +-0xef_14.00_0_Ap-1_7 +inf +nan +nan:0xF_4 + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "42_147"], + ["number", "+42"], + ["number", "+4_2"], + ["number", "-3.1415"], + ["number", "-3.1_41_5"], + ["number", "4e2"], + ["number", "4_7e2"], + ["number", "-7E+8"], + ["number", "-7E+1_8"], + ["number", "+8.004e-12"], + ["number", "+8.0_04e-12"], + ["number", "0xBadFace"], + ["number", "0xB_adF_a_c_e"], + ["number", "-0x4E.F8d"], + ["number", "-0x4_E.F8_d"], + ["number", "+0xff"], + ["number", "0xefp4"], + ["number", "0xe_fp4_2"], + ["number", "+0x5CP+12"], + ["number", "+0x5_CP+12"], + ["number", "-0xef.efp-7"], + ["number", "-0xef_14.00_0_Ap-1_7"], + ["number", "inf"], + ["number", "nan"], + ["number", "nan:0xF_4"] +] + +---------------------------------------------------- + +Checks for decimal and hexadecimal numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/wasm/string_feature.test b/package/src/prism/tests/languages/wasm/string_feature.test new file mode 100644 index 00000000..84ce0280 --- /dev/null +++ b/package/src/prism/tests/languages/wasm/string_feature.test @@ -0,0 +1,22 @@ +"" +"Foo\"\\bar" +"\t\n\r\"\'\\\u{004e}\u{0_0_4_e}" +"foo +bar" +";; foo" +"(; foo bar ;)" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"Foo\\\"\\\\bar\""], + ["string", "\"\\t\\n\\r\\\"\\'\\\\\\u{004e}\\u{0_0_4_e}\""], + ["string", "\"foo\nbar\""], + ["string", "\";; foo\""], + ["string", "\"(; foo bar ;)\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/wasm/variable_feature.test b/package/src/prism/tests/languages/wasm/variable_feature.test new file mode 100644 index 00000000..a55ea5ee --- /dev/null +++ b/package/src/prism/tests/languages/wasm/variable_feature.test @@ -0,0 +1,17 @@ +$Foo +$foo_42! +$$ +$!#$%&'*+-./:<=>?@\^_`|~ + +---------------------------------------------------- + +[ + ["variable", "$Foo"], + ["variable", "$foo_42!"], + ["variable", "$$"], + ["variable", "$!#$%&'*+-./:<=>?@\\^_`|~"] +] + +---------------------------------------------------- + +Checks for variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/web-idl/boolean_feature.test b/package/src/prism/tests/languages/web-idl/boolean_feature.test new file mode 100644 index 00000000..d342140d --- /dev/null +++ b/package/src/prism/tests/languages/web-idl/boolean_feature.test @@ -0,0 +1,9 @@ +true +false + +---------------------------------------------------- + +[ + ["boolean", "true"], + ["boolean", "false"] +] diff --git a/package/src/prism/tests/languages/web-idl/builtin_feature.test b/package/src/prism/tests/languages/web-idl/builtin_feature.test new file mode 100644 index 00000000..541091fb --- /dev/null +++ b/package/src/prism/tests/languages/web-idl/builtin_feature.test @@ -0,0 +1,43 @@ +ArrayBuffer +BigInt64Array +BigUint64Array +ByteString +DOMString +DataView +Float32Array +Float64Array +FrozenArray +Int16Array +Int32Array +Int8Array +ObservableArray +Promise +USVString +Uint16Array +Uint32Array +Uint8Array +Uint8ClampedArray + +---------------------------------------------------- + +[ + ["builtin", "ArrayBuffer"], + ["builtin", "BigInt64Array"], + ["builtin", "BigUint64Array"], + ["builtin", "ByteString"], + ["builtin", "DOMString"], + ["builtin", "DataView"], + ["builtin", "Float32Array"], + ["builtin", "Float64Array"], + ["builtin", "FrozenArray"], + ["builtin", "Int16Array"], + ["builtin", "Int32Array"], + ["builtin", "Int8Array"], + ["builtin", "ObservableArray"], + ["builtin", "Promise"], + ["builtin", "USVString"], + ["builtin", "Uint16Array"], + ["builtin", "Uint32Array"], + ["builtin", "Uint8Array"], + ["builtin", "Uint8ClampedArray"] +] diff --git a/package/src/prism/tests/languages/web-idl/class-name_feature.test b/package/src/prism/tests/languages/web-idl/class-name_feature.test new file mode 100644 index 00000000..3f6ad1b8 --- /dev/null +++ b/package/src/prism/tests/languages/web-idl/class-name_feature.test @@ -0,0 +1,410 @@ +// names +interface interface_identifier { /* interface_members... */ }; +partial interface interface_identifier { /* interface_members... */ }; +dictionary dictionary_identifier { /* dictionary_members... */ }; +partial dictionary dictionary_identifier { /* dictionary_members... */ }; +enum enumeration_identifier { "enum", "values" /* , ... */ }; +callback callback_identifier = return_type (/* arguments... */); +callback interface callback_interface_identifier { /* interface_members... */ }; + +// interfaces + +interface interface_identifier { + return_type identifier([extended_attributes] type identifier, [extended_attributes] type identifier); +}; +interface interface_identifier { + return_type identifier(type... identifier); + return_type identifier(type identifier, type... identifier); +}; +interface SolidColor : Paint { + constructor(double radius); + attribute double red; + readonly attribute unsigned long width; + undefined drawText(double x, double y, DOMString text); + getter DOMString (DOMString keyName); + getter DOMString foo(DOMString keyName); + boolean hasAddressForName(USVString name, optional LookupOptions options = {}); + const unsigned long BIT_MASK = 0x0000fc00; + iterable; +}; + +// dictionary + +dictionary identifier { + type identifier; +}; +dictionary identifier { + type identifier = "value"; +}; +dictionary identifier { + required type identifier; +}; +dictionary B : A { + long b; + long a; +}; + +// callback + +callback AsyncOperationCallback = undefined (DOMString status); + +// enum + +enum MealType { "rice", "noodles", "other" }; + +// typedef + +typedef sequence Points; + +// includes and implements +Foo includes Bar; +Foo implements Bar; + +---------------------------------------------------- + +[ + ["comment", "// names"], + + ["keyword", "interface"], + ["class-name", "interface_identifier"], + ["punctuation", "{"], + ["comment", "/* interface_members... */"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "partial"], + ["keyword", "interface"], + ["class-name", "interface_identifier"], + ["punctuation", "{"], + ["comment", "/* interface_members... */"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "dictionary"], + ["class-name", "dictionary_identifier"], + ["punctuation", "{"], + ["comment", "/* dictionary_members... */"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "partial"], + ["keyword", "dictionary"], + ["class-name", "dictionary_identifier"], + ["punctuation", "{"], + ["comment", "/* dictionary_members... */"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "enum"], + ["class-name", "enumeration_identifier"], + ["punctuation", "{"], + ["string", "\"enum\""], + ["punctuation", ","], + ["string", "\"values\""], + ["comment", "/* , ... */"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "callback"], + ["class-name", "callback_identifier"], + ["operator", "="], + ["class-name", ["return_type"]], + ["punctuation", "("], + ["comment", "/* arguments... */"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "callback"], + ["keyword", "interface"], + ["class-name", "callback_interface_identifier"], + ["punctuation", "{"], + ["comment", "/* interface_members... */"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["comment", "// interfaces"], + + ["keyword", "interface"], + ["class-name", "interface_identifier"], + ["punctuation", "{"], + + ["class-name", ["return_type"]], + " identifier", + ["punctuation", "("], + ["punctuation", "["], + "extended_attributes", + ["punctuation", "]"], + ["class-name", ["type"]], + " identifier", + ["punctuation", ","], + ["punctuation", "["], + "extended_attributes", + ["punctuation", "]"], + ["class-name", ["type"]], + " identifier", + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "interface"], + ["class-name", "interface_identifier"], + ["punctuation", "{"], + + ["class-name", ["return_type"]], + " identifier", + ["punctuation", "("], + ["class-name", ["type"]], + ["operator", "..."], + " identifier", + ["punctuation", ")"], + ["punctuation", ";"], + + ["class-name", ["return_type"]], + " identifier", + ["punctuation", "("], + ["class-name", ["type"]], + " identifier", + ["punctuation", ","], + ["class-name", ["type"]], + ["operator", "..."], + " identifier", + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "interface"], + ["class-name", "SolidColor"], + ["operator", ":"], + ["class-name", "Paint"], + ["punctuation", "{"], + + ["keyword", "constructor"], + ["punctuation", "("], + ["class-name", [ + ["keyword", "double"] + ]], + " radius", + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "attribute"], + ["class-name", [ + ["keyword", "double"] + ]], + " red", + ["punctuation", ";"], + + ["keyword", "readonly"], + ["keyword", "attribute"], + ["class-name", [ + ["keyword", "unsigned"], + ["keyword", "long"] + ]], + " width", + ["punctuation", ";"], + + ["class-name", [ + ["keyword", "undefined"] + ]], + " drawText", + ["punctuation", "("], + ["class-name", [ + ["keyword", "double"] + ]], + " x", + ["punctuation", ","], + ["class-name", [ + ["keyword", "double"] + ]], + " y", + ["punctuation", ","], + ["class-name", [ + ["builtin", "DOMString"] + ]], + " text", + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "getter"], + ["class-name", [ + ["builtin", "DOMString"] + ]], + ["punctuation", "("], + ["class-name", [ + ["builtin", "DOMString"] + ]], + " keyName", + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "getter"], + ["class-name", [ + ["builtin", "DOMString"] + ]], + " foo", + ["punctuation", "("], + ["class-name", [ + ["builtin", "DOMString"] + ]], + " keyName", + ["punctuation", ")"], + ["punctuation", ";"], + + ["class-name", [ + ["keyword", "boolean"] + ]], + " hasAddressForName", + ["punctuation", "("], + ["class-name", [ + ["builtin", "USVString"] + ]], + " name", + ["punctuation", ","], + ["keyword", "optional"], + ["class-name", ["LookupOptions"]], + " options ", + ["operator", "="], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["keyword", "const"], + ["class-name", [ + ["keyword", "unsigned"], + ["keyword", "long"] + ]], + " BIT_MASK ", + ["operator", "="], + ["number", "0x0000fc00"], + ["punctuation", ";"], + + ["class-name", [ + ["keyword", "iterable"], + ["operator", "<"], + ["builtin", "DOMString"], + ["punctuation", ","], + " Session", + ["operator", ">"] + ]], + ["punctuation", ";"], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["comment", "// dictionary"], + + ["keyword", "dictionary"], + ["class-name", "identifier"], + ["punctuation", "{"], + + ["class-name", ["type"]], + " identifier", + ["punctuation", ";"], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "dictionary"], + ["class-name", "identifier"], + ["punctuation", "{"], + + ["class-name", ["type"]], + " identifier ", + ["operator", "="], + ["string", "\"value\""], + ["punctuation", ";"], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "dictionary"], + ["class-name", "identifier"], + ["punctuation", "{"], + + ["keyword", "required"], + ["class-name", ["type"]], + " identifier", + ["punctuation", ";"], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "dictionary"], + ["class-name", "B"], + ["operator", ":"], + ["class-name", "A"], + ["punctuation", "{"], + + ["class-name", [ + ["keyword", "long"] + ]], + " b", + ["punctuation", ";"], + + ["class-name", [ + ["keyword", "long"] + ]], + " a", + ["punctuation", ";"], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["comment", "// callback"], + + ["keyword", "callback"], + ["class-name", "AsyncOperationCallback"], + ["operator", "="], + ["class-name", [ + ["keyword", "undefined"] + ]], + ["punctuation", "("], + ["class-name", [ + ["builtin", "DOMString"] + ]], + " status", + ["punctuation", ")"], + ["punctuation", ";"], + + ["comment", "// enum"], + + ["keyword", "enum"], + ["class-name", "MealType"], + ["punctuation", "{"], + ["string", "\"rice\""], + ["punctuation", ","], + ["string", "\"noodles\""], + ["punctuation", ","], + ["string", "\"other\""], + ["punctuation", "}"], + ["punctuation", ";"], + + ["comment", "// typedef"], + + ["keyword", "typedef"], + ["class-name", [ + ["keyword", "sequence"], + ["operator", "<"], + "Point", + ["operator", ">"] + ]], + " Points", + ["punctuation", ";"], + + ["comment", "// includes and implements"], + + ["class-name", "Foo"], + ["keyword", "includes"], + ["class-name", "Bar"], + ["punctuation", ";"], + + ["class-name", "Foo"], + ["keyword", "implements"], + ["class-name", "Bar"], + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/web-idl/comment_feature.test b/package/src/prism/tests/languages/web-idl/comment_feature.test new file mode 100644 index 00000000..a4a1d8fa --- /dev/null +++ b/package/src/prism/tests/languages/web-idl/comment_feature.test @@ -0,0 +1,9 @@ +// comment +/* comment */ + +---------------------------------------------------- + +[ + ["comment", "// comment"], + ["comment", "/* comment */"] +] diff --git a/package/src/prism/tests/languages/web-idl/keyword_feature.test b/package/src/prism/tests/languages/web-idl/keyword_feature.test new file mode 100644 index 00000000..b3c3130c --- /dev/null +++ b/package/src/prism/tests/languages/web-idl/keyword_feature.test @@ -0,0 +1,55 @@ +async; +attribute; +callback; +const; +constructor; +deleter; +dictionary; +enum; +getter; +includes; +inherit; +interface; +mixin; +namespace; +null; +optional; +or; +partial; +readonly; +required; +setter; +static; +stringifier; +typedef; +unrestricted; + +---------------------------------------------------- + +[ + ["keyword", "async"], ["punctuation", ";"], + ["keyword", "attribute"], ["punctuation", ";"], + ["keyword", "callback"], ["punctuation", ";"], + ["keyword", "const"], ["punctuation", ";"], + ["keyword", "constructor"], ["punctuation", ";"], + ["keyword", "deleter"], ["punctuation", ";"], + ["keyword", "dictionary"], ["punctuation", ";"], + ["keyword", "enum"], ["punctuation", ";"], + ["keyword", "getter"], ["punctuation", ";"], + ["keyword", "includes"], ["punctuation", ";"], + ["keyword", "inherit"], ["punctuation", ";"], + ["keyword", "interface"], ["punctuation", ";"], + ["keyword", "mixin"], ["punctuation", ";"], + ["keyword", "namespace"], ["punctuation", ";"], + ["keyword", "null"], ["punctuation", ";"], + ["keyword", "optional"], ["punctuation", ";"], + ["keyword", "or"], ["punctuation", ";"], + ["keyword", "partial"], ["punctuation", ";"], + ["keyword", "readonly"], ["punctuation", ";"], + ["keyword", "required"], ["punctuation", ";"], + ["keyword", "setter"], ["punctuation", ";"], + ["keyword", "static"], ["punctuation", ";"], + ["keyword", "stringifier"], ["punctuation", ";"], + ["keyword", "typedef"], ["punctuation", ";"], + ["keyword", "unrestricted"], ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/web-idl/namespace_feature.test b/package/src/prism/tests/languages/web-idl/namespace_feature.test new file mode 100644 index 00000000..7ef2734e --- /dev/null +++ b/package/src/prism/tests/languages/web-idl/namespace_feature.test @@ -0,0 +1,30 @@ +namespace SomeNamespace { + /* namespace_members... */ +}; + +partial namespace SomeNamespace { + /* namespace_members... */ +}; + +---------------------------------------------------- + +[ + ["keyword", "namespace"], + ["namespace", "SomeNamespace"], + ["punctuation", "{"], + + ["comment", "/* namespace_members... */"], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "partial"], + ["keyword", "namespace"], + ["namespace", "SomeNamespace"], + ["punctuation", "{"], + + ["comment", "/* namespace_members... */"], + + ["punctuation", "}"], + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/web-idl/number_feature.test b/package/src/prism/tests/languages/web-idl/number_feature.test new file mode 100644 index 00000000..72d31737 --- /dev/null +++ b/package/src/prism/tests/languages/web-idl/number_feature.test @@ -0,0 +1,29 @@ +0xfff +123423 +-123423 + +123.456 +123.e64 +123.324e-4 +.324e+4 + +NaN +Infinity +-Infinity + +---------------------------------------------------- + +[ + ["number", "0xfff"], + ["number", "123423"], + ["number", "-123423"], + + ["number", "123.456"], + ["number", "123.e64"], + ["number", "123.324e-4"], + ["number", ".324e+4"], + + ["number", "NaN"], + ["number", "Infinity"], + ["number", "-Infinity"] +] diff --git a/package/src/prism/tests/languages/web-idl/operator_feature.test b/package/src/prism/tests/languages/web-idl/operator_feature.test new file mode 100644 index 00000000..b27e2864 --- /dev/null +++ b/package/src/prism/tests/languages/web-idl/operator_feature.test @@ -0,0 +1,14 @@ +... += : ? < > + +---------------------------------------------------- + +[ + ["operator", "..."], + + ["operator", "="], + ["operator", ":"], + ["operator", "?"], + ["operator", "<"], + ["operator", ">"] +] diff --git a/package/src/prism/tests/languages/web-idl/primitive-type_feature.test b/package/src/prism/tests/languages/web-idl/primitive-type_feature.test new file mode 100644 index 00000000..a56623fa --- /dev/null +++ b/package/src/prism/tests/languages/web-idl/primitive-type_feature.test @@ -0,0 +1,43 @@ +any +bigint +boolean +byte +double +float +iterable +long +maplike +object +octet +record +sequence +setlike +short +symbol +undefined +unsigned +void + +---------------------------------------------------- + +[ + ["keyword", "any"], + ["keyword", "bigint"], + ["keyword", "boolean"], + ["keyword", "byte"], + ["keyword", "double"], + ["keyword", "float"], + ["keyword", "iterable"], + ["keyword", "long"], + ["keyword", "maplike"], + ["keyword", "object"], + ["keyword", "octet"], + ["keyword", "record"], + ["keyword", "sequence"], + ["keyword", "setlike"], + ["keyword", "short"], + ["keyword", "symbol"], + ["keyword", "undefined"], + ["keyword", "unsigned"], + ["keyword", "void"] +] diff --git a/package/src/prism/tests/languages/web-idl/punctuation_feature.test b/package/src/prism/tests/languages/web-idl/punctuation_feature.test new file mode 100644 index 00000000..44370341 --- /dev/null +++ b/package/src/prism/tests/languages/web-idl/punctuation_feature.test @@ -0,0 +1,17 @@ +( ) [ ] { } +. , ; + +---------------------------------------------------- + +[ + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", "{"], + ["punctuation", "}"], + + ["punctuation", "."], + ["punctuation", ","], + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/languages/web-idl/string_feature.test b/package/src/prism/tests/languages/web-idl/string_feature.test new file mode 100644 index 00000000..c6f23ce4 --- /dev/null +++ b/package/src/prism/tests/languages/web-idl/string_feature.test @@ -0,0 +1,11 @@ +"" +"foo" +"\" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"foo\""], + ["string", "\"\\\""] +] diff --git a/package/src/prism/tests/languages/wgsl/attributes_feature.test b/package/src/prism/tests/languages/wgsl/attributes_feature.test new file mode 100644 index 00000000..9e729136 --- /dev/null +++ b/package/src/prism/tests/languages/wgsl/attributes_feature.test @@ -0,0 +1,209 @@ +@notAnAttribute +@align() +@binding() + +@builtin() + +@builtin(vertex_index) +@builtin(instance_index) +@builtin(position) + +@builtin(front_facing) +@builtin(frag_depth) +@builtin(sample_index) +@builtin(sample_mask) + +@builtin(local_invocation_id) +@builtin(local_invocation_index) +@builtin(global_invocation_id) +@builtin(workgroup_id) +@builtin(num_workgroups) + +@builtin(notABuiltInValue) +something.vertex_index; + +@const +@group() +@id() +@interpolate() +@invariant +@location() +@size() +@workgroup_size() + +@vertex +@fragment +@compute + +---------------------------------------------------- + +[ + ["punctuation", "@"], + "notAnAttribute\n", + + ["punctuation", "@"], + ["attributes", "align"], + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "@"], + ["attributes", "binding"], + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["built-in-values", "vertex_index"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["built-in-values", "instance_index"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["built-in-values", "position"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["built-in-values", "front_facing"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["built-in-values", "frag_depth"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["built-in-values", "sample_index"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["built-in-values", "sample_mask"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["built-in-values", "local_invocation_id"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["built-in-values", "local_invocation_index"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["built-in-values", "global_invocation_id"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["built-in-values", "workgroup_id"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + ["built-in-values", "num_workgroups"], + ["punctuation", ")"] + ]], + + ["punctuation", "@"], + ["builtin-attribute", [ + ["attribute", "builtin"], + ["punctuation", "("], + "notABuiltInValue", + ["punctuation", ")"] + ]], + + "\nsomething", + ["punctuation", "."], + "vertex_index", + ["punctuation", ";"], + + ["punctuation", "@"], + ["attributes", "const"], + + ["punctuation", "@"], + ["attributes", "group"], + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "@"], + ["attributes", "id"], + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "@"], + ["attributes", "interpolate"], + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "@"], + ["attributes", "invariant"], + + ["punctuation", "@"], + ["attributes", "location"], + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "@"], + ["attributes", "size"], + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "@"], + ["attributes", "workgroup_size"], + ["punctuation", "("], + ["punctuation", ")"], + + ["punctuation", "@"], ["attributes", "vertex"], + ["punctuation", "@"], ["attributes", "fragment"], + ["punctuation", "@"], ["attributes", "compute"] +] diff --git a/package/src/prism/tests/languages/wgsl/builtin_feature.test b/package/src/prism/tests/languages/wgsl/builtin_feature.test new file mode 100644 index 00000000..ac8d2733 --- /dev/null +++ b/package/src/prism/tests/languages/wgsl/builtin_feature.test @@ -0,0 +1,321 @@ +bool +i32 +u32 +f32 +i64 +u64 +f64 +vec2 +vec3 +vec4 +mat2x2 +mat2x3 +mat2x4 +mat3x2 +mat3x3 +mat3x4 +mat4x2 +mat4x3 +mat4x4 + +atomic +array + +override +ptr + +sampler +sampler_comparison +staticAssert + +texture_1d +texture_2d +texture_2d_array +texture_3d +texture_cube +texture_cube_array +texture_multisampled_2d +texture_storage_1d +texture_storage_2d +texture_storage_2d_array +texture_storage_3d +texture_depth_2d +texture_depth_2d_array +texture_depth_cube +texture_depth_cube_array +texture_depth_multisampled_2d + +staticAssert() + +all +any +select +abs +acos +acosh +asin +asinh +atan +atanh +atan2 +ceil +clamp +cos +cosh +cross +degrees +distance +exp +exp2 +faceForward +floor +fma +fract +frexp +inverseSqrt +ldexp +length +log +log2 +max +min +mix +modf +normalize +pow +quantizeToF16 +radians +reflect +refract +round +sign +sin +sinh +smoothstep +sqrt +step +tan +tanh +trunc +countLeadingZeros +countOneBits +countTrailingZeros +firstLeadingBit +extractBits +insertBits +reverseBits +shiftLeft +shiftRight +determinant +transpose +dot +dpdx +dpdxCoarse +dpdxFine +dpdy +dpdyCoarse +dpdyFine +fwidth +fwidthCoarse +fwidthFine +textureDimensions +textureGather +textureGatherCompare +textureLoad +textureNumLayers +textureNumLevels +textureNumSamples +textureSample +textureSampleBias +textureSampleCompare +textureSampleCompareLevel +textureSampleGrad +textureSampleLevel +textureStore +atomicLoad +atomicStore +atomicAdd +atomicSub +atomicMax +atomicMin +atomicAnd +atomicOr +atomicXor +atomicExchange +atomicCompareExchangeWeak +pack4x8snorm +pack4x8unorm +pack2x16snorm +pack2x16unorm +pack2x16float +unpack4x8snorm +unpack4x8unorm +unpack2x16snorm +unpack2x16unorm +unpack2x16float +storageBarrier +workgroupBarrier + +---------------------------------------------------- + +[ + ["builtin", "bool"], + ["builtin", "i32"], + ["builtin", "u32"], + ["builtin", "f32"], + ["builtin", "i64"], + ["builtin", "u64"], + ["builtin", "f64"], + ["builtin", "vec2"], + ["builtin", "vec3"], + ["builtin", "vec4"], + ["builtin", "mat2x2"], + ["builtin", "mat2x3"], + ["builtin", "mat2x4"], + ["builtin", "mat3x2"], + ["builtin", "mat3x3"], + ["builtin", "mat3x4"], + ["builtin", "mat4x2"], + ["builtin", "mat4x3"], + ["builtin", "mat4x4"], + + ["builtin", "atomic"], + ["builtin", "array"], + + ["builtin", "override"], + ["builtin", "ptr"], + + ["builtin", "sampler"], + ["builtin", "sampler_comparison"], + ["builtin", "staticAssert"], + + ["builtin", "texture_1d"], + ["builtin", "texture_2d"], + ["builtin", "texture_2d_array"], + ["builtin", "texture_3d"], + ["builtin", "texture_cube"], + ["builtin", "texture_cube_array"], + ["builtin", "texture_multisampled_2d"], + ["builtin", "texture_storage_1d"], + ["builtin", "texture_storage_2d"], + ["builtin", "texture_storage_2d_array"], + ["builtin", "texture_storage_3d"], + ["builtin", "texture_depth_2d"], + ["builtin", "texture_depth_2d_array"], + ["builtin", "texture_depth_cube"], + ["builtin", "texture_depth_cube_array"], + ["builtin", "texture_depth_multisampled_2d"], + + ["builtin", "staticAssert"], + ["punctuation", "("], + ["punctuation", ")"], + + ["builtin", "all"], + ["builtin", "any"], + ["builtin", "select"], + ["builtin", "abs"], + ["builtin", "acos"], + ["builtin", "acosh"], + ["builtin", "asin"], + ["builtin", "asinh"], + ["builtin", "atan"], + ["builtin", "atanh"], + ["builtin", "atan2"], + ["builtin", "ceil"], + ["builtin", "clamp"], + ["builtin", "cos"], + ["builtin", "cosh"], + ["builtin", "cross"], + ["builtin", "degrees"], + ["builtin", "distance"], + ["builtin", "exp"], + ["builtin", "exp2"], + ["builtin", "faceForward"], + ["builtin", "floor"], + ["builtin", "fma"], + ["builtin", "fract"], + ["builtin", "frexp"], + ["builtin", "inverseSqrt"], + ["builtin", "ldexp"], + ["builtin", "length"], + ["builtin", "log"], + ["builtin", "log2"], + ["builtin", "max"], + ["builtin", "min"], + ["builtin", "mix"], + ["builtin", "modf"], + ["builtin", "normalize"], + ["builtin", "pow"], + ["builtin", "quantizeToF16"], + ["builtin", "radians"], + ["builtin", "reflect"], + ["builtin", "refract"], + ["builtin", "round"], + ["builtin", "sign"], + ["builtin", "sin"], + ["builtin", "sinh"], + ["builtin", "smoothstep"], + ["builtin", "sqrt"], + ["builtin", "step"], + ["builtin", "tan"], + ["builtin", "tanh"], + ["builtin", "trunc"], + ["builtin", "countLeadingZeros"], + ["builtin", "countOneBits"], + ["builtin", "countTrailingZeros"], + ["builtin", "firstLeadingBit"], + ["builtin", "extractBits"], + ["builtin", "insertBits"], + ["builtin", "reverseBits"], + ["builtin", "shiftLeft"], + ["builtin", "shiftRight"], + ["builtin", "determinant"], + ["builtin", "transpose"], + ["builtin", "dot"], + ["builtin", "dpdx"], + ["builtin", "dpdxCoarse"], + ["builtin", "dpdxFine"], + ["builtin", "dpdy"], + ["builtin", "dpdyCoarse"], + ["builtin", "dpdyFine"], + ["builtin", "fwidth"], + ["builtin", "fwidthCoarse"], + ["builtin", "fwidthFine"], + ["builtin", "textureDimensions"], + ["builtin", "textureGather"], + ["builtin", "textureGatherCompare"], + ["builtin", "textureLoad"], + ["builtin", "textureNumLayers"], + ["builtin", "textureNumLevels"], + ["builtin", "textureNumSamples"], + ["builtin", "textureSample"], + ["builtin", "textureSampleBias"], + ["builtin", "textureSampleCompare"], + ["builtin", "textureSampleCompareLevel"], + ["builtin", "textureSampleGrad"], + ["builtin", "textureSampleLevel"], + ["builtin", "textureStore"], + ["builtin", "atomicLoad"], + ["builtin", "atomicStore"], + ["builtin", "atomicAdd"], + ["builtin", "atomicSub"], + ["builtin", "atomicMax"], + ["builtin", "atomicMin"], + ["builtin", "atomicAnd"], + ["builtin", "atomicOr"], + ["builtin", "atomicXor"], + ["builtin", "atomicExchange"], + ["builtin", "atomicCompareExchangeWeak"], + ["builtin", "pack4x8snorm"], + ["builtin", "pack4x8unorm"], + ["builtin", "pack2x16snorm"], + ["builtin", "pack2x16unorm"], + ["builtin", "pack2x16float"], + ["builtin", "unpack4x8snorm"], + ["builtin", "unpack4x8unorm"], + ["builtin", "unpack2x16snorm"], + ["builtin", "unpack2x16unorm"], + ["builtin", "unpack2x16float"], + ["builtin", "storageBarrier"], + ["builtin", "workgroupBarrier"] +] diff --git a/package/src/prism/tests/languages/wgsl/class_name_feature.test b/package/src/prism/tests/languages/wgsl/class_name_feature.test new file mode 100644 index 00000000..e7918630 --- /dev/null +++ b/package/src/prism/tests/languages/wgsl/class_name_feature.test @@ -0,0 +1,9 @@ +ClassName +notAClassName + +---------------------------------------------------- + +[ + ["class-name", "ClassName"], + "\nnotAClassName" +] diff --git a/package/src/prism/tests/languages/wgsl/comment_feature.test b/package/src/prism/tests/languages/wgsl/comment_feature.test new file mode 100644 index 00000000..a8893edb --- /dev/null +++ b/package/src/prism/tests/languages/wgsl/comment_feature.test @@ -0,0 +1,15 @@ +//test +// test + +/* multi + line + comment */ + +---------------------------------------------------- + +[ + ["comment", "//test"], + ["comment", "// test"], + + ["comment", "/* multi\n line\n comment */"] +] diff --git a/package/src/prism/tests/languages/wgsl/function_feature.test b/package/src/prism/tests/languages/wgsl/function_feature.test new file mode 100644 index 00000000..f60b075d --- /dev/null +++ b/package/src/prism/tests/languages/wgsl/function_feature.test @@ -0,0 +1,26 @@ +fn my_function() -> bool { + my_function(); + return true; +} + +---------------------------------------------------- + +[ + ["keyword", "fn"], + ["functions", "my_function"], + ["punctuation", "("], + ["punctuation", ")"], + ["operator", "->"], + ["builtin", "bool"], + ["punctuation", "{"], + + ["function-calls", "my_function"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", ";"], + ["keyword", "return"], + ["bool-literal", "true"], + ["punctuation", ";"], + + ["punctuation", "}"] +] diff --git a/package/src/prism/tests/languages/wgsl/keyword_feature.test b/package/src/prism/tests/languages/wgsl/keyword_feature.test new file mode 100644 index 00000000..f42ea39d --- /dev/null +++ b/package/src/prism/tests/languages/wgsl/keyword_feature.test @@ -0,0 +1,59 @@ +bitcast +break +case +const +continue +continuing +default +discard +else +enable +fallthrough +fn +for +function +if +let +loop +private +return +storage +struct +switch +type +uniform +var +while +workgroup + +---------------------------------------------------- + +[ + ["keyword", "bitcast"], + ["keyword", "break"], + ["keyword", "case"], + ["keyword", "const"], + ["keyword", "continue"], + ["keyword", "continuing"], + ["keyword", "default"], + ["keyword", "discard"], + ["keyword", "else"], + ["keyword", "enable"], + ["keyword", "fallthrough"], + ["keyword", "fn"], + ["keyword", "for"], + ["keyword", "function"], + ["keyword", "if"], + ["keyword", "let"], + ["keyword", "loop"], + ["keyword", "private"], + ["keyword", "return"], + ["keyword", "storage"], + ["keyword", "struct"], + ["keyword", "switch"], + ["keyword", "type"], + ["keyword", "uniform"], + ["keyword", "var"], + ["keyword", "while"], + ["keyword", "workgroup"] +] diff --git a/package/src/prism/tests/languages/wgsl/literal_feature.test b/package/src/prism/tests/languages/wgsl/literal_feature.test new file mode 100644 index 00000000..4f414b99 --- /dev/null +++ b/package/src/prism/tests/languages/wgsl/literal_feature.test @@ -0,0 +1,57 @@ +0x123 +0X123u +1u +123 +0 +0i +0x3f + +0.e+4f +01. +.01 +12.34 +.0f +0h +1e-3 +0xa.fp+2 +0x1P+4f +0X.3 +0x3p+2h +0X1.fp-4 +0x3.2p+2h + +true +false + +notALiteral20x3f + +---------------------------------------------------- + +[ + ["hex-int-literal", "0x123"], + ["hex-int-literal", "0X123u"], + ["int-literal", "1u"], + ["int-literal", "123"], + ["int-literal", "0"], + ["int-literal", "0i"], + ["hex-int-literal", "0x3f"], + + ["decimal-float-literal", "0.e+4f"], + ["decimal-float-literal", "01."], + ["decimal-float-literal", ".01"], + ["decimal-float-literal", "12.34"], + ["decimal-float-literal", ".0f"], + ["decimal-float-literal", "0h"], + ["decimal-float-literal", "1e-3"], + ["hex-float-literal", "0xa.fp+2"], + ["hex-float-literal", "0x1P+4f"], + ["hex-float-literal", "0X.3"], + ["hex-float-literal", "0x3p+2h"], + ["hex-float-literal", "0X1.fp-4"], + ["hex-float-literal", "0x3.2p+2h"], + + ["bool-literal", "true"], + ["bool-literal", "false"], + + "\n\nnotALiteral20x3f" +] diff --git a/package/src/prism/tests/languages/wgsl/operator_feature.test b/package/src/prism/tests/languages/wgsl/operator_feature.test new file mode 100644 index 00000000..c7f51e19 --- /dev/null +++ b/package/src/prism/tests/languages/wgsl/operator_feature.test @@ -0,0 +1,69 @@ +^ +~ +| +|| +&& +<< +>> +! +& ++= +-= +*= +/= +%= +^= +&= +|= +<<= +>>= += +== +!= +<= +>= ++ +++ +% +* +- +-- +/ +-> + +---------------------------------------------------- + +[ + ["operator", "^"], + ["operator", "~"], + ["operator", "|"], + ["operator", "||"], + ["operator", "&&"], + ["operator", "<<"], + ["operator", ">>"], + ["operator", "!"], + ["operator", "&"], + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + ["operator", "%="], + ["operator", "^="], + ["operator", "&="], + ["operator", "|="], + ["operator", "<<="], + ["operator", ">>="], + ["operator", "="], + ["operator", "=="], + ["operator", "!="], + ["operator", "<="], + ["operator", ">="], + ["operator", "+"], + ["operator", "++"], + ["operator", "%"], + ["operator", "*"], + ["operator", "-"], + ["operator", "--"], + ["operator", "/"], + ["operator", "->"] +] diff --git a/package/src/prism/tests/languages/wgsl/punctuation_feature.test b/package/src/prism/tests/languages/wgsl/punctuation_feature.test new file mode 100644 index 00000000..d1a97468 --- /dev/null +++ b/package/src/prism/tests/languages/wgsl/punctuation_feature.test @@ -0,0 +1,31 @@ +@ +( +) +{ +} +[ +] +, +; +< +> +: +. + +---------------------------------------------------- + +[ + ["punctuation", "@"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"], + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", "<"], + ["punctuation", ">"], + ["punctuation", ":"], + ["punctuation", "."] +] diff --git a/package/src/prism/tests/languages/wiki/block-comment_feature.test b/package/src/prism/tests/languages/wiki/block-comment_feature.test new file mode 100644 index 00000000..4ecc14e8 --- /dev/null +++ b/package/src/prism/tests/languages/wiki/block-comment_feature.test @@ -0,0 +1,16 @@ +/**/ +/* foo */ +/* foo +bar */ + +---------------------------------------------------- + +[ + ["block-comment", "/**/"], + ["block-comment", "/* foo */"], + ["block-comment", "/* foo\nbar */"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/wiki/emphasis_feature.test b/package/src/prism/tests/languages/wiki/emphasis_feature.test new file mode 100644 index 00000000..569453cf --- /dev/null +++ b/package/src/prism/tests/languages/wiki/emphasis_feature.test @@ -0,0 +1,27 @@ +'''''foo''''' +'''bar''' +''baz'' + +---------------------------------------------------- + +[ + ["emphasis", [ + ["punctuation", "'''''"], + ["bold-italic", "foo"], + ["punctuation", "'''''"] + ]], + ["emphasis", [ + ["punctuation", "'''"], + ["bold", "bar"], + ["punctuation", "'''"] + ]], + ["emphasis", [ + ["punctuation", "''"], + ["italic", "baz"], + ["punctuation", "''"] + ]] +] + +---------------------------------------------------- + +Checks for bold and italic. diff --git a/package/src/prism/tests/languages/wiki/heading_feature.test b/package/src/prism/tests/languages/wiki/heading_feature.test new file mode 100644 index 00000000..500d6529 --- /dev/null +++ b/package/src/prism/tests/languages/wiki/heading_feature.test @@ -0,0 +1,33 @@ += Header 1 = +== Header 2 == +=== Header 3 === +==== Header 4 ==== +===== Header 5 ===== +====== Header 6 ====== + +---------------------------------------------------- + +[ + ["heading", [ + ["punctuation", "="], ["important", " Header 1 "], ["punctuation", "="] + ]], + ["heading", [ + ["punctuation", "=="], ["important", " Header 2 "], ["punctuation", "=="] + ]], + ["heading", [ + ["punctuation", "==="], ["important", " Header 3 "], ["punctuation", "==="] + ]], + ["heading", [ + ["punctuation", "===="], ["important", " Header 4 "], ["punctuation", "===="] + ]], + ["heading", [ + ["punctuation", "====="], ["important", " Header 5 "], ["punctuation", "====="] + ]], + ["heading", [ + ["punctuation", "======"], ["important", " Header 6 "], ["punctuation", "======"] + ]] +] + +---------------------------------------------------- + +Checks for titles. \ No newline at end of file diff --git a/package/src/prism/tests/languages/wiki/hr_feature.test b/package/src/prism/tests/languages/wiki/hr_feature.test new file mode 100644 index 00000000..d99083d9 --- /dev/null +++ b/package/src/prism/tests/languages/wiki/hr_feature.test @@ -0,0 +1,13 @@ +---- +----- + +---------------------------------------------------- + +[ + ["hr", "----"], + ["hr", "-----"] +] + +---------------------------------------------------- + +Checks for horizontal rows. \ No newline at end of file diff --git a/package/src/prism/tests/languages/wiki/nowiki_feature.test b/package/src/prism/tests/languages/wiki/nowiki_feature.test new file mode 100644 index 00000000..72d986b5 --- /dev/null +++ b/package/src/prism/tests/languages/wiki/nowiki_feature.test @@ -0,0 +1,51 @@ +{{foo}} ''bar'' +{{foo}} ''bar'' +
    {{foo}} ''bar'' 
    + +---------------------------------------------------- + +[ + ["nowiki", [ + ["tag", [ + ["punctuation", "<"], + ["tag", ["nowiki"]], + ["punctuation", ">"] + ]], + "{{foo}} ''bar'' ", + ["tag", [ + ["punctuation", ""] + ]] + ]], + ["nowiki", [ + ["tag", [ + ["punctuation", "<"], + ["tag", ["source"]], + ["punctuation", ">"] + ]], + "{{foo}} ''bar'' ", + ["tag", [ + ["punctuation", ""] + ]] + ]], + ["nowiki", [ + ["tag", [ + ["punctuation", "<"], + ["tag", ["pre"]], + ["punctuation", ">"] + ]], + "{{foo}} ''bar'' ", + ["tag", [ + ["punctuation", ""] + ]] + ]] +] + +---------------------------------------------------- + +Checks that no highlighting is done inside ,
     and  tags.
    diff --git a/package/src/prism/tests/languages/wiki/symbol_feature.test b/package/src/prism/tests/languages/wiki/symbol_feature.test
    new file mode 100644
    index 00000000..af99fdc8
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wiki/symbol_feature.test
    @@ -0,0 +1,17 @@
    +#REDIRECT [[somewhere]]
    +~~~
    +~~~~
    +~~~~~
    +
    +----------------------------------------------------
    +
    +[
    +	["symbol", "#REDIRECT"], ["url", "[[somewhere]]"],
    +	["symbol", "~~~"],
    +	["symbol", "~~~~"],
    +	["symbol", "~~~~~"]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for redirects and signatures.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/wiki/url_feature.test b/package/src/prism/tests/languages/wiki/url_feature.test
    new file mode 100644
    index 00000000..cc8fd5b0
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wiki/url_feature.test
    @@ -0,0 +1,29 @@
    +[[w:en:Formal_grammar|Formal grammar]]
    +[http://www.cl.cam.ac.uk/~mgk25/iso-ebnf.html EBNF help]
    +
    +ISBN 1234567890
    +ISBN 123456789x
    +ISBN      1 2 3-4-5 6789 X
    +ISBN 978-9999999999
    +
    +RFC 822
    +PMID 822
    +
    +----------------------------------------------------
    +
    +[
    +	["url", "[[w:en:Formal_grammar|Formal grammar]]"],
    +	["url", "[http://www.cl.cam.ac.uk/~mgk25/iso-ebnf.html EBNF help]"],
    +
    +	["url", "ISBN 1234567890"],
    +	["url", "ISBN 123456789x"],
    +	["url", "ISBN      1 2 3-4-5 6789 X"],
    +	["url", "ISBN 978-9999999999"],
    +
    +	["url", "RFC 822"],
    +	["url", "PMID 822"]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for links, ISBN, RFC and PMID.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/wiki/variable_feature.test b/package/src/prism/tests/languages/wiki/variable_feature.test
    new file mode 100644
    index 00000000..8327de38
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wiki/variable_feature.test
    @@ -0,0 +1,19 @@
    +__NOTOC__
    +{{{1}}}
    +{{!}}
    +{{SITENAME}}
    +{{#ifexists:foo}}
    +
    +----------------------------------------------------
    +
    +[
    +	["variable", "__NOTOC__"],
    +	["variable", "{{{1}}}"],
    +	["variable", "{{!}}"],
    +	["variable", "{{SITENAME}}"],
    +	["variable", "{{#ifexists:foo}}"]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for variables and magic words.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/wolfram/black_feature.test b/package/src/prism/tests/languages/wolfram/black_feature.test
    new file mode 100644
    index 00000000..33d87d5e
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wolfram/black_feature.test
    @@ -0,0 +1,9 @@
    +__
    +x__
    +
    +----------------------------------------------------
    +
    +[
    +	["blank", "__"],
    +	["blank", "x__"]
    +]
    diff --git a/package/src/prism/tests/languages/wolfram/boolean_feature.test b/package/src/prism/tests/languages/wolfram/boolean_feature.test
    new file mode 100644
    index 00000000..ab588bf9
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wolfram/boolean_feature.test
    @@ -0,0 +1,19 @@
    +True
    +False
    +0
    +1
    +None
    +
    +----------------------------------------------------
    +
    +[
    +	["boolean", "True"],
    +	["boolean", "False"],
    +	["number", "0"],
    +	["number", "1"],
    +	["keyword", "None"]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for booleans.
    diff --git a/package/src/prism/tests/languages/wolfram/comment_feature.test b/package/src/prism/tests/languages/wolfram/comment_feature.test
    new file mode 100644
    index 00000000..a748243a
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wolfram/comment_feature.test
    @@ -0,0 +1,17 @@
    +(* foo
    +bar *)
    +(* foo
    +(* bar *)
    +*)
    +
    +----------------------------------------------------
    +
    +[
    +	["comment", "(* foo\nbar *)"],
    +	["comment", "(* foo\n(* bar *)\n*)"]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for multi-line comments.
    +Also checks for one level of nesting.
    diff --git a/package/src/prism/tests/languages/wolfram/context_feature.test b/package/src/prism/tests/languages/wolfram/context_feature.test
    new file mode 100644
    index 00000000..871beb18
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wolfram/context_feature.test
    @@ -0,0 +1,9 @@
    +Global`
    +System`Foo
    +
    +----------------------------------------------------
    +
    +[
    +	["context", "Global`"],
    +	["context", "System`Foo"]
    +]
    diff --git a/package/src/prism/tests/languages/wolfram/keyword_feature.test b/package/src/prism/tests/languages/wolfram/keyword_feature.test
    new file mode 100644
    index 00000000..88144e07
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wolfram/keyword_feature.test
    @@ -0,0 +1,41 @@
    +Abs
    +AbsArg
    +Accuracy
    +Block
    +Do
    +For
    +Function
    +If
    +Manipulate
    +Module
    +Nest
    +NestList
    +None
    +Return
    +Switch
    +Table
    +Which
    +While
    +
    +----------------------------------------------------
    +
    +[
    +	["keyword", "Abs"],
    +	["keyword", "AbsArg"],
    +	["keyword", "Accuracy"],
    +	["keyword", "Block"],
    +	["keyword", "Do"],
    +	["keyword", "For"],
    +	["keyword", "Function"],
    +	["keyword", "If"],
    +	["keyword", "Manipulate"],
    +	["keyword", "Module"],
    +	["keyword", "Nest"],
    +	["keyword", "NestList"],
    +	["keyword", "None"],
    +	["keyword", "Return"],
    +	["keyword", "Switch"],
    +	["keyword", "Table"],
    +	["keyword", "Which"],
    +	["keyword", "While"]
    +]
    diff --git a/package/src/prism/tests/languages/wolfram/operator_feature.test b/package/src/prism/tests/languages/wolfram/operator_feature.test
    new file mode 100644
    index 00000000..d4c19546
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wolfram/operator_feature.test
    @@ -0,0 +1,27 @@
    +@ //
    +/@ @@ @@@ 
    +/ /=  //=
    +> >= <=
    +>> <<
    ++ - ^ *
    += == ===
    +:= =.
    +!= =!=
    +
    +----------------------------------------------------
    +
    +[
    +	["operator", "@"], ["operator", "//"],
    +	["operator", "/@"], ["operator", "@@"], ["operator", "@@@"],
    +	["operator", "/"], ["operator", "/="], ["operator", "//="],
    +	["operator", ">"], ["operator", ">="], ["operator", "<="],
    +	["operator", ">>"], ["operator", "<<"],
    +	["operator", "+"], ["operator", "-"], ["operator", "^"], ["operator", "*"],
    +	["operator", "="], ["operator", "=="], ["operator", "==="],
    +	["operator", ":="], ["operator", "=."],
    +	["operator", "!="], ["operator", "=!="]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for all operators.
    diff --git a/package/src/prism/tests/languages/wolfram/punctuation_feature.test b/package/src/prism/tests/languages/wolfram/punctuation_feature.test
    new file mode 100644
    index 00000000..73912910
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wolfram/punctuation_feature.test
    @@ -0,0 +1,18 @@
    +{ } [ ] ( )
    +, ; . :
    +
    +----------------------------------------------------
    +
    +[
    +	["punctuation", "{"],
    +	["punctuation", "}"],
    +	["punctuation", "["],
    +	["punctuation", "]"],
    +	["punctuation", "("],
    +	["punctuation", ")"],
    +
    +	["punctuation", ","],
    +	["operator", ";"],
    +	["punctuation", "."],
    +	["punctuation", ":"]
    +]
    diff --git a/package/src/prism/tests/languages/wolfram/string_feature.test b/package/src/prism/tests/languages/wolfram/string_feature.test
    new file mode 100644
    index 00000000..841c4713
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wolfram/string_feature.test
    @@ -0,0 +1,15 @@
    +""
    +"foo"
    +"fo\"obar"
    +
    +----------------------------------------------------
    +
    +[
    +	["string", "\"\""],
    +	["string", "\"foo\""],
    +	["string", "\"fo\\\"obar\""]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for strings.
    diff --git a/package/src/prism/tests/languages/wren/attribute_feature.test b/package/src/prism/tests/languages/wren/attribute_feature.test
    new file mode 100644
    index 00000000..b72b847e
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wren/attribute_feature.test
    @@ -0,0 +1,91 @@
    +#hidden = true
    +class Example {}
    +
    +#key
    +#key = value
    +#group(
    +  multiple,
    +  lines = true,
    +  lines = 0
    +)
    +class Example {
    +  #test(skip = true, iterations = 32)
    +  doStuff() {}
    +}
    +
    +#doc = "not runtime data"
    +#!runtimeAccess = true
    +#!maxIterations = 16
    +
    +----------------------------------------------------
    +
    +[
    +	["attribute", "#hidden"],
    +	["operator", "="],
    +	["boolean", "true"],
    +
    +	["keyword", "class"],
    +	["class-name", "Example"],
    +	["punctuation", "{"],
    +	["punctuation", "}"],
    +
    +	["attribute", "#key"],
    +
    +	["attribute", "#key"],
    +	["operator", "="],
    +	" value\n",
    +
    +	["attribute", "#group"],
    +	["punctuation", "("],
    +
    +	"\n  multiple",
    +	["punctuation", ","],
    +
    +	"\n  lines ",
    +	["operator", "="],
    +	["boolean", "true"],
    +	["punctuation", ","],
    +
    +	"\n  lines ",
    +	["operator", "="],
    +	["number", "0"],
    +
    +	["punctuation", ")"],
    +
    +	["keyword", "class"],
    +	["class-name", "Example"],
    +	["punctuation", "{"],
    +
    +	["attribute", "#test"],
    +	["punctuation", "("],
    +	"skip ",
    +	["operator", "="],
    +	["boolean", "true"],
    +	["punctuation", ","],
    +	" iterations ",
    +	["operator", "="],
    +	["number", "32"],
    +	["punctuation", ")"],
    +
    +	["function", "doStuff"],
    +	["punctuation", "("],
    +	["punctuation", ")"],
    +	["punctuation", "{"],
    +	["punctuation", "}"],
    +
    +	["punctuation", "}"],
    +
    +	["attribute", "#doc"],
    +	["operator", "="],
    +	["string-literal", [
    +		["string", "\"not runtime data\""]
    +	]],
    +
    +	["attribute", "#!runtimeAccess"],
    +	["operator", "="],
    +	["boolean", "true"],
    +
    +	["attribute", "#!maxIterations"],
    +	["operator", "="],
    +	["number", "16"]
    +]
    diff --git a/package/src/prism/tests/languages/wren/boolean_feature.test b/package/src/prism/tests/languages/wren/boolean_feature.test
    new file mode 100644
    index 00000000..d342140d
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wren/boolean_feature.test
    @@ -0,0 +1,9 @@
    +true
    +false
    +
    +----------------------------------------------------
    +
    +[
    +	["boolean", "true"],
    +	["boolean", "false"]
    +]
    diff --git a/package/src/prism/tests/languages/wren/class-name_feature.test b/package/src/prism/tests/languages/wren/class-name_feature.test
    new file mode 100644
    index 00000000..e2e70d94
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wren/class-name_feature.test
    @@ -0,0 +1,35 @@
    +Foo.bar()
    +
    +import "beverages" for Coffee, Tea
    +
    +class Foo {}
    +class foo {}
    +
    +----------------------------------------------------
    +
    +[
    +	["class-name", "Foo"],
    +	["punctuation", "."],
    +	["function", "bar"],
    +	["punctuation", "("],
    +	["punctuation", ")"],
    +
    +	["keyword", "import"],
    +	["string-literal", [
    +		["string", "\"beverages\""]
    +	]],
    +	["keyword", "for"],
    +	["class-name", "Coffee"],
    +	["punctuation", ","],
    +	["class-name", "Tea"],
    +
    +	["keyword", "class"],
    +	["class-name", "Foo"],
    +	["punctuation", "{"],
    +	["punctuation", "}"],
    +
    +	["keyword", "class"],
    +	["class-name", "foo"],
    +	["punctuation", "{"],
    +	["punctuation", "}"]
    +]
    diff --git a/package/src/prism/tests/languages/wren/comment_feature.test b/package/src/prism/tests/languages/wren/comment_feature.test
    new file mode 100644
    index 00000000..ebd45fb3
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wren/comment_feature.test
    @@ -0,0 +1,21 @@
    +// comment
    +
    +/**/
    +/* comment */
    +
    +/*
    +/*
    +nested comment
    +*/
    +*/
    +
    +----------------------------------------------------
    +
    +[
    +	["comment", "// comment"],
    +
    +	["comment", "/**/"],
    +	["comment", "/* comment */"],
    +
    +	["comment", "/*\n/*\nnested comment\n*/\n*/"]
    +]
    diff --git a/package/src/prism/tests/languages/wren/constant_feature.test b/package/src/prism/tests/languages/wren/constant_feature.test
    new file mode 100644
    index 00000000..49adc667
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wren/constant_feature.test
    @@ -0,0 +1,7 @@
    +FOO
    +
    +----------------------------------------------------
    +
    +[
    +	["constant", "FOO"]
    +]
    diff --git a/package/src/prism/tests/languages/wren/function_feature.test b/package/src/prism/tests/languages/wren/function_feature.test
    new file mode 100644
    index 00000000..ccde12e1
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wren/function_feature.test
    @@ -0,0 +1,19 @@
    +foo()
    +
    +foo {|x| x * 2}
    +
    +----------------------------------------------------
    +
    +[
    +	["function", "foo"], ["punctuation", "("], ["punctuation", ")"],
    +
    +	["function", "foo"],
    +	["punctuation", "{"],
    +	["operator", "|"],
    +	"x",
    +	["operator", "|"],
    +	" x ",
    +	["operator", "*"],
    +	["number", "2"],
    +	["punctuation", "}"]
    +]
    diff --git a/package/src/prism/tests/languages/wren/hashbang_feature.test b/package/src/prism/tests/languages/wren/hashbang_feature.test
    new file mode 100644
    index 00000000..cd9e4a66
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wren/hashbang_feature.test
    @@ -0,0 +1,7 @@
    +#!/usr/bin/env wren
    +
    +----------------------------------------------------
    +
    +[
    +	["hashbang", "#!/usr/bin/env wren"]
    +]
    diff --git a/package/src/prism/tests/languages/wren/keyword_feature.test b/package/src/prism/tests/languages/wren/keyword_feature.test
    new file mode 100644
    index 00000000..23f1ee90
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wren/keyword_feature.test
    @@ -0,0 +1,45 @@
    +as;
    +break;
    +class;
    +construct;
    +continue;
    +else;
    +for;
    +foreign;
    +if;
    +import;
    +in;
    +is;
    +return;
    +static;
    +super;
    +this;
    +var;
    +while;
    +
    +null
    +
    +----------------------------------------------------
    +
    +[
    +	["keyword", "as"], ["punctuation", ";"],
    +	["keyword", "break"], ["punctuation", ";"],
    +	["keyword", "class"], ["punctuation", ";"],
    +	["keyword", "construct"], ["punctuation", ";"],
    +	["keyword", "continue"], ["punctuation", ";"],
    +	["keyword", "else"], ["punctuation", ";"],
    +	["keyword", "for"], ["punctuation", ";"],
    +	["keyword", "foreign"], ["punctuation", ";"],
    +	["keyword", "if"], ["punctuation", ";"],
    +	["keyword", "import"], ["punctuation", ";"],
    +	["keyword", "in"], ["punctuation", ";"],
    +	["keyword", "is"], ["punctuation", ";"],
    +	["keyword", "return"], ["punctuation", ";"],
    +	["keyword", "static"], ["punctuation", ";"],
    +	["keyword", "super"], ["punctuation", ";"],
    +	["keyword", "this"], ["punctuation", ";"],
    +	["keyword", "var"], ["punctuation", ";"],
    +	["keyword", "while"], ["punctuation", ";"],
    +
    +	["null", "null"]
    +]
    diff --git a/package/src/prism/tests/languages/wren/number_feature.test b/package/src/prism/tests/languages/wren/number_feature.test
    new file mode 100644
    index 00000000..7b34e9f4
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wren/number_feature.test
    @@ -0,0 +1,25 @@
    +0
    +1234
    +-5678
    +3.14159
    +1.0
    +-12.34
    +0.0314159e02
    +0.0314159e+02
    +314.159e-02
    +0xcaffe2
    +
    +----------------------------------------------------
    +
    +[
    +	["number", "0"],
    +	["number", "1234"],
    +	["operator", "-"], ["number", "5678"],
    +	["number", "3.14159"],
    +	["number", "1.0"],
    +	["operator", "-"], ["number", "12.34"],
    +	["number", "0.0314159e02"],
    +	["number", "0.0314159e+02"],
    +	["number", "314.159e-02"],
    +	["number", "0xcaffe2"]
    +]
    diff --git a/package/src/prism/tests/languages/wren/operator_feature.test b/package/src/prism/tests/languages/wren/operator_feature.test
    new file mode 100644
    index 00000000..3693ebd9
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wren/operator_feature.test
    @@ -0,0 +1,55 @@
    +! ~ -
    +* / % + -
    +.. ...
    +<< >>
    +< <= > >= == !=
    +& ^ |
    +=
    +
    +&& ||
    +? :
    +
    +1..2 1...3
    +
    +----------------------------------------------------
    +
    +[
    +	["operator", "!"],
    +	["operator", "~"],
    +	["operator", "-"],
    +
    +	["operator", "*"],
    +	["operator", "/"],
    +	["operator", "%"],
    +	["operator", "+"],
    +	["operator", "-"],
    +
    +	["operator", ".."],
    +	["operator", "..."],
    +
    +	["operator", "<<"],
    +	["operator", ">>"],
    +
    +	["operator", "<"],
    +	["operator", "<="],
    +	["operator", ">"],
    +	["operator", ">="],
    +	["operator", "=="],
    +	["operator", "!="],
    +
    +	["operator", "&"],
    +	["operator", "^"],
    +	["operator", "|"],
    +
    +	["operator", "="],
    +
    +	["operator", "&&"], ["operator", "||"],
    +	["operator", "?"], ["operator", ":"],
    +
    +	["number", "1"],
    +	["operator", ".."],
    +	["number", "2"],
    +	["number", "1"],
    +	["operator", "..."],
    +	["number", "3"]
    +]
    diff --git a/package/src/prism/tests/languages/wren/punctuation_feature.test b/package/src/prism/tests/languages/wren/punctuation_feature.test
    new file mode 100644
    index 00000000..472d052f
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wren/punctuation_feature.test
    @@ -0,0 +1,17 @@
    +( ) [ ] { }
    +, ; .
    +
    +----------------------------------------------------
    +
    +[
    +	["punctuation", "("],
    +	["punctuation", ")"],
    +	["punctuation", "["],
    +	["punctuation", "]"],
    +	["punctuation", "{"],
    +	["punctuation", "}"],
    +
    +	["punctuation", ","],
    +	["punctuation", ";"],
    +	["punctuation", "."]
    +]
    diff --git a/package/src/prism/tests/languages/wren/string_feature.test b/package/src/prism/tests/languages/wren/string_feature.test
    new file mode 100644
    index 00000000..f1a41fe6
    --- /dev/null
    +++ b/package/src/prism/tests/languages/wren/string_feature.test
    @@ -0,0 +1,60 @@
    +""
    +"\"\\"
    +"foo
    +bar"
    +
    +""""""
    +"""
    +foo
    +bar
    +"""
    +"""
    +  {
    +    "hello": "wren",
    +    "from" : "json"
    +  }
    +"""
    +
    +"foo %(bar)"
    +"foo * %(1 + 2) ~= bar"
    +
    +----------------------------------------------------
    +
    +[
    +	["string-literal", [
    +		["string", "\"\""]
    +	]],
    +	["string-literal", [
    +		["string", "\"\\\"\\\\\""]
    +	]],
    +	["string-literal", [
    +		["string", "\"foo\nbar\""]
    +	]],
    +
    +	["triple-quoted-string", "\"\"\"\"\"\""],
    +	["triple-quoted-string", "\"\"\"\nfoo\nbar\n\"\"\""],
    +	["triple-quoted-string", "\"\"\"\n  {\n    \"hello\": \"wren\",\n    \"from\" : \"json\"\n  }\n\"\"\""],
    +
    +	["string-literal", [
    +		["string", "\"foo "],
    +		["interpolation", [
    +			["interpolation-punctuation", "%("],
    +			["expression", ["bar"]],
    +			["interpolation-punctuation", ")"]
    +		]],
    +		["string", "\""]
    +	]],
    +	["string-literal", [
    +		["string", "\"foo * "],
    +		["interpolation", [
    +			["interpolation-punctuation", "%("],
    +			["expression", [
    +				["number", "1"],
    +				["operator", "+"],
    +				["number", "2"]
    +			]],
    +			["interpolation-punctuation", ")"]
    +		]],
    +		["string", " ~= bar\""]
    +	]]
    +]
    diff --git a/package/src/prism/tests/languages/xeora/constant_feature.test b/package/src/prism/tests/languages/xeora/constant_feature.test
    new file mode 100644
    index 00000000..3c2ac107
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xeora/constant_feature.test
    @@ -0,0 +1,15 @@
    +$DomainContents$
    +$PageRenderDuration$
    +
    +----------------------------------------------------
    +
    +[
    +	["constant", [
    +		["punctuation", "$"], "DomainContents", ["punctuation", "$"]]],
    +	["constant", [
    +		["punctuation", "$"], "PageRenderDuration", ["punctuation", "$"]]]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for constants.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/xeora/directive-block-close_feature.test b/package/src/prism/tests/languages/xeora/directive-block-close_feature.test
    new file mode 100644
    index 00000000..e8ec2985
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xeora/directive-block-close_feature.test
    @@ -0,0 +1,12 @@
    +}:Control3$
    +
    +----------------------------------------------------
    +
    +[
    +	["directive-block-close", [
    +		["punctuation", "}"], ["punctuation", ":"], "Control3", ["punctuation", "$"]]]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for directive-block-closes.
    diff --git a/package/src/prism/tests/languages/xeora/directive-block-open_feature.test b/package/src/prism/tests/languages/xeora/directive-block-open_feature.test
    new file mode 100644
    index 00000000..af271495
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xeora/directive-block-open_feature.test
    @@ -0,0 +1,30 @@
    +$C:Control2:{
    +$C#1:Control2:{
    +$C[ParentControl]:Control2:{
    +$C#1[ParentControl]:Control2:{
    +$S:Statement:{!NOCACHE
    +$H:HttpRequest:{!RENDERONREQUEST
    +$C:Control2:{!MESSAGETEMPLATE
    +
    +----------------------------------------------------
    +
    +[
    +	["directive-block-open", [
    +		["punctuation", ["$C:"]], "Control2", ["punctuation", [":"]], ["punctuation", ["{"]]]],
    +	["directive-block-open", [
    +		["punctuation", ["$C", ["tag", "#1"]]], ["punctuation", [":"]], "Control2", ["punctuation", [":"]], ["punctuation", ["{"]]]],
    +	["directive-block-open", [
    +		["punctuation", ["$C["]], "ParentControl", ["punctuation", ["]"]], ["punctuation", [":"]], "Control2", ["punctuation", [":"]], ["punctuation", ["{"]]]],
    +	["directive-block-open", [
    +		["punctuation", ["$C", ["tag", "#1"]]], ["punctuation", ["["]], "ParentControl", ["punctuation", ["]"]], ["punctuation", [":"]], "Control2", ["punctuation", [":"]], ["punctuation", ["{"]]]],
    +	["directive-block-open", [
    +		["punctuation", ["$S:"]], "Statement", ["punctuation", [":"]], ["punctuation", ["{"]], ["attribute", [["punctuation", "!"], "NOCACHE"]]]],
    +	["directive-block-open", [
    +		["punctuation", ["$H:"]], "HttpRequest", ["punctuation", [":"]], ["punctuation", ["{"]], ["attribute", [["punctuation", "!"], "RENDERONREQUEST"]]]],
    +	["directive-block-open", [
    +		["punctuation", ["$C:"]], "Control2", ["punctuation", [":"]], ["punctuation", ["{"]], ["attribute", [["punctuation", "!"], "MESSAGETEMPLATE"]]]]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for directive-block-opens.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/xeora/directive-block-separator_feature.test b/package/src/prism/tests/languages/xeora/directive-block-separator_feature.test
    new file mode 100644
    index 00000000..1486cfba
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xeora/directive-block-separator_feature.test
    @@ -0,0 +1,17 @@
    +}:Control3:{
    +
    +----------------------------------------------------
    +
    +[
    +	["directive-block-separator", [
    +		["punctuation", "}"],
    +		["punctuation", ":"],
    +		"Control3",
    +		["punctuation", ":"],
    +		["punctuation", "{"]
    +	]]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for functions.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/xeora/directive-inline_feature.test b/package/src/prism/tests/languages/xeora/directive-inline_feature.test
    new file mode 100644
    index 00000000..99702096
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xeora/directive-inline_feature.test
    @@ -0,0 +1,21 @@
    +$C:Control2$
    +$C#1:Control2$
    +$C[ParentControl]:Control2$
    +$C#1[ParentControl]:Control2$
    +
    +----------------------------------------------------
    +
    +[
    +	["directive-inline", [
    +		["punctuation", ["$C:"]], "Control2", ["punctuation", ["$"]]]],
    +	["directive-inline", [
    +		["punctuation", ["$C", ["tag", "#1"]]], ["punctuation", [":"]], "Control2", ["punctuation", ["$"]]]],
    +	["directive-inline", [
    +		["punctuation", ["$C["]], "ParentControl", ["punctuation", ["]"]], ["punctuation", [":"]], "Control2", ["punctuation", ["$"]]]],
    +	["directive-inline", [
    +		["punctuation", ["$C", ["tag", "#1"]]], ["punctuation", ["["]], "ParentControl", ["punctuation", ["]"]], ["punctuation", [":"]], "Control2", ["punctuation", ["$"]]]]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for directive-inlines.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/xeora/function-block_feature.test b/package/src/prism/tests/languages/xeora/function-block_feature.test
    new file mode 100644
    index 00000000..5242cd50
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xeora/function-block_feature.test
    @@ -0,0 +1,43 @@
    +$XF:{Library?ClassName.FuncName}:XF$
    +$XF:{Library?ClassName.FuncName,=Param1|~Param2}:XF$
    +
    +----------------------------------------------------
    +
    +[
    +	["function-block", [
    +		["punctuation", "$"],
    +		"XF",
    +		["punctuation", ":"],
    +		["punctuation", "{"],
    +		"Library",
    +		["punctuation", "?"],
    +		"ClassName",
    +		["punctuation", "."],
    +		"FuncName",
    +		["punctuation", "}"],
    +		["punctuation", ":"],
    +		"XF",
    +		["punctuation", "$"]
    +	]],
    +	["function-block", [
    +		["punctuation", "$"],
    +		"XF",
    +		["punctuation", ":"],
    +		["punctuation", "{"],
    +		"Library",
    +		["punctuation", "?"],
    +		"ClassName",
    +		["punctuation", "."],
    +		"FuncName",
    +		["variable", [["punctuation", ","], ["operator", "="], "Param1"]],
    +		["variable", [["punctuation", "|"], ["operator", "~"], "Param2"]],
    +		["punctuation", "}"],
    +		["punctuation", ":"],
    +		"XF",
    +		["punctuation", "$"]
    +	]]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for function-inlines.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/xeora/function-inline_feature.test b/package/src/prism/tests/languages/xeora/function-inline_feature.test
    new file mode 100644
    index 00000000..35acb560
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xeora/function-inline_feature.test
    @@ -0,0 +1,31 @@
    +$F:Library?ClassName.FuncName$
    +$F:Library?ClassName.FuncName,=Param1|~Param2$
    +
    +----------------------------------------------------
    +
    +[
    +	["function-inline", [
    +		["punctuation", "$F:"],
    +		"Library",
    +		["punctuation", "?"],
    +		"ClassName",
    +		["punctuation", "."],
    +		"FuncName",
    +		["punctuation", "$"]
    +	]],
    +	["function-inline", [
    +		["punctuation", "$F:"],
    +		"Library",
    +		["punctuation", "?"],
    +		"ClassName",
    +		["punctuation", "."],
    +		"FuncName",
    +		["variable", [["punctuation", ","], ["operator", "="], "Param1"]],
    +		["variable", [["punctuation", "|"], ["operator", "~"], "Param2"]],
    +		["punctuation", "$"]
    +	]]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for function-inlines.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/xeora/variable_feature.test b/package/src/prism/tests/languages/xeora/variable_feature.test
    new file mode 100644
    index 00000000..810eaacb
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xeora/variable_feature.test
    @@ -0,0 +1,36 @@
    +$SearchKey$
    +$^SearchKey$
    +$~SearchKey$
    +$-SearchKey$
    +$+SearchKey$
    +$=SearchKey$
    +$#SearchKey$
    +$*SearchKey$
    +$@SearchObject.SearchProperty$
    +
    +----------------------------------------------------
    +
    +[
    +	["variable", [
    +		["punctuation", "$"], "SearchKey", ["punctuation", "$"]]],
    +	["variable", [
    +		["punctuation", "$"], ["operator", "^"], "SearchKey", ["punctuation", "$"]]],
    +	["variable", [
    +		["punctuation", "$"], ["operator", "~"], "SearchKey", ["punctuation", "$"]]],
    +	["variable", [
    +		["punctuation", "$"], ["operator", "-"], "SearchKey", ["punctuation", "$"]]],
    +	["variable", [
    +		["punctuation", "$"], ["operator", "+"], "SearchKey", ["punctuation", "$"]]],
    +	["variable", [
    +		["punctuation", "$"], ["operator", "="], "SearchKey", ["punctuation", "$"]]],
    +	["variable", [
    +		["punctuation", "$"], ["operator", "#"], "SearchKey", ["punctuation", "$"]]],
    +	["variable", [
    +		["punctuation", "$"], ["operator", "*"], "SearchKey", ["punctuation", "$"]]],
    +	["variable", [
    +		["punctuation", "$"], ["operator", "@"], "SearchObject", ["punctuation", "."], "SearchProperty", ["punctuation", "$"]]]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for variables.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/xml/cdata_feature.test b/package/src/prism/tests/languages/xml/cdata_feature.test
    new file mode 100644
    index 00000000..76272cf6
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xml/cdata_feature.test
    @@ -0,0 +1,15 @@
    +
    +
    +
    +----------------------------------------------------
    +
    +[
    +	["cdata", ""],
    +	["cdata", ""]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for CDATA sections, single-line and multi-line.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/xml/comment_feature.test b/package/src/prism/tests/languages/xml/comment_feature.test
    new file mode 100644
    index 00000000..041cd570
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xml/comment_feature.test
    @@ -0,0 +1,16 @@
    +
    +
    +
    +
    +----------------------------------------------------
    +
    +[
    +	["comment", ""],
    +	["comment", ""],
    +	["comment", ""]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for empty comment, single-line comment and multi-line comment.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/xml/doctype_feature.test b/package/src/prism/tests/languages/xml/doctype_feature.test
    new file mode 100644
    index 00000000..e0a63b57
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xml/doctype_feature.test
    @@ -0,0 +1,101 @@
    +
    +
    +
    +
    +
    +]>
    +
    +	
    +	
    +]>
    +
    +----------------------------------------------------
    +
    +[
    +	["doctype", [
    +		["punctuation", ""]
    +	]],
    +
    +	["doctype", [
    +		["punctuation", ""]
    +	]],
    +
    +	["doctype", [
    +		["punctuation", ""]
    +	]],
    +
    +	["doctype", [
    +		["punctuation", ""]
    +	]],
    +
    +	["doctype", [
    +		["punctuation", ""]
    +			]]
    +		]],
    +		["punctuation", "]"],
    +		["punctuation", ">"]
    +	]],
    +
    +	["doctype", [
    +		["punctuation", ""]
    +			]],
    +			["tag", [
    +				["punctuation", "<"],
    +				["tag", ["!ELEMENT"]],
    +				["attr-name", ["subject"]],
    +				["attr-name", ["(#PCDATA)"]],
    +				["punctuation", ">"]
    +			]],
    +			["comment", ""]
    +		]],
    +		["punctuation", "]"],
    +		["punctuation", ">"]
    +	]]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for different doctypes, single-line and multi-line.
    diff --git a/package/src/prism/tests/languages/xml/entity_feature.html.test b/package/src/prism/tests/languages/xml/entity_feature.html.test
    new file mode 100644
    index 00000000..e4240e8e
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xml/entity_feature.html.test
    @@ -0,0 +1,17 @@
    +&
    +ϑ
    +A
    +A
    +⛵
    +
    +----------------------------------------------------
    +
    +&amp;
    +&thetasym;
    +&#65;
    +&#x41;
    +&#x26f5;
    +
    +----------------------------------------------------
    +
    +Checks for HTML/XML character entity references.
    diff --git a/package/src/prism/tests/languages/xml/issue3441.test b/package/src/prism/tests/languages/xml/issue3441.test
    new file mode 100644
    index 00000000..6e22904d
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xml/issue3441.test
    @@ -0,0 +1,23 @@
    +
    +
    +----------------------------------------------------
    +
    +[
    +	["tag", [
    +		["punctuation", "<"],
    +		["tag", ["google-chart"]],
    +		["attr-name", ["data"]],
    +		["attr-equals", "="],
    +		["attr-value", [
    +			["punctuation", "'"],
    +			"[[\"Month\", \"Days\"], [\"Jan\", 31]]",
    +			["punctuation", "'"]
    +		]],
    +		["punctuation", ">"]
    +	]],
    +	["tag", [
    +		["punctuation", ""]
    +	]]
    +]
    diff --git a/package/src/prism/tests/languages/xml/issue585.test b/package/src/prism/tests/languages/xml/issue585.test
    new file mode 100644
    index 00000000..d20af151
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xml/issue585.test
    @@ -0,0 +1,55 @@
    +foo
    +
    +baz
    +
    +----------------------------------------------------
    +
    +[
    +	["tag", [
    +		["punctuation", "<"],
    +		["tag", ["Läufer"]],
    +		["punctuation", ">"]
    +	]],
    +	"foo",
    +	["tag", [
    +		["punctuation", ""]
    +	]],
    +
    +	["tag", [
    +		["punctuation", "<"],
    +		["tag", ["tag"]],
    +		["attr-name", ["läufer"]],
    +		["attr-equals", "="],
    +		["attr-value", [
    +			["punctuation", "\""],
    +			"läufer",
    +			["punctuation", "\""]
    +		]],
    +		["punctuation", ">"]
    +	]],
    +
    +	["tag", [
    +		["punctuation", "<"],
    +		["tag", [
    +			["namespace", "läufer:"],
    +			"tag"
    +		]],
    +		["punctuation", ">"]
    +	]],
    +	"baz",
    +	["tag", [
    +		["punctuation", ""]
    +	]]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for tags, attributes and namespaces containing unicode characters.
    +See #585 for details.
    diff --git a/package/src/prism/tests/languages/xml/issue888.test b/package/src/prism/tests/languages/xml/issue888.test
    new file mode 100644
    index 00000000..e901a575
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xml/issue888.test
    @@ -0,0 +1,16 @@
    +
    +
    +----------------------------------------------------
    +
    +[
    +	["tag", [
    +		["punctuation", "<"],
    +		["tag", ["android.support.v7.widget.CardView"]],
    +		["punctuation", ">"]
    +	]]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for tag names containing dots.
    +See #888 for details.
    diff --git a/package/src/prism/tests/languages/xml/prolog_feature.test b/package/src/prism/tests/languages/xml/prolog_feature.test
    new file mode 100644
    index 00000000..8cb4d7c3
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xml/prolog_feature.test
    @@ -0,0 +1,16 @@
    +
    +
    +
    +
    +----------------------------------------------------
    +
    +[
    +	["prolog", ""],
    +	["prolog", ""],
    +	["prolog", ""]
    +]
    +
    +----------------------------------------------------
    +
    +Checks for different XML prologs, single-line and multi-line.
    \ No newline at end of file
    diff --git a/package/src/prism/tests/languages/xml/tag_attribute_feature.test b/package/src/prism/tests/languages/xml/tag_attribute_feature.test
    new file mode 100644
    index 00000000..a4a223af
    --- /dev/null
    +++ b/package/src/prism/tests/languages/xml/tag_attribute_feature.test
    @@ -0,0 +1,99 @@
    +
    +
    +
    +
    +
    +
    + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "test", + ["punctuation", "\""] + ]], + ["attr-name", ["foo"]], + ["attr-name", ["bar"]], + ["attr-equals", "="], + ["attr-value", ["baz"]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["foo"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "'"], + "bar", + ["punctuation", "'"] + ]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["class"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "foo\nbar\nbaz", + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", [ + ["namespace", "foo:"], + "bar" + ]], + ["attr-equals", "="], + ["attr-value", ["42"]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["foo"]], + ["attr-equals", "="], + ["attr-value", ["42"]], + ["attr-name", ["bar"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "42", + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["attr-name", ["foo"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + "=\\", + ["punctuation", "\""] + ]], + ["attr-name", ["bar"]], + ["attr-equals", "="], + ["attr-value", ["baz"]], + ["punctuation", "/>"] + ]] +] + +---------------------------------------------------- + +Checks for single-quoted, double-quoted and unquoted attributes, attributes without value and +namespaced attributes. diff --git a/package/src/prism/tests/languages/xml/tag_feature.test b/package/src/prism/tests/languages/xml/tag_feature.test new file mode 100644 index 00000000..c41a55b4 --- /dev/null +++ b/package/src/prism/tests/languages/xml/tag_feature.test @@ -0,0 +1,67 @@ +

    +
    dummy
    +
    + +
    "] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["div"]], + ["punctuation", ">"] + ]], + "dummy", + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], ["tag", ["div"]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", [ + ["namespace", "foo:"], + "bar" + ]], + ["punctuation", ">"] + ]], + ["tag", [ + ["punctuation", ""] + ]], + + "\n +> >= ++ - * +/ \ ^ += +AddressOf And +Ctype Is IsA +Mod New Not +Or Xor WeakAddressOf + +---------------------------------------------------- + +[ + ["operator", "<"], ["operator", "<="], ["operator", "<>"], + ["operator", ">"], ["operator", ">="], + ["operator", "+"], ["operator", "-"], ["operator", "*"], + ["operator", "/"], ["operator", "\\"], ["operator", "^"], + ["operator", "="], + ["operator", "AddressOf"], ["operator", "And"], + ["operator", "Ctype"], ["operator", "Is"], ["operator", "IsA"], + ["operator", "Mod"], ["operator", "New"], ["operator", "Not"], + ["operator", "Or"], ["operator", "Xor"], ["operator", "WeakAddressOf"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xojo/punctuation_feature.test b/package/src/prism/tests/languages/xojo/punctuation_feature.test new file mode 100644 index 00000000..29e203e9 --- /dev/null +++ b/package/src/prism/tests/languages/xojo/punctuation_feature.test @@ -0,0 +1,12 @@ +. , ; : ( ) + +---------------------------------------------------- + +[ + ["punctuation", "."], + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", ":"], + ["punctuation", "("], + ["punctuation", ")"] +] diff --git a/package/src/prism/tests/languages/xojo/string_feature.test b/package/src/prism/tests/languages/xojo/string_feature.test new file mode 100644 index 00000000..0bc1c826 --- /dev/null +++ b/package/src/prism/tests/languages/xojo/string_feature.test @@ -0,0 +1,15 @@ +"" +"""" +"Foo ""bar""" + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"\"\"\""], + ["string", "\"Foo \"\"bar\"\"\""] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/axis_feature.test b/package/src/prism/tests/languages/xquery/axis_feature.test new file mode 100644 index 00000000..8d7c5842 --- /dev/null +++ b/package/src/prism/tests/languages/xquery/axis_feature.test @@ -0,0 +1,33 @@ +self:: +child:: +descendant:: +descendant-or-self:: +attribute:: +following:: +following-sibling:: +parent:: +ancestor:: +ancestor-or-self:: +preceding:: +preceding-sibling:: + +---------------------------------------------------- + +[ + ["axis", "self"], ["punctuation", ":"], ["punctuation", ":"], + ["axis", "child"], ["punctuation", ":"], ["punctuation", ":"], + ["axis", "descendant"], ["punctuation", ":"], ["punctuation", ":"], + ["axis", "descendant-or-self"], ["punctuation", ":"], ["punctuation", ":"], + ["axis", "attribute"], ["punctuation", ":"], ["punctuation", ":"], + ["axis", "following"], ["punctuation", ":"], ["punctuation", ":"], + ["axis", "following-sibling"], ["punctuation", ":"], ["punctuation", ":"], + ["axis", "parent"], ["punctuation", ":"], ["punctuation", ":"], + ["axis", "ancestor"], ["punctuation", ":"], ["punctuation", ":"], + ["axis", "ancestor-or-self"], ["punctuation", ":"], ["punctuation", ":"], + ["axis", "preceding"], ["punctuation", ":"], ["punctuation", ":"], + ["axis", "preceding-sibling"], ["punctuation", ":"], ["punctuation", ":"] +] + +---------------------------------------------------- + +Checks for axes. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/builtin_feature.test b/package/src/prism/tests/languages/xquery/builtin_feature.test new file mode 100644 index 00000000..da3055d9 --- /dev/null +++ b/package/src/prism/tests/languages/xquery/builtin_feature.test @@ -0,0 +1,122 @@ +attribute foo +comment +document +element foo +processing-instruction +text +xs:anyAtomicType +xs:anyType +xs:anyURI +xs:base64Binary +xs:boolean +xs:byte +xs:date +xs:dateTime +xs:dayTimeDuration +xs:decimal +xs:double +xs:duration +xs:ENTITIES +xs:ENTITY +xs:float +xs:gDay +xs:gMonth +xs:gMonthDay +xs:gYear +xs:gYearMonth +xs:hexBinary +xs:ID +xs:IDREF +xs:IDREFS +xs:int +xs:integer +xs:language +xs:long +xs:Name +xs:NCName +xs:negativeInteger +xs:NMTOKEN +xs:NMTOKENS +xs:nonNegativeInteger +xs:nonPositiveInteger +xs:normalizedString +xs:NOTATION +xs:positiveInteger +xs:QName +xs:short +xs:string +xs:time +xs:token +xs:unsignedByte +xs:unsignedInt +xs:unsignedLong +xs:unsignedShort +xs:untyped +xs:untypedAtomic +xs:yearMonthDuration + +---------------------------------------------------- + +[ + ["builtin", "attribute"], + ["xquery-attribute", "foo"], + ["builtin", "comment"], + ["builtin", "document"], + ["builtin", "element"], + ["xquery-element", "foo"], + ["builtin", "processing-instruction"], + ["builtin", "text"], + ["builtin", "xs:anyAtomicType"], + ["builtin", "xs:anyType"], + ["builtin", "xs:anyURI"], + ["builtin", "xs:base64Binary"], + ["builtin", "xs:boolean"], + ["builtin", "xs:byte"], + ["builtin", "xs:date"], + ["builtin", "xs:dateTime"], + ["builtin", "xs:dayTimeDuration"], + ["builtin", "xs:decimal"], + ["builtin", "xs:double"], + ["builtin", "xs:duration"], + ["builtin", "xs:ENTITIES"], + ["builtin", "xs:ENTITY"], + ["builtin", "xs:float"], + ["builtin", "xs:gDay"], + ["builtin", "xs:gMonth"], + ["builtin", "xs:gMonthDay"], + ["builtin", "xs:gYear"], + ["builtin", "xs:gYearMonth"], + ["builtin", "xs:hexBinary"], + ["builtin", "xs:ID"], + ["builtin", "xs:IDREF"], + ["builtin", "xs:IDREFS"], + ["builtin", "xs:int"], + ["builtin", "xs:integer"], + ["builtin", "xs:language"], + ["builtin", "xs:long"], + ["builtin", "xs:Name"], + ["builtin", "xs:NCName"], + ["builtin", "xs:negativeInteger"], + ["builtin", "xs:NMTOKEN"], + ["builtin", "xs:NMTOKENS"], + ["builtin", "xs:nonNegativeInteger"], + ["builtin", "xs:nonPositiveInteger"], + ["builtin", "xs:normalizedString"], + ["builtin", "xs:NOTATION"], + ["builtin", "xs:positiveInteger"], + ["builtin", "xs:QName"], + ["builtin", "xs:short"], + ["builtin", "xs:string"], + ["builtin", "xs:time"], + ["builtin", "xs:token"], + ["builtin", "xs:unsignedByte"], + ["builtin", "xs:unsignedInt"], + ["builtin", "xs:unsignedLong"], + ["builtin", "xs:unsignedShort"], + ["builtin", "xs:untyped"], + ["builtin", "xs:untypedAtomic"], + ["builtin", "xs:yearMonthDuration"] +] + +---------------------------------------------------- +Checks for builtin types. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/extension_feature.test b/package/src/prism/tests/languages/xquery/extension_feature.test new file mode 100644 index 00000000..759269a2 --- /dev/null +++ b/package/src/prism/tests/languages/xquery/extension_feature.test @@ -0,0 +1,11 @@ +(# datypic:timeOut 200 #) + +---------------------------------------------------- + +[ + ["extension", "(# datypic:timeOut 200 #)"] +] + +---------------------------------------------------- + +Checks for extensions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/function_feature.test b/package/src/prism/tests/languages/xquery/function_feature.test new file mode 100644 index 00000000..d315f0ae --- /dev/null +++ b/package/src/prism/tests/languages/xquery/function_feature.test @@ -0,0 +1,43 @@ +doc("catalog.xml") +generate-id($prod) +xs:QName("strings:trim") +declare function prod:countProds ($prods as element(product)*) as xs:string +false() + +---------------------------------------------------- + +[ + ["function", "doc"], + ["punctuation", "("], + ["string", "\"catalog.xml\""], + ["punctuation", ")"], + ["function", "generate-id"], + ["punctuation", "("], + ["variable", "$prod"], + ["punctuation", ")"], + ["function", "xs:QName"], + ["punctuation", "("], + ["string", "\"strings:trim\""], + ["punctuation", ")"], + ["keyword", "declare"], + ["keyword", "function"], + ["function", "prod:countProds"], + ["punctuation", "("], + ["variable", "$prods"], + ["keyword", "as"], + ["function", "element"], + ["punctuation", "("], + "product", + ["punctuation", ")"], + ["operator", "*"], + ["punctuation", ")"], + ["keyword", "as"], + ["builtin", "xs:string"], + ["function", "false"], + ["punctuation", "("], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for functions. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/keyword-operator_feature.test b/package/src/prism/tests/languages/xquery/keyword-operator_feature.test new file mode 100644 index 00000000..8b0eb350 --- /dev/null +++ b/package/src/prism/tests/languages/xquery/keyword-operator_feature.test @@ -0,0 +1,43 @@ +and +castable as +div +eq +except +ge +gt +idiv +instance of +intersect +is +le +lt +mod +ne +or +union + +---------------------------------------------------- + +[ + ["keyword-operator", "and"], + ["keyword-operator", "castable as"], + ["keyword-operator", "div"], + ["keyword-operator", "eq"], + ["keyword-operator", "except"], + ["keyword-operator", "ge"], + ["keyword-operator", "gt"], + ["keyword-operator", "idiv"], + ["keyword-operator", "instance of"], + ["keyword-operator", "intersect"], + ["keyword-operator", "is"], + ["keyword-operator", "le"], + ["keyword-operator", "lt"], + ["keyword-operator", "mod"], + ["keyword-operator", "ne"], + ["keyword-operator", "or"], + ["keyword-operator", "union"] +] + +---------------------------------------------------- + +Checks for keyword operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/keyword_feature.test b/package/src/prism/tests/languages/xquery/keyword_feature.test new file mode 100644 index 00000000..a5b4565f --- /dev/null +++ b/package/src/prism/tests/languages/xquery/keyword_feature.test @@ -0,0 +1,119 @@ +as +ascending +at +base-uri +boundary-space +case +cast as +collation +construction +copy-namespaces +declare +default +descending +else +empty greatest +empty least +encoding +every +external +for +function +if +import +in +inherit +lax +let +map +module +namespace +no-inherit +no-preserve +option +order +order by +ordered +ordering +preserve +return +satisfies +schema +some +stable +strict +strip +then +to +treat as +typeswitch +unordered +validate +variable +version +where +xquery + +---------------------------------------------------- + +[ + ["keyword", "as"], + ["keyword", "ascending"], + ["keyword", "at"], + ["keyword", "base-uri"], + ["keyword", "boundary-space"], + ["keyword", "case"], + ["keyword", "cast as"], + ["keyword", "collation"], + ["keyword", "construction"], + ["keyword", "copy-namespaces"], + ["keyword", "declare"], + ["keyword", "default"], + ["keyword", "descending"], + ["keyword", "else"], + ["keyword", "empty greatest"], + ["keyword", "empty least"], + ["keyword", "encoding"], + ["keyword", "every"], + ["keyword", "external"], + ["keyword", "for"], + ["keyword", "function"], + ["keyword", "if"], + ["keyword", "import"], + ["keyword", "in"], + ["keyword", "inherit"], + ["keyword", "lax"], + ["keyword", "let"], + ["keyword", "map"], + ["keyword", "module"], + ["keyword", "namespace"], + ["keyword", "no-inherit"], + ["keyword", "no-preserve"], + ["keyword", "option"], + ["keyword", "order"], + ["keyword", "order by"], + ["keyword", "ordered"], + ["keyword", "ordering"], + ["keyword", "preserve"], + ["keyword", "return"], + ["keyword", "satisfies"], + ["keyword", "schema"], + ["keyword", "some"], + ["keyword", "stable"], + ["keyword", "strict"], + ["keyword", "strip"], + ["keyword", "then"], + ["keyword", "to"], + ["keyword", "treat as"], + ["keyword", "typeswitch"], + ["keyword", "unordered"], + ["keyword", "validate"], + ["keyword", "variable"], + ["keyword", "version"], + ["keyword", "where"], + ["keyword", "xquery"] +] + +---------------------------------------------------- + +Checks for keywords. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/number_feature.test b/package/src/prism/tests/languages/xquery/number_feature.test new file mode 100644 index 00000000..88e02576 --- /dev/null +++ b/package/src/prism/tests/languages/xquery/number_feature.test @@ -0,0 +1,17 @@ +0 +3.14159 +42E8 +3.25E-4 + +---------------------------------------------------- + +[ + ["number", "0"], + ["number", "3.14159"], + ["number", "42E8"], + ["number", "3.25E-4"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/operator_feature.test b/package/src/prism/tests/languages/xquery/operator_feature.test new file mode 100644 index 00000000..899667ac --- /dev/null +++ b/package/src/prism/tests/languages/xquery/operator_feature.test @@ -0,0 +1,21 @@ ++ - * += ? | @ +. .. +:= != +< <= << +> >= >> + +---------------------------------------------------- + +[ + ["operator", "+"], ["operator", "-"], ["operator", "*"], + ["operator", "="], ["operator", "?"], ["operator", "|"], ["operator", "@"], + ["operator", "."], ["operator", ".."], + ["operator", ":="], ["operator", "!="], + ["operator", "<"], ["operator", "<="], ["operator", "<<"], + ["operator", ">"], ["operator", ">="], ["operator", ">>"] +] + +---------------------------------------------------- + +Checks for operators. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/plain-text_feature.test b/package/src/prism/tests/languages/xquery/plain-text_feature.test new file mode 100644 index 00000000..a2c51a72 --- /dev/null +++ b/package/src/prism/tests/languages/xquery/plain-text_feature.test @@ -0,0 +1,65 @@ +return
      + +plaintext +{comment{concat(" List of ", $count, " products ")}} +
    + +

    data($prod/name){data($prod/name)}{{data($prod/name)}}

    + +---------------------------------------------------- + +[ + ["keyword", "return"], + ["tag", [ + ["punctuation", "<"], + ["tag", ["ul"]], + ["punctuation", ">"] + ]], + + ["comment", ""], + ["plain-text", "\nplaintext\n"], + ["punctuation", "{"], + ["builtin", "comment"], + ["punctuation", "{"], + ["function", "concat"], + ["punctuation", "("], + ["string", "\" List of \""], + ["punctuation", ","], + ["variable", "$count"], + ["punctuation", ","], + ["string", "\" products \""], + ["punctuation", ")"], + ["punctuation", "}"], + ["punctuation", "}"], + + ["tag", [ + ["punctuation", ""] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["h1"]], + ["punctuation", ">"] + ]], + ["plain-text", "data($prod/name)"], + ["punctuation", "{"], + ["function", "data"], + ["punctuation", "("], + ["variable", "$prod"], + ["punctuation", "/"], + "name", + ["punctuation", ")"], + ["punctuation", "}"], + ["plain-text", "{{data($prod/name)}}"], + ["tag", [ + ["punctuation", ""] + ]] +] + +---------------------------------------------------- + +Checks for plain-text between tags. diff --git a/package/src/prism/tests/languages/xquery/string_feature.test b/package/src/prism/tests/languages/xquery/string_feature.test new file mode 100644 index 00000000..22965383 --- /dev/null +++ b/package/src/prism/tests/languages/xquery/string_feature.test @@ -0,0 +1,25 @@ +"" +"Foo""bar" +"Foo' +bar"" +baz" +'' +'Foo''bar' +'Foo" +bar'' +baz' + +---------------------------------------------------- + +[ + ["string", "\"\""], + ["string", "\"Foo\"\"bar\""], + ["string", "\"Foo'\nbar\"\"\nbaz\""], + ["string", "''"], + ["string", "'Foo''bar'"], + ["string", "'Foo\"\nbar''\nbaz'"] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/tag_feature.test b/package/src/prism/tests/languages/xquery/tag_feature.test new file mode 100644 index 00000000..27ce54a8 --- /dev/null +++ b/package/src/prism/tests/languages/xquery/tag_feature.test @@ -0,0 +1,133 @@ +
  • number: {data($prod/number) +}, name: {data($prod/name)}
  • + +return + +
  • + +---------------------------------------------------- + +[ + ["tag", [ + ["punctuation", "<"], + ["tag", ["li"]], + ["attr-name", ["dep"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["expression", [ + ["punctuation", "{"], + ["variable", "$prod"], + ["punctuation", "/"], + ["operator", "@"], + "dept", + ["punctuation", "}"] + ]], + ["punctuation", "\""] + ]], + ["punctuation", ">"] + ]], + ["plain-text", "number: "], + ["punctuation", "{"], + ["function", "data"], + ["punctuation", "("], + ["variable", "$prod"], + ["punctuation", "/"], + "number", + ["punctuation", ")"], + + ["punctuation", "}"], + ["plain-text", ", name: "], + ["punctuation", "{"], + ["function", "data"], + ["punctuation", "("], + ["variable", "$prod"], + ["punctuation", "/"], + "name", + ["punctuation", ")"], + ["punctuation", "}"], + ["tag", [ + ["punctuation", ""] + ]], + + ["keyword", "return"], + ["tag", [ + ["punctuation", "<"], + ["tag", ["item"]], + ["attr-name", ["num"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["expression", [ + ["punctuation", "{"], + ["variable", "$item"], + ["punctuation", "/"], + ["operator", "@"], + "num", + ["punctuation", "}"] + ]], + ["punctuation", "\""] + ]], + + ["attr-name", ["name"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["expression", [ + ["punctuation", "{"], + ["variable", "$name"], + ["punctuation", "}"] + ]], + ["punctuation", "\""] + ]], + + ["attr-name", ["quan"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["expression", [ + ["punctuation", "{"], + ["variable", "$item"], + ["punctuation", "/"], + ["operator", "@"], + "quantity", + ["punctuation", "}"] + ]], + ["punctuation", "\""] + ]], + ["punctuation", "/>"] + ]], + + ["tag", [ + ["punctuation", "<"], + ["tag", ["li"]], + ["attr-name", ["dep"]], + ["attr-equals", "="], + ["attr-value", [ + ["punctuation", "\""], + ["expression", [ + ["punctuation", "{"], + ["function", "substring-after"], + ["punctuation", "("], + ["variable", "$prod"], + ["punctuation", "/"], + ["operator", "@"], + "dept", + ["punctuation", ","], + ["string", "\"-\""], + ["punctuation", ")"], + ["punctuation", "}"] + ]], + ["punctuation", "\""] + ]], + ["punctuation", "/>"] + ]] +] + +---------------------------------------------------- + +Checks for XQuery inside tags. diff --git a/package/src/prism/tests/languages/xquery/variable_feature.test b/package/src/prism/tests/languages/xquery/variable_feature.test new file mode 100644 index 00000000..560cd94e --- /dev/null +++ b/package/src/prism/tests/languages/xquery/variable_feature.test @@ -0,0 +1,15 @@ +$foo +$foo-bar +$strings:LetterA + +---------------------------------------------------- + +[ + ["variable", "$foo"], + ["variable", "$foo-bar"], + ["variable", "$strings:LetterA"] +] + +---------------------------------------------------- + +Checks for variables. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/xquery-attribute_feature.test b/package/src/prism/tests/languages/xquery/xquery-attribute_feature.test new file mode 100644 index 00000000..49679106 --- /dev/null +++ b/package/src/prism/tests/languages/xquery/xquery-attribute_feature.test @@ -0,0 +1,18 @@ +attribute foo +attribute foo-bar +attribute foo:bar + +---------------------------------------------------- + +[ + ["builtin", "attribute"], + ["xquery-attribute", "foo"], + ["builtin", "attribute"], + ["xquery-attribute", "foo-bar"], + ["builtin", "attribute"], + ["xquery-attribute", "foo:bar"] +] + +---------------------------------------------------- + +Checks for XQuery attribute constructor. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/xquery-comment_feature.test b/package/src/prism/tests/languages/xquery/xquery-comment_feature.test new file mode 100644 index 00000000..bf82130e --- /dev/null +++ b/package/src/prism/tests/languages/xquery/xquery-comment_feature.test @@ -0,0 +1,19 @@ +(::) +(: Single line comment :) +(:Multi +line +comment:) +(: :) + +---------------------------------------------------- + +[ + ["xquery-comment", "(::)"], + ["xquery-comment", "(: Single line comment :)"], + ["xquery-comment", "(:Multi\nline\ncomment:)"], + ["xquery-comment", "(: :)"] +] + +---------------------------------------------------- + +Checks for XQuery comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/xquery/xquery-element_feature.test b/package/src/prism/tests/languages/xquery/xquery-element_feature.test new file mode 100644 index 00000000..a2f31dc2 --- /dev/null +++ b/package/src/prism/tests/languages/xquery/xquery-element_feature.test @@ -0,0 +1,18 @@ +element html +element foo-bar +element foo:bar + +---------------------------------------------------- + +[ + ["builtin", "element"], + ["xquery-element", "html"], + ["builtin", "element"], + ["xquery-element", "foo-bar"], + ["builtin", "element"], + ["xquery-element", "foo:bar"] +] + +---------------------------------------------------- + +Checks for XQuery element constructors. \ No newline at end of file diff --git a/package/src/prism/tests/languages/yaml+markdown/front-matter_feature.test b/package/src/prism/tests/languages/yaml+markdown/front-matter_feature.test new file mode 100644 index 00000000..a78b48d2 --- /dev/null +++ b/package/src/prism/tests/languages/yaml+markdown/front-matter_feature.test @@ -0,0 +1,24 @@ +--- +layout: post +title: Blogging Like a Hacker +--- + +# Title + +---------------------------------------------------- + +[ + ["front-matter-block", [ + ["punctuation", "---"], + ["front-matter", [ + ["key", "layout"], ["punctuation", ":"], " post\n", + ["key", "title"], ["punctuation", ":"], " Blogging Like a Hacker" + ]], + ["punctuation", "---"] + ]], + + ["title", [ + ["punctuation", "#"], + " Title" + ]] +] diff --git a/package/src/prism/tests/languages/yaml/anchor_and_alias_feature.test b/package/src/prism/tests/languages/yaml/anchor_and_alias_feature.test new file mode 100644 index 00000000..eb70cb9b --- /dev/null +++ b/package/src/prism/tests/languages/yaml/anchor_and_alias_feature.test @@ -0,0 +1,195 @@ +x-number: &num-ber 13 +x-string: &stri_ng "good" +x-null: &nu-ll null +x-boolean: &boo-lean true +x-datetime: &date-time 2001-12-15T02:59:43.1Z +x-scalar: &sca-lar | + foo + bar + +x-utf8: &アンカー "japanese anchor" + +x-tag-string: &tag-string !!tag-string "13" +x-tag-number: &tag-number !!tag-number 42 +x-tag-null: &tag-null !!tag-null null +x-tag-boolean: &tag-bool !!tag-bool true +x-tag-datetime: &tag-date !!tag-date 2001-12-15T02:59:43.1Z +x-tag-scalar: &tag-scalar !!tag-scalar | + foo + bar + +x-tag-string: !!tag-string &tag-string "13" +x-tag-number: !!tag-number &tag-number 42 +x-tag-null: !!tag-null &tag-null null +x-tag-boolean: !!tag-bool &tag-bool true +x-tag-datetime: !!tag-date &tag-date 2001-12-15T02:59:43.1Z +x-tag-scalar: !!tag-scalar &tag-scalar | + foo + bar + +foobar: *num-ber +fubar: *stri_ng +japanese: *アンカー +taga: *tag-a !!taga +tagb: !!tagb *tag-b + +# https://yaml.org/spec/1.2/spec.html#id2783797 + +!!str &a1 "foo": + !!str bar +&a2 baz : *a1 + +---------------------------------------------------- + +[ + ["key", "x-number"], + ["punctuation", ":"], + ["important", "&num-ber"], + ["number", "13"], + + ["key", "x-string"], + ["punctuation", ":"], + ["important", "&stri_ng"], + ["string", "\"good\""], + + ["key", "x-null"], + ["punctuation", ":"], + ["important", "&nu-ll"], + ["null", "null"], + + ["key", "x-boolean"], + ["punctuation", ":"], + ["important", "&boo-lean"], + ["boolean", "true"], + + ["key", "x-datetime"], + ["punctuation", ":"], + ["important", "&date-time"], + ["datetime", "2001-12-15T02:59:43.1Z"], + + ["key", "x-scalar"], + ["punctuation", ":"], + ["important", "&sca-lar"], + ["punctuation", "|"], + ["scalar", "\n\tfoo\n\tbar"], + + ["key", "x-utf8"], + ["punctuation", ":"], + ["important", "&アンカー"], + ["string", "\"japanese anchor\""], + + ["key", "x-tag-string"], + ["punctuation", ":"], + ["important", "&tag-string"], + ["tag", "!!tag-string"], + ["string", "\"13\""], + + ["key", "x-tag-number"], + ["punctuation", ":"], + ["important", "&tag-number"], + ["tag", "!!tag-number"], + ["number", "42"], + + ["key", "x-tag-null"], + ["punctuation", ":"], + ["important", "&tag-null"], + ["tag", "!!tag-null"], + ["null", "null"], + + ["key", "x-tag-boolean"], + ["punctuation", ":"], + ["important", "&tag-bool"], + ["tag", "!!tag-bool"], + ["boolean", "true"], + + ["key", "x-tag-datetime"], + ["punctuation", ":"], + ["important", "&tag-date"], + ["tag", "!!tag-date"], + ["datetime", "2001-12-15T02:59:43.1Z"], + + ["key", "x-tag-scalar"], + ["punctuation", ":"], + ["important", "&tag-scalar"], + ["tag", "!!tag-scalar"], + ["punctuation", "|"], + ["scalar", "\n\tfoo\n\tbar"], + + ["key", "x-tag-string"], + ["punctuation", ":"], + ["tag", "!!tag-string"], + ["important", "&tag-string"], + ["string", "\"13\""], + + ["key", "x-tag-number"], + ["punctuation", ":"], + ["tag", "!!tag-number"], + ["important", "&tag-number"], + ["number", "42"], + + ["key", "x-tag-null"], + ["punctuation", ":"], + ["tag", "!!tag-null"], + ["important", "&tag-null"], + ["null", "null"], + + ["key", "x-tag-boolean"], + ["punctuation", ":"], + ["tag", "!!tag-bool"], + ["important", "&tag-bool"], + ["boolean", "true"], + + ["key", "x-tag-datetime"], + ["punctuation", ":"], + ["tag", "!!tag-date"], + ["important", "&tag-date"], + ["datetime", "2001-12-15T02:59:43.1Z"], + + ["key", "x-tag-scalar"], + ["punctuation", ":"], + ["tag", "!!tag-scalar"], + ["important", "&tag-scalar"], + ["punctuation", "|"], + ["scalar", "\n\tfoo\n\tbar"], + + ["key", "foobar"], + ["punctuation", ":"], + ["important", "*num-ber"], + + ["key", "fubar"], + ["punctuation", ":"], + ["important", "*stri_ng"], + + ["key", "japanese"], + ["punctuation", ":"], + ["important", "*アンカー"], + + ["key", "taga"], + ["punctuation", ":"], + ["important", "*tag-a"], + ["tag", "!!taga"], + + ["key", "tagb"], + ["punctuation", ":"], + ["tag", "!!tagb"], + ["important", "*tag-b"], + + ["comment", "# https://yaml.org/spec/1.2/spec.html#id2783797"], + + ["tag", "!!str"], + ["important", "&a1"], + ["key", "\"foo\""], + ["punctuation", ":"], + + ["tag", "!!str"], + " bar\n", + + ["important", "&a2"], + ["key", "baz"], + ["punctuation", ":"], + ["important", "*a1"] +] + +---------------------------------------------------- + +Checks for anchors and aliases. diff --git a/package/src/prism/tests/languages/yaml/boolean_feature.test b/package/src/prism/tests/languages/yaml/boolean_feature.test new file mode 100644 index 00000000..471862fb --- /dev/null +++ b/package/src/prism/tests/languages/yaml/boolean_feature.test @@ -0,0 +1,17 @@ +--- +foo: true +bar: false + +---------------------------------------------------- + +[ + ["punctuation", "---"], + ["key", "foo"], ["punctuation", ":"], + ["boolean", "true"], + ["key", "bar"], ["punctuation", ":"], + ["boolean", "false"] +] + +---------------------------------------------------- + +Checks for booleans. \ No newline at end of file diff --git a/package/src/prism/tests/languages/yaml/comment_feature.test b/package/src/prism/tests/languages/yaml/comment_feature.test new file mode 100644 index 00000000..710014b8 --- /dev/null +++ b/package/src/prism/tests/languages/yaml/comment_feature.test @@ -0,0 +1,13 @@ +# +# foobar + +---------------------------------------------------- + +[ + ["comment", "#"], + ["comment", "# foobar"] +] + +---------------------------------------------------- + +Checks for comments. \ No newline at end of file diff --git a/package/src/prism/tests/languages/yaml/datetime_feature.test b/package/src/prism/tests/languages/yaml/datetime_feature.test new file mode 100644 index 00000000..31849d9a --- /dev/null +++ b/package/src/prism/tests/languages/yaml/datetime_feature.test @@ -0,0 +1,31 @@ +--- +canonical: 2001-12-15T02:59:43.1Z +iso8601: 2001-12-14t21:59:43.10-05:00 +spaced: 2001-12-14 21:59:43.10 -5 +date: 2002-12-14 +times: + - 10:53 + - 10:53:20.53 + +---------------------------------------------------- + +[ + ["punctuation", "---"], + ["key", "canonical"], ["punctuation", ":"], + ["datetime", "2001-12-15T02:59:43.1Z"], + ["key", "iso8601"], ["punctuation", ":"], + ["datetime", "2001-12-14t21:59:43.10-05:00"], + ["key", "spaced"], ["punctuation", ":"], + ["datetime", "2001-12-14 21:59:43.10 -5"], + ["key", "date"], ["punctuation", ":"], + ["datetime", "2002-12-14"], + ["key", "times"], ["punctuation", ":"], + ["punctuation", "-"], + ["datetime", "10:53"], + ["punctuation", "-"], + ["datetime", "10:53:20.53"] +] + +---------------------------------------------------- + +Checks for dates, times and datetimes. \ No newline at end of file diff --git a/package/src/prism/tests/languages/yaml/directive_feature.test b/package/src/prism/tests/languages/yaml/directive_feature.test new file mode 100644 index 00000000..31b2fb9d --- /dev/null +++ b/package/src/prism/tests/languages/yaml/directive_feature.test @@ -0,0 +1,13 @@ +%YAML 1.2 +%TAG + +---------------------------------------------------- + +[ + ["directive", "%YAML 1.2"], + ["directive", "%TAG"] +] + +---------------------------------------------------- + +Checks for directives. \ No newline at end of file diff --git a/package/src/prism/tests/languages/yaml/important_feature.test b/package/src/prism/tests/languages/yaml/important_feature.test new file mode 100644 index 00000000..f694b776 --- /dev/null +++ b/package/src/prism/tests/languages/yaml/important_feature.test @@ -0,0 +1,19 @@ +&B1 +&A +*A +&SS +*SS + +---------------------------------------------------- + +[ + ["important", "&B1"], + ["important", "&A"], + ["important", "*A"], + ["important", "&SS"], + ["important", "*SS"] +] + +---------------------------------------------------- + +Checks for important. \ No newline at end of file diff --git a/package/src/prism/tests/languages/yaml/key_feature.test b/package/src/prism/tests/languages/yaml/key_feature.test new file mode 100644 index 00000000..44693b8a --- /dev/null +++ b/package/src/prism/tests/languages/yaml/key_feature.test @@ -0,0 +1,21 @@ +--- +foo: 4 +FooBar : 5 +hello the-world: 23 +"\"foo# : {}[]": 23 +'\'foo# : {}[]': 23 + +---------------------------------------------------- + +[ + ["punctuation", "---"], + ["key", "foo"], ["punctuation", ":"], ["number", "4"], + ["key", "FooBar"], ["punctuation", ":"], ["number", "5"], + ["key", "hello the-world"], ["punctuation", ":"], ["number", "23"], + ["key", "\"\\\"foo# : {}[]\""], ["punctuation", ":"], ["number", "23"], + ["key", "'\\'foo# : {}[]'"], ["punctuation", ":"], ["number", "23"] +] + +---------------------------------------------------- + +Checks for keys. diff --git a/package/src/prism/tests/languages/yaml/null_feature.test b/package/src/prism/tests/languages/yaml/null_feature.test new file mode 100644 index 00000000..b1333a12 --- /dev/null +++ b/package/src/prism/tests/languages/yaml/null_feature.test @@ -0,0 +1,17 @@ +--- +foo: null +bar: ~ + +---------------------------------------------------- + +[ + ["punctuation", "---"], + ["key", "foo"], ["punctuation", ":"], + ["null", "null"], + ["key", "bar"], ["punctuation", ":"], + ["null", "~"] +] + +---------------------------------------------------- + +Checks for null and ~. \ No newline at end of file diff --git a/package/src/prism/tests/languages/yaml/number_feature.test b/package/src/prism/tests/languages/yaml/number_feature.test new file mode 100644 index 00000000..d0e108d6 --- /dev/null +++ b/package/src/prism/tests/languages/yaml/number_feature.test @@ -0,0 +1,38 @@ +--- +foo: 0xBadFace +bar: 0o754 +baz: 42 +foo: 3.14159 +bar: 4e8 +baz: 3.1E-7 +foo: 0.4e+2 +bar: -0xFF +baz: +0o123 + +---------------------------------------------------- + +[ + ["punctuation", "---"], + ["key", "foo"], ["punctuation", ":"], + ["number", "0xBadFace"], + ["key", "bar"], ["punctuation", ":"], + ["number", "0o754"], + ["key", "baz"], ["punctuation", ":"], + ["number", "42"], + ["key", "foo"], ["punctuation", ":"], + ["number", "3.14159"], + ["key", "bar"], ["punctuation", ":"], + ["number", "4e8"], + ["key", "baz"], ["punctuation", ":"], + ["number", "3.1E-7"], + ["key", "foo"], ["punctuation", ":"], + ["number", "0.4e+2"], + ["key", "bar"], ["punctuation", ":"], + ["number", "-0xFF"], + ["key", "baz"], ["punctuation", ":"], + ["number", "+0o123"] +] + +---------------------------------------------------- + +Checks for numbers. \ No newline at end of file diff --git a/package/src/prism/tests/languages/yaml/scalar_feature.test b/package/src/prism/tests/languages/yaml/scalar_feature.test new file mode 100644 index 00000000..744286c6 --- /dev/null +++ b/package/src/prism/tests/languages/yaml/scalar_feature.test @@ -0,0 +1,23 @@ +--- +foo: > + Foo bar + baz +bar: | + Foo bar + baz + +---------------------------------------------------- + +[ + ["punctuation", "---"], + ["key", "foo"], ["punctuation", ":"], + ["punctuation", ">"], + ["scalar", "\n\tFoo bar\n\tbaz"], + ["key", "bar"], ["punctuation", ":"], + ["punctuation", "|"], + ["scalar", "\n\tFoo bar\n\tbaz"] +] + +---------------------------------------------------- + +Checks for scalars. \ No newline at end of file diff --git a/package/src/prism/tests/languages/yaml/string_feature.test b/package/src/prism/tests/languages/yaml/string_feature.test new file mode 100644 index 00000000..b27bf925 --- /dev/null +++ b/package/src/prism/tests/languages/yaml/string_feature.test @@ -0,0 +1,29 @@ +--- +foo: "" +bar: "fo\"obar" +foo: '' +bar: 'fo\'obar' +foo: "foo" # bar +bar: 'bar' # foo + +---------------------------------------------------- + +[ + ["punctuation", "---"], + ["key", "foo"], ["punctuation", ":"], + ["string", "\"\""], + ["key", "bar"], ["punctuation", ":"], + ["string", "\"fo\\\"obar\""], + ["key", "foo"], ["punctuation", ":"], + ["string", "''"], + ["key", "bar"], ["punctuation", ":"], + ["string", "'fo\\'obar'"], + ["key", "foo"], ["punctuation", ":"], + ["string", "\"foo\""], ["comment", "# bar"], + ["key", "bar"], ["punctuation", ":"], + ["string", "'bar'"], ["comment", "# foo"] +] + +---------------------------------------------------- + +Checks for strings. \ No newline at end of file diff --git a/package/src/prism/tests/languages/yaml/tag_feature.test b/package/src/prism/tests/languages/yaml/tag_feature.test new file mode 100644 index 00000000..ce951ddc --- /dev/null +++ b/package/src/prism/tests/languages/yaml/tag_feature.test @@ -0,0 +1,92 @@ +!!map +!!str +!!seq + +# https://yaml.org/spec/1.2/spec.html#c-ns-tag-property + +! foo : ! baz + +- !local foo +- !!str bar +- !e!tag%21 baz + +!!seq [ + ! "foo", + ! "bar", + ! "baz" +] + +# Assuming conventional resolution: +- "12" +- 12 +- ! 12 + +!!seq [ + ! "12", + ! "12", + ! "12", +] + +---------------------------------------------------- + +[ + ["tag", "!!map"], + ["tag", "!!str"], + ["tag", "!!seq"], + + ["comment", "# https://yaml.org/spec/1.2/spec.html#c-ns-tag-property"], + + ["tag", "!"], + ["key", "foo"], + ["punctuation", ":"], + ["tag", "!"], + " baz\n\n", + + ["punctuation", "-"], + ["tag", "!local"], + " foo\n", + ["punctuation", "-"], + ["tag", "!!str"], + " bar\n", + ["punctuation", "-"], + ["tag", "!e!tag%21"], + " baz\n\n", + + ["tag", "!!seq"], + ["punctuation", "["], + ["tag", "!"], + ["string", "\"foo\""], + ["punctuation", ","], + ["tag", "!"], + ["string", "\"bar\""], + ["punctuation", ","], + ["tag", "!"], + ["string", "\"baz\""], + ["punctuation", "]"], + + ["comment", "# Assuming conventional resolution:"], + ["punctuation", "-"], + ["string", "\"12\""], + ["punctuation", "-"], + ["number", "12"], + ["punctuation", "-"], + ["tag", "!"], + ["number", "12"], + + ["tag", "!!seq"], + ["punctuation", "["], + ["tag", "!"], + ["string", "\"12\""], + ["punctuation", ","], + ["tag", "!"], + ["string", "\"12\""], + ["punctuation", ","], + ["tag", "!"], + ["string", "\"12\""], + ["punctuation", ","], + ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for tags diff --git a/package/src/prism/tests/languages/yang/boolean_feature.test b/package/src/prism/tests/languages/yang/boolean_feature.test new file mode 100644 index 00000000..9ae98f90 --- /dev/null +++ b/package/src/prism/tests/languages/yang/boolean_feature.test @@ -0,0 +1,13 @@ +true +false + +---------------------------------------------------- + +[ + ["keyword", "true"], + ["keyword", "false"] +] + +---------------------------------------------------- + +Checks for booleans. diff --git a/package/src/prism/tests/languages/yang/comment_feature.test b/package/src/prism/tests/languages/yang/comment_feature.test new file mode 100644 index 00000000..ca4545e8 --- /dev/null +++ b/package/src/prism/tests/languages/yang/comment_feature.test @@ -0,0 +1,15 @@ +// comment +/* + comment +*/ + +---------------------------------------------------- + +[ + ["comment", "// comment"], + ["comment", "/*\n comment\n*/"] +] + +---------------------------------------------------- + +Checks for comments. diff --git a/package/src/prism/tests/languages/yang/keyword_feature.test b/package/src/prism/tests/languages/yang/keyword_feature.test new file mode 100644 index 00000000..3f3d0b6a --- /dev/null +++ b/package/src/prism/tests/languages/yang/keyword_feature.test @@ -0,0 +1,53 @@ +submodule execd-ntp { + + key name; + + leaf stratum { type ntpStratum; default 10; } + + leaf version { type int8 { range "1..4"; } default 4; } + +} + +---------------------------------------------------- + +[ + ["keyword", "submodule"], + " execd-ntp ", + ["punctuation", "{"], + + ["keyword", "key"], + " name", + ["punctuation", ";"], + + ["keyword", "leaf"], + " stratum ", + ["punctuation", "{"], + ["keyword", "type"], + " ntpStratum", + ["punctuation", ";"], + ["keyword", "default"], + " 10", + ["punctuation", ";"], + ["punctuation", "}"], + + ["keyword", "leaf"], + " version ", + ["punctuation", "{"], + ["keyword", "type"], + " int8 ", + ["punctuation", "{"], + ["keyword", "range"], + ["string", "\"1..4\""], + ["punctuation", ";"], + ["punctuation", "}"], + ["keyword", "default"], + " 4", + ["punctuation", ";"], + ["punctuation", "}"], + + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/yang/namespace_feature.test b/package/src/prism/tests/languages/yang/namespace_feature.test new file mode 100644 index 00000000..294f41b5 --- /dev/null +++ b/package/src/prism/tests/languages/yang/namespace_feature.test @@ -0,0 +1,20 @@ +type foo:type +type _foo.-bar:type + +---------------------------------------------------- + +[ + ["keyword", "type"], + ["namespace", "foo"], + ["punctuation", ":"], + "type\n", + + ["keyword", "type"], + ["namespace", "_foo.-bar"], + ["punctuation", ":"], + "type" +] + +---------------------------------------------------- + +Checks for namespace prefixes. diff --git a/package/src/prism/tests/languages/yang/string_feature.test b/package/src/prism/tests/languages/yang/string_feature.test new file mode 100644 index 00000000..b7711d7e --- /dev/null +++ b/package/src/prism/tests/languages/yang/string_feature.test @@ -0,0 +1,19 @@ +" + +\"'foo'\" + +" +'fo +"" +o' + +---------------------------------------------------- + +[ + ["string", "\"\n\n\\\"'foo'\\\"\n\n\""], + ["string", "'fo\n\"\"\no'"] +] + +---------------------------------------------------- + +Checks for string. diff --git a/package/src/prism/tests/languages/zig/builtin-type_feature.test b/package/src/prism/tests/languages/zig/builtin-type_feature.test new file mode 100644 index 00000000..7f1043b5 --- /dev/null +++ b/package/src/prism/tests/languages/zig/builtin-type_feature.test @@ -0,0 +1,75 @@ +i8 +u8 +i16 +u16 +i32 +u32 +i64 +u64 +i128 +u128 +isize +usize +c_short +c_ushort +c_int +c_uint +c_long +c_ulong +c_longlong +c_ulonglong +c_longdouble +c_void +f16 +f32 +f64 +f128 +bool +void +noreturn +type +anyerror +comptime_int +comptime_float + +---------------------------------------------------- + +[ + ["builtin-type", "i8"], + ["builtin-type", "u8"], + ["builtin-type", "i16"], + ["builtin-type", "u16"], + ["builtin-type", "i32"], + ["builtin-type", "u32"], + ["builtin-type", "i64"], + ["builtin-type", "u64"], + ["builtin-type", "i128"], + ["builtin-type", "u128"], + ["builtin-type", "isize"], + ["builtin-type", "usize"], + ["builtin-type", "c_short"], + ["builtin-type", "c_ushort"], + ["builtin-type", "c_int"], + ["builtin-type", "c_uint"], + ["builtin-type", "c_long"], + ["builtin-type", "c_ulong"], + ["builtin-type", "c_longlong"], + ["builtin-type", "c_ulonglong"], + ["builtin-type", "c_longdouble"], + ["builtin-type", "c_void"], + ["builtin-type", "f16"], + ["builtin-type", "f32"], + ["builtin-type", "f64"], + ["builtin-type", "f128"], + ["builtin-type", "bool"], + ["builtin-type", "void"], + ["builtin-type", "noreturn"], + ["builtin-type", "type"], + ["builtin-type", "anyerror"], + ["builtin-type", "comptime_int"], + ["builtin-type", "comptime_float"] +] + +---------------------------------------------------- + +Checks for builtin types. diff --git a/package/src/prism/tests/languages/zig/builtin_feature.test b/package/src/prism/tests/languages/zig/builtin_feature.test new file mode 100644 index 00000000..86aa2c22 --- /dev/null +++ b/package/src/prism/tests/languages/zig/builtin_feature.test @@ -0,0 +1,417 @@ +@addWithOverflow() +@alignCast() +@alignOf() +@ArgType() +@atomicLoad() +@atomicRmw() +@bitCast() +@bitOffsetOf() +@boolToInt() +@breakpoint() +@mulAdd() +@byteSwap() +@bitReverse() +@byteOffsetOf() +@bytesToSlice() +@cDefine() +@cImport() +@cInclude() +@clz() +@cmpxchgStrong() +@cmpxchgWeak() +@compileError() +@compileLog() +@ctz() +@cUndef() +@divExact() +@divFloor() +@divTrunc() +@embedFile() +@enumToInt() +@errorName() +@errorReturnTrace() +@errorToInt() +@errSetCast() +@export() +@fence() +@field() +@fieldParentPtr() +@floatCast() +@floatToInt() +@frameAddress() +@handle() +@hasDecl() +@hasField() +@import() +@inlineCall() +@intCast() +@intToEnum() +@intToError() +@intToFloat() +@intToPtr() +@IntType() +@memberCount() +@memberName() +@memberType() +@memcpy() +@memset() +@mod() +@mulWithOverflow() +@newStackCall() +@noInlineCall() +@OpaqueType() +@panic() +@popCount() +@ptrCast() +@ptrToInt() +@rem() +@returnAddress() +@setAlignStack() +@setCold() +@setEvalBranchQuota() +@setFloatMode() +@setRuntimeSafety() +@shlExact() +@shlWithOverflow() +@shrExact() +@sizeOf() +@sliceToBytes() +@sqrt() +@sin() +@cos() +@exp() +@exp2() +@ln() +@log2() +@log10() +@fabs() +@floor() +@ceil() +@trunc() +@round() +@subWithOverflow() +@tagName() +@TagType() +@This() +@truncate() +@typeId() +@typeInfo() +@typeName() +@typeOf() +@unionInit() +@Vector() + +---------------------------------------------------- + +[ + ["builtin", "@addWithOverflow"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@alignCast"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@alignOf"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@ArgType"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@atomicLoad"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@atomicRmw"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@bitCast"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@bitOffsetOf"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@boolToInt"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@breakpoint"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@mulAdd"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@byteSwap"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@bitReverse"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@byteOffsetOf"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@bytesToSlice"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@cDefine"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@cImport"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@cInclude"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@clz"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@cmpxchgStrong"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@cmpxchgWeak"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@compileError"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@compileLog"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@ctz"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@cUndef"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@divExact"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@divFloor"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@divTrunc"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@embedFile"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@enumToInt"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@errorName"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@errorReturnTrace"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@errorToInt"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@errSetCast"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@export"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@fence"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@field"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@fieldParentPtr"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@floatCast"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@floatToInt"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@frameAddress"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@handle"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@hasDecl"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@hasField"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@import"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@inlineCall"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@intCast"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@intToEnum"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@intToError"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@intToFloat"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@intToPtr"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@IntType"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@memberCount"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@memberName"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@memberType"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@memcpy"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@memset"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@mod"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@mulWithOverflow"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@newStackCall"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@noInlineCall"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@OpaqueType"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@panic"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@popCount"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@ptrCast"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@ptrToInt"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@rem"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@returnAddress"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@setAlignStack"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@setCold"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@setEvalBranchQuota"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@setFloatMode"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@setRuntimeSafety"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@shlExact"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@shlWithOverflow"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@shrExact"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@sizeOf"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@sliceToBytes"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@sqrt"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@sin"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@cos"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@exp"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@exp2"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@ln"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@log2"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@log10"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@fabs"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@floor"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@ceil"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@trunc"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@round"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@subWithOverflow"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@tagName"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@TagType"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@This"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@truncate"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@typeId"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@typeInfo"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@typeName"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@typeOf"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@unionInit"], + ["punctuation", "("], + ["punctuation", ")"], + ["builtin", "@Vector"], + ["punctuation", "("], + ["punctuation", ")"] +] + +---------------------------------------------------- + +Checks for builtin functions. diff --git a/package/src/prism/tests/languages/zig/class-name_feature.test b/package/src/prism/tests/languages/zig/class-name_feature.test new file mode 100644 index 00000000..8f374d9a --- /dev/null +++ b/package/src/prism/tests/languages/zig/class-name_feature.test @@ -0,0 +1,544 @@ +const Timestamp = struct { + seconds: i64, + nanos: u32, + pub fn unixEpoch() Timestamp { + return Timestamp{ + .seconds = 0, + .nanos = 0, + }; + } +}; + +const one_plus_one: i32 = 1 + 1; +var x: i32; +const value: ?u32 = null; +var optional_value: ?[]const u8 = null; +var number_or_error: anyerror!i32 = error.ArgNotFound; +const array1 = [_]u32{1,2}; +var foo: S align(4) = undefined; + +fn add(a: i32, b: i32) i32 { + return a + b; +} +extern fn foo(x: f64) f64; +fn noop4() align(4) void {} +fn derp() align(@sizeOf(usize) * 2) i32 { return 1234; } + +fn eventuallyNullSequence() ?u32 { + return if (numbers_left == 0) null else blk: { + numbers_left -= 1; + break :blk numbers_left; + }; +} + +const message = [_]u8{ 'h', 'e', 'l', 'l', 'o' }; + +const mat4x4 = [4][4]f32{ + [_]f32{ 1.0, 0.0, 0.0, 0.0 }, + [_]f32{ 0.0, 1.0, 0.0, 1.0 }, + [_]f32{ 0.0, 0.0, 1.0, 0.0 }, + [_]f32{ 0.0, 0.0, 0.0, 1.0 }, +}; + +const Point = struct {}; +const Point2 = packed struct {}; +const Type = enum {}; +const Value = enum(u2) {}; +const Number = packed enum(u8) {}; +const Foo = extern enum { A, B, C }; +const Foo = extern enum { A, B, C }; +const Payload = union {}; +const ComplexType = union(ComplexTypeTag) {}; + +var node = ListOfInts.Node {}; +var list2 = LinkedList(i32) {}; + +---------------------------------------------------- + +[ + ["keyword", "const"], + ["class-name", "Timestamp"], + ["operator", "="], + ["keyword", "struct"], + ["punctuation", "{"], + + "\n\tseconds", + ["punctuation", ":"], + ["class-name", [ + ["builtin-type", "i64"] + ]], + ["punctuation", ","], + + "\n\tnanos", + ["punctuation", ":"], + ["class-name", [ + ["builtin-type", "u32"] + ]], + ["punctuation", ","], + + ["keyword", "pub"], + ["keyword", "fn"], + ["function", "unixEpoch"], + ["punctuation", "("], + ["punctuation", ")"], + ["class-name", ["Timestamp"]], + ["punctuation", "{"], + + ["keyword", "return"], + ["class-name", ["Timestamp"]], + ["punctuation", "{"], + + ["punctuation", "."], + "seconds ", + ["operator", "="], + ["number", "0"], + ["punctuation", ","], + + ["punctuation", "."], + "nanos ", + ["operator", "="], + ["number", "0"], + ["punctuation", ","], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "const"], + " one_plus_one", + ["punctuation", ":"], + ["class-name", [ + ["builtin-type", "i32"] + ]], + ["operator", "="], + ["number", "1"], + ["operator", "+"], + ["number", "1"], + ["punctuation", ";"], + + ["keyword", "var"], + " x", + ["punctuation", ":"], + ["class-name", [ + ["builtin-type", "i32"] + ]], + ["punctuation", ";"], + + ["keyword", "const"], + " value", + ["punctuation", ":"], + ["class-name", [ + ["operator", "?"], + ["builtin-type", "u32"] + ]], + ["operator", "="], + ["keyword", "null"], + ["punctuation", ";"], + + ["keyword", "var"], + " optional_value", + ["punctuation", ":"], + ["class-name", [ + ["operator", "?"], + ["punctuation", "["], + ["punctuation", "]"], + ["keyword", "const"], + ["builtin-type", "u8"] + ]], + ["operator", "="], + ["keyword", "null"], + ["punctuation", ";"], + + ["keyword", "var"], + " number_or_error", + ["punctuation", ":"], + ["class-name", [ + ["builtin-type", "anyerror"], + ["operator", "!"], + ["builtin-type", "i32"] + ]], + ["operator", "="], + ["keyword", "error"], + ["punctuation", "."], + "ArgNotFound", + ["punctuation", ";"], + + ["keyword", "const"], + " array1 ", + ["operator", "="], + ["class-name", [ + ["punctuation", "["], + "_", + ["punctuation", "]"], + ["builtin-type", "u32"] + ]], + ["punctuation", "{"], + ["number", "1"], + ["punctuation", ","], + ["number", "2"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "var"], + " foo", + ["punctuation", ":"], + ["class-name", ["S"]], + ["keyword", "align"], + ["punctuation", "("], + ["number", "4"], + ["punctuation", ")"], + ["operator", "="], + ["keyword", "undefined"], + ["punctuation", ";"], + + ["keyword", "fn"], + ["function", "add"], + ["punctuation", "("], + "a", + ["punctuation", ":"], + ["class-name", [ + ["builtin-type", "i32"] + ]], + ["punctuation", ","], + " b", + ["punctuation", ":"], + ["class-name", [ + ["builtin-type", "i32"] + ]], + ["punctuation", ")"], + ["class-name", [ + ["builtin-type", "i32"] + ]], + ["punctuation", "{"], + + ["keyword", "return"], + " a ", + ["operator", "+"], + " b", + ["punctuation", ";"], + + ["punctuation", "}"], + + ["keyword", "extern"], + ["keyword", "fn"], + ["function", "foo"], + ["punctuation", "("], + "x", + ["punctuation", ":"], + ["class-name", [ + ["builtin-type", "f64"] + ]], + ["punctuation", ")"], + ["class-name", [ + ["builtin-type", "f64"] + ]], + ["punctuation", ";"], + + ["keyword", "fn"], + ["function", "noop4"], + ["punctuation", "("], + ["punctuation", ")"], + ["keyword", "align"], + ["punctuation", "("], + ["number", "4"], + ["punctuation", ")"], + ["class-name", [ + ["builtin-type", "void"] + ]], + ["punctuation", "{"], + ["punctuation", "}"], + + ["keyword", "fn"], + ["function", "derp"], + ["punctuation", "("], + ["punctuation", ")"], + ["keyword", "align"], + ["punctuation", "("], + ["builtin", "@sizeOf"], + ["punctuation", "("], + ["builtin-type", "usize"], + ["punctuation", ")"], + ["operator", "*"], + ["number", "2"], + ["punctuation", ")"], + ["class-name", [ + ["builtin-type", "i32"] + ]], + ["punctuation", "{"], + ["keyword", "return"], + ["number", "1234"], + ["punctuation", ";"], + ["punctuation", "}"], + + ["keyword", "fn"], + ["function", "eventuallyNullSequence"], + ["punctuation", "("], + ["punctuation", ")"], + ["class-name", [ + ["operator", "?"], + ["builtin-type", "u32"] + ]], + ["punctuation", "{"], + + ["keyword", "return"], + ["keyword", "if"], + ["punctuation", "("], + "numbers_left ", + ["operator", "=="], + ["number", "0"], + ["punctuation", ")"], + ["keyword", "null"], + ["keyword", "else"], + ["label", "blk"], + ["punctuation", ":"], + ["punctuation", "{"], + + "\n\t\tnumbers_left ", + ["operator", "-="], + ["number", "1"], + ["punctuation", ";"], + + ["keyword", "break"], + ["punctuation", ":"], + ["label", "blk"], + " numbers_left", + ["punctuation", ";"], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["keyword", "const"], + " message ", + ["operator", "="], + ["class-name", [ + ["punctuation", "["], + "_", + ["punctuation", "]"], + ["builtin-type", "u8"] + ]], + ["punctuation", "{"], + ["char", "'h'"], + ["punctuation", ","], + ["char", "'e'"], + ["punctuation", ","], + ["char", "'l'"], + ["punctuation", ","], + ["char", "'l'"], + ["punctuation", ","], + ["char", "'o'"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "const"], + " mat4x4 ", + ["operator", "="], + ["class-name", [ + ["punctuation", "["], + ["number", "4"], + ["punctuation", "]"], + ["punctuation", "["], + ["number", "4"], + ["punctuation", "]"], + ["builtin-type", "f32"] + ]], + ["punctuation", "{"], + + ["class-name", [ + ["punctuation", "["], + "_", + ["punctuation", "]"], + ["builtin-type", "f32"] + ]], + ["punctuation", "{"], + ["number", "1.0"], + ["punctuation", ","], + ["number", "0.0"], + ["punctuation", ","], + ["number", "0.0"], + ["punctuation", ","], + ["number", "0.0"], + ["punctuation", "}"], + ["punctuation", ","], + + ["class-name", [ + ["punctuation", "["], + "_", + ["punctuation", "]"], + ["builtin-type", "f32"] + ]], + ["punctuation", "{"], + ["number", "0.0"], + ["punctuation", ","], + ["number", "1.0"], + ["punctuation", ","], + ["number", "0.0"], + ["punctuation", ","], + ["number", "1.0"], + ["punctuation", "}"], + ["punctuation", ","], + + ["class-name", [ + ["punctuation", "["], + "_", + ["punctuation", "]"], + ["builtin-type", "f32"] + ]], + ["punctuation", "{"], + ["number", "0.0"], + ["punctuation", ","], + ["number", "0.0"], + ["punctuation", ","], + ["number", "1.0"], + ["punctuation", ","], + ["number", "0.0"], + ["punctuation", "}"], + ["punctuation", ","], + + ["class-name", [ + ["punctuation", "["], + "_", + ["punctuation", "]"], + ["builtin-type", "f32"] + ]], + ["punctuation", "{"], + ["number", "0.0"], + ["punctuation", ","], + ["number", "0.0"], + ["punctuation", ","], + ["number", "0.0"], + ["punctuation", ","], + ["number", "1.0"], + ["punctuation", "}"], + ["punctuation", ","], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "const"], + ["class-name", "Point"], + ["operator", "="], + ["keyword", "struct"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "const"], + ["class-name", "Point2"], + ["operator", "="], + ["keyword", "packed"], + ["keyword", "struct"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "const"], + ["class-name", "Type"], + ["operator", "="], + ["keyword", "enum"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "const"], + ["class-name", "Value"], + ["operator", "="], + ["keyword", "enum"], + ["punctuation", "("], + "u2", + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "const"], + ["class-name", "Number"], + ["operator", "="], + ["keyword", "packed"], + ["keyword", "enum"], + ["punctuation", "("], + ["builtin-type", "u8"], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "const"], + ["class-name", "Foo"], + ["operator", "="], + ["keyword", "extern"], + ["keyword", "enum"], + ["punctuation", "{"], + " A", + ["punctuation", ","], + " B", + ["punctuation", ","], + " C ", + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "const"], + ["class-name", "Foo"], + ["operator", "="], + ["keyword", "extern"], + ["keyword", "enum"], + ["punctuation", "{"], + " A", + ["punctuation", ","], + " B", + ["punctuation", ","], + " C ", + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "const"], + ["class-name", "Payload"], + ["operator", "="], + ["keyword", "union"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "const"], + ["class-name", "ComplexType"], + ["operator", "="], + ["keyword", "union"], + ["punctuation", "("], + "ComplexTypeTag", + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "var"], + " node ", + ["operator", "="], + ["class-name", [ + "ListOfInts", + ["punctuation", "."], + "Node" + ]], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"], + + ["keyword", "var"], + " list2 ", + ["operator", "="], + ["function", "LinkedList"], + ["punctuation", "("], + ["builtin-type", "i32"], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", ";"] +] + +---------------------------------------------------- + +Checks for class names. diff --git a/package/src/prism/tests/languages/zig/comment_feature.test b/package/src/prism/tests/languages/zig/comment_feature.test new file mode 100644 index 00000000..0bbe6b19 --- /dev/null +++ b/package/src/prism/tests/languages/zig/comment_feature.test @@ -0,0 +1,21 @@ +// normal comment + +/// A structure for storing a timestamp, with nanosecond precision (this is a +/// multiline doc comment). + +//! This module provides functions for retrieving the current date and +//! time with varying degrees of precision and accuracy. It does not +//! depend on libc, but will use functions from it if available. + +---------------------------------------------------- + +[ + ["comment", "// normal comment"], + + ["comment", "/// A structure for storing a timestamp, with nanosecond precision (this is a"], + ["comment", "/// multiline doc comment)."], + + ["comment", "//! This module provides functions for retrieving the current date and"], + ["comment", "//! time with varying degrees of precision and accuracy. It does not"], + ["comment", "//! depend on libc, but will use functions from it if available."] +] diff --git a/package/src/prism/tests/languages/zig/keyword_feature.test b/package/src/prism/tests/languages/zig/keyword_feature.test new file mode 100644 index 00000000..0dfe33e2 --- /dev/null +++ b/package/src/prism/tests/languages/zig/keyword_feature.test @@ -0,0 +1,111 @@ +align +allowzero +and +anyframe +anytype +asm +async +await +break +cancel +catch +comptime +const +continue +defer +else +enum +errdefer +error +export +extern +fn +for +if +inline +linksection +nakedcc +noalias +nosuspend +null +or +orelse +packed +promise +pub +resume +return +stdcallcc +struct +suspend +switch +test +threadlocal +try +undefined +union +unreachable +usingnamespace +var +volatile +while + +---------------------------------------------------- + +[ + ["keyword", "align"], + ["keyword", "allowzero"], + ["keyword", "and"], + ["keyword", "anyframe"], + ["keyword", "anytype"], + ["keyword", "asm"], + ["keyword", "async"], + ["keyword", "await"], + ["keyword", "break"], + ["keyword", "cancel"], + ["keyword", "catch"], + ["keyword", "comptime"], + ["keyword", "const"], + ["keyword", "continue"], + ["keyword", "defer"], + ["keyword", "else"], + ["keyword", "enum"], + ["keyword", "errdefer"], + ["keyword", "error"], + ["keyword", "export"], + ["keyword", "extern"], + ["keyword", "fn"], + ["keyword", "for"], + ["keyword", "if"], + ["keyword", "inline"], + ["keyword", "linksection"], + ["keyword", "nakedcc"], + ["keyword", "noalias"], + ["keyword", "nosuspend"], + ["keyword", "null"], + ["keyword", "or"], + ["keyword", "orelse"], + ["keyword", "packed"], + ["keyword", "promise"], + ["keyword", "pub"], + ["keyword", "resume"], + ["keyword", "return"], + ["keyword", "stdcallcc"], + ["keyword", "struct"], + ["keyword", "suspend"], + ["keyword", "switch"], + ["keyword", "test"], + ["keyword", "threadlocal"], + ["keyword", "try"], + ["keyword", "undefined"], + ["keyword", "union"], + ["keyword", "unreachable"], + ["keyword", "usingnamespace"], + ["keyword", "var"], + ["keyword", "volatile"], + ["keyword", "while"] +] + +---------------------------------------------------- + +Checks for keywords. diff --git a/package/src/prism/tests/languages/zig/label_feature.test b/package/src/prism/tests/languages/zig/label_feature.test new file mode 100644 index 00000000..8dbf648b --- /dev/null +++ b/package/src/prism/tests/languages/zig/label_feature.test @@ -0,0 +1,85 @@ +outer: while (true) { + while (true) { + break :outer; + } +} + +fn eventuallyErrorSequence() anyerror!u32 { + return if (numbers_left == 0) error.ReachedZero else blk: { + numbers_left -= 1; + break :blk numbers_left; + }; +} + +---------------------------------------------------- + +[ + ["label", "outer"], + ["punctuation", ":"], + ["keyword", "while"], + ["punctuation", "("], + ["boolean", "true"], + ["punctuation", ")"], + ["punctuation", "{"], + + ["keyword", "while"], + ["punctuation", "("], + ["boolean", "true"], + ["punctuation", ")"], + ["punctuation", "{"], + + ["keyword", "break"], + ["punctuation", ":"], + ["label", "outer"], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["punctuation", "}"], + + ["keyword", "fn"], + ["function", "eventuallyErrorSequence"], + ["punctuation", "("], + ["punctuation", ")"], + ["class-name", [ + ["builtin-type", "anyerror"], + ["operator", "!"], + ["builtin-type", "u32"] + ]], + ["punctuation", "{"], + + ["keyword", "return"], + ["keyword", "if"], + ["punctuation", "("], + "numbers_left ", + ["operator", "=="], + ["number", "0"], + ["punctuation", ")"], + ["keyword", "error"], + ["punctuation", "."], + "ReachedZero ", + ["keyword", "else"], + ["label", "blk"], + ["punctuation", ":"], + ["punctuation", "{"], + + "\n\t\tnumbers_left ", + ["operator", "-="], + ["number", "1"], + ["punctuation", ";"], + + ["keyword", "break"], + ["punctuation", ":"], + ["label", "blk"], + " numbers_left", + ["punctuation", ";"], + + ["punctuation", "}"], + ["punctuation", ";"], + + ["punctuation", "}"] +] + +---------------------------------------------------- + +Checks for labels. diff --git a/package/src/prism/tests/languages/zig/number_feature.test b/package/src/prism/tests/languages/zig/number_feature.test new file mode 100644 index 00000000..8fc87f8c --- /dev/null +++ b/package/src/prism/tests/languages/zig/number_feature.test @@ -0,0 +1,22 @@ +123 +123.456e-7 + +0xBadFace +0xBAD.FACEp+F + +0b1001 +0o377 +---------------------------------------------------- + +[ + ["number", "123"], + ["number", "123.456e-7"], + ["number", "0xBadFace"], + ["number", "0xBAD.FACEp+F"], + ["number", "0b1001"], + ["number", "0o377"] +] + +---------------------------------------------------- + +Checks for numbers. diff --git a/package/src/prism/tests/languages/zig/operator_feature.test b/package/src/prism/tests/languages/zig/operator_feature.test new file mode 100644 index 00000000..0bdbd3d7 --- /dev/null +++ b/package/src/prism/tests/languages/zig/operator_feature.test @@ -0,0 +1,73 @@ ++ - * / % ++= -= *= /= %= + +& | ^ +&= |= ^= + ++% -% *% ++%= -%= *%= + +** ++ + +< > <= >= ! != == = +~ << <<= >> >>= + +.* .? +.. ... + +=> -> +? +|| + +---------------------------------------------------- +[ + ["operator", "+"], + ["operator", "-"], + ["operator", "*"], + ["operator", "/"], + ["operator", "%"], + ["operator", "+="], + ["operator", "-="], + ["operator", "*="], + ["operator", "/="], + ["operator", "%="], + ["operator", "&"], + ["operator", "|"], + ["operator", "^"], + ["operator", "&="], + ["operator", "|="], + ["operator", "^="], + ["operator", "+%"], + ["operator", "-%"], + ["operator", "*%"], + ["operator", "+%="], + ["operator", "-%="], + ["operator", "*%="], + ["operator", "**"], + ["operator", "++"], + ["operator", "<"], + ["operator", ">"], + ["operator", "<="], + ["operator", ">="], + ["operator", "!"], + ["operator", "!="], + ["operator", "=="], + ["operator", "="], + ["operator", "~"], + ["operator", "<<"], + ["operator", "<<="], + ["operator", ">>"], + ["operator", ">>="], + ["operator", ".*"], + ["operator", ".?"], + ["operator", ".."], + ["operator", "..."], + ["operator", "=>"], + ["operator", "->"], + ["operator", "?"], + ["operator", "||"] +] + +---------------------------------------------------- + +Checks for operators. diff --git a/package/src/prism/tests/languages/zig/punctuation_feature.test b/package/src/prism/tests/languages/zig/punctuation_feature.test new file mode 100644 index 00000000..a041e074 --- /dev/null +++ b/package/src/prism/tests/languages/zig/punctuation_feature.test @@ -0,0 +1,21 @@ +. : , ; +( ) { } [ ] + +---------------------------------------------------- + +[ + ["punctuation", "."], + ["punctuation", ":"], + ["punctuation", ","], + ["punctuation", ";"], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + ["punctuation", "}"], + ["punctuation", "["], + ["punctuation", "]"] +] + +---------------------------------------------------- + +Checks for punctuation. diff --git a/package/src/prism/tests/languages/zig/string_char_feature.test b/package/src/prism/tests/languages/zig/string_char_feature.test new file mode 100644 index 00000000..7b3ac658 --- /dev/null +++ b/package/src/prism/tests/languages/zig/string_char_feature.test @@ -0,0 +1,160 @@ +// source: https://ziglang.org/documentation/master/#String-Literals-and-Character-Literals + +const expect = @import("std").testing.expect; +const mem = @import("std").mem; + +test "string literals" { + const bytes = "hello"; + expect(@TypeOf(bytes) == *const [5:0]u8); + expect(bytes.len == 5); + expect(bytes[1] == 'e'); + expect(bytes[5] == 0); + expect('e' == '\x65'); + expect('\u{1f4a9}' == 128169); + expect('💯' == 128175); + expect(mem.eql(u8, "hello", "h\x65llo")); +} + +const hello_world_in_c = + \\#include + \\ + \\int main(int argc, char **argv) { + \\ printf("hello world\n"); + \\ return 0; + \\} +; + +---------------------------------------------------- + +[ + ["comment", "// source: https://ziglang.org/documentation/master/#String-Literals-and-Character-Literals"], + + ["keyword", "const"], + " expect ", + ["operator", "="], + ["builtin", "@import"], + ["punctuation", "("], + ["string", "\"std\""], + ["punctuation", ")"], + ["punctuation", "."], + "testing", + ["punctuation", "."], + "expect", + ["punctuation", ";"], + + ["keyword", "const"], + " mem ", + ["operator", "="], + ["builtin", "@import"], + ["punctuation", "("], + ["string", "\"std\""], + ["punctuation", ")"], + ["punctuation", "."], + "mem", + ["punctuation", ";"], + + ["keyword", "test"], + ["string", "\"string literals\""], + ["punctuation", "{"], + + ["keyword", "const"], + " bytes ", + ["operator", "="], + ["string", "\"hello\""], + ["punctuation", ";"], + + ["function", "expect"], + ["punctuation", "("], + ["builtin", "@TypeOf"], + ["punctuation", "("], + "bytes", + ["punctuation", ")"], + ["operator", "=="], + ["operator", "*"], + ["keyword", "const"], + ["punctuation", "["], + ["number", "5"], + ["punctuation", ":"], + ["number", "0"], + ["punctuation", "]"], + ["builtin-type", "u8"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["function", "expect"], + ["punctuation", "("], + "bytes", + ["punctuation", "."], + "len ", + ["operator", "=="], + ["number", "5"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["function", "expect"], + ["punctuation", "("], + "bytes", + ["punctuation", "["], + ["number", "1"], + ["punctuation", "]"], + ["operator", "=="], + ["char", "'e'"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["function", "expect"], + ["punctuation", "("], + "bytes", + ["punctuation", "["], + ["number", "5"], + ["punctuation", "]"], + ["operator", "=="], + ["number", "0"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["function", "expect"], + ["punctuation", "("], + ["char", "'e'"], + ["operator", "=="], + ["char", "'\\x65'"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["function", "expect"], + ["punctuation", "("], + ["char", "'\\u{1f4a9}'"], + ["operator", "=="], + ["number", "128169"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["function", "expect"], + ["punctuation", "("], + ["char", "'💯'"], + ["operator", "=="], + ["number", "128175"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["function", "expect"], + ["punctuation", "("], + "mem", + ["punctuation", "."], + ["function", "eql"], + ["punctuation", "("], + ["builtin-type", "u8"], + ["punctuation", ","], + ["string", "\"hello\""], + ["punctuation", ","], + ["string", "\"h\\x65llo\""], + ["punctuation", ")"], + ["punctuation", ")"], + ["punctuation", ";"], + + ["punctuation", "}"], + + ["keyword", "const"], " hello_world_in_c ", ["operator", "="], + ["string", " \\\\#include \n \\\\\n \\\\int main(int argc, char **argv) {\n \\\\ printf(\"hello world\\n\");\n \\\\ return 0;\n \\\\}"], + ["punctuation", ";"] +] diff --git a/package/src/prism/tests/optional.json b/package/src/prism/tests/optional.json new file mode 100644 index 00000000..9a167ba3 --- /dev/null +++ b/package/src/prism/tests/optional.json @@ -0,0 +1,293 @@ +{ + "abap": [], + "abnf": [], + "actionscript": [], + "ada": [], + "agda": [], + "al": [], + "antlr4": [], + "apacheconf": [], + "apex": [], + "apl": [], + "applescript": [], + "aql": [], + "arduino": [], + "arff": [], + "armasm": [], + "arturo": [], + "asciidoc": [], + "asm6502": [], + "asmatmel": [], + "aspnet": [], + "autohotkey": [], + "autoit": [], + "avisynth": [], + "avro-idl": [], + "awk": [], + "bash": [], + "basic": [], + "batch": [], + "bbcode": [], + "bbj": [], + "bicep": [], + "birb": [], + "bison": [], + "bnf": [], + "bqn": [], + "brainfuck": [], + "brightscript": [], + "bro": [], + "bsl": [], + "c": ["opencl"], + "cfscript": [], + "chaiscript": [], + "cil": [], + "cilkc": [], + "cilkcpp": [], + "clike": [], + "clojure": [], + "cmake": [], + "cobol": [], + "coffeescript": [], + "concurnas": [], + "cooklang": [], + "coq": [], + "cpp": ["opencl"], + "crystal": [], + "csharp": ["xml-doc"], + "cshtml": [], + "csp": [], + "css": ["css-extras"], + "csv": [], + "cue": [], + "cypher": [], + "d": [], + "dart": [], + "dataweave": [], + "dax": [], + "dhall": [], + "diff": [], + "django": [], + "dns-zone-file": [], + "docker": [], + "dot": [], + "ebnf": [], + "editorconfig": [], + "eiffel": [], + "ejs": [], + "elixir": [], + "elm": [], + "erb": [], + "erlang": [], + "etlua": [], + "excel-formula": [], + "factor": [], + "false": [], + "firestore-security-rules": [], + "flow": [], + "fortran": [], + "fsharp": ["xml-doc"], + "ftl": [], + "gap": [], + "gcode": [], + "gdscript": [], + "gedcom": [], + "gettext": [], + "gherkin": [], + "git": [], + "glsl": [], + "gml": [], + "gn": [], + "go-module": [], + "go": [], + "gradle": [], + "graphql": [], + "groovy": [], + "haml": [], + "handlebars": [], + "haskell": [], + "haxe": [], + "hcl": [], + "hlsl": [], + "hoon": [], + "hpkp": [], + "hsts": [], + "http": ["json"], + "ichigojam": [], + "icon": [], + "icu-message-format": [], + "idris": [], + "iecst": [], + "ignore": [], + "inform7": [], + "ini": [], + "io": [], + "j": [], + "java": [], + "javadoc": [], + "javadoclike": [], + "javascript": ["js-templates"], + "javastacktrace": [], + "jexl": [], + "jolie": [], + "jq": [], + "jsdoc": [], + "json": [], + "json5": [], + "jsonp": [], + "jsstacktrace": [], + "jsx": [], + "julia": [], + "keepalived": [], + "keyman": [], + "kotlin": [], + "kumir": [], + "kusto": [], + "latex": [], + "latte": [], + "less": [], + "lilypond": [], + "linker-script": [], + "liquid": [], + "lisp": [], + "livescript": [], + "llvm": [], + "log": ["javastacktrace"], + "lolcode": [], + "lua": [], + "magma": [], + "makefile": [], + "markdown": [], + "markup": [], + "mata": [], + "matlab": [], + "maxscript": [], + "mel": [], + "mermaid": [], + "metafont": [], + "mizar": [], + "mongodb": [], + "monkey": [], + "moonscript": [], + "n1ql": [], + "n4js": [], + "nand2tetris-hdl": [], + "naniscript": [], + "nasm": [], + "neon": [], + "nevod": [], + "nginx": [], + "nim": [], + "nix": [], + "nsis": [], + "objectivec": [], + "ocaml": [], + "odin": [], + "opencl": [], + "openqasm": [], + "oz": [], + "parigp": [], + "parser": [], + "pascal": [], + "pascaligo": [], + "pcaxis": [], + "peoplecode": [], + "perl": [], + "php": ["php-extras"], + "phpdoc": [], + "plant-uml": [], + "plsql": [], + "powerquery": [], + "powershell": [], + "processing": [], + "prolog": [], + "promql": [], + "properties": [], + "protobuf": [], + "psl": [], + "pug": [], + "puppet": [], + "pure": [], + "purebasic": [], + "purescript": [], + "python": [], + "q": [], + "qml": [], + "qore": [], + "qsharp": [], + "r": [], + "racket": [], + "reason": [], + "regex": [], + "rego": [], + "renpy": [], + "rescript": [], + "rest": [], + "rip": [], + "roboconf": [], + "robotframework": [], + "ruby": [], + "rust": [], + "sas": [], + "sass": [], + "scala": [], + "scheme": [], + "scss": [], + "shell-session": [], + "smali": [], + "smalltalk": [], + "smarty": [], + "sml": [], + "solidity": [], + "solution-file": [], + "soy": [], + "sparql": [], + "splunk-spl": [], + "sqf": [], + "sql": [], + "squirrel": [], + "stan": [], + "stata": [], + "stylus": [], + "supercollider": [], + "swift": [], + "systemd": [], + "t4-cs": [], + "t4-vb": [], + "tap": [], + "tcl": [], + "textile": [], + "toml": [], + "tremor": [], + "tsx": [], + "tt2": [], + "turtle": [], + "twig": [], + "typescript": [], + "typoscript": [], + "unrealscript": [], + "uorazor": [], + "uri": [], + "v": [], + "vala": [], + "vbnet": ["xml-doc"], + "velocity": [], + "verilog": [], + "vhdl": [], + "vim": [], + "visual-basic": [], + "warpscript": [], + "wasm": [], + "web-idl": [], + "wgsl": [], + "wiki": [], + "wolfram": [], + "wren": [], + "xeora": [], + "xml": [], + "xojo": [], + "xquery": [], + "yaml": [], + "yang": [], + "zig": [] +} diff --git a/package/src/prism/tests/pattern-tests.js b/package/src/prism/tests/pattern-tests.js new file mode 100644 index 00000000..78519eb7 --- /dev/null +++ b/package/src/prism/tests/pattern-tests.js @@ -0,0 +1,762 @@ +// Prism's patterns tests with minor changes +// https://github.com/PrismJS/prism/blob/v1.29.0/tests/pattern-tests.js + +'use strict'; + +import { assert } from 'chai'; +import { loadLanguages } from './helper/prism-loader.js'; +import { BFS, BFSPathToPrismTokenPath, parseRegex } from './helper/util.js'; +import { visitRegExpAST } from 'regexpp'; +import { transform, combineTransformers, getIntersectionWordSets, JS, Words, NFA, Transformers, isDisjointWith } from 'refa'; +import { analyse } from 'scslre'; +import { isPotentiallyZeroLength, isZeroLength, getEffectiveMaximumRepetition, hasSomeDescendant } from 'regexp-ast-analysis'; +import { languages } from '../core.js'; +import { language } from './helper/args.js'; +import { optionals } from './helper/lang-info.js'; + +for (const lang in optionals) { + if (language && lang !== language) { + continue; + } + + describe(`Patterns of '${lang}'`, () => { + testPatterns([lang]); + }); + + const optional = optionals[lang]; + + if (optional.length) { + + describe(`Patterns of '${lang}' with optional dependencies`, () => { + testPatterns([lang, ...optional]); + }); + } +} + +/** + * @param {string[]} langs + * + * @typedef {import("./helper/util").LiteralAST} LiteralAST + * @typedef {import("regexpp/ast").CapturingGroup} CapturingGroup + * @typedef {import("regexpp/ast").Element} Element + * @typedef {import("regexpp/ast").Group} Group + * @typedef {import("regexpp/ast").LookaroundAssertion} LookaroundAssertion + * @typedef {import("regexpp/ast").Pattern} Pattern + */ +function testPatterns(langs) { + + /** + * Invokes the given function on every pattern in `Prism.languages`. + * + * _Note:_ This will aggregate all errors thrown by the given callback and throw an aggregated error at the end + * of the iteration. You can also append any number of errors per callback using the `reportError` function. + * + * @param {(values: ForEachPatternCallbackValue) => void} callback + * + * @typedef ForEachPatternCallbackValue + * @property {RegExp} pattern + * @property {LiteralAST} ast + * @property {string} tokenPath + * @property {string} name + * @property {any} parent + * @property {boolean} lookbehind Whether the first capturing group of the pattern is a Prism lookbehind group. + * @property {CapturingGroup | undefined} lookbehindGroup + * @property {{ key: string, value: any }[]} path + * @property {(message: string) => void} reportError + */ + async function forEachPattern(callback) { + const visited = new Set(); + const errors = []; + + /** + * @param {object} root + * @param {string} rootStr + */ + function traverse(root, rootStr) { + if (visited.has(root)) { + return; + } + visited.add(root); + + BFS(root, path => { + const { key, value } = path[path.length - 1]; + const tokenPath = BFSPathToPrismTokenPath(path, rootStr); + visited.add(value); + + if (Object.prototype.toString.call(value) == '[object RegExp]') { + try { + let ast; + try { + ast = parseRegex(value); + } catch (error) { + throw new SyntaxError(`Invalid RegExp at ${tokenPath}\n\n${error.message}`); + } + + const parent = path.length > 1 ? path[path.length - 2].value : undefined; + const lookbehind = key === 'pattern' && parent && !!parent.lookbehind; + const lookbehindGroup = lookbehind ? getFirstCapturingGroup(ast.pattern) : undefined; + callback({ + pattern: value, + ast, + tokenPath, + name: key, + parent, + path, + lookbehind, + lookbehindGroup, + reportError: message => errors.push(message) + }); + } catch (error) { + errors.push(error); + } + } + }); + } + + await loadLanguages(langs); + + // static analysis + for (let name in languages) { + traverse(languages[name], name); + } + + if (errors.length > 0) { + throw new Error(errors.map(e => String(e.message || e)).join('\n\n')); + } + } + + /** + * Invokes the given callback for all capturing groups in the given pattern in left to right order. + * + * @param {Pattern} pattern + * @param {(values: ForEachCapturingGroupCallbackValue) => void} callback + * + * @typedef ForEachCapturingGroupCallbackValue + * @property {CapturingGroup} group + * @property {number} number Note: Starts at 1. + */ + function forEachCapturingGroup(pattern, callback) { + let number = 0; + visitRegExpAST(pattern, { + onCapturingGroupEnter(node) { + callback({ + group: node, + number: ++number + }); + } + }); + } + + it('- should not match the empty string', async () => { + await forEachPattern(({ ast, pattern, tokenPath }) => { + // test for empty string + const empty = isPotentiallyZeroLength(ast.pattern.alternatives); + assert.isFalse(empty, `${tokenPath}: ${pattern} should not match the empty string.\n\n` + + `Patterns that do match the empty string can potentially cause infinitely many empty tokens. ` + + `Make sure that all patterns always consume at least one character.`); + }); + }); + + it('- should have a capturing group if lookbehind is set to true', async () => { + await forEachPattern(({ ast, tokenPath, lookbehind }) => { + if (lookbehind) { + let hasCapturingGroup = false; + forEachCapturingGroup(ast.pattern, () => { hasCapturingGroup = true; }); + + if (!hasCapturingGroup) { + assert.fail(`${tokenPath}: The pattern is set to 'lookbehind: true' but does not have a capturing group.\n\n` + + `Prism lookbehind groups use the captured text of the first capturing group to simulate a lookbehind. ` + + `Without a capturing group, a lookbehind is not possible.\n` + + `To fix this, either add a capturing group for the lookbehind or remove the 'lookbehind' property.`); + } + } + }); + }); + + it('- should not have lookbehind groups that can be preceded by some characters', async () => { + await forEachPattern(({ tokenPath, lookbehindGroup }) => { + if (lookbehindGroup && !isFirstMatch(lookbehindGroup)) { + assert.fail(`${tokenPath}: The lookbehind group ${lookbehindGroup.raw} might be preceded by some characters.\n\n` + + `Prism assumes that the lookbehind group, if captured, is the first thing matched by the regex. ` + + `If characters might precede the lookbehind group (e.g. /a?(b)c/), then Prism cannot correctly apply the lookbehind correctly in all cases.\n` + + `To fix this, either remove the preceding characters or include them in the lookbehind group.`); + } + }); + }); + + it('- should not have lookbehind groups that only have zero-width alternatives', async () => { + await forEachPattern(({ tokenPath, lookbehindGroup, reportError }) => { + if (lookbehindGroup && isZeroLength(lookbehindGroup)) { + const groupContent = lookbehindGroup.raw.substr(1, lookbehindGroup.raw.length - 2); + const replacement = lookbehindGroup.alternatives.length === 1 ? groupContent : `(?:${groupContent})`; + reportError(`${tokenPath}: The lookbehind group ${lookbehindGroup.raw} does not consume characters.\n\n` + + `Therefor it is not necessary to use a lookbehind group.\n` + + `To fix this, replace the lookbehind group with ${replacement} and remove the 'lookbehind' property.`); + } + }); + }); + + it('- should not have greedy tokens without the global flag', async () => { + await forEachPattern(({ tokenPath, pattern, parent }) => { + if (parent.greedy && !pattern.global) { + assert.fail(`${tokenPath}: The pattern is set to 'greedy: true', but does not have the global flag.\n` + + 'Greedy matching does not work without the global flag.\n' + + 'Consider adding the global flag or removing the greedy property.'); + } + }); + }); + + it('- should not have unused capturing groups', async () => { + await forEachPattern(({ ast, tokenPath, lookbehindGroup, reportError }) => { + forEachCapturingGroup(ast.pattern, ({ group, number }) => { + const isLookbehindGroup = group === lookbehindGroup; + if (group.references.length === 0 && !isLookbehindGroup) { + const fixes = []; + fixes.push(`Make this group a non-capturing group ('(?:...)' instead of '(...)'). (It's usually this option.)`); + fixes.push(`Reference this group with a backreference (use '\\${number}' for this).`); + if (number === 1 && !lookbehindGroup) { + if (isFirstMatch(group)) { + fixes.push(`Add a 'lookbehind: true' declaration.`); + } else { + fixes.push(`Add a 'lookbehind: true' declaration. (This group is not a valid lookbehind group because it can be preceded by some characters.)`); + } + } + + reportError(`${tokenPath}: Unused capturing group ${group.raw}.\n\n` + + `Unused capturing groups generally degrade the performance of regular expressions. ` + + `They might also be a sign that a backreference is incorrect or that a 'lookbehind: true' declaration in missing.\n` + + `To fix this, do one of the following:\n` + + fixes.map(f => '- ' + f).join('\n')); + } + }); + }); + }); + + it('- should have nice names and aliases', async () => { + const niceName = /^[a-z][a-z\d]*(?:-[a-z\d]+)*$/; + /** @param {string} name */ + function testName(name, desc = 'token name') { + if (!niceName.test(name)) { + assert.fail(`The ${desc} '${name}' does not match ${niceName}.\n\n` + + `To fix this, choose a name that matches the above regular expression.`); + } + } + + await forEachPattern(({ name, parent, tokenPath, path }) => { + // token name + let offset = 1; + if (name == 'pattern') { // regex can be inside an object + offset++; + } + if (Array.isArray(path[path.length - 1 - offset].value)) { // regex/regex object can be inside an array + offset++; + } + const patternName = path[path.length - offset].key; + testName(patternName); + + // check alias + if (name == 'pattern' && 'alias' in parent) { + /** @type {string} */ + const alias = parent.alias; + if (alias) alias.split(" ").forEach(name => testName(name, `alias of '${tokenPath}'`)); + } + }); + }); + + it('- should not use octal escapes', async () => { + await forEachPattern(({ ast, tokenPath, reportError }) => { + visitRegExpAST(ast.pattern, { + onCharacterEnter(node) { + if (/^\\(?:[1-9]|\d{2,})$/.test(node.raw)) { + reportError(`${tokenPath}: Octal escape ${node.raw}.\n\n` + + `Octal escapes can be confused with backreferences, so please do not use them.\n` + + `To fix this, use a different escape method. ` + + `Note that this could also be an invalid backreference, so be sure to carefully analyse the pattern.`); + } + } + }); + }); + }); + + it('- should not cause exponential backtracking', async () => { + await replaceRegExpProto(exec => { + return function (input) { + checkExponentialBacktracking('', this); + return exec.call(this, input); + }; + }, async () => { + await forEachPattern(({ pattern, ast, tokenPath }) => { + checkExponentialBacktracking(tokenPath, pattern, ast); + }); + }); + }); + + it('- should not cause polynomial backtracking', async () => { + await replaceRegExpProto(exec => { + return function (input) { + checkPolynomialBacktracking('', this); + return exec.call(this, input); + }; + }, async () => { + await forEachPattern(({ pattern, ast, tokenPath }) => { + checkPolynomialBacktracking(tokenPath, pattern, ast); + }); + }); + }); +} + + +/** + * Returns the first capturing group in the given pattern. + * + * @param {Pattern} pattern + * @returns {CapturingGroup | undefined} + */ +function getFirstCapturingGroup(pattern) { + let cap = undefined; + + try { + visitRegExpAST(pattern, { + onCapturingGroupEnter(node) { + cap = node; + throw new Error('stop'); + } + }); + } catch (error) { + // ignore errors + } + + return cap; +} + +/** + * Returns whether the given element will always at the start of the whole match. + * + * @param {Element} element + * @returns {boolean} + */ +function isFirstMatch(element) { + const parent = element.parent; + switch (parent.type) { + case 'Alternative': { + // all elements before this element have to of zero length + if (!parent.elements.slice(0, parent.elements.indexOf(element)).every(isZeroLength)) { + return false; + } + const grandParent = parent.parent; + if (grandParent.type === 'Pattern') { + return true; + } else { + return isFirstMatch(grandParent); + } + } + + case 'Quantifier': + if (parent.max >= 2) { + return false; + } else { + return isFirstMatch(parent); + } + + default: + throw new Error(`Internal error: The given node should not be a '${element.type}'.`); + } +} + +/** + * Returns whether the given node either is or is a child of what is effectively a Kleene star. + * + * @param {import("regexpp/ast").Node} node + * @returns {boolean} + */ +function underAStar(node) { + return getEffectiveMaximumRepetition(node) > 10; +} + +/** + * @param {Iterable} iter + * @returns {T | undefined} + * @template T + */ +function firstOf(iter) { + const [first] = iter; + return first; +} + +/** + * A set of all safe (non-exponentially backtracking) RegExp literals (string). + * + * @type {Set} + */ +const expoSafeRegexes = new Set(); + +/** @type {Transformers.CreationOptions} */ +const options = { + ignoreOrder: true, + ignoreAmbiguity: true +}; +const transformer = combineTransformers([ + Transformers.inline(options), + Transformers.removeDeadBranches(options), + Transformers.unionCharacters(options), + Transformers.moveUpEmpty(options), + Transformers.nestedQuantifiers(options), + Transformers.sortAssertions(options), + Transformers.removeUnnecessaryAssertions(options), + Transformers.applyAssertions(options), +]); + + +/** @type {Map>} */ +const resultCache = new Map(); +/** + * @param {string} cacheName + * @returns {Map} + */ +function getResultCache(cacheName) { + let cache = resultCache.get(cacheName); + if (cache === undefined) { + resultCache.set(cacheName, cache = new Map()); + } + return cache; +} +/** + * @param {string} cacheName + * @param {T} cacheKey + * @param {(node: T) => void} compute + * @returns {void} + * @template {import('regexpp/ast').Node} T + */ +function withResultCache(cacheName, cacheKey, compute) { + const hasBackRef = hasSomeDescendant(cacheKey, n => n.type === 'Backreference'); + if (hasBackRef) { + compute(cacheKey); + return; + } + + const cache = getResultCache(cacheName); + let cached = cache.get(cacheKey.raw); + if (cached === undefined) { + try { + compute(cacheKey); + cached = null; + } catch (error) { + cached = error; + } + cache.set(cacheKey.raw, cached); + } + + if (cached) { + throw cached; + } +} + +/** + * @param {string} path + * @param {RegExp} pattern + * @param {LiteralAST} [ast] + * @returns {void} + */ +function checkExponentialBacktracking(path, pattern, ast) { + if (expoSafeRegexes.has(pattern)) { + // we know that the pattern won't cause exp backtracking because we checked before + return; + } + const patternStr = String(pattern); + if (expoSafeRegexes.has(patternStr)) { + // we know that the pattern won't cause exp backtracking because we checked before + return; + } + + if (!ast) { + ast = parseRegex(pattern); + } + + const parser = JS.Parser.fromAst(ast); + /** + * Parses the given element and creates its NFA. + * + * @param {import("refa").JS.ParsableElement} element + * @returns {NFA} + */ + function toNFA(element) { + let { expression, maxCharacter } = parser.parseElement(element, { + maxBackreferenceWords: 1000, + backreferences: 'disable' + }); + + return NFA.fromRegex(transform(transformer, expression), { maxCharacter }, { assertions: 'disable' }); + } + + /** + * Checks whether the alternatives of the given node are disjoint. If the alternatives are not disjoint + * and the give node is a descendant of an effective Kleene star, then an error will be thrown. + * + * @param {CapturingGroup | Group | LookaroundAssertion} node + * @returns {void} + */ + function checkDisjointAlternatives(node) { + if (!underAStar(node) || node.alternatives.length < 2) { + return; + } + + withResultCache('disjointAlternatives', node, () => { + const alternatives = node.alternatives; + + const total = toNFA(alternatives[0]); + total.withoutEmptyWord(); + for (let i = 1, l = alternatives.length; i < l; i++) { + const a = alternatives[i]; + const current = toNFA(a); + current.withoutEmptyWord(); + + if (!isDisjointWith(total, current)) { + assert.fail(`${path}: The alternative \`${a.raw}\` is not disjoint with at least one previous alternative.` + + ` This will cause exponential backtracking.` + + `\n\nTo fix this issue, you have to rewrite the ${node.type} \`${node.raw}\`.` + + ` The goal is that all of its alternatives are disjoint.` + + ` This means that if a (sub-)string is matched by the ${node.type}, then only one of its alternatives can match the (sub-)string.` + + `\n\nExample: \`(?:[ab]|\\w|::)+\`` + + `\nThe alternatives of the group are not disjoint because the string "a" can be matched by both \`[ab]\` and \`\\w\`.` + + ` In this example, the pattern can easily be fixed because the \`[ab]\` is a subset of the \`\\w\`, so its enough to remove the \`[ab]\` alternative to get \`(?:\\w|::)+\` as the fixed pattern.` + + `\nIn the real world, patterns can be a lot harder to fix.` + + ` If you are trying to make the tests pass for a pull request but can\'t fix the issue yourself, then make the pull request (or commit) anyway.` + + ` A maintainer will help you.` + + `\n\nFull pattern:\n${pattern}`); + } else if (i !== l - 1) { + total.union(current); + } + } + }); + } + + visitRegExpAST(ast.pattern, { + onCapturingGroupLeave: checkDisjointAlternatives, + onGroupLeave: checkDisjointAlternatives, + onAssertionLeave(node) { + if (node.kind === 'lookahead' || node.kind === 'lookbehind') { + checkDisjointAlternatives(node); + } + }, + + onQuantifierLeave(node) { + if (node.max < 10) { + return; // not a star + } + if (node.element.type !== 'CapturingGroup' && node.element.type !== 'Group') { + return; // not a group + } + + withResultCache('2star', node, () => { + // The idea here is the following: + // + // We have found a part `A*` of the regex (`A` is assumed to not accept the empty word). Let `I` be + // the intersection of `A` and `A{2,}`. If `I` is not empty, then there exists a non-empty word `w` + // that is accepted by both `A` and `A{2,}`. That means that there exists some `m>1` for which `w` + // is accepted by `A{m}`. + // This means that there are at least two ways `A*` can accept `w`. It can be accepted as `A` or as + // `A{m}`. Hence there are at least 2^n ways for `A*` to accept the word `w{n}`. This is the main + // requirement for exponential backtracking. + // + // This is actually only a crude approximation for the real analysis that would have to be done. We + // would actually have to check the intersection `A{p}` and `A{p+1,}` for all p>0. However, in most + // cases, the approximation is good enough. + + const nfa = toNFA(node.element); + nfa.withoutEmptyWord(); + const twoStar = nfa.copy(); + twoStar.quantify(2, Infinity); + + if (!isDisjointWith(nfa, twoStar)) { + const word = Words.pickMostReadableWord(firstOf(getIntersectionWordSets(nfa, twoStar))); + const example = Words.fromUnicodeToString(word); + assert.fail(`${path}: The quantifier \`${node.raw}\` ambiguous for all words ${JSON.stringify(example)}.repeat(n) for any n>1.` + + ` This will cause exponential backtracking.` + + `\n\nTo fix this issue, you have to rewrite the element (let's call it E) of the quantifier.` + + ` The goal is modify E such that it is disjoint with repetitions of itself.` + + ` This means that if a (sub-)string is matched by E, then it must not be possible for E{2}, E{3}, E{4}, etc. to match that (sub-)string.` + + `\n\nExample 1: \`(?:\\w+|::)+\`` + + `\nThe problem lies in \`\\w+\` because \`\\w+\` and \`(?:\\w+){2}\` are not disjoint as the string "aa" is fully matched by both.` + + ` In this example, the pattern can easily be fixed by changing \`\\w+\` to \`\\w\`.` + + `\nExample 2: \`(?:\\w|Foo)+\`` + + `\nThe problem lies in \`\\w\` and \`Foo\` because the string "Foo" can be matched as either repeating \`\\w\` 3 times or by using the \`Foo\` alternative once.` + + ` In this example, the pattern can easily be fixed because the \`Foo\` alternative is redundant can can be removed.` + + `\nExample 3: \`(?:\\.\\w+(?:<.*?>)?)+\`` + + `\nThe problem lies in \`<.*?>\`. The string ".a<>.a<>" can be matched as either \`\\. \\w < . . . . >\` or \`\\. \\w < > \\. \\w < >\`.` + + ` When it comes to exponential backtracking, it doesn't matter whether a quantifier is greedy or lazy.` + + ` This means that the lazy \`.*?\` can jump over \`>\`.` + + ` In this example, the pattern can easily be fixed because we just have to prevent \`.*?\` jumping over \`>\`.` + + ` This can done by replacing \`<.*?>\` with \`<[^\\r\\n>]*>\`.` + + `\n\nIn the real world, patterns can be a lot harder to fix.` + + ` If you are trying to make this test pass for a pull request but can\'t fix the issue yourself, then make the pull request (or commit) anyway, a maintainer will help you.` + + `\n\nFull pattern:\n${pattern}`); + } + }); + }, + }); + + expoSafeRegexes.add(pattern); + expoSafeRegexes.add(patternStr); +} + +/** + * A set of all safe (non-polynomially backtracking) RegExp literals (string). + * + * @type {Set} + */ +const polySafeRegexes = new Set(); +/** + * @param {string} path + * @param {RegExp} pattern + * @param {LiteralAST} [ast] + * @returns {void} + */ +function checkPolynomialBacktracking(path, pattern, ast) { + if (polySafeRegexes.has(pattern)) { + // we know that the pattern won't cause poly backtracking because we checked before + return; + } + const patternStr = String(pattern); + if (polySafeRegexes.has(patternStr)) { + // we know that the pattern won't cause poly backtracking because we checked before + return; + } + + if (!ast) { + ast = parseRegex(pattern); + } + + const result = analyse(ast, { maxReports: 1, reportTypes: { 'Move': false } }); + if (result.reports.length > 0) { + const report = result.reports[0]; + + let rangeOffset; + let rangeStr; + let rangeHighlight; + + switch (report.type) { + case 'Trade': { + const start = Math.min(report.startQuant.start, report.endQuant.start); + const end = Math.max(report.startQuant.end, report.endQuant.end); + rangeOffset = start + 1; + rangeStr = patternStr.substring(start + 1, end + 1); + rangeHighlight = highlight([ + { ...report.startQuant, label: 'start' }, + { ...report.endQuant, label: 'end' } + ], -start); + break; + } + case 'Self': { + rangeOffset = report.parentQuant.start + 1; + rangeStr = patternStr.substring(report.parentQuant.start + 1, report.parentQuant.end + 1); + rangeHighlight = highlight([{ ...report.quant, label: 'self' }], -report.parentQuant.start); + break; + } + case 'Move': { + rangeOffset = 1; + rangeStr = patternStr.substring(1, report.quant.end + 1); + rangeHighlight = highlight([report.quant]); + break; + } + default: + throw new Error('Invalid report type. This should never happen.'); + } + + + const attackChar = `/${report.character.literal.source}/${report.character.literal.flags}`; + const fixed = report.fix(); + + assert.fail( + `${path}: ${report.exponential ? 'Exponential' : 'Polynomial'} backtracking. ` + + `By repeating any character that matches ${attackChar}, an attack string can be created.` + + `\n` + + `\n${indent(rangeStr)}` + + `\n${indent(rangeHighlight)}` + + `\n` + + `\nFull pattern:` + + `\n${patternStr}` + + `\n${indent(rangeHighlight, ' '.repeat(rangeOffset))}` + + `\n` + + `\n` + (fixed ? `Fixed:\n/${fixed.source}/${fixed.flags}` : `Fix not available.`) + ); + } + + polySafeRegexes.add(pattern); + polySafeRegexes.add(patternStr); +} + +/** + * @param {Highlight[]} highlights + * @param {number} [offset] + * @returns {string} + * + * @typedef Highlight + * @property {number} start + * @property {number} end + * @property {string} [label] + */ +function highlight(highlights, offset = 0) { + highlights.sort((a, b) => a.start - b.start); + + const lines = []; + while (highlights.length > 0) { + const newHighlights = []; + let l = ''; + for (const highlight of highlights) { + const start = highlight.start + offset; + const end = highlight.end + offset; + if (start < l.length) { + newHighlights.push(highlight); + } else { + l += ' '.repeat(start - l.length); + l += '^'; + l += '~'.repeat(end - start - 1); + if (highlight.label) { + l += '[' + highlight.label + ']'; + } + } + } + lines.push(l); + highlights = newHighlights; + } + + return lines.join('\n'); +} + +/** + * @param {string} str + * @param {string} amount + * @returns {string} + */ +function indent(str, amount = ' ') { + return str.split(/\r?\n/).map(m => m === '' ? '' : amount + m).join('\n'); +} + +/** + * @param {(exec: RegExp["exec"]) => RegExp["exec"]} execSupplier + * @param {() => Promise} fn + */ +async function replaceRegExpProto(execSupplier, fn) { + const oldExec = RegExp.prototype.exec; + const oldTest = RegExp.prototype.test; + const newExec = execSupplier(oldExec); + + RegExp.prototype.exec = newExec; + RegExp.prototype.test = function (input) { + return newExec.call(this, input) !== null; + }; + + let error; + try { + await fn(); + } catch (e) { + error = e; + } + + RegExp.prototype.exec = oldExec; + RegExp.prototype.test = oldTest; + + if (error) { + throw error; + } +} diff --git a/package/src/prism/tests/run.js b/package/src/prism/tests/run.js new file mode 100644 index 00000000..bdeb707d --- /dev/null +++ b/package/src/prism/tests/run.js @@ -0,0 +1,24 @@ +import path from "path" +import { language, update } from "./helper/args.js" +import * as TestCase from "./helper/test-case.js" +import * as TestDiscovery from "./helper/test-discovery.js" + +const testSuite = language + ? TestDiscovery.loadSomeTests(language) + : // load complete test suite + TestDiscovery.loadAllTests() + +// define tests for all tests in all languages in the test suite +for (const [languageIdentifier, files] of testSuite) { + describe("Testing language '" + languageIdentifier + "'", function () { + this.timeout(10000) + + for (const filePath of files) { + const fileName = path.basename(filePath, path.extname(filePath)) + + it("– should pass test case '" + fileName + "'", async () => { + await TestCase.runTestCase(languageIdentifier, filePath, update ? "update" : "insert") + }) + } + }) +} diff --git a/package/src/prism/types.ts b/package/src/prism/types.ts new file mode 100644 index 00000000..6f9f128e --- /dev/null +++ b/package/src/prism/types.ts @@ -0,0 +1,111 @@ +import { tokenize, rest, Token } from "./core" + +/** + * A token stream is an array of strings and {@link Token} objects. + * + * Token streams have to fulfill a few properties that are assumed by most functions (mostly internal ones) that process + * them. + * + * 1. No adjacent strings. + * 2. No empty strings. + * + * The only exception here is the token stream that only contains the empty string and nothing else. + */ +export type TokenStream = (string | Token)[] + +export type StandardTokenName = + | 'atrule' + | 'attr-name' + | 'attr-value' + | 'bold' + | 'boolean' + | 'builtin' + | 'cdata' + | 'char' + | 'class-name' + | 'comment' + | 'constant' + | 'deleted' + | 'doctype' + | 'entity' + | 'function' + | 'important' + | 'inserted' + | 'italic' + | 'keyword' + | 'namespace' + | 'number' + | 'operator' + | 'prolog' + | 'property' + | 'punctuation' + | 'regex' + | 'selector' + | 'string' + | 'symbol' + | 'tag' + | 'url' + +export type TokenName = string & {} | StandardTokenName + +/** + * The expansion of a simple `RegExp` literal to support additional properties. + */ +export interface GrammarToken { + /** + * The regular expression of the token. + */ + pattern: RegExp + /** + * If `true`, then the first capturing group of `pattern` will (effectively) behave as a lookbehind group meaning that the captured text will not be part of the matched text of the new token. + * + * @default false + */ + lookbehind?: boolean + /** + * Whether the token is greedy. + * + * @default false + */ + greedy?: boolean + /** + * An optional alias. Multiple aliases are separated by spaces. + */ + alias?: TokenName + /** + * The nested grammar of this token. + * + * The `inside` grammar will be used to tokenize the text value of each token of this kind. + * + * This can be used to make nested and even recursive language definitions. + * + * Note: This can cause infinite recursion. Be careful when you embed different languages or even the same language into + * each another. + */ + inside?: Grammar | string | null + /** + * A property to make the types {@link GrammarToken} and {@link RegExp} non-overlapping. + * + * Since {@link GrammarToken} requires `exec` to be `undefined` and {@link RegExp} requires it to be a function, + * there can be no object that is both a {@link GrammarToken} and a {@link RegExp}. + */ + readonly exec?: never +} + +/** + * A custom tokenizer for a grammar. + * + * @see {@link tokenize} symbol for more info. + * + * @param code A string with the code this grammar needs to tokenize. + * @param grammar The grammar with the custom tokenizer + * @returns A token stream representing the matched code. + */ +export type CustomTokenizer = (code: string, grammar: Grammar) => TokenStream + +export type GrammarTokens = Partial> +export type GrammarSymbols = { + [rest]?: Grammar | string | null + [tokenize]?: CustomTokenizer | null +} +export type Grammar = GrammarTokens & GrammarSymbols diff --git a/package/src/prism/utils/index.ts b/package/src/prism/utils/index.ts new file mode 100644 index 00000000..9c162dae --- /dev/null +++ b/package/src/prism/utils/index.ts @@ -0,0 +1,2 @@ +export { clone, insertBefore, extend } from "./language" +export { embeddedIn } from "./templating" diff --git a/package/src/prism/utils/language.d.ts b/package/src/prism/utils/language.d.ts new file mode 100644 index 00000000..ecf00a5a --- /dev/null +++ b/package/src/prism/utils/language.d.ts @@ -0,0 +1,87 @@ +import type { Grammar, GrammarTokens, TokenName, TokenStream } from "../types" + +/** + * Creates a deep clone of the given grammar definition. + * @param grammar Grammar object you want to clone. + */ +export declare const clone: (grammar: Grammar) => Grammar + +/** + * Inserts tokens _before_ another token in the given grammar. + * + * ## Usage + * + * This helper method makes it easy to modify existing grammars. For example, the markup language definition + * defines highlighting for CSS embedded in HTML through `