Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[Dltk-dev] Handling included/imported scripts

I'm trying to figure out how best to construct a model (partial AST and IModelElement-based) to represent the following scenario.  My compiler has an "include/import" statement roughly analagous to ruby's "import" or a C/C++ header file.

* compiler runs on a single script file, which may include one or more other script files
* I only want the compiler run on the "main" script;  many of the included scripts do not compile properly in isolation.
* I need "look up definition" and problem marker navigation to properly navigate to the proper included script, if appropriate

I currently build a minimal DLTK AST based on compiler output.  Currently I'm storing each included script's AST in a container within the ModuleDeclaration returned by the script parser.  As such, problems reported by the compiler generate incorrect markers with the DefaultProblemFactory (the resource of the marker is the main script, even though the filename reported in the IProblem is different).  I've tried a custom ProblemFactory which fixes the resource in the problem marker, which eliminates the marker from the problems view, but a red X still appears in the main script as if it were the included file. 


A few questions:
o Does the included script have to be part of the project's resources in order to track problems and/or look up definitions?  if so, how best to flag the resource as "do not build"?
o Where does the included script's AST and/or model belong so that problem and/or definition lookup works properly?

Back to the top