Beispiel #1
0
        internal bool CatchScope(string ns)
        {
            IdentificationTable symbols = (IdentificationTable)namespaces [ns];

            if (symbols == null)
            {
                throw new Exception(ns + " does not exist");
            }

            return(symbols.CatchScope);
        }
Beispiel #2
0
        internal int Depth(string ns)
        {
            IdentificationTable symbols = (IdentificationTable)namespaces [ns];

            if (symbols == null)
            {
                throw new Exception(ns + " does not exist");
            }

            return(symbols.depth);
        }
Beispiel #3
0
        internal bool InCurrentScope(string ns, Symbol id)
        {
            IdentificationTable symbols = (IdentificationTable)namespaces [ns];

            if (symbols == null)
            {
                throw new Exception(ns + " does not exist");
            }

            return(symbols.InCurrentScope(id));
        }
Beispiel #4
0
        internal void EndScope(string ns)
        {
            IdentificationTable symbols = (IdentificationTable)namespaces [ns];

            if (symbols == null)
            {
                throw new Exception(ns + " does not exist");
            }

            symbols.EndScope();
        }
Beispiel #5
0
        internal object [] CurrentLocals(string ns)
        {
            IdentificationTable symbols = (IdentificationTable)namespaces [ns];

            if (symbols == null)
            {
                throw new Exception(ns + " does not exist");
            }

            return(symbols.CurrentLocals);
        }
Beispiel #6
0
        internal void BeginScope(string ns, bool catchScope)
        {
            IdentificationTable symbols = (IdentificationTable)namespaces [ns];

            if (symbols == null)
            {
                throw new Exception(ns + " does not exist");
            }

            symbols.BeginScope(catchScope);
        }
Beispiel #7
0
        internal void Remove(string ns, Symbol key)
        {
            IdentificationTable symbols = (IdentificationTable)namespaces [ns];

            if (symbols == null)
            {
                throw new Exception(ns + " does not exist");
            }

            symbols.Remove(key);
        }
Beispiel #8
0
        internal void Enter(string ns, Symbol key, object value)
        {
            IdentificationTable symbols = (IdentificationTable)namespaces [ns];

            if (symbols == null)
            {
                throw new Exception(ns + " does not exist");
            }

            symbols.Enter(key, value);
        }
Beispiel #9
0
        internal object Get(string ns, Symbol key)
        {
            IdentificationTable symbols = (IdentificationTable)namespaces [ns];

            if (symbols == null)
            {
                return(null);
            }

            return(symbols.Get(key));
        }
Beispiel #10
0
        internal bool Contains(string ns, Symbol key)
        {
            IdentificationTable symbols = (IdentificationTable)namespaces [ns];

            if (symbols == null)
            {
                return(false);
            }

            return(symbols.Contains(key));
        }
