# Declaration part if re.search(
r"(InstallTrueMethod|Declare(Attribute|Category|Filter|Operation" +
r"|GlobalFunction|Synonym|SynonymAttr|Property))", text
):
score += 0.7
# Implementation part if re.search(
r"(DeclareRepresentation|Install(GlobalFunction|Method|" +
r"ImmediateMethod|OtherMethod)|New(Family|Type)|Objectify)", text
):
score += 0.7
return min(score, 1.0)
class GAPConsoleLexer(Lexer): """ For GAP console sessions. Modeled after JuliaConsoleLexer. """
name = 'GAP session'
aliases = ['gap-console', 'gap-repl']
filenames = ['*.tst']
url = 'https://www.gap-system.org'
version_added = '2.14'
for line in text.splitlines(keepends=True): if line.startswith('gap> ') or line.startswith('brk> '):
insertions.append((len(curcode), [(0, Generic.Prompt, line[:5])]))
curcode += line[5:]
output = False
error = False elifnot output and line.startswith('> '):
insertions.append((len(curcode), [(0, Generic.Prompt, line[:2])]))
curcode += line[2:] else: if curcode: yieldfrom do_insertions(
insertions, gaplexer.get_tokens_unprocessed(curcode))
curcode = ''
insertions = [] if line.startswith('Error, ') or error: yield start, Generic.Error, line
error = True else: yield start, Generic.Output, line
output = True
start += len(line)
if curcode: yieldfrom do_insertions(
insertions, gaplexer.get_tokens_unprocessed(curcode))
# the following is needed to distinguish Scilab and GAP .tst files def analyse_text(text): # GAP prompts are a dead give away, although hypothetical;y a # file in another language could be trying to compare a variable # "gap" as in "gap> 0.1". But that this should happen at the # start of a line seems unlikely... if re.search(r"^gap> ", text): return 0.9 else: return 0.0
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 und die Messung sind noch experimentell.