Arena
1.0
A content management system
|
A generic Markdown-style statement. More...
Public Member Functions | |
def | init |
Initializer. | |
def | parse |
Parse tokens from the source. More... | |
def | subclassHandlerFor |
Search subclasses for the handler for the specified token. More... | |
def | handlerFor |
Determine whether the class will handle the specified token. More... | |
def | ParsedFrom |
Parse a statement from the specified source. | |
Public Member Functions inherited from Library.Parse.Semantic.SourceStatements.ASourceStatement | |
def | __init__ |
Constructor. | |
def | init |
Initializer. | |
def | Language |
Retrieve the language used to parse the statement. More... | |
Public Member Functions inherited from Library.Parse.Semantic.Statements.AStatement | |
def | __init__ |
Construct a statement instance. More... | |
def | init |
Initializer. | |
def | parse |
Parse the statement. More... | |
def | ParsedFrom |
Construct and parse a statement from the specified parser. More... | |
def | toString |
Construct a string representation of the statement. More... | |
def | value |
Retrieve the value of the statement. More... | |
def | Log |
Retrieve the log used by the statement. More... | |
def | Source |
Retrieve the scanner used by the statement. More... | |
def | Parser |
Retrieve the parser used by the statement. More... | |
def | Output |
Retrieve the output used by the statement. | |
def | OutputTo |
Set the output used by the statement. | |
Public Member Functions inherited from Library.Base.Events.ALoggingEventfulObject | |
def | __init__ |
Constructor. More... | |
def | init |
Initializer. | |
def | error |
Generate an error event. More... | |
def | log |
Log the specified item. More... | |
def | Log |
Retrieve the log used by the class. | |
Public Member Functions inherited from Library.Base.Events.AnEventfulObject | |
def | __init__ |
Constructor. More... | |
def | init |
Initializer. | |
def | __del__ |
Destructor. | |
def | parseParams |
Parse the specified parameters, looking for named events and setting event handlers as appropriate. More... | |
def | generate |
Generate the named event. | |
def | update |
Update the events generated by the object. | |
def | error |
Generate an error event. More... | |
def | toString |
Construct a string representation of the object. More... | |
def | on |
Set the handler for the specified event. More... | |
def | onMultiple |
Set handlers for multiple events. More... | |
def | handlerFor |
Retrieve the handler for the specified event. More... | |
def | generates |
Determine whether or not the object generates the named event. More... | |
def | __getitem__ |
Retrieve the value of the named property. | |
def | __setitem__ |
Set the value of the named property. | |
Public Member Functions inherited from Library.Base.Classwork.AnObject | |
def | init |
Initialize a new object instance. More... | |
def | __init__ |
Construct and initialize a new instance of AnObject. More... | |
def | __del__ |
Destroy the object instance. More... | |
def | displayName |
Construct a "pretty" display name for the class instance, based on the name of its class. More... | |
def | implements |
Determine whether the class instance is related to the specified class. More... | |
def | toString |
Return a string representation of the class, suitable for output to a console or text-based device. More... | |
def | __str__ |
Return a string representation of the class. More... | |
def | classname |
Return the name of the class from which the instance was created. More... | |
def | name |
Return the name of the class. More... | |
Public Member Functions inherited from Library.String.Utilities.IsPrintable | |
def | toString |
Return a string representation of the class conveniently. More... | |
def | __str__ |
Return a string representation of the class. More... | |
def | printTo |
Print a string representation of the class to the specified stream. More... | |
A generic Markdown-style statement.
def Plugins.Content.Parse.Semantic.MarkdownStatements.AMarkdownStatement.handlerFor | ( | Self, | |
tokenCode, | |||
params | |||
) |
Determine whether the class will handle the specified token.
Together with AMarkdownStatement.subclassHandlerFor(), this method makes adding new handlers for Markdown tokens as easy as deriving a class from AMarkdownStatement or its descendants.
The base implementation of this method searches the immediate subclasses of AMarkdownStatement, calling AMarkdownStatement.handlerFor() on each one. THOSE classes, in turn, first determine whether or not they will handle tokenCode
. If not, they search their immediate subclasses (by calling AMarkdownStatement.subclassHandlerFor() on themselves) – and so forth.
The base implementation of this method returns the result of call to AMarkdownStatement.subclassHandlerFor() on itself. The return value will either be an instance of the class that will handle the specified tokenCode
; or None
to indicate that no class was found to handle the specified token.
Descendant classes should override this method to add code that will determine whether or not the class will handle the specified token. Otherwise, the overriding method should return the result of a call to AMarkdownStatement.subclassHandlerFor() on its class.
def Plugins.Content.Parse.Semantic.MarkdownStatements.AMarkdownStatement.parse | ( | Self | ) |
Parse tokens from the source.
Descendant classes should override this method to act on one more or tokens. The base implementation of this method simply outputs the token literal to the output stream and fetches the next token.
def Plugins.Content.Parse.Semantic.MarkdownStatements.AMarkdownStatement.subclassHandlerFor | ( | Self, | |
tokenCode, | |||
params | |||
) |
Search subclasses for the handler for the specified token.
This method takes advantage of the fact that Python links the immediate subclasses of a class to their parent using an iterable object. The method iterates through those subclasses, calling AMarkdownStatement.handlerFor() on each one in an attempt to find a class that will handle the specified tokenCode
.
If a class determines that it will handle the specified tokenCode
, it creates an instance of itself and returns that instance instead of continuing the search. That instance will be returned by this method, which otherwise returns None
to indicate that no class was found to handle the specified tokenCode
.