private CStatementBlock cases; // this will be a vector of case objects public CSelect(CToken token, CExpression pivot) : base(token) { cases = new CStatementBlock(); this.pivot = pivot; pivot.Parent = this; }
public CUnaryOperator(CToken tok, CExpression rhs) : base(tok) { action = tok; this.rhs = rhs; rhs.Parent = this; }
public CUnionType(CToken token) : base(token, "__Unamed_Union" + unnamedCount++) { CProgram.Global.AddClass(base.Name, this); NameToken = CToken.Identifer(token, "", ""); IsObject = false; }
public CNew(CToken tok, CToken classname, CParameters @params) : base(tok, classname) { this.classname = classname; this.@params = @params; [email protected] = this; }
public CAccess(CToken tok, CToken item) : base(tok) { referenceToken = item; isMemberSource = false; isRootAccess = true; }
/// <summary>Creates a new instance of CFunction /// this one is for funcs and subs that are parts of classes. this means /// that they can be public or private. also, we track if they are subs or funcs as this has /// implications with how exit/return is used /// </summary> public CFunction(CToken token, string rawname, string name, TokenTypes visibility, FunctionType subFuncFlag, CArgumentList args, CTypeRef tref) : base(token) { funcName = name; rawFuncName = rawname; this.visibility = visibility; functionType = subFuncFlag; LoadType(tref); if (args != null) { arguments = args; } switch (functionType) { case vbPropertyGet: alias = "get_" + rawname; break; case vbPropertySet: alias = "set_" + rawname; break; case vbSub: case vbFunction: default: alias = rawname; break; } }
private bool elseCaseFlag; // flag indicating if this case is the default case // if statements is null, that means there are no statements. meaning this case uses the statements // of the case below it. so dont put a break point. eg: // switch (color) { // case (red): // case (blue): // print("its red or blue); // break; // public CCase(CToken token, CExpression val) : base(token) { m_value = val; m_value.Parent = this; statements = null; }
private CStatementBlock statements; // the statements to be executed in this case of the switch #endregion Fields #region Constructors // if statements is null, that means there are no statements. meaning this case uses the statements // of the case below it. so dont put a break point. eg: // switch (color) { // case (red): // case (blue): // print("its red or blue); // break; // public CCase(CToken token, CExpression val) : base(token) { m_value = val; m_value.Parent = this; statements = null; }
public CUnionType(CToken token, String rawname, String name) : base(token, "__Unamed_Union" + unnamedCount++) { CProgram.Global.AddClass(base.Name, this); NameToken = CToken.Identifer(token, name, rawname); CProgram.Global.AddClass(base.Name, this); }
public CConst(CToken token, CToken name, CExpression exp) : base(token) { constName = name; constValue = exp; constValue.Parent = this; }
public CArgument(CToken direction, CToken name, CTypeRef tref) : base(name) { this.direction = direction; this.name = name; base.LoadType(tref); }
public CMember(CToken tok, string name, string memberType, int declaredSize, bool isUnionMember) : base(tok) { this.name = name; this.memberType = memberType; declared = new CNode[declaredSize]; this.isUnionMember = isUnionMember; }
public CIf(CToken token, CExpression condition, bool oneLine, bool elseIf) : base(token) { this.condition = condition; condition.Parent = this; oneLineFlag = oneLine; elseIfFlag = elseIf; }
public static CToken Keyword(CToken @src, String keyword) { if (src == null) { src = Empty; } return(new CToken(src.filename, src.line, src.offset, src.fullLine, TokenTypes.keyword, keyword.ToLower(), keyword, true)); }
public CAttribute(CToken name, CParameters parameters, CTypeRef ctr) : base(name) { this.name = name.Value; nameToken = name; this.parameters = parameters ?? new CParameters(); LoadType(new CTypeRef(this, ctr)); }
internal static CToken String(CToken @src, string alias) { if (src == null) { src = Empty; } return(new CToken(src.filename, src.line, src.offset, src.fullLine, TokenTypes.str, alias, alias, true)); }
public CMemberAccess(CToken tok, CAccess objectSource, CToken item) : base(tok, item) { _object = objectSource; _object.Parent = this; _object.IsMemberSource = true; IsRootAccess = false; }
public static CToken Identifer(CToken @src, String ident, String rawIdent) { if (src == null) { src = Empty; } return(new CToken(src.filename, src.line, src.offset, src.fullLine, TokenTypes.identifier, ident, rawIdent, true)); }
public CExit(CToken token, String exitWhat) : base(token) { this.exitWhat = exitWhat; if (exitWhat == "function") funcFlag = true; else if (exitWhat == "sub") subFlag = true; }
public CBinaryOperator(CToken tok, CExpression lhs, CExpression rhs) : base(tok) { operation = tok; this.lhs = lhs; this.rhs = rhs; lhs.Parent = this; rhs.Parent = this; }
// this is the constructor when you actually need to parse all the statements of a case // until you hit the next case public CCase(CToken token, CExpression val, CStatementBlock block) : base(token) { m_value = val; elseCaseFlag = val == null; if (!elseCaseFlag) m_value.Parent = this; statements = block; }
public CConstantExpression(CToken tok) : base(tok) { m_value = tok; CClass type = null; switch (tok.TokenType) { case TokenTypes.number: int i; if (Int32.TryParse(tok.Value, out i) || tok.Value.StartsWith("0x")) { type = BuiltIns.Int32; } else { type = BuiltIns.Double; } break; case TokenTypes.str: type = BuiltIns.String; break; case TokenTypes.character: type = BuiltIns.Character; break; case TokenTypes.pound: type = BuiltIns.Date; break; case TokenTypes.keyword: if (tok.Value == "true") { type = BuiltIns.Boolean; } else if (tok.Value == "false") { type = BuiltIns.Boolean; } else if (tok.Value == "nothing") { type = BuiltIns.Nothing; } else if (tok.Value == "dbnull") { type = BuiltIns.DbNull; } break; } if (type != null) { base.LoadType(type); } }
public CDefaultAccess(CToken tok, CAccess item, CParameters parameters) : base(tok, tok) { m_targetAccess = item; m_targetAccess.Parent = this; this.parameters = parameters; this.parameters.Parent = this; item.IsCallExplicit = true; IsRootAccess = false; }
public CClass(CToken token, String rawname, String name, CTypeRef baseClass) : base(token) { originalClassName = name; className = CToken.Identifer(token, name, rawname); canConvertToString = false; this.baseClass = new CTypeRef(this, baseClass); base.LoadType(this); }
public CTernary(CToken tok, CExpression cond, CExpression lhs, CExpression rhs) : base(tok) { this.cond = cond; this.lhs = lhs; this.rhs = rhs; cond.Parent = this; lhs.Parent = this; rhs.Parent = this; }
// this is the constructor when you actually need to parse all the statements of a case // until you hit the next case public CCase(CToken token, CExpression val, CStatementBlock block) : base(token) { m_value = val; elseCaseFlag = val == null; if (!elseCaseFlag) { m_value.Parent = this; } statements = block; }
public CVariable(CToken name, bool shared, CTypeRef tref, CParameters arrayDimsinit, CExpression init, CDim parent) : base(name, shared) { this.dim = parent; this.name = name; base.LoadType(tref); this.init = init; if (init != null) init.Parent = this; member = false; this.arrayDimsinit = arrayDimsinit; }
public CLambdaFunction(CToken token, CFunction containingFunction, CFile containingFile, String name, CTypeRef tref, CArgumentList args) : base(token, name, name, TokenTypes.visInternal, FunctionType.Function, args, tref) { this.containingFunction = containingFunction; this.containingFile = containingFile; if (this.containingFunction != null) this.containingFunction.Lambdas.Add(this); else this.containingFile.Lambdas.Add(this); CallCount++; Attributes.Add(CToken.Identifer(null, "ExecuteAnywhere"), new CTypeRef(null, CToken.Identifer(null, "ExecuteAnywhereAttribute"))); }
public CExit(CToken token, String exitWhat) : base(token) { this.exitWhat = exitWhat; if (exitWhat == "function") { funcFlag = true; } else if (exitWhat == "sub") { subFlag = true; } }
private CProgram() : base(null) { global = this; classes["String"] = BuiltIns.String; classes["Int32"] = BuiltIns.Int32; classes["Int64"] = BuiltIns.Int32; classes["Character"] = BuiltIns.Character; classes["Boolean"] = BuiltIns.Boolean; classes["Date"] = BuiltIns.Date; classes["Double"] = BuiltIns.Double; classes["__Object"] = BuiltIns.Object; classes["__Variant"] = BuiltIns.Variant; // lowercase alias classes["byte"] = BuiltIns.Byte; classes["string"] = BuiltIns.String; classes["int32"] = BuiltIns.Int32; classes["int64"] = BuiltIns.Int32; classes["character"] = BuiltIns.Character; classes["boolean"] = BuiltIns.Boolean; classes["date"] = BuiltIns.Date; classes["double"] = BuiltIns.Double; classes["object"] = BuiltIns.Object; classes["variant"] = BuiltIns.Variant; classes["DbNull"] = BuiltIns.DbNull; classes["dbnull"] = BuiltIns.DbNull; classes["Nothing"] = BuiltIns.Nothing; classes["__Void"] = BuiltIns.Void; foreach (KeyValuePair <string, CClass> e in classes) { e.Value.SetSemanticallyComplete(); universalClasses[e.Key] = e.Value; } // Add valueOf method to Date object CFunction valueOf = new CFunction(new CToken("", 1, 0, "", TokenTypes.identifier, "valueof", "valueOf", true), "valueOf", "valueof", TokenTypes.visPublic, FunctionType.Function, new CArgumentList(), new CTypeRef(null, BuiltIns.Int32)); valueOf.Attributes.Add(CToken.Identifer(valueOf.Token, "suppressusagewarning"), new CTypeRef(null, CToken.Identifer(valueOf.Token, "SuppressUsageWarningAttribute"))); valueOf.Attributes.Add(CToken.Identifer(valueOf.Token, "executeonclient"), new CTypeRef(null, CToken.Identifer(valueOf.Token, "ExecuteOnClientAttribute"))); valueOf.Class = BuiltIns.Date; BuiltIns.Date.SetMember("valueof", new CMethod(valueOf)); }
public CVariable(CToken name, bool shared, CTypeRef tref, CParameters arrayDimsinit, CExpression init, CDim parent) : base(name, shared) { this.dim = parent; this.name = name; base.LoadType(tref); this.init = init; if (init != null) { init.Parent = this; } member = false; this.arrayDimsinit = arrayDimsinit; }
public CLambdaFunction(CToken token, CFunction containingFunction, CFile containingFile, String name, CTypeRef tref, CArgumentList args) : base(token, name, name, TokenTypes.visInternal, FunctionType.Function, args, tref) { this.containingFunction = containingFunction; this.containingFile = containingFile; if (this.containingFunction != null) { this.containingFunction.Lambdas.Add(this); } else { this.containingFile.Lambdas.Add(this); } CallCount++; Attributes.Add(CToken.Identifer(null, "ExecuteAnywhere"), new CTypeRef(null, CToken.Identifer(null, "ExecuteAnywhereAttribute"))); }
public virtual void Add(CTypeRef tref) { if (tref.Resolved && tref.ActualType is CUnionType) { Add((CUnionType)tref.ActualType); } else { string prefix = " Or "; if (Name == "") { prefix = ""; } NameToken = CToken.Identifer(NameToken, Name + prefix + tref.TypeName.Value, RawName + prefix + tref.TypeName.RawValue); types.Add(new CTypeRef(this, tref)); } }
public CClass FindClass(CToken name, bool searchImports) { CClass result = null; CFile file = null; if (name.Filename != null) { fileMap.TryGetValue(name.Filename, out file); } // first look to see if the type has been renamed CToken newName; if (file != null && file.ClassNameAliases.TryGetValue(name.RawValue, out newName)) { name = newName; } // Try to find the class the normal way if (result == null) { result = InternalFindClass(name.RawValue, name.Value, searchImports); } // Look in the namespace mapping if (result == null && file != null) { foreach (var prefix in file.NameSpaceResolutionPrefixes) { result = InternalFindClass( prefix.RawValue + "." + name.RawValue, prefix.Value + "." + name.Value, searchImports); if (result != null) { break; } } } return(result); }
public CFunctionType(CToken token, CFunction function, bool declarationOnly) : base(token, function.TypeSignature) { target = function; this.declarationOnly = declarationOnly; CMethod method = new CMethod(function); DefaultMember = method; function.TypeChanged += new EventHandler(function_TypeChanged); foreach (CArgument arg in function.Arguments) arg.TypeChanged += new EventHandler(function_TypeChanged); this.IsSealed = true; // we don't actually want people accessing the default method directly // we also don't want it to get visited through the type. // so we don't do this: Members.Add(function.Name, method); Attributes.Add(CToken.Identifer(null, "ExecuteAnywhere"), new CTypeRef(null, CToken.Identifer(null, "ExecuteAnywhereAttribute"))); }
public CConstantExpression(CToken tok) : base(tok) { m_value = tok; CClass type = null; switch (tok.TokenType) { case TokenTypes.number: int i; if (Int32.TryParse(tok.Value, out i) || tok.Value.StartsWith("0x")) type = BuiltIns.Int32; else type = BuiltIns.Double; break; case TokenTypes.str: type = BuiltIns.String; break; case TokenTypes.character: type = BuiltIns.Character; break; case TokenTypes.pound: type = BuiltIns.Date; break; case TokenTypes.keyword: if (tok.Value == "true") type = BuiltIns.Boolean; else if (tok.Value == "false") type = BuiltIns.Boolean; else if (tok.Value == "nothing") type = BuiltIns.Nothing; else if (tok.Value == "dbnull") type = BuiltIns.DbNull; break; } if (type != null) base.LoadType(type); }
public CFunctionType(CToken token, CFunction function, bool declarationOnly) : base(token, function.TypeSignature) { target = function; this.declarationOnly = declarationOnly; CMethod method = new CMethod(function); DefaultMember = method; function.TypeChanged += new EventHandler(function_TypeChanged); foreach (CArgument arg in function.Arguments) { arg.TypeChanged += new EventHandler(function_TypeChanged); } this.IsSealed = true; // we don't actually want people accessing the default method directly // we also don't want it to get visited through the type. // so we don't do this: Members.Add(function.Name, method); Attributes.Add(CToken.Identifer(null, "ExecuteAnywhere"), new CTypeRef(null, CToken.Identifer(null, "ExecuteAnywhereAttribute"))); }
public CProperty(CToken token, string name) : base(token, name, "property", 3, false) { }
/// <summary> /// Create a new Try-Catch-Finally block. /// </summary> /// <param name="token">The token defining the Try</param> public CTry(CToken token) : base(token) { }
public CDirective(CToken token) : base(token) { }
public COptionalByRef(CToken tok) : base(tok) { this.IsPassedByRef = true; }
public CDo(CToken token) : base(token) { }
public CComparison(CToken tok, CExpression lhs, CExpression rhs) : base(tok, lhs, rhs) { base.LoadType(BuiltIns.Boolean); }
protected CNode() { type = new CTypeRef(this); token = null; lock (allNodes) allNodes.Add(this); }
protected CNode(CToken token) { type = new CTypeRef(this); this.token = token; lock (allNodes) allNodes.Add(this); }
public CIgnore(CToken token) : base(token) { }