# class ScriptParser | Abstract script parser. More...
Contains pure virtuals
Full name | `TelEngine::ScriptParser`
Definition | `#include <libs/yscript/yatescript.h>`
Inherits | TelEngine::GenObject [public ]
Inherited by | JsParser
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- virtual ~ScriptParser ()
- virtual bool parse (const char* text, bool fragment = false, const char* file = 0, int len = -1)
- virtual bool parseFile (const char* name, bool fragment = false)
- inline void clear ()
- inline ScriptCode* code () const
- virtual ScriptContext* createContext () const
- virtual ScriptRun* createRunner (ScriptCode* code, ScriptContext* context = 0, const char* title = 0) const
- inline ScriptRun* createRunner (ScriptContext* context = 0, const char* title = 0) const
- virtual bool callable (const String& name)

#### Protected Methods

- inline ScriptParser ()
- void setCode (ScriptCode* code)

## Detailed Description

Abstract parser, base class for each language parser

~ScriptParser () | ### ~ScriptParser

[virtual]

Destructor, releases code

bool parse (const char* text, bool fragment = false, const char* file = 0, int len = -1) | ### parse

[pure virtual]

Parse a string as script source code

Parameters:

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

Returns: True if the text was successfully parsed

bool parseFile (const char* name, bool fragment = false) | ### parseFile

[virtual]

Parse a file as script source code

Parameters:

name | Source file name
fragment | True if the code is just an included fragment

Returns: True if the file was successfully parsed

inline void clear () | ### clear

Clear any existing parsed code

inline ScriptCode* code () | ### code

[const]

Retrieve the currently stored parsed code

Returns: Parsed code block, may be NULL

ScriptContext* createContext () | ### createContext

[const virtual]

Create a context adequate for the parsed code

Returns: A new script context

ScriptRun* createRunner (ScriptCode* code, ScriptContext* context = 0, const char* title = 0) | ### createRunner

[const virtual]

Create a runner adequate for a block of parsed code

Parameters:

code | Parsed code block
context | Script context, an empty one will be allocated if NULL
title | An optional name for the runner

Returns: A new script runner, NULL if code is NULL

inline ScriptRun* createRunner (ScriptContext* context = 0, const char* title = 0) | ### createRunner

[const]

Create a runner adequate for the parsed code

Parameters:

context | Script context, an empty one will be allocated if NULL
title | An optional name for the runner

Returns: A new script runner, NULL if code is not yet parsed

bool callable (const String& name) | ### callable

[virtual]

Check if a script has a certain function or method

Parameters:

name | Name of the function to check

Returns: True if function exists in code

inline ScriptParser () | ### ScriptParser

[protected]

Default constructor for derived classes

void setCode (ScriptCode* code) | ### setCode

[protected]

Set the just parsed block of code

Parameters:

code | Parsed code block, may be NULL

Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.