Skip to content

Instantly share code, notes, and snippets.

@roman-kashitsyn
Last active August 29, 2015 14:01
Show Gist options
  • Save roman-kashitsyn/25b1c4d536b5db95ffdd to your computer and use it in GitHub Desktop.
Save roman-kashitsyn/25b1c4d536b5db95ffdd to your computer and use it in GitHub Desktop.
GNU Make FishEye/Crucible syntax highlighting.
# Basic GNU make syntax highlighting rules for FishEye/Crucible.
#
# Put this file to the <FISHEYE_INST>/syntax directory and update the
# <FISHEYE_INST>/syntax/filename.map file to contain the following lines:
#
# "**/*.mk" make.def "Makefile"
# "**/makefile" make.def "Makefile"
# "**/Makefile" make.def "Makefile"
# "**/GNUMakefile" make.def "Makefile"
#
# FishEye/Crucible needs to be restarted to have the changes take effect.
#
# References:
# * https://confluence.atlassian.com/display/FISHKB/Defining+your+own+syntax+highlighting+in+Crucible+or+Fisheye
# * https://confluence.atlassian.com/display/FISHKB/Configure+syntax+highlighting+for+non-standard+file+extensions
#
syntaxdef make {
# Whitespaces
/\s+/m : ;
# Comments
/(?<![\$])#(.*?)$/m : {
todo(${1});
region {
type=comment;
index=prose;
findlinks=true;
}
region ${1} {
index=prose;
}
}
# String literals
/"/ : {
context {
/\\./: ;
/$/m : exit;
"\"" : exit;
}
region ${ALL} {
type=string;
}
}
/'[^']*'/ : {
region {
type=string;
}
}
# Predefined functions
/(?<=\$[({])(a(nd|dd(prefix|suffix)|bspath)|basename|call|dir|e(val|rror)|f(lavor|oreach|i(nd(string)?|rstword|lter(-out)?))|i(f|nfo)|join|lastword|notdir|or(igin)?|patsubst|realpath|s(ubst|hell|ort|trip|uffix)|value|w(arning|ildcard|ord(list|s)?))\b/ : {
region {
type=keyword;
}
}
# Special targets
/\.(S(UFFIXES|ECONDARY|ILENT)|P(HONY|OSIX|RECIOUS)|I(GNORE|NTERMEDIATE)|EXPORT_ALL_VARIABLES|KEEP_STATE|LIBPATTERNS|NOTPARALLEL|DE(LETE_ON_ERROR|FAULT))\b/ : {
region {
type=keyword;
}
}
# Directves
/\b(if(n?def|n?eq)?|e(lse|nd(ef|if)|xport)|-include|sinclude|define|unexport|override|vpath)\b/ : {
region {
type=prepocessor;
}
}
# Shell keywords
/(do(?:ne)?|el(?:if|se)|f(?:i|or)|i[fn]|then|until|while)\b/ : {
region {
type=keyword;
}
}
# Automatic variables
/\b\$[@%<?^+|*1-9]\b/ : {
region {
type=keyword;
}
}
/\b\$\([@%*<?^+][DF]\)\b/ : {
region {
type=keyword;
}
}
# Identifiers
/[-_a-zA-Z0-9]*/ : {
region {
type=identifier;
index=word;
}
}
context todo {
/(?i)todo\s.*/ : {
region {
type=todo;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment