##// END OF EJS Templates
branch-permissions: protect from XSS on branch rules forbidden flash message.
branch-permissions: protect from XSS on branch rules forbidden flash message.

File last commit:

r4105:10488616 default
r4432:4213c7c1 default
Show More
dockerfile.js
211 lines | 4.6 KiB | application/javascript | JavascriptLexer
project: added all source files and assets
r1 // CodeMirror, copyright (c) by Marijn Haverbeke and others
codemirror: bumped to version 5.49.2
r4105 // Distributed under an MIT license: https://codemirror.net/LICENSE
project: added all source files and assets
r1
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
codemirror: bumped to version 5.49.2
r4105 var from = "from";
var fromRegex = new RegExp("^(\\s*)\\b(" + from + ")\\b", "i");
var shells = ["run", "cmd", "entrypoint", "shell"];
var shellsAsArrayRegex = new RegExp("^(\\s*)(" + shells.join('|') + ")(\\s+\\[)", "i");
var expose = "expose";
var exposeRegex = new RegExp("^(\\s*)(" + expose + ")(\\s+)", "i");
var others = [
"arg", "from", "maintainer", "label", "env",
"add", "copy", "volume", "user",
"workdir", "onbuild", "stopsignal", "healthcheck", "shell"
];
project: added all source files and assets
r1 // Collect all Dockerfile directives
codemirror: bumped to version 5.49.2
r4105 var instructions = [from, expose].concat(shells).concat(others),
project: added all source files and assets
r1 instructionRegex = "(" + instructions.join('|') + ")",
codemirror: bumped to version 5.49.2
r4105 instructionOnlyLine = new RegExp("^(\\s*)" + instructionRegex + "(\\s*)(#.*)?$", "i"),
instructionWithArguments = new RegExp("^(\\s*)" + instructionRegex + "(\\s+)", "i");
project: added all source files and assets
r1
CodeMirror.defineSimpleMode("dockerfile", {
start: [
// Block comment: This is a line starting with a comment
{
codemirror: bumped to version 5.49.2
r4105 regex: /^\s*#.*$/,
sol: true,
project: added all source files and assets
r1 token: "comment"
},
codemirror: bumped to version 5.49.2
r4105 {
regex: fromRegex,
token: [null, "keyword"],
sol: true,
next: "from"
},
project: added all source files and assets
r1 // Highlight an instruction without any arguments (for convenience)
{
regex: instructionOnlyLine,
codemirror: bumped to version 5.49.2
r4105 token: [null, "keyword", null, "error"],
sol: true
},
{
regex: shellsAsArrayRegex,
token: [null, "keyword", null],
sol: true,
next: "array"
},
{
regex: exposeRegex,
token: [null, "keyword", null],
sol: true,
next: "expose"
project: added all source files and assets
r1 },
// Highlight an instruction followed by arguments
{
regex: instructionWithArguments,
codemirror: bumped to version 5.49.2
r4105 token: [null, "keyword", null],
sol: true,
project: added all source files and assets
r1 next: "arguments"
},
{
regex: /./,
token: null
}
],
codemirror: bumped to version 5.49.2
r4105 from: [
project: added all source files and assets
r1 {
codemirror: bumped to version 5.49.2
r4105 regex: /\s*$/,
project: added all source files and assets
r1 token: null,
next: "start"
},
{
codemirror: bumped to version 5.49.2
r4105 // Line comment without instruction arguments is an error
regex: /(\s*)(#.*)$/,
token: [null, "error"],
next: "start"
},
{
regex: /(\s*\S+\s+)(as)/i,
token: [null, "keyword"],
project: added all source files and assets
r1 next: "start"
},
// Fail safe return to start
{
token: null,
next: "start"
}
codemirror: update from 5.4.0 to 5.11.0, fixes #3154
r346 ],
codemirror: bumped to version 5.49.2
r4105 single: [
{
regex: /(?:[^\\']|\\.)/,
token: "string"
},
{
regex: /'/,
token: "string",
pop: true
}
],
double: [
{
regex: /(?:[^\\"]|\\.)/,
token: "string"
},
{
regex: /"/,
token: "string",
pop: true
}
],
array: [
{
regex: /\]/,
token: null,
next: "start"
},
{
regex: /"(?:[^\\"]|\\.)*"?/,
token: "string"
codemirror: update from 5.4.0 to 5.11.0, fixes #3154
r346 }
codemirror: bumped to version 5.49.2
r4105 ],
expose: [
{
regex: /\d+$/,
token: "number",
next: "start"
},
{
regex: /[^\d]+$/,
token: null,
next: "start"
},
{
regex: /\d+/,
token: "number"
},
{
regex: /[^\d]+/,
token: null
},
// Fail safe return to start
{
token: null,
next: "start"
}
],
arguments: [
{
regex: /^\s*#.*$/,
sol: true,
token: "comment"
},
{
regex: /"(?:[^\\"]|\\.)*"?$/,
token: "string",
next: "start"
},
{
regex: /"/,
token: "string",
push: "double"
},
{
regex: /'(?:[^\\']|\\.)*'?$/,
token: "string",
next: "start"
},
{
regex: /'/,
token: "string",
push: "single"
},
{
regex: /[^#"']+[\\`]$/,
token: null
},
{
regex: /[^#"']+$/,
token: null,
next: "start"
},
{
regex: /[^#"']+/,
token: null
},
// Fail safe return to start
{
token: null,
next: "start"
}
],
meta: {
lineComment: "#"
}
project: added all source files and assets
r1 });
CodeMirror.defineMIME("text/x-dockerfile", "dockerfile");
});