|
Yate
|
Javascript parser. More...
#include <yatescript.h>
Public Member Functions | |
| JsParser (bool allowLink=true, bool allowTrace=false) | |
| virtual bool | parse (const char *text, bool fragment=false, const char *file=0, int len=-1) |
| virtual ScriptContext * | createContext () const |
| virtual ScriptRun * | createRunner (ScriptCode *code, ScriptContext *context=0, const char *title=0) const |
| ScriptRun * | createRunner (ScriptContext *context=0, const char *title=0) const |
| virtual bool | callable (const String &name) |
| void | adjustPath (String &script, bool extraInc=false) const |
| const String & | basePath () const |
| const String & | includePath () const |
| void | basePath (const char *path, const char *incPath=0) |
| const String & | parsedFile () const |
| bool | scriptChanged (const char *file) const |
| bool | scriptChanged (const char *file, const String &path, const String &incPath=String::empty()) const |
| void | link (bool allowed=true) |
| void | trace (bool allowed=true) |
Public Member Functions inherited from ScriptParser | |
| virtual | ~ScriptParser () |
| virtual bool | parseFile (const char *name, bool fragment=false) |
| void | clear () |
| ScriptCode * | code () const |
| void | setMaxFileLen (unsigned int len) |
| unsigned int | maxFileLen () const |
| ScriptRun * | createRunner (ScriptContext *context=0, const char *title=0) const |
Public Member Functions inherited from GenObject | |
| GenObject () | |
| virtual | ~GenObject () |
| virtual bool | alive () const |
| virtual void | destruct () |
| virtual const String & | toString () const |
| virtual const String & | traceId () const |
| virtual void * | getObject (const String &name) const |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (NamedCounter *counter) |
Static Public Member Functions | |
| static ScriptRun::Status | eval (const String &text, ExpOperation **result=0, ScriptContext *context=0) |
| static ExpOperation * | parseJSON (const char *text, ScriptMutex *mtx=0, ObjList *stack=0, GenObject *context=0, const ExpOperation *op=0) |
| static ExpOperation * | nullClone (const char *name=0) |
| static JsObject * | nullObject () |
| static bool | isNull (const ExpOperation &oper) |
| static bool | isUndefined (const ExpOperation &oper) |
| static bool | isMissing (const ExpOperation &oper) |
| static bool | isMissing (const ExpOperation *oper) |
| static bool | isPresent (const ExpOperation &oper) |
| static bool | isPresent (const ExpOperation *oper) |
| static bool | isEmpty (const ExpOperation &oper) |
| static bool | isEmpty (const ExpOperation *oper) |
| static bool | isFilled (const ExpOperation &oper) |
| static bool | isFilled (const ExpOperation *oper) |
Static Public Member Functions inherited from GenObject | |
| static void * | getObject (const String &name, const GenObject *obj) |
| static bool | getObjCounting () |
| static void | setObjCounting (bool enable) |
| static NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
Additional Inherited Members | |
Protected Member Functions inherited from ScriptParser | |
| ScriptParser () | |
| void | setCode (ScriptCode *code) |
Javascript parser.
Javascript parser, takes source code and generates preparsed code
|
inline |
Constructor
| allowLink | True to allow linking of the code, false otherwise. |
| allowTrace | True to allow the script to enable performance tracing |
| void adjustPath | ( | String & | script, |
| bool | extraInc = false ) const |
Adjust a file script path to include default if needed
| script | File path to adjust |
| extraInc | True to check the extra include path first |
|
inline |
Retrieve the base script path
|
inline |
Set the base script path
| path | Base path to add to relative script paths |
| incPath | Extra include path to add to relative script paths |
|
virtual |
Check if a script has a certain function or method
| name | Name of the function to check |
Reimplemented from ScriptParser.
|
virtual |
Create a context adequate for Javascript code
Reimplemented from ScriptParser.
|
virtual |
Create a runner adequate for a block of parsed Javascript code
| code | Parsed code block |
| context | Javascript context, an empty one will be allocated if NULL |
| title | An optional name for the runner |
Reimplemented from ScriptParser.
References ScriptParser::code().
Referenced by createRunner().
|
inline |
Create a runner adequate for the parsed Javascript code
| context | Javascript context, an empty one will be allocated if NULL |
| title | An optional name for the runner |
References ScriptParser::code(), and createRunner().
|
static |
Parse and run a piece of Javascript code
| text | Source code fragment to execute |
| result | Pointer to an optional pointer to store returned value |
| context | Script context, an empty one will be allocated if NULL |
|
inline |
Retrieve the extra include script path
|
inlinestatic |
Check if an operation holds a null or undefined value or empty string
References isMissing(), and String::null().
Referenced by isFilled().
|
inlinestatic |
Check if an operation is missing, holds a null or undefined value or empty string
References isMissing().
|
inlinestatic |
Check if an operation is not null or undefined or empty string
References isMissing().
|
inlinestatic |
Check if an operation is not null or undefined or empty string
References isEmpty().
|
static |
Check if an operation is null or undefined
Referenced by isEmpty(), isEmpty(), isFilled(), isMissing(), isPresent(), and isPresent().
|
inlinestatic |
Check if an operation is missing, holds a null or undefined
References isMissing().
|
static |
Check if an operation holds a null value
|
inlinestatic |
Check if an operation is not null or undefined
References isMissing().
|
inlinestatic |
Check if an operation is present and not null or undefined
References isMissing().
|
static |
Check if an operation holds an undefined value
|
inline |
Set whether the Javascript code should be linked or not
| allowed | True to allow linking, false otherwise |
|
static |
Get a "null" object wrapper that will identity match another "null"
| name | Name of the new wrapper, "null" if empty |
|
static |
Obtain the "null" object
|
virtual |
Parse a string as Javascript source code
| text | Source code text |
| fragment | True if the code is just an included fragment |
| file | Name of the file that is being parsed |
| len | Length of text, negative if unknown |
Implements ScriptParser.
|
inline |
Retrieve the last parsed file name
|
static |
Parse a complete block of JSON text
| text | JSON text to parse |
| mtx | Pointer to the mutex that serializes this object |
| stack | Pointer to an execution stack, required for adding prototypes |
| context | Pointer to an execution context, required for adding prototypes |
| op | ExpOperation that determined calling of this method |
References GenObject::GenObject().
| bool scriptChanged | ( | const char * | file | ) | const |
Check if the script or any includes have changed
| file | Name of the file to check |
Referenced by scriptChanged().
|
inline |
Check if the script or any includes have changed
| file | Name of the file to check |
| path | New base path to check |
| incPath | New extra include path to check |
References String::empty(), and scriptChanged().
|
inline |
Set whether the Javascript code can be traced or not
| allowed | True to allow tracing, false otherwise |