Browse Source

[lexer] allow capitalized `#if` dot-idents, closes #8364

Jens Fischer 6 years ago
parent
commit
877addced2

+ 2 - 2
src/syntax/lexer.ml

@@ -279,11 +279,11 @@ let ident = [%sedlex.regexp?
 
 let sharp_ident = [%sedlex.regexp?
 	(
-		('a'..'z' | '_'),
+		('a'..'z' | 'A'..'Z' | '_'),
 		Star ('a'..'z' | 'A'..'Z' | '0'..'9' | '_'),
 		Star (
 			'.',
-			('a'..'z' | '_'),
+			('a'..'z' | 'A'..'Z' | '_'),
 			Star ('a'..'z' | 'A'..'Z' | '0'..'9' | '_')
 		)
 	)

+ 15 - 0
tests/misc/projects/Issue8364/Main.hx

@@ -0,0 +1,15 @@
+class Main {
+	static function main() {
+		#if FOO.BAR
+		// pass
+		#else
+		throw 'FOO.BAR condition failed';
+		#end
+
+		#if foo.bar
+		// pass
+		#else
+		throw 'foo.bar condition failed';
+		#end
+	}
+}

+ 4 - 0
tests/misc/projects/Issue8364/compile.hxml

@@ -0,0 +1,4 @@
+-main Main
+--interp
+-D FOO.BAR
+-D foo.bar