com.vaadin.sass.internal.parser
Interface SassListItem

All Known Implementing Classes:
ArgumentList, Interpolation, LexicalUnitImpl, SassExpression, SassList, StringItem

public interface SassListItem

SassListItem specifies the interface implemented by both list items (LexicalUnitImpl) and lists (SassList). SassListItems are used as the elements of a SassList so that a list can contain both single values and other lists as its elements. To allow unified handling of lists and single values, SassListItem specifies several methods that are needed in both cases. This includes methods for replacing variables with their values and toString-like methods. Several list methods are also in the interface to allow a single value to behave like a list. For instance, it is possible to add an element to a single value and obtain a list as a result. The unified behavior of lists and single values is relevant because the value of a Sass variable can be either a list or a single value.


Method Summary
 String buildString(Node.BuildStringStrategy strategy)
          Return a string representation of this item using the given strategy of converting items to strings.
 boolean containsArithmeticalOperator()
          Checks whether the item contains an arithmetic expression.
 boolean containsVariable()
          Checks whether this item contains a variable.
 SassListItem evaluateFunctionsAndExpressions(ScssContext context, boolean evaluateArithmetics)
          Evaluates the arithmetic expressions and functions of this item without modifying this item.
 int getColumnNumber()
           
 LexicalUnitImpl getContainedValue()
          Deprecated. 
 int getLineNumber()
           
 String printState()
          Returns a string representation of this item.
 SassListItem replaceVariables(ScssContext context)
          Returns a new item that is otherwise equal to this one but all occurrences of variables have been replaced by the values in the current variable scope.
 String unquotedString()
          Returns a string representation of this item with surrounding quotation marks of the same type (" or ') removed.
 SassListItem updateUrl(String prefix)
          Returns a new item that is obtained from this by updating all url's by, e.g., adding the prefix to an url not starting with slash "/" and not containing the symbol ":".
 

Method Detail

getLineNumber

int getLineNumber()

getColumnNumber

int getColumnNumber()

containsVariable

boolean containsVariable()
Checks whether this item contains a variable. This method is used to avoid the evaluation of expressions when unset variables remain. That situation can happen as a result of calling replaceVariables for the children of a @mixin node. The replaceVariables method in MixinNodeHandler then replaces the variables corresponding to the parameter list of the @mixin but other variables remain unset until the node is traversed again. The evaluation of interpolation and expressions should then be deferred until all variables of the SassListItem have a value.

Returns:
Whether this expression contains variables.

containsArithmeticalOperator

boolean containsArithmeticalOperator()
Checks whether the item contains an arithmetic expression.


evaluateFunctionsAndExpressions

SassListItem evaluateFunctionsAndExpressions(ScssContext context,
                                             boolean evaluateArithmetics)
Evaluates the arithmetic expressions and functions of this item without modifying this item.

Parameters:
evaluateArithmetics - True indicates that the arithmetic expressions in this item should be evaluated. This parameter is used to handle the case where the operator '/' should not be interpreted as an arithmetic operation. The arithmetic expressions occurring in the parameter lists of functions will be evaluated even if evaluateArithmetics is false.
context - the compilation context in which to evaluate functions, variables etc.
Returns:
For single values, the result of the arithmetic expression or function. For a list, a copy of the list where the arithmetic expressions and functions have been replaced with their evaluated values.

replaceVariables

SassListItem replaceVariables(ScssContext context)
Returns a new item that is otherwise equal to this one but all occurrences of variables have been replaced by the values in the current variable scope. Does not modify this item.

Parameters:
context - the compilation context in which to evaluate functions, variables etc.
Returns:
A SassListItem where all occurrences of variables have been replaced by their values.

updateUrl

SassListItem updateUrl(String prefix)
Returns a new item that is obtained from this by updating all url's by, e.g., adding the prefix to an url not starting with slash "/" and not containing the symbol ":". Does not modify this item.

Parameters:
prefix - The prefix to be added.

printState

String printState()
Returns a string representation of this item. See LexicalUnitImpl.printState(). For a list, the string representation contains the list items separated with the separator character of the list. No parentheses appear in the string representation of a list, for valid CSS output.

Returns:
A string representation of this item.

buildString

String buildString(Node.BuildStringStrategy strategy)
Return a string representation of this item using the given strategy of converting items to strings. See LexicalUnitImpl#buildString(BuildStringStrategy).

Parameters:
strategy - Specifies how an item is converted to a string. The strategy may use the toString- and printState-methods.
Returns:
A string representation of this string.

unquotedString

String unquotedString()
Returns a string representation of this item with surrounding quotation marks of the same type (" or ') removed. Quotation marks are only removed from a single item or a list containing a single element and only one pair of quotation marks is removed.

Returns:
An unquoted string representation of this item.

getContainedValue

@Deprecated
LexicalUnitImpl getContainedValue()
Deprecated. 



Copyright © 2013–2015 Vaadin. All rights reserved.