AST Node Construction

  • Oct 26, 2012

I spent this week examining the various classes that (I believe) create the AST nodes for Looking Glass. As Caitlin suggested, I began by examining ManagementLevel, which is simply an enumeration with the properties of NONE (not generated and not managed), GENERATED (generated, but not managed), and MANAGED (generated, and managed). Whether or not the enum is generated/managed is a boolean value and they can be called with getters. All worlds have userFields that are instantiated with their management level as NONE. Some are later set to be GENERATED OR MANAGED, which I believe means that they either have been created but will not be updated or they have been created and will be updated by LG.

Looking at all of the references for ManagementLevel in the project, I found that the class that controls many of the things behind the scenes is BootstrapUtilities. It actually sets the values of some of the things created to being MANAGED with a method called setValue( PropertOwner owner, E value ) in InstanceProperty. The main two items set to being managed are cameraField and userField initially. When props or characters are inserted into the world, their management levels are also set to be managed. when a userField is MANAGED, the StorytellingSceneEditor will set all of the body statements with false in generateCodeForSetUp.

Looking more closely at how the values are set, it appears as if there is a list of properties in Element called m_listPropertyListeners, which every property is added to when a world is created. This list is iterated through to check and set properties. Each item is set upon creation, however, when a particular event occurs, it can be updated with the setValue from before. 

I believe that every single class that is created in LookingGlass that may be written into the code has a set of properties written out for them. So in the initializer, ManagementLevel is automatically set at NONE where ever it might be needed. What this means for me is that I think it will be fairly straight-forward to create a class that contains the property that I want describe each AST node with. The difficulty will be in determining which of the many classes needs to be updated with the additional property. once it is added, I believe that it will automatically be incorporated into the design that is currently working with the EnumProperties and the BooleanProperties, etc.



  • No comments yet

Log In or Sign Up to leave a comment.