Follow the links below to browse sample Javadoc for MJ classes and tools, including the MJ Runtime Library.

 

Package: com.arsi.mj.maprpt.lexer.ptree.cmd  previous next contents

Package com.arsi.mj.maprpt.lexer.ptree.cmd contains the following classes and interfaces.
Classes and Interfaces
CommandParseResult Result returned by IRunCommandParser.parseCommand method.
CommandParserFactory Simple factory class for creating instances of IRunCommandParser.
IRunCommandParser Parses a Mapper RUN command (e.g., LDV, SRH) to create a command node in the parse tree for a Mapper report.
MaprptVariableType Enumeration of Mapper native variable types.
RunCommandParserBase Base class for RUN command parsers that contain common methods.

Class: CommandParseResult   next package

Result returned by IRunCommandParser.parseCommand method.
public class com.arsi.mj.maprpt.lexer.ptree.cmd.CommandParseResult
  extends java.lang.Object
Fields
Node that results from parsing command.
public final com.arsi.mj.maprpt.lexer.ptree.CommandParseNode commandNode
Last token read during parse, which should become the new initial token.
public final com.arsi.mj.maprpt.lexer.tokens.IMaprptToken lastTokenRead
Constructors
Initializes an instance of this class.
Parameters:
aLastTokenRead - last token read during parse, which should become the new initial token. This is typically the token that ends the command, such as PeriodToken or AlphanumStringToken that represents a new command.
aNode - node resulting from parsing command.
public CommandParseResult(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken aLastTokenRead, com.arsi.mj.maprpt.lexer.ptree.CommandParseNode aNode)

Class: CommandParserFactory   previous next package

Simple factory class for creating instances of IRunCommandParser.
Treat this class as "thread-safe", since it is immutable once created.
public class com.arsi.mj.maprpt.lexer.ptree.cmd.CommandParserFactory
  extends java.lang.Object
Constructors
public CommandParserFactory()
Methods
Given a purported Mapper RUN command name, create a command parser instance for the command.
Parameters:
aName - name of RUN command (e.g., "LDV", "brk").
Throws:
MJTranslateException - if command parser instance cannot be instantiated.
Returns:
command parser instance, or NULL if name is not a valid RUN command.
public static com.arsi.mj.maprpt.lexer.ptree.cmd.IRunCommandParser createCommandParser(java.lang.String aName)
    throws com.arsi.mj.MJTranslateException
Is specified name a valid Mapper RUN command?
Parameters:
aName - name to check for RUN command (e.g., "LDV", "brk").
Returns:
true if specified name a valid Mapper RUN command, false if not.
public static boolean isRunCommand(java.lang.String aName)

Interface: IRunCommandParser   previous next package

Parses a Mapper RUN command (e.g., LDV, SRH) to create a command node in the parse tree for a Mapper report.
public interface com.arsi.mj.maprpt.lexer.ptree.cmd.IRunCommandParser
Methods
public com.arsi.mj.maprpt.lexer.ptree.cmd.CommandParseResult parseCommand(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, org.springframework.context.ApplicationContext anAppCtx)
    throws com.arsi.mj.MJTranslateException

Class: MaprptVariableType   previous next package

Enumeration of Mapper native variable types.
public final class com.arsi.mj.maprpt.lexer.ptree.cmd.MaprptVariableType
  extends java.lang.Enum
  implements com.arsi.mj.IGenericEnum
Fields
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.MaprptVariableType ALPHANUMERIC
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.MaprptVariableType FIXED_POINT
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.MaprptVariableType HOLLERITH
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.MaprptVariableType INTEGER
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.MaprptVariableType OCTAL
public static final com.arsi.mj.maprpt.lexer.ptree.cmd.MaprptVariableType STRING
Methods
Get canonical name of the enumeration constant, which is the associated string value.
Returns:
canonical name (e.g., for HOLLERITH, canonical name is "H").
public java.lang.String asName()
Given canonical name (associated string value) of an enumeration constant, return the Java enumeration constant.
Parameters:
aValue - associated string value (canonical name, e.g., "H").
Throws:
IllegalArgumentException - if aValue is not associated with any enumeration constant.
Returns:
enumeration constant associated with string value (e.g., HOLLERITH).
public static com.arsi.mj.maprpt.lexer.ptree.cmd.MaprptVariableType asValueOf(java.lang.String aValue)
Given a data type, return corresponding variable type.
Parameters:
aDataType - a non-NULL data type.
Returns:
corresponding variable type.
public static com.arsi.mj.maprpt.lexer.ptree.cmd.MaprptVariableType fromDataType(com.arsi.mj.datatype.MaprptDataType aDataType)
public static com.arsi.mj.maprpt.lexer.ptree.cmd.MaprptVariableType valueOf(java.lang.String name)
public static com.arsi.mj.maprpt.lexer.ptree.cmd.MaprptVariableType values()

Class: RunCommandParserBase   previous package

Base class for RUN command parsers that contain common methods.
Treat this class as "thread-hostile", as an instance is designed to be created, used and discarded by a single thread.
public abstract class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase
  extends java.lang.Object
Inner Class CabinetAsQuotedStringResult
Result returned by parseRptnameCabinetOrResultFromQuoted method.
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.CabinetAsQuotedStringResult
  extends java.lang.Object
Cabinet, drawer and report number, or NULL if not applicable.
public final com.arsi.mj.maprpt.namedrpt.NamedReportLookup.CDRCoordinate cdrCoordinate

Expression that resolves to result number (e.g., -0), or NULL if not applicable.
public final com.arsi.mj.maprpt.lexer.ptree.expr.ConcatExpr concatExpr

Last token read during parse, which should become the new initial token.
public final com.arsi.mj.maprpt.lexer.tokens.IMaprptToken lastTokenRead

Result number (e.g., -0), or NULL if not applicable.
public final java.lang.Integer resultNumber

Initializes an instance of this class.
Parameters:
anExpr - concatenation expression that resolves to result number (e.g., -0).
aLastTokenRead - last token read during parse, which should become the new initial token. If encountered EOF on lexer (last token in last command line on Mapper report, this will be NULL).
public RunCommandParserBase.CabinetAsQuotedStringResult(com.arsi.mj.maprpt.lexer.ptree.expr.ConcatExpr anExpr, com.arsi.mj.maprpt.lexer.tokens.IMaprptToken aLastTokenRead)
Initializes an instance of this class.
Parameters:
aResultNumber - a result number (e.g., -0).
aLastTokenRead - last token read during parse, which should become the new initial token. If encountered EOF on lexer (last token in last command line on Mapper report, this will be NULL).
public RunCommandParserBase.CabinetAsQuotedStringResult(java.lang.Integer aResultNumber, com.arsi.mj.maprpt.lexer.tokens.IMaprptToken aLastTokenRead)
Initializes an instance of this class.
Parameters:
aCDR - cabinet, drawer (optional) and report number (optional).
aLastTokenRead - last token read during parse, which should become the new initial token. If encountered EOF on lexer (last token in last command line on Mapper report, this will be NULL).
public RunCommandParserBase.CabinetAsQuotedStringResult(com.arsi.mj.maprpt.namedrpt.NamedReportLookup.CDRCoordinate aCDR, com.arsi.mj.maprpt.lexer.tokens.IMaprptToken aLastTokenRead)
Inner Class CdrResult
Result returned by parseCdr method.
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.CdrResult
  extends java.lang.Object
public final com.arsi.mj.maprpt.lexer.ptree.symbol.Cdr cdr
public final com.arsi.mj.maprpt.lexer.tokens.IMaprptToken lastTokenRead
Initializes an instance of this class.
Parameters:
aLastTokenRead - last token read during parse, which should become the new initial token.
aCdr - cabinet-drawer-report specification.
public RunCommandParserBase.CdrResult(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken aLastTokenRead, com.arsi.mj.maprpt.lexer.ptree.symbol.Cdr aCdr)
Inner Class ConcatEndOfExprDefaultImpl
Default implementation class that checks for end of concatenation expression.
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatEndOfExprDefaultImpl
  extends java.lang.Object
  implements com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatEndOfExpr
