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

org.unlaxer.tinyexpression.parser.StringVariableParser Maven / Gradle / Ivy

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

import java.util.Optional;

import org.unlaxer.parser.Parser;
import org.unlaxer.parser.Parsers;
import org.unlaxer.parser.combinator.LazyChoice;
import org.unlaxer.util.cache.SupplierBoundCache;

public class StringVariableParser extends LazyChoice implements RootVariableParser , StringExpression{

  private static final long serialVersionUID = -604853821610350410L;
  
  static final SupplierBoundCache SINGLETON = new SupplierBoundCache<>(StringVariableParser::new);

  public StringVariableParser() {
    super();
  }

  @Override
  public org.unlaxer.parser.Parsers getLazyParsers() {
    return new Parsers(//
        Parser.get(StringVariableMatchedWithVariableDeclarationParser.class),
        Parser.get(StringPrefixedVariableParser.class),//
        Parser.get(StringSuffixedVariableParser.class)//
    );
  }
 
  @Override
  public Optional typeAsOptional() {
    return Optional.of(ExpressionTypes.string);
  }
    
  public static StringVariableParser get() {
    return SINGLETON.get();
  }

  @Override
  public Class rootOfTypedVariableParser() {
    return StringVariableParser.class;
  }

  @Override
  public Class oneOfTypedVariableParser() {
    return StringPrefixedVariableParser.class;
  }

  @Override
  public Class typeHintVariableParser() {
    return StringTypeHintPrefixParser.class;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy