All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cfml.parsing.cfscript.CFStringExpression Maven / Gradle / Ivy

There is a newer version: 2.11.0
Show newest version
package cfml.parsing.cfscript;

import java.util.ArrayList;
import java.util.List;

import org.antlr.v4.runtime.Token;

import cfml.parsing.cfscript.script.CFScriptStatement;
import cfml.parsing.util.ArrayBuilder;

public class CFStringExpression extends CFExpression {
	
	List subExpressions = new ArrayList();
	
	public CFStringExpression(Token t) {
		super(t);
		
	}
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 233826913909000678L;
	
	@Override
	public String Decompile(int indent) {
		StringBuilder sb = new StringBuilder();
		sb.append("'");
		for (CFExpression expression : subExpressions) {
			if (expression instanceof CFLiteral) {
				final String txt = expression.Decompile(0);
				if (txt != null) {
					sb.append(txt.substring(1, txt.length() - 1));
				}
			} else {
				sb.append("#");
				sb.append(expression.Decompile(0));
				sb.append("#");
			}
		}
		sb.append("'");
		return sb.toString();
	}
	
	public List getSubExpressions() {
		return subExpressions;
	}
	
	@Override
	public List decomposeExpression() {
		return subExpressions;
	}
	
	@Override
	public List decomposeScript() {
		return ArrayBuilder.createCFScriptStatement();
	}
	
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy