com.aptana.ide.parsing
Interface IParseState

All Known Implementing Classes:
CSSParseState, HTMLParseState, JSCommentParseState, JSParseState, ParseState, ParseStateChild, ScriptDocParseState, XMLParseState

public interface IParseState

Stores the current lexemes of the current file, as well as the parse results. If all else fails, this is the "most correct" version of the file information. Everything a generic parser needs in order to parse a file.

Author:
Kevin Lindsey

Method Summary
 void addChildState(IParseState child)
          Add a child parse state to this parse state
 void addCommentRegion(IParseNode node)
          Adds a comment region (GenericCommentNode) to this parse state
 void clearCommentRegions()
          Clears the comments regions
 IParseState[] getChildren()
          Get the child parse states for this parser
 IParseNode[] getCommentRegions()
          Gets the comment regions currently in this parse state
 int getFileIndex()
          Get the file index associated with this parse state
 char[] getInsertedText()
          Get the source code that has been inserted into the source document
 java.lang.String getLanguage()
          Gets the language mime type for this parse state.
 LexemeList getLexemeList()
          Retrieve the lexeme list associated with this parse state
 IParseState getParent()
          Get the parent parse state for this parse state
 IParseNodeFactory getParseNodeFactory()
          Gets the factory that creates all parse nodes for a given language.
 IParseNode getParseResults()
          Gets the results of a parse.
 IParseState getParseState(java.lang.String language)
          Get the child parse state of given language
 long getParseTime()
          Return the amount of time in milliseconds that elapsed during parsing of the edit represented by this parse state
 int getRemoveLength()
          Gets the length of the source code that has been deleted, if any.
 IParseState getRoot()
          Get the top-most IParseState in this tree.
 char[] getSource()
          Retrieve the full source of the current document
 int getStartingOffset()
          Get the offset where the source code begins in the source file
 java.util.HashMap getUpdatedProperties()
           
 void onAfterParse()
          Called after the full parse happens (after parse, but not before parseComposite).
 void onBeforeParse()
          Called before the full parse happens (before parse, but not before parseComposite).
 void removeChildState(IParseState child)
          Remove a child parse state from this parse state
 void reset()
          Reset all the state information associated with this parse context
 void setEditState(java.lang.String source, java.lang.String insertedSource, int offset, int removeLength)
          Setup this parse state with the next edit to the source document
 void setFileIndex(int index)
          Set the file index associate with this parse state
 void setParseResults(IParseNode results)
          Sets the results of a parse.
 void setParseTime(long elapsedMilliseconds)
          Set the total number of milliseconds that elapsed for the last parse
 void unloadFromEnvironment()
          Unloads any additions the parse of this parse state has added to the environment
 void updateLexemeList()
          Update the lexeme list based on the edits represented by this parse state
 

Method Detail

getChildren

IParseState[] getChildren()
Get the child parse states for this parser

Returns:
Returns the child parse states for this parser

getFileIndex

int getFileIndex()
Get the file index associated with this parse state

Returns:
Returns the associated file index

setFileIndex

void setFileIndex(int index)
Set the file index associate with this parse state

Parameters:
index - The new file index for this parse state

getInsertedText

char[] getInsertedText()
Get the source code that has been inserted into the source document

Returns:
Returns the source code that has been inserted into the source document

getLexemeList

LexemeList getLexemeList()
Retrieve the lexeme list associated with this parse state

Returns:
Returns this parse state's lexeme list

getParent

IParseState getParent()
Get the parent parse state for this parse state

Returns:
Returns the parse state that owns this parse state

getParseState

IParseState getParseState(java.lang.String language)
Get the child parse state of given language

Parameters:
language - the language mime type
Returns:
Returns the parse state that owns this parse state

getParseTime

long getParseTime()
Return the amount of time in milliseconds that elapsed during parsing of the edit represented by this parse state

Returns:
Returns the amount of time in milliseconds that elapsed during the last parse

setParseTime

void setParseTime(long elapsedMilliseconds)
Set the total number of milliseconds that elapsed for the last parse

Parameters:
elapsedMilliseconds - The new elapsed time

getRemoveLength

int getRemoveLength()
Gets the length of the source code that has been deleted, if any.

Returns:
Returns the length of the deleted text.

getRoot

IParseState getRoot()
Get the top-most IParseState in this tree. This is typically needed for calls that need to propagate to all child parse states, like reset()

Returns:
Returns the top-most IParseState in the tree

getSource

char[] getSource()
Retrieve the full source of the current document

Returns:
Returns the source of the current document

getStartingOffset

int getStartingOffset()
Get the offset where the source code begins in the source file

Returns:
Returns the source code's offset within its source file

addChildState

void addChildState(IParseState child)
Add a child parse state to this parse state

Parameters:
child - The child parse state to add

removeChildState

void removeChildState(IParseState child)
Remove a child parse state from this parse state

Parameters:
child - The child parse state to remove

reset

void reset()
Reset all the state information associated with this parse context


setEditState

void setEditState(java.lang.String source,
                  java.lang.String insertedSource,
                  int offset,
                  int removeLength)
Setup this parse state with the next edit to the source document

Parameters:
source - The entire source of the document after this edit has been applied
insertedSource - The new text inserted into the document
offset - The offset where this edit occurred
removeLength - The number of characters to remove before inserting the insertedSource

updateLexemeList

void updateLexemeList()
Update the lexeme list based on the edits represented by this parse state


onBeforeParse

void onBeforeParse()
Called before the full parse happens (before parse, but not before parseComposite).


onAfterParse

void onAfterParse()
Called after the full parse happens (after parse, but not before parseComposite).


addCommentRegion

void addCommentRegion(IParseNode node)
Adds a comment region (GenericCommentNode) to this parse state

Parameters:
node - GenericCommentNode instance

getCommentRegions

IParseNode[] getCommentRegions()
Gets the comment regions currently in this parse state

Returns:
- Array of GenericCommentNode nodes

clearCommentRegions

void clearCommentRegions()
Clears the comments regions


getLanguage

java.lang.String getLanguage()
Gets the language mime type for this parse state.

Returns:
Returns the language mime type for this parse state.

getParseNodeFactory

IParseNodeFactory getParseNodeFactory()
Gets the factory that creates all parse nodes for a given language.

Returns:
IParseNodeFactory

setParseResults

void setParseResults(IParseNode results)
Sets the results of a parse.

Parameters:
results -

getParseResults

IParseNode getParseResults()
Gets the results of a parse.

Returns:
Returns the results of a parse.

getUpdatedProperties

java.util.HashMap getUpdatedProperties()
Returns:
Returns object that holds the environment properties that have been added by this parseState.

unloadFromEnvironment

void unloadFromEnvironment()
Unloads any additions the parse of this parse state has added to the environment