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

org.unlaxer.tinyexpression.parser.javalang.JavaStyleDelimitedLazyZeroOrMore Maven / Gradle / Ivy

There is a newer version: 1.4.4
Show newest version
package org.unlaxer.tinyexpression.parser.javalang;

import java.util.function.Supplier;

import org.unlaxer.Name;
import org.unlaxer.parser.Parser;
import org.unlaxer.parser.Parsers;
import org.unlaxer.parser.combinator.LazyZeroOrMore;

public abstract class JavaStyleDelimitedLazyZeroOrMore extends LazyZeroOrMore {

  JavaStyleDelimitedLazyChain chain;
  
  public JavaStyleDelimitedLazyZeroOrMore() {
    super();
    Parsers parser = Parsers.of(targetParser().get());
    chain = new JavaStyleDelimitedLazyChain() {

      @Override
      public org.unlaxer.parser.Parsers getLazyParsers() {
        return parser;
      }
      
    };
  }

  public JavaStyleDelimitedLazyZeroOrMore(Name name) {
    super(name);
    Parsers parser = Parsers.of(targetParser().get());
    chain = new JavaStyleDelimitedLazyChain() {

      @Override
      public org.unlaxer.parser.Parsers getLazyParsers() {
        return parser;
      }
      
    };
  }
  

  @Override
  public Supplier getLazyParser() {
    return ()->chain;
  }

  @Override
  public java.util.Optional getLazyTerminatorParser() {
    return java.util.Optional.empty();
  }
  
  public abstract Supplier targetParser();
}
  




© 2015 - 2024 Weber Informatics LLC | Privacy Policy