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

org.fife.tmm.IntLiteralFormat Maven / Gradle / Ivy

Go to download

An application to easily create syntax highlighting for custom languages in RSyntaxTextArea.

The newest version!
package org.fife.tmm;

/**
 * Format for integer literals.
 */
public enum IntLiteralFormat implements NumberFormat {

	FORMAT1("{Digit}+", "512"),
	FORMAT2("{Digit}+[lL]?", "512, 512L");

	private String format;
	private String sample;


	/**
	 * Constructor.
	 *
	 * @param format The format.
	 * @param sample A sample of text that this format would match.
	 */
	IntLiteralFormat(String format, String sample) {
		this.format = format;
		this.sample = sample;
	}


	public static IntLiteralFormat getByFormat(String format) {
		for (IntLiteralFormat ilf : values()) {
			if (ilf.getFormat().equals(format)) {
				return ilf;
			}
		}
		return null;
	}


	public String getFormat() {
		return format;
	}


	public String getSample() {
		return sample;
	}


	@Override
	public String toString() {
		return format;
	}


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy