Modifier and Type | Field and Description |
---|---|
protected static EnumSet<LeolaTokenType> |
ARRAY_DECLARATION_SET |
protected static EnumSet<LeolaTokenType> |
PARAMETER_LIST_SET |
Constructor and Description |
---|
ParserUtils() |
Modifier and Type | Method and Description |
---|---|
static Expr[] |
parseArgumentExpressions(StmtParser parser,
Token currentToken)
Parses the parameters to a function call or class instantiation.
|
static Expr[] |
parseArrayDeclaration(StmtParser parser,
Token currentToken)
Parses an array declaration
|
static String |
parseClassName(LeolaParser parser,
Token token)
Parses a single class name
|
static String |
parseClassName(LeolaParser parser,
Token token,
LeolaTokenType... endTokenTypes)
Parses the class name, generally this is used when a set of class names are expected.
|
static List<Pair<Expr,Expr>> |
parseMapParameters(StmtParser parser,
Token currentToken,
EnumSet<LeolaTokenType> commaDelimeter,
LeolaTokenType endToken)
Parses the body of a Map during a map declaration.
|
static ParameterList |
parseParameterListings(LeolaParser parser,
Token next)
Parses a parameter listings, for classes, functions and generators.
|
protected static final EnumSet<LeolaTokenType> ARRAY_DECLARATION_SET
protected static final EnumSet<LeolaTokenType> PARAMETER_LIST_SET
public static Expr[] parseArgumentExpressions(StmtParser parser, Token currentToken) throws Exception
function(x,y); // parses the x, y expressions
parser
- currentToken
- the current token.Exception
public static Expr[] parseArrayDeclaration(StmtParser parser, Token currentToken) throws Exception
var array = [x,y]; // parses the x, y expressions
parser
- currentToken
- the current token.Exception
public static List<Pair<Expr,Expr>> parseMapParameters(StmtParser parser, Token currentToken, EnumSet<LeolaTokenType> commaDelimeter, LeolaTokenType endToken) throws Exception
var map = { x -> "hello", y -> "bye" } // This function parses the x->"hello",y->"bye" part
parser
- currentToken
- the current token.commaDelimeter
- endToken
- Exception
public static ParameterList parseParameterListings(LeolaParser parser, Token next) throws Exception
class Person(name, age); // this parses out the name, age list
parser
- next
- the current token.Exception
public static String parseClassName(LeolaParser parser, Token token, LeolaTokenType... endTokenTypes) throws Exception
parser
- token
- the current token.endTokenTypes
- Exception
public static String parseClassName(LeolaParser parser, Token token) throws Exception
parser
- token
- Exception
Copyright © 2010–2015. All rights reserved.