Interface Expression

All Known Subinterfaces:
Repetition.GreedyQuantifier, Repetition.ReluctantQuantifier
All Known Implementing Classes:
RangeExpression, SetExpression, TrieExpression
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface
public interface Expression
An abstract representation of a expression. This can be either a complete expression or a 'partial' expression. The toRegex lambda function returns a string representation of a regular expression. (It can be any of the regex constructs)
  • Method Summary

    Modifier and Type Method Description
    default Expression debug​(java.util.function.Consumer<java.lang.StringBuilder> callback)
    Debug a expression at chained point.
    java.lang.StringBuilder toRegex()
    Synthesizes a given specification into a regular expression.
  • Method Details

    • toRegex

      java.lang.StringBuilder toRegex()
      Synthesizes a given specification into a regular expression. The implementing class can control what should be in the regex by simply wrapping it in a object or a higher-order function.
      Returns:
      regex equivalent
      Since:
      1.0.0
    • debug

      default Expression debug​(java.util.function.Consumer<java.lang.StringBuilder> callback)
      Debug a expression at chained point. It passes whatever constructed upto this node in the abstract syntax tree.
      Parameters:
      callback - consumer callback function
      Returns:
      the current expression