public static class FormCalcScriptHandler.FormCalcParser extends com.adobe.xfa.formcalc.CalcParser implements ScriptHost, ProtocolHost, DebugHost
CODESIZE, DATASIZE, jj_nt, moCode, moData, moFrame, moScope, mStack, token, token_sourceSTEP_INTO, STEP_OUT, STEP_OVER, STOPALLOWKEYWORDS, ALNUM_PART, ALPHA_PART, AND1, AND2, ASGN, BREAK, COMMA, CONTINUE, DEFAULT, DIV, DO, DOT, DOTDOT, DOTHASH, DOTSTAR, DOWNTO, ELSE, ELSEIF, END, ENDFOR, ENDFUNC, ENDIF, ENDWHILE, EOF, EQ1, EQ2, ERROR, EXIT, EXPONENT_PART, FOR, FOREACH, FUNC, GE1, GE2, GT1, GT2, HEXDIGIT, IDENT, IF, IN, INTEGER, INTEGER_PART, KEYID, LBRACE, LE1, LE2, LPAREN, LT1, LT2, MINUS, NE1, NE2, NOT, NULL1, NULL2, OR1, OR2, PLUS, RBRACE, REAL, RETURN, RPAREN, STAR, STEP, STRING, THEN, tokenImage, UPTO, VAR, WHILE| Constructor and Description |
|---|
FormCalcParser(AppModel oAppModel,
FormCalcScriptHandler oScriptHandler) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
breakPoint(com.adobe.xfa.formcalc.CalcParser oParser,
int nScriptID,
int nLine,
boolean bSet)
Abstract method that sets or clears a breakpoint.
|
boolean |
cancelActionOccured()
Method that is called periodically during script execution.
|
boolean |
command(com.adobe.xfa.formcalc.CalcParser oParser,
int eCmd)
Abstract method that allows for single-stepping.
|
Obj |
getItem(String sItem,
Obj[] oObj)
Abstract method to get the handle of a SOM object.
|
CalcSymbol[] |
getItemValue(String sItem,
Obj[] oObj)
Virtual method to get the value(s) of a SOM reference.
|
String |
getStackTrace(com.adobe.xfa.formcalc.CalcParser oParser)
Abstract method that returns a new-line delimited string
showing the current stack and parameter values.
|
CalcSymbol |
getUrl(String sUrl)
Abstract method to get data from an URL.
|
void |
getVariables(com.adobe.xfa.formcalc.CalcParser oParser,
List<String> oNames,
List<CalcSymbol> oValues)
Abstract method that returns parallel lists of variables/parameters
and values (the lists are the same size).
|
void |
poll()
Abstract method that is called periodically during script execution.
|
CalcSymbol |
postUrl(String sUrl,
String sSoapHeader,
String sData,
String sContentType,
String sEnc)
Abstract method to post data to an URL and get its response.
|
int |
putItem(Obj[] oObj,
CalcSymbol oValue)
Virtual method to set the value of an SOM reference.
|
int |
putItemValue(String sItem,
Obj[] oObj,
CalcSymbol oValue)
Virtual method to set the value of a SOM reference.
|
CalcSymbol |
putUrl(String sUrl,
String sData,
String sEnc)
Abstract method to put data to an URL.
|
int |
stopped(int nScriptID,
int nLine)
Abstract method that is called when the engine stops in debug mode.
|
Accessor, AdditiveExpression, And, ArgumentList, Arguments, AssignmentExpression, BlockExpression, BreakExpression, clone, compile, Condition, ContinueExpression, debugEnable, DeclarationExpression, disable_tracing, Do, DotOp, Elif, ElifExpression, Else, enable_tracing, EndFor, EndFunc, EndIf, EndVar, EndWhile, Eq, EqualityExpression, evaluate, Expression, ExpressionList, For, Foreach, ForeachExpression, ForExpression, FormCalculation, Func, Function, FunctionCall, Ge, generateParseException, getCalcResult, getDupsMode, getNextToken, getToken, Gt, Identifier, If, IfExpression, In, inUse, Le, LogicalAndExpression, LogicalOrExpression, Lt, MultiplicativeExpression, Ne, Null, Number, Or, ParameterList, Parameters, PrimaryExpression, putScript, ReInit, ReInit, ReInit, ReInit, RelationalExpression, setDebugHost, setDisplayHost, setDupsMode, setLegacyScripting, setLocale, setProtocolHost, setScriptHost, setScriptID, setSyntaxCheckMode, SimpleExpression, Step, Then, To, UnaryExpression, Var, Variable, While, WhileExpressionpublic FormCalcParser(AppModel oAppModel, FormCalcScriptHandler oScriptHandler)
public Obj getItem(String sItem, Obj[] oObj)
ScriptHostA SOM reference provides access to objects, object properties and methods, as well as access to the values of objects, properties and methods. A SOM reference may be qualified, as in, for example, Field2.Color[2].Value, Field3[-1] -- some of which may be relative to the current object. A SOM reference may also contain any number of object literals of the form #N where N is a non-negative number corresponding to the 0-based index of an array of ObjImpl *. As an example of SOM references with object literals consider: #0.Parent, and #0.SetColor(#1.Border[1].Value)
The return object is an object handle -- an ObjImpl *. If the given SOM reference refers to several SOM objects, this method should throw an exception.
getItem in interface ScriptHostsItem - a given SOM reference.oObj - an array of objects. If
non-null, this is array whose size corresponds
to the maximal object literal occurence in the given SOM reference.public CalcSymbol[] getItemValue(String sItem, Obj[] oObj)
ScriptHostA SOM reference provides access to objects, object properties and methods, as well as access to the values of objects, properties and methods. A SOM reference may be qualified, as in, for example, Field2.Color[2].Value, Field3[-1] -- some of which may be relative to the current object. A SOM reference may also contain any number of object literals of the form #N where N is a non-negative number corresponding to the 0-based index of an array of Obj. As an example of SOM references with object literals consider: #0.Parent, and #0.SetColor(#1.Border[1].Value)
The return values are objects of type
CalcSymbol
which are no more than typed-values.
References to:
CalcSymbols of type TypeNull.
CalcSymbols of type TypeString.
CalcSymbols of type TypeString
to avoid loss of precision, although it is possible for them to
be returned as numeric-valued
CalcSymbols of type TypeDouble.
CalcSymbols of type TypeError.
To illustrate all the above, here's a degenerate implementation that,
irrespective of the SOM reference given, always returns a single value
of type error, accompanied with an "unknown accessor" message text.
import com.adobe.xfa.formcalc.ScriptHost;
import com.adobe.xfa.formcalc.CalcSymbol;
import com.adobe.xfa.Obj;
import com.adobe.xfa.ut.MsgFormat;
import com.adobe.xfa.ut.ResId;
class FormCalcUser implements ScriptHost {
CalcSymbol[] getItemValue(String sItem, Obj[] oObj) {
MsgFormat sFmt = new MsgFormat(ResId.FC_ERR_ACCESSOR);
sFmt.format(sItem);
CalcSymbol[] oRetValues = new CalcSymbol[1];
oRetValues[0] = new CalcSymbol(sFmt, true);
return oRetValues;
}
...
};
getItemValue in interface ScriptHostsItem - a SOM reference.oObj - an array of objects. If
non-null, this is an array whose size corresponds
to the maximal object literal occurence in the given SOM reference.public int putItemValue(String sItem, Obj[] oObj, CalcSymbol oValue)
ScriptHostA SOM reference provides access to objects, object properties and methods, as well as access to the values of objects, properties and methods. A SOM reference may be qualified, as in, for example, Field2.Color[2].Value, Field3[-1] -- some of which may be relative to the current object. A SOM reference may also contain any number of object literals of the form #N where N is a non-negative number corresponding to the 0-based index of an array of ObjImpl *. As an example of SOM references with object literals consider: #0.Parent, and #0.SetColor(#1.Border[1].Value)
The given SOM reference may refer to more than one scripting object, in which case this methods sets the value of several SOM objects.
The given value is an object of type
CalcSymbol
which again, is no more than a typed-value.
Only CalcSymbols of one of these types will ever be involved:
CalcSymbol.getStringValue() method to get the CalcSymbols's
value.
To illustrate all the above, here's a degenerate implementation that,
stores the given object into a hash table indexed by the given SOM
reference.
import com.adobe.xfa.formcalc.ScriptHost;
import com.adobe.xfa.formcalc.CalcSymbol;
import com.adobe.xfa.ut.Obj;
import java.util.HashMap;
class FormCalcUser implements ScriptHost {
HashMap moMap;
int PutItemValue(String sItem, Obj[] oObj, CalcSymbol oValue) {
moMap.remove(sItem);
moMap.put(sItem, oValue);
return 0;
}
...
};
putItemValue in interface ScriptHostsItem - the given SOM reference.oObj - an array of objects. If
non-null, this is an array whose size corresponds
to the maximal object literal occurence in the given SOM reference.oValue - the given object value.public int putItem(Obj[] oObj, CalcSymbol oValue)
ScriptHost The given value is an object of type
CalcSymbol
which again, is no more than a typed-value.
Only CalcSymbols of one of these types will ever be involved:
CalcSymbol.getStringValue() method to get the CalcSymbols's
value.putItem in interface ScriptHostoObj - an array of objects. If
non-null, this is an array whose size corresponds
to the maximal object literal occurence in the given SOM reference.oValue - the given object value.public CalcSymbol getUrl(String sUrl) throws CalcException
ProtocolHostgetUrl in interface ProtocolHostsUrl - the URL to get.CalcExceptionpublic CalcSymbol putUrl(String sUrl, String sData, String sEnc) throws CalcException
ProtocolHostputUrl in interface ProtocolHostsUrl - the URL to put.sData - the data to put.sEnc - the encoding to use.CalcExceptionpublic CalcSymbol postUrl(String sUrl, String sSoapHeader, String sData, String sContentType, String sEnc) throws CalcException
ProtocolHostpostUrl in interface ProtocolHostsUrl - the URL to post.sSoapHeader - an optional post header.sData - the data to post.sEnc - the encoding to use.CalcExceptionpublic int stopped(int nScriptID,
int nLine)
DebugHostpublic void poll()
DebugHostpublic boolean breakPoint(com.adobe.xfa.formcalc.CalcParser oParser,
int nScriptID,
int nLine,
boolean bSet)
DebugHostbreakPoint in interface DebugHostoParser - the parser to affect.nScriptID - the ID of script, which had been set via
CalcParser.setScriptID(int).nLine - the line of script.bSet - true if setting breakpoint; false if clearing it.public boolean command(com.adobe.xfa.formcalc.CalcParser oParser,
int eCmd)
DebugHostpublic String getStackTrace(com.adobe.xfa.formcalc.CalcParser oParser)
DebugHostgetStackTrace in interface DebugHostoParser - the parser to query.public void getVariables(com.adobe.xfa.formcalc.CalcParser oParser,
List<String> oNames,
List<CalcSymbol> oValues)
DebugHostgetVariables in interface DebugHostoParser - the parser to query.oNames - returned list of variable/parameter names.oValues - returned list of values.public boolean cancelActionOccured()
ScriptHostcancelActionOccured in interface ScriptHostCopyright © 2010 - 2020 Adobe. All Rights Reserved