public oosClass(pBaseLangObject parent) : base(parent) { this.parentClasses = new List<oosClass>(); this.parentInterfaces = new List<oosInterface>(); this.children.Add(null); }
public Function(pBaseLangObject parent) : base(parent) { this.children.Add(null); varType = null; this.IsAsync = false; }
private NamespaceResolver(string origString) { this.origString = origString; objectTree = new List <pBaseLangObject>(); var sArr = this.origString.Split(new char[] { ':', '.' }); pBaseLangObject curObject = BaseClass; objectTree.Add(BaseClass); bool flag = false; foreach (var s in sArr) { flag = false; if (string.IsNullOrEmpty(s)) { continue; } foreach (var it in curObject.getAllChildrenOf <Interfaces.iName>()) { if (it.Name != null && it.Name.OriginalValue == s) { objectTree.Add((pBaseLangObject)it); curObject = (pBaseLangObject)it; flag = true; break; } } if (!flag) { break; } } this.IsValid = flag; }
public For(pBaseLangObject parent) : base(parent) { this.children.Add(null); this.children.Add(null); this.children.Add(null); }
public Template(pBaseLangObject parent, int line, int pos) : base(parent) { this.line = line; this.pos = pos; vtoList = new List<VarTypeObject>(); }
public Native(pBaseLangObject parent, int line, int pos) : base(parent) { this.addChild(null); this.line = line; this.pos = pos; }
public VirtualFunction(pBaseLangObject parent) : base(parent) { argTypes = new List<VarTypeObject>(); this.children.Add(null); varType = null; }
public Variable(pBaseLangObject parent, int pos, int line) : base(parent) { this.addChild(null); varType = null; this.Line = line; this.Pos = pos; }
public Expression(pBaseLangObject parent, int line, int pos) : base(parent) { this.children.Add(null); this.children.Add(null); negate = false; expOperator = ""; this.line = line; this.pos = pos; }
public Ident(pBaseLangObject parent, string origVal, int line, int pos) : base(parent) { this.originalValue = origVal; referencedObject = null; referencedType = new VarTypeObject(VarType.Void); this.Line = line; this.Pos = pos; this.Access = AccessType.NA; this.isGlobalIdentifier = false; }
public NativeAssign(pBaseLangObject parent, int line, int pos) : base(parent, line, pos) { if (parent is Native) { this.name = ((Native)parent).Name; this.VTO = new VarTypeObject(this.name); } else { throw new Exception("Never NEVER ever this should happen! If it does, report to dev."); } }
public static Variable getVariableReferenceOfFQN(NamespaceResolver nsr, bool localVariables = true, pBaseLangObject blo = null) { if (nsr == null) { return(null); } if (!nsr.IsValid && !localVariables) { return(null); } if (!nsr.IsValid) { if (blo == null) { return(null); } pBaseLangObject curObj = blo; List <Variable> privateVarList = new List <Variable>(); while (true) { curObj = (pBaseLangObject)curObj.getFirstOf <Interfaces.iCodeBlock>(false); if (curObj == null) { break; } privateVarList.AddRange(curObj.getAllChildrenOf <Variable>()); } foreach (var it in privateVarList) { if (nsr.origString.EndsWith(':' + it.Name.OriginalValue)) { return(it); } } return(null); } else { if (nsr.objectTree.Last() is Variable) { return((Variable)nsr.objectTree.Last()); } else { return(null); } } }
public static void printPrivateArray(pBaseLangObject obj, string tab, System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg, int scopeIndex = -1) { var varList = obj.getAllChildrenOf <Variable>(false, null, -1, scopeIndex); var forLoopList = obj.getAllChildrenOf <For>(false, null, -1, scopeIndex); foreach (var it in forLoopList) { if (it.forArg1 != null && it.forArg1 is Variable) { varList.Add((Variable)it.forArg1); } } if (varList.Count > 0) { if (varList.Count == 1) { sw.Write(tab + '\t' + "private "); } else { sw.Write(tab + '\t' + "private ["); } for (int i = 0; i < varList.Count; i++) { var it = varList[i]; if (i != 0) { sw.Write(", "); } if (it is Variable) { sw.Write('"' + ((Variable)it).SqfVariableName + '"'); } else { throw new Exception(); } } if (varList.Count > 1) { sw.Write("]"); } sw.WriteLine(";"); } }
public Switch(pBaseLangObject parent) : base(parent) { this.children.Add(null); this.DefaultCase = null; }
public SqfCall(pBaseLangObject parent) : base(parent) { this.children.Add(null); this.referencedType = new VarTypeObject(VarType.Void); }
void INTERFACE(out pBaseLangObject outObj, pBaseLangObject parent) { var obj = new oosInterface(parent); outObj = obj; pBaseLangObject blo; Expect(56); IDENT(out blo, obj); obj.Name = (Ident)blo; obj.VTO = new VarTypeObject((Ident)blo, true); Expect(14); while (StartOf(11)) { VFUNCTION(out blo, obj); obj.addChild(blo); } Expect(15); }
public Namespace(pBaseLangObject parent) : base(parent) { this.children.Add(null); }
public ContainerClass(object value, int purpose, pBaseLangObject sender) { this.Value = value; this.Purpose = purpose; this.Sender = sender; }
public Case(pBaseLangObject parent, int line, int pos) : base(parent) { this.line = line; this.pos = pos; }
void NAMESPACE(out pBaseLangObject outObj, pBaseLangObject parent) { var obj = new Namespace(parent); outObj = obj; pBaseLangObject blo; Expect(42); IDENT(out blo, obj); obj.Name = (Ident)blo; var nsList = parent.getAllChildrenOf<Namespace>(); foreach(var it in nsList) { if(it.Name.OriginalValue == ((Ident)blo).OriginalValue) { obj = it; outObj = obj; break; } } Expect(14); while (StartOf(7)) { if (la.kind == 42) { NAMESPACE(out blo, obj); obj.addChild(blo); } else if (la.kind == 53) { CLASS(out blo, obj); obj.addChild(blo); } else if (la.kind == 43) { NATIVECLASS(out blo, obj); obj.addChild(blo); } else if (la.kind == 56) { INTERFACE(out blo, obj); obj.addChild(blo); } else { Get(); if (peekCompare(-1, -1, _T_TERMINATOR) ) { NEWVARIABLE(out blo, obj, Encapsulation.Static); obj.addChild(blo); TERMINATOR(); } else if (StartOf(8)) { FUNCTION(out blo, obj, Encapsulation.Static); obj.addChild(blo); } else SynErr(91); } } Expect(15); }
void NATIVECLASS(out pBaseLangObject outObj, pBaseLangObject parent) { var obj = new Native(parent, t.line, t.col); outObj = obj; pBaseLangObject blo; Template te; bool flag = false; Expect(43); IDENT(out blo, obj); obj.Name = (Ident)blo; if (la.kind == 21) { TEMPLATE(out te, obj); obj.TemplateObject = te; flag = true; obj.VTO = new VarTypeObject(obj.Name, true, te); } if(!flag) obj.VTO = new VarTypeObject(obj.Name, true); Expect(14); NATIVEASSIGN(out blo, obj); obj.addChild(blo); while (la.kind == 44 || la.kind == 47 || la.kind == 51) { if (la.kind == 44) { NATIVEASSIGN(out blo, obj); obj.addChild(blo); } else if (la.kind == 47) { NATIVEFUNCTION(out blo, obj); obj.addChild(blo); } else { NATIVEOPERATOR(out blo, obj); obj.addChild(blo); } } Expect(15); }
void NATIVEASSIGN(out pBaseLangObject outObj, pBaseLangObject parent) { var obj = new NativeAssign(parent, t.line, t.col); outObj = obj; pBaseLangObject blo; obj.Name = new Ident(obj, ((Native)parent).Name.OriginalValue, ((Native)parent).Name.Line, ((Native)parent).Name.Pos); Expect(44); if (la.kind == 45) { Get(); obj.IsSimple = true; } Expect(10); if (StartOf(13)) { NEWVARIABLE(out blo, obj); obj.addChild(blo); while (la.kind == 18) { Get(); NEWVARIABLE(out blo, obj); obj.addChild(blo); } } Expect(11); while (StartOf(15)) { Get(); obj.Code += t.val + (la.val == ";" ? "" : " "); } Expect(46); obj.Code = obj.Code.Trim(); }
void NATIVEFUNCTION(out pBaseLangObject outObj, pBaseLangObject parent) { var obj = new NativeFunction(parent, t.line, t.col); outObj = obj; pBaseLangObject blo; VarType v; Expect(47); if (la.kind == 45) { Get(); obj.IsSimple = true; } if (StartOf(2)) { VARTYPE(out v); obj.VTO = new VarTypeObject(v); } else if (la.kind == 48) { Get(); obj.VTO = new VarTypeObject(VarType.Void); } else if (StartOf(12)) { bool isStrict = false; if (la.kind == 49) { Get(); isStrict = true; } IDENTACCESS(out blo, obj); obj.VTO = new VarTypeObject((Ident)blo, isStrict); if (la.kind == 21) { Template te; TEMPLATE(out te, outObj); obj.VTO.TemplateObject = te; } } else SynErr(95); IDENT(out blo, obj); obj.Name = (Ident)blo; Expect(10); if (StartOf(13)) { NEWVARIABLE(out blo, obj); obj.addChild(blo); while (la.kind == 18) { Get(); NEWVARIABLE(out blo, obj); obj.addChild(blo); } } Expect(11); while (StartOf(16)) { Get(); obj.Code += t.val + (la.val == ";" ? "" : " "); } Expect(50); obj.Code = obj.Code.Trim(); }
public static Variable getVariableReferenceOfFQN(NamespaceResolver nsr, bool localVariables = true, pBaseLangObject blo = null) { if (nsr == null) return null; if (!nsr.IsValid && !localVariables) return null; if(!nsr.IsValid) { if (blo == null) return null; pBaseLangObject curObj = blo; List<Variable> privateVarList = new List<Variable>(); while (true) { curObj = (pBaseLangObject)curObj.getFirstOf<Interfaces.iCodeBlock>(false); if (curObj == null) break; privateVarList.AddRange(curObj.getAllChildrenOf<Variable>()); } foreach(var it in privateVarList) { if (it.Name.FullyQualifiedName == nsr.origString) return it; } return null; } else { if (nsr.objectTree.Last() is Variable) return (Variable)nsr.objectTree.Last(); else return null; } }
void NATIVEOPERATOR(out pBaseLangObject outObj, pBaseLangObject parent) { var obj = new NativeOperator(parent, t.line, t.col); outObj = obj; pBaseLangObject blo; VarType v; Expect(51); if (la.kind == 45) { Get(); obj.IsSimple = true; } if (StartOf(2)) { VARTYPE(out v); obj.VTO = new VarTypeObject(v); } else if (la.kind == 48) { Get(); obj.VTO = new VarTypeObject(VarType.Void); } else if (StartOf(12)) { bool isStrict = false; if (la.kind == 49) { Get(); isStrict = true; } IDENTACCESS(out blo, obj, false); obj.VTO = new VarTypeObject((Ident)blo, isStrict); if (la.kind == 21) { Template te; TEMPLATE(out te, outObj); obj.VTO.TemplateObject = te; } } else SynErr(96); if (la.kind == 12) { Get(); Expect(13); obj.OperatorType = OverridableOperator.ArrayAccess; } else if (StartOf(5)) { if (la.kind == 5) { Get(); switch(t.val) { case "===": obj.OperatorType = OverridableOperator.ExplicitEquals; break; default: SemErr("The operator '" + t.val + "' is not supported for override"); break; } } else if (la.kind == 23) { Get(); SemErr("The operator '" + t.val + "' is not supported for override"); } else if (la.kind == 21) { Get(); Expect(21); SemErr("The operator '" + t.val + "' is not supported for override"); } else { Get(); Expect(22); SemErr("The operator '" + t.val + "' is not supported for override"); } } else SynErr(97); Expect(10); if (StartOf(13)) { NEWVARIABLE(out blo, obj); obj.addChild(blo); while (la.kind == 18) { Get(); NEWVARIABLE(out blo, obj); obj.addChild(blo); } } Expect(11); while (StartOf(17)) { Get(); obj.Code += t.val + (la.val == ";" ? "" : " "); } Expect(52); obj.Code = obj.Code.Trim(); }
void IDENTACCESS(out pBaseLangObject outObj, pBaseLangObject parent, bool allowBody = true) { pBaseLangObject blo; pBaseLangObject ident; outObj = null; bool isGlobalIdent = false; if (la.kind == 17) { Get(); isGlobalIdent = true; } if (la.kind == 19 || la.kind == 20) { CAST(out outObj, parent); } IDENT(out ident, (outObj == null ? parent : outObj)); try{ ((Ident)ident).IsGlobalIdentifier = isGlobalIdent; } catch (Exception ex) { SemErr(ex.Message); } if(outObj == null) outObj = ident; else outObj.addChild(ident); if(allowBody) { if (la.kind == 10 || la.kind == 12) { if (la.kind == 10) { BODY_FUNCTIONCALL(out blo, ident); ((Ident)ident).addChild(blo); } else { BODY_ARRAYACCESS(out blo, ident); ((Ident)ident).addChild(blo); } } } if (la.kind == 16 || la.kind == 17) { if (la.kind == 16) { Get(); ((Ident)ident).Access = Ident.AccessType.Instance; } else { Get(); ((Ident)ident).Access = Ident.AccessType.Namespace; } IDENTACCESS(out blo, ident, allowBody); ((Ident)ident).addChild(blo); } }
public InstanceOf(pBaseLangObject parent) : base(parent) { this.addChild(null); this.addChild(null); }
public Break(pBaseLangObject parent) : base(parent) { }
public FunctionCall(pBaseLangObject parent) : base(parent) { }
public Throw(pBaseLangObject parent) : base(parent) { }
public NativeInstruction(pBaseLangObject parent, int line, int pos) : base(parent) { this.line = line; this.pos = pos; }
public Cast(pBaseLangObject parent) : base(parent) { }
public oosInterface(pBaseLangObject parent) : base(parent) { this.children.Add(null); }