mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 05:07:00 -04:00
implemented html export (only for writing the main file, not the write_file functions);
fixed parser bug: (...\n...) was not parsed as a statement separator if the second ... starts with a string or number git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@432 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
+16
-5
@@ -57,6 +57,12 @@ class Context {
|
||||
/// Get the value of a variable, returns ScriptValue() if it is not set
|
||||
ScriptValueP getVariableOpt(const String& name);
|
||||
|
||||
/// Open a new scope
|
||||
/** returns the number of shadowed binding before that scope */
|
||||
size_t openScope();
|
||||
/// Close a scope, must be passed a value from openScope
|
||||
void closeScope(size_t scope);
|
||||
|
||||
public:// public for FOR_EACH
|
||||
/// Record of a variable
|
||||
struct Variable {
|
||||
@@ -85,11 +91,6 @@ class Context {
|
||||
|
||||
/// Set a variable to a new value (in the current scope)
|
||||
void setVariable(int name, const ScriptValueP& value);
|
||||
/// Open a new scope
|
||||
/** returns the number of shadowed binding before that scope */
|
||||
size_t openScope();
|
||||
/// Close a scope, must be passed a value from openScope
|
||||
void closeScope(size_t scope);
|
||||
/// Return the bindings in the current scope
|
||||
void getBindings(size_t scope, vector<Binding>&);
|
||||
/// Remove all bindings made in the current scope
|
||||
@@ -98,5 +99,15 @@ class Context {
|
||||
void makeObject(size_t n);
|
||||
};
|
||||
|
||||
/// A class that creates a local scope
|
||||
class LocalScope {
|
||||
public:
|
||||
inline LocalScope(Context& ctx) : ctx(ctx), scope(ctx.openScope()) {}
|
||||
inline ~LocalScope() { ctx.closeScope(scope); }
|
||||
private:
|
||||
Context& ctx;
|
||||
size_t scope;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user