Modules | Files | Inheritance Tree | Inheritance Graph | Name Index | Config
module Synopsis::Core::AST
class SourceFile
Files: Synopsis/Core/AST.py

The information about a file that the AST was generated from. Contains filename, all declarations from this file (even nested ones) and includes (aka imports) from this file.


Operations Summary:
 __init__(self, filename, full_filename, language)
Constructor [Source]
 is_main(self)
Returns whether this was a main file. [Source]
 set_is_main(self, value)
Sets the is_main flag. [Source]
 filename(self)
Returns the filename of this file. [Source]
 full_filename(self)
Returns the full_filename of this file. [Source]
 language(self)
Returns the language for this file as a string [Source]
 declarations(self)
Returns a list of declarations declared in this file [Source]
 includes(self)
Returns a the files included by this file. [Source]

Operation Details:
  is_main(self)

Returns whether this was a main file. A source file is a main file if it was parsed directly or as an extra file. A source file is not a main file if it was just included. A source file that had no actual declarations but was given to the parser as either the main source file or an extra file is still a main file.


  set_is_main(self, value)

Sets the is_main flag. Typically only called once, and then may by the linker if it discovers that a file is actually a main file elsewhere.


  filename(self)

Returns the filename of this file. The filename can be absolute or relative, depending on the settings for the Parser


  full_filename(self)

Returns the full_filename of this file. The filename can be absolute or relative, depending on the filename given to the Parser. This filename does not have any basename stripped from it, and should be accessible from the current directory as is whether absolute or relative.


  includes(self)

Returns a the files included by this file. These may be absolute or relative, depending on the settings for the Parser. This may also include system files. The return value is a list of tuples, with each tuple being a pair (included-from-filename, include-filename). This allows distinction of files directly included (included-from-filename == self.filename()) but also allows dependency tracking since *all* files read while parsing this file are included in the list (even system files).