Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(302)

Unified Diff: lib/src/prism/components/prism-batch.js

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/prism/components/prism-basic.min.js ('k') | lib/src/prism/components/prism-batch.min.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/prism/components/prism-batch.js
diff --git a/lib/src/prism/components/prism-batch.js b/lib/src/prism/components/prism-batch.js
new file mode 100644
index 0000000000000000000000000000000000000000..c7ca9ca60d78e0c400e719e2b2c7046c0a6855a0
--- /dev/null
+++ b/lib/src/prism/components/prism-batch.js
@@ -0,0 +1,99 @@
+(function (Prism) {
+ var variable = /%%?[~:\w]+%?|!\S+!/;
+ var parameter = {
+ pattern: /\/[a-z?]+(?=[ :]|$):?|-[a-z]\b|--[a-z-]+\b/im,
+ alias: 'attr-name',
+ inside: {
+ 'punctuation': /:/
+ }
+ };
+ var string = /"[^"]*"/;
+ var number = /(?:\b|-)\d+\b/;
+
+ Prism.languages.batch = {
+ 'comment': [
+ /^::.*/m,
+ {
+ pattern: /((?:^|[&(])[ \t]*)rem\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
+ lookbehind: true
+ }
+ ],
+ 'label': {
+ pattern: /^:.*/m,
+ alias: 'property'
+ },
+ 'command': [
+ {
+ // FOR command
+ pattern: /((?:^|[&(])[ \t]*)for(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* \S+ in \([^)]+\) do/im,
+ lookbehind: true,
+ inside: {
+ 'keyword': /^for\b|\b(?:in|do)\b/i,
+ 'string': string,
+ 'parameter': parameter,
+ 'variable': variable,
+ 'number': number,
+ 'punctuation': /[()',]/
+ }
+ },
+ {
+ // IF command
+ pattern: /((?:^|[&(])[ \t]*)if(?: ?\/[a-z?](?:[ :](?:"[^"]*"|\S+))?)* (?:not )?(?:cmdextversion \d+|defined \w+|errorlevel \d+|exist \S+|(?:"[^"]*"|\S+)?(?:==| (?:equ|neq|lss|leq|gtr|geq) )(?:"[^"]*"|\S+))/im,
+ lookbehind: true,
+ inside: {
+ 'keyword': /^if\b|\b(?:not|cmdextversion|defined|errorlevel|exist)\b/i,
+ 'string': string,
+ 'parameter': parameter,
+ 'variable': variable,
+ 'number': number,
+ 'operator': /\^|==|\b(?:equ|neq|lss|leq|gtr|geq)\b/i
+ }
+ },
+ {
+ // ELSE command
+ pattern: /((?:^|[&()])[ \t]*)else\b/im,
+ lookbehind: true,
+ inside: {
+ 'keyword': /^else\b/i
+ }
+ },
+ {
+ // SET command
+ pattern: /((?:^|[&(])[ \t]*)set(?: ?\/[a-z](?:[ :](?:"[^"]*"|\S+))?)* (?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
+ lookbehind: true,
+ inside: {
+ 'keyword': /^set\b/i,
+ 'string': string,
+ 'parameter': parameter,
+ 'variable': [
+ variable,
+ /\w+(?=(?:[*\/%+\-&^|]|<<|>>)?=)/
+ ],
+ 'number': number,
+ 'operator': /[*\/%+\-&^|]=?|<<=?|>>=?|[!~_=]/,
+ 'punctuation': /[()',]/
+ }
+ },
+ {
+ // Other commands
+ pattern: /((?:^|[&(])[ \t]*@?)\w+\b(?:[^^&)\r\n]|\^(?:\r\n|[\s\S]))*/im,
+ lookbehind: true,
+ inside: {
+ 'keyword': /^\w+\b/i,
+ 'string': string,
+ 'parameter': parameter,
+ 'label': {
+ pattern: /(^\s*):\S+/m,
+ lookbehind: true,
+ alias: 'property'
+ },
+ 'variable': variable,
+ 'number': number,
+ 'operator': /\^/
+ }
+ }
+ ],
+ 'operator': /[&@]/,
+ 'punctuation': /[()']/
+ };
+}(Prism));
« no previous file with comments | « lib/src/prism/components/prism-basic.min.js ('k') | lib/src/prism/components/prism-batch.min.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698