private Ref newOp() throws PageException { int start = cfml.getPos(); String name = null; cfml.removeSpace(); // first identifier name = identifier(true); Ref refName = null; if (name != null) { StringBuilder fullName = new StringBuilder(); fullName.append(name); // Loop over addional identifier while (cfml.isValidIndex()) { if (cfml.forwardIfCurrent('.')) { cfml.removeSpace(); name = identifier(true); if (name == null) throw new ExpressionException("invalid Component declaration"); cfml.removeSpace(); fullName.append('.'); fullName.append(name); } else break; } refName = new LString(fullName.toString()); } else { if (cfml.isCurrentQuoter()) refName = string(); if (refName == null) { cfml.setPos(start); return null; } } cfml.removeSpace(); if (cfml.isCurrent('(')) { FunctionLibFunction function = fld.getFunction("_createComponent"); Ref[] arguments = functionArg("_createComponent", true, function, ')'); Ref[] args = new Ref[arguments.length + 1]; for (int i = 0; i < arguments.length; i++) { args[i] = arguments[i]; } args[args.length - 1] = refName; BIFCall bif = new BIFCall(pc, function, args); cfml.removeSpace(); return bif; } throw new ExpressionException("invalid Component declaration "); }
/** * Hier werden die verschiedenen Mglichen Werte erkannt und jenachdem wird mit der passenden * Methode weitergefahren <br> * EBNF:<br> * <code>string | number | dynamic | sharp;</code> * * @return CFXD Element * @throws PageException */ private Ref checker() throws PageException { Ref ref = null; // String if (cfml.isCurrentQuoter()) { // mode=STATIC; is at the end of the string function because must set after execution return string(); } // Number if (cfml.isCurrentDigit() || cfml.isCurrent('.')) { // mode=STATIC; is at the end of the string function because must set after execution return number(); } // Dynamic if ((ref = dynamic()) != null) { mode = DYNAMIC; return ref; } // Sharp if ((ref = sharp()) != null) { mode = DYNAMIC; return ref; } // JSON if ((ref = json(JSON_ARRAY, '[', ']')) != null) { mode = DYNAMIC; return ref; } if ((ref = json(JSON_STRUCT, '{', '}')) != null) { mode = DYNAMIC; return ref; } if (cfml.isAfterLast() && cfml.toString().trim().length() == 0) return new LString(""); // else Error throw new ExpressionException( "Syntax Error, Invalid Construct", "at position " + cfml.getPos() + " in [" + cfml.toString() + "]"); }