Support for specifying memreserve ranges in the source format, based on
a patch by Jon Loeliger <jdl AT freescale.com>, although tweaked
substantially.
diff --git a/dtc-lexer.l b/dtc-lexer.l
index 0f94dfc..cd3229f 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -22,6 +22,7 @@
 
 %x CELLDATA
 %x BYTESTRING
+%x MEMRESERVE
 
 PROPCHAR	[a-zA-Z0-9,._+*#?-]
 UNITCHAR	[0-9a-f,]
@@ -53,6 +54,29 @@
 			return DT_STRING;
 		}
 
+"/memreserve/"	{
+			DPRINT("Keyword: /memreserve/\n");
+			BEGIN(MEMRESERVE);
+			return DT_MEMRESERVE;
+		}
+
+<MEMRESERVE>[0-9a-fA-F]+ {
+			if (yyleng > 2*sizeof(yylval.addr)) {
+				fprintf(stderr, "Address value %s too large\n",
+					yytext);
+			}
+			yylval.addr = (u64) strtoull(yytext, NULL, 16);
+			DPRINT("Addr: %llx\n",
+			       (unsigned long long)yylval.addr);
+			return DT_ADDR;
+		}
+
+<MEMRESERVE>";"	{
+			DPRINT("/MEMRESERVE\n");
+			BEGIN(INITIAL);
+			return ';';
+		}
+
 <CELLDATA>[0-9a-fA-F]+	{
 			if (yyleng > 2*sizeof(yylval.cval)) {
 				fprintf(stderr,
@@ -116,7 +140,7 @@
 
 <*>"//".*\n	/* eat line comments */
 
-.		{
+<*>.		{
 			switch (yytext[0]) {
 				case '<':
 					DPRINT("CELLDATA\n");