summary refs log tree commit diff
path: root/bin/make.l
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--bin/make.l30
1 files changed, 26 insertions, 4 deletions
diff --git a/bin/make.l b/bin/make.l
index 49fda674..6d0c73f9 100644
--- a/bin/make.l
+++ b/bin/make.l
@@ -21,7 +21,7 @@
 #include "hilex.h"
 %}
 
-%s Assign
+%s Assign Preproc
 %x Variable Shell
 
 ident [._[:alnum:]]+
@@ -54,6 +54,30 @@ operator [:!]|::
 	return Keyword;
 }
 
+{target}/{operator} { return Ident; }
+
+^"."{ident} |
+^"-"?include {
+	BEGIN(pop = Preproc);
+	return Macro;
+}
+<Preproc>{
+	"\n" {
+		BEGIN(pop = INITIAL);
+		return Normal;
+	}
+	"\\\n""\t"? { return Normal; }
+
+	"\""[^""]*"\"" |
+	"<"[^>]*">" {
+		return String;
+	}
+
+	[!<>=]"="?|"||"|"&&" { return Operator; }
+	[0-9]+|"0x"[[:xdigit:]]+ { return Number; }
+	defined|make|empty|exists|target|commands|in { return Keyword; }
+}
+
 ^{ident}/[[:blank:]]*{assign} {
 	return Ident;
 }
@@ -67,12 +91,10 @@ operator [:!]|::
 		BEGIN(pop = INITIAL);
 		return Normal;
 	}
-	"\\\n""\t"? { return String; }
+	"\\\n""\t"? { return Escape; }
 	[^\\$[:space:]]+|. { return String; }
 }
 
-^"-"?include { return Macro; }
-
 {target} { return Ident; }
 
 "#"([^\\\n]|"\\"[^\n]|"\\\n")* { return Comment; }