From c2afa59be655763a26a9ed6f18442d3940b9032e Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Fri, 3 Dec 2021 21:08:53 +0100 Subject: [PATCH] IO: Simplified comment token (#3214) --- components/prism-io.js | 19 +++++-------------- components/prism-io.min.js | 2 +- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/components/prism-io.js b/components/prism-io.js index dc8093651a..3bfd2cccf6 100644 --- a/components/prism-io.js +++ b/components/prism-io.js @@ -1,18 +1,9 @@ Prism.languages.io = { - 'comment': [ - { - pattern: /(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/, - lookbehind: true - }, - { - pattern: /(^|[^\\])\/\/.*/, - lookbehind: true - }, - { - pattern: /(^|[^\\])#.*/, - lookbehind: true - } - ], + 'comment': { + pattern: /(^|[^\\])(?:\/\*[\s\S]*?(?:\*\/|$)|\/\/.*|#.*)/, + lookbehind: true, + greedy: true + }, 'triple-quoted-string': { pattern: /"""(?:\\[\s\S]|(?!""")[^\\])*"""/, greedy: true, diff --git a/components/prism-io.min.js b/components/prism-io.min.js index 4bee5ae6de..08bbe661da 100644 --- a/components/prism-io.min.js +++ b/components/prism-io.min.js @@ -1 +1 @@ -Prism.languages.io={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0},{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0},{pattern:/(^|[^\\])#.*/,lookbehind:!0}],"triple-quoted-string":{pattern:/"""(?:\\[\s\S]|(?!""")[^\\])*"""/,greedy:!0,alias:"string"},string:{pattern:/"(?:\\.|[^\\\r\n"])*"/,greedy:!0},keyword:/\b(?:activate|activeCoroCount|asString|block|break|call|catch|clone|collectGarbage|compileString|continue|do|doFile|doMessage|doString|else|elseif|exit|for|foreach|forward|getEnvironmentVariable|getSlot|hasSlot|if|ifFalse|ifNil|ifNilEval|ifTrue|isActive|isNil|isResumable|list|message|method|parent|pass|pause|perform|performWithArgList|print|println|proto|raise|raiseResumable|removeSlot|resend|resume|schedulerSleepSeconds|self|sender|setSchedulerSleepSeconds|setSlot|shallowCopy|slotNames|super|system|then|thisBlock|thisContext|try|type|uniqueId|updateSlot|wait|while|write|yield)\b/,builtin:/\b(?:Array|AudioDevice|AudioMixer|BigNum|Block|Box|Buffer|CFunction|CGI|Color|Curses|DBM|DNSResolver|DOConnection|DOProxy|DOServer|Date|Directory|Duration|DynLib|Error|Exception|FFT|File|Fnmatch|Font|Future|GL|GLE|GLScissor|GLU|GLUCylinder|GLUQuadric|GLUSphere|GLUT|Host|Image|Importer|LinkList|List|Lobby|Locals|MD5|MP3Decoder|MP3Encoder|Map|Message|Movie|Notification|Number|Object|OpenGL|Point|Protos|Random|Regex|SGML|SGMLElement|SGMLParser|SQLite|Sequence|Server|ShowMessage|SleepyCat|SleepyCatCursor|Socket|SocketManager|Sound|Soup|Store|String|Tree|UDPSender|UPDReceiver|URL|User|Warning|WeakLink)\b/,boolean:/\b(?:false|nil|true)\b/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e-?\d+)?/i,operator:/[=!*/%+\-^&|]=|>>?=?|<>?=?|<