|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrailo.transformer.cfml.tag.CFMLTransformer
public final class CFMLTransformer
Die Klasse CFMLTransformer ist das Herzstck des ᅵbersetzungsprozess, es liest die bergebene CFML Datei ein und bersetzt diese in ein valid (CFXD) XML Dokument in der Form eines org.w3c.dom.Document Object, die dann als weitere Vorlage zum bersetzten in PHP dient. Der CFMLTransformer bersetzt nur die Tags die innerhalb einer CFML Seite vorkommen, nicht die Ausdrcke die innerhalb von Attributen und dem Body eines Tag vorkommen knnen, fr dies ist der ExprTransformer zust¦ndig, der in der jeweiligen Tag Library definiert ist. Der CFMLTransformer kann zwar durch seine Grammatik, Tags erkennen aber nicht validieren. Erst mithilfe der im zugeteilten Tag Libraries kann er vergleichen ob ein Tag nur ein normaler HTML Tag ist, das er einfach als literale Zeichenkette aufnimmt, oder ob es sich um einen Tag handelt der eine konkrete Anweisung implementiert. Die Tag Library definiert alle in CFML vorhanden Tags, deren individuelle Grammatik und deren Aufbau und Verhalten.
Parser Grammatik nach EBNF (Extended Backus-Naur Form) transform = {body} body = [comment] ("" | "<" tag body | literal body); comment = ""} "--->"; literal = ("<" | {?-"#"-"<"} "<" | {"#" expression "#"} "<" ) | ({?-"<"} "<") (* Welcher Teil der "oder" Bedingung ausgefhrt wird, ist abh¦ngig was die Tag-Lib vorgibt, dass Expression geparst werden sollen oder nicht. *) tag = name-space identifier spaces attributes ("/>" | ">" [body "" identifier spaces ">"]); (* Ob dem Tag ein Body und ein End-Tag folgt ist abh¦ngig von Definition des body-content in Tag-Lib, gleices gilt fr appendix *) name-space = < tagLib[].getNameSpaceAndSeperator() >; (* Vergleicht Zeichen mit den Namespacedefinitionen der Tag Libraries. *) attributes = ({spaces attribute} "/>" | {spaces attribute} ">") | attribute-value; (* Welcher Teil der "oder" Bedingung ausgefhrt wird, ist abh¦ngig von der Tag Attribute Definition in der Tag Lib. *) attribute = attribute-name spaces "=" spaces attribute-value; attribute-name = ("expression"|'expression'|expression) | identifier; (* Ruft identifier oder den Expression Transformer auf je nach Attribute Definition in der Tag Lib. *) attribute-value = expression; identifier = (letter | "_") {letter | "_"|digit}; letter = "a".."z"|"A".."Z"; digit = "0".."9"; expression =; (* Ruft den Expression Transformer auf. *) spaces = {space}; space = "\s"|"\t"|"\f"|"\t"|"\n"; {"x"}= 0 bis n mal "x" ["x"]= 0 bis 1 mal "x" ("x" | "y")"z" = "xz" oder "yz"
Nested Class Summary | |
---|---|
class |
CFMLTransformer.Data
|
Field Summary | |
---|---|
static short |
TAG_LIB_GLOBAL
|
static short |
TAG_LIB_PAGE
|
Constructor Summary | |
---|---|
CFMLTransformer()
|
Method Summary | |
---|---|
static void |
attributes(CFMLTransformer.Data data,
TagLibTag tag,
Tag parent)
Liest die Attribute eines Tags ein, dies Abh¦ngig von der Definition innerhalb der Tag-Lib. |
static Expression |
attributeValue(CFMLTransformer.Data data,
TagLibTag tag,
String type,
boolean parseExpression,
boolean isNonName,
Expression noExpression)
Liest den Wert eines Attribut, mithilfe des innerhalb der Tag-Lib definierten Expression Transformer, ein. |
static boolean |
comment(CFMLString cfml)
|
static void |
comment(CFMLString cfml,
boolean removeSpace)
Liest einen Kommentar ein, Kommentare werden nicht in die CFXD bertragen sondern verworfen. |
static TemplateException |
createTemplateException(CFMLString cfml,
String msg,
String detail,
TagLibTag tag)
|
static TemplateException |
createTemplateException(CFMLString cfml,
String msg,
TagLibTag tag)
|
static TagLibTag |
getTLT(CFMLString cfml,
String name)
|
static String |
identifier(CFMLString cfml,
boolean throwError)
Liest einen Identifier ein und gibt diesen als String zurck. |
static ApplicationException |
setAddional(ApplicationException ae,
TagLibTag tlt)
|
static TemplateException |
setAddional(TemplateException te,
TagLibTag tlt)
|
Page |
transform(ConfigImpl config,
CFMLString cfml,
TagLib[] tlibs,
FunctionLib[] flibs,
long sourceLastModified)
Startmethode zum transfomieren einer CFMLString. |
Page |
transform(ConfigImpl config,
SourceFile sf,
TagLib[] tlibs,
FunctionLib[] flibs)
Startmethode zum transfomieren einer CFML Datei. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static short TAG_LIB_GLOBAL
public static short TAG_LIB_PAGE
Constructor Detail |
---|
public CFMLTransformer()
Method Detail |
---|
public Page transform(ConfigImpl config, SourceFile sf, TagLib[] tlibs, FunctionLib[] flibs) throws TemplateException, IOException
{body}
config
- sf
- CFML Filetlibs
- Tag Library Deskriptoren, nach denen innerhalb der CFML Datei geprft werden soll.flibs
- Function Library Deskriptoren, nach denen innerhalb der Expressions der CFML Datei geprft werden soll.
TemplateException
IOException
public static TagLibTag getTLT(CFMLString cfml, String name) throws TemplateException
TemplateException
public Page transform(ConfigImpl config, CFMLString cfml, TagLib[] tlibs, FunctionLib[] flibs, long sourceLastModified) throws TemplateException
{body}
config
- cfml
- CFMLStringtlibs
- Tag Library Deskriptoren, nach denen innerhalb der CFML Datei geprft werden soll.flibs
- Function Library Deskriptoren, nach denen innerhalb der Expressions der CFML Datei geprft werden soll.sourceLastModified
-
TemplateException
public static void comment(CFMLString cfml, boolean removeSpace) throws TemplateException
""} "--->";
TemplateException
public static boolean comment(CFMLString cfml) throws TemplateException
TemplateException
public static void attributes(CFMLTransformer.Data data, TagLibTag tag, Tag parent) throws TemplateException
({spaces attribute} "/>" | {spaces attribute} ">") | attribute-value;(* Welcher Teil der "oder" Bedingung ausgefhrt wird, ist abh¦ngig von der Tag Attribute Definition in der Tag Lib. *)
tag
- parent
-
TemplateException
public static Expression attributeValue(CFMLTransformer.Data data, TagLibTag tag, String type, boolean parseExpression, boolean isNonName, Expression noExpression) throws TemplateException
expression;
tag
- type
- parseExpression
- isNonName
-
TemplateException
public static String identifier(CFMLString cfml, boolean throwError) throws TemplateException
(letter | "_") {letter | "_"|digit};
throwError
- throw error or return null if name is invalid
TemplateException
public static TemplateException createTemplateException(CFMLString cfml, String msg, String detail, TagLibTag tag)
public static TemplateException createTemplateException(CFMLString cfml, String msg, TagLibTag tag)
public static TemplateException setAddional(TemplateException te, TagLibTag tlt)
public static ApplicationException setAddional(ApplicationException ae, TagLibTag tlt)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |