| IncludeStatement | Pragma weak/strong | Pragma cast |
The pragma weak/strong
controls how type declarations
are requested by the CfgScript interpreter.
PragmaStrictWeakStatement : '#' 'pragma' 'strict' | '#' 'pragma' 'weak' ;
#pragma strict
force interpreter only to accept typed
variable declarations.#pragma weak
- which is default - also allows ad hoc
untyped variable declarations.
#pragma strict int k = 3; try { i = 42; // i is not declared before, trows an exception out.println("TEST FAILED"); } catch (acdk.cfgscript.ScriptException ex) { out.println("expected exception: " + ex.getMessage()); out.println("TEST OK"); } #pragma weak j = 42; // weak mode should allow ad hoc variables out.println("TEST OK"); |