Package com.schibsted.spt.data.jslt.impl
Class ParseContext
java.lang.Object
com.schibsted.spt.data.jslt.impl.ParseContext
Class to encapsulate context information like available functions,
parser/compiler settings, and so on, during parsing.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Collection
<Function> Tracks all loaded JSLT files.private Collection
<FunctionExpression> Function expressions, used for delayed name-to-function resolution.Imported modules listed under their prefixes.Named modules listed under their identifiers.private JsonFilter
Filter used to determine what object key/value pairs to keep.private ParseContext
private PreparationContext
Variable declaration and usage tracking.private ResourceResolver
private String
What file/resource are we parsing? Can be null, in cases where we don't have this information. -
Constructor Summary
ConstructorsConstructorDescriptionParseContext
(String source) ParseContext
(Collection<Function> extensions, String source, ResourceResolver resolver, Map<String, Module> namedModules, List<JstlFile> files, PreparationContext preparationContext, JsonFilter objectFilter) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDeclaredFunction
(String name, Function function) getFiles()
getFunction
(String name) getImportedCallable
(String prefix, String name, Location loc) getNamedModule
(String identifier) boolean
isAlreadyImported
(String module) void
registerJsltFile
(JstlFile file) void
registerModule
(String prefix, Module module) void
void
void
setParent
(ParseContext parent)
-
Field Details
-
extensions
-
functions
-
source
What file/resource are we parsing? Can be null, in cases where we don't have this information. -
modules
Imported modules listed under their prefixes. This is scoped per source file, since each has a different name-module mapping. -
files
Tracks all loaded JSLT files. Shared between all contexts. -
funcalls
Function expressions, used for delayed name-to-function resolution. -
parent
-
resolver
-
namedModules
Named modules listed under their identifiers. -
preparationContext
Variable declaration and usage tracking. -
objectFilter
Filter used to determine what object key/value pairs to keep.
-
-
Constructor Details
-
ParseContext
public ParseContext(Collection<Function> extensions, String source, ResourceResolver resolver, Map<String, Module> namedModules, List<JstlFile> files, PreparationContext preparationContext, JsonFilter objectFilter) -
ParseContext
-
-
Method Details
-
setParent
-
getPreparationContext
-
getFunction
-
getMacro
-
getSource
-
getExtensions
-
addDeclaredFunction
-
rememberFunctionCall
-
resolveFunctions
public void resolveFunctions() -
getDeclaredFunctions
-
registerModule
-
getNamedModule
-
getNamedModules
-
isAlreadyImported
-
getImportedCallable
-
getResolver
-
getFiles
-
registerJsltFile
-
getObjectFilter
-