public class TypeParser extends Object
Constructor and Description |
---|
TypeParser(NamespaceModel namespace)
Constructs a new type parser with a given namespace.
|
TypeParser(NamespaceModel namespace,
boolean visibilityStrict)
Constructs a new type parser with a given namespace.
|
TypeParser(NamespaceModel namespace,
boolean visibilityStrict,
Collection<String> freeTypes)
Constructs a new type parser with a given namespace and a collection of free types.
|
TypeParser(NamespaceModel namespace,
boolean visibilityStrict,
Collection<String> freeTypes,
FreeTypeMapping freeTypeMapping)
Constructs a new type parser with a given namespace, a collection of free types
and a given free type mapping.
|
TypeParser(NamespaceModel namespace,
Collection<String> freeTypes)
Constructs a new type parser with a given namespace and a collection of free types.
|
Modifier and Type | Method and Description |
---|---|
protected ValidationException |
createValidationException(String errorMessage,
org.antlr.runtime.tree.Tree tree)
Creates a validation exception with a given message.
|
protected Type |
findNamedType(QID qid)
Finds a type by a given name.
|
Type |
parseType(AntlrType antlrType)
Parses a type from an AntlrType object.
|
Type |
parseType(String string)
Parses a type from a string.
|
Type |
parseType(org.antlr.runtime.tree.Tree tree)
Parses a type from an ANTLR tree.
|
List<Type> |
parseTypeList(String string)
Parses a type list from a string.
|
Map<String,Type> |
parseTypeParameters(AntlrTypeParameters typeParameters)
Parses a free type list from an AntlrTypeParameters object.
|
Map<String,Type> |
parseTypeParameters(String string)
Parses a type parameter declaration from a string.
|
TypeParametersAst |
parseTypeParametersAst(String fullText,
AntlrTypeParameters typeParameters)
Parses a free type list from an AntlrTypeParameters object.
|
public TypeParser(NamespaceModel namespace)
namespace
- public TypeParser(NamespaceModel namespace, boolean visibilityStrict)
namespace
- visibilityStrict
- if true
, only public types are visible from imported modulespublic TypeParser(NamespaceModel namespace, Collection<String> freeTypes)
namespace
- freeTypes
- public TypeParser(NamespaceModel namespace, boolean visibilityStrict, Collection<String> freeTypes)
namespace
- visibilityStrict
- if true
, only public types are visible from imported modulesfreeTypes
- public TypeParser(NamespaceModel namespace, boolean visibilityStrict, Collection<String> freeTypes, FreeTypeMapping freeTypeMapping)
namespace
- visibilityStrict
- if true
, only public types are visible from imported modulesfreeTypes
- freeTypeMapping
- public Type parseType(String string) throws ValidationException
string
- ValidationException
- if the string
is not a valid typepublic Type parseType(org.antlr.runtime.tree.Tree tree) throws ValidationException
tree
- ValidationException
NullPointerException
- if the tree
is nullIllegalArgumentException
- if the tree
is not a valid type treepublic Type parseType(AntlrType antlrType) throws ValidationException
antlrType
- ValidationException
public List<Type> parseTypeList(String string) throws ValidationException
string
- ValidationException
- if the string
is not a valid list of typespublic Map<String,Type> parseTypeParameters(String string) throws ValidationException
null
.string
- ValidationException
- if the string
is not a valid type parameter declarationpublic Map<String,Type> parseTypeParameters(AntlrTypeParameters typeParameters) throws ValidationException
null
.typeParameters
- ValidationException
- if the string
is not a valid type parameter declarationpublic TypeParametersAst parseTypeParametersAst(String fullText, AntlrTypeParameters typeParameters) throws ValidationException
fullText
- a full sourcetypeParameters
- ValidationException
- if the string
is not a valid type parameter declarationprotected Type findNamedType(QID qid) throws ValidationException, AmbiguousTypeException
qid
- null
ValidationException
AmbiguousTypeException
protected ValidationException createValidationException(String errorMessage, org.antlr.runtime.tree.Tree tree)
errorMessage
- tree
- Copyright © 2007-2020 Whitestein Technologies. All Rights Reserved.