story.scheherazade.grammars
Class SCHGrammarTools

java.lang.Object
  extended by story.scheherazade.grammars.SCHGrammarTools

public class SCHGrammarTools
extends java.lang.Object

Back-end functions for the Scheherazade grammar.


Constructor Summary
SCHGrammarTools()
           
 
Method Summary
static Action action(ReturnValue actionType, ReturnValue truthDegree, ReturnValue modeReturn, SCHArguments args)
          Parse in an Action.
static StoryAssertionParameter assertionParameter(ReturnValue paramType, ReturnValue roleRV, SCHArguments args)
          Handles a complete StoryAssertion parameter, with type and arguments (e.g., node[role](arg))
static AssignedActionAddress assignedActionAddress(Action action, ReturnValue time)
          Parse in an AssignedActionAddress.
static AssignedConditionAddress assignedConditionAddress(Condition condition, ReturnValue time)
          Parse in an AssignedConditionAddress.
static AssignedModifierAddress assignedModifierAddress(Modifier modifier, ReturnValue modified)
          Parse in an AssignedModifierAddress
static ReturnValue atomicID(SCHSymbolTable symbols, java.lang.String id)
          Handle an atomic identifier
static Condition condition(ReturnValue conditionType, ReturnValue truthDegree, ReturnValue modeReturn, SCHArguments args)
          Parse in a Condition.
static StoryPoint makePoint(ReturnValue pointType, SCHArguments args)
          Roll up a StoryPoint out of a parsed out ID (presumably a StoryPointType) and a series of arguments
static Modifier modifier(ReturnValue modifierType, SCHArguments args)
          Parse in a Modifier.
static java.lang.Object noun(ReturnValue nounType, SCHArguments args, ReturnValue nounName, NounFlavor flavor)
          Parse in a Noun.
static java.lang.Object parseID(java.lang.String id, SCHSymbolTable symbols)
          Given a string identifier, determine what kind of identifier it is, and upgrade it to a more specific object if possible.
static java.lang.Object stripArg(ReturnValue returnValue, SCHSymbolTable symbols)
          Given a ReturnValue, return the value itself, stripping away the encapsulation of ReturnVector.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SCHGrammarTools

public SCHGrammarTools()
Method Detail

parseID

public static java.lang.Object parseID(java.lang.String id,
                                       SCHSymbolTable symbols)
                                throws Scheherexception
Given a string identifier, determine what kind of identifier it is, and upgrade it to a more specific object if possible.

Parameters:
id - String identifier.
Returns:
An object that is the most semantically specific object for the identifier. For example, it might be NarrativeID if the identifier was a properly punctuated node (i.e., [name]), or a CharacterName, etc.
Throws:
Scheherexception

atomicID

public static ReturnValue atomicID(SCHSymbolTable symbols,
                                   java.lang.String id)
                            throws Scheherexception
Handle an atomic identifier

Throws:
Scheherexception

assertionParameter

public static StoryAssertionParameter assertionParameter(ReturnValue paramType,
                                                         ReturnValue roleRV,
                                                         SCHArguments args)
                                                  throws Scheherexception
Handles a complete StoryAssertion parameter, with type and arguments (e.g., node[role](arg))

Throws:
Scheherexception

stripArg

public static java.lang.Object stripArg(ReturnValue returnValue,
                                        SCHSymbolTable symbols)
                                 throws Scheherexception
Given a ReturnValue, return the value itself, stripping away the encapsulation of ReturnVector. However, if there is an associated argument to any value (i.e., an argument in an argument), this will throw an exception. Also dereferences from the symbol table

Throws:
Scheherexception

makePoint

public static StoryPoint makePoint(ReturnValue pointType,
                                   SCHArguments args)
                            throws Scheherexception
Roll up a StoryPoint out of a parsed out ID (presumably a StoryPointType) and a series of arguments

Throws:
Scheherexception

condition

public static Condition condition(ReturnValue conditionType,
                                  ReturnValue truthDegree,
                                  ReturnValue modeReturn,
                                  SCHArguments args)
                           throws Scheherexception
Parse in a Condition.

Throws:
Scheherexception

noun

public static java.lang.Object noun(ReturnValue nounType,
                                    SCHArguments args,
                                    ReturnValue nounName,
                                    NounFlavor flavor)
                             throws Scheherexception
Parse in a Noun.

Throws:
Scheherexception

action

public static Action action(ReturnValue actionType,
                            ReturnValue truthDegree,
                            ReturnValue modeReturn,
                            SCHArguments args)
                     throws Scheherexception
Parse in an Action.

Throws:
Scheherexception

assignedConditionAddress

public static AssignedConditionAddress assignedConditionAddress(Condition condition,
                                                                ReturnValue time)
                                                         throws Scheherexception
Parse in an AssignedConditionAddress.

Throws:
Scheherexception

assignedActionAddress

public static AssignedActionAddress assignedActionAddress(Action action,
                                                          ReturnValue time)
                                                   throws Scheherexception
Parse in an AssignedActionAddress.

Throws:
Scheherexception

modifier

public static Modifier modifier(ReturnValue modifierType,
                                SCHArguments args)
                         throws Scheherexception
Parse in a Modifier.

Throws:
Scheherexception

assignedModifierAddress

public static AssignedModifierAddress assignedModifierAddress(Modifier modifier,
                                                              ReturnValue modified)
                                                       throws Scheherexception
Parse in an AssignedModifierAddress

Throws:
Scheherexception


Copyright © 2011 David K. Elson. All Rights Reserved.