src/Pure/General/antiquote.ML
changeset 67193 4ade0d387429
parent 62797 e08c44eed27f
child 67426 6311cf9dc943
--- a/src/Pure/General/antiquote.ML	Tue Dec 12 17:53:59 2017 +0100
+++ b/src/Pure/General/antiquote.ML	Tue Dec 12 18:53:40 2017 +0100
@@ -76,11 +76,15 @@
 
 val err_prefix = "Antiquotation lexical error: ";
 
+val scan_nl = Scan.one (fn (s, _) => s = "\n") >> single;
+
 val scan_txt =
+  scan_nl ||
   Scan.repeats1
    (Scan.many1 (fn (s, _) =>
-      not (Symbol.is_control s) andalso s <> Symbol.open_ andalso s <> "@" andalso Symbol.not_eof s) ||
-    $$$ "@" --| Scan.ahead (~$$ "{"));
+      not (Symbol.is_control s) andalso s <> Symbol.open_ andalso s <> "@" andalso
+        s <> "\n" andalso Symbol.not_eof s) ||
+    $$$ "@" --| Scan.ahead (~$$ "{")) @@@ Scan.optional scan_nl [];
 
 val scan_antiq_body =
   Scan.trace (Symbol_Pos.scan_string_qq err_prefix || Symbol_Pos.scan_string_bq err_prefix) >> #2 ||