Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 428700 | Differences between
and this patch

Collapse All | Expand All

(-)a/bundles/org.eclipse.orion.client.editor/web/orion/editor/stylers/text_html/syntax.js (-36 lines)
Lines 46-87 Link Here
46
						include: "orion.js"
46
						include: "orion.js"
47
					}
47
					}
48
				]
48
				]
49
			}, {
50
				begin: "(?i)<script\\s.*?(?:language\\s*=\\s*(['\"])php\\1|type\\s*=\\s*(['\"])text/x-php\\2).*?>",
51
				end: "(?i)</script>",
52
				captures: {
53
					0: {name: "entity.name.tag.html"}
54
				},
55
				contentName: "source.php.embedded.html",
56
				patterns: [
57
					{
58
						include: "orion.php"
59
					}
60
				]
61
			}, {
62
				begin: "(?i)<\\?(?:=|php)?(?:\\s|$)",
63
				end: "\\?>",
64
				captures: {
65
					0: {name: "entity.name.declaration.php"}
66
				},
67
				contentName: "source.php.embedded.html",
68
				patterns: [
69
					{
70
						include: "orion.php"
71
					}
72
				]
73
			}, {
74
				begin: "<%=?(?:\\s|$)",
75
				end: "%>",
76
				captures: {
77
					0: {name: "entity.name.declaration.php"}
78
				},
79
				contentName: "source.php.embedded.html",
80
				patterns: [
81
					{
82
						include: "orion.php"
83
					}
84
				]
85
			}
49
			}
86
		],
50
		],
87
		repository: {
51
		repository: {
(-)a/bundles/org.eclipse.orion.client.editor/web/orion/editor/stylers/text_x-php/syntax.js (-26 / +32 lines)
Lines 44-80 Link Here
44
		contentTypes: ["text/x-php"],
44
		contentTypes: ["text/x-php"],
45
		patterns: [
45
		patterns: [
46
			{
46
			{
47
				include: "orion.lib#doc_block"
47
				include: "orion.html"
48
			}, {
48
			}, {
49
				include: "orion.c-like"
49
				begin: "(?i)<(\\?|%(?!php))(?:=|php)?(?:\\s|$)",
50
			}, {
50
				end: "[\\1]>",
51
				match: "(?i)<\\?(?:=|php)?(?:\\s|$)",
51
				captures: {
52
				name: "entity.name.declaration.php",
52
					0: {name: "entity.name.declaration.php"}
53
			}, {
53
				},
54
				match: "<%=?(?:\\s|$)",
54
				contentName: "source.php.embedded",
55
				name: "entity.name.declaration.php",
56
			}, {
57
				match: "#.*",
58
				name: "comment.line.number-sign.php",
59
				patterns: [
55
				patterns: [
60
					{
56
					{
61
						include: "orion.lib#todo_comment_singleLine"
57
						include: "orion.lib#doc_block"
58
					}, {
59
						include: "orion.c-like"
60
					}, {
61
						match: "\\b0[bB][01]+\\b",
62
						name: "constant.numeric.binary.php"
63
					}, {
64
						match: "#.*",
65
						name: "comment.line.number-sign.php",
66
						patterns: [
67
							{
68
								include: "orion.lib#todo_comment_singleLine"
69
							}
70
						]
71
					}, {
72
						begin: "<<<(\\w+)$",
73
						end: "^\\1;$",
74
						name: "string.unquoted.heredoc.php"
75
					}, {
76
						begin: "<<<'(\\w+)'$",
77
						end: "^\\1;$",
78
						name: "string.unquoted.heredoc.nowdoc.php"
79
					}, {
80
						match: "\\b(?:" + keywords.join("|") + ")\\b",
81
						name: "keyword.control.php"
62
					}
82
					}
63
				]
83
				]
64
			}, {
65
				begin: "<<<(\\w+)$",
66
				end: "^\\1;$",
67
				name: "string.unquoted.heredoc.php"
68
			}, {
69
				begin: "<<<'(\\w+)'$",
70
				end: "^\\1;$",
71
				name: "string.unquoted.heredoc.nowdoc.php"
72
			}, {
73
				match: "\\b0[bB][01]+\\b",
74
				name: "constant.numeric.binary.php"
75
			}, {
76
				match: "\\b(?:" + keywords.join("|") + ")\\b",
77
				name: "keyword.control.php"
78
			}
84
			}
79
		]
85
		]
80
	});
86
	});
(-)a/bundles/org.eclipse.orion.client.editor/web/orion/editor/textStyler.js (-10 / +27 lines)
Lines 33-40 Link Here
33
33
34
	var eolRegex = /$/;
34
	var eolRegex = /$/;
35
	var captureReferenceRegex = /\\(\d)/g;
35
	var captureReferenceRegex = /\\(\d)/g;
36
	var ignoreCaseRegex = /^\(\?i\)\s*/;
36
	var linebreakRegex = /(.*)(?:[\r\n]|$)/g;
37
	var linebreakRegex = /(.*)(?:[\r\n]|$)/g;
37
	var spacePattern = {regex: / /g, style: {styleClass: "punctuation separator space", unmergeable: true}}; //$NON-NLS-0$
38
	var spacePattern = {regex: /[ ]/g, style: {styleClass: "punctuation separator space", unmergeable: true}}; //$NON-NLS-0$
38
	var tabPattern = {regex: /\t/g, style: {styleClass: "punctuation separator tab", unmergeable: true}}; //$NON-NLS-0$
39
	var tabPattern = {regex: /\t/g, style: {styleClass: "punctuation separator tab", unmergeable: true}}; //$NON-NLS-0$
39
40
40
	var _findMatch = function(regex, text, startIndex, testBeforeMatch) {
41
	var _findMatch = function(regex, text, startIndex, testBeforeMatch) {
Lines 297-306 Link Here
297
					var contentStart = current.result.index;
298
					var contentStart = current.result.index;
298
					var resultEnd = null;
299
					var resultEnd = null;
299
300
300
					/* 
301
					 * If the end match contains a capture reference (eg.- "\1") then update
302
					 * its regex with the resolved capture values from the begin match.
303
					 */
304
					var endRegex = current.pattern.regexEnd;
301
					var endRegex = current.pattern.regexEnd;
305
					if (!endRegex) {
302
					if (!endRegex) {
306
						resultEnd = new Block(
303
						resultEnd = new Block(
Lines 316-322 Link Here
316
							block);
313
							block);
317
					} else {
314
					} else {
318
						contentStart += current.result[0].length;
315
						contentStart += current.result[0].length;
319
						endRegex = substituteCaptureValues(endRegex, current.result);
316
						var testPattern = current.pattern;
317
						/* 
318
						 * If the end regex contains a capture reference (eg.- "\1") then substitute
319
						 * the resolved capture values from the begin match.
320
						 */
321
						var resolvedEndRegex = substituteCaptureValues(endRegex, current.result);
322
						if (resolvedEndRegex !== endRegex) {
323
							/*
324
							 * A substitution was made, so make a copy of the test pattern and set its
325
							 * end regex to the resolved one.  This will cause end-match detection to be
326
							 * performed with this concrete end regex value, but the original pattern
327
							 * definition containing the capture reference will not be affected.
328
							 */
329
							testPattern = {
330
								pattern: testPattern.pattern,
331
								regexBegin: testPattern.regexBegin,
332
								regexEnd: resolvedEndRegex
333
							};
334
							endRegex = resolvedEndRegex;
335
						}
320
336
321
						var lastIndex = contentStart;
337
						var lastIndex = contentStart;
322
						while (!resultEnd) {
338
						while (!resultEnd) {
Lines 333-339 Link Here
333
									contentStart: offset + contentStart,
349
									contentStart: offset + contentStart,
334
									contentEnd: offset + result.index
350
									contentEnd: offset + result.index
335
								},
351
								},
336
								current.pattern,
352
								testPattern,
337
								block.getStyler(),
353
								block.getStyler(),
338
								model,
354
								model,
339
								block);
355
								block);
Lines 390-407 Link Here
390
		getPatterns: function(pattern) {
406
		getPatterns: function(pattern) {
391
			var parentId;
407
			var parentId;
392
			if (!pattern) {
408
			if (!pattern) {
393
				parentId = this._rootId;
409
				parentId = this._rootId + "#" + this._NO_ID;
394
			} else {
410
			} else {
395
				if (typeof(pattern) === "string") { //$NON-NLS-0$
411
				if (typeof(pattern) === "string") { //$NON-NLS-0$
396
					parentId = pattern;
412
					parentId = pattern;
397
				} else {
413
				} else {
398
					parentId = pattern.qualifiedId;
414
					parentId = pattern.qualifiedId;
399
				}
415
				}
416
				parentId += "#";
400
			}
417
			}
401
			/* indexes on patterns are used to break ties when multiple patterns match the same start text */
418
			/* indexes on patterns are used to break ties when multiple patterns match the same start text */
402
			var indexCounter = [0];
419
			var indexCounter = [0];
403
			var resultObject = {};
420
			var resultObject = {};
404
			var regEx = new RegExp("^" + parentId + "#[^#]+$"); //$NON-NLS-0$
421
			var regEx = new RegExp("^" + parentId + "[^#]+$"); //$NON-NLS-0$
405
			var includes = [];
422
			var includes = [];
406
			this._patterns.forEach(function(current) {
423
			this._patterns.forEach(function(current) {
407
				if (regEx.test(current.qualifiedId)) {
424
				if (regEx.test(current.qualifiedId)) {
Lines 598-604 Link Here
598
		_initPatterns: function() {
615
		_initPatterns: function() {
599
			var patterns = this.getPatternManager().getPatterns(this.pattern ? this.pattern.pattern : null);
616
			var patterns = this.getPatternManager().getPatterns(this.pattern ? this.pattern.pattern : null);
600
			var processIgnore = function(matchString) {
617
			var processIgnore = function(matchString) {
601
				var result = /^\(\?i\)\s*/.exec(matchString);
618
				var result = ignoreCaseRegex.exec(matchString);
602
				if (result) {
619
				if (result) {
603
					matchString = matchString.substring(result[0].length);
620
					matchString = matchString.substring(result[0].length);
604
				}
621
				}

Return to bug 428700