Commit 5edb31d2f6f7640d0c95fc4e685a126ff0feb51c

Victorien ELVINGER 2014-12-04T19:54:03

Add Eiffel programming language definition.

diff --git a/components.js b/components.js
index 94a440e..8803042 100644
--- a/components.js
+++ b/components.js
@@ -58,6 +58,10 @@ var components = {
 			"title": "C-like",
 			"option": "default"
 		},
+		"eiffel": {
+			"title": "Eiffel",
+			"option": "default"
+		},
 		"javascript": {
 			"title": "JavaScript",
 			"option": "default",
diff --git a/components/prism-eiffel.js b/components/prism-eiffel.js
new file mode 100644
index 0000000..444e686
--- /dev/null
+++ b/components/prism-eiffel.js
@@ -0,0 +1,27 @@
+Prism.languages.eiffel = {
+	'string': [
+		// Aligned-verbatim-strings (verbatim option not supported)
+		/"\[(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[cC][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*|\d(?:_?\d)*)\/)*?]"/g,
+		// Non-aligned-verbatim-strings (verbatim option not supported)
+		/"\{(?:[^"%\b\f\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[cC][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*|\d(?:_?\d)*)\/)*?}"/g,
+		// Single-line string
+		/"(?:[^%\b\f\n\r\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[cC][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*|\d(?:_?\d)*)\/)*?"/g
+	],
+	// (comments including quoted strings not supported)
+	'comment': /--.*/,
+	// normal char | special char | char code
+	'char': /'(?:[^%\b\f\n\r\t\v]|%[A-DFHLNQR-V%'"()<>]|%\/(?:0[xX][\da-fA-F](?:_?[\da-fA-F])*|0[cC][0-7](?:_?[0-7])*|0[bB][01](?:_?[01])*|\d(?:_?\d)*)\/)'/g,
+	'keyword': /\b(?:across|agent|alias|all|and|attached|as|assign|attribute|check|class|convert|create|Current|debug|deferred|detachable|do|else|elseif|end|ensure|expanded|export|external|feature|from|frozen|if|implies|inherit|inspect|invariant|like|local|loop|not|note|obsolete|old|once|or|Precursor|redefine|rename|require|rescue|Result|retry|select|separate|some|then|undefine|until|variant|Void|when|xor)\b/gi,
+	'boolean': /\b(?:True|False)\b/gi,
+	'number': [
+		// Decimal
+		{
+			pattern: /(\s)(?:\d(?:_?\d)*\.|(?:(?:\d(?:_?\d)*)?\.(?:\d(?:_?\d)*)?(?:[eE][+-]?)?)?\d(?:_?\d)*)(?=\s)/g,
+			lookbehind: true
+		},
+		// hexa | octal | bin
+		/\b0(?:[xX][\da-fA-F](?:_?[\da-fA-F])*|[cC][0-7](?:_?[0-7])*|[bB][01](?:_?[01])*)\b/g
+	],
+	'punctuation': /:=|<<|>>|\(\||\|\)|->|\.(?=\w)|[{}[\];(),:?]/g,
+	'operator': /\\\\|\|\.\.\||\.\.|\/[~\/]?|[><\/]=?|[-+*^=~]/g
+};