From 5ee8c55726020f47ec1494d1342f88cf0971b2e4 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Fri, 10 Dec 2021 14:35:12 +0100 Subject: [PATCH] Processing: Use standard tokens correctly (#3246) --- components/prism-processing.js | 11 ++++------- components/prism-processing.min.js | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/components/prism-processing.js b/components/prism-processing.js index f2558d2d84..a7ac93a1aa 100644 --- a/components/prism-processing.js +++ b/components/prism-processing.js @@ -1,18 +1,15 @@ Prism.languages.processing = Prism.languages.extend('clike', { 'keyword': /\b(?:break|case|catch|class|continue|default|else|extends|final|for|if|implements|import|new|null|private|public|return|static|super|switch|this|try|void|while)\b/, + // Spaces are allowed between function name and parenthesis + 'function': /\b\w+(?=\s*\()/, 'operator': /<[<=]?|>[>=]?|&&?|\|\|?|[%?]|[!=+\-*\/]=?/ }); + Prism.languages.insertBefore('processing', 'number', { // Special case: XML is a type 'constant': /\b(?!XML\b)[A-Z][A-Z\d_]+\b/, 'type': { pattern: /\b(?:boolean|byte|char|color|double|float|int|[A-Z]\w*)\b/, - alias: 'variable' + alias: 'class-name' } }); - -// Spaces are allowed between function name and parenthesis -Prism.languages.processing['function'] = /\b\w+(?=\s*\()/; - -// Class-names is not styled by default -Prism.languages.processing['class-name'].alias = 'variable'; diff --git a/components/prism-processing.min.js b/components/prism-processing.min.js index d941bf4f44..91d36ca1d7 100644 --- a/components/prism-processing.min.js +++ b/components/prism-processing.min.js @@ -1 +1 @@ -Prism.languages.processing=Prism.languages.extend("clike",{keyword:/\b(?:break|case|catch|class|continue|default|else|extends|final|for|if|implements|import|new|null|private|public|return|static|super|switch|this|try|void|while)\b/,operator:/<[<=]?|>[>=]?|&&?|\|\|?|[%?]|[!=+\-*\/]=?/}),Prism.languages.insertBefore("processing","number",{constant:/\b(?!XML\b)[A-Z][A-Z\d_]+\b/,type:{pattern:/\b(?:boolean|byte|char|color|double|float|int|[A-Z]\w*)\b/,alias:"variable"}}),Prism.languages.processing.function=/\b\w+(?=\s*\()/,Prism.languages.processing["class-name"].alias="variable"; \ No newline at end of file +Prism.languages.processing=Prism.languages.extend("clike",{keyword:/\b(?:break|case|catch|class|continue|default|else|extends|final|for|if|implements|import|new|null|private|public|return|static|super|switch|this|try|void|while)\b/,function:/\b\w+(?=\s*\()/,operator:/<[<=]?|>[>=]?|&&?|\|\|?|[%?]|[!=+\-*\/]=?/}),Prism.languages.insertBefore("processing","number",{constant:/\b(?!XML\b)[A-Z][A-Z\d_]+\b/,type:{pattern:/\b(?:boolean|byte|char|color|double|float|int|[A-Z]\w*)\b/,alias:"class-name"}}); \ No newline at end of file