Search in sources :

Example 1 with ParserTag

use of cfml.parsing.ParserTag in project CFLint by cflint.

the class CFLint method process.

public void process(final String src, final String filename) throws ParseException, IOException {
    fireStartedProcessing(filename);
    final CFMLSource cfmlSource = new CFMLSource(src != null && src.contains("<!---") ? CommentReformatting.wrap(src) : src);
    final ParserTag firstTag = getFirstTagQuietly(cfmlSource);
    final List<Element> elements = new ArrayList<Element>();
    if (firstTag != null) {
        elements.addAll(cfmlSource.getChildElements());
    }
    if (src.contains("component") && (elements.isEmpty() || elements.get(0).getBegin() > src.indexOf("component"))) {
        // Check if pure cfscript
        final CFScriptStatement scriptStatement = cfmlParser.parseScript(src);
        Context context = new Context(filename, null, null, false, handler, scriptStatement.getTokens());
        process(scriptStatement, context);
    } else {
        processStack(elements, " ", filename, null);
    }
    fireFinishedProcessing(filename);
}
Also used : Context(com.cflint.plugins.Context) CFMLSource(cfml.parsing.CFMLSource) CFScriptStatement(cfml.parsing.cfscript.script.CFScriptStatement) ParserTag(cfml.parsing.ParserTag) Element(net.htmlparser.jericho.Element) ArrayList(java.util.ArrayList)

Aggregations

CFMLSource (cfml.parsing.CFMLSource)1 ParserTag (cfml.parsing.ParserTag)1 CFScriptStatement (cfml.parsing.cfscript.script.CFScriptStatement)1 Context (com.cflint.plugins.Context)1 ArrayList (java.util.ArrayList)1 Element (net.htmlparser.jericho.Element)1