public class AppParser extends Object
AppNodes
from Tokens
. This class may
serve as a base for higher level app processing, for instance streams or tasks.Constructor and Description |
---|
AppParser(Tokens tokens)
Construct a
AppParser based on the provided Tokens . |
Modifier and Type | Method and Description |
---|---|
protected AppNode |
eatApp()
Return a
AppNode from the next token and advance the token position. |
protected ArgumentNode[] |
eatAppArgs()
Return an array of
ArgumentNode and advance the token position if the next
token(s) contain arguments. |
protected String |
eatArgValue()
Return the argument value from the next token and advance the token position.
|
protected List<Token> |
eatDottedName()
Return an array of
Token that are separated by a dot. |
Tokens |
getTokens()
Return the
Tokens this parser is using. |
protected boolean |
isValidName(String name)
Verify the supplied name is a valid name.
|
protected String |
toData(Iterable<Token> iterable)
Return the concatenation of the data of multiple tokens.
|
protected List<String> |
tokenListToStringList(List<Token> tokens)
Return a list of string representations of
Tokens . |
protected LabelNode |
toLabelNode(Token label)
Create a new
LabelNode based on the provided token. |
protected String |
toString(Token t)
Return the string representation of a
Token . |
public Tokens getTokens()
Tokens
this parser is using.protected AppNode eatApp()
AppNode
from the next token and advance the token position.
Expected format: app: [label':']? identifier (appArguments)*
protected ArgumentNode[] eatAppArgs()
ArgumentNode
and advance the token position if the next
token(s) contain arguments.
Expected format:
appArguments : DOUBLE_MINUS identifier(name) EQUALS identifier(value)
null
if the next token(s) do not contain
argumentsprotected String eatArgValue()
Expected format: argValue: identifier | literal_string
protected List<Token> eatDottedName()
Token
that are separated by a dot.
Expected format: identifier [DOT identifier]*
protected LabelNode toLabelNode(Token label)
LabelNode
based on the provided token.label
- token containing the label; may be null
LabelNode
instance based on the provided token, or null
if the provided token is null
protected String toData(Iterable<Token> iterable)
protected List<String> tokenListToStringList(List<Token> tokens)
Tokens
.tokens
- list of tokens to convert to a list of stringsprotected String toString(Token t)
Token
.t
- tokenprotected boolean isValidName(String name)
name
- the name to validateCopyright © 2018 Pivotal Software, Inc.. All rights reserved.