Skip to content

Instantly share code, notes, and snippets.

@ewiger
Created February 17, 2013 02:18
Show Gist options
  • Save ewiger/4969758 to your computer and use it in GitHub Desktop.
Save ewiger/4969758 to your computer and use it in GitHub Desktop.
Somewhat based on python.def MATLAB jsp syntax highlighting for Atlassian Fisheye/Crucible
# MATLAB jsp syntax highlighting for Atlassian Fisheye/Crucible
#
# http://stackoverflow.com/questions/14916809/defining-custom-syntax-highlighting-for-atlassian-fisheye-crucible-matlab
syntaxdef matlab {
# whitespace
/\s+/m : ;
# comments
/%.*?$/m : {
region {
type=comment;
index=prose;
findlinks=true;
}
}
# strings
/(?s)((u|U)?(r|R)?)("""|''')(.*?)\4/ : {
region {
type=string;
}
region ${5} {
index=prose;
}
}
# keywords
/(for|end|if|while|function|return|elseif|case|otherwise|switch|continue|else|try|catch|global|persistent\
|break|ans|beep|pi|eps|inf|NaN|nan|i|j|nargin|nargout|realmin|realmax|bitmax|varargin|varargout)\b/ : {
region {
type=keyword;
index=word;
}
}
#identifiers
/[a-zA-Z_][a-zA-Z0-9_]*/ : {
region {
type=identifier;
index=word;
}
}
#numeric literals
/(0(x|X)[0-9A-Fa-f]+(l|L)?)|([0-9]+(\.[0-9]*)?|\.[0-9]+)((e|E)(\+|-)?[0-9]+)?(l|L|j|J)?/ : {
region {
type=numeric;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment