Commits

Rafael García committed e9542fc

Fixed regex for osx implementation, patch by Tomasz Klak

  • Participants
  • Parent commits dc2ab9e
  • Tags 0.5

Comments (0)

Files changed (2)

 static const Syntax syntaxes[] = {
 #if HILIGHT_SYNTAX
 {"c", "\\.(c(pp|xx)?|h(pp|xx)?|cc)$", {
-	/* HiRed   */  "",
+	/* HiRed   */  "$^",
 	/* HiGreen */  B"(for|if|while|do|else|case|default|switch|try|throw|catch|operator|new|delete)"B,
 	/* LoGreen */  B"(float|double|bool|char|int|short|long|sizeof|enum|void|static|const|struct|union|typedef|extern|(un)?signed|inline|((s?size)|((u_?)?int(8|16|32|64|ptr)))_t|class|namespace|template|public|protected|private|typename|this|friend|virtual|using|mutable|volatile|register|explicit)"B,
 	/* HiMag   */  B"(goto|continue|break|return)"B,
 	} },
 
 {"sh", "\\.sh$", {
-	/* HiRed   */  "",
+	/* HiRed   */  "$^",
 	/* HiGreen */  "^[0-9A-Z_]+\\(\\)",
 	/* LoGreen */  B"(case|do|done|elif|else|esac|exit|fi|for|function|if|in|local|read|return|select|shift|then|time|until|while)"B,
-	/* HiMag   */  "",
+	/* HiMag   */  "$^",
 	/* LoMag   */  "\"(\\\\.|[^\"])*\"",
 	/* HiBlue  */  "(\\{|\\}|\\(|\\)|\\;|\\]|\\[|`|\\\\|\\$|<|>|!|=|&|\\|)",
 	/* LoRed   */  "\\$\\{?[0-9A-Z_!@#$*?-]+\\}?",
 	} },
 
 {"makefile", "(Makefile[^/]*|\\.mk)$", {
-	/* HiRed   */  "",
-	/* HiGreen */  "",
+	/* HiRed   */  "$^",
+	/* HiGreen */  "$^",
 	/* LoGreen */  "\\$+[{(][a-zA-Z0-9_-]+[})]",
 	/* HiMag   */  B"(if|ifeq|else|endif)"B,
-	/* LoMag   */  "",
+	/* LoMag   */  "$^",
 	/* HiBlue  */  "^[^ 	]+:",
 	/* LoRed   */  "[:=]",
 	/* LoBlue  */  "#.*$",
 
 {"man", "\\.[1-9]x?$", {
 	/* HiRed   */  "\\.(BR?|I[PR]?).*$",
-	/* HiGreen */  "",
+	/* HiGreen */  "$^",
 	/* LoGreen */  "\\.(S|T)H.*$",
 	/* HiMag   */  "\\.(br|DS|RS|RE|PD)",
 	/* LoMag   */  "(\\.(S|T)H|\\.TP)",
 	/* HiBlue  */  "\\.(BR?|I[PR]?|PP)",
-	/* LoRed   */  "",
+	/* LoRed   */  "$^",
 	/* LoBlue  */  "\\\\f[BIPR]",
 	} },
 
 				   : !regexec(syntax_file_res[i], filename, 1, NULL, 0)) {
 			for(j=0; j<SYN_COLORS; j++) {
 				if((syntx >= 0) && syntax_res[syntx][j]) regfree(syntax_res[syntx][j]);
-				if(regcomp(syntax_res[i][j], syntaxes[i].re_text[j], REG_EXTENDED|REG_NEWLINE)) i_die("Faulty regex.\n");
+				if(syntaxes[i].re_text[j] && regcomp(syntax_res[i][j], syntaxes[i].re_text[j], REG_EXTENDED|REG_NEWLINE)) i_die("Faulty regex.\n");
 			}
 			syntx=i;
 			setenv(envs[EnvSyntax], syntaxes[syntx].name, 1);