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

com.cflint.tools.PrecedingCommentReader Maven / Gradle / Ivy

Go to download

A static code analysis tool for ColdFusion (in the spirit of FindBugs and Lint). With CFLint, you are able to analyze your ColdFusion code base for code violations.

There is a newer version: 1.5.0
Show newest version
package com.cflint.tools;

import org.antlr.v4.runtime.Token;

import com.cflint.plugins.Context;

import cfml.CFSCRIPTLexer;

public class PrecedingCommentReader {
	
	public static final String CFC_DEFAULT_EXTENSION = ".cfc";
	public static final String CFM_DEFAULT_EXTENSION = ".cfm";

	public static String getMultiLine(Context context, final Token token) {
		Iterable tokens = context.beforeTokens(token);
		for (Token currentTok : tokens) {
			if (currentTok.getChannel() == Token.HIDDEN_CHANNEL && currentTok.getType() == CFSCRIPTLexer.ML_COMMENT) {
				String mlText = currentTok.getText();
				return mlText == null?null:mlText.trim();
			} else if (currentTok.getLine() < token.getLine()) {
				break;
			}
		}
		return null;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy