public class Syntax extends SyntaxFragment
USAGE_STRING_SEPARATOR
ABBREV_DELIMITER, RESOURCE_PREFIX, VALUE_DELIMITER
KW_ACTION_NAME, KW_CLASS, KW_CONSTRAINTS_PARSER, KW_CONSTRAINTS_TYPE, KW_DEFAULT, KW_DESCRIPTION, KW_EXTENDS, KW_FLOATING, KW_HELP_TEXT, KW_HELP_TOPICS, KW_NAME, KW_PACKAGE, KW_PARAMETER, KW_PARAMETER_PARSER, KW_PRIORITY, KW_PROPERTY, KW_RESOURCES, KW_SUPER, KW_SYNTAX, KW_USAGE, KW_VALUE, KW_VALUE_TYPE, MAX_OCCURRENCES, MIN_OCCURRENCES, OPTIONAL
Modifier | Constructor and Description |
---|---|
protected |
Syntax()
Default constructor.
|
|
Syntax(SyntaxNode node,
SyntaxNodeExtension parent,
List<SyntaxNode> anchoredNodes,
List<SyntaxNode> floatingNodes,
String actionName)
Constructs a new syntax node.
|
Modifier and Type | Method and Description |
---|---|
String |
getActionName()
Get the symbolic action name associated with this syntax pattern.
|
int |
getPriority()
Get the priority of the syntax, which determines the order in which
this syntax will be considered relative to other syntax entities.
|
boolean |
isAuxiliary()
Returns true if the syntax is purely auxiliary and hence it should
never be considered as the closest matching syntax in case of a
complete mismatch.
|
boolean |
matches(String[] args,
Parameters parameters,
Parameters committedParameters,
ParsePosition position,
ParsePosition start,
SyntaxPosition farthestMismatchPosition,
boolean indexParameters)
Returns true if the node matches the given arguments starting with the
specified position.
|
protected void |
setActionName(String actionName)
Set the symbolic action name associated with this syntax pattern.
|
protected void |
setPriority(int priority)
Set the priority of the syntax, which determines the order in which
this syntax will be considered relative to other syntax entities.
|
applyDefaults, getAnchoredNodes, getCanonicNodeLists, getFirstAnchoredNode, getFloatingNodes, getHelpTopics, matchesAnchor, matchesFloater, matchesOnce, setHelpTopics, toString
getMaxOccurrences, getMinOccurrences, getParent
error, getContainer, getDB, getDescription, getHelpText, getLocale, getName, getResourceBundle, getShortName, isFloating, setDescription, setFloating, setHelpText, setName, setResourceBundle, translate
protected Syntax()
public Syntax(SyntaxNode node, SyntaxNodeExtension parent, List<SyntaxNode> anchoredNodes, List<SyntaxNode> floatingNodes, String actionName)
node
- originating nodeparent
- parent nodeanchoredNodes
- list of anchored nodesfloatingNodes
- list of floating nodesactionName
- action namepublic int getPriority()
protected void setPriority(int priority)
priority
- Integer value that specifies the priority of the
syntax; lower number means higher priority.public String getActionName()
protected void setActionName(String actionName)
actionName
- new syntax action namepublic boolean isAuxiliary()
public boolean matches(String[] args, Parameters parameters, Parameters committedParameters, ParsePosition position, ParsePosition start, SyntaxPosition farthestMismatchPosition, boolean indexParameters)
farthestMismatchPosition
parameter will hold the index of
the farthest argument that failed to match and the reference to the
syntax node against which that match failed.matches
in class SyntaxFragment
args
- Command-line argument stringsparameters
- Parameter map into which this matching attempt should
accumulate its (String, Serializable) bindings.committedParameters
- Parameter map of (String, Serializable)
bindings that has been committed thus far through the entire
syntax matching process.position
- Position within the args, where this matching attempt
should start.start
- Position within the defined syntax, where this matching
attempt should start.farthestMismatchPosition
- The farthest position where mismatch
occured within this matching attempt.indexParameters
- flag indicating whether parameters contained
within this node should be added as indexed.SyntaxNode.matches(java.lang.String[], com.hp.util.syntax.Parameters, com.hp.util.syntax.Parameters, java.text.ParsePosition, java.text.ParsePosition, com.hp.util.syntax.SyntaxPosition, boolean)
Copyright © 2016. All Rights Reserved.