From 97172a460746279c1bf53eb1644cef6465f2fa07 Mon Sep 17 00:00:00 2001 From: Zinfidel Date: Sat, 11 Sep 2021 18:41:49 -0700 Subject: [PATCH 01/12] Avisynth lang definition. --- components.js | 2 +- components.json | 5 + components/prism-avisynth.js | 172 +++++++ components/prism-avisynth.min.js | 1 + examples/prism-avisynth.html | 24 + plugins/autoloader/prism-autoloader.js | 1 + plugins/autoloader/prism-autoloader.min.js | 2 +- plugins/show-language/prism-show-language.js | 2 + .../show-language/prism-show-language.min.js | 2 +- .../avisynth/clipproperties_feature.test | 359 +++++++++++++++ .../comments_strings_predefines_feature.test | 129 ++++++ .../avisynth/intenalfuncs_feature.test | 393 ++++++++++++++++ .../avisynth/internalfilters_feature.test | 431 ++++++++++++++++++ ...keywords_constants_bools_last_feature.test | 90 ++++ .../operators_numbers_punctuation.test | 84 ++++ .../avisynth/types_arguments_feature.test | 116 +++++ .../avisynth/userfunctions_feature.test | 25 + 17 files changed, 1835 insertions(+), 3 deletions(-) create mode 100644 components/prism-avisynth.js create mode 100644 components/prism-avisynth.min.js create mode 100644 examples/prism-avisynth.html create mode 100644 tests/languages/avisynth/clipproperties_feature.test create mode 100644 tests/languages/avisynth/comments_strings_predefines_feature.test create mode 100644 tests/languages/avisynth/intenalfuncs_feature.test create mode 100644 tests/languages/avisynth/internalfilters_feature.test create mode 100644 tests/languages/avisynth/keywords_constants_bools_last_feature.test create mode 100644 tests/languages/avisynth/operators_numbers_punctuation.test create mode 100644 tests/languages/avisynth/types_arguments_feature.test create mode 100644 tests/languages/avisynth/userfunctions_feature.test diff --git a/components.js b/components.js index b56c91ce0a..41ef45bb0c 100644 --- a/components.js +++ b/components.js @@ -1,2 +1,2 @@ -var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","optional":"regex","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"ABNF","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"agda":{"title":"Agda","owner":"xy-ren"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apex":{"title":"Apex","require":["clike","sql"],"owner":"RunDevelopment"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"dkern"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"avro-idl":{"title":"Avro IDL","alias":"avdl","owner":"RunDevelopment"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bicep":{"title":"Bicep","owner":"johnnyreilly"},"birb":{"title":"Birb","require":"clike","owner":"Calamity210"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"BNF","alias":"rbnf","aliasTitles":{"rbnf":"RBNF"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"bsl":{"title":"BSL (1C:Enterprise)","alias":"oscript","aliasTitles":{"oscript":"OneScript"},"owner":"Diversus23"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cfscript":{"title":"CFScript","require":"clike","alias":"cfc","owner":"mjclemente"},"chaiscript":{"title":"ChaiScript","require":["clike","cpp"],"owner":"RunDevelopment"},"cil":{"title":"CIL","owner":"sbrl"},"clojure":{"title":"Clojure","owner":"troglotit"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"cobol":{"title":"COBOL","owner":"RunDevelopment"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"coq":{"title":"Coq","owner":"RunDevelopment"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"csv":{"title":"CSV","owner":"RunDevelopment"},"cypher":{"title":"Cypher","owner":"RunDevelopment"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dataweave":{"title":"DataWeave","owner":"machaval"},"dax":{"title":"DAX","owner":"peterbud"},"dhall":{"title":"Dhall","owner":"RunDevelopment"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"dot":{"title":"DOT (Graphviz)","alias":"gv","optional":"markup","owner":"RunDevelopment"},"ebnf":{"title":"EBNF","owner":"RunDevelopment"},"editorconfig":{"title":"EditorConfig","owner":"osipxd"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"false":{"title":"False","owner":"edukisto"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gn":{"title":"GN","alias":"gni","owner":"RunDevelopment"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","optional":"markdown","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","alias":"hbs","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"hoon":{"title":"Hoon","owner":"matildepark"},"http":{"title":"HTTP","optional":["css","javascript","json","markup","uri"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"icu-message-format":{"title":"ICU Message Format","owner":"RunDevelopment"},"idris":{"title":"Idris","alias":"idr","owner":"KeenS","require":"haskell"},"ignore":{"title":".ignore","owner":"osipxd","alias":["gitignore","hgignore","npmignore"],"aliasTitles":{"gitignore":".gitignore","hgignore":".hgignore","npmignore":".npmignore"}},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jexl":{"title":"Jexl","owner":"czosel"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike","typescript"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"jsstacktrace":{"title":"JS stack trace","owner":"sbrl"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup","sql"],"owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","alias":["kt","kts"],"aliasTitles":{"kts":"Kotlin Script"},"require":"clike","owner":"Golmote"},"kumir":{"title":"KuMir (КуМир)","alias":"kum","owner":"edukisto"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","require":"markup-templating","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"log":{"title":"Log file","optional":"javastacktrace","owner":"RunDevelopment"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","optional":"yaml","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"mel":{"title":"MEL","owner":"Golmote"},"mermaid":{"title":"Mermaid","owner":"RunDevelopment"},"mizar":{"title":"Mizar","owner":"Golmote"},"mongodb":{"title":"MongoDB","owner":"airs0urce","require":"javascript"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"naniscript":{"title":"Naninovel Script","owner":"Elringus","alias":"nani"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nevod":{"title":"Nevod","owner":"nezaboodka"},"nginx":{"title":"nginx","owner":"volado"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"openqasm":{"title":"OpenQasm","alias":"qasm","owner":"RunDevelopment"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"psl":{"title":"PATROL Scripting Language","owner":"bertysentry"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":"markup-templating","owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"promql":{"title":"PromQL","owner":"arendjr"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"purescript":{"title":"PureScript","require":"haskell","alias":"purs","owner":"sriharshachilakapati"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"qsharp":{"title":"Q#","require":"clike","alias":"qs","owner":"fedonman"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","owner":"RunDevelopment"},"rego":{"title":"Rego","owner":"JordanSh"},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","optional":"css-extras","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","alias":["sh-session","shellsession"],"owner":"RunDevelopment"},"smali":{"title":"Smali","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"sml":{"title":"SML","alias":"smlnj","aliasTitles":{"smlnj":"SML/NJ"},"owner":"RunDevelopment"},"solidity":{"title":"Solidity (Ethereum)","alias":"sol","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"squirrel":{"title":"Squirrel","require":"clike","owner":"RunDevelopment"},"stan":{"title":"Stan","owner":"RunDevelopment"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","owner":"chrischares"},"systemd":{"title":"Systemd configuration file","owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"typoscript":{"title":"TypoScript","alias":"tsconfig","aliasTitles":{"tsconfig":"TSConfig"},"owner":"dkern"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"uri":{"title":"URI","alias":"url","aliasTitles":{"url":"URL"},"owner":"RunDevelopment"},"v":{"title":"V","require":"clike","owner":"taggon"},"vala":{"title":"Vala","require":"clike","optional":"regex","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":["vb","vba"],"aliasTitles":{"vba":"VBA"},"owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"wolfram":{"title":"Wolfram language","alias":["mathematica","nb","wl"],"aliasTitles":{"mathematica":"Mathematica","nb":"Mathematica Notebook"},"owner":"msollami"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"yang":{"title":"YANG","owner":"RunDevelopment"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword for fine-grained highlighting.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}}; +var components = {"core":{"meta":{"path":"components/prism-core.js","option":"mandatory"},"core":"Core"},"themes":{"meta":{"path":"themes/{id}.css","link":"index.html?theme={id}","exclusive":true},"prism":{"title":"Default","option":"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{"title":"Okaidia","owner":"ocodia"},"prism-twilight":{"title":"Twilight","owner":"remybach"},"prism-coy":{"title":"Coy","owner":"tshedor"},"prism-solarizedlight":{"title":"Solarized Light","owner":"hectormatos2011 "},"prism-tomorrow":{"title":"Tomorrow Night","owner":"Rosey"}},"languages":{"meta":{"path":"components/prism-{id}","noCSS":true,"examplesPath":"examples/prism-{id}","addCheckAll":true},"markup":{"title":"Markup","alias":["html","xml","svg","mathml","ssml","atom","rss"],"aliasTitles":{"html":"HTML","xml":"XML","svg":"SVG","mathml":"MathML","ssml":"SSML","atom":"Atom","rss":"RSS"},"option":"default"},"css":{"title":"CSS","option":"default","modify":"markup"},"clike":{"title":"C-like","option":"default"},"javascript":{"title":"JavaScript","require":"clike","modify":"markup","optional":"regex","alias":"js","option":"default"},"abap":{"title":"ABAP","owner":"dellagustin"},"abnf":{"title":"ABNF","owner":"RunDevelopment"},"actionscript":{"title":"ActionScript","require":"javascript","modify":"markup","owner":"Golmote"},"ada":{"title":"Ada","owner":"Lucretia"},"agda":{"title":"Agda","owner":"xy-ren"},"al":{"title":"AL","owner":"RunDevelopment"},"antlr4":{"title":"ANTLR4","alias":"g4","owner":"RunDevelopment"},"apacheconf":{"title":"Apache Configuration","owner":"GuiTeK"},"apex":{"title":"Apex","require":["clike","sql"],"owner":"RunDevelopment"},"apl":{"title":"APL","owner":"ngn"},"applescript":{"title":"AppleScript","owner":"Golmote"},"aql":{"title":"AQL","owner":"RunDevelopment"},"arduino":{"title":"Arduino","require":"cpp","owner":"dkern"},"arff":{"title":"ARFF","owner":"Golmote"},"asciidoc":{"alias":"adoc","title":"AsciiDoc","owner":"Golmote"},"aspnet":{"title":"ASP.NET (C#)","require":["markup","csharp"],"owner":"nauzilus"},"asm6502":{"title":"6502 Assembly","owner":"kzurawel"},"autohotkey":{"title":"AutoHotkey","owner":"aviaryan"},"autoit":{"title":"AutoIt","owner":"Golmote"},"avisynth":{"title":"AviSynth","alias":"avs","owner":"Zinfidel"},"avro-idl":{"title":"Avro IDL","alias":"avdl","owner":"RunDevelopment"},"bash":{"title":"Bash","alias":"shell","aliasTitles":{"shell":"Shell"},"owner":"zeitgeist87"},"basic":{"title":"BASIC","owner":"Golmote"},"batch":{"title":"Batch","owner":"Golmote"},"bbcode":{"title":"BBcode","alias":"shortcode","aliasTitles":{"shortcode":"Shortcode"},"owner":"RunDevelopment"},"bicep":{"title":"Bicep","owner":"johnnyreilly"},"birb":{"title":"Birb","require":"clike","owner":"Calamity210"},"bison":{"title":"Bison","require":"c","owner":"Golmote"},"bnf":{"title":"BNF","alias":"rbnf","aliasTitles":{"rbnf":"RBNF"},"owner":"RunDevelopment"},"brainfuck":{"title":"Brainfuck","owner":"Golmote"},"brightscript":{"title":"BrightScript","owner":"RunDevelopment"},"bro":{"title":"Bro","owner":"wayward710"},"bsl":{"title":"BSL (1C:Enterprise)","alias":"oscript","aliasTitles":{"oscript":"OneScript"},"owner":"Diversus23"},"c":{"title":"C","require":"clike","owner":"zeitgeist87"},"csharp":{"title":"C#","require":"clike","alias":["cs","dotnet"],"owner":"mvalipour"},"cpp":{"title":"C++","require":"c","owner":"zeitgeist87"},"cfscript":{"title":"CFScript","require":"clike","alias":"cfc","owner":"mjclemente"},"chaiscript":{"title":"ChaiScript","require":["clike","cpp"],"owner":"RunDevelopment"},"cil":{"title":"CIL","owner":"sbrl"},"clojure":{"title":"Clojure","owner":"troglotit"},"cmake":{"title":"CMake","owner":"mjrogozinski"},"cobol":{"title":"COBOL","owner":"RunDevelopment"},"coffeescript":{"title":"CoffeeScript","require":"javascript","alias":"coffee","owner":"R-osey"},"concurnas":{"title":"Concurnas","alias":"conc","owner":"jasontatton"},"csp":{"title":"Content-Security-Policy","owner":"ScottHelme"},"coq":{"title":"Coq","owner":"RunDevelopment"},"crystal":{"title":"Crystal","require":"ruby","owner":"MakeNowJust"},"css-extras":{"title":"CSS Extras","require":"css","modify":"css","owner":"milesj"},"csv":{"title":"CSV","owner":"RunDevelopment"},"cypher":{"title":"Cypher","owner":"RunDevelopment"},"d":{"title":"D","require":"clike","owner":"Golmote"},"dart":{"title":"Dart","require":"clike","owner":"Golmote"},"dataweave":{"title":"DataWeave","owner":"machaval"},"dax":{"title":"DAX","owner":"peterbud"},"dhall":{"title":"Dhall","owner":"RunDevelopment"},"diff":{"title":"Diff","owner":"uranusjr"},"django":{"title":"Django/Jinja2","require":"markup-templating","alias":"jinja2","owner":"romanvm"},"dns-zone-file":{"title":"DNS zone file","owner":"RunDevelopment","alias":"dns-zone"},"docker":{"title":"Docker","alias":"dockerfile","owner":"JustinBeckwith"},"dot":{"title":"DOT (Graphviz)","alias":"gv","optional":"markup","owner":"RunDevelopment"},"ebnf":{"title":"EBNF","owner":"RunDevelopment"},"editorconfig":{"title":"EditorConfig","owner":"osipxd"},"eiffel":{"title":"Eiffel","owner":"Conaclos"},"ejs":{"title":"EJS","require":["javascript","markup-templating"],"owner":"RunDevelopment","alias":"eta","aliasTitles":{"eta":"Eta"}},"elixir":{"title":"Elixir","owner":"Golmote"},"elm":{"title":"Elm","owner":"zwilias"},"etlua":{"title":"Embedded Lua templating","require":["lua","markup-templating"],"owner":"RunDevelopment"},"erb":{"title":"ERB","require":["ruby","markup-templating"],"owner":"Golmote"},"erlang":{"title":"Erlang","owner":"Golmote"},"excel-formula":{"title":"Excel Formula","alias":["xlsx","xls"],"owner":"RunDevelopment"},"fsharp":{"title":"F#","require":"clike","owner":"simonreynolds7"},"factor":{"title":"Factor","owner":"catb0t"},"false":{"title":"False","owner":"edukisto"},"firestore-security-rules":{"title":"Firestore security rules","require":"clike","owner":"RunDevelopment"},"flow":{"title":"Flow","require":"javascript","owner":"Golmote"},"fortran":{"title":"Fortran","owner":"Golmote"},"ftl":{"title":"FreeMarker Template Language","require":"markup-templating","owner":"RunDevelopment"},"gml":{"title":"GameMaker Language","alias":"gamemakerlanguage","require":"clike","owner":"LiarOnce"},"gcode":{"title":"G-code","owner":"RunDevelopment"},"gdscript":{"title":"GDScript","owner":"RunDevelopment"},"gedcom":{"title":"GEDCOM","owner":"Golmote"},"gherkin":{"title":"Gherkin","owner":"hason"},"git":{"title":"Git","owner":"lgiraudel"},"glsl":{"title":"GLSL","require":"c","owner":"Golmote"},"gn":{"title":"GN","alias":"gni","owner":"RunDevelopment"},"go":{"title":"Go","require":"clike","owner":"arnehormann"},"graphql":{"title":"GraphQL","optional":"markdown","owner":"Golmote"},"groovy":{"title":"Groovy","require":"clike","owner":"robfletcher"},"haml":{"title":"Haml","require":"ruby","optional":["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],"owner":"Golmote"},"handlebars":{"title":"Handlebars","require":"markup-templating","alias":"hbs","owner":"Golmote"},"haskell":{"title":"Haskell","alias":"hs","owner":"bholst"},"haxe":{"title":"Haxe","require":"clike","owner":"Golmote"},"hcl":{"title":"HCL","owner":"outsideris"},"hlsl":{"title":"HLSL","require":"c","owner":"RunDevelopment"},"hoon":{"title":"Hoon","owner":"matildepark"},"http":{"title":"HTTP","optional":["css","javascript","json","markup","uri"],"owner":"danielgtaylor"},"hpkp":{"title":"HTTP Public-Key-Pins","owner":"ScottHelme"},"hsts":{"title":"HTTP Strict-Transport-Security","owner":"ScottHelme"},"ichigojam":{"title":"IchigoJam","owner":"BlueCocoa"},"icon":{"title":"Icon","owner":"Golmote"},"icu-message-format":{"title":"ICU Message Format","owner":"RunDevelopment"},"idris":{"title":"Idris","alias":"idr","owner":"KeenS","require":"haskell"},"ignore":{"title":".ignore","owner":"osipxd","alias":["gitignore","hgignore","npmignore"],"aliasTitles":{"gitignore":".gitignore","hgignore":".hgignore","npmignore":".npmignore"}},"inform7":{"title":"Inform 7","owner":"Golmote"},"ini":{"title":"Ini","owner":"aviaryan"},"io":{"title":"Io","owner":"AlesTsurko"},"j":{"title":"J","owner":"Golmote"},"java":{"title":"Java","require":"clike","owner":"sherblot"},"javadoc":{"title":"JavaDoc","require":["markup","java","javadoclike"],"modify":"java","optional":"scala","owner":"RunDevelopment"},"javadoclike":{"title":"JavaDoc-like","modify":["java","javascript","php"],"owner":"RunDevelopment"},"javastacktrace":{"title":"Java stack trace","owner":"RunDevelopment"},"jexl":{"title":"Jexl","owner":"czosel"},"jolie":{"title":"Jolie","require":"clike","owner":"thesave"},"jq":{"title":"JQ","owner":"RunDevelopment"},"jsdoc":{"title":"JSDoc","require":["javascript","javadoclike","typescript"],"modify":"javascript","optional":["actionscript","coffeescript"],"owner":"RunDevelopment"},"js-extras":{"title":"JS Extras","require":"javascript","modify":"javascript","optional":["actionscript","coffeescript","flow","n4js","typescript"],"owner":"RunDevelopment"},"json":{"title":"JSON","alias":"webmanifest","aliasTitles":{"webmanifest":"Web App Manifest"},"owner":"CupOfTea696"},"json5":{"title":"JSON5","require":"json","owner":"RunDevelopment"},"jsonp":{"title":"JSONP","require":"json","owner":"RunDevelopment"},"jsstacktrace":{"title":"JS stack trace","owner":"sbrl"},"js-templates":{"title":"JS Templates","require":"javascript","modify":"javascript","optional":["css","css-extras","graphql","markdown","markup","sql"],"owner":"RunDevelopment"},"julia":{"title":"Julia","owner":"cdagnino"},"keyman":{"title":"Keyman","owner":"mcdurdin"},"kotlin":{"title":"Kotlin","alias":["kt","kts"],"aliasTitles":{"kts":"Kotlin Script"},"require":"clike","owner":"Golmote"},"kumir":{"title":"KuMir (КуМир)","alias":"kum","owner":"edukisto"},"latex":{"title":"LaTeX","alias":["tex","context"],"aliasTitles":{"tex":"TeX","context":"ConTeXt"},"owner":"japborst"},"latte":{"title":"Latte","require":["clike","markup-templating","php"],"owner":"nette"},"less":{"title":"Less","require":"css","optional":"css-extras","owner":"Golmote"},"lilypond":{"title":"LilyPond","require":"scheme","alias":"ly","owner":"RunDevelopment"},"liquid":{"title":"Liquid","require":"markup-templating","owner":"cinhtau"},"lisp":{"title":"Lisp","alias":["emacs","elisp","emacs-lisp"],"owner":"JuanCaicedo"},"livescript":{"title":"LiveScript","owner":"Golmote"},"llvm":{"title":"LLVM IR","owner":"porglezomp"},"log":{"title":"Log file","optional":"javastacktrace","owner":"RunDevelopment"},"lolcode":{"title":"LOLCODE","owner":"Golmote"},"lua":{"title":"Lua","owner":"Golmote"},"makefile":{"title":"Makefile","owner":"Golmote"},"markdown":{"title":"Markdown","require":"markup","optional":"yaml","alias":"md","owner":"Golmote"},"markup-templating":{"title":"Markup templating","require":"markup","owner":"Golmote"},"matlab":{"title":"MATLAB","owner":"Golmote"},"mel":{"title":"MEL","owner":"Golmote"},"mermaid":{"title":"Mermaid","owner":"RunDevelopment"},"mizar":{"title":"Mizar","owner":"Golmote"},"mongodb":{"title":"MongoDB","owner":"airs0urce","require":"javascript"},"monkey":{"title":"Monkey","owner":"Golmote"},"moonscript":{"title":"MoonScript","alias":"moon","owner":"RunDevelopment"},"n1ql":{"title":"N1QL","owner":"TMWilds"},"n4js":{"title":"N4JS","require":"javascript","optional":"jsdoc","alias":"n4jsd","owner":"bsmith-n4"},"nand2tetris-hdl":{"title":"Nand To Tetris HDL","owner":"stephanmax"},"naniscript":{"title":"Naninovel Script","owner":"Elringus","alias":"nani"},"nasm":{"title":"NASM","owner":"rbmj"},"neon":{"title":"NEON","owner":"nette"},"nevod":{"title":"Nevod","owner":"nezaboodka"},"nginx":{"title":"nginx","owner":"volado"},"nim":{"title":"Nim","owner":"Golmote"},"nix":{"title":"Nix","owner":"Golmote"},"nsis":{"title":"NSIS","owner":"idleberg"},"objectivec":{"title":"Objective-C","require":"c","alias":"objc","owner":"uranusjr"},"ocaml":{"title":"OCaml","owner":"Golmote"},"opencl":{"title":"OpenCL","require":"c","modify":["c","cpp"],"owner":"Milania1"},"openqasm":{"title":"OpenQasm","alias":"qasm","owner":"RunDevelopment"},"oz":{"title":"Oz","owner":"Golmote"},"parigp":{"title":"PARI/GP","owner":"Golmote"},"parser":{"title":"Parser","require":"markup","owner":"Golmote"},"pascal":{"title":"Pascal","alias":"objectpascal","aliasTitles":{"objectpascal":"Object Pascal"},"owner":"Golmote"},"pascaligo":{"title":"Pascaligo","owner":"DefinitelyNotAGoat"},"psl":{"title":"PATROL Scripting Language","owner":"bertysentry"},"pcaxis":{"title":"PC-Axis","alias":"px","owner":"RunDevelopment"},"peoplecode":{"title":"PeopleCode","alias":"pcode","owner":"RunDevelopment"},"perl":{"title":"Perl","owner":"Golmote"},"php":{"title":"PHP","require":"markup-templating","owner":"milesj"},"phpdoc":{"title":"PHPDoc","require":["php","javadoclike"],"modify":"php","owner":"RunDevelopment"},"php-extras":{"title":"PHP Extras","require":"php","modify":"php","owner":"milesj"},"plsql":{"title":"PL/SQL","require":"sql","owner":"Golmote"},"powerquery":{"title":"PowerQuery","alias":["pq","mscript"],"owner":"peterbud"},"powershell":{"title":"PowerShell","owner":"nauzilus"},"processing":{"title":"Processing","require":"clike","owner":"Golmote"},"prolog":{"title":"Prolog","owner":"Golmote"},"promql":{"title":"PromQL","owner":"arendjr"},"properties":{"title":".properties","owner":"Golmote"},"protobuf":{"title":"Protocol Buffers","require":"clike","owner":"just-boris"},"pug":{"title":"Pug","require":["markup","javascript"],"optional":["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],"owner":"Golmote"},"puppet":{"title":"Puppet","owner":"Golmote"},"pure":{"title":"Pure","optional":["c","cpp","fortran"],"owner":"Golmote"},"purebasic":{"title":"PureBasic","require":"clike","alias":"pbfasm","owner":"HeX0R101"},"purescript":{"title":"PureScript","require":"haskell","alias":"purs","owner":"sriharshachilakapati"},"python":{"title":"Python","alias":"py","owner":"multipetros"},"qsharp":{"title":"Q#","require":"clike","alias":"qs","owner":"fedonman"},"q":{"title":"Q (kdb+ database)","owner":"Golmote"},"qml":{"title":"QML","require":"javascript","owner":"RunDevelopment"},"qore":{"title":"Qore","require":"clike","owner":"temnroegg"},"r":{"title":"R","owner":"Golmote"},"racket":{"title":"Racket","require":"scheme","alias":"rkt","owner":"RunDevelopment"},"jsx":{"title":"React JSX","require":["markup","javascript"],"optional":["jsdoc","js-extras","js-templates"],"owner":"vkbansal"},"tsx":{"title":"React TSX","require":["jsx","typescript"]},"reason":{"title":"Reason","require":"clike","owner":"Golmote"},"regex":{"title":"Regex","owner":"RunDevelopment"},"rego":{"title":"Rego","owner":"JordanSh"},"renpy":{"title":"Ren'py","alias":"rpy","owner":"HyuchiaDiego"},"rest":{"title":"reST (reStructuredText)","owner":"Golmote"},"rip":{"title":"Rip","owner":"ravinggenius"},"roboconf":{"title":"Roboconf","owner":"Golmote"},"robotframework":{"title":"Robot Framework","alias":"robot","owner":"RunDevelopment"},"ruby":{"title":"Ruby","require":"clike","alias":"rb","owner":"samflores"},"rust":{"title":"Rust","owner":"Golmote"},"sas":{"title":"SAS","optional":["groovy","lua","sql"],"owner":"Golmote"},"sass":{"title":"Sass (Sass)","require":"css","optional":"css-extras","owner":"Golmote"},"scss":{"title":"Sass (Scss)","require":"css","optional":"css-extras","owner":"MoOx"},"scala":{"title":"Scala","require":"java","owner":"jozic"},"scheme":{"title":"Scheme","owner":"bacchus123"},"shell-session":{"title":"Shell session","require":"bash","alias":["sh-session","shellsession"],"owner":"RunDevelopment"},"smali":{"title":"Smali","owner":"RunDevelopment"},"smalltalk":{"title":"Smalltalk","owner":"Golmote"},"smarty":{"title":"Smarty","require":"markup-templating","owner":"Golmote"},"sml":{"title":"SML","alias":"smlnj","aliasTitles":{"smlnj":"SML/NJ"},"owner":"RunDevelopment"},"solidity":{"title":"Solidity (Ethereum)","alias":"sol","require":"clike","owner":"glachaud"},"solution-file":{"title":"Solution file","alias":"sln","owner":"RunDevelopment"},"soy":{"title":"Soy (Closure Template)","require":"markup-templating","owner":"Golmote"},"sparql":{"title":"SPARQL","require":"turtle","owner":"Triply-Dev","alias":"rq"},"splunk-spl":{"title":"Splunk SPL","owner":"RunDevelopment"},"sqf":{"title":"SQF: Status Quo Function (Arma 3)","require":"clike","owner":"RunDevelopment"},"sql":{"title":"SQL","owner":"multipetros"},"squirrel":{"title":"Squirrel","require":"clike","owner":"RunDevelopment"},"stan":{"title":"Stan","owner":"RunDevelopment"},"iecst":{"title":"Structured Text (IEC 61131-3)","owner":"serhioromano"},"stylus":{"title":"Stylus","owner":"vkbansal"},"swift":{"title":"Swift","owner":"chrischares"},"systemd":{"title":"Systemd configuration file","owner":"RunDevelopment"},"t4-templating":{"title":"T4 templating","owner":"RunDevelopment"},"t4-cs":{"title":"T4 Text Templates (C#)","require":["t4-templating","csharp"],"alias":"t4","owner":"RunDevelopment"},"t4-vb":{"title":"T4 Text Templates (VB)","require":["t4-templating","vbnet"],"owner":"RunDevelopment"},"tap":{"title":"TAP","owner":"isaacs","require":"yaml"},"tcl":{"title":"Tcl","owner":"PeterChaplin"},"tt2":{"title":"Template Toolkit 2","require":["clike","markup-templating"],"owner":"gflohr"},"textile":{"title":"Textile","require":"markup","optional":"css","owner":"Golmote"},"toml":{"title":"TOML","owner":"RunDevelopment"},"turtle":{"title":"Turtle","alias":"trig","aliasTitles":{"trig":"TriG"},"owner":"jakubklimek"},"twig":{"title":"Twig","require":"markup","owner":"brandonkelly"},"typescript":{"title":"TypeScript","require":"javascript","optional":"js-templates","alias":"ts","owner":"vkbansal"},"typoscript":{"title":"TypoScript","alias":"tsconfig","aliasTitles":{"tsconfig":"TSConfig"},"owner":"dkern"},"unrealscript":{"title":"UnrealScript","alias":["uscript","uc"],"owner":"RunDevelopment"},"uri":{"title":"URI","alias":"url","aliasTitles":{"url":"URL"},"owner":"RunDevelopment"},"v":{"title":"V","require":"clike","owner":"taggon"},"vala":{"title":"Vala","require":"clike","optional":"regex","owner":"TemplarVolk"},"vbnet":{"title":"VB.Net","require":"basic","owner":"Bigsby"},"velocity":{"title":"Velocity","require":"markup","owner":"Golmote"},"verilog":{"title":"Verilog","owner":"a-rey"},"vhdl":{"title":"VHDL","owner":"a-rey"},"vim":{"title":"vim","owner":"westonganger"},"visual-basic":{"title":"Visual Basic","alias":["vb","vba"],"aliasTitles":{"vba":"VBA"},"owner":"Golmote"},"warpscript":{"title":"WarpScript","owner":"RunDevelopment"},"wasm":{"title":"WebAssembly","owner":"Golmote"},"wiki":{"title":"Wiki markup","require":"markup","owner":"Golmote"},"wolfram":{"title":"Wolfram language","alias":["mathematica","nb","wl"],"aliasTitles":{"mathematica":"Mathematica","nb":"Mathematica Notebook"},"owner":"msollami"},"xeora":{"title":"Xeora","require":"markup","alias":"xeoracube","aliasTitles":{"xeoracube":"XeoraCube"},"owner":"freakmaxi"},"xml-doc":{"title":"XML doc (.net)","require":"markup","modify":["csharp","fsharp","vbnet"],"owner":"RunDevelopment"},"xojo":{"title":"Xojo (REALbasic)","owner":"Golmote"},"xquery":{"title":"XQuery","require":"markup","owner":"Golmote"},"yaml":{"title":"YAML","alias":"yml","owner":"hason"},"yang":{"title":"YANG","owner":"RunDevelopment"},"zig":{"title":"Zig","owner":"RunDevelopment"}},"plugins":{"meta":{"path":"plugins/{id}/prism-{id}","link":"plugins/{id}/"},"line-highlight":{"title":"Line Highlight","description":"Highlights specific lines and/or line ranges."},"line-numbers":{"title":"Line Numbers","description":"Line number at the beginning of code lines.","owner":"kuba-kubula"},"show-invisibles":{"title":"Show Invisibles","description":"Show hidden characters such as tabs and line breaks.","optional":["autolinker","data-uri-highlight"]},"autolinker":{"title":"Autolinker","description":"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},"wpd":{"title":"WebPlatform Docs","description":"Makes tokens link to WebPlatform.org documentation. The links open in a new tab."},"custom-class":{"title":"Custom Class","description":"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.","owner":"dvkndn","noCSS":true},"file-highlight":{"title":"File Highlight","description":"Fetch external files and highlight them with Prism. Used on the Prism website itself.","noCSS":true},"show-language":{"title":"Show Language","description":"Display the highlighted language in code blocks (inline code does not show the label).","owner":"nauzilus","noCSS":true,"require":"toolbar"},"jsonp-highlight":{"title":"JSONP Highlight","description":"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).","noCSS":true,"owner":"nauzilus"},"highlight-keywords":{"title":"Highlight Keywords","description":"Adds special CSS classes for each keyword for fine-grained highlighting.","owner":"vkbansal","noCSS":true},"remove-initial-line-feed":{"title":"Remove initial line feed","description":"Removes the initial line feed in code blocks.","owner":"Golmote","noCSS":true},"inline-color":{"title":"Inline color","description":"Adds a small inline preview for colors in style sheets.","require":"css-extras","owner":"RunDevelopment"},"previewers":{"title":"Previewers","description":"Previewers for angles, colors, gradients, easing and time.","require":"css-extras","owner":"Golmote"},"autoloader":{"title":"Autoloader","description":"Automatically loads the needed languages to highlight the code blocks.","owner":"Golmote","noCSS":true},"keep-markup":{"title":"Keep Markup","description":"Prevents custom markup from being dropped out during highlighting.","owner":"Golmote","optional":"normalize-whitespace","noCSS":true},"command-line":{"title":"Command Line","description":"Display a command line with a prompt and, optionally, the output/response from the commands.","owner":"chriswells0"},"unescaped-markup":{"title":"Unescaped Markup","description":"Write markup without having to escape anything."},"normalize-whitespace":{"title":"Normalize Whitespace","description":"Supports multiple operations to normalize whitespace in code blocks.","owner":"zeitgeist87","optional":"unescaped-markup","noCSS":true},"data-uri-highlight":{"title":"Data-URI Highlight","description":"Highlights data-URI contents.","owner":"Golmote","noCSS":true},"toolbar":{"title":"Toolbar","description":"Attach a toolbar for plugins to easily register buttons on the top of a code block.","owner":"mAAdhaTTah"},"copy-to-clipboard":{"title":"Copy to Clipboard Button","description":"Add a button that copies the code block to the clipboard when clicked.","owner":"mAAdhaTTah","require":"toolbar","noCSS":true},"download-button":{"title":"Download Button","description":"A button in the toolbar of a code block adding a convenient way to download a code file.","owner":"Golmote","require":"toolbar","noCSS":true},"match-braces":{"title":"Match braces","description":"Highlights matching braces.","owner":"RunDevelopment"},"diff-highlight":{"title":"Diff Highlight","description":"Highlights the code inside diff blocks.","owner":"RunDevelopment","require":"diff"},"filter-highlight-all":{"title":"Filter highlightAll","description":"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.","owner":"RunDevelopment","noCSS":true},"treeview":{"title":"Treeview","description":"A language with special styles to highlight file system tree structures.","owner":"Golmote"}}}; if (typeof module !== 'undefined' && module.exports) { module.exports = components; } \ No newline at end of file diff --git a/components.json b/components.json index 6b17a85f6f..3c0f1db957 100644 --- a/components.json +++ b/components.json @@ -160,6 +160,11 @@ "title": "AutoIt", "owner": "Golmote" }, + "avisynth": { + "title": "AviSynth", + "alias": "avs", + "owner": "Zinfidel" + }, "avro-idl": { "title":"Avro IDL", "alias": "avdl", diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js new file mode 100644 index 0000000000..2f1dbb8dd3 --- /dev/null +++ b/components/prism-avisynth.js @@ -0,0 +1,172 @@ +// http://avisynth.nl/index.php/The_full_AviSynth_grammar +(function (Prism) { + + function toAlternation(words) { + return words.reduce(function (acc, cur) { + return cat(acc, cur.trim().replace(/ /g, '|')); + }, ''); + } + + function cat(left, right) { + return left + (left == '' ? '' : '|') + right; + } + + 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 wordLists = { + types: 'clip int float string bool val', + keywords: 'function global return try catch if else while for __END__', // includes avs+ native gscript constructs + predefined: 'DEFAULT_MT_MODE (?:SCRIPT|MAINSCRIPT|PROGRAM)DIR (?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS', + constants: 'MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)', + internals: { + bools: 'is(?:bool|clip|float|int|string) defined (?:var|(?:internal)?function)?exists?', + control: 'apply assert default eval import select nop undefined', + global: 'set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment) opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))', + conv: 'hex(?:value)? value', + numeric: 'max min muldiv floor ceil round fmod pi exp log(?:10)? pow sqrt abs sign frac rand spline continued(?:numerator|denominator)?', + trig: 'a?sinh? a?cosh? a?tan[2h]?', + 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?))', + runtime: 'average(?:luma|chroma[uv]|[bgr]) (?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)? [yuvrgb]plane(?:median|min|max|minmaxdifference)', + script: 'script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?) setlogparams logmsg getprocessinfo', + string: '[lu]case str(?:toutf8|fromutf8|len|cmpi?) (?:rev|left|right|mid|find|replace|fill)str format trim(?:left|right|all) chr ord time', + version: 'version(?:number|string) isversionorgreater', + helper: 'buildpixeltype colorspacenametopixeltype', + avsplus: 'setfiltermtmode prefetch addautoloaddir on(?:cpu|cuda)' + }, + properties: { + content: 'has(?:audio|video)', + resolution: 'width height', + framerate: 'frame(?:count|rate) framerate(?:numerator|denominator)', + interlacing: 'is(?:field|frame)based getparity', + colorformat: 'pixeltype is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb) hasalpha componentsize numcomponents bitspercomponent', + audio: 'audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits) isaudio(?:float|int)' + }, + filters: { + source: 'avi(?:file)?source opendmlsource directshowsource image(?:reader|source|sourceanim) segmented(?:avisource|directshowsource) wavsource', + color: 'coloryuv convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2) convertbacktoyuy2 fixluminance gr[ae]yscale invert levels limiter mergea?rgb merge(?:luma|chroma) rgbadjust show(?:red|green|blue|alpha) swapuv tweak [uv]toy8? ytouv', + overlay: '(?:colorkey|reset)mask mask(?:hs)? layer merge overlay subtract', + geometry: 'addborders crop(?:bottom)? flip(?:horizontal|vertical) letterbox (?:horizontal|vertical)?reduceby2 (?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize skewrows turn(?:left|right|180)', + pixel: 'blur sharpen generalconvolution (?:spatial|temporal)soften fixbrokenchromaupsampling', + timeline: 'trim (?:un)?alignedsplice (?:assume|assumescaled|change|convert)FPS (?:delete|duplicate)frame dissolve fade(?:in|out|io)[02]? freezeframe interleave loop reverse select(?:even|odd|(?:range)?every)', + interlace: 'assume(?:frame|field)based assume[bt]ff bob complementparity doubleweave peculiarblend pulldown separate(?:columns|rows|fields) swapfields weave(?:columns|rows)?', + 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 supereq ssrc timestretch', + conditional: 'conditional(?:filter|select|reader) frameevaluate scriptclip writefile(?:if|start|end)? animate applyrange tcp(?:server|source)', + export: 'imagewriter', + debug: 'subtitle blankclip blackness colorbars(?:hd)? compare dumpfiltergraph setgraphanalysis echo histogram info messageclip preroll showfiveversions show(?:framenumber|smpte|time) stack(?:horizontal|vertical) tone version' + } + }; + + var types = toAlternation([wordLists.types]); + var keywords = toAlternation([wordLists.keywords]); + var predefined = toAlternation([wordLists.predefined]); + var constants = toAlternation([wordLists.constants]); + var properties = toAlternation(Object.values(wordLists.properties)); + var intfuncs = toAlternation(Object.values(wordLists.internals)); + var intfilters = toAlternation(Object.values(wordLists.filters)); + var internals = cat(intfuncs, cat(properties, intfilters)); + + Prism.languages.avisynth = { + + 'comment': [ + { // Matches [* *] nestable block comments, but can not handle nested comments correctly (recursion) + pattern: /(^|[^\\])\[\*[\s\S]*?(?:\*\]|$)/, + lookbehind: true, + greedy: true + }, + { // Matches /* */ block comments + pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, + lookbehind: true, + greedy: true + }, + { // Matches # comments + pattern: /(^|[^\\$])#.*/, + lookbehind: true, + greedy: true + } + ], + + // Handle before strings because optional arguments are surrounded by double quotes. + 'argument': { + pattern: re(/\b(?:<<0>>)\s+("?)\w+\1/.source, [types], 'i'), + inside: { + 'keyword': { + pattern: re(/\b(?:<<0>>)\b/.source, [types], 'i') + } + } + }, + + 'string': [ + { // triple double-quoted + pattern: /"""[\s\S]*?"""/i, + greedy: true, + }, + { // single double-quoted + pattern: /"(?:\\(?:\r\n|[\s\S])|(?!")[^\\\r\n])*"/, + greedy: true, + inside: { + 'constant': { + pattern: re(/<<0>>/.source, [predefined]) // These *are* case-sensitive! + } + } + } + ], + + // The special "last" variable that takes the value of the last implicitly returned clip. + 'variable': /\b(last)\b/i, + + 'boolean': /\b(?:true|false|yes|no)\b/i, + + 'keyword': { + pattern: re(/((?:^|[\\{])\s*)(?:<<0>>)(?=\s+)/.source, [keywords], 'im'), + lookbehind: true + }, + + 'constant': re(/\b<<0>>\b/.source, [constants]), + + // AviSynth's internal functions and filters. + 'builtin': re(/\b(?:<<0>>)(?=\s*\()/.source, [internals], 'i'), + + 'builtin': [ + { // AviSynth's internal clip properties. + pattern: re(/(\b\.)(?:<<0>>)\b(?=[^\.])/.source, [properties], 'i'), + lookbehind: true + }, + { // AviSynth's internal functions and filters, including properties used as functions. + pattern: re(/\b(?:<<0>>)(?=\s*\()/.source, [internals], 'i') + } + ], + + // External filters, and user-defined filters. + 'function': { + pattern: /\b[a-z_]\w*(?=\s*\()/i, + inside: { + 'keyword': { // type casts + pattern: re(/\b(?:<<0>>)\b/.source, [types], 'i') + } + } + }, + + // Matches a \ as the first or last character on a line + 'line-continuation': { + pattern: /(^\s*)\\|\\(?=\s*$)/m, + lookbehind: true, + alias: 'punctuation' + }, + + 'operator': /\+\+?|!=?|<=?|>=?|==?|&&|\|\||\?|\*|\/|%|:/, + + 'number': /\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i, + + 'punctuation': /[{};(),.]/ + } +}(Prism)); + +Prism.languages.avs = Prism.languages.avisynth \ No newline at end of file diff --git a/components/prism-avisynth.min.js b/components/prism-avisynth.min.js new file mode 100644 index 0000000000..cf04a5051c --- /dev/null +++ b/components/prism-avisynth.min.js @@ -0,0 +1 @@ +!function(e){function r(e){return e.reduce(function(e,r){return a(e,r.trim().replace(/ /g,"|"))},"")}function a(e,r){return e+(""==e?"":"|")+r}function t(e,r,a){return RegExp(function(e,a){return e.replace(/<<(\d+)>>/g,function(e,r){return a[+r]})}(e,r),a||"")}var i="function global return try catch if else while for __END__",o="DEFAULT_MT_MODE (?:SCRIPT|MAINSCRIPT|PROGRAM)DIR (?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS",n="MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)",l={bools:"is(?:bool|clip|float|int|string) defined (?:var|(?:internal)?function)?exists?",control:"apply assert default eval import select nop undefined",global:"set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment) opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))",conv:"hex(?:value)? value",numeric:"max min muldiv floor ceil round fmod pi exp log(?:10)? pow sqrt abs sign frac rand spline continued(?:numerator|denominator)?",trig:"a?sinh? a?cosh? a?tan[2h]?",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?))",runtime:"average(?:luma|chroma[uv]|[bgr]) (?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)? [yuvrgb]plane(?:median|min|max|minmaxdifference)",script:"script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?) setlogparams logmsg getprocessinfo",string:"[lu]case str(?:toutf8|fromutf8|len|cmpi?) (?:rev|left|right|mid|find|replace|fill)str format trim(?:left|right|all) chr ord time",version:"version(?:number|string) isversionorgreater",helper:"buildpixeltype colorspacenametopixeltype",avsplus:"setfiltermtmode prefetch addautoloaddir on(?:cpu|cuda)"},s={content:"has(?:audio|video)",resolution:"width height",framerate:"frame(?:count|rate) framerate(?:numerator|denominator)",interlacing:"is(?:field|frame)based getparity",colorformat:"pixeltype is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb) hasalpha componentsize numcomponents bitspercomponent",audio:"audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits) isaudio(?:float|int)"},c={source:"avi(?:file)?source opendmlsource directshowsource image(?:reader|source|sourceanim) segmented(?:avisource|directshowsource) wavsource",color:"coloryuv convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2) convertbacktoyuy2 fixluminance gr[ae]yscale invert levels limiter mergea?rgb merge(?:luma|chroma) rgbadjust show(?:red|green|blue|alpha) swapuv tweak [uv]toy8? ytouv",overlay:"(?:colorkey|reset)mask mask(?:hs)? layer merge overlay subtract",geometry:"addborders crop(?:bottom)? flip(?:horizontal|vertical) letterbox (?:horizontal|vertical)?reduceby2 (?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize skewrows turn(?:left|right|180)",pixel:"blur sharpen generalconvolution (?:spatial|temporal)soften fixbrokenchromaupsampling",timeline:"trim (?:un)?alignedsplice (?:assume|assumescaled|change|convert)FPS (?:delete|duplicate)frame dissolve fade(?:in|out|io)[02]? freezeframe interleave loop reverse select(?:even|odd|(?:range)?every)",interlace:"assume(?:frame|field)based assume[bt]ff bob complementparity doubleweave peculiarblend pulldown separate(?:columns|rows|fields) swapfields weave(?:columns|rows)?",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 supereq ssrc timestretch",conditional:"conditional(?:filter|select|reader) frameevaluate scriptclip writefile(?:if|start|end)? animate applyrange tcp(?:server|source)",export:"imagewriter",debug:"subtitle blankclip blackness colorbars(?:hd)? compare dumpfiltergraph setgraphanalysis echo histogram info messageclip preroll showfiveversions show(?:framenumber|smpte|time) stack(?:horizontal|vertical) tone version"},u=r(["clip int float string bool val"]),m=r([i]),d=r([o]),p=r([n]),b=r(Object.values(s)),f=a(r(Object.values(l)),a(b,r(Object.values(c))));e.languages.avisynth={comment:[{pattern:/(^|[^\\])\[\*[\s\S]*?(?:\*\]|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],argument:{pattern:t('\\b(?:<<0>>)\\s+("?)\\w+\\1',[u],"i"),inside:{keyword:{pattern:t("\\b(?:<<0>>)\\b",[u],"i")}}},string:[{pattern:/"""[\s\S]*?"""/i,greedy:!0},{pattern:/"(?:\\(?:\r\n|[\s\S])|(?!")[^\\\r\n])*"/,greedy:!0,inside:{constant:{pattern:t("<<0>>",[d])}}}],variable:/\b(last)\b/i,boolean:/\b(?:true|false|yes|no)\b/i,keyword:{pattern:t("((?:^|[\\\\{])\\s*)(?:<<0>>)(?=\\s+)",[m],"im"),lookbehind:!0},constant:t("\\b<<0>>\\b",[p]),builtin:t("\\b(?:<<0>>)(?=\\s*\\()",[f],"i"),builtin:[{pattern:t("(\\b\\.)(?:<<0>>)\\b(?=[^\\.])",[b],"i"),lookbehind:!0},{pattern:t("\\b(?:<<0>>)(?=\\s*\\()",[f],"i")}],function:{pattern:/\b[a-z_]\w*(?=\s*\()/i,inside:{keyword:{pattern:t("\\b(?:<<0>>)\\b",[u],"i")}}},"line-continuation":{pattern:/(^\s*)\\|\\(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},operator:/\+\+?|!=?|<=?|>=?|==?|&&|\|\||\?|\*|\/|%|:/,number:/\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i,punctuation:/[{};(),.]/}}(Prism),Prism.languages.avs=Prism.languages.avisynth; \ No newline at end of file diff --git a/examples/prism-avisynth.html b/examples/prism-avisynth.html new file mode 100644 index 0000000000..e78fecd9e9 --- /dev/null +++ b/examples/prism-avisynth.html @@ -0,0 +1,24 @@ +

Full Example

+
/*
+ * Example AviSynth script for PrismJS demonstration.
+ * By Zinfidel
+ */
+
+SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
+AddAutoloadDir("MAINSCRIPTDIR/programs/plugins")
+
+# Multiplies clip size and changes aspect ratio to 4:3
+function CorrectAspectRatio(clip c, int scaleFactor, bool "useNearestNeighbor") {
+    useNearestNeighbor = default(useNearestNeighbor, false)
+    stretchFactor = (c.Height * (4 / 3)) / c.Width
+
+    return useNearestNeighbor \
+        ? c.PointResize(c.Width * scaleFactor * stretchFactor, c.Height * scaleFactor) \
+        : c.Lanczos4Resize(c.Width * scaleFactor * stretchFactor, c.Height * scaleFactor)
+}
+
+AviSource("myclip.avi")
+last.CorrectAspectRatio(3, yes)
+
+
+Prefetch(4)
\ No newline at end of file diff --git a/plugins/autoloader/prism-autoloader.js b/plugins/autoloader/prism-autoloader.js index ddefe74218..fe1b3b0b04 100644 --- a/plugins/autoloader/prism-autoloader.js +++ b/plugins/autoloader/prism-autoloader.js @@ -172,6 +172,7 @@ "js": "javascript", "g4": "antlr4", "adoc": "asciidoc", + "avs": "avisynth", "avdl": "avro-idl", "shell": "bash", "shortcode": "bbcode", diff --git a/plugins/autoloader/prism-autoloader.min.js b/plugins/autoloader/prism-autoloader.min.js index d5ca7c04dd..29790e15d7 100644 --- a/plugins/autoloader/prism-autoloader.min.js +++ b/plugins/autoloader/prism-autoloader.min.js @@ -1 +1 @@ -!function(){if("undefined"!=typeof Prism&&"undefined"!=typeof document){var l={javascript:"clike",actionscript:"javascript",apex:["clike","sql"],arduino:"cpp",aspnet:["markup","csharp"],birb:"clike",bison:"c",c:"clike",csharp:"clike",cpp:"c",cfscript:"clike",chaiscript:["clike","cpp"],coffeescript:"javascript",crystal:"ruby","css-extras":"css",d:"clike",dart:"clike",django:"markup-templating",ejs:["javascript","markup-templating"],etlua:["lua","markup-templating"],erb:["ruby","markup-templating"],fsharp:"clike","firestore-security-rules":"clike",flow:"javascript",ftl:"markup-templating",gml:"clike",glsl:"c",go:"clike",groovy:"clike",haml:"ruby",handlebars:"markup-templating",haxe:"clike",hlsl:"c",idris:"haskell",java:"clike",javadoc:["markup","java","javadoclike"],jolie:"clike",jsdoc:["javascript","javadoclike","typescript"],"js-extras":"javascript",json5:"json",jsonp:"json","js-templates":"javascript",kotlin:"clike",latte:["clike","markup-templating","php"],less:"css",lilypond:"scheme",liquid:"markup-templating",markdown:"markup","markup-templating":"markup",mongodb:"javascript",n4js:"javascript",objectivec:"c",opencl:"c",parser:"markup",php:"markup-templating",phpdoc:["php","javadoclike"],"php-extras":"php",plsql:"sql",processing:"clike",protobuf:"clike",pug:["markup","javascript"],purebasic:"clike",purescript:"haskell",qsharp:"clike",qml:"javascript",qore:"clike",racket:"scheme",jsx:["markup","javascript"],tsx:["jsx","typescript"],reason:"clike",ruby:"clike",sass:"css",scss:"css",scala:"java","shell-session":"bash",smarty:"markup-templating",solidity:"clike",soy:"markup-templating",sparql:"turtle",sqf:"clike",squirrel:"clike","t4-cs":["t4-templating","csharp"],"t4-vb":["t4-templating","vbnet"],tap:"yaml",tt2:["clike","markup-templating"],textile:"markup",twig:"markup",typescript:"javascript",v:"clike",vala:"clike",vbnet:"basic",velocity:"markup",wiki:"markup",xeora:"markup","xml-doc":"markup",xquery:"markup"},n={html:"markup",xml:"markup",svg:"markup",mathml:"markup",ssml:"markup",atom:"markup",rss:"markup",js:"javascript",g4:"antlr4",adoc:"asciidoc",avdl:"avro-idl",shell:"bash",shortcode:"bbcode",rbnf:"bnf",oscript:"bsl",cs:"csharp",dotnet:"csharp",cfc:"cfscript",coffee:"coffeescript",conc:"concurnas",jinja2:"django","dns-zone":"dns-zone-file",dockerfile:"docker",gv:"dot",eta:"ejs",xlsx:"excel-formula",xls:"excel-formula",gamemakerlanguage:"gml",gni:"gn",hbs:"handlebars",hs:"haskell",idr:"idris",gitignore:"ignore",hgignore:"ignore",npmignore:"ignore",webmanifest:"json",kt:"kotlin",kts:"kotlin",kum:"kumir",tex:"latex",context:"latex",ly:"lilypond",emacs:"lisp",elisp:"lisp","emacs-lisp":"lisp",md:"markdown",moon:"moonscript",n4jsd:"n4js",nani:"naniscript",objc:"objectivec",qasm:"openqasm",objectpascal:"pascal",px:"pcaxis",pcode:"peoplecode",pq:"powerquery",mscript:"powerquery",pbfasm:"purebasic",purs:"purescript",py:"python",qs:"qsharp",rkt:"racket",rpy:"renpy",robot:"robotframework",rb:"ruby","sh-session":"shell-session",shellsession:"shell-session",smlnj:"sml",sol:"solidity",sln:"solution-file",rq:"sparql",t4:"t4-cs",trig:"turtle",ts:"typescript",tsconfig:"typoscript",uscript:"unrealscript",uc:"unrealscript",url:"uri",vb:"visual-basic",vba:"visual-basic",mathematica:"wolfram",nb:"wolfram",wl:"wolfram",xeoracube:"xeora",yml:"yaml"},p={},e="components/",a=Prism.util.currentScript();if(a){var r=/\bplugins\/autoloader\/prism-autoloader\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,s=/(^|\/)[\w-]+\.(?:min\.)?js(?:\?[^\r\n/]*)?$/i,i=a.getAttribute("data-autoloader-path");if(null!=i)e=i.trim().replace(/\/?$/,"/");else{var t=a.src;r.test(t)?e=t.replace(r,"components/"):s.test(t)&&(e=t.replace(s,"$1components/"))}}var o=Prism.plugins.autoloader={languages_path:e,use_minified:!0,loadLanguages:m};Prism.hooks.add("complete",function(e){var a=e.element,r=e.language;if(a&&r&&"none"!==r){var s=function(e){var a=(e.getAttribute("data-dependencies")||"").trim();if(!a){var r=e.parentElement;r&&"pre"===r.tagName.toLowerCase()&&(a=(r.getAttribute("data-dependencies")||"").trim())}return a?a.split(/\s*,\s*/g):[]}(a);/^diff-./i.test(r)?(s.push("diff"),s.push(r.substr("diff-".length))):s.push(r),s.every(u)||m(s,function(){Prism.highlightElement(a)})}})}function u(e){if(0<=e.indexOf("!"))return!1;if((e=n[e]||e)in Prism.languages)return!0;var a=p[e];return a&&!a.error&&!1===a.loading}function m(e,a,r){"string"==typeof e&&(e=[e]);var s=e.length,i=0,t=!1;function c(){t||++i===s&&a&&a(e)}0!==s?e.forEach(function(e){!function(a,r,s){var i=0<=a.indexOf("!");function e(){var e=p[a];e||(e=p[a]={callbacks:[]}),e.callbacks.push({success:r,error:s}),!i&&u(a)?k(a,"success"):!i&&e.error?k(a,"error"):!i&&e.loading||(e.loading=!0,e.error=!1,function(e,a,r){var s=document.createElement("script");s.src=e,s.async=!0,s.onload=function(){document.body.removeChild(s),a&&a()},s.onerror=function(){document.body.removeChild(s),r&&r()},document.body.appendChild(s)}(function(e){return o.languages_path+"prism-"+e+(o.use_minified?".min":"")+".js"}(a),function(){e.loading=!1,k(a,"success")},function(){e.loading=!1,e.error=!0,k(a,"error")}))}a=a.replace("!",""),a=n[a]||a;var t=l[a];t&&t.length?m(t,e,s):e()}(e,c,function(){t||(t=!0,r&&r(e))})}):a&&setTimeout(a,0)}function k(e,a){if(p[e]){for(var r=p[e].callbacks,s=0,i=r.length;s +>= += +== +&& +|| +? +: +% +/ +* + +$abcdef +$89abcdef +123.89032 +.902834 + +$9abcdef +a$123456a + +() +{} +; +, +. +\ + +\ 1.0 \ + +1.0 \ 1.0 + +---------------------------------------------------- + +[ + ["operator", "+"], + ["operator", "++"], + ["operator", "!"], + ["operator", "!="], + ["operator", "<"], + ["operator", "<="], + ["operator", ">"], + ["operator", ">="], + ["operator", "="], + ["operator", "=="], + ["operator", "&&"], + ["operator", "||"], + ["operator", "?"], + ["operator", ":"], + ["operator", "%"], + ["operator", "/"], + ["operator", "*"], + + ["number", "$abcdef"], + ["number", "$89abcdef"], + ["number", "123.89032"], + ["number", ".902834"], + + "\r\n\r\n$9abcdef\r\na$123456a\r\n\r\n", + + ["punctuation", "("], ["punctuation", ")"], + ["punctuation", "{"], ["punctuation", "}"], + ["punctuation", ";"], + ["punctuation", ","], + ["punctuation", "."], + ["line-continuation", "\\"], + + ["line-continuation", "\\"], ["number", "1.0"], ["line-continuation", "\\"], + + ["number", "1.0"], " \\ ", ["number", "1.0"] +] + +---------------------------------------------------- + +Numbers can be specified in decimal form, with or without a leading value. So 0.0 and .0 both work. +Numbers can also be specified as 6- or 8- digit hexadecimal strings for colors. They begin with a $. +Numbers can not be bounded by words. + +Line continuations must be either the first or last character in a line, less some whitespace. \ No newline at end of file diff --git a/tests/languages/avisynth/types_arguments_feature.test b/tests/languages/avisynth/types_arguments_feature.test new file mode 100644 index 0000000000..43cfaef582 --- /dev/null +++ b/tests/languages/avisynth/types_arguments_feature.test @@ -0,0 +1,116 @@ +function test(clip input, int interleavedFields, float precision, string "floatingDesync", bool "useQTGMC", val "chromaNoise") +{ + castTest = clip(chromaNoise) + castTest = int(chromaNoise) + castTest = float(chromaNoise) + castTest = string(chromaNoise) + castTest = bool(chromaNoise) + castTest = val(chromaNoise) + + return interleavedClip +} + +---------------------------------------------------- + +[ + ["keyword", "function"], + ["function", ["test"]], + ["punctuation", "("], + ["argument", [ + ["keyword", "clip"], + " input" + ]], + ["punctuation", ","], + ["argument", [ + ["keyword", "int"], + " interleavedFields" + ]], + ["punctuation", ","], + ["argument", [ + ["keyword", "float"], + " precision" + ]], + ["punctuation", ","], + ["argument", [ + ["keyword", "string"], + " \"floatingDesync\"" + ]], + ["punctuation", ","], + ["argument", [ + ["keyword", "bool"], + " \"useQTGMC\"" + ]], + ["punctuation", ","], + ["argument", [ + ["keyword", "val"], + " \"chromaNoise\"" + ]], + ["punctuation", ")"], + + ["punctuation", "{"], + + "\r\n\tcastTest ", + ["operator", "="], + ["function", [ + ["keyword", "clip"] + ]], + ["punctuation", "("], + "chromaNoise", + ["punctuation", ")"], + + "\r\n\tcastTest ", + ["operator", "="], + ["function", [ + ["keyword", "int"] + ]], + ["punctuation", "("], + "chromaNoise", + ["punctuation", ")"], + + "\r\n\tcastTest ", + ["operator", "="], + ["function", [ + ["keyword", "float"] + ]], + ["punctuation", "("], + "chromaNoise", + ["punctuation", ")"], + + "\r\n\tcastTest ", + ["operator", "="], + ["function", [ + ["keyword", "string"] + ]], + ["punctuation", "("], + "chromaNoise", + ["punctuation", ")"], + + "\r\n\tcastTest ", + ["operator", "="], + ["function", [ + ["keyword", "bool"] + ]], + ["punctuation", "("], + "chromaNoise", + ["punctuation", ")"], + + "\r\n\tcastTest ", + ["operator", "="], + ["function", [ + ["keyword", "val"] + ]], + ["punctuation", "("], + "chromaNoise", + ["punctuation", ")"], + + ["keyword", "return"], " interleavedClip\r\n", + ["punctuation", "}"] +] + +---------------------------------------------------- + +Test types and optional arguments. +Optional arguments check for preceeding types to match before getting matched as a string, and should not be matched as strings. +Incidental names of types in an arguments list (such as "interleavedFields" containing "int") should not get highlighted. +Types can be used as casts, and should not be highlighted as user-functions. +Incidental names of types elsewhere (such as "interleavedClip" in a function body) should not get highlighted. diff --git a/tests/languages/avisynth/userfunctions_feature.test b/tests/languages/avisynth/userfunctions_feature.test new file mode 100644 index 0000000000..c671ea1eb7 --- /dev/null +++ b/tests/languages/avisynth/userfunctions_feature.test @@ -0,0 +1,25 @@ +function CustomUserFunction() { + + +} + +QTGMC() + +---------------------------------------------------- + +[ + ["keyword", "function"], + ["function", ["CustomUserFunction"]], + ["punctuation", "("], + ["punctuation", ")"], + ["punctuation", "{"], + + ["punctuation", "}"], + + ["function", ["QTGMC"]], ["punctuation", "("], ["punctuation", ")"] +] + +---------------------------------------------------- + +Identifiers after the function keyword are user-defined functions. +Identifiers preceeding an opening parenthesis that are not an internal function or filter are a user/external function/filter. From 0b6bb730471828fe5cc5eb60c9cc4b71743f0e82 Mon Sep 17 00:00:00 2001 From: Zinfidel Date: Sun, 12 Sep 2021 02:02:32 -0700 Subject: [PATCH 02/12] Remove duplicate definition. --- components/prism-avisynth.js | 3 --- components/prism-avisynth.min.js | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js index 2f1dbb8dd3..8bc3a3ab98 100644 --- a/components/prism-avisynth.js +++ b/components/prism-avisynth.js @@ -131,9 +131,6 @@ 'constant': re(/\b<<0>>\b/.source, [constants]), - // AviSynth's internal functions and filters. - 'builtin': re(/\b(?:<<0>>)(?=\s*\()/.source, [internals], 'i'), - 'builtin': [ { // AviSynth's internal clip properties. pattern: re(/(\b\.)(?:<<0>>)\b(?=[^\.])/.source, [properties], 'i'), diff --git a/components/prism-avisynth.min.js b/components/prism-avisynth.min.js index cf04a5051c..9cd5723514 100644 --- a/components/prism-avisynth.min.js +++ b/components/prism-avisynth.min.js @@ -1 +1 @@ -!function(e){function r(e){return e.reduce(function(e,r){return a(e,r.trim().replace(/ /g,"|"))},"")}function a(e,r){return e+(""==e?"":"|")+r}function t(e,r,a){return RegExp(function(e,a){return e.replace(/<<(\d+)>>/g,function(e,r){return a[+r]})}(e,r),a||"")}var i="function global return try catch if else while for __END__",o="DEFAULT_MT_MODE (?:SCRIPT|MAINSCRIPT|PROGRAM)DIR (?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS",n="MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)",l={bools:"is(?:bool|clip|float|int|string) defined (?:var|(?:internal)?function)?exists?",control:"apply assert default eval import select nop undefined",global:"set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment) opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))",conv:"hex(?:value)? value",numeric:"max min muldiv floor ceil round fmod pi exp log(?:10)? pow sqrt abs sign frac rand spline continued(?:numerator|denominator)?",trig:"a?sinh? a?cosh? a?tan[2h]?",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?))",runtime:"average(?:luma|chroma[uv]|[bgr]) (?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)? [yuvrgb]plane(?:median|min|max|minmaxdifference)",script:"script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?) setlogparams logmsg getprocessinfo",string:"[lu]case str(?:toutf8|fromutf8|len|cmpi?) (?:rev|left|right|mid|find|replace|fill)str format trim(?:left|right|all) chr ord time",version:"version(?:number|string) isversionorgreater",helper:"buildpixeltype colorspacenametopixeltype",avsplus:"setfiltermtmode prefetch addautoloaddir on(?:cpu|cuda)"},s={content:"has(?:audio|video)",resolution:"width height",framerate:"frame(?:count|rate) framerate(?:numerator|denominator)",interlacing:"is(?:field|frame)based getparity",colorformat:"pixeltype is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb) hasalpha componentsize numcomponents bitspercomponent",audio:"audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits) isaudio(?:float|int)"},c={source:"avi(?:file)?source opendmlsource directshowsource image(?:reader|source|sourceanim) segmented(?:avisource|directshowsource) wavsource",color:"coloryuv convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2) convertbacktoyuy2 fixluminance gr[ae]yscale invert levels limiter mergea?rgb merge(?:luma|chroma) rgbadjust show(?:red|green|blue|alpha) swapuv tweak [uv]toy8? ytouv",overlay:"(?:colorkey|reset)mask mask(?:hs)? layer merge overlay subtract",geometry:"addborders crop(?:bottom)? flip(?:horizontal|vertical) letterbox (?:horizontal|vertical)?reduceby2 (?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize skewrows turn(?:left|right|180)",pixel:"blur sharpen generalconvolution (?:spatial|temporal)soften fixbrokenchromaupsampling",timeline:"trim (?:un)?alignedsplice (?:assume|assumescaled|change|convert)FPS (?:delete|duplicate)frame dissolve fade(?:in|out|io)[02]? freezeframe interleave loop reverse select(?:even|odd|(?:range)?every)",interlace:"assume(?:frame|field)based assume[bt]ff bob complementparity doubleweave peculiarblend pulldown separate(?:columns|rows|fields) swapfields weave(?:columns|rows)?",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 supereq ssrc timestretch",conditional:"conditional(?:filter|select|reader) frameevaluate scriptclip writefile(?:if|start|end)? animate applyrange tcp(?:server|source)",export:"imagewriter",debug:"subtitle blankclip blackness colorbars(?:hd)? compare dumpfiltergraph setgraphanalysis echo histogram info messageclip preroll showfiveversions show(?:framenumber|smpte|time) stack(?:horizontal|vertical) tone version"},u=r(["clip int float string bool val"]),m=r([i]),d=r([o]),p=r([n]),b=r(Object.values(s)),f=a(r(Object.values(l)),a(b,r(Object.values(c))));e.languages.avisynth={comment:[{pattern:/(^|[^\\])\[\*[\s\S]*?(?:\*\]|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],argument:{pattern:t('\\b(?:<<0>>)\\s+("?)\\w+\\1',[u],"i"),inside:{keyword:{pattern:t("\\b(?:<<0>>)\\b",[u],"i")}}},string:[{pattern:/"""[\s\S]*?"""/i,greedy:!0},{pattern:/"(?:\\(?:\r\n|[\s\S])|(?!")[^\\\r\n])*"/,greedy:!0,inside:{constant:{pattern:t("<<0>>",[d])}}}],variable:/\b(last)\b/i,boolean:/\b(?:true|false|yes|no)\b/i,keyword:{pattern:t("((?:^|[\\\\{])\\s*)(?:<<0>>)(?=\\s+)",[m],"im"),lookbehind:!0},constant:t("\\b<<0>>\\b",[p]),builtin:t("\\b(?:<<0>>)(?=\\s*\\()",[f],"i"),builtin:[{pattern:t("(\\b\\.)(?:<<0>>)\\b(?=[^\\.])",[b],"i"),lookbehind:!0},{pattern:t("\\b(?:<<0>>)(?=\\s*\\()",[f],"i")}],function:{pattern:/\b[a-z_]\w*(?=\s*\()/i,inside:{keyword:{pattern:t("\\b(?:<<0>>)\\b",[u],"i")}}},"line-continuation":{pattern:/(^\s*)\\|\\(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},operator:/\+\+?|!=?|<=?|>=?|==?|&&|\|\||\?|\*|\/|%|:/,number:/\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i,punctuation:/[{};(),.]/}}(Prism),Prism.languages.avs=Prism.languages.avisynth; \ No newline at end of file +!function(e){function r(e){return e.reduce(function(e,r){return a(e,r.trim().replace(/ /g,"|"))},"")}function a(e,r){return e+(""==e?"":"|")+r}function t(e,r,a){return RegExp(function(e,a){return e.replace(/<<(\d+)>>/g,function(e,r){return a[+r]})}(e,r),a||"")}var o="function global return try catch if else while for __END__",i="DEFAULT_MT_MODE (?:SCRIPT|MAINSCRIPT|PROGRAM)DIR (?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS",n="MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)",l={bools:"is(?:bool|clip|float|int|string) defined (?:var|(?:internal)?function)?exists?",control:"apply assert default eval import select nop undefined",global:"set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment) opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))",conv:"hex(?:value)? value",numeric:"max min muldiv floor ceil round fmod pi exp log(?:10)? pow sqrt abs sign frac rand spline continued(?:numerator|denominator)?",trig:"a?sinh? a?cosh? a?tan[2h]?",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?))",runtime:"average(?:luma|chroma[uv]|[bgr]) (?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)? [yuvrgb]plane(?:median|min|max|minmaxdifference)",script:"script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?) setlogparams logmsg getprocessinfo",string:"[lu]case str(?:toutf8|fromutf8|len|cmpi?) (?:rev|left|right|mid|find|replace|fill)str format trim(?:left|right|all) chr ord time",version:"version(?:number|string) isversionorgreater",helper:"buildpixeltype colorspacenametopixeltype",avsplus:"setfiltermtmode prefetch addautoloaddir on(?:cpu|cuda)"},s={content:"has(?:audio|video)",resolution:"width height",framerate:"frame(?:count|rate) framerate(?:numerator|denominator)",interlacing:"is(?:field|frame)based getparity",colorformat:"pixeltype is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb) hasalpha componentsize numcomponents bitspercomponent",audio:"audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits) isaudio(?:float|int)"},c={source:"avi(?:file)?source opendmlsource directshowsource image(?:reader|source|sourceanim) segmented(?:avisource|directshowsource) wavsource",color:"coloryuv convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2) convertbacktoyuy2 fixluminance gr[ae]yscale invert levels limiter mergea?rgb merge(?:luma|chroma) rgbadjust show(?:red|green|blue|alpha) swapuv tweak [uv]toy8? ytouv",overlay:"(?:colorkey|reset)mask mask(?:hs)? layer merge overlay subtract",geometry:"addborders crop(?:bottom)? flip(?:horizontal|vertical) letterbox (?:horizontal|vertical)?reduceby2 (?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize skewrows turn(?:left|right|180)",pixel:"blur sharpen generalconvolution (?:spatial|temporal)soften fixbrokenchromaupsampling",timeline:"trim (?:un)?alignedsplice (?:assume|assumescaled|change|convert)FPS (?:delete|duplicate)frame dissolve fade(?:in|out|io)[02]? freezeframe interleave loop reverse select(?:even|odd|(?:range)?every)",interlace:"assume(?:frame|field)based assume[bt]ff bob complementparity doubleweave peculiarblend pulldown separate(?:columns|rows|fields) swapfields weave(?:columns|rows)?",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 supereq ssrc timestretch",conditional:"conditional(?:filter|select|reader) frameevaluate scriptclip writefile(?:if|start|end)? animate applyrange tcp(?:server|source)",export:"imagewriter",debug:"subtitle blankclip blackness colorbars(?:hd)? compare dumpfiltergraph setgraphanalysis echo histogram info messageclip preroll showfiveversions show(?:framenumber|smpte|time) stack(?:horizontal|vertical) tone version"},u=r(["clip int float string bool val"]),m=r([o]),d=r([i]),p=r([n]),b=r(Object.values(s)),f=a(r(Object.values(l)),a(b,r(Object.values(c))));e.languages.avisynth={comment:[{pattern:/(^|[^\\])\[\*[\s\S]*?(?:\*\]|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],argument:{pattern:t('\\b(?:<<0>>)\\s+("?)\\w+\\1',[u],"i"),inside:{keyword:{pattern:t("\\b(?:<<0>>)\\b",[u],"i")}}},string:[{pattern:/"""[\s\S]*?"""/i,greedy:!0},{pattern:/"(?:\\(?:\r\n|[\s\S])|(?!")[^\\\r\n])*"/,greedy:!0,inside:{constant:{pattern:t("<<0>>",[d])}}}],variable:/\b(last)\b/i,boolean:/\b(?:true|false|yes|no)\b/i,keyword:{pattern:t("((?:^|[\\\\{])\\s*)(?:<<0>>)(?=\\s+)",[m],"im"),lookbehind:!0},constant:t("\\b<<0>>\\b",[p]),builtin:[{pattern:t("(\\b\\.)(?:<<0>>)\\b(?=[^\\.])",[b],"i"),lookbehind:!0},{pattern:t("\\b(?:<<0>>)(?=\\s*\\()",[f],"i")}],function:{pattern:/\b[a-z_]\w*(?=\s*\()/i,inside:{keyword:{pattern:t("\\b(?:<<0>>)\\b",[u],"i")}}},"line-continuation":{pattern:/(^\s*)\\|\\(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},operator:/\+\+?|!=?|<=?|>=?|==?|&&|\|\||\?|\*|\/|%|:/,number:/\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i,punctuation:/[{};(),.]/}}(Prism),Prism.languages.avs=Prism.languages.avisynth; \ No newline at end of file From edca4ac44be2fd5754801890e28780e14fde283a Mon Sep 17 00:00:00 2001 From: Zach Date: Sun, 12 Sep 2021 15:32:26 -0700 Subject: [PATCH 03/12] Apply suggestions from code review Co-authored-by: Michael Schmidt --- components/prism-avisynth.js | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js index 8bc3a3ab98..5fcaa331ee 100644 --- a/components/prism-avisynth.js +++ b/components/prism-avisynth.js @@ -24,7 +24,7 @@ var wordLists = { types: 'clip int float string bool val', keywords: 'function global return try catch if else while for __END__', // includes avs+ native gscript constructs - predefined: 'DEFAULT_MT_MODE (?:SCRIPT|MAINSCRIPT|PROGRAM)DIR (?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS', + predefined: /DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS/.source, constants: 'MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)', internals: { bools: 'is(?:bool|clip|float|int|string) defined (?:var|(?:internal)?function)?exists?', @@ -68,10 +68,23 @@ var keywords = toAlternation([wordLists.keywords]); var predefined = toAlternation([wordLists.predefined]); var constants = toAlternation([wordLists.constants]); - var properties = toAlternation(Object.values(wordLists.properties)); + var properties = [ + // content + /has(?:audio|video)/.source, + // resolution + /width|height/.source, + // framerate + /frame(?:count|rate)|framerate(?:numerator|denominator)/.source, + // interlacing + /is(?:field|frame)based|getparity/.source, + // color format + /pixeltype|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|hasalpha|componentsize|numcomponents|bitspercomponent/.source, + // audio + /audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits)|isaudio(?:float|int)/.source + ].join('|'); var intfuncs = toAlternation(Object.values(wordLists.internals)); var intfilters = toAlternation(Object.values(wordLists.filters)); - var internals = cat(intfuncs, cat(properties, intfilters)); + var internals = intfuncs + '|' + properties + '|' + intfilters; Prism.languages.avisynth = { @@ -109,7 +122,7 @@ greedy: true, }, { // single double-quoted - pattern: /"(?:\\(?:\r\n|[\s\S])|(?!")[^\\\r\n])*"/, + pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/, greedy: true, inside: { 'constant': { @@ -120,7 +133,7 @@ ], // The special "last" variable that takes the value of the last implicitly returned clip. - 'variable': /\b(last)\b/i, + 'variable': /\b(?:last)\b/i, 'boolean': /\b(?:true|false|yes|no)\b/i, From 666cf09c831ed2ee091efe25e9d468867e29a6fa Mon Sep 17 00:00:00 2001 From: Zinfidel Date: Sun, 12 Sep 2021 16:22:14 -0700 Subject: [PATCH 04/12] Remove toAlternation and cat. Convert strings to regex arrays. Also some changes to appease the linter. --- components/prism-avisynth.js | 151 ++++++++++++++++--------------- components/prism-avisynth.min.js | 2 +- 2 files changed, 79 insertions(+), 74 deletions(-) diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js index 5fcaa331ee..7194829a73 100644 --- a/components/prism-avisynth.js +++ b/components/prism-avisynth.js @@ -1,16 +1,6 @@ // http://avisynth.nl/index.php/The_full_AviSynth_grammar (function (Prism) { - function toAlternation(words) { - return words.reduce(function (acc, cur) { - return cat(acc, cur.trim().replace(/ /g, '|')); - }, ''); - } - - function cat(left, right) { - return left + (left == '' ? '' : '|') + right; - } - function replace(pattern, replacements) { return pattern.replace(/<<(\d+)>>/g, function (m, index) { return replacements[+index]; @@ -21,53 +11,38 @@ return RegExp(replace(pattern, replacements), flags || ''); } - var wordLists = { - types: 'clip int float string bool val', - keywords: 'function global return try catch if else while for __END__', // includes avs+ native gscript constructs - predefined: /DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS/.source, - constants: 'MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)', - internals: { - bools: 'is(?:bool|clip|float|int|string) defined (?:var|(?:internal)?function)?exists?', - control: 'apply assert default eval import select nop undefined', - global: 'set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment) opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))', - conv: 'hex(?:value)? value', - numeric: 'max min muldiv floor ceil round fmod pi exp log(?:10)? pow sqrt abs sign frac rand spline continued(?:numerator|denominator)?', - trig: 'a?sinh? a?cosh? a?tan[2h]?', - 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?))', - runtime: 'average(?:luma|chroma[uv]|[bgr]) (?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)? [yuvrgb]plane(?:median|min|max|minmaxdifference)', - script: 'script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?) setlogparams logmsg getprocessinfo', - string: '[lu]case str(?:toutf8|fromutf8|len|cmpi?) (?:rev|left|right|mid|find|replace|fill)str format trim(?:left|right|all) chr ord time', - version: 'version(?:number|string) isversionorgreater', - helper: 'buildpixeltype colorspacenametopixeltype', - avsplus: 'setfiltermtmode prefetch addautoloaddir on(?:cpu|cuda)' - }, - properties: { - content: 'has(?:audio|video)', - resolution: 'width height', - framerate: 'frame(?:count|rate) framerate(?:numerator|denominator)', - interlacing: 'is(?:field|frame)based getparity', - colorformat: 'pixeltype is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb) hasalpha componentsize numcomponents bitspercomponent', - audio: 'audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits) isaudio(?:float|int)' - }, - filters: { - source: 'avi(?:file)?source opendmlsource directshowsource image(?:reader|source|sourceanim) segmented(?:avisource|directshowsource) wavsource', - color: 'coloryuv convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2) convertbacktoyuy2 fixluminance gr[ae]yscale invert levels limiter mergea?rgb merge(?:luma|chroma) rgbadjust show(?:red|green|blue|alpha) swapuv tweak [uv]toy8? ytouv', - overlay: '(?:colorkey|reset)mask mask(?:hs)? layer merge overlay subtract', - geometry: 'addborders crop(?:bottom)? flip(?:horizontal|vertical) letterbox (?:horizontal|vertical)?reduceby2 (?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize skewrows turn(?:left|right|180)', - pixel: 'blur sharpen generalconvolution (?:spatial|temporal)soften fixbrokenchromaupsampling', - timeline: 'trim (?:un)?alignedsplice (?:assume|assumescaled|change|convert)FPS (?:delete|duplicate)frame dissolve fade(?:in|out|io)[02]? freezeframe interleave loop reverse select(?:even|odd|(?:range)?every)', - interlace: 'assume(?:frame|field)based assume[bt]ff bob complementparity doubleweave peculiarblend pulldown separate(?:columns|rows|fields) swapfields weave(?:columns|rows)?', - 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 supereq ssrc timestretch', - conditional: 'conditional(?:filter|select|reader) frameevaluate scriptclip writefile(?:if|start|end)? animate applyrange tcp(?:server|source)', - export: 'imagewriter', - debug: 'subtitle blankclip blackness colorbars(?:hd)? compare dumpfiltergraph setgraphanalysis echo histogram info messageclip preroll showfiveversions show(?:framenumber|smpte|time) stack(?:horizontal|vertical) tone version' - } - }; - - var types = toAlternation([wordLists.types]); - var keywords = toAlternation([wordLists.keywords]); - var predefined = toAlternation([wordLists.predefined]); - var constants = toAlternation([wordLists.constants]); + var types = /clip|int|float|string|bool|val/.source + var keywords = /function|global|return|try|catch|if|else|while|for|__END__/.source // includes avs+ native gscript constructs + var predefined = /DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS/.source + var constants = /MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)/.source + var internals = [ + // bools + /is(?:bool|clip|float|int|string)|defined|(?:var|(?:internal)?function)?exists?/.source, + // control + /apply|assert|default|eval|import|select|nop|undefined/.source, + // global + /set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment)|opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))/.source, + // conv + /hex(?:value)?|value/.source, + // numeric + /max|min|muldiv|floor|ceil|round|fmod|pi|exp|log(?:10)?|pow|sqrt|abs|sign|frac|rand|spline|continued(?:numerator|denominator)?/.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(?:luma|chroma[uv]|[bgr])|(?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)?|[yuvrgb]plane(?:median|min|max|minmaxdifference)/.source, + // script + /script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?)|setlogparams|logmsg|getprocessinfo/.source, + // string + /[lu]case|str(?:toutf8|fromutf8|len|cmpi?)|(?:rev|left|right|mid|find|replace|fill)str|format|trim(?:left|right|all)|chr|ord|time/.source, + // version + /version(?:number|string)|isversionorgreater/.source, + // helper + /buildpixeltype|colorspacenametopixeltype/.source, + // avsplus + /setfiltermtmode|prefetch|addautoloaddir|on(?:cpu|cuda)/.source + ].join('|') var properties = [ // content /has(?:audio|video)/.source, @@ -81,25 +56,50 @@ /pixeltype|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|hasalpha|componentsize|numcomponents|bitspercomponent/.source, // audio /audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits)|isaudio(?:float|int)/.source - ].join('|'); - var intfuncs = toAlternation(Object.values(wordLists.internals)); - var intfilters = toAlternation(Object.values(wordLists.filters)); - var internals = intfuncs + '|' + properties + '|' + intfilters; + ].join('|') + var filters = [ + // source + /avi(?:file)?source|opendmlsource|directshowsource|image(?:reader|source|sourceanim)|segmented(?:avisource|directshowsource)|wavsource/.source, + // color + /coloryuv|convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2)|convertbacktoyuy2|fixluminance|gr[ae]yscale|invert|levels|limiter|mergea?rgb|merge(?:luma|chroma)|rgbadjust|show(?:red|green|blue|alpha)|swapuv|tweak|[uv]toy8?|ytouv/.source, + // overlay + /(?:colorkey|reset)mask|mask(?:hs)?|layer|merge|overlay|subtract/.source, + // geometry + /addborders|crop(?:bottom)?|flip(?:horizontal|vertical)|letterbox|(?:horizontal|vertical)?reduceby2|(?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize|skewrows|turn(?:left|right|180)/.source, + // pixel + /blur|sharpen|generalconvolution|(?:spatial|temporal)soften|fixbrokenchromaupsampling/.source, + // timeline + /trim|(?:un)?alignedsplice|(?:assume|assumescaled|change|convert)FPS|(?:delete|duplicate)frame|dissolve|fade(?:in|out|io)[02]?|freezeframe|interleave|loop|reverse|select(?:even|odd|(?:range)?every)/.source, + // interlace + /assume(?:frame|field)based|assume[bt]ff|bob|complementparity|doubleweave|peculiarblend|pulldown|separate(?:columns|rows|fields)|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|supereq|ssrc|timestretch/.source, + // conditional + /conditional(?:filter|select|reader)|frameevaluate|scriptclip|writefile(?:if|start|end)?|animate|applyrange|tcp(?:server|source)/.source, + // export + /imagewriter/.source, + // debug + /subtitle|blankclip|blackness|colorbars(?:hd)?|compare|dumpfiltergraph|setgraphanalysis|echo|histogram|info|messageclip|preroll|showfiveversions|show(?:framenumber|smpte|time)|stack(?:horizontal|vertical)|tone|version/.source + ].join('|') - Prism.languages.avisynth = { + var internals = [internals, properties, filters].join('|') + Prism.languages.avisynth = { 'comment': [ - { // Matches [* *] nestable block comments, but can not handle nested comments correctly (recursion) + { + // Matches [* *] nestable block comments, but can not handle nested comments correctly (recursion) pattern: /(^|[^\\])\[\*[\s\S]*?(?:\*\]|$)/, lookbehind: true, greedy: true }, - { // Matches /* */ block comments + { + // Matches /* */ block comments pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, lookbehind: true, greedy: true }, - { // Matches # comments + { + // Matches # comments pattern: /(^|[^\\$])#.*/, lookbehind: true, greedy: true @@ -117,11 +117,13 @@ }, 'string': [ - { // triple double-quoted + { + // triple double-quoted pattern: /"""[\s\S]*?"""/i, greedy: true, }, - { // single double-quoted + { + // single double-quoted pattern: /"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/, greedy: true, inside: { @@ -138,18 +140,20 @@ 'boolean': /\b(?:true|false|yes|no)\b/i, 'keyword': { - pattern: re(/((?:^|[\\{])\s*)(?:<<0>>)(?=\s+)/.source, [keywords], 'im'), + pattern: re(/((?:^|[\\{])\s*)(?:<<0>>)(?=\s)/.source, [keywords], 'im'), lookbehind: true }, 'constant': re(/\b<<0>>\b/.source, [constants]), - 'builtin': [ - { // AviSynth's internal clip properties. + 'builtin': [ + { + // AviSynth's internal clip properties. pattern: re(/(\b\.)(?:<<0>>)\b(?=[^\.])/.source, [properties], 'i'), lookbehind: true }, - { // AviSynth's internal functions and filters, including properties used as functions. + { + // AviSynth's internal functions and filters, including properties used as functions. pattern: re(/\b(?:<<0>>)(?=\s*\()/.source, [internals], 'i') } ], @@ -158,7 +162,8 @@ 'function': { pattern: /\b[a-z_]\w*(?=\s*\()/i, inside: { - 'keyword': { // type casts + 'keyword': { + // type casts pattern: re(/\b(?:<<0>>)\b/.source, [types], 'i') } } @@ -176,7 +181,7 @@ 'number': /\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i, 'punctuation': /[{};(),.]/ - } + }; }(Prism)); Prism.languages.avs = Prism.languages.avisynth \ No newline at end of file diff --git a/components/prism-avisynth.min.js b/components/prism-avisynth.min.js index 9cd5723514..e29dacd679 100644 --- a/components/prism-avisynth.min.js +++ b/components/prism-avisynth.min.js @@ -1 +1 @@ -!function(e){function r(e){return e.reduce(function(e,r){return a(e,r.trim().replace(/ /g,"|"))},"")}function a(e,r){return e+(""==e?"":"|")+r}function t(e,r,a){return RegExp(function(e,a){return e.replace(/<<(\d+)>>/g,function(e,r){return a[+r]})}(e,r),a||"")}var o="function global return try catch if else while for __END__",i="DEFAULT_MT_MODE (?:SCRIPT|MAINSCRIPT|PROGRAM)DIR (?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS",n="MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)",l={bools:"is(?:bool|clip|float|int|string) defined (?:var|(?:internal)?function)?exists?",control:"apply assert default eval import select nop undefined",global:"set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment) opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))",conv:"hex(?:value)? value",numeric:"max min muldiv floor ceil round fmod pi exp log(?:10)? pow sqrt abs sign frac rand spline continued(?:numerator|denominator)?",trig:"a?sinh? a?cosh? a?tan[2h]?",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?))",runtime:"average(?:luma|chroma[uv]|[bgr]) (?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)? [yuvrgb]plane(?:median|min|max|minmaxdifference)",script:"script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?) setlogparams logmsg getprocessinfo",string:"[lu]case str(?:toutf8|fromutf8|len|cmpi?) (?:rev|left|right|mid|find|replace|fill)str format trim(?:left|right|all) chr ord time",version:"version(?:number|string) isversionorgreater",helper:"buildpixeltype colorspacenametopixeltype",avsplus:"setfiltermtmode prefetch addautoloaddir on(?:cpu|cuda)"},s={content:"has(?:audio|video)",resolution:"width height",framerate:"frame(?:count|rate) framerate(?:numerator|denominator)",interlacing:"is(?:field|frame)based getparity",colorformat:"pixeltype is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb) hasalpha componentsize numcomponents bitspercomponent",audio:"audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits) isaudio(?:float|int)"},c={source:"avi(?:file)?source opendmlsource directshowsource image(?:reader|source|sourceanim) segmented(?:avisource|directshowsource) wavsource",color:"coloryuv convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2) convertbacktoyuy2 fixluminance gr[ae]yscale invert levels limiter mergea?rgb merge(?:luma|chroma) rgbadjust show(?:red|green|blue|alpha) swapuv tweak [uv]toy8? ytouv",overlay:"(?:colorkey|reset)mask mask(?:hs)? layer merge overlay subtract",geometry:"addborders crop(?:bottom)? flip(?:horizontal|vertical) letterbox (?:horizontal|vertical)?reduceby2 (?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize skewrows turn(?:left|right|180)",pixel:"blur sharpen generalconvolution (?:spatial|temporal)soften fixbrokenchromaupsampling",timeline:"trim (?:un)?alignedsplice (?:assume|assumescaled|change|convert)FPS (?:delete|duplicate)frame dissolve fade(?:in|out|io)[02]? freezeframe interleave loop reverse select(?:even|odd|(?:range)?every)",interlace:"assume(?:frame|field)based assume[bt]ff bob complementparity doubleweave peculiarblend pulldown separate(?:columns|rows|fields) swapfields weave(?:columns|rows)?",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 supereq ssrc timestretch",conditional:"conditional(?:filter|select|reader) frameevaluate scriptclip writefile(?:if|start|end)? animate applyrange tcp(?:server|source)",export:"imagewriter",debug:"subtitle blankclip blackness colorbars(?:hd)? compare dumpfiltergraph setgraphanalysis echo histogram info messageclip preroll showfiveversions show(?:framenumber|smpte|time) stack(?:horizontal|vertical) tone version"},u=r(["clip int float string bool val"]),m=r([o]),d=r([i]),p=r([n]),b=r(Object.values(s)),f=a(r(Object.values(l)),a(b,r(Object.values(c))));e.languages.avisynth={comment:[{pattern:/(^|[^\\])\[\*[\s\S]*?(?:\*\]|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],argument:{pattern:t('\\b(?:<<0>>)\\s+("?)\\w+\\1',[u],"i"),inside:{keyword:{pattern:t("\\b(?:<<0>>)\\b",[u],"i")}}},string:[{pattern:/"""[\s\S]*?"""/i,greedy:!0},{pattern:/"(?:\\(?:\r\n|[\s\S])|(?!")[^\\\r\n])*"/,greedy:!0,inside:{constant:{pattern:t("<<0>>",[d])}}}],variable:/\b(last)\b/i,boolean:/\b(?:true|false|yes|no)\b/i,keyword:{pattern:t("((?:^|[\\\\{])\\s*)(?:<<0>>)(?=\\s+)",[m],"im"),lookbehind:!0},constant:t("\\b<<0>>\\b",[p]),builtin:[{pattern:t("(\\b\\.)(?:<<0>>)\\b(?=[^\\.])",[b],"i"),lookbehind:!0},{pattern:t("\\b(?:<<0>>)(?=\\s*\\()",[f],"i")}],function:{pattern:/\b[a-z_]\w*(?=\s*\()/i,inside:{keyword:{pattern:t("\\b(?:<<0>>)\\b",[u],"i")}}},"line-continuation":{pattern:/(^\s*)\\|\\(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},operator:/\+\+?|!=?|<=?|>=?|==?|&&|\|\||\?|\*|\/|%|:/,number:/\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i,punctuation:/[{};(),.]/}}(Prism),Prism.languages.avs=Prism.languages.avisynth; \ No newline at end of file +!function(e){function a(e,a,r){return RegExp(function(e,r){return e.replace(/<<(\d+)>>/g,function(e,a){return r[+a]})}(e,a),r||"")}var r="clip|int|float|string|bool|val",t=["is(?:bool|clip|float|int|string)|defined|(?:var|(?:internal)?function)?exists?","apply|assert|default|eval|import|select|nop|undefined","set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment)|opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))","hex(?:value)?|value","max|min|muldiv|floor|ceil|round|fmod|pi|exp|log(?:10)?|pow|sqrt|abs|sign|frac|rand|spline|continued(?:numerator|denominator)?","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(?:luma|chroma[uv]|[bgr])|(?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)?|[yuvrgb]plane(?:median|min|max|minmaxdifference)","script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?)|setlogparams|logmsg|getprocessinfo","[lu]case|str(?:toutf8|fromutf8|len|cmpi?)|(?:rev|left|right|mid|find|replace|fill)str|format|trim(?:left|right|all)|chr|ord|time","version(?:number|string)|isversionorgreater","buildpixeltype|colorspacenametopixeltype","setfiltermtmode|prefetch|addautoloaddir|on(?:cpu|cuda)"].join("|"),i=["has(?:audio|video)","width|height","frame(?:count|rate)|framerate(?:numerator|denominator)","is(?:field|frame)based|getparity","pixeltype|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|hasalpha|componentsize|numcomponents|bitspercomponent","audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits)|isaudio(?:float|int)"].join("|");t=[t,i,["avi(?:file)?source|opendmlsource|directshowsource|image(?:reader|source|sourceanim)|segmented(?:avisource|directshowsource)|wavsource","coloryuv|convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2)|convertbacktoyuy2|fixluminance|gr[ae]yscale|invert|levels|limiter|mergea?rgb|merge(?:luma|chroma)|rgbadjust|show(?:red|green|blue|alpha)|swapuv|tweak|[uv]toy8?|ytouv","(?:colorkey|reset)mask|mask(?:hs)?|layer|merge|overlay|subtract","addborders|crop(?:bottom)?|flip(?:horizontal|vertical)|letterbox|(?:horizontal|vertical)?reduceby2|(?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize|skewrows|turn(?:left|right|180)","blur|sharpen|generalconvolution|(?:spatial|temporal)soften|fixbrokenchromaupsampling","trim|(?:un)?alignedsplice|(?:assume|assumescaled|change|convert)FPS|(?:delete|duplicate)frame|dissolve|fade(?:in|out|io)[02]?|freezeframe|interleave|loop|reverse|select(?:even|odd|(?:range)?every)","assume(?:frame|field)based|assume[bt]ff|bob|complementparity|doubleweave|peculiarblend|pulldown|separate(?:columns|rows|fields)|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|supereq|ssrc|timestretch","conditional(?:filter|select|reader)|frameevaluate|scriptclip|writefile(?:if|start|end)?|animate|applyrange|tcp(?:server|source)","imagewriter","subtitle|blankclip|blackness|colorbars(?:hd)?|compare|dumpfiltergraph|setgraphanalysis|echo|histogram|info|messageclip|preroll|showfiveversions|show(?:framenumber|smpte|time)|stack(?:horizontal|vertical)|tone|version"].join("|")].join("|");e.languages.avisynth={comment:[{pattern:/(^|[^\\])\[\*[\s\S]*?(?:\*\]|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],argument:{pattern:a('\\b(?:<<0>>)\\s+("?)\\w+\\1',[r],"i"),inside:{keyword:{pattern:a("\\b(?:<<0>>)\\b",[r],"i")}}},string:[{pattern:/"""[\s\S]*?"""/i,greedy:!0},{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0,inside:{constant:{pattern:a("<<0>>",["DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS"])}}}],variable:/\b(?:last)\b/i,boolean:/\b(?:true|false|yes|no)\b/i,keyword:{pattern:a("((?:^|[\\\\{])\\s*)(?:<<0>>)(?=\\s)",["function|global|return|try|catch|if|else|while|for|__END__"],"im"),lookbehind:!0},constant:a("\\b<<0>>\\b",["MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)"]),builtin:[{pattern:a("(\\b\\.)(?:<<0>>)\\b(?=[^\\.])",[i],"i"),lookbehind:!0},{pattern:a("\\b(?:<<0>>)(?=\\s*\\()",[t],"i")}],function:{pattern:/\b[a-z_]\w*(?=\s*\()/i,inside:{keyword:{pattern:a("\\b(?:<<0>>)\\b",[r],"i")}}},"line-continuation":{pattern:/(^\s*)\\|\\(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},operator:/\+\+?|!=?|<=?|>=?|==?|&&|\|\||\?|\*|\/|%|:/,number:/\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i,punctuation:/[{};(),.]/}}(Prism),Prism.languages.avs=Prism.languages.avisynth; \ No newline at end of file From a17f391dde3c91733eb04c4f764e613791b305d1 Mon Sep 17 00:00:00 2001 From: Zinfidel Date: Sun, 12 Sep 2021 16:56:52 -0700 Subject: [PATCH 05/12] Change builtin to builtin-function with function alias. Appease the linter even harder. --- components/prism-avisynth.js | 27 +- components/prism-avisynth.min.js | 2 +- .../avisynth/clipproperties_feature.test | 196 ++++----- .../avisynth/intenalfuncs_feature.test | 354 ++++++++-------- .../avisynth/internalfilters_feature.test | 392 +++++++++--------- 5 files changed, 486 insertions(+), 485 deletions(-) diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js index 7194829a73..11fd295517 100644 --- a/components/prism-avisynth.js +++ b/components/prism-avisynth.js @@ -11,10 +11,10 @@ return RegExp(replace(pattern, replacements), flags || ''); } - var types = /clip|int|float|string|bool|val/.source - var keywords = /function|global|return|try|catch|if|else|while|for|__END__/.source // includes avs+ native gscript constructs - var predefined = /DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS/.source - var constants = /MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)/.source + var types = /clip|int|float|string|bool|val/.source; + var keywords = /function|global|return|try|catch|if|else|while|for|__END__/.source; // includes avs+ native gscript constructs + var predefined = /DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS/.source; + var constants = /MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)/.source; var internals = [ // bools /is(?:bool|clip|float|int|string)|defined|(?:var|(?:internal)?function)?exists?/.source, @@ -42,7 +42,7 @@ /buildpixeltype|colorspacenametopixeltype/.source, // avsplus /setfiltermtmode|prefetch|addautoloaddir|on(?:cpu|cuda)/.source - ].join('|') + ].join('|'); var properties = [ // content /has(?:audio|video)/.source, @@ -56,7 +56,7 @@ /pixeltype|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|hasalpha|componentsize|numcomponents|bitspercomponent/.source, // audio /audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits)|isaudio(?:float|int)/.source - ].join('|') + ].join('|'); var filters = [ // source /avi(?:file)?source|opendmlsource|directshowsource|image(?:reader|source|sourceanim)|segmented(?:avisource|directshowsource)|wavsource/.source, @@ -80,9 +80,8 @@ /imagewriter/.source, // debug /subtitle|blankclip|blackness|colorbars(?:hd)?|compare|dumpfiltergraph|setgraphanalysis|echo|histogram|info|messageclip|preroll|showfiveversions|show(?:framenumber|smpte|time)|stack(?:horizontal|vertical)|tone|version/.source - ].join('|') - - var internals = [internals, properties, filters].join('|') + ].join('|'); + var allinternals = [internals, properties, filters].join('|'); Prism.languages.avisynth = { 'comment': [ @@ -146,15 +145,17 @@ 'constant': re(/\b<<0>>\b/.source, [constants]), - 'builtin': [ + 'builtin-function': [ { // AviSynth's internal clip properties. pattern: re(/(\b\.)(?:<<0>>)\b(?=[^\.])/.source, [properties], 'i'), - lookbehind: true + lookbehind: true, + alias: 'function' }, { // AviSynth's internal functions and filters, including properties used as functions. - pattern: re(/\b(?:<<0>>)(?=\s*\()/.source, [internals], 'i') + pattern: re(/\b(?:<<0>>)(?=\s*\()/.source, [allinternals], 'i'), + alias: 'function' } ], @@ -184,4 +185,4 @@ }; }(Prism)); -Prism.languages.avs = Prism.languages.avisynth \ No newline at end of file +Prism.languages.avs = Prism.languages.avisynth; diff --git a/components/prism-avisynth.min.js b/components/prism-avisynth.min.js index e29dacd679..d461b4a4bd 100644 --- a/components/prism-avisynth.min.js +++ b/components/prism-avisynth.min.js @@ -1 +1 @@ -!function(e){function a(e,a,r){return RegExp(function(e,r){return e.replace(/<<(\d+)>>/g,function(e,a){return r[+a]})}(e,a),r||"")}var r="clip|int|float|string|bool|val",t=["is(?:bool|clip|float|int|string)|defined|(?:var|(?:internal)?function)?exists?","apply|assert|default|eval|import|select|nop|undefined","set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment)|opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))","hex(?:value)?|value","max|min|muldiv|floor|ceil|round|fmod|pi|exp|log(?:10)?|pow|sqrt|abs|sign|frac|rand|spline|continued(?:numerator|denominator)?","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(?:luma|chroma[uv]|[bgr])|(?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)?|[yuvrgb]plane(?:median|min|max|minmaxdifference)","script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?)|setlogparams|logmsg|getprocessinfo","[lu]case|str(?:toutf8|fromutf8|len|cmpi?)|(?:rev|left|right|mid|find|replace|fill)str|format|trim(?:left|right|all)|chr|ord|time","version(?:number|string)|isversionorgreater","buildpixeltype|colorspacenametopixeltype","setfiltermtmode|prefetch|addautoloaddir|on(?:cpu|cuda)"].join("|"),i=["has(?:audio|video)","width|height","frame(?:count|rate)|framerate(?:numerator|denominator)","is(?:field|frame)based|getparity","pixeltype|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|hasalpha|componentsize|numcomponents|bitspercomponent","audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits)|isaudio(?:float|int)"].join("|");t=[t,i,["avi(?:file)?source|opendmlsource|directshowsource|image(?:reader|source|sourceanim)|segmented(?:avisource|directshowsource)|wavsource","coloryuv|convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2)|convertbacktoyuy2|fixluminance|gr[ae]yscale|invert|levels|limiter|mergea?rgb|merge(?:luma|chroma)|rgbadjust|show(?:red|green|blue|alpha)|swapuv|tweak|[uv]toy8?|ytouv","(?:colorkey|reset)mask|mask(?:hs)?|layer|merge|overlay|subtract","addborders|crop(?:bottom)?|flip(?:horizontal|vertical)|letterbox|(?:horizontal|vertical)?reduceby2|(?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize|skewrows|turn(?:left|right|180)","blur|sharpen|generalconvolution|(?:spatial|temporal)soften|fixbrokenchromaupsampling","trim|(?:un)?alignedsplice|(?:assume|assumescaled|change|convert)FPS|(?:delete|duplicate)frame|dissolve|fade(?:in|out|io)[02]?|freezeframe|interleave|loop|reverse|select(?:even|odd|(?:range)?every)","assume(?:frame|field)based|assume[bt]ff|bob|complementparity|doubleweave|peculiarblend|pulldown|separate(?:columns|rows|fields)|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|supereq|ssrc|timestretch","conditional(?:filter|select|reader)|frameevaluate|scriptclip|writefile(?:if|start|end)?|animate|applyrange|tcp(?:server|source)","imagewriter","subtitle|blankclip|blackness|colorbars(?:hd)?|compare|dumpfiltergraph|setgraphanalysis|echo|histogram|info|messageclip|preroll|showfiveversions|show(?:framenumber|smpte|time)|stack(?:horizontal|vertical)|tone|version"].join("|")].join("|");e.languages.avisynth={comment:[{pattern:/(^|[^\\])\[\*[\s\S]*?(?:\*\]|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],argument:{pattern:a('\\b(?:<<0>>)\\s+("?)\\w+\\1',[r],"i"),inside:{keyword:{pattern:a("\\b(?:<<0>>)\\b",[r],"i")}}},string:[{pattern:/"""[\s\S]*?"""/i,greedy:!0},{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0,inside:{constant:{pattern:a("<<0>>",["DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS"])}}}],variable:/\b(?:last)\b/i,boolean:/\b(?:true|false|yes|no)\b/i,keyword:{pattern:a("((?:^|[\\\\{])\\s*)(?:<<0>>)(?=\\s)",["function|global|return|try|catch|if|else|while|for|__END__"],"im"),lookbehind:!0},constant:a("\\b<<0>>\\b",["MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)"]),builtin:[{pattern:a("(\\b\\.)(?:<<0>>)\\b(?=[^\\.])",[i],"i"),lookbehind:!0},{pattern:a("\\b(?:<<0>>)(?=\\s*\\()",[t],"i")}],function:{pattern:/\b[a-z_]\w*(?=\s*\()/i,inside:{keyword:{pattern:a("\\b(?:<<0>>)\\b",[r],"i")}}},"line-continuation":{pattern:/(^\s*)\\|\\(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},operator:/\+\+?|!=?|<=?|>=?|==?|&&|\|\||\?|\*|\/|%|:/,number:/\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i,punctuation:/[{};(),.]/}}(Prism),Prism.languages.avs=Prism.languages.avisynth; \ No newline at end of file +!function(e){function a(e,a,r){return RegExp(function(e,r){return e.replace(/<<(\d+)>>/g,function(e,a){return r[+a]})}(e,a),r||"")}var r="clip|int|float|string|bool|val",t=["is(?:bool|clip|float|int|string)|defined|(?:var|(?:internal)?function)?exists?","apply|assert|default|eval|import|select|nop|undefined","set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment)|opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))","hex(?:value)?|value","max|min|muldiv|floor|ceil|round|fmod|pi|exp|log(?:10)?|pow|sqrt|abs|sign|frac|rand|spline|continued(?:numerator|denominator)?","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(?:luma|chroma[uv]|[bgr])|(?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)?|[yuvrgb]plane(?:median|min|max|minmaxdifference)","script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?)|setlogparams|logmsg|getprocessinfo","[lu]case|str(?:toutf8|fromutf8|len|cmpi?)|(?:rev|left|right|mid|find|replace|fill)str|format|trim(?:left|right|all)|chr|ord|time","version(?:number|string)|isversionorgreater","buildpixeltype|colorspacenametopixeltype","setfiltermtmode|prefetch|addautoloaddir|on(?:cpu|cuda)"].join("|"),i=["has(?:audio|video)","width|height","frame(?:count|rate)|framerate(?:numerator|denominator)","is(?:field|frame)based|getparity","pixeltype|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|hasalpha|componentsize|numcomponents|bitspercomponent","audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits)|isaudio(?:float|int)"].join("|"),n=[t,i,["avi(?:file)?source|opendmlsource|directshowsource|image(?:reader|source|sourceanim)|segmented(?:avisource|directshowsource)|wavsource","coloryuv|convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2)|convertbacktoyuy2|fixluminance|gr[ae]yscale|invert|levels|limiter|mergea?rgb|merge(?:luma|chroma)|rgbadjust|show(?:red|green|blue|alpha)|swapuv|tweak|[uv]toy8?|ytouv","(?:colorkey|reset)mask|mask(?:hs)?|layer|merge|overlay|subtract","addborders|crop(?:bottom)?|flip(?:horizontal|vertical)|letterbox|(?:horizontal|vertical)?reduceby2|(?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize|skewrows|turn(?:left|right|180)","blur|sharpen|generalconvolution|(?:spatial|temporal)soften|fixbrokenchromaupsampling","trim|(?:un)?alignedsplice|(?:assume|assumescaled|change|convert)FPS|(?:delete|duplicate)frame|dissolve|fade(?:in|out|io)[02]?|freezeframe|interleave|loop|reverse|select(?:even|odd|(?:range)?every)","assume(?:frame|field)based|assume[bt]ff|bob|complementparity|doubleweave|peculiarblend|pulldown|separate(?:columns|rows|fields)|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|supereq|ssrc|timestretch","conditional(?:filter|select|reader)|frameevaluate|scriptclip|writefile(?:if|start|end)?|animate|applyrange|tcp(?:server|source)","imagewriter","subtitle|blankclip|blackness|colorbars(?:hd)?|compare|dumpfiltergraph|setgraphanalysis|echo|histogram|info|messageclip|preroll|showfiveversions|show(?:framenumber|smpte|time)|stack(?:horizontal|vertical)|tone|version"].join("|")].join("|");e.languages.avisynth={comment:[{pattern:/(^|[^\\])\[\*[\s\S]*?(?:\*\]|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],argument:{pattern:a('\\b(?:<<0>>)\\s+("?)\\w+\\1',[r],"i"),inside:{keyword:{pattern:a("\\b(?:<<0>>)\\b",[r],"i")}}},string:[{pattern:/"""[\s\S]*?"""/i,greedy:!0},{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0,inside:{constant:{pattern:a("<<0>>",["DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS"])}}}],variable:/\b(?:last)\b/i,boolean:/\b(?:true|false|yes|no)\b/i,keyword:{pattern:a("((?:^|[\\\\{])\\s*)(?:<<0>>)(?=\\s)",["function|global|return|try|catch|if|else|while|for|__END__"],"im"),lookbehind:!0},constant:a("\\b<<0>>\\b",["MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)"]),"builtin-function":[{pattern:a("(\\b\\.)(?:<<0>>)\\b(?=[^\\.])",[i],"i"),lookbehind:!0,alias:"function"},{pattern:a("\\b(?:<<0>>)(?=\\s*\\()",[n],"i"),alias:"function"}],function:{pattern:/\b[a-z_]\w*(?=\s*\()/i,inside:{keyword:{pattern:a("\\b(?:<<0>>)\\b",[r],"i")}}},"line-continuation":{pattern:/(^\s*)\\|\\(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},operator:/\+\+?|!=?|<=?|>=?|==?|&&|\|\||\?|\*|\/|%|:/,number:/\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i,punctuation:/[{};(),.]/}}(Prism),Prism.languages.avs=Prism.languages.avisynth; \ No newline at end of file diff --git a/tests/languages/avisynth/clipproperties_feature.test b/tests/languages/avisynth/clipproperties_feature.test index 3e04c300ce..2064210d4d 100644 --- a/tests/languages/avisynth/clipproperties_feature.test +++ b/tests/languages/avisynth/clipproperties_feature.test @@ -57,296 +57,296 @@ c.isaudioint isaudioint( [ "c", ["punctuation", "."], - ["builtin", "hasaudio"], - ["builtin", "hasaudio"], + ["builtin-function", "hasaudio"], + ["builtin-function", "hasaudio"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "hasvideo"], - ["builtin", "hasvideo"], + ["builtin-function", "hasvideo"], + ["builtin-function", "hasvideo"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "width"], - ["builtin", "width"], + ["builtin-function", "width"], + ["builtin-function", "width"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "height"], - ["builtin", "height"], + ["builtin-function", "height"], + ["builtin-function", "height"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "framecount"], - ["builtin", "framecount"], + ["builtin-function", "framecount"], + ["builtin-function", "framecount"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "framerate"], - ["builtin", "framerate"], + ["builtin-function", "framerate"], + ["builtin-function", "framerate"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "frameratenumerator"], - ["builtin", "frameratenumerator"], + ["builtin-function", "frameratenumerator"], + ["builtin-function", "frameratenumerator"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "frameratedenominator"], - ["builtin", "frameratedenominator"], + ["builtin-function", "frameratedenominator"], + ["builtin-function", "frameratedenominator"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isfieldbased"], - ["builtin", "isfieldbased"], + ["builtin-function", "isfieldbased"], + ["builtin-function", "isfieldbased"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isframebased"], - ["builtin", "isframebased"], + ["builtin-function", "isframebased"], + ["builtin-function", "isframebased"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "getparity"], - ["builtin", "getparity"], + ["builtin-function", "getparity"], + ["builtin-function", "getparity"], ["punctuation", "("], "\r\n\r\nc", ["punctuation", "."], - ["builtin", "pixeltype"], - ["builtin", "pixeltype"], + ["builtin-function", "pixeltype"], + ["builtin-function", "pixeltype"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isplanar"], - ["builtin", "isplanar"], + ["builtin-function", "isplanar"], + ["builtin-function", "isplanar"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isinterleaved"], - ["builtin", "isinterleaved"], + ["builtin-function", "isinterleaved"], + ["builtin-function", "isinterleaved"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isrgb"], - ["builtin", "isrgb"], + ["builtin-function", "isrgb"], + ["builtin-function", "isrgb"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isrgb24"], - ["builtin", "isrgb24"], + ["builtin-function", "isrgb24"], + ["builtin-function", "isrgb24"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isrgb32"], - ["builtin", "isrgb32"], + ["builtin-function", "isrgb32"], + ["builtin-function", "isrgb32"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isyuv"], - ["builtin", "isyuv"], + ["builtin-function", "isyuv"], + ["builtin-function", "isyuv"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isyuy2"], - ["builtin", "isyuy2"], + ["builtin-function", "isyuy2"], + ["builtin-function", "isyuy2"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isy8"], - ["builtin", "isy8"], + ["builtin-function", "isy8"], + ["builtin-function", "isy8"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isyv12"], - ["builtin", "isyv12"], + ["builtin-function", "isyv12"], + ["builtin-function", "isyv12"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isyv16"], - ["builtin", "isyv16"], + ["builtin-function", "isyv16"], + ["builtin-function", "isyv16"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isyv24"], - ["builtin", "isyv24"], + ["builtin-function", "isyv24"], + ["builtin-function", "isyv24"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isyv411"], - ["builtin", "isyv411"], + ["builtin-function", "isyv411"], + ["builtin-function", "isyv411"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "is420"], - ["builtin", "is420"], + ["builtin-function", "is420"], + ["builtin-function", "is420"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "is422"], - ["builtin", "is422"], + ["builtin-function", "is422"], + ["builtin-function", "is422"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "is444"], - ["builtin", "is444"], + ["builtin-function", "is444"], + ["builtin-function", "is444"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isy"], - ["builtin", "isy"], + ["builtin-function", "isy"], + ["builtin-function", "isy"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isyuva"], - ["builtin", "isyuva"], + ["builtin-function", "isyuva"], + ["builtin-function", "isyuva"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isrgb48"], - ["builtin", "isrgb48"], + ["builtin-function", "isrgb48"], + ["builtin-function", "isrgb48"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isrgb64"], - ["builtin", "isrgb64"], + ["builtin-function", "isrgb64"], + ["builtin-function", "isrgb64"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "ispackedrgb"], - ["builtin", "ispackedrgb"], + ["builtin-function", "ispackedrgb"], + ["builtin-function", "ispackedrgb"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isplanarrgb"], - ["builtin", "isplanarrgb"], + ["builtin-function", "isplanarrgb"], + ["builtin-function", "isplanarrgb"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isplanarrgba"], - ["builtin", "isplanarrgba"], + ["builtin-function", "isplanarrgba"], + ["builtin-function", "isplanarrgba"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "hasalpha"], - ["builtin", "hasalpha"], + ["builtin-function", "hasalpha"], + ["builtin-function", "hasalpha"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "componentsize"], - ["builtin", "componentsize"], + ["builtin-function", "componentsize"], + ["builtin-function", "componentsize"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "numcomponents"], - ["builtin", "numcomponents"], + ["builtin-function", "numcomponents"], + ["builtin-function", "numcomponents"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "bitspercomponent"], - ["builtin", "bitspercomponent"], + ["builtin-function", "bitspercomponent"], + ["builtin-function", "bitspercomponent"], ["punctuation", "("], "\r\n\r\nc", ["punctuation", "."], - ["builtin", "audiorate"], - ["builtin", "audiorate"], + ["builtin-function", "audiorate"], + ["builtin-function", "audiorate"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "audioduration"], - ["builtin", "audioduration"], + ["builtin-function", "audioduration"], + ["builtin-function", "audioduration"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "audiolength"], - ["builtin", "audiolength"], + ["builtin-function", "audiolength"], + ["builtin-function", "audiolength"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "audiolengthf"], - ["builtin", "audiolengthf"], + ["builtin-function", "audiolengthf"], + ["builtin-function", "audiolengthf"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "audiolengths"], - ["builtin", "audiolengths"], + ["builtin-function", "audiolengths"], + ["builtin-function", "audiolengths"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "audiolengthlo"], - ["builtin", "audiolengthlo"], + ["builtin-function", "audiolengthlo"], + ["builtin-function", "audiolengthlo"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "audiolengthhi"], - ["builtin", "audiolengthhi"], + ["builtin-function", "audiolengthhi"], + ["builtin-function", "audiolengthhi"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "audiochannels"], - ["builtin", "audiochannels"], + ["builtin-function", "audiochannels"], + ["builtin-function", "audiochannels"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "audiobits"], - ["builtin", "audiobits"], + ["builtin-function", "audiobits"], + ["builtin-function", "audiobits"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isaudiofloat"], - ["builtin", "isaudiofloat"], + ["builtin-function", "isaudiofloat"], + ["builtin-function", "isaudiofloat"], ["punctuation", "("], "\r\nc", ["punctuation", "."], - ["builtin", "isaudioint"], - ["builtin", "isaudioint"], + ["builtin-function", "isaudioint"], + ["builtin-function", "isaudioint"], ["punctuation", "("], ["punctuation", "."], "audiobits" diff --git a/tests/languages/avisynth/intenalfuncs_feature.test b/tests/languages/avisynth/intenalfuncs_feature.test index 6b7057d2b4..4fdf9b2f9a 100644 --- a/tests/languages/avisynth/intenalfuncs_feature.test +++ b/tests/languages/avisynth/intenalfuncs_feature.test @@ -194,194 +194,194 @@ kevincosner ---------------------------------------------------- [ - ["builtin", "isbool"], ["punctuation", "("], - ["builtin", "isclip"], ["punctuation", "("], - ["builtin", "isfloat"], ["punctuation", "("], - ["builtin", "isint"], ["punctuation", "("], - ["builtin", "isstring"], ["punctuation", "("], - ["builtin", "exist"], ["punctuation", "("], - ["builtin", "defined"], ["punctuation", "("], - ["builtin", "functionexists"], ["punctuation", "("], - ["builtin", "internalfunctionexists"], ["punctuation", "("], - ["builtin", "varexist"], ["punctuation", "("], + ["builtin-function", "isbool"], ["punctuation", "("], + ["builtin-function", "isclip"], ["punctuation", "("], + ["builtin-function", "isfloat"], ["punctuation", "("], + ["builtin-function", "isint"], ["punctuation", "("], + ["builtin-function", "isstring"], ["punctuation", "("], + ["builtin-function", "exist"], ["punctuation", "("], + ["builtin-function", "defined"], ["punctuation", "("], + ["builtin-function", "functionexists"], ["punctuation", "("], + ["builtin-function", "internalfunctionexists"], ["punctuation", "("], + ["builtin-function", "varexist"], ["punctuation", "("], - ["builtin", "apply"], ["punctuation", "("], - ["builtin", "eval"], ["punctuation", "("], - ["builtin", "import"], ["punctuation", "("], - ["builtin", "select"], ["punctuation", "("], - ["builtin", "default"], ["punctuation", "("], - ["builtin", "assert"], ["punctuation", "("], - ["builtin", "nop"], ["punctuation", "("], - ["builtin", "undefined"], ["punctuation", "("], + ["builtin-function", "apply"], ["punctuation", "("], + ["builtin-function", "eval"], ["punctuation", "("], + ["builtin-function", "import"], ["punctuation", "("], + ["builtin-function", "select"], ["punctuation", "("], + ["builtin-function", "default"], ["punctuation", "("], + ["builtin-function", "assert"], ["punctuation", "("], + ["builtin-function", "nop"], ["punctuation", "("], + ["builtin-function", "undefined"], ["punctuation", "("], - ["builtin", "setmemorymax"], ["punctuation", "("], - ["builtin", "setcachemode"], ["punctuation", "("], - ["builtin", "setmaxcpu"], ["punctuation", "("], - ["builtin", "setworkingdir"], ["punctuation", "("], - ["builtin", "setplanarlegacyalignment"], ["punctuation", "("], - ["builtin", "opt_allowfloataudio"], ["punctuation", "("], - ["builtin", "opt_usewaveextensible"], ["punctuation", "("], - ["builtin", "opt_dwchannelmask"], ["punctuation", "("], - ["builtin", "opt_avipadscanlines"], ["punctuation", "("], - ["builtin", "opt_vdubplanarhack"], ["punctuation", "("], - ["builtin", "opt_enable_v210"], ["punctuation", "("], - ["builtin", "opt_enable_y3_10_10"], ["punctuation", "("], - ["builtin", "opt_enable_y3_10_16"], ["punctuation", "("], - ["builtin", "opt_enable_b64a"], ["punctuation", "("], - ["builtin", "opt_enable_planartopackedrgb"], ["punctuation", "("], + ["builtin-function", "setmemorymax"], ["punctuation", "("], + ["builtin-function", "setcachemode"], ["punctuation", "("], + ["builtin-function", "setmaxcpu"], ["punctuation", "("], + ["builtin-function", "setworkingdir"], ["punctuation", "("], + ["builtin-function", "setplanarlegacyalignment"], ["punctuation", "("], + ["builtin-function", "opt_allowfloataudio"], ["punctuation", "("], + ["builtin-function", "opt_usewaveextensible"], ["punctuation", "("], + ["builtin-function", "opt_dwchannelmask"], ["punctuation", "("], + ["builtin-function", "opt_avipadscanlines"], ["punctuation", "("], + ["builtin-function", "opt_vdubplanarhack"], ["punctuation", "("], + ["builtin-function", "opt_enable_v210"], ["punctuation", "("], + ["builtin-function", "opt_enable_y3_10_10"], ["punctuation", "("], + ["builtin-function", "opt_enable_y3_10_16"], ["punctuation", "("], + ["builtin-function", "opt_enable_b64a"], ["punctuation", "("], + ["builtin-function", "opt_enable_planartopackedrgb"], ["punctuation", "("], - ["builtin", "value"], ["punctuation", "("], - ["builtin", "hexvalue"], ["punctuation", "("], - ["builtin", "hex"], ["punctuation", "("], + ["builtin-function", "value"], ["punctuation", "("], + ["builtin-function", "hexvalue"], ["punctuation", "("], + ["builtin-function", "hex"], ["punctuation", "("], - ["builtin", "max"], ["punctuation", "("], - ["builtin", "min"], ["punctuation", "("], - ["builtin", "muldiv"], ["punctuation", "("], - ["builtin", "floor"], ["punctuation", "("], - ["builtin", "ceil"], ["punctuation", "("], - ["builtin", "round"], ["punctuation", "("], - ["builtin", "fmod"], ["punctuation", "("], - ["builtin", "pi"], ["punctuation", "("], - ["builtin", "exp"], ["punctuation", "("], - ["builtin", "log"], ["punctuation", "("], - ["builtin", "log10"], ["punctuation", "("], - ["builtin", "pow"], ["punctuation", "("], - ["builtin", "sqrt"], ["punctuation", "("], - ["builtin", "abs"], ["punctuation", "("], - ["builtin", "sign"], ["punctuation", "("], - ["builtin", "frac"], ["punctuation", "("], - ["builtin", "rand"], ["punctuation", "("], - ["builtin", "spline"], ["punctuation", "("], - ["builtin", "continuednumerator"], ["punctuation", "("], - ["builtin", "continueddenominator"], ["punctuation", "("], + ["builtin-function", "max"], ["punctuation", "("], + ["builtin-function", "min"], ["punctuation", "("], + ["builtin-function", "muldiv"], ["punctuation", "("], + ["builtin-function", "floor"], ["punctuation", "("], + ["builtin-function", "ceil"], ["punctuation", "("], + ["builtin-function", "round"], ["punctuation", "("], + ["builtin-function", "fmod"], ["punctuation", "("], + ["builtin-function", "pi"], ["punctuation", "("], + ["builtin-function", "exp"], ["punctuation", "("], + ["builtin-function", "log"], ["punctuation", "("], + ["builtin-function", "log10"], ["punctuation", "("], + ["builtin-function", "pow"], ["punctuation", "("], + ["builtin-function", "sqrt"], ["punctuation", "("], + ["builtin-function", "abs"], ["punctuation", "("], + ["builtin-function", "sign"], ["punctuation", "("], + ["builtin-function", "frac"], ["punctuation", "("], + ["builtin-function", "rand"], ["punctuation", "("], + ["builtin-function", "spline"], ["punctuation", "("], + ["builtin-function", "continuednumerator"], ["punctuation", "("], + ["builtin-function", "continueddenominator"], ["punctuation", "("], - ["builtin", "sin"], ["punctuation", "("], - ["builtin", "cos"], ["punctuation", "("], - ["builtin", "tan"], ["punctuation", "("], - ["builtin", "asin"], ["punctuation", "("], - ["builtin", "acos"], ["punctuation", "("], - ["builtin", "atan"], ["punctuation", "("], - ["builtin", "atan2"], ["punctuation", "("], - ["builtin", "sinh"], ["punctuation", "("], - ["builtin", "cosh"], ["punctuation", "("], - ["builtin", "tanh"], ["punctuation", "("], + ["builtin-function", "sin"], ["punctuation", "("], + ["builtin-function", "cos"], ["punctuation", "("], + ["builtin-function", "tan"], ["punctuation", "("], + ["builtin-function", "asin"], ["punctuation", "("], + ["builtin-function", "acos"], ["punctuation", "("], + ["builtin-function", "atan"], ["punctuation", "("], + ["builtin-function", "atan2"], ["punctuation", "("], + ["builtin-function", "sinh"], ["punctuation", "("], + ["builtin-function", "cosh"], ["punctuation", "("], + ["builtin-function", "tanh"], ["punctuation", "("], - ["builtin", "bitand"], ["punctuation", "("], - ["builtin", "bitnot"], ["punctuation", "("], - ["builtin", "bitor"], ["punctuation", "("], - ["builtin", "bitxor"], ["punctuation", "("], - ["builtin", "bitlshift"], ["punctuation", "("], - ["builtin", "bitshl"], ["punctuation", "("], - ["builtin", "bitsal"], ["punctuation", "("], - ["builtin", "bitrshifta"], ["punctuation", "("], - ["builtin", "bitrshifts"], ["punctuation", "("], - ["builtin", "bitsar"], ["punctuation", "("], - ["builtin", "bitrshiftl"], ["punctuation", "("], - ["builtin", "bitrshiftu"], ["punctuation", "("], - ["builtin", "bitshr"], ["punctuation", "("], - ["builtin", "bitlrotate"], ["punctuation", "("], - ["builtin", "bitrol"], ["punctuation", "("], - ["builtin", "bitrrotatel"], ["punctuation", "("], - ["builtin", "bitror"], ["punctuation", "("], - ["builtin", "bittest"], ["punctuation", "("], - ["builtin", "bittst"], ["punctuation", "("], - ["builtin", "bitset"], ["punctuation", "("], - ["builtin", "bitsetcount"], ["punctuation", "("], - ["builtin", "bitclear"], ["punctuation", "("], - ["builtin", "bitclr"], ["punctuation", "("], - ["builtin", "bitchange"], ["punctuation", "("], - ["builtin", "bitchg"], ["punctuation", "("], + ["builtin-function", "bitand"], ["punctuation", "("], + ["builtin-function", "bitnot"], ["punctuation", "("], + ["builtin-function", "bitor"], ["punctuation", "("], + ["builtin-function", "bitxor"], ["punctuation", "("], + ["builtin-function", "bitlshift"], ["punctuation", "("], + ["builtin-function", "bitshl"], ["punctuation", "("], + ["builtin-function", "bitsal"], ["punctuation", "("], + ["builtin-function", "bitrshifta"], ["punctuation", "("], + ["builtin-function", "bitrshifts"], ["punctuation", "("], + ["builtin-function", "bitsar"], ["punctuation", "("], + ["builtin-function", "bitrshiftl"], ["punctuation", "("], + ["builtin-function", "bitrshiftu"], ["punctuation", "("], + ["builtin-function", "bitshr"], ["punctuation", "("], + ["builtin-function", "bitlrotate"], ["punctuation", "("], + ["builtin-function", "bitrol"], ["punctuation", "("], + ["builtin-function", "bitrrotatel"], ["punctuation", "("], + ["builtin-function", "bitror"], ["punctuation", "("], + ["builtin-function", "bittest"], ["punctuation", "("], + ["builtin-function", "bittst"], ["punctuation", "("], + ["builtin-function", "bitset"], ["punctuation", "("], + ["builtin-function", "bitsetcount"], ["punctuation", "("], + ["builtin-function", "bitclear"], ["punctuation", "("], + ["builtin-function", "bitclr"], ["punctuation", "("], + ["builtin-function", "bitchange"], ["punctuation", "("], + ["builtin-function", "bitchg"], ["punctuation", "("], - ["builtin", "averageluma"], ["punctuation", "("], - ["builtin", "averagechromau"], ["punctuation", "("], - ["builtin", "averagechromav"], ["punctuation", "("], - ["builtin", "averageb"], ["punctuation", "("], - ["builtin", "averageg"], ["punctuation", "("], - ["builtin", "averager"], ["punctuation", "("], - ["builtin", "lumadifference"], ["punctuation", "("], - ["builtin", "chromaudifference"], ["punctuation", "("], - ["builtin", "chromavdifference"], ["punctuation", "("], - ["builtin", "rgbdifference"], ["punctuation", "("], - ["builtin", "bdifference"], ["punctuation", "("], - ["builtin", "gdifference"], ["punctuation", "("], - ["builtin", "rdifference"], ["punctuation", "("], - ["builtin", "ydifferencefromprevious"], ["punctuation", "("], - ["builtin", "udifferencefromprevious"], ["punctuation", "("], - ["builtin", "vdifferencefromprevious"], ["punctuation", "("], - ["builtin", "rgbdifferencefromprevious"], ["punctuation", "("], - ["builtin", "bdifferencefromprevious"], ["punctuation", "("], - ["builtin", "gdifferencefromprevious"], ["punctuation", "("], - ["builtin", "rdifferencefromprevious"], ["punctuation", "("], - ["builtin", "ydifferencetonext"], ["punctuation", "("], - ["builtin", "udifferencetonext"], ["punctuation", "("], - ["builtin", "vdifferencetonext"], ["punctuation", "("], - ["builtin", "rgbdifferencetonext"], ["punctuation", "("], - ["builtin", "rdifferencetonext"], ["punctuation", "("], - ["builtin", "gdifferencetonext"], ["punctuation", "("], - ["builtin", "bdifferencetonext"], ["punctuation", "("], - ["builtin", "yplanemedian"], ["punctuation", "("], - ["builtin", "uplanemedian"], ["punctuation", "("], - ["builtin", "vplanemedian"], ["punctuation", "("], - ["builtin", "bplanemedian"], ["punctuation", "("], - ["builtin", "gplanemedian"], ["punctuation", "("], - ["builtin", "rplanemedian"], ["punctuation", "("], - ["builtin", "yplanemin"], ["punctuation", "("], - ["builtin", "uplanemin"], ["punctuation", "("], - ["builtin", "vplanemin"], ["punctuation", "("], - ["builtin", "bplanemin"], ["punctuation", "("], - ["builtin", "gplanemin"], ["punctuation", "("], - ["builtin", "rplanemin"], ["punctuation", "("], - ["builtin", "yplanemax"], ["punctuation", "("], - ["builtin", "uplanemax"], ["punctuation", "("], - ["builtin", "vplanemax"], ["punctuation", "("], - ["builtin", "bplanemax"], ["punctuation", "("], - ["builtin", "gplanemax"], ["punctuation", "("], - ["builtin", "rplanemax"], ["punctuation", "("], - ["builtin", "yplaneminmaxdifference"], ["punctuation", "("], - ["builtin", "uplaneminmaxdifference"], ["punctuation", "("], - ["builtin", "vplaneminmaxdifference"], ["punctuation", "("], - ["builtin", "bplaneminmaxdifference"], ["punctuation", "("], - ["builtin", "gplaneminmaxdifference"], ["punctuation", "("], - ["builtin", "rplaneminmaxdifference"], ["punctuation", "("], + ["builtin-function", "averageluma"], ["punctuation", "("], + ["builtin-function", "averagechromau"], ["punctuation", "("], + ["builtin-function", "averagechromav"], ["punctuation", "("], + ["builtin-function", "averageb"], ["punctuation", "("], + ["builtin-function", "averageg"], ["punctuation", "("], + ["builtin-function", "averager"], ["punctuation", "("], + ["builtin-function", "lumadifference"], ["punctuation", "("], + ["builtin-function", "chromaudifference"], ["punctuation", "("], + ["builtin-function", "chromavdifference"], ["punctuation", "("], + ["builtin-function", "rgbdifference"], ["punctuation", "("], + ["builtin-function", "bdifference"], ["punctuation", "("], + ["builtin-function", "gdifference"], ["punctuation", "("], + ["builtin-function", "rdifference"], ["punctuation", "("], + ["builtin-function", "ydifferencefromprevious"], ["punctuation", "("], + ["builtin-function", "udifferencefromprevious"], ["punctuation", "("], + ["builtin-function", "vdifferencefromprevious"], ["punctuation", "("], + ["builtin-function", "rgbdifferencefromprevious"], ["punctuation", "("], + ["builtin-function", "bdifferencefromprevious"], ["punctuation", "("], + ["builtin-function", "gdifferencefromprevious"], ["punctuation", "("], + ["builtin-function", "rdifferencefromprevious"], ["punctuation", "("], + ["builtin-function", "ydifferencetonext"], ["punctuation", "("], + ["builtin-function", "udifferencetonext"], ["punctuation", "("], + ["builtin-function", "vdifferencetonext"], ["punctuation", "("], + ["builtin-function", "rgbdifferencetonext"], ["punctuation", "("], + ["builtin-function", "rdifferencetonext"], ["punctuation", "("], + ["builtin-function", "gdifferencetonext"], ["punctuation", "("], + ["builtin-function", "bdifferencetonext"], ["punctuation", "("], + ["builtin-function", "yplanemedian"], ["punctuation", "("], + ["builtin-function", "uplanemedian"], ["punctuation", "("], + ["builtin-function", "vplanemedian"], ["punctuation", "("], + ["builtin-function", "bplanemedian"], ["punctuation", "("], + ["builtin-function", "gplanemedian"], ["punctuation", "("], + ["builtin-function", "rplanemedian"], ["punctuation", "("], + ["builtin-function", "yplanemin"], ["punctuation", "("], + ["builtin-function", "uplanemin"], ["punctuation", "("], + ["builtin-function", "vplanemin"], ["punctuation", "("], + ["builtin-function", "bplanemin"], ["punctuation", "("], + ["builtin-function", "gplanemin"], ["punctuation", "("], + ["builtin-function", "rplanemin"], ["punctuation", "("], + ["builtin-function", "yplanemax"], ["punctuation", "("], + ["builtin-function", "uplanemax"], ["punctuation", "("], + ["builtin-function", "vplanemax"], ["punctuation", "("], + ["builtin-function", "bplanemax"], ["punctuation", "("], + ["builtin-function", "gplanemax"], ["punctuation", "("], + ["builtin-function", "rplanemax"], ["punctuation", "("], + ["builtin-function", "yplaneminmaxdifference"], ["punctuation", "("], + ["builtin-function", "uplaneminmaxdifference"], ["punctuation", "("], + ["builtin-function", "vplaneminmaxdifference"], ["punctuation", "("], + ["builtin-function", "bplaneminmaxdifference"], ["punctuation", "("], + ["builtin-function", "gplaneminmaxdifference"], ["punctuation", "("], + ["builtin-function", "rplaneminmaxdifference"], ["punctuation", "("], - ["builtin", "scriptname"], ["punctuation", "("], - ["builtin", "scriptnameutf8"], ["punctuation", "("], - ["builtin", "scriptfile"], ["punctuation", "("], - ["builtin", "scriptfileutf8"], ["punctuation", "("], - ["builtin", "scriptdir"], ["punctuation", "("], - ["builtin", "scriptdirutf8"], ["punctuation", "("], - ["builtin", "setlogparams"], ["punctuation", "("], - ["builtin", "logmsg"], ["punctuation", "("], - ["builtin", "getprocessinfo"], ["punctuation", "("], + ["builtin-function", "scriptname"], ["punctuation", "("], + ["builtin-function", "scriptnameutf8"], ["punctuation", "("], + ["builtin-function", "scriptfile"], ["punctuation", "("], + ["builtin-function", "scriptfileutf8"], ["punctuation", "("], + ["builtin-function", "scriptdir"], ["punctuation", "("], + ["builtin-function", "scriptdirutf8"], ["punctuation", "("], + ["builtin-function", "setlogparams"], ["punctuation", "("], + ["builtin-function", "logmsg"], ["punctuation", "("], + ["builtin-function", "getprocessinfo"], ["punctuation", "("], - ["builtin", "lcase"], ["punctuation", "("], - ["builtin", "ucase"], ["punctuation", "("], - ["builtin", "strtoutf8"], ["punctuation", "("], - ["builtin", "strfromutf8"], ["punctuation", "("], - ["builtin", "strlen"], ["punctuation", "("], - ["builtin", "revstr"], ["punctuation", "("], - ["builtin", "leftstr"], ["punctuation", "("], - ["builtin", "rightstr"], ["punctuation", "("], - ["builtin", "midstr"], ["punctuation", "("], - ["builtin", "findstr"], ["punctuation", "("], - ["builtin", "replacestr"], ["punctuation", "("], - ["builtin", "format"], ["punctuation", "("], - ["builtin", "fillstr"], ["punctuation", "("], - ["builtin", "strcmp"], ["punctuation", "("], - ["builtin", "strcmpi"], ["punctuation", "("], - ["builtin", "trimleft"], ["punctuation", "("], - ["builtin", "trimright"], ["punctuation", "("], - ["builtin", "trimall"], ["punctuation", "("], - ["builtin", "chr"], ["punctuation", "("], - ["builtin", "ord"], ["punctuation", "("], - ["builtin", "time"], ["punctuation", "("], + ["builtin-function", "lcase"], ["punctuation", "("], + ["builtin-function", "ucase"], ["punctuation", "("], + ["builtin-function", "strtoutf8"], ["punctuation", "("], + ["builtin-function", "strfromutf8"], ["punctuation", "("], + ["builtin-function", "strlen"], ["punctuation", "("], + ["builtin-function", "revstr"], ["punctuation", "("], + ["builtin-function", "leftstr"], ["punctuation", "("], + ["builtin-function", "rightstr"], ["punctuation", "("], + ["builtin-function", "midstr"], ["punctuation", "("], + ["builtin-function", "findstr"], ["punctuation", "("], + ["builtin-function", "replacestr"], ["punctuation", "("], + ["builtin-function", "format"], ["punctuation", "("], + ["builtin-function", "fillstr"], ["punctuation", "("], + ["builtin-function", "strcmp"], ["punctuation", "("], + ["builtin-function", "strcmpi"], ["punctuation", "("], + ["builtin-function", "trimleft"], ["punctuation", "("], + ["builtin-function", "trimright"], ["punctuation", "("], + ["builtin-function", "trimall"], ["punctuation", "("], + ["builtin-function", "chr"], ["punctuation", "("], + ["builtin-function", "ord"], ["punctuation", "("], + ["builtin-function", "time"], ["punctuation", "("], - ["builtin", "versionnumber"], ["punctuation", "("], - ["builtin", "versionstring"], ["punctuation", "("], - ["builtin", "isversionorgreater"], ["punctuation", "("], + ["builtin-function", "versionnumber"], ["punctuation", "("], + ["builtin-function", "versionstring"], ["punctuation", "("], + ["builtin-function", "isversionorgreater"], ["punctuation", "("], - ["builtin", "buildpixeltype"], ["punctuation", "("], - ["builtin", "colorspacenametopixeltype"], ["punctuation", "("], + ["builtin-function", "buildpixeltype"], ["punctuation", "("], + ["builtin-function", "colorspacenametopixeltype"], ["punctuation", "("], "\r\n\r\nisbool\r\nisbool", ["punctuation", "."], ["punctuation", "("], "\r\nkevincosner" diff --git a/tests/languages/avisynth/internalfilters_feature.test b/tests/languages/avisynth/internalfilters_feature.test index fe11c09b46..7d98108f17 100644 --- a/tests/languages/avisynth/internalfilters_feature.test +++ b/tests/languages/avisynth/internalfilters_feature.test @@ -213,213 +213,213 @@ pantone ( ---------------------------------------------------- [ - ["builtin", "avisource"], ["punctuation", "("], - ["builtin", "avifilesource"], ["punctuation", "("], - ["builtin", "opendmlsource"], ["punctuation", "("], - ["builtin", "directshowsource"], ["punctuation", "("], - ["builtin", "imagereader"], ["punctuation", "("], - ["builtin", "imagesource"], ["punctuation", "("], - ["builtin", "imagesourceanim"], ["punctuation", "("], - ["builtin", "segmentedavisource"], ["punctuation", "("], - ["builtin", "segmenteddirectshowsource"], ["punctuation", "("], - ["builtin", "wavsource"], ["punctuation", "("], + ["builtin-function", "avisource"], ["punctuation", "("], + ["builtin-function", "avifilesource"], ["punctuation", "("], + ["builtin-function", "opendmlsource"], ["punctuation", "("], + ["builtin-function", "directshowsource"], ["punctuation", "("], + ["builtin-function", "imagereader"], ["punctuation", "("], + ["builtin-function", "imagesource"], ["punctuation", "("], + ["builtin-function", "imagesourceanim"], ["punctuation", "("], + ["builtin-function", "segmentedavisource"], ["punctuation", "("], + ["builtin-function", "segmenteddirectshowsource"], ["punctuation", "("], + ["builtin-function", "wavsource"], ["punctuation", "("], - ["builtin", "coloryuv"], ["punctuation", "("], - ["builtin", "convertbacktoyuy2"], ["punctuation", "("], - ["builtin", "converttorgb"], ["punctuation", "("], - ["builtin", "converttorgb24"], ["punctuation", "("], - ["builtin", "converttorgb32"], ["punctuation", "("], - ["builtin", "converttorgb48"], ["punctuation", "("], - ["builtin", "converttorgb64"], ["punctuation", "("], - ["builtin", "converttoplanarrgb"], ["punctuation", "("], - ["builtin", "converttoplanarrgba"], ["punctuation", "("], - ["builtin", "converttoyuy2"], ["punctuation", "("], - ["builtin", "converttoyv24"], ["punctuation", "("], - ["builtin", "converttoyv16"], ["punctuation", "("], - ["builtin", "converttoyv12"], ["punctuation", "("], - ["builtin", "converttoy8"], ["punctuation", "("], - ["builtin", "converttoyuv444"], ["punctuation", "("], - ["builtin", "converttoyuv422"], ["punctuation", "("], - ["builtin", "converttoyuv420"], ["punctuation", "("], - ["builtin", "converttoyuva444"], ["punctuation", "("], - ["builtin", "converttoyuva422"], ["punctuation", "("], - ["builtin", "converttoyuva420"], ["punctuation", "("], - ["builtin", "converttoyuv411"], ["punctuation", "("], - ["builtin", "fixluminance"], ["punctuation", "("], - ["builtin", "greyscale"], ["punctuation", "("], - ["builtin", "grayscale"], ["punctuation", "("], - ["builtin", "invert"], ["punctuation", "("], - ["builtin", "levels"], ["punctuation", "("], - ["builtin", "limiter"], ["punctuation", "("], - ["builtin", "mergergb"], ["punctuation", "("], - ["builtin", "mergeargb"], ["punctuation", "("], - ["builtin", "mergeluma"], ["punctuation", "("], - ["builtin", "mergechroma"], ["punctuation", "("], - ["builtin", "rgbadjust"], ["punctuation", "("], - ["builtin", "showred"], ["punctuation", "("], - ["builtin", "showgreen"], ["punctuation", "("], - ["builtin", "showblue"], ["punctuation", "("], - ["builtin", "showalpha"], ["punctuation", "("], - ["builtin", "swapuv"], ["punctuation", "("], - ["builtin", "tweak"], ["punctuation", "("], - ["builtin", "utoy"], ["punctuation", "("], - ["builtin", "utoy8"], ["punctuation", "("], - ["builtin", "vtoy"], ["punctuation", "("], - ["builtin", "vtoy8"], ["punctuation", "("], - ["builtin", "ytouv"], ["punctuation", "("], + ["builtin-function", "coloryuv"], ["punctuation", "("], + ["builtin-function", "convertbacktoyuy2"], ["punctuation", "("], + ["builtin-function", "converttorgb"], ["punctuation", "("], + ["builtin-function", "converttorgb24"], ["punctuation", "("], + ["builtin-function", "converttorgb32"], ["punctuation", "("], + ["builtin-function", "converttorgb48"], ["punctuation", "("], + ["builtin-function", "converttorgb64"], ["punctuation", "("], + ["builtin-function", "converttoplanarrgb"], ["punctuation", "("], + ["builtin-function", "converttoplanarrgba"], ["punctuation", "("], + ["builtin-function", "converttoyuy2"], ["punctuation", "("], + ["builtin-function", "converttoyv24"], ["punctuation", "("], + ["builtin-function", "converttoyv16"], ["punctuation", "("], + ["builtin-function", "converttoyv12"], ["punctuation", "("], + ["builtin-function", "converttoy8"], ["punctuation", "("], + ["builtin-function", "converttoyuv444"], ["punctuation", "("], + ["builtin-function", "converttoyuv422"], ["punctuation", "("], + ["builtin-function", "converttoyuv420"], ["punctuation", "("], + ["builtin-function", "converttoyuva444"], ["punctuation", "("], + ["builtin-function", "converttoyuva422"], ["punctuation", "("], + ["builtin-function", "converttoyuva420"], ["punctuation", "("], + ["builtin-function", "converttoyuv411"], ["punctuation", "("], + ["builtin-function", "fixluminance"], ["punctuation", "("], + ["builtin-function", "greyscale"], ["punctuation", "("], + ["builtin-function", "grayscale"], ["punctuation", "("], + ["builtin-function", "invert"], ["punctuation", "("], + ["builtin-function", "levels"], ["punctuation", "("], + ["builtin-function", "limiter"], ["punctuation", "("], + ["builtin-function", "mergergb"], ["punctuation", "("], + ["builtin-function", "mergeargb"], ["punctuation", "("], + ["builtin-function", "mergeluma"], ["punctuation", "("], + ["builtin-function", "mergechroma"], ["punctuation", "("], + ["builtin-function", "rgbadjust"], ["punctuation", "("], + ["builtin-function", "showred"], ["punctuation", "("], + ["builtin-function", "showgreen"], ["punctuation", "("], + ["builtin-function", "showblue"], ["punctuation", "("], + ["builtin-function", "showalpha"], ["punctuation", "("], + ["builtin-function", "swapuv"], ["punctuation", "("], + ["builtin-function", "tweak"], ["punctuation", "("], + ["builtin-function", "utoy"], ["punctuation", "("], + ["builtin-function", "utoy8"], ["punctuation", "("], + ["builtin-function", "vtoy"], ["punctuation", "("], + ["builtin-function", "vtoy8"], ["punctuation", "("], + ["builtin-function", "ytouv"], ["punctuation", "("], - ["builtin", "colorkeymask"], ["punctuation", "("], - ["builtin", "layer"], ["punctuation", "("], - ["builtin", "mask"], ["punctuation", "("], - ["builtin", "maskhs"], ["punctuation", "("], - ["builtin", "merge"], ["punctuation", "("], - ["builtin", "overlay"], ["punctuation", "("], - ["builtin", "resetmask"], ["punctuation", "("], - ["builtin", "subtract"], ["punctuation", "("], + ["builtin-function", "colorkeymask"], ["punctuation", "("], + ["builtin-function", "layer"], ["punctuation", "("], + ["builtin-function", "mask"], ["punctuation", "("], + ["builtin-function", "maskhs"], ["punctuation", "("], + ["builtin-function", "merge"], ["punctuation", "("], + ["builtin-function", "overlay"], ["punctuation", "("], + ["builtin-function", "resetmask"], ["punctuation", "("], + ["builtin-function", "subtract"], ["punctuation", "("], - ["builtin", "addborders"], ["punctuation", "("], - ["builtin", "crop"], ["punctuation", "("], - ["builtin", "cropbottom"], ["punctuation", "("], - ["builtin", "fliphorizontal"], ["punctuation", "("], - ["builtin", "flipvertical"], ["punctuation", "("], - ["builtin", "letterbox"], ["punctuation", "("], - ["builtin", "horizontalreduceby2"], ["punctuation", "("], - ["builtin", "verticalreduceby2"], ["punctuation", "("], - ["builtin", "reduceby2"], ["punctuation", "("], - ["builtin", "bicubicresize"], ["punctuation", "("], - ["builtin", "bilinearresize"], ["punctuation", "("], - ["builtin", "blackmanresize"], ["punctuation", "("], - ["builtin", "gaussresize"], ["punctuation", "("], - ["builtin", "lanczosresize"], ["punctuation", "("], - ["builtin", "lanczos4resize"], ["punctuation", "("], - ["builtin", "pointresize"], ["punctuation", "("], - ["builtin", "sincresize"], ["punctuation", "("], - ["builtin", "spline16resize"], ["punctuation", "("], - ["builtin", "spline36resize"], ["punctuation", "("], - ["builtin", "spline64resize"], ["punctuation", "("], + ["builtin-function", "addborders"], ["punctuation", "("], + ["builtin-function", "crop"], ["punctuation", "("], + ["builtin-function", "cropbottom"], ["punctuation", "("], + ["builtin-function", "fliphorizontal"], ["punctuation", "("], + ["builtin-function", "flipvertical"], ["punctuation", "("], + ["builtin-function", "letterbox"], ["punctuation", "("], + ["builtin-function", "horizontalreduceby2"], ["punctuation", "("], + ["builtin-function", "verticalreduceby2"], ["punctuation", "("], + ["builtin-function", "reduceby2"], ["punctuation", "("], + ["builtin-function", "bicubicresize"], ["punctuation", "("], + ["builtin-function", "bilinearresize"], ["punctuation", "("], + ["builtin-function", "blackmanresize"], ["punctuation", "("], + ["builtin-function", "gaussresize"], ["punctuation", "("], + ["builtin-function", "lanczosresize"], ["punctuation", "("], + ["builtin-function", "lanczos4resize"], ["punctuation", "("], + ["builtin-function", "pointresize"], ["punctuation", "("], + ["builtin-function", "sincresize"], ["punctuation", "("], + ["builtin-function", "spline16resize"], ["punctuation", "("], + ["builtin-function", "spline36resize"], ["punctuation", "("], + ["builtin-function", "spline64resize"], ["punctuation", "("], ["punctuation", "("], - ["builtin", "skewrows"], ["punctuation", "("], - ["builtin", "turnleft"], ["punctuation", "("], - ["builtin", "turnright"], ["punctuation", "("], - ["builtin", "turn180"], ["punctuation", "("], + ["builtin-function", "skewrows"], ["punctuation", "("], + ["builtin-function", "turnleft"], ["punctuation", "("], + ["builtin-function", "turnright"], ["punctuation", "("], + ["builtin-function", "turn180"], ["punctuation", "("], - ["builtin", "blur"], ["punctuation", "("], - ["builtin", "sharpen"], ["punctuation", "("], - ["builtin", "generalconvolution"], ["punctuation", "("], - ["builtin", "spatialsoften"], ["punctuation", "("], - ["builtin", "temporalsoften"], ["punctuation", "("], - ["builtin", "fixbrokenchromaupsampling"], ["punctuation", "("], + ["builtin-function", "blur"], ["punctuation", "("], + ["builtin-function", "sharpen"], ["punctuation", "("], + ["builtin-function", "generalconvolution"], ["punctuation", "("], + ["builtin-function", "spatialsoften"], ["punctuation", "("], + ["builtin-function", "temporalsoften"], ["punctuation", "("], + ["builtin-function", "fixbrokenchromaupsampling"], ["punctuation", "("], - ["builtin", "alignedsplice"], ["punctuation", "("], - ["builtin", "unalignedsplice"], ["punctuation", "("], - ["builtin", "assumefps"], ["punctuation", "("], - ["builtin", "assumescaledfps"], ["punctuation", "("], - ["builtin", "changefps"], ["punctuation", "("], - ["builtin", "convertfps"], ["punctuation", "("], - ["builtin", "deleteframe"], ["punctuation", "("], - ["builtin", "dissolve"], ["punctuation", "("], - ["builtin", "duplicateframe"], ["punctuation", "("], - ["builtin", "fadein0"], ["punctuation", "("], - ["builtin", "fadein"], ["punctuation", "("], - ["builtin", "fadein2"], ["punctuation", "("], - ["builtin", "fadeout0"], ["punctuation", "("], - ["builtin", "fadeout"], ["punctuation", "("], - ["builtin", "fadeout2"], ["punctuation", "("], - ["builtin", "fadeio0"], ["punctuation", "("], - ["builtin", "fadeio"], ["punctuation", "("], - ["builtin", "fadeio2"], ["punctuation", "("], - ["builtin", "freezeframe"], ["punctuation", "("], - ["builtin", "interleave"], ["punctuation", "("], - ["builtin", "loop"], ["punctuation", "("], - ["builtin", "reverse"], ["punctuation", "("], - ["builtin", "selecteven"], ["punctuation", "("], - ["builtin", "selectodd"], ["punctuation", "("], - ["builtin", "selectevery"], ["punctuation", "("], - ["builtin", "selectrangeevery"], ["punctuation", "("], - ["builtin", "trim"], ["punctuation", "("], + ["builtin-function", "alignedsplice"], ["punctuation", "("], + ["builtin-function", "unalignedsplice"], ["punctuation", "("], + ["builtin-function", "assumefps"], ["punctuation", "("], + ["builtin-function", "assumescaledfps"], ["punctuation", "("], + ["builtin-function", "changefps"], ["punctuation", "("], + ["builtin-function", "convertfps"], ["punctuation", "("], + ["builtin-function", "deleteframe"], ["punctuation", "("], + ["builtin-function", "dissolve"], ["punctuation", "("], + ["builtin-function", "duplicateframe"], ["punctuation", "("], + ["builtin-function", "fadein0"], ["punctuation", "("], + ["builtin-function", "fadein"], ["punctuation", "("], + ["builtin-function", "fadein2"], ["punctuation", "("], + ["builtin-function", "fadeout0"], ["punctuation", "("], + ["builtin-function", "fadeout"], ["punctuation", "("], + ["builtin-function", "fadeout2"], ["punctuation", "("], + ["builtin-function", "fadeio0"], ["punctuation", "("], + ["builtin-function", "fadeio"], ["punctuation", "("], + ["builtin-function", "fadeio2"], ["punctuation", "("], + ["builtin-function", "freezeframe"], ["punctuation", "("], + ["builtin-function", "interleave"], ["punctuation", "("], + ["builtin-function", "loop"], ["punctuation", "("], + ["builtin-function", "reverse"], ["punctuation", "("], + ["builtin-function", "selecteven"], ["punctuation", "("], + ["builtin-function", "selectodd"], ["punctuation", "("], + ["builtin-function", "selectevery"], ["punctuation", "("], + ["builtin-function", "selectrangeevery"], ["punctuation", "("], + ["builtin-function", "trim"], ["punctuation", "("], - ["builtin", "assumeframebased"], ["punctuation", "("], - ["builtin", "assumefieldbased"], ["punctuation", "("], - ["builtin", "assumebff"], ["punctuation", "("], - ["builtin", "assumetff"], ["punctuation", "("], - ["builtin", "bob"], ["punctuation", "("], - ["builtin", "complementparity"], ["punctuation", "("], - ["builtin", "doubleweave"], ["punctuation", "("], - ["builtin", "peculiarblend"], ["punctuation", "("], - ["builtin", "pulldown"], ["punctuation", "("], - ["builtin", "separatecolumns"], ["punctuation", "("], - ["builtin", "separaterows"], ["punctuation", "("], - ["builtin", "separatefields"], ["punctuation", "("], - ["builtin", "swapfields"], ["punctuation", "("], - ["builtin", "weave"], ["punctuation", "("], - ["builtin", "weavecolumns"], ["punctuation", "("], - ["builtin", "weaverows"], ["punctuation", "("], + ["builtin-function", "assumeframebased"], ["punctuation", "("], + ["builtin-function", "assumefieldbased"], ["punctuation", "("], + ["builtin-function", "assumebff"], ["punctuation", "("], + ["builtin-function", "assumetff"], ["punctuation", "("], + ["builtin-function", "bob"], ["punctuation", "("], + ["builtin-function", "complementparity"], ["punctuation", "("], + ["builtin-function", "doubleweave"], ["punctuation", "("], + ["builtin-function", "peculiarblend"], ["punctuation", "("], + ["builtin-function", "pulldown"], ["punctuation", "("], + ["builtin-function", "separatecolumns"], ["punctuation", "("], + ["builtin-function", "separaterows"], ["punctuation", "("], + ["builtin-function", "separatefields"], ["punctuation", "("], + ["builtin-function", "swapfields"], ["punctuation", "("], + ["builtin-function", "weave"], ["punctuation", "("], + ["builtin-function", "weavecolumns"], ["punctuation", "("], + ["builtin-function", "weaverows"], ["punctuation", "("], - ["builtin", "amplify"], ["punctuation", "("], - ["builtin", "amplifydb"], ["punctuation", "("], - ["builtin", "assumesamplerate"], ["punctuation", "("], - ["builtin", "audiodub"], ["punctuation", "("], - ["builtin", "audiodubex"], ["punctuation", "("], - ["builtin", "audiotrim"], ["punctuation", "("], - ["builtin", "convertaudioto8bit"], ["punctuation", "("], - ["builtin", "convertaudioto16bit"], ["punctuation", "("], - ["builtin", "convertaudioto24bit"], ["punctuation", "("], - ["builtin", "convertaudioto32bit"], ["punctuation", "("], - ["builtin", "convertaudiotofloat"], ["punctuation", "("], - ["builtin", "converttomono"], ["punctuation", "("], - ["builtin", "delayaudio"], ["punctuation", "("], - ["builtin", "ensurevbrmp3sync"], ["punctuation", "("], - ["builtin", "getchannel"], ["punctuation", "("], - ["builtin", "getleftchannel"], ["punctuation", "("], - ["builtin", "getrightchannel"], ["punctuation", "("], - ["builtin", "killaudio"], ["punctuation", "("], - ["builtin", "killvideo"], ["punctuation", "("], - ["builtin", "mergechannels"], ["punctuation", "("], - ["builtin", "mixaudio"], ["punctuation", "("], - ["builtin", "monotostereo"], ["punctuation", "("], - ["builtin", "normalize"], ["punctuation", "("], - ["builtin", "resampleaudio"], ["punctuation", "("], - ["builtin", "supereq"], ["punctuation", "("], - ["builtin", "ssrc"], ["punctuation", "("], - ["builtin", "timestretch"], ["punctuation", "("], + ["builtin-function", "amplify"], ["punctuation", "("], + ["builtin-function", "amplifydb"], ["punctuation", "("], + ["builtin-function", "assumesamplerate"], ["punctuation", "("], + ["builtin-function", "audiodub"], ["punctuation", "("], + ["builtin-function", "audiodubex"], ["punctuation", "("], + ["builtin-function", "audiotrim"], ["punctuation", "("], + ["builtin-function", "convertaudioto8bit"], ["punctuation", "("], + ["builtin-function", "convertaudioto16bit"], ["punctuation", "("], + ["builtin-function", "convertaudioto24bit"], ["punctuation", "("], + ["builtin-function", "convertaudioto32bit"], ["punctuation", "("], + ["builtin-function", "convertaudiotofloat"], ["punctuation", "("], + ["builtin-function", "converttomono"], ["punctuation", "("], + ["builtin-function", "delayaudio"], ["punctuation", "("], + ["builtin-function", "ensurevbrmp3sync"], ["punctuation", "("], + ["builtin-function", "getchannel"], ["punctuation", "("], + ["builtin-function", "getleftchannel"], ["punctuation", "("], + ["builtin-function", "getrightchannel"], ["punctuation", "("], + ["builtin-function", "killaudio"], ["punctuation", "("], + ["builtin-function", "killvideo"], ["punctuation", "("], + ["builtin-function", "mergechannels"], ["punctuation", "("], + ["builtin-function", "mixaudio"], ["punctuation", "("], + ["builtin-function", "monotostereo"], ["punctuation", "("], + ["builtin-function", "normalize"], ["punctuation", "("], + ["builtin-function", "resampleaudio"], ["punctuation", "("], + ["builtin-function", "supereq"], ["punctuation", "("], + ["builtin-function", "ssrc"], ["punctuation", "("], + ["builtin-function", "timestretch"], ["punctuation", "("], ["punctuation", "("], - ["builtin", "conditionalfilter"], ["punctuation", "("], - ["builtin", "frameevaluate"], ["punctuation", "("], - ["builtin", "scriptclip"], ["punctuation", "("], - ["builtin", "conditionalselect"], ["punctuation", "("], - ["builtin", "conditionalreader"], ["punctuation", "("], - ["builtin", "writefile"], ["punctuation", "("], - ["builtin", "writefileif"], ["punctuation", "("], - ["builtin", "writefilestart"], ["punctuation", "("], - ["builtin", "writefileend"], ["punctuation", "("], - ["builtin", "animate"], ["punctuation", "("], - ["builtin", "applyrange"], ["punctuation", "("], - ["builtin", "tcpserver"], ["punctuation", "("], - ["builtin", "tcpsource"], ["punctuation", "("], + ["builtin-function", "conditionalfilter"], ["punctuation", "("], + ["builtin-function", "frameevaluate"], ["punctuation", "("], + ["builtin-function", "scriptclip"], ["punctuation", "("], + ["builtin-function", "conditionalselect"], ["punctuation", "("], + ["builtin-function", "conditionalreader"], ["punctuation", "("], + ["builtin-function", "writefile"], ["punctuation", "("], + ["builtin-function", "writefileif"], ["punctuation", "("], + ["builtin-function", "writefilestart"], ["punctuation", "("], + ["builtin-function", "writefileend"], ["punctuation", "("], + ["builtin-function", "animate"], ["punctuation", "("], + ["builtin-function", "applyrange"], ["punctuation", "("], + ["builtin-function", "tcpserver"], ["punctuation", "("], + ["builtin-function", "tcpsource"], ["punctuation", "("], - ["builtin", "imagewriter"], ["punctuation", "("], + ["builtin-function", "imagewriter"], ["punctuation", "("], - ["builtin", "blankclip"], ["punctuation", "("], - ["builtin", "blackness"], ["punctuation", "("], - ["builtin", "colorbars"], ["punctuation", "("], - ["builtin", "colorbarshd"], ["punctuation", "("], - ["builtin", "compare"], ["punctuation", "("], - ["builtin", "dumpfiltergraph"], ["punctuation", "("], - ["builtin", "setgraphanalysis"], ["punctuation", "("], - ["builtin", "echo"], ["punctuation", "("], - ["builtin", "histogram"], ["punctuation", "("], - ["builtin", "info"], ["punctuation", "("], - ["builtin", "messageclip"], ["punctuation", "("], - ["builtin", "preroll"], ["punctuation", "("], - ["builtin", "showfiveversions"], ["punctuation", "("], - ["builtin", "showframenumber"], ["punctuation", "("], - ["builtin", "showsmpte"], ["punctuation", "("], - ["builtin", "showtime"], ["punctuation", "("], - ["builtin", "stackhorizontal"], ["punctuation", "("], - ["builtin", "stackvertical"], ["punctuation", "("], - ["builtin", "subtitle"], ["punctuation", "("], - ["builtin", "tone"], ["punctuation", "("], - ["builtin", "version"], ["punctuation", "("], + ["builtin-function", "blankclip"], ["punctuation", "("], + ["builtin-function", "blackness"], ["punctuation", "("], + ["builtin-function", "colorbars"], ["punctuation", "("], + ["builtin-function", "colorbarshd"], ["punctuation", "("], + ["builtin-function", "compare"], ["punctuation", "("], + ["builtin-function", "dumpfiltergraph"], ["punctuation", "("], + ["builtin-function", "setgraphanalysis"], ["punctuation", "("], + ["builtin-function", "echo"], ["punctuation", "("], + ["builtin-function", "histogram"], ["punctuation", "("], + ["builtin-function", "info"], ["punctuation", "("], + ["builtin-function", "messageclip"], ["punctuation", "("], + ["builtin-function", "preroll"], ["punctuation", "("], + ["builtin-function", "showfiveversions"], ["punctuation", "("], + ["builtin-function", "showframenumber"], ["punctuation", "("], + ["builtin-function", "showsmpte"], ["punctuation", "("], + ["builtin-function", "showtime"], ["punctuation", "("], + ["builtin-function", "stackhorizontal"], ["punctuation", "("], + ["builtin-function", "stackvertical"], ["punctuation", "("], + ["builtin-function", "subtitle"], ["punctuation", "("], + ["builtin-function", "tone"], ["punctuation", "("], + ["builtin-function", "version"], ["punctuation", "("], "\r\n\r\ntone\r\ntone", ["punctuation", "."], ["punctuation", "("], ["function", ["pantone"]], ["punctuation", "("] From 96c6fcac072c6eb4e57df9a06d49813de4bf720f Mon Sep 17 00:00:00 2001 From: Zach Date: Mon, 13 Sep 2021 18:56:39 -0700 Subject: [PATCH 06/12] Apply suggestions from code review Co-authored-by: Michael Schmidt --- components/prism-avisynth.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js index 11fd295517..8b40b94893 100644 --- a/components/prism-avisynth.js +++ b/components/prism-avisynth.js @@ -86,8 +86,9 @@ Prism.languages.avisynth = { 'comment': [ { - // Matches [* *] nestable block comments, but can not handle nested comments correctly (recursion) - pattern: /(^|[^\\])\[\*[\s\S]*?(?:\*\]|$)/, + // Matches [* *] nestable block comments, but only supports 1 level of nested comments + // /\[\*(?:[^\[*]|\[(?!\*)|\*(?!\])|)*\*\]/ + pattern: /(^|[^\\])\[\*(?:[^\[*]|\[(?!\*)|\*(?!\])|\[\*(?:[^\[*]|\[(?!\*)|\*(?!\]))*\*\])*\*\]/, lookbehind: true, greedy: true }, @@ -109,16 +110,14 @@ 'argument': { pattern: re(/\b(?:<<0>>)\s+("?)\w+\1/.source, [types], 'i'), inside: { - 'keyword': { - pattern: re(/\b(?:<<0>>)\b/.source, [types], 'i') - } + 'keyword': /^\w+/ } }, 'string': [ { // triple double-quoted - pattern: /"""[\s\S]*?"""/i, + pattern: /"""[\s\S]*?"""/, greedy: true, }, { @@ -127,7 +126,8 @@ greedy: true, inside: { 'constant': { - pattern: re(/<<0>>/.source, [predefined]) // These *are* case-sensitive! + // These *are* case-sensitive! + pattern: /\b(?:DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS)\b/ } } } @@ -143,7 +143,7 @@ lookbehind: true }, - 'constant': re(/\b<<0>>\b/.source, [constants]), + 'constant': /\bMT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)\b/, 'builtin-function': [ { @@ -172,7 +172,7 @@ // Matches a \ as the first or last character on a line 'line-continuation': { - pattern: /(^\s*)\\|\\(?=\s*$)/m, + pattern: /(^[ \t]*)\\|\\(?=[ \t]*$)/m, lookbehind: true, alias: 'punctuation' }, @@ -181,7 +181,7 @@ 'number': /\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i, - 'punctuation': /[{};(),.]/ + 'punctuation': /[{}\[\]();,.]/ }; }(Prism)); From 39017b079d63e366c9724480a43b77b441416678 Mon Sep 17 00:00:00 2001 From: Zinfidel Date: Mon, 13 Sep 2021 22:57:02 -0700 Subject: [PATCH 07/12] Add argument labels, update functions to be more permissive. Internal functions now match any internal word bounded by word boundaries. User/External functions now match identifiers after a ., before a (, or both. --- components/prism-avisynth.js | 43 +- components/prism-avisynth.min.js | 2 +- .../avisynth/clipproperties_feature.test | 10 +- .../comments_strings_predefines_feature.test | 10 +- .../avisynth/intenalfuncs_feature.test | 724 ++++++++-------- .../avisynth/internalfilters_feature.test | 820 +++++++++--------- .../avisynth/userfunctions_feature.test | 42 +- 7 files changed, 841 insertions(+), 810 deletions(-) diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js index 8b40b94893..8c276d0709 100644 --- a/components/prism-avisynth.js +++ b/components/prism-avisynth.js @@ -13,8 +13,6 @@ var types = /clip|int|float|string|bool|val/.source; var keywords = /function|global|return|try|catch|if|else|while|for|__END__/.source; // includes avs+ native gscript constructs - var predefined = /DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS/.source; - var constants = /MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)/.source; var internals = [ // bools /is(?:bool|clip|float|int|string)|defined|(?:var|(?:internal)?function)?exists?/.source, @@ -114,6 +112,19 @@ } }, + // Optional argument assignment + 'argument-label': { + pattern: /([,(][\s\\]*)\w+\s*=(?!=)/, + lookbehind: true, + inside: { + 'argument-name': { + pattern: /^\w+/, + alias: 'punctuation' + }, + 'punctuation': /=$/ + } + }, + 'string': [ { // triple double-quoted @@ -145,23 +156,16 @@ 'constant': /\bMT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)\b/, - 'builtin-function': [ - { - // AviSynth's internal clip properties. - pattern: re(/(\b\.)(?:<<0>>)\b(?=[^\.])/.source, [properties], 'i'), - lookbehind: true, - alias: 'function' - }, - { - // AviSynth's internal functions and filters, including properties used as functions. - pattern: re(/\b(?:<<0>>)(?=\s*\()/.source, [allinternals], 'i'), - alias: 'function' - } - ], + // AviSynth's internal functions, filters, and properties + 'builtin-function': { + pattern: re(/\b(?:<<0>>)\b(?!\s*=)/.source, [allinternals], 'i'), + alias: 'function' + }, - // External filters, and user-defined filters. + // External/user-defined filters, and type casts. 'function': { - pattern: /\b[a-z_]\w*(?=\s*\()/i, + pattern: /\b[a-z_]\w*(?=\s*\()|(\.)[a-z_]\w*\b/i, + lookbehind: true, inside: { 'keyword': { // type casts @@ -183,6 +187,7 @@ 'punctuation': /[{}\[\]();,.]/ }; -}(Prism)); -Prism.languages.avs = Prism.languages.avisynth; + Prism.languages.avs = Prism.languages.avisynth; + +}(Prism)); diff --git a/components/prism-avisynth.min.js b/components/prism-avisynth.min.js index d461b4a4bd..390fbf7379 100644 --- a/components/prism-avisynth.min.js +++ b/components/prism-avisynth.min.js @@ -1 +1 @@ -!function(e){function a(e,a,r){return RegExp(function(e,r){return e.replace(/<<(\d+)>>/g,function(e,a){return r[+a]})}(e,a),r||"")}var r="clip|int|float|string|bool|val",t=["is(?:bool|clip|float|int|string)|defined|(?:var|(?:internal)?function)?exists?","apply|assert|default|eval|import|select|nop|undefined","set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment)|opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))","hex(?:value)?|value","max|min|muldiv|floor|ceil|round|fmod|pi|exp|log(?:10)?|pow|sqrt|abs|sign|frac|rand|spline|continued(?:numerator|denominator)?","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(?:luma|chroma[uv]|[bgr])|(?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)?|[yuvrgb]plane(?:median|min|max|minmaxdifference)","script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?)|setlogparams|logmsg|getprocessinfo","[lu]case|str(?:toutf8|fromutf8|len|cmpi?)|(?:rev|left|right|mid|find|replace|fill)str|format|trim(?:left|right|all)|chr|ord|time","version(?:number|string)|isversionorgreater","buildpixeltype|colorspacenametopixeltype","setfiltermtmode|prefetch|addautoloaddir|on(?:cpu|cuda)"].join("|"),i=["has(?:audio|video)","width|height","frame(?:count|rate)|framerate(?:numerator|denominator)","is(?:field|frame)based|getparity","pixeltype|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|hasalpha|componentsize|numcomponents|bitspercomponent","audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits)|isaudio(?:float|int)"].join("|"),n=[t,i,["avi(?:file)?source|opendmlsource|directshowsource|image(?:reader|source|sourceanim)|segmented(?:avisource|directshowsource)|wavsource","coloryuv|convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2)|convertbacktoyuy2|fixluminance|gr[ae]yscale|invert|levels|limiter|mergea?rgb|merge(?:luma|chroma)|rgbadjust|show(?:red|green|blue|alpha)|swapuv|tweak|[uv]toy8?|ytouv","(?:colorkey|reset)mask|mask(?:hs)?|layer|merge|overlay|subtract","addborders|crop(?:bottom)?|flip(?:horizontal|vertical)|letterbox|(?:horizontal|vertical)?reduceby2|(?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize|skewrows|turn(?:left|right|180)","blur|sharpen|generalconvolution|(?:spatial|temporal)soften|fixbrokenchromaupsampling","trim|(?:un)?alignedsplice|(?:assume|assumescaled|change|convert)FPS|(?:delete|duplicate)frame|dissolve|fade(?:in|out|io)[02]?|freezeframe|interleave|loop|reverse|select(?:even|odd|(?:range)?every)","assume(?:frame|field)based|assume[bt]ff|bob|complementparity|doubleweave|peculiarblend|pulldown|separate(?:columns|rows|fields)|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|supereq|ssrc|timestretch","conditional(?:filter|select|reader)|frameevaluate|scriptclip|writefile(?:if|start|end)?|animate|applyrange|tcp(?:server|source)","imagewriter","subtitle|blankclip|blackness|colorbars(?:hd)?|compare|dumpfiltergraph|setgraphanalysis|echo|histogram|info|messageclip|preroll|showfiveversions|show(?:framenumber|smpte|time)|stack(?:horizontal|vertical)|tone|version"].join("|")].join("|");e.languages.avisynth={comment:[{pattern:/(^|[^\\])\[\*[\s\S]*?(?:\*\]|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],argument:{pattern:a('\\b(?:<<0>>)\\s+("?)\\w+\\1',[r],"i"),inside:{keyword:{pattern:a("\\b(?:<<0>>)\\b",[r],"i")}}},string:[{pattern:/"""[\s\S]*?"""/i,greedy:!0},{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0,inside:{constant:{pattern:a("<<0>>",["DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS"])}}}],variable:/\b(?:last)\b/i,boolean:/\b(?:true|false|yes|no)\b/i,keyword:{pattern:a("((?:^|[\\\\{])\\s*)(?:<<0>>)(?=\\s)",["function|global|return|try|catch|if|else|while|for|__END__"],"im"),lookbehind:!0},constant:a("\\b<<0>>\\b",["MT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)"]),"builtin-function":[{pattern:a("(\\b\\.)(?:<<0>>)\\b(?=[^\\.])",[i],"i"),lookbehind:!0,alias:"function"},{pattern:a("\\b(?:<<0>>)(?=\\s*\\()",[n],"i"),alias:"function"}],function:{pattern:/\b[a-z_]\w*(?=\s*\()/i,inside:{keyword:{pattern:a("\\b(?:<<0>>)\\b",[r],"i")}}},"line-continuation":{pattern:/(^\s*)\\|\\(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},operator:/\+\+?|!=?|<=?|>=?|==?|&&|\|\||\?|\*|\/|%|:/,number:/\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i,punctuation:/[{};(),.]/}}(Prism),Prism.languages.avs=Prism.languages.avisynth; \ No newline at end of file +!function(e){function a(e,a,r){return RegExp(function(e,r){return e.replace(/<<(\d+)>>/g,function(e,a){return r[+a]})}(e,a),r||"")}var r="clip|int|float|string|bool|val",t=[["is(?:bool|clip|float|int|string)|defined|(?:var|(?:internal)?function)?exists?","apply|assert|default|eval|import|select|nop|undefined","set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment)|opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))","hex(?:value)?|value","max|min|muldiv|floor|ceil|round|fmod|pi|exp|log(?:10)?|pow|sqrt|abs|sign|frac|rand|spline|continued(?:numerator|denominator)?","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(?:luma|chroma[uv]|[bgr])|(?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)?|[yuvrgb]plane(?:median|min|max|minmaxdifference)","script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?)|setlogparams|logmsg|getprocessinfo","[lu]case|str(?:toutf8|fromutf8|len|cmpi?)|(?:rev|left|right|mid|find|replace|fill)str|format|trim(?:left|right|all)|chr|ord|time","version(?:number|string)|isversionorgreater","buildpixeltype|colorspacenametopixeltype","setfiltermtmode|prefetch|addautoloaddir|on(?:cpu|cuda)"].join("|"),["has(?:audio|video)","width|height","frame(?:count|rate)|framerate(?:numerator|denominator)","is(?:field|frame)based|getparity","pixeltype|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|hasalpha|componentsize|numcomponents|bitspercomponent","audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits)|isaudio(?:float|int)"].join("|"),["avi(?:file)?source|opendmlsource|directshowsource|image(?:reader|source|sourceanim)|segmented(?:avisource|directshowsource)|wavsource","coloryuv|convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2)|convertbacktoyuy2|fixluminance|gr[ae]yscale|invert|levels|limiter|mergea?rgb|merge(?:luma|chroma)|rgbadjust|show(?:red|green|blue|alpha)|swapuv|tweak|[uv]toy8?|ytouv","(?:colorkey|reset)mask|mask(?:hs)?|layer|merge|overlay|subtract","addborders|crop(?:bottom)?|flip(?:horizontal|vertical)|letterbox|(?:horizontal|vertical)?reduceby2|(?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize|skewrows|turn(?:left|right|180)","blur|sharpen|generalconvolution|(?:spatial|temporal)soften|fixbrokenchromaupsampling","trim|(?:un)?alignedsplice|(?:assume|assumescaled|change|convert)FPS|(?:delete|duplicate)frame|dissolve|fade(?:in|out|io)[02]?|freezeframe|interleave|loop|reverse|select(?:even|odd|(?:range)?every)","assume(?:frame|field)based|assume[bt]ff|bob|complementparity|doubleweave|peculiarblend|pulldown|separate(?:columns|rows|fields)|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|supereq|ssrc|timestretch","conditional(?:filter|select|reader)|frameevaluate|scriptclip|writefile(?:if|start|end)?|animate|applyrange|tcp(?:server|source)","imagewriter","subtitle|blankclip|blackness|colorbars(?:hd)?|compare|dumpfiltergraph|setgraphanalysis|echo|histogram|info|messageclip|preroll|showfiveversions|show(?:framenumber|smpte|time)|stack(?:horizontal|vertical)|tone|version"].join("|")].join("|");e.languages.avisynth={comment:[{pattern:/(^|[^\\])\[\*(?:[^\[*]|\[(?!\*)|\*(?!\])|\[\*(?:[^\[*]|\[(?!\*)|\*(?!\]))*\*\])*\*\]/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],argument:{pattern:a('\\b(?:<<0>>)\\s+("?)\\w+\\1',[r],"i"),inside:{keyword:/^\w+/}},"argument-label":{pattern:/([,(][\s\\]*)\w+\s*=(?!=)/,lookbehind:!0,inside:{"argument-name":{pattern:/^\w+/,alias:"punctuation"},punctuation:/=$/}},string:[{pattern:/"""[\s\S]*?"""/,greedy:!0},{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0,inside:{constant:{pattern:/\b(?:DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS)\b/}}}],variable:/\b(?:last)\b/i,boolean:/\b(?:true|false|yes|no)\b/i,keyword:{pattern:a("((?:^|[\\\\{])\\s*)(?:<<0>>)(?=\\s)",["function|global|return|try|catch|if|else|while|for|__END__"],"im"),lookbehind:!0},constant:/\bMT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)\b/,"builtin-function":{pattern:a("\\b(?:<<0>>)\\b(?!\\s*=)",[t],"i"),alias:"function"},function:{pattern:/\b[a-z_]\w*(?=\s*\()|(\.)[a-z_]\w*\b/i,lookbehind:!0,inside:{keyword:{pattern:a("\\b(?:<<0>>)\\b",[r],"i")}}},"line-continuation":{pattern:/(^[ \t]*)\\|\\(?=[ \t]*$)/m,lookbehind:!0,alias:"punctuation"},operator:/\+\+?|!=?|<=?|>=?|==?|&&|\|\||\?|\*|\/|%|:/,number:/\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i,punctuation:/[{}\[\]();,.]/},e.languages.avs=e.languages.avisynth}(Prism); \ No newline at end of file diff --git a/tests/languages/avisynth/clipproperties_feature.test b/tests/languages/avisynth/clipproperties_feature.test index 2064210d4d..b285d906b7 100644 --- a/tests/languages/avisynth/clipproperties_feature.test +++ b/tests/languages/avisynth/clipproperties_feature.test @@ -50,7 +50,7 @@ c.audiobits audiobits( c.isaudiofloat isaudiofloat( c.isaudioint isaudioint( -.audiobits +xyzisaudiointxyz ---------------------------------------------------- @@ -349,11 +349,11 @@ c.isaudioint isaudioint( ["builtin-function", "isaudioint"], ["punctuation", "("], - ["punctuation", "."], "audiobits" + "\r\n\r\nxyzisaudiointxyz" ] ---------------------------------------------------- -Internal clip properties can appear after a . character following an identifier. -Internal clip properties can also be used like functions. -The . character before a clip property must immediately proceed an identifier. +All internal functions, filters, and properties can be used in the following formats: +intFunc == intFunc() == last.intFunc == last.intFunc() +They must not appear within other words. diff --git a/tests/languages/avisynth/comments_strings_predefines_feature.test b/tests/languages/avisynth/comments_strings_predefines_feature.test index bc15a4bf6b..b6575acf5d 100644 --- a/tests/languages/avisynth/comments_strings_predefines_feature.test +++ b/tests/languages/avisynth/comments_strings_predefines_feature.test @@ -1,4 +1,4 @@ -[* comment global DEFAULT_MT_MODE *] +[* comment [* global *] DEFAULT_MT_MODE *] notacomment @@ -37,7 +37,7 @@ string""" "machine_classic_plugins" DEFAULT_MT_MODE -SCRIPTDIR +# SCRIPTDIR is also an internal function MAINSCRIPTDIR PROGRAMDIR USER_PLUS_PLUGINS @@ -48,7 +48,7 @@ MACHINE_CLASSIC_PLUGINS ---------------------------------------------------- [ - ["comment", "[* comment global DEFAULT_MT_MODE *]"], + ["comment", "[* comment [* global *] DEFAULT_MT_MODE *]"], "\r\n\r\nnotacomment\r\n\r\n", @@ -114,7 +114,9 @@ MACHINE_CLASSIC_PLUGINS ["string", ["\"user_classic_plugins\""]], ["string", ["\"machine_classic_plugins\""]], - "\r\n\r\nDEFAULT_MT_MODE\r\nSCRIPTDIR\r\nMAINSCRIPTDIR\r\nPROGRAMDIR\r\nUSER_PLUS_PLUGINS\r\nMACHINE_PLUS_PLUGINS\r\nUSER_CLASSIC_PLUGINS\r\nMACHINE_CLASSIC_PLUGINS" + "\r\n\r\nDEFAULT_MT_MODE\r\n", + ["comment", "# SCRIPTDIR is also an internal function"], + "\r\nMAINSCRIPTDIR\r\nPROGRAMDIR\r\nUSER_PLUS_PLUGINS\r\nMACHINE_PLUS_PLUGINS\r\nUSER_CLASSIC_PLUGINS\r\nMACHINE_CLASSIC_PLUGINS" ] ---------------------------------------------------- diff --git a/tests/languages/avisynth/intenalfuncs_feature.test b/tests/languages/avisynth/intenalfuncs_feature.test index 4fdf9b2f9a..730e9f557f 100644 --- a/tests/languages/avisynth/intenalfuncs_feature.test +++ b/tests/languages/avisynth/intenalfuncs_feature.test @@ -1,393 +1,391 @@ -isbool ( -isclip ( -isfloat ( -isint ( -isstring ( -exist ( -defined ( -functionexists ( -internalfunctionexists ( -varexist ( +isbool +isclip +isfloat +isint +isstring +exist +defined +functionexists +internalfunctionexists +varexist -apply ( -eval ( -import ( -select ( -default ( -assert ( -nop ( -undefined ( +apply +eval +import +select +default +assert +nop +undefined -setmemorymax ( -setcachemode ( -setmaxcpu ( -setworkingdir ( -setplanarlegacyalignment ( -opt_allowfloataudio ( -opt_usewaveextensible ( -opt_dwchannelmask ( -opt_avipadscanlines ( -opt_vdubplanarhack ( -opt_enable_v210 ( -opt_enable_y3_10_10 ( -opt_enable_y3_10_16 ( -opt_enable_b64a ( -opt_enable_planartopackedrgb ( +setmemorymax +setcachemode +setmaxcpu +setworkingdir +setplanarlegacyalignment +opt_allowfloataudio +opt_usewaveextensible +opt_dwchannelmask +opt_avipadscanlines +opt_vdubplanarhack +opt_enable_v210 +opt_enable_y3_10_10 +opt_enable_y3_10_16 +opt_enable_b64a +opt_enable_planartopackedrgb -value ( -hexvalue ( -hex ( - -max ( -min ( -muldiv ( -floor ( -ceil ( -round ( -fmod ( -pi ( -exp ( -log ( -log10 ( -pow ( -sqrt ( -abs ( -sign ( -frac ( -rand ( -spline ( -continuednumerator ( -continueddenominator ( +value +hexvalue +hex -sin ( -cos ( -tan ( -asin ( -acos ( -atan ( -atan2 ( -sinh ( -cosh ( -tanh ( - -bitand ( -bitnot ( -bitor ( -bitxor ( -bitlshift ( -bitshl ( -bitsal ( -bitrshifta ( -bitrshifts ( -bitsar ( -bitrshiftl ( -bitrshiftu ( -bitshr ( -bitlrotate ( -bitrol ( -bitrrotatel ( -bitror ( -bittest ( -bittst ( -bitset ( -bitsetcount ( -bitclear ( -bitclr ( -bitchange ( -bitchg ( - -averageluma ( -averagechromau ( -averagechromav ( -averageb ( -averageg ( -averager ( -lumadifference ( -chromaudifference ( -chromavdifference ( -rgbdifference ( -bdifference ( -gdifference ( -rdifference ( -ydifferencefromprevious ( -udifferencefromprevious ( -vdifferencefromprevious ( -rgbdifferencefromprevious ( -bdifferencefromprevious ( -gdifferencefromprevious ( -rdifferencefromprevious ( -ydifferencetonext ( -udifferencetonext ( -vdifferencetonext ( -rgbdifferencetonext ( -rdifferencetonext ( -gdifferencetonext ( -bdifferencetonext ( -yplanemedian ( -uplanemedian ( -vplanemedian ( -bplanemedian ( -gplanemedian ( -rplanemedian ( -yplanemin ( -uplanemin ( -vplanemin ( -bplanemin ( -gplanemin ( -rplanemin ( -yplanemax ( -uplanemax ( -vplanemax ( -bplanemax ( -gplanemax ( -rplanemax ( -yplaneminmaxdifference ( -uplaneminmaxdifference ( -vplaneminmaxdifference ( -bplaneminmaxdifference ( -gplaneminmaxdifference ( -rplaneminmaxdifference ( +max +min +muldiv +floor +ceil +round +fmod +pi +exp +log +log10 +pow +sqrt +abs +sign +frac +rand +spline +continuednumerator +continueddenominator -scriptname ( -scriptnameutf8 ( -scriptfile ( -scriptfileutf8 ( -scriptdir ( -scriptdirutf8 ( -setlogparams ( -logmsg ( -getprocessinfo ( +sin +cos +tan +asin +acos +atan +atan2 +sinh +cosh +tanh -lcase ( -ucase ( -strtoutf8 ( -strfromutf8 ( -strlen ( -revstr ( -leftstr ( -rightstr ( -midstr ( -findstr ( -replacestr ( -format ( -fillstr ( -strcmp ( -strcmpi ( -trimleft ( -trimright ( -trimall ( -chr ( -ord ( -time ( +bitand +bitnot +bitor +bitxor +bitlshift +bitshl +bitsal +bitrshifta +bitrshifts +bitsar +bitrshiftl +bitrshiftu +bitshr +bitlrotate +bitrol +bitrrotatel +bitror +bittest +bittst +bitset +bitsetcount +bitclear +bitclr +bitchange +bitchg -versionnumber ( -versionstring ( -isversionorgreater ( +averageluma +averagechromau +averagechromav +averageb +averageg +averager +lumadifference +chromaudifference +chromavdifference +rgbdifference +bdifference +gdifference +rdifference +ydifferencefromprevious +udifferencefromprevious +vdifferencefromprevious +rgbdifferencefromprevious +bdifferencefromprevious +gdifferencefromprevious +rdifferencefromprevious +ydifferencetonext +udifferencetonext +vdifferencetonext +rgbdifferencetonext +rdifferencetonext +gdifferencetonext +bdifferencetonext +yplanemedian +uplanemedian +vplanemedian +bplanemedian +gplanemedian +rplanemedian +yplanemin +uplanemin +vplanemin +bplanemin +gplanemin +rplanemin +yplanemax +uplanemax +vplanemax +bplanemax +gplanemax +rplanemax +yplaneminmaxdifference +uplaneminmaxdifference +vplaneminmaxdifference +bplaneminmaxdifference +gplaneminmaxdifference +rplaneminmaxdifference -buildpixeltype ( -colorspacenametopixeltype ( +scriptname +scriptnameutf8 +scriptfile +scriptfileutf8 +scriptdir +scriptdirutf8 +setlogparams +logmsg +getprocessinfo + +lcase +ucase +strtoutf8 +strfromutf8 +strlen +revstr +leftstr +rightstr +midstr +findstr +replacestr +format +fillstr +strcmp +strcmpi +trimleft +trimright +trimall +chr +ord +time + +versionnumber +versionstring +isversionorgreater + +buildpixeltype +colorspacenametopixeltype -isbool -isbool.( kevincosner ---------------------------------------------------- [ - ["builtin-function", "isbool"], ["punctuation", "("], - ["builtin-function", "isclip"], ["punctuation", "("], - ["builtin-function", "isfloat"], ["punctuation", "("], - ["builtin-function", "isint"], ["punctuation", "("], - ["builtin-function", "isstring"], ["punctuation", "("], - ["builtin-function", "exist"], ["punctuation", "("], - ["builtin-function", "defined"], ["punctuation", "("], - ["builtin-function", "functionexists"], ["punctuation", "("], - ["builtin-function", "internalfunctionexists"], ["punctuation", "("], - ["builtin-function", "varexist"], ["punctuation", "("], + ["builtin-function", "isbool"], + ["builtin-function", "isclip"], + ["builtin-function", "isfloat"], + ["builtin-function", "isint"], + ["builtin-function", "isstring"], + ["builtin-function", "exist"], + ["builtin-function", "defined"], + ["builtin-function", "functionexists"], + ["builtin-function", "internalfunctionexists"], + ["builtin-function", "varexist"], - ["builtin-function", "apply"], ["punctuation", "("], - ["builtin-function", "eval"], ["punctuation", "("], - ["builtin-function", "import"], ["punctuation", "("], - ["builtin-function", "select"], ["punctuation", "("], - ["builtin-function", "default"], ["punctuation", "("], - ["builtin-function", "assert"], ["punctuation", "("], - ["builtin-function", "nop"], ["punctuation", "("], - ["builtin-function", "undefined"], ["punctuation", "("], + ["builtin-function", "apply"], + ["builtin-function", "eval"], + ["builtin-function", "import"], + ["builtin-function", "select"], + ["builtin-function", "default"], + ["builtin-function", "assert"], + ["builtin-function", "nop"], + ["builtin-function", "undefined"], - ["builtin-function", "setmemorymax"], ["punctuation", "("], - ["builtin-function", "setcachemode"], ["punctuation", "("], - ["builtin-function", "setmaxcpu"], ["punctuation", "("], - ["builtin-function", "setworkingdir"], ["punctuation", "("], - ["builtin-function", "setplanarlegacyalignment"], ["punctuation", "("], - ["builtin-function", "opt_allowfloataudio"], ["punctuation", "("], - ["builtin-function", "opt_usewaveextensible"], ["punctuation", "("], - ["builtin-function", "opt_dwchannelmask"], ["punctuation", "("], - ["builtin-function", "opt_avipadscanlines"], ["punctuation", "("], - ["builtin-function", "opt_vdubplanarhack"], ["punctuation", "("], - ["builtin-function", "opt_enable_v210"], ["punctuation", "("], - ["builtin-function", "opt_enable_y3_10_10"], ["punctuation", "("], - ["builtin-function", "opt_enable_y3_10_16"], ["punctuation", "("], - ["builtin-function", "opt_enable_b64a"], ["punctuation", "("], - ["builtin-function", "opt_enable_planartopackedrgb"], ["punctuation", "("], + ["builtin-function", "setmemorymax"], + ["builtin-function", "setcachemode"], + ["builtin-function", "setmaxcpu"], + ["builtin-function", "setworkingdir"], + ["builtin-function", "setplanarlegacyalignment"], + ["builtin-function", "opt_allowfloataudio"], + ["builtin-function", "opt_usewaveextensible"], + ["builtin-function", "opt_dwchannelmask"], + ["builtin-function", "opt_avipadscanlines"], + ["builtin-function", "opt_vdubplanarhack"], + ["builtin-function", "opt_enable_v210"], + ["builtin-function", "opt_enable_y3_10_10"], + ["builtin-function", "opt_enable_y3_10_16"], + ["builtin-function", "opt_enable_b64a"], + ["builtin-function", "opt_enable_planartopackedrgb"], - ["builtin-function", "value"], ["punctuation", "("], - ["builtin-function", "hexvalue"], ["punctuation", "("], - ["builtin-function", "hex"], ["punctuation", "("], + ["builtin-function", "value"], + ["builtin-function", "hexvalue"], + ["builtin-function", "hex"], - ["builtin-function", "max"], ["punctuation", "("], - ["builtin-function", "min"], ["punctuation", "("], - ["builtin-function", "muldiv"], ["punctuation", "("], - ["builtin-function", "floor"], ["punctuation", "("], - ["builtin-function", "ceil"], ["punctuation", "("], - ["builtin-function", "round"], ["punctuation", "("], - ["builtin-function", "fmod"], ["punctuation", "("], - ["builtin-function", "pi"], ["punctuation", "("], - ["builtin-function", "exp"], ["punctuation", "("], - ["builtin-function", "log"], ["punctuation", "("], - ["builtin-function", "log10"], ["punctuation", "("], - ["builtin-function", "pow"], ["punctuation", "("], - ["builtin-function", "sqrt"], ["punctuation", "("], - ["builtin-function", "abs"], ["punctuation", "("], - ["builtin-function", "sign"], ["punctuation", "("], - ["builtin-function", "frac"], ["punctuation", "("], - ["builtin-function", "rand"], ["punctuation", "("], - ["builtin-function", "spline"], ["punctuation", "("], - ["builtin-function", "continuednumerator"], ["punctuation", "("], - ["builtin-function", "continueddenominator"], ["punctuation", "("], + ["builtin-function", "max"], + ["builtin-function", "min"], + ["builtin-function", "muldiv"], + ["builtin-function", "floor"], + ["builtin-function", "ceil"], + ["builtin-function", "round"], + ["builtin-function", "fmod"], + ["builtin-function", "pi"], + ["builtin-function", "exp"], + ["builtin-function", "log"], + ["builtin-function", "log10"], + ["builtin-function", "pow"], + ["builtin-function", "sqrt"], + ["builtin-function", "abs"], + ["builtin-function", "sign"], + ["builtin-function", "frac"], + ["builtin-function", "rand"], + ["builtin-function", "spline"], + ["builtin-function", "continuednumerator"], + ["builtin-function", "continueddenominator"], - ["builtin-function", "sin"], ["punctuation", "("], - ["builtin-function", "cos"], ["punctuation", "("], - ["builtin-function", "tan"], ["punctuation", "("], - ["builtin-function", "asin"], ["punctuation", "("], - ["builtin-function", "acos"], ["punctuation", "("], - ["builtin-function", "atan"], ["punctuation", "("], - ["builtin-function", "atan2"], ["punctuation", "("], - ["builtin-function", "sinh"], ["punctuation", "("], - ["builtin-function", "cosh"], ["punctuation", "("], - ["builtin-function", "tanh"], ["punctuation", "("], + ["builtin-function", "sin"], + ["builtin-function", "cos"], + ["builtin-function", "tan"], + ["builtin-function", "asin"], + ["builtin-function", "acos"], + ["builtin-function", "atan"], + ["builtin-function", "atan2"], + ["builtin-function", "sinh"], + ["builtin-function", "cosh"], + ["builtin-function", "tanh"], - ["builtin-function", "bitand"], ["punctuation", "("], - ["builtin-function", "bitnot"], ["punctuation", "("], - ["builtin-function", "bitor"], ["punctuation", "("], - ["builtin-function", "bitxor"], ["punctuation", "("], - ["builtin-function", "bitlshift"], ["punctuation", "("], - ["builtin-function", "bitshl"], ["punctuation", "("], - ["builtin-function", "bitsal"], ["punctuation", "("], - ["builtin-function", "bitrshifta"], ["punctuation", "("], - ["builtin-function", "bitrshifts"], ["punctuation", "("], - ["builtin-function", "bitsar"], ["punctuation", "("], - ["builtin-function", "bitrshiftl"], ["punctuation", "("], - ["builtin-function", "bitrshiftu"], ["punctuation", "("], - ["builtin-function", "bitshr"], ["punctuation", "("], - ["builtin-function", "bitlrotate"], ["punctuation", "("], - ["builtin-function", "bitrol"], ["punctuation", "("], - ["builtin-function", "bitrrotatel"], ["punctuation", "("], - ["builtin-function", "bitror"], ["punctuation", "("], - ["builtin-function", "bittest"], ["punctuation", "("], - ["builtin-function", "bittst"], ["punctuation", "("], - ["builtin-function", "bitset"], ["punctuation", "("], - ["builtin-function", "bitsetcount"], ["punctuation", "("], - ["builtin-function", "bitclear"], ["punctuation", "("], - ["builtin-function", "bitclr"], ["punctuation", "("], - ["builtin-function", "bitchange"], ["punctuation", "("], - ["builtin-function", "bitchg"], ["punctuation", "("], + ["builtin-function", "bitand"], + ["builtin-function", "bitnot"], + ["builtin-function", "bitor"], + ["builtin-function", "bitxor"], + ["builtin-function", "bitlshift"], + ["builtin-function", "bitshl"], + ["builtin-function", "bitsal"], + ["builtin-function", "bitrshifta"], + ["builtin-function", "bitrshifts"], + ["builtin-function", "bitsar"], + ["builtin-function", "bitrshiftl"], + ["builtin-function", "bitrshiftu"], + ["builtin-function", "bitshr"], + ["builtin-function", "bitlrotate"], + ["builtin-function", "bitrol"], + ["builtin-function", "bitrrotatel"], + ["builtin-function", "bitror"], + ["builtin-function", "bittest"], + ["builtin-function", "bittst"], + ["builtin-function", "bitset"], + ["builtin-function", "bitsetcount"], + ["builtin-function", "bitclear"], + ["builtin-function", "bitclr"], + ["builtin-function", "bitchange"], + ["builtin-function", "bitchg"], - ["builtin-function", "averageluma"], ["punctuation", "("], - ["builtin-function", "averagechromau"], ["punctuation", "("], - ["builtin-function", "averagechromav"], ["punctuation", "("], - ["builtin-function", "averageb"], ["punctuation", "("], - ["builtin-function", "averageg"], ["punctuation", "("], - ["builtin-function", "averager"], ["punctuation", "("], - ["builtin-function", "lumadifference"], ["punctuation", "("], - ["builtin-function", "chromaudifference"], ["punctuation", "("], - ["builtin-function", "chromavdifference"], ["punctuation", "("], - ["builtin-function", "rgbdifference"], ["punctuation", "("], - ["builtin-function", "bdifference"], ["punctuation", "("], - ["builtin-function", "gdifference"], ["punctuation", "("], - ["builtin-function", "rdifference"], ["punctuation", "("], - ["builtin-function", "ydifferencefromprevious"], ["punctuation", "("], - ["builtin-function", "udifferencefromprevious"], ["punctuation", "("], - ["builtin-function", "vdifferencefromprevious"], ["punctuation", "("], - ["builtin-function", "rgbdifferencefromprevious"], ["punctuation", "("], - ["builtin-function", "bdifferencefromprevious"], ["punctuation", "("], - ["builtin-function", "gdifferencefromprevious"], ["punctuation", "("], - ["builtin-function", "rdifferencefromprevious"], ["punctuation", "("], - ["builtin-function", "ydifferencetonext"], ["punctuation", "("], - ["builtin-function", "udifferencetonext"], ["punctuation", "("], - ["builtin-function", "vdifferencetonext"], ["punctuation", "("], - ["builtin-function", "rgbdifferencetonext"], ["punctuation", "("], - ["builtin-function", "rdifferencetonext"], ["punctuation", "("], - ["builtin-function", "gdifferencetonext"], ["punctuation", "("], - ["builtin-function", "bdifferencetonext"], ["punctuation", "("], - ["builtin-function", "yplanemedian"], ["punctuation", "("], - ["builtin-function", "uplanemedian"], ["punctuation", "("], - ["builtin-function", "vplanemedian"], ["punctuation", "("], - ["builtin-function", "bplanemedian"], ["punctuation", "("], - ["builtin-function", "gplanemedian"], ["punctuation", "("], - ["builtin-function", "rplanemedian"], ["punctuation", "("], - ["builtin-function", "yplanemin"], ["punctuation", "("], - ["builtin-function", "uplanemin"], ["punctuation", "("], - ["builtin-function", "vplanemin"], ["punctuation", "("], - ["builtin-function", "bplanemin"], ["punctuation", "("], - ["builtin-function", "gplanemin"], ["punctuation", "("], - ["builtin-function", "rplanemin"], ["punctuation", "("], - ["builtin-function", "yplanemax"], ["punctuation", "("], - ["builtin-function", "uplanemax"], ["punctuation", "("], - ["builtin-function", "vplanemax"], ["punctuation", "("], - ["builtin-function", "bplanemax"], ["punctuation", "("], - ["builtin-function", "gplanemax"], ["punctuation", "("], - ["builtin-function", "rplanemax"], ["punctuation", "("], - ["builtin-function", "yplaneminmaxdifference"], ["punctuation", "("], - ["builtin-function", "uplaneminmaxdifference"], ["punctuation", "("], - ["builtin-function", "vplaneminmaxdifference"], ["punctuation", "("], - ["builtin-function", "bplaneminmaxdifference"], ["punctuation", "("], - ["builtin-function", "gplaneminmaxdifference"], ["punctuation", "("], - ["builtin-function", "rplaneminmaxdifference"], ["punctuation", "("], + ["builtin-function", "averageluma"], + ["builtin-function", "averagechromau"], + ["builtin-function", "averagechromav"], + ["builtin-function", "averageb"], + ["builtin-function", "averageg"], + ["builtin-function", "averager"], + ["builtin-function", "lumadifference"], + ["builtin-function", "chromaudifference"], + ["builtin-function", "chromavdifference"], + ["builtin-function", "rgbdifference"], + ["builtin-function", "bdifference"], + ["builtin-function", "gdifference"], + ["builtin-function", "rdifference"], + ["builtin-function", "ydifferencefromprevious"], + ["builtin-function", "udifferencefromprevious"], + ["builtin-function", "vdifferencefromprevious"], + ["builtin-function", "rgbdifferencefromprevious"], + ["builtin-function", "bdifferencefromprevious"], + ["builtin-function", "gdifferencefromprevious"], + ["builtin-function", "rdifferencefromprevious"], + ["builtin-function", "ydifferencetonext"], + ["builtin-function", "udifferencetonext"], + ["builtin-function", "vdifferencetonext"], + ["builtin-function", "rgbdifferencetonext"], + ["builtin-function", "rdifferencetonext"], + ["builtin-function", "gdifferencetonext"], + ["builtin-function", "bdifferencetonext"], + ["builtin-function", "yplanemedian"], + ["builtin-function", "uplanemedian"], + ["builtin-function", "vplanemedian"], + ["builtin-function", "bplanemedian"], + ["builtin-function", "gplanemedian"], + ["builtin-function", "rplanemedian"], + ["builtin-function", "yplanemin"], + ["builtin-function", "uplanemin"], + ["builtin-function", "vplanemin"], + ["builtin-function", "bplanemin"], + ["builtin-function", "gplanemin"], + ["builtin-function", "rplanemin"], + ["builtin-function", "yplanemax"], + ["builtin-function", "uplanemax"], + ["builtin-function", "vplanemax"], + ["builtin-function", "bplanemax"], + ["builtin-function", "gplanemax"], + ["builtin-function", "rplanemax"], + ["builtin-function", "yplaneminmaxdifference"], + ["builtin-function", "uplaneminmaxdifference"], + ["builtin-function", "vplaneminmaxdifference"], + ["builtin-function", "bplaneminmaxdifference"], + ["builtin-function", "gplaneminmaxdifference"], + ["builtin-function", "rplaneminmaxdifference"], - ["builtin-function", "scriptname"], ["punctuation", "("], - ["builtin-function", "scriptnameutf8"], ["punctuation", "("], - ["builtin-function", "scriptfile"], ["punctuation", "("], - ["builtin-function", "scriptfileutf8"], ["punctuation", "("], - ["builtin-function", "scriptdir"], ["punctuation", "("], - ["builtin-function", "scriptdirutf8"], ["punctuation", "("], - ["builtin-function", "setlogparams"], ["punctuation", "("], - ["builtin-function", "logmsg"], ["punctuation", "("], - ["builtin-function", "getprocessinfo"], ["punctuation", "("], + ["builtin-function", "scriptname"], + ["builtin-function", "scriptnameutf8"], + ["builtin-function", "scriptfile"], + ["builtin-function", "scriptfileutf8"], + ["builtin-function", "scriptdir"], + ["builtin-function", "scriptdirutf8"], + ["builtin-function", "setlogparams"], + ["builtin-function", "logmsg"], + ["builtin-function", "getprocessinfo"], - ["builtin-function", "lcase"], ["punctuation", "("], - ["builtin-function", "ucase"], ["punctuation", "("], - ["builtin-function", "strtoutf8"], ["punctuation", "("], - ["builtin-function", "strfromutf8"], ["punctuation", "("], - ["builtin-function", "strlen"], ["punctuation", "("], - ["builtin-function", "revstr"], ["punctuation", "("], - ["builtin-function", "leftstr"], ["punctuation", "("], - ["builtin-function", "rightstr"], ["punctuation", "("], - ["builtin-function", "midstr"], ["punctuation", "("], - ["builtin-function", "findstr"], ["punctuation", "("], - ["builtin-function", "replacestr"], ["punctuation", "("], - ["builtin-function", "format"], ["punctuation", "("], - ["builtin-function", "fillstr"], ["punctuation", "("], - ["builtin-function", "strcmp"], ["punctuation", "("], - ["builtin-function", "strcmpi"], ["punctuation", "("], - ["builtin-function", "trimleft"], ["punctuation", "("], - ["builtin-function", "trimright"], ["punctuation", "("], - ["builtin-function", "trimall"], ["punctuation", "("], - ["builtin-function", "chr"], ["punctuation", "("], - ["builtin-function", "ord"], ["punctuation", "("], - ["builtin-function", "time"], ["punctuation", "("], + ["builtin-function", "lcase"], + ["builtin-function", "ucase"], + ["builtin-function", "strtoutf8"], + ["builtin-function", "strfromutf8"], + ["builtin-function", "strlen"], + ["builtin-function", "revstr"], + ["builtin-function", "leftstr"], + ["builtin-function", "rightstr"], + ["builtin-function", "midstr"], + ["builtin-function", "findstr"], + ["builtin-function", "replacestr"], + ["builtin-function", "format"], + ["builtin-function", "fillstr"], + ["builtin-function", "strcmp"], + ["builtin-function", "strcmpi"], + ["builtin-function", "trimleft"], + ["builtin-function", "trimright"], + ["builtin-function", "trimall"], + ["builtin-function", "chr"], + ["builtin-function", "ord"], + ["builtin-function", "time"], - ["builtin-function", "versionnumber"], ["punctuation", "("], - ["builtin-function", "versionstring"], ["punctuation", "("], - ["builtin-function", "isversionorgreater"], ["punctuation", "("], + ["builtin-function", "versionnumber"], + ["builtin-function", "versionstring"], + ["builtin-function", "isversionorgreater"], - ["builtin-function", "buildpixeltype"], ["punctuation", "("], - ["builtin-function", "colorspacenametopixeltype"], ["punctuation", "("], + ["builtin-function", "buildpixeltype"], + ["builtin-function", "colorspacenametopixeltype"], - "\r\n\r\nisbool\r\nisbool", ["punctuation", "."], ["punctuation", "("], - "\r\nkevincosner" + "\r\n\r\nkevincosner" ] ---------------------------------------------------- -Internal functions must simply preceed optional whitespace followed by an opening parenthesis. -They must not be inside of another word. +All internal functions, filters, and properties can be used in the following formats: +intFunc == intFunc() == last.intFunc == last.intFunc() +They must not appear within other words. diff --git a/tests/languages/avisynth/internalfilters_feature.test b/tests/languages/avisynth/internalfilters_feature.test index 7d98108f17..375da954a8 100644 --- a/tests/languages/avisynth/internalfilters_feature.test +++ b/tests/languages/avisynth/internalfilters_feature.test @@ -1,431 +1,429 @@ -avisource ( -avifilesource ( -opendmlsource ( -directshowsource ( -imagereader ( -imagesource ( -imagesourceanim ( -segmentedavisource ( -segmenteddirectshowsource ( -wavsource ( - -coloryuv ( -convertbacktoyuy2 ( -converttorgb ( -converttorgb24 ( -converttorgb32 ( -converttorgb48 ( -converttorgb64 ( -converttoplanarrgb ( -converttoplanarrgba ( -converttoyuy2 ( -converttoyv24 ( -converttoyv16 ( -converttoyv12 ( -converttoy8 ( -converttoyuv444 ( -converttoyuv422 ( -converttoyuv420 ( -converttoyuva444 ( -converttoyuva422 ( -converttoyuva420 ( -converttoyuv411 ( -fixluminance ( -greyscale ( -grayscale ( -invert ( -levels ( -limiter ( -mergergb ( -mergeargb ( -mergeluma ( -mergechroma ( -rgbadjust ( -showred ( -showgreen ( -showblue ( -showalpha ( -swapuv ( -tweak ( -utoy ( -utoy8 ( -vtoy ( -vtoy8 ( -ytouv ( - -colorkeymask ( -layer ( -mask ( -maskhs ( -merge ( -overlay ( -resetmask ( -subtract ( - -addborders ( -crop ( -cropbottom ( -fliphorizontal ( -flipvertical ( -letterbox ( -horizontalreduceby2 ( -verticalreduceby2 ( -reduceby2 ( -bicubicresize ( -bilinearresize ( -blackmanresize ( -gaussresize ( -lanczosresize ( -lanczos4resize ( -pointresize ( -sincresize ( -spline16resize ( -spline36resize ( -spline64resize ( - ( -skewrows ( -turnleft ( -turnright ( -turn180 ( - -blur ( -sharpen ( -generalconvolution ( -spatialsoften ( -temporalsoften ( -fixbrokenchromaupsampling ( - -alignedsplice ( -unalignedsplice ( -assumefps ( -assumescaledfps ( -changefps ( -convertfps ( -deleteframe ( -dissolve ( -duplicateframe ( -fadein0 ( -fadein ( -fadein2 ( -fadeout0 ( -fadeout ( -fadeout2 ( -fadeio0 ( -fadeio ( -fadeio2 ( -freezeframe ( -interleave ( -loop ( -reverse ( -selecteven ( -selectodd ( -selectevery ( -selectrangeevery ( -trim ( - -assumeframebased ( -assumefieldbased ( -assumebff ( -assumetff ( -bob ( -complementparity ( -doubleweave ( -peculiarblend ( -pulldown ( -separatecolumns ( -separaterows ( -separatefields ( -swapfields ( -weave ( -weavecolumns ( -weaverows ( - -amplify ( -amplifydb ( -assumesamplerate ( -audiodub ( -audiodubex ( -audiotrim ( -convertaudioto8bit ( -convertaudioto16bit ( -convertaudioto24bit ( -convertaudioto32bit ( -convertaudiotofloat ( -converttomono ( -delayaudio ( -ensurevbrmp3sync ( -getchannel ( -getleftchannel ( -getrightchannel ( -killaudio ( -killvideo ( -mergechannels ( -mixaudio ( -monotostereo ( -normalize ( -resampleaudio ( -supereq ( -ssrc ( -timestretch ( - ( -conditionalfilter ( -frameevaluate ( -scriptclip ( -conditionalselect ( -conditionalreader ( -writefile ( -writefileif ( -writefilestart ( -writefileend ( -animate ( -applyrange ( -tcpserver ( -tcpsource ( - -imagewriter ( - -blankclip ( -blackness ( -colorbars ( -colorbarshd ( -compare ( -dumpfiltergraph ( -setgraphanalysis ( -echo ( -histogram ( -info ( -messageclip ( -preroll ( -showfiveversions ( -showframenumber ( -showsmpte ( -showtime ( -stackhorizontal ( -stackvertical ( -subtitle ( -tone ( -version ( +avisource +avifilesource +opendmlsource +directshowsource +imagereader +imagesource +imagesourceanim +segmentedavisource +segmenteddirectshowsource +wavsource +coloryuv +convertbacktoyuy2 +converttorgb +converttorgb24 +converttorgb32 +converttorgb48 +converttorgb64 +converttoplanarrgb +converttoplanarrgba +converttoyuy2 +converttoyv24 +converttoyv16 +converttoyv12 +converttoy8 +converttoyuv444 +converttoyuv422 +converttoyuv420 +converttoyuva444 +converttoyuva422 +converttoyuva420 +converttoyuv411 +fixluminance +greyscale +grayscale +invert +levels +limiter +mergergb +mergeargb +mergeluma +mergechroma +rgbadjust +showred +showgreen +showblue +showalpha +swapuv +tweak +utoy +utoy8 +vtoy +vtoy8 +ytouv + +colorkeymask +layer +mask +maskhs +merge +overlay +resetmask +subtract + +addborders +crop +cropbottom +fliphorizontal +flipvertical +letterbox +horizontalreduceby2 +verticalreduceby2 +reduceby2 +bicubicresize +bilinearresize +blackmanresize +gaussresize +lanczosresize +lanczos4resize +pointresize +sincresize +spline16resize +spline36resize +spline64resize + +skewrows +turnleft +turnright +turn180 + +blur +sharpen +generalconvolution +spatialsoften +temporalsoften +fixbrokenchromaupsampling + +alignedsplice +unalignedsplice +assumefps +assumescaledfps +changefps +convertfps +deleteframe +dissolve +duplicateframe +fadein0 +fadein +fadein2 +fadeout0 +fadeout +fadeout2 +fadeio0 +fadeio +fadeio2 +freezeframe +interleave +loop +reverse +selecteven +selectodd +selectevery +selectrangeevery +trim + +assumeframebased +assumefieldbased +assumebff +assumetff +bob +complementparity +doubleweave +peculiarblend +pulldown +separatecolumns +separaterows +separatefields +swapfields +weave +weavecolumns +weaverows + +amplify +amplifydb +assumesamplerate +audiodub +audiodubex +audiotrim +convertaudioto8bit +convertaudioto16bit +convertaudioto24bit +convertaudioto32bit +convertaudiotofloat +converttomono +delayaudio +ensurevbrmp3sync +getchannel +getleftchannel +getrightchannel +killaudio +killvideo +mergechannels +mixaudio +monotostereo +normalize +resampleaudio +supereq +ssrc +timestretch + +conditionalfilter +frameevaluate +scriptclip +conditionalselect +conditionalreader +writefile +writefileif +writefilestart +writefileend +animate +applyrange +tcpserver +tcpsource + +imagewriter + +blankclip +blackness +colorbars +colorbarshd +compare +dumpfiltergraph +setgraphanalysis +echo +histogram +info +messageclip +preroll +showfiveversions +showframenumber +showsmpte +showtime +stackhorizontal +stackvertical +subtitle tone -tone.( -pantone ( +version + +pantone ---------------------------------------------------- [ - ["builtin-function", "avisource"], ["punctuation", "("], - ["builtin-function", "avifilesource"], ["punctuation", "("], - ["builtin-function", "opendmlsource"], ["punctuation", "("], - ["builtin-function", "directshowsource"], ["punctuation", "("], - ["builtin-function", "imagereader"], ["punctuation", "("], - ["builtin-function", "imagesource"], ["punctuation", "("], - ["builtin-function", "imagesourceanim"], ["punctuation", "("], - ["builtin-function", "segmentedavisource"], ["punctuation", "("], - ["builtin-function", "segmenteddirectshowsource"], ["punctuation", "("], - ["builtin-function", "wavsource"], ["punctuation", "("], + ["builtin-function", "avisource"], + ["builtin-function", "avifilesource"], + ["builtin-function", "opendmlsource"], + ["builtin-function", "directshowsource"], + ["builtin-function", "imagereader"], + ["builtin-function", "imagesource"], + ["builtin-function", "imagesourceanim"], + ["builtin-function", "segmentedavisource"], + ["builtin-function", "segmenteddirectshowsource"], + ["builtin-function", "wavsource"], + + ["builtin-function", "coloryuv"], + ["builtin-function", "convertbacktoyuy2"], + ["builtin-function", "converttorgb"], + ["builtin-function", "converttorgb24"], + ["builtin-function", "converttorgb32"], + ["builtin-function", "converttorgb48"], + ["builtin-function", "converttorgb64"], + ["builtin-function", "converttoplanarrgb"], + ["builtin-function", "converttoplanarrgba"], + ["builtin-function", "converttoyuy2"], + ["builtin-function", "converttoyv24"], + ["builtin-function", "converttoyv16"], + ["builtin-function", "converttoyv12"], + ["builtin-function", "converttoy8"], + ["builtin-function", "converttoyuv444"], + ["builtin-function", "converttoyuv422"], + ["builtin-function", "converttoyuv420"], + ["builtin-function", "converttoyuva444"], + ["builtin-function", "converttoyuva422"], + ["builtin-function", "converttoyuva420"], + ["builtin-function", "converttoyuv411"], + ["builtin-function", "fixluminance"], + ["builtin-function", "greyscale"], + ["builtin-function", "grayscale"], + ["builtin-function", "invert"], + ["builtin-function", "levels"], + ["builtin-function", "limiter"], + ["builtin-function", "mergergb"], + ["builtin-function", "mergeargb"], + ["builtin-function", "mergeluma"], + ["builtin-function", "mergechroma"], + ["builtin-function", "rgbadjust"], + ["builtin-function", "showred"], + ["builtin-function", "showgreen"], + ["builtin-function", "showblue"], + ["builtin-function", "showalpha"], + ["builtin-function", "swapuv"], + ["builtin-function", "tweak"], + ["builtin-function", "utoy"], + ["builtin-function", "utoy8"], + ["builtin-function", "vtoy"], + ["builtin-function", "vtoy8"], + ["builtin-function", "ytouv"], + + ["builtin-function", "colorkeymask"], + ["builtin-function", "layer"], + ["builtin-function", "mask"], + ["builtin-function", "maskhs"], + ["builtin-function", "merge"], + ["builtin-function", "overlay"], + ["builtin-function", "resetmask"], + ["builtin-function", "subtract"], - ["builtin-function", "coloryuv"], ["punctuation", "("], - ["builtin-function", "convertbacktoyuy2"], ["punctuation", "("], - ["builtin-function", "converttorgb"], ["punctuation", "("], - ["builtin-function", "converttorgb24"], ["punctuation", "("], - ["builtin-function", "converttorgb32"], ["punctuation", "("], - ["builtin-function", "converttorgb48"], ["punctuation", "("], - ["builtin-function", "converttorgb64"], ["punctuation", "("], - ["builtin-function", "converttoplanarrgb"], ["punctuation", "("], - ["builtin-function", "converttoplanarrgba"], ["punctuation", "("], - ["builtin-function", "converttoyuy2"], ["punctuation", "("], - ["builtin-function", "converttoyv24"], ["punctuation", "("], - ["builtin-function", "converttoyv16"], ["punctuation", "("], - ["builtin-function", "converttoyv12"], ["punctuation", "("], - ["builtin-function", "converttoy8"], ["punctuation", "("], - ["builtin-function", "converttoyuv444"], ["punctuation", "("], - ["builtin-function", "converttoyuv422"], ["punctuation", "("], - ["builtin-function", "converttoyuv420"], ["punctuation", "("], - ["builtin-function", "converttoyuva444"], ["punctuation", "("], - ["builtin-function", "converttoyuva422"], ["punctuation", "("], - ["builtin-function", "converttoyuva420"], ["punctuation", "("], - ["builtin-function", "converttoyuv411"], ["punctuation", "("], - ["builtin-function", "fixluminance"], ["punctuation", "("], - ["builtin-function", "greyscale"], ["punctuation", "("], - ["builtin-function", "grayscale"], ["punctuation", "("], - ["builtin-function", "invert"], ["punctuation", "("], - ["builtin-function", "levels"], ["punctuation", "("], - ["builtin-function", "limiter"], ["punctuation", "("], - ["builtin-function", "mergergb"], ["punctuation", "("], - ["builtin-function", "mergeargb"], ["punctuation", "("], - ["builtin-function", "mergeluma"], ["punctuation", "("], - ["builtin-function", "mergechroma"], ["punctuation", "("], - ["builtin-function", "rgbadjust"], ["punctuation", "("], - ["builtin-function", "showred"], ["punctuation", "("], - ["builtin-function", "showgreen"], ["punctuation", "("], - ["builtin-function", "showblue"], ["punctuation", "("], - ["builtin-function", "showalpha"], ["punctuation", "("], - ["builtin-function", "swapuv"], ["punctuation", "("], - ["builtin-function", "tweak"], ["punctuation", "("], - ["builtin-function", "utoy"], ["punctuation", "("], - ["builtin-function", "utoy8"], ["punctuation", "("], - ["builtin-function", "vtoy"], ["punctuation", "("], - ["builtin-function", "vtoy8"], ["punctuation", "("], - ["builtin-function", "ytouv"], ["punctuation", "("], + ["builtin-function", "addborders"], + ["builtin-function", "crop"], + ["builtin-function", "cropbottom"], + ["builtin-function", "fliphorizontal"], + ["builtin-function", "flipvertical"], + ["builtin-function", "letterbox"], + ["builtin-function", "horizontalreduceby2"], + ["builtin-function", "verticalreduceby2"], + ["builtin-function", "reduceby2"], + ["builtin-function", "bicubicresize"], + ["builtin-function", "bilinearresize"], + ["builtin-function", "blackmanresize"], + ["builtin-function", "gaussresize"], + ["builtin-function", "lanczosresize"], + ["builtin-function", "lanczos4resize"], + ["builtin-function", "pointresize"], + ["builtin-function", "sincresize"], + ["builtin-function", "spline16resize"], + ["builtin-function", "spline36resize"], + ["builtin-function", "spline64resize"], - ["builtin-function", "colorkeymask"], ["punctuation", "("], - ["builtin-function", "layer"], ["punctuation", "("], - ["builtin-function", "mask"], ["punctuation", "("], - ["builtin-function", "maskhs"], ["punctuation", "("], - ["builtin-function", "merge"], ["punctuation", "("], - ["builtin-function", "overlay"], ["punctuation", "("], - ["builtin-function", "resetmask"], ["punctuation", "("], - ["builtin-function", "subtract"], ["punctuation", "("], + ["builtin-function", "skewrows"], + ["builtin-function", "turnleft"], + ["builtin-function", "turnright"], + ["builtin-function", "turn180"], - ["builtin-function", "addborders"], ["punctuation", "("], - ["builtin-function", "crop"], ["punctuation", "("], - ["builtin-function", "cropbottom"], ["punctuation", "("], - ["builtin-function", "fliphorizontal"], ["punctuation", "("], - ["builtin-function", "flipvertical"], ["punctuation", "("], - ["builtin-function", "letterbox"], ["punctuation", "("], - ["builtin-function", "horizontalreduceby2"], ["punctuation", "("], - ["builtin-function", "verticalreduceby2"], ["punctuation", "("], - ["builtin-function", "reduceby2"], ["punctuation", "("], - ["builtin-function", "bicubicresize"], ["punctuation", "("], - ["builtin-function", "bilinearresize"], ["punctuation", "("], - ["builtin-function", "blackmanresize"], ["punctuation", "("], - ["builtin-function", "gaussresize"], ["punctuation", "("], - ["builtin-function", "lanczosresize"], ["punctuation", "("], - ["builtin-function", "lanczos4resize"], ["punctuation", "("], - ["builtin-function", "pointresize"], ["punctuation", "("], - ["builtin-function", "sincresize"], ["punctuation", "("], - ["builtin-function", "spline16resize"], ["punctuation", "("], - ["builtin-function", "spline36resize"], ["punctuation", "("], - ["builtin-function", "spline64resize"], ["punctuation", "("], - ["punctuation", "("], - ["builtin-function", "skewrows"], ["punctuation", "("], - ["builtin-function", "turnleft"], ["punctuation", "("], - ["builtin-function", "turnright"], ["punctuation", "("], - ["builtin-function", "turn180"], ["punctuation", "("], + ["builtin-function", "blur"], + ["builtin-function", "sharpen"], + ["builtin-function", "generalconvolution"], + ["builtin-function", "spatialsoften"], + ["builtin-function", "temporalsoften"], + ["builtin-function", "fixbrokenchromaupsampling"], - ["builtin-function", "blur"], ["punctuation", "("], - ["builtin-function", "sharpen"], ["punctuation", "("], - ["builtin-function", "generalconvolution"], ["punctuation", "("], - ["builtin-function", "spatialsoften"], ["punctuation", "("], - ["builtin-function", "temporalsoften"], ["punctuation", "("], - ["builtin-function", "fixbrokenchromaupsampling"], ["punctuation", "("], + ["builtin-function", "alignedsplice"], + ["builtin-function", "unalignedsplice"], + ["builtin-function", "assumefps"], + ["builtin-function", "assumescaledfps"], + ["builtin-function", "changefps"], + ["builtin-function", "convertfps"], + ["builtin-function", "deleteframe"], + ["builtin-function", "dissolve"], + ["builtin-function", "duplicateframe"], + ["builtin-function", "fadein0"], + ["builtin-function", "fadein"], + ["builtin-function", "fadein2"], + ["builtin-function", "fadeout0"], + ["builtin-function", "fadeout"], + ["builtin-function", "fadeout2"], + ["builtin-function", "fadeio0"], + ["builtin-function", "fadeio"], + ["builtin-function", "fadeio2"], + ["builtin-function", "freezeframe"], + ["builtin-function", "interleave"], + ["builtin-function", "loop"], + ["builtin-function", "reverse"], + ["builtin-function", "selecteven"], + ["builtin-function", "selectodd"], + ["builtin-function", "selectevery"], + ["builtin-function", "selectrangeevery"], + ["builtin-function", "trim"], - ["builtin-function", "alignedsplice"], ["punctuation", "("], - ["builtin-function", "unalignedsplice"], ["punctuation", "("], - ["builtin-function", "assumefps"], ["punctuation", "("], - ["builtin-function", "assumescaledfps"], ["punctuation", "("], - ["builtin-function", "changefps"], ["punctuation", "("], - ["builtin-function", "convertfps"], ["punctuation", "("], - ["builtin-function", "deleteframe"], ["punctuation", "("], - ["builtin-function", "dissolve"], ["punctuation", "("], - ["builtin-function", "duplicateframe"], ["punctuation", "("], - ["builtin-function", "fadein0"], ["punctuation", "("], - ["builtin-function", "fadein"], ["punctuation", "("], - ["builtin-function", "fadein2"], ["punctuation", "("], - ["builtin-function", "fadeout0"], ["punctuation", "("], - ["builtin-function", "fadeout"], ["punctuation", "("], - ["builtin-function", "fadeout2"], ["punctuation", "("], - ["builtin-function", "fadeio0"], ["punctuation", "("], - ["builtin-function", "fadeio"], ["punctuation", "("], - ["builtin-function", "fadeio2"], ["punctuation", "("], - ["builtin-function", "freezeframe"], ["punctuation", "("], - ["builtin-function", "interleave"], ["punctuation", "("], - ["builtin-function", "loop"], ["punctuation", "("], - ["builtin-function", "reverse"], ["punctuation", "("], - ["builtin-function", "selecteven"], ["punctuation", "("], - ["builtin-function", "selectodd"], ["punctuation", "("], - ["builtin-function", "selectevery"], ["punctuation", "("], - ["builtin-function", "selectrangeevery"], ["punctuation", "("], - ["builtin-function", "trim"], ["punctuation", "("], + ["builtin-function", "assumeframebased"], + ["builtin-function", "assumefieldbased"], + ["builtin-function", "assumebff"], + ["builtin-function", "assumetff"], + ["builtin-function", "bob"], + ["builtin-function", "complementparity"], + ["builtin-function", "doubleweave"], + ["builtin-function", "peculiarblend"], + ["builtin-function", "pulldown"], + ["builtin-function", "separatecolumns"], + ["builtin-function", "separaterows"], + ["builtin-function", "separatefields"], + ["builtin-function", "swapfields"], + ["builtin-function", "weave"], + ["builtin-function", "weavecolumns"], + ["builtin-function", "weaverows"], - ["builtin-function", "assumeframebased"], ["punctuation", "("], - ["builtin-function", "assumefieldbased"], ["punctuation", "("], - ["builtin-function", "assumebff"], ["punctuation", "("], - ["builtin-function", "assumetff"], ["punctuation", "("], - ["builtin-function", "bob"], ["punctuation", "("], - ["builtin-function", "complementparity"], ["punctuation", "("], - ["builtin-function", "doubleweave"], ["punctuation", "("], - ["builtin-function", "peculiarblend"], ["punctuation", "("], - ["builtin-function", "pulldown"], ["punctuation", "("], - ["builtin-function", "separatecolumns"], ["punctuation", "("], - ["builtin-function", "separaterows"], ["punctuation", "("], - ["builtin-function", "separatefields"], ["punctuation", "("], - ["builtin-function", "swapfields"], ["punctuation", "("], - ["builtin-function", "weave"], ["punctuation", "("], - ["builtin-function", "weavecolumns"], ["punctuation", "("], - ["builtin-function", "weaverows"], ["punctuation", "("], + ["builtin-function", "amplify"], + ["builtin-function", "amplifydb"], + ["builtin-function", "assumesamplerate"], + ["builtin-function", "audiodub"], + ["builtin-function", "audiodubex"], + ["builtin-function", "audiotrim"], + ["builtin-function", "convertaudioto8bit"], + ["builtin-function", "convertaudioto16bit"], + ["builtin-function", "convertaudioto24bit"], + ["builtin-function", "convertaudioto32bit"], + ["builtin-function", "convertaudiotofloat"], + ["builtin-function", "converttomono"], + ["builtin-function", "delayaudio"], + ["builtin-function", "ensurevbrmp3sync"], + ["builtin-function", "getchannel"], + ["builtin-function", "getleftchannel"], + ["builtin-function", "getrightchannel"], + ["builtin-function", "killaudio"], + ["builtin-function", "killvideo"], + ["builtin-function", "mergechannels"], + ["builtin-function", "mixaudio"], + ["builtin-function", "monotostereo"], + ["builtin-function", "normalize"], + ["builtin-function", "resampleaudio"], + ["builtin-function", "supereq"], + ["builtin-function", "ssrc"], + ["builtin-function", "timestretch"], - ["builtin-function", "amplify"], ["punctuation", "("], - ["builtin-function", "amplifydb"], ["punctuation", "("], - ["builtin-function", "assumesamplerate"], ["punctuation", "("], - ["builtin-function", "audiodub"], ["punctuation", "("], - ["builtin-function", "audiodubex"], ["punctuation", "("], - ["builtin-function", "audiotrim"], ["punctuation", "("], - ["builtin-function", "convertaudioto8bit"], ["punctuation", "("], - ["builtin-function", "convertaudioto16bit"], ["punctuation", "("], - ["builtin-function", "convertaudioto24bit"], ["punctuation", "("], - ["builtin-function", "convertaudioto32bit"], ["punctuation", "("], - ["builtin-function", "convertaudiotofloat"], ["punctuation", "("], - ["builtin-function", "converttomono"], ["punctuation", "("], - ["builtin-function", "delayaudio"], ["punctuation", "("], - ["builtin-function", "ensurevbrmp3sync"], ["punctuation", "("], - ["builtin-function", "getchannel"], ["punctuation", "("], - ["builtin-function", "getleftchannel"], ["punctuation", "("], - ["builtin-function", "getrightchannel"], ["punctuation", "("], - ["builtin-function", "killaudio"], ["punctuation", "("], - ["builtin-function", "killvideo"], ["punctuation", "("], - ["builtin-function", "mergechannels"], ["punctuation", "("], - ["builtin-function", "mixaudio"], ["punctuation", "("], - ["builtin-function", "monotostereo"], ["punctuation", "("], - ["builtin-function", "normalize"], ["punctuation", "("], - ["builtin-function", "resampleaudio"], ["punctuation", "("], - ["builtin-function", "supereq"], ["punctuation", "("], - ["builtin-function", "ssrc"], ["punctuation", "("], - ["builtin-function", "timestretch"], ["punctuation", "("], - ["punctuation", "("], - ["builtin-function", "conditionalfilter"], ["punctuation", "("], - ["builtin-function", "frameevaluate"], ["punctuation", "("], - ["builtin-function", "scriptclip"], ["punctuation", "("], - ["builtin-function", "conditionalselect"], ["punctuation", "("], - ["builtin-function", "conditionalreader"], ["punctuation", "("], - ["builtin-function", "writefile"], ["punctuation", "("], - ["builtin-function", "writefileif"], ["punctuation", "("], - ["builtin-function", "writefilestart"], ["punctuation", "("], - ["builtin-function", "writefileend"], ["punctuation", "("], - ["builtin-function", "animate"], ["punctuation", "("], - ["builtin-function", "applyrange"], ["punctuation", "("], - ["builtin-function", "tcpserver"], ["punctuation", "("], - ["builtin-function", "tcpsource"], ["punctuation", "("], + ["builtin-function", "conditionalfilter"], + ["builtin-function", "frameevaluate"], + ["builtin-function", "scriptclip"], + ["builtin-function", "conditionalselect"], + ["builtin-function", "conditionalreader"], + ["builtin-function", "writefile"], + ["builtin-function", "writefileif"], + ["builtin-function", "writefilestart"], + ["builtin-function", "writefileend"], + ["builtin-function", "animate"], + ["builtin-function", "applyrange"], + ["builtin-function", "tcpserver"], + ["builtin-function", "tcpsource"], - ["builtin-function", "imagewriter"], ["punctuation", "("], + ["builtin-function", "imagewriter"], - ["builtin-function", "blankclip"], ["punctuation", "("], - ["builtin-function", "blackness"], ["punctuation", "("], - ["builtin-function", "colorbars"], ["punctuation", "("], - ["builtin-function", "colorbarshd"], ["punctuation", "("], - ["builtin-function", "compare"], ["punctuation", "("], - ["builtin-function", "dumpfiltergraph"], ["punctuation", "("], - ["builtin-function", "setgraphanalysis"], ["punctuation", "("], - ["builtin-function", "echo"], ["punctuation", "("], - ["builtin-function", "histogram"], ["punctuation", "("], - ["builtin-function", "info"], ["punctuation", "("], - ["builtin-function", "messageclip"], ["punctuation", "("], - ["builtin-function", "preroll"], ["punctuation", "("], - ["builtin-function", "showfiveversions"], ["punctuation", "("], - ["builtin-function", "showframenumber"], ["punctuation", "("], - ["builtin-function", "showsmpte"], ["punctuation", "("], - ["builtin-function", "showtime"], ["punctuation", "("], - ["builtin-function", "stackhorizontal"], ["punctuation", "("], - ["builtin-function", "stackvertical"], ["punctuation", "("], - ["builtin-function", "subtitle"], ["punctuation", "("], - ["builtin-function", "tone"], ["punctuation", "("], - ["builtin-function", "version"], ["punctuation", "("], + ["builtin-function", "blankclip"], + ["builtin-function", "blackness"], + ["builtin-function", "colorbars"], + ["builtin-function", "colorbarshd"], + ["builtin-function", "compare"], + ["builtin-function", "dumpfiltergraph"], + ["builtin-function", "setgraphanalysis"], + ["builtin-function", "echo"], + ["builtin-function", "histogram"], + ["builtin-function", "info"], + ["builtin-function", "messageclip"], + ["builtin-function", "preroll"], + ["builtin-function", "showfiveversions"], + ["builtin-function", "showframenumber"], + ["builtin-function", "showsmpte"], + ["builtin-function", "showtime"], + ["builtin-function", "stackhorizontal"], + ["builtin-function", "stackvertical"], + ["builtin-function", "subtitle"], + ["builtin-function", "tone"], + ["builtin-function", "version"], - "\r\n\r\ntone\r\ntone", ["punctuation", "."], ["punctuation", "("], - ["function", ["pantone"]], ["punctuation", "("] + "\r\n\r\npantone" ] ---------------------------------------------------- -Internal filters must simply preceed optional whitespace followed by an opening parenthesis. -They must not be inside of another word. +All internal functions, filters, and properties can be used in the following formats: +intFunc == intFunc() == last.intFunc == last.intFunc() +They must not appear within other words. diff --git a/tests/languages/avisynth/userfunctions_feature.test b/tests/languages/avisynth/userfunctions_feature.test index c671ea1eb7..d23464068c 100644 --- a/tests/languages/avisynth/userfunctions_feature.test +++ b/tests/languages/avisynth/userfunctions_feature.test @@ -1,9 +1,13 @@ function CustomUserFunction() { - -} - QTGMC() +last.QTGMC +last.QTGMC() + +QTGMC +1func() +last.1func +last.1func() ---------------------------------------------------- @@ -14,12 +18,36 @@ QTGMC() ["punctuation", ")"], ["punctuation", "{"], - ["punctuation", "}"], + ["function", ["QTGMC"]], + ["punctuation", "("], + ["punctuation", ")"], + + ["variable", "last"], + ["punctuation", "."], + ["function", ["QTGMC"]], + + ["variable", "last"], + ["punctuation", "."], + ["function", ["QTGMC"]], + ["punctuation", "("], + ["punctuation", ")"], - ["function", ["QTGMC"]], ["punctuation", "("], ["punctuation", ")"] + "\r\n\r\nQTGMC\r\n1func", + ["punctuation", "("], + ["punctuation", ")"], + + ["variable", "last"], + ["punctuation", "."], + "1func\r\n", + + ["variable", "last"], + ["punctuation", "."], + "1func", + ["punctuation", "("], + ["punctuation", ")"] ] ---------------------------------------------------- -Identifiers after the function keyword are user-defined functions. -Identifiers preceeding an opening parenthesis that are not an internal function or filter are a user/external function/filter. +Valid identifiers (starts with [a-zA-Z_]) proceeding a '.', preceeding a '(', or both are user/external functions. +User/external functions that don't match the above are technically valid but indistinguisable from variables. From 1056b3700974a3b767da4d92244824fd40067abe Mon Sep 17 00:00:00 2001 From: Zach Date: Tue, 14 Sep 2021 18:48:30 -0700 Subject: [PATCH 08/12] Update components/prism-avisynth.js Co-authored-by: Michael Schmidt --- components/prism-avisynth.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js index 8c276d0709..88e5890158 100644 --- a/components/prism-avisynth.js +++ b/components/prism-avisynth.js @@ -181,10 +181,10 @@ alias: 'punctuation' }, - 'operator': /\+\+?|!=?|<=?|>=?|==?|&&|\|\||\?|\*|\/|%|:/, - 'number': /\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i, + 'operator': /\+\+?|[!=<>]=?|&&|\|\||[?:*/%-]/, + 'punctuation': /[{}\[\]();,.]/ }; From 8ca9bb5e51aa23ad65b28c8d51dd5d719bdf7da6 Mon Sep 17 00:00:00 2001 From: Zinfidel Date: Tue, 14 Sep 2021 19:29:16 -0700 Subject: [PATCH 09/12] Extract type-casts from function as they are different now. Also remove positive lookahead on builtin-function for consistency. --- components/prism-avisynth.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js index 88e5890158..a020666c92 100644 --- a/components/prism-avisynth.js +++ b/components/prism-avisynth.js @@ -158,20 +158,19 @@ // AviSynth's internal functions, filters, and properties 'builtin-function': { - pattern: re(/\b(?:<<0>>)\b(?!\s*=)/.source, [allinternals], 'i'), + pattern: re(/\b(?:<<0>>)\b/.source, [allinternals], 'i'), alias: 'function' }, + 'type-cast': { + pattern: re(/\b(?:<<0>>)(?=\s*\()/.source, [types], 'i'), + alias: 'keyword' + }, + // External/user-defined filters, and type casts. 'function': { pattern: /\b[a-z_]\w*(?=\s*\()|(\.)[a-z_]\w*\b/i, - lookbehind: true, - inside: { - 'keyword': { - // type casts - pattern: re(/\b(?:<<0>>)\b/.source, [types], 'i') - } - } + lookbehind: true }, // Matches a \ as the first or last character on a line From d917930e219156e0493d4ce3c57e6d022fef1457 Mon Sep 17 00:00:00 2001 From: Zinfidel Date: Tue, 14 Sep 2021 21:34:51 -0700 Subject: [PATCH 10/12] Inline keywords. --- components/prism-avisynth.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js index a020666c92..c90599e4bb 100644 --- a/components/prism-avisynth.js +++ b/components/prism-avisynth.js @@ -12,7 +12,6 @@ } var types = /clip|int|float|string|bool|val/.source; - var keywords = /function|global|return|try|catch|if|else|while|for|__END__/.source; // includes avs+ native gscript constructs var internals = [ // bools /is(?:bool|clip|float|int|string)|defined|(?:var|(?:internal)?function)?exists?/.source, @@ -150,7 +149,7 @@ 'boolean': /\b(?:true|false|yes|no)\b/i, 'keyword': { - pattern: re(/((?:^|[\\{])\s*)(?:<<0>>)(?=\s)/.source, [keywords], 'im'), + pattern: /((?:^|[\\{])\s*)(?:function|global|return|try|catch|if|else|while|for|__END__)(?=\s)/im, lookbehind: true }, From b560b2b1dce57255bdd595c7ba51d9b142adc04f Mon Sep 17 00:00:00 2001 From: Zinfidel Date: Wed, 15 Sep 2021 11:37:06 -0700 Subject: [PATCH 11/12] Simplify keywords to just have word boundaries. --- components/prism-avisynth.js | 11 ++++------- components/prism-avisynth.min.js | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/components/prism-avisynth.js b/components/prism-avisynth.js index c90599e4bb..09332f1c6b 100644 --- a/components/prism-avisynth.js +++ b/components/prism-avisynth.js @@ -103,7 +103,7 @@ } ], - // Handle before strings because optional arguments are surrounded by double quotes. + // Handle before strings because optional arguments are surrounded by double quotes 'argument': { pattern: re(/\b(?:<<0>>)\s+("?)\w+\1/.source, [types], 'i'), inside: { @@ -143,15 +143,12 @@ } ], - // The special "last" variable that takes the value of the last implicitly returned clip. + // The special "last" variable that takes the value of the last implicitly returned clip 'variable': /\b(?:last)\b/i, 'boolean': /\b(?:true|false|yes|no)\b/i, - 'keyword': { - pattern: /((?:^|[\\{])\s*)(?:function|global|return|try|catch|if|else|while|for|__END__)(?=\s)/im, - lookbehind: true - }, + 'keyword': /\b(?:function|global|return|try|catch|if|else|while|for|__END__)\b/i, 'constant': /\bMT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)\b/, @@ -166,7 +163,7 @@ alias: 'keyword' }, - // External/user-defined filters, and type casts. + // External/user-defined filters 'function': { pattern: /\b[a-z_]\w*(?=\s*\()|(\.)[a-z_]\w*\b/i, lookbehind: true diff --git a/components/prism-avisynth.min.js b/components/prism-avisynth.min.js index 390fbf7379..4fa150c833 100644 --- a/components/prism-avisynth.min.js +++ b/components/prism-avisynth.min.js @@ -1 +1 @@ -!function(e){function a(e,a,r){return RegExp(function(e,r){return e.replace(/<<(\d+)>>/g,function(e,a){return r[+a]})}(e,a),r||"")}var r="clip|int|float|string|bool|val",t=[["is(?:bool|clip|float|int|string)|defined|(?:var|(?:internal)?function)?exists?","apply|assert|default|eval|import|select|nop|undefined","set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment)|opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))","hex(?:value)?|value","max|min|muldiv|floor|ceil|round|fmod|pi|exp|log(?:10)?|pow|sqrt|abs|sign|frac|rand|spline|continued(?:numerator|denominator)?","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(?:luma|chroma[uv]|[bgr])|(?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)?|[yuvrgb]plane(?:median|min|max|minmaxdifference)","script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?)|setlogparams|logmsg|getprocessinfo","[lu]case|str(?:toutf8|fromutf8|len|cmpi?)|(?:rev|left|right|mid|find|replace|fill)str|format|trim(?:left|right|all)|chr|ord|time","version(?:number|string)|isversionorgreater","buildpixeltype|colorspacenametopixeltype","setfiltermtmode|prefetch|addautoloaddir|on(?:cpu|cuda)"].join("|"),["has(?:audio|video)","width|height","frame(?:count|rate)|framerate(?:numerator|denominator)","is(?:field|frame)based|getparity","pixeltype|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|hasalpha|componentsize|numcomponents|bitspercomponent","audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits)|isaudio(?:float|int)"].join("|"),["avi(?:file)?source|opendmlsource|directshowsource|image(?:reader|source|sourceanim)|segmented(?:avisource|directshowsource)|wavsource","coloryuv|convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2)|convertbacktoyuy2|fixluminance|gr[ae]yscale|invert|levels|limiter|mergea?rgb|merge(?:luma|chroma)|rgbadjust|show(?:red|green|blue|alpha)|swapuv|tweak|[uv]toy8?|ytouv","(?:colorkey|reset)mask|mask(?:hs)?|layer|merge|overlay|subtract","addborders|crop(?:bottom)?|flip(?:horizontal|vertical)|letterbox|(?:horizontal|vertical)?reduceby2|(?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize|skewrows|turn(?:left|right|180)","blur|sharpen|generalconvolution|(?:spatial|temporal)soften|fixbrokenchromaupsampling","trim|(?:un)?alignedsplice|(?:assume|assumescaled|change|convert)FPS|(?:delete|duplicate)frame|dissolve|fade(?:in|out|io)[02]?|freezeframe|interleave|loop|reverse|select(?:even|odd|(?:range)?every)","assume(?:frame|field)based|assume[bt]ff|bob|complementparity|doubleweave|peculiarblend|pulldown|separate(?:columns|rows|fields)|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|supereq|ssrc|timestretch","conditional(?:filter|select|reader)|frameevaluate|scriptclip|writefile(?:if|start|end)?|animate|applyrange|tcp(?:server|source)","imagewriter","subtitle|blankclip|blackness|colorbars(?:hd)?|compare|dumpfiltergraph|setgraphanalysis|echo|histogram|info|messageclip|preroll|showfiveversions|show(?:framenumber|smpte|time)|stack(?:horizontal|vertical)|tone|version"].join("|")].join("|");e.languages.avisynth={comment:[{pattern:/(^|[^\\])\[\*(?:[^\[*]|\[(?!\*)|\*(?!\])|\[\*(?:[^\[*]|\[(?!\*)|\*(?!\]))*\*\])*\*\]/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],argument:{pattern:a('\\b(?:<<0>>)\\s+("?)\\w+\\1',[r],"i"),inside:{keyword:/^\w+/}},"argument-label":{pattern:/([,(][\s\\]*)\w+\s*=(?!=)/,lookbehind:!0,inside:{"argument-name":{pattern:/^\w+/,alias:"punctuation"},punctuation:/=$/}},string:[{pattern:/"""[\s\S]*?"""/,greedy:!0},{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0,inside:{constant:{pattern:/\b(?:DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS)\b/}}}],variable:/\b(?:last)\b/i,boolean:/\b(?:true|false|yes|no)\b/i,keyword:{pattern:a("((?:^|[\\\\{])\\s*)(?:<<0>>)(?=\\s)",["function|global|return|try|catch|if|else|while|for|__END__"],"im"),lookbehind:!0},constant:/\bMT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)\b/,"builtin-function":{pattern:a("\\b(?:<<0>>)\\b(?!\\s*=)",[t],"i"),alias:"function"},function:{pattern:/\b[a-z_]\w*(?=\s*\()|(\.)[a-z_]\w*\b/i,lookbehind:!0,inside:{keyword:{pattern:a("\\b(?:<<0>>)\\b",[r],"i")}}},"line-continuation":{pattern:/(^[ \t]*)\\|\\(?=[ \t]*$)/m,lookbehind:!0,alias:"punctuation"},operator:/\+\+?|!=?|<=?|>=?|==?|&&|\|\||\?|\*|\/|%|:/,number:/\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i,punctuation:/[{}\[\]();,.]/},e.languages.avs=e.languages.avisynth}(Prism); \ No newline at end of file +!function(e){function a(e,a,r){return RegExp(function(e,r){return e.replace(/<<(\d+)>>/g,function(e,a){return r[+a]})}(e,a),r||"")}var r="clip|int|float|string|bool|val",t=[["is(?:bool|clip|float|int|string)|defined|(?:var|(?:internal)?function)?exists?","apply|assert|default|eval|import|select|nop|undefined","set(?:memorymax|cachemode|maxcpu|workingdir|planarlegacyalignment)|opt_(?:allowfloataudio|usewaveextensible|dwchannelmask|avipadscanlines|vdubplanarhack|enable_(?:v210|y3_10_10|y3_10_16|b64a|planartopackedrgb))","hex(?:value)?|value","max|min|muldiv|floor|ceil|round|fmod|pi|exp|log(?:10)?|pow|sqrt|abs|sign|frac|rand|spline|continued(?:numerator|denominator)?","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(?:luma|chroma[uv]|[bgr])|(?:luma|chroma[uv]|rgb|[rgb]|[yuv](?=difference(?:fromprevious|tonext)))difference(?:fromprevious|tonext)?|[yuvrgb]plane(?:median|min|max|minmaxdifference)","script(?:name(?:utf8)?|file(?:utf8)?|dir(?:utf8)?)|setlogparams|logmsg|getprocessinfo","[lu]case|str(?:toutf8|fromutf8|len|cmpi?)|(?:rev|left|right|mid|find|replace|fill)str|format|trim(?:left|right|all)|chr|ord|time","version(?:number|string)|isversionorgreater","buildpixeltype|colorspacenametopixeltype","setfiltermtmode|prefetch|addautoloaddir|on(?:cpu|cuda)"].join("|"),["has(?:audio|video)","width|height","frame(?:count|rate)|framerate(?:numerator|denominator)","is(?:field|frame)based|getparity","pixeltype|is(?:planar(?:rgba?)?|interleaved|rgb(?:24|32|48|64)?|y(?:8|u(?:y2|va?))?|yv(?:12|16|24|411)|420|422|444|packedrgb)|hasalpha|componentsize|numcomponents|bitspercomponent","audio(?:rate|duration|length(?:[fs]|lo|hi)?|channels|bits)|isaudio(?:float|int)"].join("|"),["avi(?:file)?source|opendmlsource|directshowsource|image(?:reader|source|sourceanim)|segmented(?:avisource|directshowsource)|wavsource","coloryuv|convertto(?:RGB(?:24|32|48|64)|(?:planar)?RGBA?|Y8?|YV(?:12|16|24|411)|YUVA?(?:444|422|420|411)|YUY2)|convertbacktoyuy2|fixluminance|gr[ae]yscale|invert|levels|limiter|mergea?rgb|merge(?:luma|chroma)|rgbadjust|show(?:red|green|blue|alpha)|swapuv|tweak|[uv]toy8?|ytouv","(?:colorkey|reset)mask|mask(?:hs)?|layer|merge|overlay|subtract","addborders|crop(?:bottom)?|flip(?:horizontal|vertical)|letterbox|(?:horizontal|vertical)?reduceby2|(?:bicubic|bilinear|blackman|gauss|lanczos|lanczos4|point|sinc|spline(?:16|36|64))resize|skewrows|turn(?:left|right|180)","blur|sharpen|generalconvolution|(?:spatial|temporal)soften|fixbrokenchromaupsampling","trim|(?:un)?alignedsplice|(?:assume|assumescaled|change|convert)FPS|(?:delete|duplicate)frame|dissolve|fade(?:in|out|io)[02]?|freezeframe|interleave|loop|reverse|select(?:even|odd|(?:range)?every)","assume(?:frame|field)based|assume[bt]ff|bob|complementparity|doubleweave|peculiarblend|pulldown|separate(?:columns|rows|fields)|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|supereq|ssrc|timestretch","conditional(?:filter|select|reader)|frameevaluate|scriptclip|writefile(?:if|start|end)?|animate|applyrange|tcp(?:server|source)","imagewriter","subtitle|blankclip|blackness|colorbars(?:hd)?|compare|dumpfiltergraph|setgraphanalysis|echo|histogram|info|messageclip|preroll|showfiveversions|show(?:framenumber|smpte|time)|stack(?:horizontal|vertical)|tone|version"].join("|")].join("|");e.languages.avisynth={comment:[{pattern:/(^|[^\\])\[\*(?:[^\[*]|\[(?!\*)|\*(?!\])|\[\*(?:[^\[*]|\[(?!\*)|\*(?!\]))*\*\])*\*\]/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\$])#.*/,lookbehind:!0,greedy:!0}],argument:{pattern:a('\\b(?:<<0>>)\\s+("?)\\w+\\1',[r],"i"),inside:{keyword:/^\w+/}},"argument-label":{pattern:/([,(][\s\\]*)\w+\s*=(?!=)/,lookbehind:!0,inside:{"argument-name":{pattern:/^\w+/,alias:"punctuation"},punctuation:/=$/}},string:[{pattern:/"""[\s\S]*?"""/,greedy:!0},{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0,inside:{constant:{pattern:/\b(?:DEFAULT_MT_MODE|(?:SCRIPT|MAINSCRIPT|PROGRAM)DIR|(?:USER|MACHINE)_(?:PLUS|CLASSIC)_PLUGINS)\b/}}}],variable:/\b(?:last)\b/i,boolean:/\b(?:true|false|yes|no)\b/i,keyword:/\b(?:function|global|return|try|catch|if|else|while|for|__END__)\b/i,constant:/\bMT_(?:NICE_FILTER|MULTI_INSTANCE|SERIALIZED|SPECIAL_MT)\b/,"builtin-function":{pattern:a("\\b(?:<<0>>)\\b",[t],"i"),alias:"function"},"type-cast":{pattern:a("\\b(?:<<0>>)(?=\\s*\\()",[r],"i"),alias:"keyword"},function:{pattern:/\b[a-z_]\w*(?=\s*\()|(\.)[a-z_]\w*\b/i,lookbehind:!0},"line-continuation":{pattern:/(^[ \t]*)\\|\\(?=[ \t]*$)/m,lookbehind:!0,alias:"punctuation"},number:/\B\$(?:[\da-f]{6}|[\da-f]{8})\b|(?:(?:\b|\B-)\d+(?:\.\d*)?\b|\B\.\d+\b)/i,operator:/\+\+?|[!=<>]=?|&&|\|\||[?:*/%-]/,punctuation:/[{}\[\]();,.]/},e.languages.avs=e.languages.avisynth}(Prism); \ No newline at end of file From dc48428c32807908baeaa975d7b5d953ee3c9438 Mon Sep 17 00:00:00 2001 From: Zinfidel Date: Wed, 15 Sep 2021 11:42:36 -0700 Subject: [PATCH 12/12] Several test updates. - Simplify property tests to account for more permissive actual usage. - Simplify keyword tests to account for more permissive matching. - Add missing - operator to operators test. - Add missing [] punctuation to punctuation test. - Add argument-label test. --- .../avisynth/clipproperties_feature.test | 344 +++--------------- ...keywords_constants_bools_last_feature.test | 22 +- .../operators_numbers_punctuation.test | 6 +- .../avisynth/types_arguments_feature.test | 45 +-- .../avisynth/userfunctions_feature.test | 8 +- 5 files changed, 89 insertions(+), 336 deletions(-) diff --git a/tests/languages/avisynth/clipproperties_feature.test b/tests/languages/avisynth/clipproperties_feature.test index b285d906b7..d4335a2e5b 100644 --- a/tests/languages/avisynth/clipproperties_feature.test +++ b/tests/languages/avisynth/clipproperties_feature.test @@ -1,353 +1,111 @@ -c.hasaudio hasaudio( -c.hasvideo hasvideo( -c.width width( -c.height height( -c.framecount framecount( -c.framerate framerate( -c.frameratenumerator frameratenumerator( -c.frameratedenominator frameratedenominator( -c.isfieldbased isfieldbased( -c.isframebased isframebased( -c.getparity getparity( - -c.pixeltype pixeltype( -c.isplanar isplanar( -c.isinterleaved isinterleaved( -c.isrgb isrgb( -c.isrgb24 isrgb24( -c.isrgb32 isrgb32( -c.isyuv isyuv( -c.isyuy2 isyuy2( -c.isy8 isy8( -c.isyv12 isyv12( -c.isyv16 isyv16( -c.isyv24 isyv24( -c.isyv411 isyv411( -c.is420 is420( -c.is422 is422( -c.is444 is444( -c.isy isy( -c.isyuva isyuva( -c.isrgb48 isrgb48( -c.isrgb64 isrgb64( -c.ispackedrgb ispackedrgb( -c.isplanarrgb isplanarrgb( -c.isplanarrgba isplanarrgba( -c.hasalpha hasalpha( -c.componentsize componentsize( -c.numcomponents numcomponents( -c.bitspercomponent bitspercomponent( - -c.audiorate audiorate( -c.audioduration audioduration( -c.audiolength audiolength( -c.audiolengthf audiolengthf( -c.audiolengths audiolengths( -c.audiolengthlo audiolengthlo( -c.audiolengthhi audiolengthhi( -c.audiochannels audiochannels( -c.audiobits audiobits( -c.isaudiofloat isaudiofloat( -c.isaudioint isaudioint( +hasaudio +hasvideo +width +height +framecount +framerate +frameratenumerator +frameratedenominator +isfieldbased +isframebased +getparity + +pixeltype +isplanar +isinterleaved +isrgb +isrgb24 +isrgb32 +isyuv +isyuy2 +isy8 +isyv12 +isyv16 +isyv24 +isyv411 +is420 +is422 +is444 +isy +isyuva +isrgb48 +isrgb64 +ispackedrgb +isplanarrgb +isplanarrgba +hasalpha +componentsize +numcomponents +bitspercomponent + +audiorate +audioduration +audiolength +audiolengthf +audiolengths +audiolengthlo +audiolengthhi +audiochannels +audiobits +isaudiofloat +isaudioint xyzisaudiointxyz ---------------------------------------------------- [ - "c", - ["punctuation", "."], ["builtin-function", "hasaudio"], - ["builtin-function", "hasaudio"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "hasvideo"], - ["builtin-function", "hasvideo"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "width"], ["builtin-function", "width"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "height"], ["builtin-function", "height"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "framecount"], - ["builtin-function", "framecount"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "framerate"], ["builtin-function", "framerate"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "frameratenumerator"], ["builtin-function", "frameratenumerator"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "frameratedenominator"], - ["builtin-function", "frameratedenominator"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isfieldbased"], ["builtin-function", "isfieldbased"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isframebased"], ["builtin-function", "isframebased"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "getparity"], - ["builtin-function", "getparity"], - ["punctuation", "("], - "\r\n\r\nc", - ["punctuation", "."], - ["builtin-function", "pixeltype"], ["builtin-function", "pixeltype"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "isplanar"], - ["builtin-function", "isplanar"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isinterleaved"], ["builtin-function", "isinterleaved"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isrgb"], ["builtin-function", "isrgb"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "isrgb24"], - ["builtin-function", "isrgb24"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isrgb32"], ["builtin-function", "isrgb32"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isyuv"], ["builtin-function", "isyuv"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "isyuy2"], - ["builtin-function", "isyuy2"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isy8"], ["builtin-function", "isy8"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isyv12"], ["builtin-function", "isyv12"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "isyv16"], - ["builtin-function", "isyv16"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isyv24"], ["builtin-function", "isyv24"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isyv411"], ["builtin-function", "isyv411"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "is420"], - ["builtin-function", "is420"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "is422"], ["builtin-function", "is422"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "is444"], ["builtin-function", "is444"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "isy"], - ["builtin-function", "isy"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isyuva"], ["builtin-function", "isyuva"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isrgb48"], ["builtin-function", "isrgb48"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "isrgb64"], - ["builtin-function", "isrgb64"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "ispackedrgb"], ["builtin-function", "ispackedrgb"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isplanarrgb"], ["builtin-function", "isplanarrgb"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "isplanarrgba"], - ["builtin-function", "isplanarrgba"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "hasalpha"], ["builtin-function", "hasalpha"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "componentsize"], ["builtin-function", "componentsize"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "numcomponents"], - ["builtin-function", "numcomponents"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "bitspercomponent"], ["builtin-function", "bitspercomponent"], - ["punctuation", "("], - "\r\n\r\nc", - ["punctuation", "."], ["builtin-function", "audiorate"], - ["builtin-function", "audiorate"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "audioduration"], ["builtin-function", "audioduration"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "audiolength"], ["builtin-function", "audiolength"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "audiolengthf"], - ["builtin-function", "audiolengthf"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "audiolengths"], ["builtin-function", "audiolengths"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "audiolengthlo"], ["builtin-function", "audiolengthlo"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "audiolengthhi"], - ["builtin-function", "audiolengthhi"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "audiochannels"], ["builtin-function", "audiochannels"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "audiobits"], ["builtin-function", "audiobits"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], ["builtin-function", "isaudiofloat"], - ["builtin-function", "isaudiofloat"], - ["punctuation", "("], - - "\r\nc", - ["punctuation", "."], - ["builtin-function", "isaudioint"], ["builtin-function", "isaudioint"], - ["punctuation", "("], "\r\n\r\nxyzisaudiointxyz" ] diff --git a/tests/languages/avisynth/keywords_constants_bools_last_feature.test b/tests/languages/avisynth/keywords_constants_bools_last_feature.test index a0e6584616..3b28abc86f 100644 --- a/tests/languages/avisynth/keywords_constants_bools_last_feature.test +++ b/tests/languages/avisynth/keywords_constants_bools_last_feature.test @@ -1,17 +1,14 @@ function - global -{return -\ try +global +return +try catch if else while for __END__ -try { return } -}global -global} MT_NICE_FILTER MT_MULTI_INSTANCE @@ -41,9 +38,7 @@ blasted [ ["keyword", "function"], ["keyword", "global"], - ["punctuation", "{"], ["keyword", "return"], - ["line-continuation", "\\"], ["keyword", "try"], ["keyword", "catch"], ["keyword", "if"], @@ -51,12 +46,6 @@ blasted ["keyword", "while"], ["keyword", "for"], ["keyword", "__END__"], - ["keyword", "try"], - ["punctuation", "{"], - ["keyword", "return"], - ["punctuation", "}"], - - ["punctuation", "}"], "global\r\nglobal", ["punctuation", "}"], ["constant", "MT_NICE_FILTER"], ["constant", "MT_MULTI_INSTANCE"], @@ -79,9 +68,8 @@ blasted ---------------------------------------------------- -Keywords must proceed the start of the line and optional space, a line continuation and optional space, or an open brace (code block) and optional space. -Keywords must preceed at least one space. -Keywords can not be bounded by any other punctuation. +Keywords just have word boundaries. Keywords can actually be used as parameter names in functions, but this +scenario is an extreme edge and we do not bother handling it. Constants are case sensitive, and must not appear within other words. diff --git a/tests/languages/avisynth/operators_numbers_punctuation.test b/tests/languages/avisynth/operators_numbers_punctuation.test index 4340a1e667..1cc4c2b50c 100644 --- a/tests/languages/avisynth/operators_numbers_punctuation.test +++ b/tests/languages/avisynth/operators_numbers_punctuation.test @@ -1,5 +1,6 @@ + ++ +- ! != < @@ -26,6 +27,7 @@ a$123456a () {} +[] ; , . @@ -40,6 +42,7 @@ a$123456a [ ["operator", "+"], ["operator", "++"], + ["operator", "-"], ["operator", "!"], ["operator", "!="], ["operator", "<"], @@ -65,6 +68,7 @@ a$123456a ["punctuation", "("], ["punctuation", ")"], ["punctuation", "{"], ["punctuation", "}"], + ["punctuation", "["], ["punctuation", "]"], ["punctuation", ";"], ["punctuation", ","], ["punctuation", "."], @@ -81,4 +85,4 @@ Numbers can be specified in decimal form, with or without a leading value. So 0. Numbers can also be specified as 6- or 8- digit hexadecimal strings for colors. They begin with a $. Numbers can not be bounded by words. -Line continuations must be either the first or last character in a line, less some whitespace. \ No newline at end of file +Line continuations must be either the first or last character in a line, less some whitespace. diff --git a/tests/languages/avisynth/types_arguments_feature.test b/tests/languages/avisynth/types_arguments_feature.test index 43cfaef582..aa1660b227 100644 --- a/tests/languages/avisynth/types_arguments_feature.test +++ b/tests/languages/avisynth/types_arguments_feature.test @@ -10,11 +10,13 @@ function test(clip input, int interleavedFields, float precision, string "floati return interleavedClip } +test(5, 0.5, floatingDesync="progressive") + ---------------------------------------------------- [ ["keyword", "function"], - ["function", ["test"]], + ["function", "test"], ["punctuation", "("], ["argument", [ ["keyword", "clip"], @@ -51,66 +53,67 @@ function test(clip input, int interleavedFields, float precision, string "floati "\r\n\tcastTest ", ["operator", "="], - ["function", [ - ["keyword", "clip"] - ]], + ["type-cast", "clip"], ["punctuation", "("], "chromaNoise", ["punctuation", ")"], "\r\n\tcastTest ", ["operator", "="], - ["function", [ - ["keyword", "int"] - ]], + ["type-cast", "int"], ["punctuation", "("], "chromaNoise", ["punctuation", ")"], "\r\n\tcastTest ", ["operator", "="], - ["function", [ - ["keyword", "float"] - ]], + ["type-cast", "float"], ["punctuation", "("], "chromaNoise", ["punctuation", ")"], "\r\n\tcastTest ", ["operator", "="], - ["function", [ - ["keyword", "string"] - ]], + ["type-cast", "string"], ["punctuation", "("], "chromaNoise", ["punctuation", ")"], "\r\n\tcastTest ", ["operator", "="], - ["function", [ - ["keyword", "bool"] - ]], + ["type-cast", "bool"], ["punctuation", "("], "chromaNoise", ["punctuation", ")"], "\r\n\tcastTest ", ["operator", "="], - ["function", [ - ["keyword", "val"] - ]], + ["type-cast", "val"], ["punctuation", "("], "chromaNoise", ["punctuation", ")"], ["keyword", "return"], " interleavedClip\r\n", - ["punctuation", "}"] + ["punctuation", "}"], + + ["function", "test"], + ["punctuation", "("], + ["number", "5"], + ["punctuation", ","], + ["number", "0.5"], + ["punctuation", ","], + ["argument-label", [ + ["argument-name", "floatingDesync"], + ["punctuation", "="] + ]], + ["string", ["\"progressive\""]], + ["punctuation", ")"] ] ---------------------------------------------------- -Test types and optional arguments. Optional arguments check for preceeding types to match before getting matched as a string, and should not be matched as strings. Incidental names of types in an arguments list (such as "interleavedFields" containing "int") should not get highlighted. Types can be used as casts, and should not be highlighted as user-functions. Incidental names of types elsewhere (such as "interleavedClip" in a function body) should not get highlighted. +Explicitly-named optional arguments in function calls get lowlighted (including the '='). diff --git a/tests/languages/avisynth/userfunctions_feature.test b/tests/languages/avisynth/userfunctions_feature.test index d23464068c..d6226cd996 100644 --- a/tests/languages/avisynth/userfunctions_feature.test +++ b/tests/languages/avisynth/userfunctions_feature.test @@ -13,22 +13,22 @@ last.1func() [ ["keyword", "function"], - ["function", ["CustomUserFunction"]], + ["function", "CustomUserFunction"], ["punctuation", "("], ["punctuation", ")"], ["punctuation", "{"], - ["function", ["QTGMC"]], + ["function", "QTGMC"], ["punctuation", "("], ["punctuation", ")"], ["variable", "last"], ["punctuation", "."], - ["function", ["QTGMC"]], + ["function", "QTGMC"], ["variable", "last"], ["punctuation", "."], - ["function", ["QTGMC"]], + ["function", "QTGMC"], ["punctuation", "("], ["punctuation", ")"],