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

com.kotcrab.vis.usl.USL Maven / Gradle / Ivy

There is a newer version: 0.2.1
Show newest version
package com.kotcrab.vis.usl;

import java.io.File;

/** Allows to use USL from code */
public class USL {
	private static final String USER_HOME_PATH = System.getProperty("user.home") + File.separator;
	public static final String USL_FOLDER_PATH = USER_HOME_PATH + ".usl" + File.separator;
	public static final String CACHE_FOLDER_PATH = USL_FOLDER_PATH + "cache" + File.separator;

	public static String parse (File uslFile) {
		return parse(uslFile.getParentFile(), Utils.readFile(uslFile));
	}

	/**
	 * @param workingDirectory used for finding included files, may be null only if parsed string does not contains
	 * any file include directive. However 'include ' or 'include ' is always allowed even when workingDirectory
	 * is null.
	 */
	public static String parse (File workingDirectory, String usl) {
		LexerContext context = new LexerContext(workingDirectory);
		Lexer.lexUsl(context, usl);
		return new Parser().getJson(context.tokens);
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy