[TxMt] Language Grammar .log

Daniel Käsmayr daniel at kaesmayr.net
Thu May 25 15:02:36 UTC 2006


Folks,

I am just playing with TextMate and trying to get a better grasp of  
regexps.. ;)

A language grammar for some time stamped log files (like system.log)

{	scopeName = 'text.logfile';
	fileTypes = ( 'log' );
	foldingStartMarker = '/\*\*|\{\s*$';
	foldingStopMarker = '\*\*/|^\s*\}';
	patterns = (
		{	name = 'invalid';
			match = '(crash(dump|ed)|error|failed)';
		},
		{	name = 'constant.numeric';
			match = '[0-9]';
		},
		{	name = 'keyword.operator';
			match = '(\(|\))';
		},
		{	name = 'string.url';
			match = '\s(\/.*log)';
		},
		{	name = 'string';
			begin = '^';
			end = ':\s';
			patterns = (
				{	name = 'constant.language.time-stamp';
					match = '[a-zA-Z]{3}\s[0-9]+?\s[0-9]{2}:[0-9]{2}:[0-9]{2}';
				},
				{	name = 'keyword';
					match = '(launchd|authexec)';
				},
				{	name = 'variable.other.process';
					match = '\w+?\[\d{1,6}\]';
				},
			);
		},
	);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3996 bytes
Desc: not available
URL: <http://lists.macromates.com/textmate/attachments/20060525/60d0586e/attachment.p7s>


More information about the textmate mailing list