com.github.sommeri.less4j.core.ast.Document Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of less4j Show documentation
Show all versions of less4j Show documentation
Less language is an extension of css and less4j compiles it into regular css. It adds several dynamic features into css: variables, expressions, nested rules.
Less4j is a port. The original compiler was written in JavaScript and is called less.js. The less language is mostly defined in less.js documentation/issues and by what less.js actually do. Links to less.js:
* home page: http://lesscss.org/
* source code & issues: https://github.com/cloudhead/less.js
package com.github.sommeri.less4j.core.ast;
import java.util.ArrayList;
import java.util.List;
import com.github.sommeri.less4j.core.ast.annotations.NotAstProperty;
import com.github.sommeri.less4j.core.parser.HiddenTokenAwareTree;
import com.github.sommeri.less4j.utils.ArraysUtils;
public class Document extends Directive {
private String dialect;
private List urlMatchFunction = new ArrayList();
private GeneralBody body;
public Document(HiddenTokenAwareTree token, String dialect) {
super(token);
this.dialect = dialect;
}
public boolean bubleUpWithoutChanges() {
return false;
}
public GeneralBody getBody() {
return body;
}
public void setBody(GeneralBody body) {
this.body = body;
}
public String getDialect() {
return dialect;
}
public void setDialect(String dialect) {
this.dialect = dialect;
}
public List getUrlMatchFunctions() {
return urlMatchFunction;
}
@Override
@NotAstProperty
public List getChilds() {
List childs = new ArrayList(urlMatchFunction);
childs.add(body);
return childs;
}
@Override
public ASTCssNodeType getType() {
return ASTCssNodeType.DOCUMENT;
}
@Override
public Document clone() {
Document result = (Document) super.clone();
result.urlMatchFunction = ArraysUtils.deeplyClonedList(urlMatchFunction);
result.body = body==null? null : body.clone();
result.configureParentToAllChilds();
return result;
}
public void addUrlMatchFunctions(List urlMatchFunctions) {
this.urlMatchFunction.addAll(urlMatchFunctions);
}
}