src/Pure/PIDE/document.scala
changeset 55620 19dffae33cde
parent 55435 662e0fd39823
child 55649 1532ab0dc67b
equal deleted inserted replaced
55619:c5aeeacdd2b1 55620:19dffae33cde
   367     val thy_load_commands: List[Command]
   367     val thy_load_commands: List[Command]
   368     def eq_content(other: Snapshot): Boolean
   368     def eq_content(other: Snapshot): Boolean
   369     def cumulate_markup[A](
   369     def cumulate_markup[A](
   370       range: Text.Range,
   370       range: Text.Range,
   371       info: A,
   371       info: A,
   372       elements: Option[Set[String]],
   372       elements: String => Boolean,
   373       result: Command.State => (A, Text.Markup) => Option[A]): List[Text.Info[A]]
   373       result: Command.State => (A, Text.Markup) => Option[A]): List[Text.Info[A]]
   374     def select_markup[A](
   374     def select_markup[A](
   375       range: Text.Range,
   375       range: Text.Range,
   376       elements: Option[Set[String]],
   376       elements: String => Boolean,
   377       result: Command.State => Text.Markup => Option[A]): List[Text.Info[A]]
   377       result: Command.State => Text.Markup => Option[A]): List[Text.Info[A]]
   378   }
   378   }
   379 
   379 
   380   type Assign_Update =
   380   type Assign_Update =
   381     List[(Document_ID.Command, List[Document_ID.Exec])]  // update of exec state assignment
   381     List[(Document_ID.Command, List[Document_ID.Exec])]  // update of exec state assignment
   627           (node.commands.iterator zip other.node.commands.iterator).forall(eq_commands) &&
   627           (node.commands.iterator zip other.node.commands.iterator).forall(eq_commands) &&
   628           thy_load_commands.length == other.thy_load_commands.length &&
   628           thy_load_commands.length == other.thy_load_commands.length &&
   629           (thy_load_commands zip other.thy_load_commands).forall(eq_commands)
   629           (thy_load_commands zip other.thy_load_commands).forall(eq_commands)
   630         }
   630         }
   631 
   631 
   632         def cumulate_markup[A](range: Text.Range, info: A, elements: Option[Set[String]],
   632         def cumulate_markup[A](range: Text.Range, info: A, elements: String => Boolean,
   633           result: Command.State => (A, Text.Markup) => Option[A]): List[Text.Info[A]] =
   633           result: Command.State => (A, Text.Markup) => Option[A]): List[Text.Info[A]] =
   634         {
   634         {
   635           val former_range = revert(range)
   635           val former_range = revert(range)
   636           thy_load_commands match {
   636           thy_load_commands match {
   637             case thy_load_command :: _ =>
   637             case thy_load_command :: _ =>
   657                 ).iterator
   657                 ).iterator
   658               } yield Text.Info(convert(r0 + command_start), a)).toList
   658               } yield Text.Info(convert(r0 + command_start), a)).toList
   659           }
   659           }
   660         }
   660         }
   661 
   661 
   662         def select_markup[A](range: Text.Range, elements: Option[Set[String]],
   662         def select_markup[A](range: Text.Range, elements: String => Boolean,
   663           result: Command.State => Text.Markup => Option[A]): List[Text.Info[A]] =
   663           result: Command.State => Text.Markup => Option[A]): List[Text.Info[A]] =
   664         {
   664         {
   665           def result1(st: Command.State): (Option[A], Text.Markup) => Option[Option[A]] =
   665           def result1(st: Command.State): (Option[A], Text.Markup) => Option[Option[A]] =
   666           {
   666           {
   667             val res = result(st)
   667             val res = result(st)
   669               res(x) match {
   669               res(x) match {
   670                 case None => None
   670                 case None => None
   671                 case some => Some(some)
   671                 case some => Some(some)
   672               }
   672               }
   673           }
   673           }
   674           for (Text.Info(r, Some(x)) <- cumulate_markup(range, None, elements, result1))
   674           for (Text.Info(r, Some(x)) <- cumulate_markup(range, None, elements, result1 _))
   675             yield Text.Info(r, x)
   675             yield Text.Info(r, x)
   676         }
   676         }
   677       }
   677       }
   678     }
   678     }
   679   }
   679   }