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

cfml.parsing.cfscript.script.CFMLFunctionStatement Maven / Gradle / Ivy

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

import java.io.Serializable;
import java.util.HashSet;
import java.util.List;
import java.util.Map;

import org.antlr.v4.runtime.Token;

import cfml.parsing.cfscript.CFExpression;
import cfml.parsing.cfscript.CFIdentifier;
import cfml.parsing.util.ArrayBuilder;

public class CFMLFunctionStatement extends CFParsedAttributeStatement implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
	private CFScriptStatement body;
	
	private Token type;
	
	private static HashSet supportedAttributes;
	
	static {
		supportedAttributes = new HashSet();
		supportedAttributes.add("ACTION");
		supportedAttributes.add("SAVEPOINT");
		supportedAttributes.add("ISOLATION");
	}
	
	public CFMLFunctionStatement(Token _t, Token type, Map _attr, CFScriptStatement _body) {
		super(_t, _attr);
		this.type = type;
		
		body = _body;
	}
	
	public Token getType() {
		return type;
	}
	
	@Override
	public String Decompile(int indent) {
		StringBuilder sb = new StringBuilder();
		sb.append(type.getText());
		DecompileAttributes(sb);
		if (body == null) {
			sb.append(";");
		} else {
			sb.append(body.Decompile(0));
		}
		
		return sb.toString();
	}
	
	public CFScriptStatement getBody() {
		return body;
	}
	
	public static HashSet getSupportedAttributes() {
		return supportedAttributes;
	}
	
	@Override
	public List decomposeScript() {
		return ArrayBuilder.createCFScriptStatement(body);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy