pyuseocl.utils.sources

Classes

AnnotatedSourceFile(fileName[, openingMark, ...]) A source file with annotated fragments.
SourceFile(fileName) A source file seen as as sequence of lines.

AnnotatedSourceFile

class pyuseocl.utils.sources.AnnotatedSourceFile(fileName, openingMark='--oo<< *(?P<value>[^ \n]+) *$', closingMark='--oo>> *$', hereMark='--oo== *(?P<value>[^ \n]+) *$')[source]

A source file with annotated fragments. The source can be viewed both as a flat sequence of line or as a fragment trees. The annotation markers can be defined when building the source file.

Create a annotated source file. The mark have to be provided in the form of regular expression with sometimes an optional named group with the named value. That is a regexp group like (?P<value> ... ). This part will be extracted and will constitute the name of the mark. :param fileName: the file name :type fileName: str :param openingMark: The opening mark with ?P<value> group :type openingMark: str :param closingMark: The closing mark :type closingMark: str :param hereMark: The here mark with ?P<value> group :type hereMark: str :return: AnnotatedSourceFile :rtype: AnnotatedSourceFile

fragment = None

The root fragment according to the given mark

SourceFile

class pyuseocl.utils.sources.SourceFile(fileName)[source]

A source file seen as as sequence of lines. The source file may contains some list of errors.

fileName = None

The filename as given when creating the source file

name = None

The short file name with extension included

sourceLines = None

The list of lines of the source file

errors = None

The list of errors

addError(sourceError)[source]
clearErrors()[source]