more explicit language context;
authorwenzelm
Fri, 13 Jan 2023 19:07:18 +0100
changeset 76966 2f91b787f509
parent 76965 922df6aa1607
child 76967 38e19412cf31
more explicit language context;
src/Pure/PIDE/markup.scala
src/Pure/Tools/update.scala
--- a/src/Pure/PIDE/markup.scala	Fri Jan 13 17:14:59 2023 +0100
+++ b/src/Pure/PIDE/markup.scala	Fri Jan 13 19:07:18 2023 +0100
@@ -198,6 +198,8 @@
       def description: String = Word.implode(Word.explode('_', name))
     }
 
+    val outer: Value = Value("", true, false, false)
+
     def unapply(markup: Markup): Option[Value] =
       markup match {
         case Markup(LANGUAGE, props) =>
--- a/src/Pure/Tools/update.scala	Fri Jan 13 17:14:59 2023 +0100
+++ b/src/Pure/Tools/update.scala	Fri Jan 13 19:07:18 2023 +0100
@@ -62,17 +62,20 @@
 
     val path_cartouches = options.bool("update_path_cartouches")
 
-    def update_xml(xml: XML.Body): XML.Body =
+    def update_xml(lang: Markup.Language.Value, xml: XML.Body): XML.Body =
       xml flatMap {
         case XML.Wrapped_Elem(markup, body1, body2) =>
-          if (markup.name == Markup.UPDATE) update_xml(body1) else update_xml(body2)
-        case XML.Elem(Markup.Language(lang), body)
-        if lang.is_path && path_cartouches =>
-          Token.read_embedded(Keyword.Keywords.empty, XML.content(body)) match {
-            case Some(tok) => List(XML.Text(Symbol.cartouche(tok.content)))
-            case None => update_xml(body)
+          val body = if (markup.name == Markup.UPDATE) body1 else body2
+          update_xml(lang, body)
+        case XML.Elem(Markup.Language(lang), body) =>
+          if (lang.is_path && path_cartouches) {
+            Token.read_embedded(Keyword.Keywords.empty, XML.content(body)) match {
+              case Some(tok) => List(XML.Text(Symbol.cartouche(tok.content)))
+              case None => update_xml(lang, body)
+            }
           }
-        case XML.Elem(_, body) => update_xml(body)
+          else update_xml(lang, body)
+        case XML.Elem(_, body) => update_xml(lang, body)
         case t => List(t)
       }
 
@@ -102,7 +105,7 @@
             } {
               progress.expose_interrupt()
               val source1 =
-                XML.content(update_xml(
+                XML.content(update_xml(Markup.Language.outer,
                   snapshot.xml_markup(elements = Markup.Elements(Markup.UPDATE, Markup.LANGUAGE))))
               if (source1 != snapshot.node.source) {
                 val path = Path.explode(node_name.node)