public RunCommandParserBase.ConcatEndOfExprDefaultImpl()
public com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatEndOfExprResult isEndOfExpr(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
Inner Class ConcatEndOfExprOneshotImpl
End-of-concatenation expression class that grabs the first construct (e.g., variable reference or text) recognized in the expression.
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatEndOfExprOneshotImpl
  extends java.lang.Object
  implements com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatEndOfExpr, com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatExprObserver
Terminate expression when input token matches one of these types. If requireExprBeforeEnding is true, one construct in an expression (e.g., text, variable, reserved word) must have been recognized before one of these token types terminates the expression.
protected final java.lang.Class endingTokenTypes

Indicates a variable reference, text or reserved word was recognized while parsing concatenation expression.
protected boolean foundExpr

If true, require that an expression has been recognized before returning.
protected boolean requireExprBeforeEnding

public RunCommandParserBase.ConcatEndOfExprOneshotImpl(java.lang.Class someEndingTokenTypes)
public RunCommandParserBase.ConcatEndOfExprOneshotImpl(java.lang.Class someEndingTokenTypes, boolean aRequireFlag)
public com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatEndOfExprResult isEndOfExpr(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void reservedWord(com.arsi.mj.maprpt.lexer.ptree.expr.ReservedWordExpr aResvWord, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void reservedWord(com.arsi.mj.maprpt.lexer.ptree.expr.ReservedWordRefmtExpr aResvWord, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void reservedWord(com.arsi.mj.maprpt.lexer.ptree.expr.ReservedWordStrboundsExpr aResvWord, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void reset()
public void text(com.arsi.mj.maprpt.lexer.ptree.expr.TextExpr aVariable, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void variable(com.arsi.mj.maprpt.lexer.ptree.expr.ArraySubscriptExpr aVariable, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void variable(com.arsi.mj.maprpt.lexer.ptree.expr.VariableReferenceExpr aVariable, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void variable(com.arsi.mj.maprpt.lexer.ptree.expr.VariableRefmtExpr aVariable, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void variable(com.arsi.mj.maprpt.lexer.ptree.expr.VariableStrboundsExpr aVariable, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
Inner Class ConcatEndOfExprResult
Result returned by IConcatEndOfExpr.isEndOfExpr method.
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatEndOfExprResult
  extends java.lang.Object
public final com.arsi.mj.maprpt.lexer.tokens.IMaprptToken lastTokenRead
Initializes an instance of this class.
Parameters:
aLastTokenRead - last token read during parse, which should become the new initial token. If encountered EOF on lexer (last token in last command line on Mapper report, this will be NULL).
public RunCommandParserBase.ConcatEndOfExprResult(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken aLastTokenRead)
Inner Class ConcatExprResult
Result returned by parseConcatExpr method.
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatExprResult
  extends java.lang.Object
public final com.arsi.mj.maprpt.lexer.ptree.expr.ConcatExpr concatExpr
public final com.arsi.mj.maprpt.lexer.tokens.IMaprptToken lastTokenRead
Initializes an instance of this class.
Parameters:
aLastTokenRead - last token read during parse, which should become the new initial token. If encountered EOF on lexer (last token in last command line on Mapper report), this will be NULL.
anExpr - concatenation expression, or NULL if parsed expression is empty.
public RunCommandParserBase.ConcatExprResult(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken aLastTokenRead, com.arsi.mj.maprpt.lexer.ptree.expr.ConcatExpr anExpr)
Inner Interface IConcatEndOfExpr
Defines method to check for end of concatenation expression.
public static interface com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatEndOfExpr
Determines if end of concatenation expression has been reached. For example, in the LDV command, a concatenation expression initializes a variable and may be terminated by blanks or a comma.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens; these tokens are pushed back by this method if the input is not recognized as the end of concatenation expression.
Returns:
token which ended concatenation expression, NULL if end of concatenation expression has not been reached.
public com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatEndOfExprResult isEndOfExpr(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
Inner Interface IConcatExprObserver
Defines optional observer methods to report significant milestones while parsing a concatenation expression.
public static interface com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatExprObserver
public void reservedWord(com.arsi.mj.maprpt.lexer.ptree.expr.ReservedWordExpr aResvWord, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void reservedWord(com.arsi.mj.maprpt.lexer.ptree.expr.ReservedWordRefmtExpr aResvWord, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void reservedWord(com.arsi.mj.maprpt.lexer.ptree.expr.ReservedWordStrboundsExpr aResvWord, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void text(com.arsi.mj.maprpt.lexer.ptree.expr.TextExpr aVariable, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void variable(com.arsi.mj.maprpt.lexer.ptree.expr.ArraySubscriptExpr aVariable, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void variable(com.arsi.mj.maprpt.lexer.ptree.expr.VariableReferenceExpr aVariable, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void variable(com.arsi.mj.maprpt.lexer.ptree.expr.VariableRefmtExpr aVariable, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
public void variable(com.arsi.mj.maprpt.lexer.ptree.expr.VariableStrboundsExpr aVariable, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
Inner Class JumpExprResult
Result returned by parsejumpExpression method.
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.JumpExprResult
  extends java.lang.Object
Expression that yields label or line offset, NULL if literalCallback is not NULL.
public final com.arsi.mj.maprpt.lexer.ptree.expr.ConcatExpr concatExpr

Last token read during parse, which should become the new initial token.
public final com.arsi.mj.maprpt.lexer.tokens.IMaprptToken lastTokenRead

Stores literal label or line number offset, NULL if concatExpr is not NULL.
public final com.arsi.mj.maprpt.lexer.ptree.cmd.litcbk.JumpExprCallback literalCallback

Initializes an instance of this class.
Parameters:
aLastTokenRead - last token read during parse, which should become the new initial token. If encountered EOF on lexer (last token in last command line on Mapper report), this will be NULL.
aRuntimeExpr - concatenation expression that can only be evaluated at runtime.
public RunCommandParserBase.JumpExprResult(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken aLastTokenRead, com.arsi.mj.maprpt.lexer.ptree.expr.ConcatExpr aRuntimeExpr)
Initializes an instance of this class.
Parameters:
aLastTokenRead - last token read during parse, which should become the new initial token. If encountered EOF on lexer (last token in last command line on Mapper report), this will be NULL.
aLiteralCallback - literal label or line number offset, stored by callback.
public RunCommandParserBase.JumpExprResult(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken aLastTokenRead, com.arsi.mj.maprpt.lexer.ptree.cmd.litcbk.JumpExprCallback aLiteralCallback)
Inner Class LooksLikeNumvarResult
Result returned by looksLikeNumberedVariable method.
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.LooksLikeNumvarResult
  extends java.lang.Object
public final boolean isIndirect
public final com.arsi.mj.maprpt.lexer.tokens.cmd.AlphanumStringToken typeSizePushbackToken
public final int variableNumber
Inner Class RelationalOperatorResult
Result returned by parseRelationalOperator method.
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.RelationalOperatorResult
  extends java.lang.Object
public final com.arsi.mj.maprpt.lexer.tokens.IMaprptToken lastTokenRead
public final com.arsi.mj.maprpt.lexer.ptree.symbol.RelationalOperator relop
Inner Class ReservedWordParseResult
Result returned by parseReservedWord method.
public class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ReservedWordParseResult
  extends java.lang.Object
Last token read during parse, which should become the new initial token.
public final com.arsi.mj.maprpt.lexer.tokens.IMaprptToken lastTokenRead

Reserved word parsed from token stream, NULL if no legal reserved word recognized.
public final com.arsi.mj.maprpt.lexer.ptree.rsvd.IReservedWord reservedWord

Initializes an instance of this class.
Parameters:
aLastTokenRead - last token read during parse, which should become the new initial token.
aResvWord - reserved word parsed from token stream, NULL if no legal reserved word recognized.
public RunCommandParserBase.ReservedWordParseResult(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken aLastTokenRead, com.arsi.mj.maprpt.lexer.ptree.rsvd.IReservedWord aResvWord)
Inner Class VariableReferenceResult
Result returned by parseVariableReference method.
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.VariableReferenceResult
  extends java.lang.Object
public final com.arsi.mj.maprpt.lexer.tokens.IMaprptToken lastTokenRead
public final java.util.Deque pushback
public final com.arsi.mj.maprpt.lexer.ptree.symbol.VariableReference varRef
Push all tokens we read to recognize the variable reference back onto the lexer so next rule in grammar will get the tokens.
public void doPushback(com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
Inner Class VariableTypeSizeResult
Result returned by parseVariableTypeSize method.
public static class com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.VariableTypeSizeResult
  extends java.lang.Object
public final com.arsi.mj.maprpt.lexer.tokens.IMaprptToken lastTokenRead
public final java.util.Deque pushback
public final com.arsi.mj.maprpt.lexer.ptree.symbol.VariableTypeSize varTypeSize
Initializes an instance of this class.
Parameters:
aLastTokenRead - last token read during parse, which is the last part of the type and size, and not the token after the type and size (it is not the new initial token); this last token read is included in pushback.
aPushbackQueue - a queue of tokens to push back onto lexer if caller decides that although it appears a variable type and size were matched, the context does not allow for a variable type and size declaration at this point. Use doPushback to accomplish push back.
aTypeSize - variable type and size.
public RunCommandParserBase.VariableTypeSizeResult(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken aLastTokenRead, java.util.Deque aPushbackQueue, com.arsi.mj.maprpt.lexer.ptree.symbol.VariableTypeSize aTypeSize)
Call if parsing context does not allow for a variable type and size declaration at this point to push all tokens we read back onto the lexer so next rule in grammar will get the tokens.
public void doPushback(com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
Constructors
public RunCommandParserBase()
Methods
As part of parsing arguments, advance token past the comma we expect to occur after the argument just parsed (unless reached end of command or lexer). The caller must skip any blanks before calling this method.
Parameters:
anInitialToken - last token returned by from lexer, and the current token from the caller's perspective (should not be a blank token).
aLexer - lexer for obtaining additional tokens.
aUserRID - report ID string that is meaningful to user as an error context.
aLineNumber - line number in report where aCommandName command occurs.
aCommandName - name of Mapper command being parsed, for diagnostic purposes.
Returns:
NULL if no advancement possible because anInitialToken indicates end of command or lexer, otherwise next token after optional blanks and expected comma (this method advances past any blanks before and after comma).
protected com.arsi.mj.maprpt.lexer.tokens.IMaprptToken advanceTokenPastComma(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, java.lang.String aUserRID, int aLineNumber, java.lang.String aCommandName)
Check concatenation expression for a variable declaration and reduce to a declared variable expression. Such variable declarations may occur instead of more typical variable dereferences (e.g., V55f6.2 instead of v55) while parsing commands not dedicated to variable definition such as LDV.
Parameters:
aConcatExpr - concatenation expression to check for a variable declaration.
aCabinetNumber - cabinet of Mapper report where expression originated.
aDrawerLetter - drawer of Mapper report where expression originated.
aReportNumber - report number of Mapper report where expression originated.
aLineNumber - line number where aConcatExpr was encountered in Mapper report.
Returns:
a declared variable expression that can replace aConcatExpr, or NULL if a declared variable expression was not recognized.
protected com.arsi.mj.maprpt.lexer.ptree.expr.DeclaredVariableExpr checkAndReduceDeclaredVariable(com.arsi.mj.maprpt.lexer.ptree.expr.ConcatExpr aConcatExpr, int aCabinetNumber, char aDrawerLetter, int aReportNumber, int aLineNumber)
Create parse tree from one or more Mapper statements that originated from another Mapper report.
Parameters:
aMapperCodeSnippet - one or more Mapper statements embedded in a single line, which may consist of an empty line (e.g., blanks or only a period). For example, CLV LDV,Z v1s6='X'.
aTokenReplCtx - token replacements (token name and replacement value) extracted from :DEFINEs by parent lexer where Mapper statements originated.
anAppCtx - application context for looking up report names and other beans.
aCabinetNumber - cabinet of Mapper report where Mapper statements originated.
aDrawerLetter - drawer of Mapper report where Mapper statements originated.
aReportNumber - report number of Mapper report where Mapper statements originated.
aLineNumber - line number in Mapper report where Mapper statements originated.
Throws:
MJTranslateException - if the parse tree cannot be constructed.
Returns:
the parse tree for the Mapper statements.
protected com.arsi.mj.maprpt.lexer.ptree.MaprptParseTree codeSnippetParsetree(java.lang.String aMapperCodeSnippet, com.arsi.mj.maprpt.lexer.TokenReplacementContext aTokenReplCtx, org.springframework.context.ApplicationContext anAppCtx, int aCabinetNumber, char aDrawerLetter, int aReportNumber, int aLineNumber)
    throws com.arsi.mj.MJTranslateException
Parse a single variable reference from the input as a concatenation expression.
Parameters:
anInitialToken - a less-than (start of named variable) or alphanumeric (start of numbered variable) token.
aLexer - lexer for obtaining additional tokens.
aConcatEndOfExpr - terminate parsing of one-shot concatenation expression to extract variable reference, text or other construct (e.g., reserved word) if token matches one of these types.
aUserRID - report ID string that is meaningful to user as an error context.
aLineNumber - line number in report where command that contains equation occurs.
Returns:
single concatenation expression that is a IVariableDerefExpr.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatExprResult doOneShotParseOfVariable(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatEndOfExprOneshotImpl aConcatEndOfExpr, java.lang.String aUserRID, int aLineNumber)
Create a lexer that serves only to parse a Mapper expression that originated from another Mapper report.
Parameters:
aMapperExpr - a Mapper "concatenation" expression, e.g., 'A'v1(1-4z)TIC$.
aCabinetNumber - cabinet of Mapper report where expression originated.
aDrawerLetter - drawer of Mapper report where expression originated.
aReportNumber - report number of Mapper report where expression originated.
aLineNumber - line number in Mapper report where expression originated.
Throws:
MJTranslateException - if the lexer cannot be constructed.
Returns:
the expression lexer.
protected com.arsi.mj.maprpt.lexer.MaprptLexer expressionLexer(java.lang.String aMapperExpr, int aCabinetNumber, char aDrawerLetter, int aReportNumber, int aLineNumber)
    throws com.arsi.mj.MJTranslateException
Attempt to parse an array subscript such as [5] from the Mapper report lexer.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens; these tokens are pushed back by this method if the input is not recognized as an array subscript.
Throws:
MJTranslateException - if closing, right bracket not found in input.
Returns:
array subscript, or NULL if array subscript not recognized.
protected com.arsi.mj.maprpt.lexer.ptree.symbol.ArraySubscript parseArraySubscript(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
    throws com.arsi.mj.MJTranslateException
Parse an optional cabinet and drawer (CD) specification, which includes results identified by negative numbers (examples of CD include 16,B, 'order drawer', -0, v1,v2 ,,) from the Mapper report lexer. This method eats all tokens it reads except for the last token read, so invoke only when a CD specification is the next thing expected in the input.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens.
aNamedReportLookup - lookup class for resolving Mapper report names (may be NULL).
Returns:
CDR result that represents cabinet and drawer (report number is always NULL), a result number or NULL cdr if empty cabinet and drawer (,).
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.CdrResult parseCd(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, com.arsi.mj.maprpt.namedrpt.NamedReportLookup aNamedReportLookup)
Parse an optional cabinet and drawer (CD) specification, which includes results identified by negative numbers (examples of CD include 16,B, 'order drawer', -0, v1,v2 ,,) from the Mapper report lexer. This method eats all tokens it reads except for the last token read, so invoke only when a CD specification is the next thing expected in the input.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens.
aNamedReportLookup - lookup class for resolving Mapper report names (may be NULL).
aCabinetEndOfExpr - determines if end of cabinet concatenation expression has been reached.
aDrawerEndOfExpr - determines if end of drawer concatenation expression has been reached.
Returns:
CDR result that represents cabinet and drawer (report number is always NULL), a result number or NULL cdr if empty cabinet and drawer (,).
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.CdrResult parseCd(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, com.arsi.mj.maprpt.namedrpt.NamedReportLookup aNamedReportLookup, com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatEndOfExpr aCabinetEndOfExpr, com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatEndOfExpr aDrawerEndOfExpr)
Parse a cabinet, drawer and report number (CDR) specification, which includes results identified by negative numbers (examples of CDR include 16,B,5, 'order report', -0, v1,v2,v3) from the Mapper report lexer. This method eats all tokens it reads except for the last token read, so invoke only when a CDR specification is the next thing expected in the input.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens.
aNamedReportLookup - lookup class for resolving Mapper report names (may be NULL).
Returns:
CDR result that represents cabinet, drawer and report number or a result number.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.CdrResult parseCdr(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, com.arsi.mj.maprpt.namedrpt.NamedReportLookup aNamedReportLookup)
Parse a cabinet, drawer and report number (CDR) specification, which includes results identified by negative numbers (examples of CDR include 16,B,5, 'order report', -0, v1,v2,v3) from the Mapper report lexer. This method eats all tokens it reads except for the last token read, so invoke only when a CDR specification is the next thing expected in the input.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens.
aNamedReportLookup - lookup class for resolving Mapper report names (may be NULL).
aCabinetEndOfExpr - determines if end of cabinet concatenation expression has been reached.
aDrawerEndOfExpr - determines if end of drawer concatenation expression has been reached.
aReportEndOfExpr - determines if end of report concatenation expression has been reached.
Returns:
CDR result that represents cabinet, drawer and report number or a result number.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.CdrResult parseCdr(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, com.arsi.mj.maprpt.namedrpt.NamedReportLookup aNamedReportLookup, com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatEndOfExpr aCabinetEndOfExpr, com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatEndOfExpr aDrawerEndOfExpr, com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatEndOfExpr aReportEndOfExpr)
Attempt to parse a concatenation expression from the Mapper report lexer.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens; these tokens are pushed back by this method if the input is not recognized as a concatenation expression.
anEofParser - parser to detect end of concatenation expression.
aTreatReservedWordAsLiteralFlag - if true, treat reserved words as literal text (e.g., DATE1$ is treated as the string "DATE1$" instead of current date in YYMMDD format).
aGreedyTextFlag - if true, create text object as soon as text is recognized, otherwise text may be accumulated until other parts of expression (e.g., variable) are recognized.
Returns:
concatenation expression, or NULL if concatenation expression not recognized.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatExprResult parseConcatExpr(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatEndOfExpr anEofParser, boolean aTreatReservedWordAsLiteralFlag, boolean aGreedyTextFlag)
Attempt to parse a "jump" expression (e.g., target of a GTO) from the input, where the input has been typically been found enclosed in parentheses such as "(0100)", "(end)" and "( lin +v1 )".
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens (tokens are eaten and not pushed back).
aConcatEndOfExpr - determines when end of concatenation expression has been reached.
someEndingTokenTypes - token last read after parsing jump expression must match one of these types.
aUserRID - report ID string that is meaningful to user as an error context.
aLineNumber - line number where anInitialToken was encountered in Mapper report.
aJumpExprString - string that is likely to contain a jump expression for diagnostic purposes only, pass as NULL if not known.
Returns:
NULL if jump expression was not recognized, otherwise a literal callback that stores a literal label or line offset, or a concatenation expression that encompasses jump expression, which may be a combination of literals (e.g., an integer, "END", "lin +5", "RPX 22") and variable references (simple variable name or number, array subscript, etc.).
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.JumpExprResult parseJumpExpression(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatEndOfExpr aConcatEndOfExpr, java.lang.Class someEndingTokenTypes, java.lang.String aUserRID, int aLineNumber, java.lang.String aJumpExprString)
Attempt to parse a "jump" expression (e.g., target of a GTO) from the input string, where the input has been typically been found enclosed in parentheses such as "(0100)", "(end)" and "( lin +v1 )".
Parameters:
aJumpExprString - string that is likely to contain a jump expression (this string is not enclosed in parentheses; opening and closing parenthesis have been removed).
aCabinetNumber - cabinet of Mapper report where expression originated.
aDrawerLetter - drawer of Mapper report where expression originated.
aReportNumber - report number of Mapper report where expression originated.
aLineNumber - line number where aJumpExprString was encountered in Mapper report.
Returns:
NULL if jump expression was not recognized, otherwise a literal callback that stores a literal label or line offset, or a concatenation expression that encompasses jump expression, which may be a combination of literals (e.g., an integer, "END", "lin +5") and variable references (simple variable name or number, array subscript, etc.).
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.JumpExprResult parseJumpExpression(java.lang.String aJumpExprString, int aCabinetNumber, char aDrawerLetter, int aReportNumber, int aLineNumber)
Parse a concatenation expression from the input, then parse a literal, or combination of text, variable(s) and/or reserved word(s) from the expression. The literal and reserved words must conform to expectations. This method eats all tokens it reads except for the last token read, so invoke only when an element initializer is the next thing expected in the input.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens.
aConcatEndOfExpr - determines if end of concatenation expression has been reached.
aValidator - validates and captures any literal recognized by this method.
someReservedWords - classes of reserved words that are considered valid.
aGreedyTextFlag - if true, create text object as soon as text is recognized, otherwise text may be accumulated until other parts of expression (e.g., variable) are recognized.
aLineNumber - line number where anInitialToken was encountered in Mapper report.
Throws:
MJTranslateException - if an error occurs parsing an expression from the input, or parsing a literal, variable or reserved word from the expression.
Returns:
concatenation expression, or NULL if no expression (ConcatExprResult.concatExpr may be NULL as well and should be checked by caller); if a literal is recognized by this method, it should be captured by aValidator.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatExprResult parseLiteralVariableOrReserved(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.IConcatEndOfExpr aConcatEndOfExpr, com.arsi.mj.maprpt.lexer.ptree.cmd.litcbk.ILiteralCallback aValidator, java.util.List someReservedWords, boolean aGreedyTextFlag, int aLineNumber)
    throws com.arsi.mj.MJTranslateException
Attempt to parse a reformat directive such as (p) from the Mapper report lexer.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens; these tokens are pushed back by this method if the input is not recognized as an array subscript.
Returns:
reformat directive, or NULL if reformat directive not recognized.
protected com.arsi.mj.maprpt.lexer.ptree.symbol.Reformat parseReformat(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
Attempt to parse a re-formatting string bounds such as (4-7z) from the Mapper report lexer.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens; these tokens are pushed back by this method if the input is not recognized as a string bounds.
Returns:
parse result object, or NULL if re-formatting string bounds not recognized.
protected com.arsi.mj.maprpt.lexer.ptree.symbol.ReformatStringBounds parseReformatStringBounds(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
Parse a relational operator (e.g., EQ, <, notgt) from the Mapper report lexer. This method eats all tokens it reads except for the last token read, so invoke only when a relational operator is the next thing expected in the input.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer, expected to be first token that comprise relational operator.
aLexer - lexer for obtaining additional tokens.
aUserRID - report ID string that is meaningful to user as an error context.
aLineNumber - line number in report where command option occurs.
Throws:
MJTranslateException - if no relational operator was recognized.
Returns:
result that contains relational operator.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.RelationalOperatorResult parseRelationalOperator(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, java.lang.String aUserRID, int aLineNumber)
    throws com.arsi.mj.MJTranslateException
Attempt to parse reserved word from specified token and the token that follows (i.e., alphanumeric followed by a dollar sign) resembles a reserved word. The reserved word can further be checked against a list of legal reserved words before being returned as a valid reserved word.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens; these tokens are pushed back by this method if the input is not recognized as a valid reserved word.
Returns:
result containing reserved word that was parsed and recognized, or NULL if tokens do not resemble a reserved word, or if parsed reserved word is not legal. When a reserved word is returned, the caller must read from the lexer get the next token after the reserved word.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ReservedWordParseResult parseReservedWord(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, java.util.List someReservedWords)
Parse a report name, result number literal or expression that resolves to a result number from contents of a quoted string.
Parameters:
aQSToken - quoted string whose contents are to be parsed.
aNamedReportLookup - lookup class for resolving Mapper report names (may be NULL).
aCabinetNumber - cabinet of Mapper report where expression originated.
aDrawerLetter - drawer of Mapper report where expression originated.
aReportNumber - report number of Mapper report where expression originated.
aLineNumber - line number where aQSToken was encountered in Mapper report.
Throws:
MJTranslateException - if an error occurs parsing the contents of the quoted string.
Returns:
object that stores the return value from parsing, either a cabinet, drawer and report number, a literal result number (e.g., -1) or an expression that evaluates at run-time to a result number.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.CabinetAsQuotedStringResult parseRptnameOrResultFromQuotedString(com.arsi.mj.maprpt.lexer.tokens.cmd.QuotedStringToken aQSToken, com.arsi.mj.maprpt.namedrpt.NamedReportLookup aNamedReportLookup, int aCabinetNumber, char aDrawerLetter, int aReportNumber, int aLineNumber)
    throws com.arsi.mj.MJTranslateException
Parse size in variable declaration that is itself defined by a named or numbered variable reference. Size should have been determined to be defined by a variable reference before this method is called, as it expects an initial token that starts a variable reference and consumes additional tokens while parsing the rest of the variable reference.
Parameters:
anInitialToken - a less-than (start of named variable) or alphanumeric (start of numbered variable) token.
aLexer - lexer for obtaining additional tokens (tokens are eaten and not pushed back).
aTypeChar - upper-case character that represent a valid Mapper variable type (e.g., 'F', 'S').
aConcatEndOfExpr - terminate parsing of one-shot concatenation expression to extract variable reference if token matches one of these types.
Returns:
parsed variable size and type.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.VariableTypeSizeResult parseSizeAsVariable(com.arsi.mj.maprpt.lexer.tokens.ICommandToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, char aTypeChar, com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatEndOfExprOneshotImpl aConcatEndOfExpr)
Attempt to parse a string bounds such as (4-7) or (0-3) from the Mapper report lexer.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens; these tokens are pushed back by this method if the input is not recognized as a string bounds.
Returns:
parse result object, or NULL if string bounds not recognized.
protected com.arsi.mj.maprpt.lexer.ptree.symbol.StringBounds parseStringBounds(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
Attempt to parse a variable reference (e.g., v100, <myvar>) from the Mapper report lexer.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens; these tokens are pushed back by this method if the input is not recognized as a variable reference.
Returns:
parse result object (where a non-NULL varRef indicates that a variable reference was recognized and parsed) or NULL if no variable reference recognized.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.VariableReferenceResult parseVariableReference(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer)
Attempt to parse a variable type and size (e.g., s20, f7.2) from the Mapper report lexer.
Parameters:
anInitialToken - initial token to examine returned from a previous call to lexer.
aLexer - lexer for obtaining additional tokens; these tokens are pushed back by this method if the input is not recognized as a variable type and size.
aConcatEndOfExpr - terminate parsing of one-shot concatenation expression to extract variable reference if token matches one of these types.
Returns:
parse result object, or NULL if variable type and size were not recognized.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.VariableTypeSizeResult parseVariableTypeSize(com.arsi.mj.maprpt.lexer.tokens.IMaprptToken anInitialToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.ConcatEndOfExprOneshotImpl aConcatEndOfExpr)
Reduce concatenation expression that is assumed to be a run-time jump expression so that expression no longer contains LIN or RPX literal text. However, we count on these text expressions being initially present in the concatenation expression so the jump destination of the expression can be determined.
Parameters:
aConcatExpr - concatenation expression assumed to be run-time jump expression, the expression is modified by this method if LIN or RPX text isn found.
Returns:
the jump destination, determined by checking for LIN or RPX text in expression; if neither found, defaults to JumpDestination.LABEL.
public static com.arsi.mj.maprpt.lexer.ptree.cmd.ctrlflow.jumps.JumpInfoBase.JumpDestination reduceJumpExpr(com.arsi.mj.maprpt.lexer.ptree.expr.ConcatExpr aConcatExpr)
Do read-ahead of lexer to do simple check that token following a less-than token resemble the start of a named variable (i.e., alphanumeric follows, or another less-than token then followed by an alphanumeric).
Parameters:
aLessThanToken - initial less-than token parsed from lexer.
aLexer - lexer for obtaining additional tokens; tokens that resemble a named variable are pushed back onto lexer before returning true.
aNoResemblancePushback - queue where token(s) that do not resemble a named variable are pushed back before returning false (including aLessThanToken).
Returns:
true if resembles a named variable, false if not.
protected boolean resemblesNamedVariableRef(com.arsi.mj.maprpt.lexer.tokens.cmd.LessThanToken aLessThanToken, com.arsi.mj.maprpt.lexer.MaprptLexer aLexer, java.util.Deque aNoResemblancePushback)
Determine if alphanumeric string looks like a numbered variable declaration, e.g., "V100", "vv25", "v34i6", "v28H15", "V75f6" (rest of floating point truncated because period stops parsing of alphanumeric token), etc.
Parameters:
aVarname - string that is candidate numbered variable name.
aLine - at-sign line where this token was parsed.
Returns:
parse result object if string appears to be a numbered variable, or NULL if string does not appear to be a numbered variable.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.LooksLikeNumvarResult resemblesNumberedVariableDecl(java.lang.String aVarname, com.arsi.mj.maprpt.parser.line.types.AtLine aLine)
Determine if alphanumeric string looks like a numbered variable reference, e.g., "V100", "vv25". No attempt is made to qualify alphanumeric string contents after the initial portion that resembles a numbered variable reference.
Parameters:
aVarname - string that is candidate numbered variable name.
aLine - at-sign line where this token was parsed.
Returns:
parse result object if string appears to be a numbered variable, or NULL if string does not appear to be a numbered variable.
protected com.arsi.mj.maprpt.lexer.ptree.cmd.RunCommandParserBase.LooksLikeNumvarResult resemblesNumberedVariableRef(java.lang.String aVarname, com.arsi.mj.maprpt.parser.line.types.AtLine aLine)
Given a character that signifies a Mapper variable type (e.g., 'S', 'F', 'I'), return the corresponding Mapper data type enumeration constant.
Parameters:
aTypeChar - a type character (e.g., 's', 'F').
Returns:
corresponding Mapper data type enumeration, or NULL if none.
protected com.arsi.mj.datatype.MaprptDataType typeCharToDataType(char aTypeChar)