def compact_source: (String, Span) = { val source = Token.implode(content) val content1 = new mutable.ListBuffer[Token] var i = 0 for (Token(kind, s) <- content) { val n = s.length val s1 = source.substring(i, i + n)
content1 += Token(kind, s1)
i += n
}
(source, Span(kind, content1.toList))
}
def clean_arguments: List[(Token, Int)] = { if (name.nonEmpty) { def clean(toks: List[(Token, Int)]): List[(Token, Int)] =
toks match { case (t1, i1) :: (t2, i2) :: rest => if (t1.is_keyword && t1.source == "%" && t2.is_name) clean(rest) else (t1, i1) :: clean((t2, i2) :: rest) case _ => toks
}
clean(content.zipWithIndex.filter({ case (t, _) => t.is_proper }))
.dropWhile({ case (t, _) => !t.is_command })
.dropWhile({ case (t, _) => t.is_command })
} else Nil
}
def loaded_files(syntax: Outer_Syntax): Loaded_Files =
syntax.load_command(name) match { case None => Loaded_Files.none case Some(a) =>
load_commands.find(_.name == a) match { case Some(load_command) => load_command.loaded_files(clean_arguments) case None => error("Undefined load command function: " + a)
}
}
}
val empty: Span = Span(Ignored_Span, Nil)
def unparsed(source: String, theory_commands: Option[Int] = None): Span = { val kind =
theory_commands match { case Some(commands) => Theory_Span(commands) case None => Malformed_Span
}
Span(kind, List(Token(Token.Kind.UNPARSED, source)))
}
}
¤ Dauer der Verarbeitung: 0.14 Sekunden
(vorverarbeitet)
¤
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.