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

target_tree.TargetTree.kt Maven / Gradle / Ivy

Go to download

Treepat is a language to recognise patterns in trees in a similar way as regular expressions recognize patterns in strings. Treepat includes analogous operators to regex union, concatenation, and closure, which are extended to the notion of trees.

There is a newer version: 2.0.0
Show newest version
package target_tree

import expression.TreepatExpression
import expression.operators.VisitorFunctionResponse

interface TargetTree {
    var root: T?

    fun findMatchesRaw(treepatExpression: TreepatExpression): VisitorFunctionResponse =
        treepatExpression.executeExpression(root)

    fun hasMatch(treepatExpression: TreepatExpression): Boolean = findMatchesRaw(treepatExpression).hasMatch
    fun findMatches(treepatExpression: TreepatExpression): List> =
        findMatchesRaw(treepatExpression).responses.map { it.matches }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy