railo.runtime.interpreter
Class CFMLExpressionInterpreter

java.lang.Object
  extended by railo.runtime.interpreter.CFMLExpressionInterpreter
Direct Known Subclasses:
JSONExpressionInterpreter

public class CFMLExpressionInterpreter
extends Object

Der CFMLExprTransfomer implementiert das Interface ExprTransfomer, er bildet die Parser Grammatik ab, die unten definiert ist. Er erh¦lt als Eingabe CFML Code, als String oder CFMLString, der einen CFML Expression erh¦lt und liefert ein CFXD Element zurck, das diesen Ausdruck abbildet. Mithilfe der FunctionLibメs, kann er Funktionsaufrufe, die Teil eines Ausdruck sein k￶nnen, erkennen und validieren. Dies geschieht innerhalb der Methode function. Falls ein Funktionsaufruf, einer Funktion innerhalb einer FunctionLib entspricht, werden diese gegeneinander verglichen und der Aufruf wird als Build-In-Funktion bernommen, andernfalls wird der Funktionsaufruf als User-Defined-Funktion interpretiert. Die Klasse Cast, Operator und ElementFactory (siehe 3.2) helfen ihm beim erstellen des Ausgabedokument CFXD.

 Parser Grammatik EBNF (Extended Backus-Naur Form) 

    transform      = spaces impOp;
    impOp          = eqvOp {"imp" spaces eqvOp};
    eqvOp          = xorOp {"eqv" spaces xorOp};
    xorOp          = orOp {"xor" spaces  orOp};
    orOp           = andOp {("or" | "||") spaces andOp}; 
            (* "||" Existiert in CFMX nicht *)
    andOp          = notOp {("and" | "&&") spaces notOp}; 
            (* "&&" Existiert in CFMX nicht *) 
    notOp          = [("not"|"!") spaces] decsionOp; 
            (* "!" Existiert in CFMX nicht *)
    decsionOp      = concatOp {("neq"|"eq"|"gte"|"gt"|"lte"|"lt"|"ct"|
                     "contains"|"nct"|"does not contain") spaces concatOp}; 
            (* "ct"=conatains und "nct"=does not contain; Existiert in CFMX nicht *)
    concatOp       = plusMinusOp {"&" spaces plusMinusOp};
    plusMinusOp    = modOp {("-"|"+") spaces modOp};

    modOp          = divMultiOp {("mod" | "%") spaces divMultiOp}; 
                    (* modulus operator , "%" Existiert in CFMX nicht *)
    divMultiOp     = expoOp {("*"|"/") spaces expoOp};
    expoOp         = clip {("exp"|"^") spaces clip}; 
                    (*exponent operator, " exp " Existiert in CFMX nicht *)
    clip           = ("(" spaces impOp ")" spaces) | checker;
    checker        = string | number | dynamic | sharp;
    string         = ("'" {"##"|"''"|"#" impOp "#"| ?-"#"-"'" } "'") | 
                     (""" {"##"|""""|"#" impOp "#"| ?-"#"-""" } """);
    number         = ["+"|"-"] digit {digit} {"." digit {digit}};
    digit          = "0"|..|"9";
    dynamic        = "true" | "false" | "yes" | "no" | startElement  
                     {("." identifier | "[" structElement "]")[function] };
    startElement   = identifier "(" functionArg ")" | scope | identifier;
    scope          = "variable" | "cgi" | "url" | "form" | "session" | "application" | 
                     "arguments" | "cookie" | " client";
    identifier     = (letter | "_") {letter | "_"|digit};
    structElement  = "[" impOp "]";
    functionArg    = [impOp{"," impOp}];
    sharp          = "#" checker "#";
    spaces         = {space};
    space          = "\s"|"\t"|"\f"|"\t"|"\n";
    letter         = "a"|..|"z"|"A"|..|"Z";

{"x"}= 0 bis n mal "x"
["x"]= 0 bis 1 mal "x"
("x" | "y")"z" = "xz" oder "yz"


Constructor Summary
CFMLExpressionInterpreter()
           
 
Method Summary
 Object interpret(PageContext pc, String str)
           
 Object interpret(PageContext pc, String str, boolean preciseMath)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CFMLExpressionInterpreter

public CFMLExpressionInterpreter()
Method Detail

interpret

public Object interpret(PageContext pc,
                        String str)
                 throws PageException
Throws:
PageException

interpret

public Object interpret(PageContext pc,
                        String str,
                        boolean preciseMath)
                 throws PageException
Throws:
PageException


Copyright © 2012 Railo