def proper_heading_level(command: Command): Option[Int] =
command.span.name match { case Thy_Header.CHAPTER => Some(0) case Thy_Header.SECTION => Some(1) case Thy_Header.SUBSECTION => Some(2) case Thy_Header.SUBSUBSECTION => Some(3) case Thy_Header.PARAGRAPH => Some(4) case Thy_Header.SUBPARAGRAPH => Some(5) case _ => None
}
def parse_ml_sections(SML: Boolean, text: CharSequence): List[Document] = { val sections = new Sections val nl = new ML_Item(ML_Lex.Token(ML_Lex.Kind.SPACE, "\n"), None)
var context: Scan.Line_Context = Scan.Finished for (line <- Library.separated_chunks(_ == '\n', text)) { val (toks, next_context) = ML_Lex.tokenize_line(SML, line, context) val level =
toks.filterNot(_.is_space) match { case List(tok) if tok.is_comment => val s = tok.source if (Codepoint.iterator(s).exists(c => Character.isLetter(c) || Character.isDigit(c))) { if (s.startsWith("(**** ") && s.endsWith(" ****)")) Some(0) elseif (s.startsWith("(*** ") && s.endsWith(" ***)")) Some(1) elseif (s.startsWith("(** ") && s.endsWith(" **)")) Some(2) elseif (s.startsWith("(* ") && s.endsWith(" *)")) Some(3) else None
} else None case _ => None
} if (level.isDefined && context == Scan.Finished && next_context == Scan.Finished)
toks.foreach(tok => sections.add(new ML_Item(tok, if (tok.is_comment) level else None))) else
toks.foreach(tok => sections.add(new ML_Item(tok, None)))
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.