Top Description Fields Constructors Methods
uk.ac.ed.ph.snuggletex.internal

public final Class StyleEvaluator

extends Object
Class Inheritance
Imports
uk.ac.ed.ph.snuggletex.SnuggleLogicException, .SnuggleSession, uk.ac.ed.ph.snuggletex.definitions.Command, .ComputedStyle, .Environment, .LaTeXMode, .ComputedStyle.FontFamily, .ComputedStyle.FontSize, uk.ac.ed.ph.snuggletex.semantics.InterpretationType, .StyleDeclarationInterpretation, uk.ac.ed.ph.snuggletex.tokens.ArgumentContainerToken, .BraceContainerToken, .CommandToken, .EnvironmentToken, .FlowToken, .RootToken, .Token, java.util.List

This calculates the ComputedStyle for each raw parsed Token. It is used directly after LaTeXTokeniser but before the TokenFixer.

Once this has run, all Commands and Environments with a StyleDeclarationInterpretation will have been removed from the parse tree. This corresponds to commands such as \bf, \textrm{...} and environments like \begin{em}...\end{em}. Each Token remaining in the tree will have its Token#setComputedStyle(ComputedStyle) called to indicate the resulting "style" it will have.

Author
David McKain
Version
$Revision$
See Also
LaTeXTokeniser, TokenFixer, StyleRebuilder, SnuggleSession#parseInput(uk.ac.ed.ph.snuggletex.SnuggleInput)

Field Summary

Modifier and TypeField and Description
private final SessionContext

Constructor Summary

AccessConstructor and Description
public
StyleEvaluator(final SessionContext sessionContext)

Method Summary

Modifier and TypeMethod and Description
public void
private ComputedStyle
private ComputedStyle
private void
visitCommand(CommandToken commandToken, ComputedStyle currentStyle)

private void
private void
visitEnvironment(EnvironmentToken environmentToken, ComputedStyle currentStyle)

private void
visitSiblings(List<FlowToken> content, ComputedStyle scopeStyle)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

sessionContextback to summary
private final SessionContext sessionContext
Annotations
@SuppressWarnings:unused

Constructor Detail

StyleEvaluatorback to summary
public StyleEvaluator(final SessionContext sessionContext)

Method Detail

evaluateStylesback to summary
public void evaluateStyles(RootToken rootToken) throws SnuggleParseException
mergeStyleback to summary
private ComputedStyle mergeStyle(ComputedStyle currentStyle, StyleDeclarationInterpretation interpretation)
newStyleScopeback to summary
private ComputedStyle newStyleScope(ComputedStyle currentStyle)
visitCommandback to summary
private void visitCommand(CommandToken commandToken, ComputedStyle currentStyle) throws SnuggleParseException
visitContainerContentback to summary
private void visitContainerContent(ArgumentContainerToken parent, ComputedStyle scopeStyle) throws SnuggleParseException
visitEnvironmentback to summary
private void visitEnvironment(EnvironmentToken environmentToken, ComputedStyle currentStyle) throws SnuggleParseException
visitSiblingsback to summary
private void visitSiblings(List<FlowToken> content, ComputedStyle scopeStyle) throws SnuggleParseException