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

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

The newest version!
package org.unlaxer.tinyexpression.parser;

import org.unlaxer.parser.Parser;
import org.unlaxer.parser.Parsers;
import org.unlaxer.parser.combinator.Choice;
import org.unlaxer.parser.combinator.ZeroOrMore;
import org.unlaxer.tinyexpression.parser.javalang.JavaStyleDelimitedLazyChain;

public abstract class AbstractStringExpressionParser extends JavaStyleDelimitedLazyChain implements StringExpression , VariableTypeSelectable{

	private static final long serialVersionUID = 3057326703009847594L;
	
	
	public AbstractStringExpressionParser() {
		super();
	}

  @Override
  public org.unlaxer.parser.Parsers getLazyParsers(boolean withNakedVariable) {
    return
        withNakedVariable ? 
        // StringExpression:=StringTerm('+'StringTerm)*;
          new Parsers(
            Parser.get(StringTermParser.class),
            new ZeroOrMore(
              new Choice(
                Parser.get(StringPlusParser.class),
                Parser.get(StringTermParser.class)
              )
            )
          ):
          new Parsers(
            Parser.get(StrictTypedStringTermParser.class),
            new ZeroOrMore(
              new Choice(
                Parser.get(StringPlusParser.class),
                Parser.get(StrictTypedStringTermParser.class)
              )
            )
          );

  }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy