Package br.com.caelum.vraptor.panettone.parser.rule

Source Code of br.com.caelum.vraptor.panettone.parser.rule.ScriptletPrintRule

package br.com.caelum.vraptor.panettone.parser.rule;

import java.util.regex.Pattern;

import br.com.caelum.vraptor.panettone.parser.TextChunk;
import br.com.caelum.vraptor.panettone.parser.ast.Node;
import br.com.caelum.vraptor.panettone.parser.ast.ScriptletPrintNode;

public class ScriptletPrintRule extends Rule {

  private static final Pattern SCRIPTLET_PRINT = Pattern.compile("(<%=\\s*.*?\\s*%>)");

  protected Pattern pattern() {
    return SCRIPTLET_PRINT;
  }

  @Override
  public Node getNode(TextChunk chunk) {
    return new ScriptletPrintNode(chunk.getText().replace("<%=", "").replace("%>", "").trim(), chunk.getBeginLine());
  }

}
TOP

Related Classes of br.com.caelum.vraptor.panettone.parser.rule.ScriptletPrintRule

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.