Beispiel #11
0
        static SemanticAnalyser()
        {
            label_set = new IdentificationTable();

            obj_ctrs = new Hashtable();
            obj_ctrs.Add("Array", typeof(ArrayConstructor));
            obj_ctrs.Add("Boolean", typeof(BooleanConstructor));
            obj_ctrs.Add("Date", typeof(DateConstructor));
            obj_ctrs.Add("Function", typeof(FunctionConstructor));
            obj_ctrs.Add("Math", typeof(MathObject));
            obj_ctrs.Add("Number", typeof(NumberConstructor));
            obj_ctrs.Add("Object", typeof(ObjectConstructor));
            obj_ctrs.Add("String", typeof(StringConstructor));
            obj_ctrs.Add("RegExp", typeof(RegExpConstructor));

            prototypes = new Hashtable();
            // Constructors
            prototypes.Add(typeof(FunctionConstructor), typeof(FunctionPrototype));
            prototypes.Add(typeof(ArrayConstructor), typeof(FunctionPrototype));
            prototypes.Add(typeof(StringConstructor), typeof(FunctionPrototype));
            prototypes.Add(typeof(BooleanConstructor), typeof(FunctionPrototype));
            prototypes.Add(typeof(NumberConstructor), typeof(FunctionPrototype));
            prototypes.Add(typeof(DateConstructor), typeof(FunctionPrototype));
            prototypes.Add(typeof(RegExpConstructor), typeof(FunctionPrototype));
            prototypes.Add(typeof(ObjectConstructor), typeof(FunctionPrototype));
            prototypes.Add(typeof(ErrorConstructor), typeof(FunctionPrototype));
            // Prototypes
            prototypes.Add(typeof(FunctionPrototype), typeof(ObjectPrototype));
            prototypes.Add(typeof(ArrayPrototype), typeof(ObjectPrototype));
            prototypes.Add(typeof(StringPrototype), typeof(ObjectPrototype));
            prototypes.Add(typeof(BooleanPrototype), typeof(ObjectPrototype));
            prototypes.Add(typeof(NumberPrototype), typeof(ObjectPrototype));
            prototypes.Add(typeof(DatePrototype), typeof(ObjectPrototype));
            prototypes.Add(typeof(RegExpPrototype), typeof(ObjectPrototype));
            prototypes.Add(typeof(ErrorPrototype), typeof(ObjectPrototype));
            // Regular objects
            prototypes.Add(typeof(object), typeof(ObjectPrototype));
            prototypes.Add(typeof(FunctionObject), typeof(FunctionPrototype));
            prototypes.Add(typeof(ScriptFunction), typeof(FunctionPrototype));
            prototypes.Add(typeof(Closure), typeof(FunctionPrototype));
            prototypes.Add(typeof(ArrayObject), typeof(ArrayPrototype));
            prototypes.Add(typeof(StringObject), typeof(StringPrototype));
            prototypes.Add(typeof(BooleanObject), typeof(BooleanPrototype));
            prototypes.Add(typeof(NumberObject), typeof(NumberPrototype));
            prototypes.Add(typeof(DateObject), typeof(DatePrototype));
            prototypes.Add(typeof(RegExpObject), typeof(RegExpPrototype));
            prototypes.Add(typeof(RegExpMatch), typeof(ArrayPrototype));
            prototypes.Add(typeof(ObjectPrototype), typeof(ObjectPrototype));
            prototypes.Add(typeof(ErrorObject), typeof(ErrorPrototype));
            prototypes.Add(typeof(EvalErrorObject), typeof(ErrorPrototype));
            prototypes.Add(typeof(RangeErrorObject), typeof(ErrorPrototype));
            prototypes.Add(typeof(SyntaxErrorObject), typeof(ErrorPrototype));
            prototypes.Add(typeof(TypeErrorObject), typeof(ErrorPrototype));
            prototypes.Add(typeof(URIErrorObject), typeof(ErrorPrototype));


            // literals, used when accessing a method from the prototype
            // through the literal
            prototypes.Add(typeof(ArrayLiteral), typeof(ArrayPrototype));
            prototypes.Add(typeof(StringLiteral), typeof(StringPrototype));
            prototypes.Add(typeof(BooleanConstant), typeof(BooleanPrototype));

            Type number_prototype = typeof(NumberPrototype);

            prototypes.Add(typeof(ByteConstant), number_prototype);
            prototypes.Add(typeof(ShortConstant), number_prototype);
            prototypes.Add(typeof(IntConstant), number_prototype);
            prototypes.Add(typeof(LongConstant), number_prototype);
            prototypes.Add(typeof(FloatConstant), number_prototype);
            prototypes.Add(typeof(DoubleConstant), number_prototype);
        }
Beispiel #12
0
 static TypeManager()
 {
     infos = new IdentificationTable();
     local_script_functions = new IdentificationTable();
 }
Beispiel #13
0
		static SemanticAnalyser ()
		{
			label_set = new IdentificationTable ();
			
			obj_ctrs = new Hashtable ();
			obj_ctrs.Add ("Array", typeof (ArrayConstructor));
			obj_ctrs.Add ("Boolean", typeof (BooleanConstructor));
			obj_ctrs.Add ("Date", typeof (DateConstructor));
			obj_ctrs.Add ("Function", typeof (FunctionConstructor));
			obj_ctrs.Add ("Math", typeof (MathObject));
			obj_ctrs.Add ("Number", typeof (NumberConstructor));
			obj_ctrs.Add ("Object", typeof (ObjectConstructor));
			obj_ctrs.Add ("String", typeof (StringConstructor));
			obj_ctrs.Add ("RegExp", typeof (RegExpConstructor));

			prototypes = new Hashtable ();
			// Constructors
			prototypes.Add (typeof (FunctionConstructor), typeof (FunctionPrototype));
			prototypes.Add (typeof (ArrayConstructor), typeof (FunctionPrototype));
			prototypes.Add (typeof (StringConstructor), typeof (FunctionPrototype));
			prototypes.Add (typeof (BooleanConstructor), typeof (FunctionPrototype));
			prototypes.Add (typeof (NumberConstructor), typeof (FunctionPrototype));
			prototypes.Add (typeof (DateConstructor), typeof (FunctionPrototype));
			prototypes.Add (typeof (RegExpConstructor), typeof (FunctionPrototype));
			prototypes.Add (typeof (ObjectConstructor), typeof (FunctionPrototype));
			prototypes.Add (typeof (ErrorConstructor), typeof (FunctionPrototype));
			// Prototypes
			prototypes.Add (typeof (FunctionPrototype), typeof (ObjectPrototype));
			prototypes.Add (typeof (ArrayPrototype), typeof (ObjectPrototype));
			prototypes.Add (typeof (StringPrototype), typeof (ObjectPrototype));
			prototypes.Add (typeof (BooleanPrototype), typeof (ObjectPrototype));
			prototypes.Add (typeof (NumberPrototype), typeof (ObjectPrototype));
			prototypes.Add (typeof (DatePrototype), typeof (ObjectPrototype));
			prototypes.Add (typeof (RegExpPrototype), typeof (ObjectPrototype));
			prototypes.Add (typeof (ErrorPrototype), typeof (ObjectPrototype));
			// Regular objects
			prototypes.Add (typeof (object), typeof (ObjectPrototype));
			prototypes.Add (typeof (FunctionObject), typeof (FunctionPrototype));
			prototypes.Add (typeof (ScriptFunction), typeof (FunctionPrototype));
			prototypes.Add (typeof (Closure), typeof (FunctionPrototype));
			prototypes.Add (typeof (ArrayObject), typeof (ArrayPrototype));
			prototypes.Add (typeof (StringObject), typeof (StringPrototype));
			prototypes.Add (typeof (BooleanObject), typeof (BooleanPrototype));
			prototypes.Add (typeof (NumberObject), typeof (NumberPrototype));
			prototypes.Add (typeof (DateObject), typeof (DatePrototype));
			prototypes.Add (typeof (RegExpObject), typeof (RegExpPrototype));
			prototypes.Add (typeof (RegExpMatch), typeof (ArrayPrototype));
			prototypes.Add (typeof (ObjectPrototype), typeof (ObjectPrototype));
			prototypes.Add (typeof (ErrorObject), typeof (ErrorPrototype));
			prototypes.Add (typeof (EvalErrorObject), typeof (ErrorPrototype));
			prototypes.Add (typeof (RangeErrorObject), typeof (ErrorPrototype));
			prototypes.Add (typeof (SyntaxErrorObject), typeof (ErrorPrototype));
			prototypes.Add (typeof (TypeErrorObject), typeof (ErrorPrototype));
			prototypes.Add (typeof (URIErrorObject), typeof (ErrorPrototype));


			// literals, used when accessing a method from the prototype
			// through the literal
			prototypes.Add (typeof (ArrayLiteral), typeof (ArrayPrototype));
			prototypes.Add (typeof (StringLiteral), typeof (StringPrototype));
			prototypes.Add (typeof (BooleanConstant), typeof (BooleanPrototype));

			Type number_prototype = typeof (NumberPrototype);
			prototypes.Add (typeof (ByteConstant), number_prototype);
			prototypes.Add (typeof (ShortConstant), number_prototype);
			prototypes.Add (typeof (IntConstant), number_prototype);
			prototypes.Add (typeof (LongConstant), number_prototype);
			prototypes.Add (typeof (FloatConstant), number_prototype);
			prototypes.Add (typeof (DoubleConstant), number_prototype);
		}
Beispiel #14
0
 static TypeManager()
 {
     infos = new IdentificationTable ();
     local_script_functions = new IdentificationTable ();
 }