diff --git a/CSLightStudio/core/CSLightEvil/C#LE/CLS_Environment.cs b/CSLightStudio/core/CSLightEvil/C#LE/CLS_Environment.cs index c3dceb8..401c16d 100644 --- a/CSLightStudio/core/CSLightEvil/C#LE/CLS_Environment.cs +++ b/CSLightStudio/core/CSLightEvil/C#LE/CLS_Environment.cs @@ -18,7 +18,7 @@ public string version { get { - return "0.49.1Beta"; + return "0.49.4Beta"; } } public CLS_Environment(ICLS_Logger logger) diff --git a/CSLightStudio/core/CSLightEvil/C#LE/Compitler/CLS_Compiler_05Function.cs b/CSLightStudio/core/CSLightEvil/C#LE/Compitler/CLS_Compiler_05Function.cs index 08f56a2..7fd15e3 100644 --- a/CSLightStudio/core/CSLightEvil/C#LE/Compitler/CLS_Compiler_05Function.cs +++ b/CSLightStudio/core/CSLightEvil/C#LE/Compitler/CLS_Compiler_05Function.cs @@ -1,254 +1,257 @@ -using System; -using System.Collections.Generic; -using System.Text; -namespace CSLE -{ - public partial class CLS_Expression_Compiler : ICLS_Expression_Compiler - { - - - public ICLS_Expression Compiler_Expression_Function(IList tlist, ICLS_Environment content, int pos, int posend) - { - CLS_Expression_Function func = new CLS_Expression_Function(pos, posend, tlist[pos].line, tlist[posend].line); - - func.funcname = tlist[pos].text; - int begin = pos + 2; - int dep; - int end = FindCodeAnyInFunc(tlist, ref begin, out dep); - - if (tlist[pos + 1].type == TokenType.PUNCTUATION && tlist[pos + 1].text == "(") - { - do - { - ICLS_Expression param; - bool succ = Compiler_Expression(tlist, content, begin, end, out param); - if (succ && param != null) - { - func.listParam.Add(param); - func.tokenEnd = end; - func.lineEnd = tlist[end].line; - } - begin = end + 2; - end = FindCodeAnyInFunc(tlist, ref begin, out dep); - - } - while (end < posend && begin <= end); - - - return func; - } - //一般函数 - return null; - } - public ICLS_Expression Compiler_Expression_FunctionTrace(IList tlist, ICLS_Environment content, int pos, int posend) - { - if (tlist[pos + 1].type == TokenType.PUNCTUATION && tlist[pos + 1].text == "(") - return Compiler_Expression_Function(tlist, content, pos, posend); - int begin = pos + 1; - int dep; - int end = FindCodeAnyInFunc(tlist, ref begin, out dep); - if (end != posend) - { - return null; - } - CLS_Expression_Function func = new CLS_Expression_Function(pos, end, tlist[pos].line, tlist[end].line); - func.funcname = "trace"; - - do - { - ICLS_Expression param; - bool succ = Compiler_Expression(tlist, content, begin, end, out param); - if (succ && param != null) - { - func.listParam.Add(param); - func.tokenEnd = end; - func.lineEnd = tlist[end].line; - } - begin = end + 2; - end = FindCodeAnyInFunc(tlist, ref begin, out dep); - - } - while (end < posend && begin <= end); - - //ICLS_Expression param0; - //bool succ = Compiler_Expression(tlist,content, begin, end, out param0); - //if(succ&¶m0!=null) - //{ - // func.listParam.Add(param0); - // return func; - - //} - return func; - //trace ,单值直接dump,否则按逗号分隔的表达式处理 - - //return null; - } - public ICLS_Expression Compiler_Expression_FunctionThrow(IList tlist, ICLS_Environment content, int pos, int posend) - { - CLS_Expression_Throw func = new CLS_Expression_Throw(pos, posend, tlist[pos].line, tlist[posend].line); - - ICLS_Expression subvalue; - bool succ = Compiler_Expression(tlist, content, pos + 1, posend, out subvalue); - if (succ) - { - func.listParam.Add(subvalue); - } - - - return func; - //trace ,单值直接dump,否则按逗号分隔的表达式处理 - - //return null; - } - - public ICLS_Expression Compiler_Expression_FunctionNew(IList tlist, ICLS_Environment content, int pos, int posend) - { - int begin = pos + 3; - int dep; - int end = FindCodeAnyInFunc(tlist, ref begin, out dep); - - if (tlist[pos + 2].type == TokenType.PUNCTUATION && tlist[pos + 2].text == "(") - { - //一般函数 - CLS_Expression_FunctionNew func = new CLS_Expression_FunctionNew(pos, posend, tlist[pos].line, tlist[posend].line); - func.type = content.GetTypeByKeyword(tlist[pos + 1].text); - - do - { - ICLS_Expression param; - bool succ = Compiler_Expression(tlist, content, begin, end, out param); - if (succ && param != null) - { - func.listParam.Add(param); - } - begin = end + 2; - end = FindCodeAnyInFunc(tlist, ref begin, out dep); - - } - while (end < posend && begin <= end); - - - return func; - } - else if (tlist[pos + 2].type == TokenType.PUNCTUATION && tlist[pos + 2].text == "[")//数组实例化表达式 - { - CLS_Expression_FunctionNewArray func = new CLS_Expression_FunctionNewArray(pos, posend, tlist[pos].line, tlist[posend].line); - func.type = content.GetTypeByKeyword(tlist[pos + 1].text + "[]"); - - int valuebegin = 0; - ICLS_Expression count = null; - if (tlist[pos + 3].text == "]") - { - valuebegin = pos + 4; - } - else - { - int nbegin = pos + 3; - int dep2; - int end2 = FindCodeAny(tlist, ref nbegin, out dep2); - - bool succ = Compiler_Expression(tlist, content, nbegin, end2, out count); - if (!succ) - { - throw new Exception("数组数量无法识别"); - } - valuebegin = end2 + 2; - } - func.listParam.Add(count); - if (tlist[valuebegin].text == "{")//InitValue - { - int nbegin = valuebegin + 1; - do - { - int dep2; - int nend = FindCodeAny(tlist, ref nbegin, out dep2); - ICLS_Expression valueI; - bool succ = Compiler_Expression(tlist, content, nbegin, nend, out valueI); - if (!succ) - { - throw new Exception("数组初始值无法识别"); - } - func.listParam.Add(valueI); - - if (tlist[nend + 1].text != ",") - break; - nbegin = nend + 2; - } - while (nbegin >= pos && nbegin < posend); - } - return func; - } - return null; - } - - public ICLS_Expression Compiler_Expression_FunctionStatic(IList tlist, ICLS_Environment content, int pos, int posend) - { - CLS_Expression_Function func = new CLS_Expression_Function(pos, posend, tlist[pos].line, tlist[posend].line); - func.funcname = tlist[pos].text; - int begin = pos + 2; - int dep; - int end = FindCodeAnyInFunc(tlist, ref begin, out dep); - - if (tlist[pos + 1].type == TokenType.PUNCTUATION && tlist[pos + 1].text == "(") - { - do - { - ICLS_Expression param; - bool succ = Compiler_Expression(tlist, content, begin, end, out param); - if (succ && param != null) - { - func.listParam.Add(param); - func.tokenEnd = end; - func.lineEnd = tlist[end].line; - } - begin = end + 2; - end = FindCodeAnyInFunc(tlist, ref begin, out dep); - - } - while (end < posend && begin <= end); - - - return func; - } - //一般函数 - return null; - } - - - public ICLS_Expression Compiler_Expression_IndexFind(IList tlist, ICLS_Environment content, int pos, int posend) - { - CLS_Expression_IndexFind func = new CLS_Expression_IndexFind(pos, posend, tlist[pos].line, tlist[posend].line); - ICLS_Expression lefv; - bool b = Compiler_Expression(tlist, content, pos, pos, out lefv); - func.listParam.Add(lefv); - //func.funcname = tlist[pos].text; - int begin = pos + 2; - int dep; - int end = FindCodeAny(tlist, ref begin, out dep); - - if (tlist[pos + 1].type == TokenType.PUNCTUATION && tlist[pos + 1].text == "[") - { - do - { - ICLS_Expression param; - bool succ = Compiler_Expression(tlist, content, begin, end, out param); - if (succ && param != null) - { - func.tokenEnd = end; - func.lineEnd = tlist[end].line; - func.listParam.Add(param); - } - begin = end + 2; - end = FindCodeAny(tlist, ref begin, out dep); - - } - while (end < posend && begin <= end); - - - return func; - } - //一般函数 - return null; - } - } +using System; +using System.Collections.Generic; +using System.Text; +namespace CSLE +{ + public partial class CLS_Expression_Compiler : ICLS_Expression_Compiler + { + + + public ICLS_Expression Compiler_Expression_Function(IList tlist, ICLS_Environment content, int pos, int posend) + { + CLS_Expression_Function func = new CLS_Expression_Function(pos, posend, tlist[pos].line, tlist[posend].line); + + func.funcname = tlist[pos].text; + int begin = pos + 2; + int dep; + int end = FindCodeAnyInFunc(tlist, ref begin, out dep); + + if (tlist[pos + 1].type == TokenType.PUNCTUATION && tlist[pos + 1].text == "(") + { + do + { + ICLS_Expression param; + bool succ = Compiler_Expression(tlist, content, begin, end, out param); + if (succ && param != null) + { + func.listParam.Add(param); + func.tokenEnd = end; + func.lineEnd = tlist[end].line; + } + begin = end + 2; + end = FindCodeAnyInFunc(tlist, ref begin, out dep); + + } + while (end < posend && begin <= end); + + + return func; + } + //一般函数 + return null; + } + public ICLS_Expression Compiler_Expression_FunctionTrace(IList tlist, ICLS_Environment content, int pos, int posend) + { + if (tlist[pos + 1].type == TokenType.PUNCTUATION && tlist[pos + 1].text == "(") + return Compiler_Expression_Function(tlist, content, pos, posend); + int begin = pos + 1; + int dep; + int end = FindCodeAnyInFunc(tlist, ref begin, out dep); + if (end != posend) + { + return null; + } + CLS_Expression_Function func = new CLS_Expression_Function(pos, end, tlist[pos].line, tlist[end].line); + func.funcname = "trace"; + + do + { + ICLS_Expression param; + bool succ = Compiler_Expression(tlist, content, begin, end, out param); + if (succ && param != null) + { + func.listParam.Add(param); + func.tokenEnd = end; + func.lineEnd = tlist[end].line; + } + begin = end + 2; + end = FindCodeAnyInFunc(tlist, ref begin, out dep); + + } + while (end < posend && begin <= end); + + //ICLS_Expression param0; + //bool succ = Compiler_Expression(tlist,content, begin, end, out param0); + //if(succ&¶m0!=null) + //{ + // func.listParam.Add(param0); + // return func; + + //} + return func; + //trace ,单值直接dump,否则按逗号分隔的表达式处理 + + //return null; + } + public ICLS_Expression Compiler_Expression_FunctionThrow(IList tlist, ICLS_Environment content, int pos, int posend) + { + CLS_Expression_Throw func = new CLS_Expression_Throw(pos, posend, tlist[pos].line, tlist[posend].line); + + ICLS_Expression subvalue; + bool succ = Compiler_Expression(tlist, content, pos + 1, posend, out subvalue); + if (succ) + { + func.listParam.Add(subvalue); + } + + + return func; + //trace ,单值直接dump,否则按逗号分隔的表达式处理 + + //return null; + } + + public ICLS_Expression Compiler_Expression_FunctionNew(IList tlist, ICLS_Environment content, int pos, int posend) + { + int begin = pos + 3; + int dep; + int end = FindCodeAnyInFunc(tlist, ref begin, out dep); + + if (tlist[pos + 2].type == TokenType.PUNCTUATION && tlist[pos + 2].text == "(") + { + //一般函数 + CLS_Expression_FunctionNew func = new CLS_Expression_FunctionNew(pos, posend, tlist[pos].line, tlist[posend].line); + func.type = content.GetTypeByKeyword(tlist[pos + 1].text); + + do + { + ICLS_Expression param; + bool succ = Compiler_Expression(tlist, content, begin, end, out param); + if (succ && param != null) + { + func.listParam.Add(param); + } + begin = end + 2; + end = FindCodeAnyInFunc(tlist, ref begin, out dep); + + } + while (end < posend && begin <= end); + + + return func; + } + else if (tlist[pos + 2].type == TokenType.PUNCTUATION && tlist[pos + 2].text == "[")//数组实例化表达式 + { + CLS_Expression_FunctionNewArray func = new CLS_Expression_FunctionNewArray(pos, posend, tlist[pos].line, tlist[posend].line); + func.type = content.GetTypeByKeyword(tlist[pos + 1].text + "[]"); + + int valuebegin = 0; + ICLS_Expression count = null; + if (tlist[pos + 3].text == "]") + { + valuebegin = pos + 4; + } + else + { + int nbegin = pos + 3; + int dep2; + int end2 = FindCodeAny(tlist, ref nbegin, out dep2); + + bool succ = Compiler_Expression(tlist, content, nbegin, end2, out count); + if (!succ) + { + throw new Exception("数组数量无法识别"); + } + valuebegin = end2 + 2; + } + func.listParam.Add(count); + if (tlist[valuebegin].text == "{")//InitValue + { + int[] v = new int[0]; + int nbegin = valuebegin + 1; + do + { + int dep2; + int nend = FindCodeAny(tlist, ref nbegin, out dep2); + ICLS_Expression valueI; + bool succ = Compiler_Expression(tlist, content, nbegin, nend, out valueI); + if (!succ) + { + //throw new Exception("数组初始值无法识别"); + } + else + { + func.listParam.Add(valueI); + } + if (tlist[nend + 1].text != ",") + break; + nbegin = nend + 2; + } + while (nbegin >= pos && nbegin < posend); + } + return func; + } + return null; + } + + public ICLS_Expression Compiler_Expression_FunctionStatic(IList tlist, ICLS_Environment content, int pos, int posend) + { + CLS_Expression_Function func = new CLS_Expression_Function(pos, posend, tlist[pos].line, tlist[posend].line); + func.funcname = tlist[pos].text; + int begin = pos + 2; + int dep; + int end = FindCodeAnyInFunc(tlist, ref begin, out dep); + + if (tlist[pos + 1].type == TokenType.PUNCTUATION && tlist[pos + 1].text == "(") + { + do + { + ICLS_Expression param; + bool succ = Compiler_Expression(tlist, content, begin, end, out param); + if (succ && param != null) + { + func.listParam.Add(param); + func.tokenEnd = end; + func.lineEnd = tlist[end].line; + } + begin = end + 2; + end = FindCodeAnyInFunc(tlist, ref begin, out dep); + + } + while (end < posend && begin <= end); + + + return func; + } + //一般函数 + return null; + } + + + public ICLS_Expression Compiler_Expression_IndexFind(IList tlist, ICLS_Environment content, int pos, int posend) + { + CLS_Expression_IndexFind func = new CLS_Expression_IndexFind(pos, posend, tlist[pos].line, tlist[posend].line); + ICLS_Expression lefv; + bool b = Compiler_Expression(tlist, content, pos, pos, out lefv); + func.listParam.Add(lefv); + //func.funcname = tlist[pos].text; + int begin = pos + 2; + int dep; + int end = FindCodeAny(tlist, ref begin, out dep); + + if (tlist[pos + 1].type == TokenType.PUNCTUATION && tlist[pos + 1].text == "[") + { + do + { + ICLS_Expression param; + bool succ = Compiler_Expression(tlist, content, begin, end, out param); + if (succ && param != null) + { + func.tokenEnd = end; + func.lineEnd = tlist[end].line; + func.listParam.Add(param); + } + begin = end + 2; + end = FindCodeAny(tlist, ref begin, out dep); + + } + while (end < posend && begin <= end); + + + return func; + } + //一般函数 + return null; + } + } } \ No newline at end of file diff --git a/CSLightStudio/core/CSLightEvil/C#LE/Expression/Math/CLS_Expression_Math2ValueLogic.cs b/CSLightStudio/core/CSLightEvil/C#LE/Expression/Math/CLS_Expression_Math2ValueLogic.cs index 7ed9788..80da80f 100644 --- a/CSLightStudio/core/CSLightEvil/C#LE/Expression/Math/CLS_Expression_Math2ValueLogic.cs +++ b/CSLightStudio/core/CSLightEvil/C#LE/Expression/Math/CLS_Expression_Math2ValueLogic.cs @@ -1,90 +1,101 @@ -using System; -using System.Collections.Generic; -using System.Text; -namespace CSLE -{ - - public class CLS_Expression_Math2ValueLogic : ICLS_Expression - { - public CLS_Expression_Math2ValueLogic(int tbegin, int tend, int lbegin, int lend) - { - listParam = new List(); - this.tokenBegin = tbegin; - tokenEnd = tend; - lineBegin = lbegin; - lineEnd = lend; - } - public int lineBegin - { - get; - private set; - } - public int lineEnd - { - get; - private set; - } - //Block的参数 一个就是一行,顺序执行,没有 - public List listParam - { - get; - private set; - } - public int tokenBegin - { - get; - private set; - } - public int tokenEnd - { - get; - private set; - } - public CLS_Content.Value ComputeValue(CLS_Content content) - { - content.InStack(this); - CLS_Content.Value result = new CLS_Content.Value(); - - - //if(mathop=="<"||mathop=="<="||mathop==">"||mathop==">="||mathop=="=="||mathop=="!=") - { - result.type = typeof(bool); - var left = listParam[0].ComputeValue(content); - var right = listParam[1].ComputeValue(content); - if ((Type)left.type == typeof(bool) && (Type)right.type == typeof(bool)) - { - if (mathop == logictoken.equal) - { - result.value = (bool)left.value == (bool)right.value; - //return result; - } - else if (mathop == logictoken.not_equal) - { - result.value = (bool)left.value != (bool)right.value; - //return result; - } - else - { - throw new Exception("bool 不支持此运算符"); - } - } - else - { - - result.value = content.environment.GetType(left.type).MathLogic(content, mathop, left.value, right); - - } - } - content.OutStack(this); - - return result; - } - - public logictoken mathop; - - public override string ToString() - { - return "Math2ValueLogic|a" + mathop + "b"; - } - } +using System; +using System.Collections.Generic; +using System.Text; +namespace CSLE +{ + + public class CLS_Expression_Math2ValueLogic : ICLS_Expression + { + public CLS_Expression_Math2ValueLogic(int tbegin, int tend, int lbegin, int lend) + { + listParam = new List(); + this.tokenBegin = tbegin; + tokenEnd = tend; + lineBegin = lbegin; + lineEnd = lend; + } + public int lineBegin + { + get; + private set; + } + public int lineEnd + { + get; + private set; + } + //Block的参数 一个就是一行,顺序执行,没有 + public List listParam + { + get; + private set; + } + public int tokenBegin + { + get; + private set; + } + public int tokenEnd + { + get; + private set; + } + public CLS_Content.Value ComputeValue(CLS_Content content) + { + content.InStack(this); + CLS_Content.Value result = new CLS_Content.Value(); + + + //if(mathop=="<"||mathop=="<="||mathop==">"||mathop==">="||mathop=="=="||mathop=="!=") + { + result.type = typeof(bool); + var left = listParam[0].ComputeValue(content); + var right = listParam[1].ComputeValue(content); + if(left.type==null||right.type==null) + { + if (mathop == logictoken.equal) + { + result.value = left.value == right.value; + } + if(mathop== logictoken.not_equal) + { + result.value = left.value != right.value; + } + } + else if ((Type)left.type == typeof(bool) && (Type)right.type == typeof(bool)) + { + if (mathop == logictoken.equal) + { + result.value = (bool)left.value == (bool)right.value; + //return result; + } + else if (mathop == logictoken.not_equal) + { + result.value = (bool)left.value != (bool)right.value; + //return result; + } + else + { + throw new Exception("bool 不支持此运算符"); + } + } + else + { + + result.value = content.environment.GetType(left.type).MathLogic(content, mathop, left.value, right); + + } + } + content.OutStack(this); + + return result; + } + + public logictoken mathop; + + public override string ToString() + { + return "Math2ValueLogic|a" + mathop + "b"; + } + } } \ No newline at end of file diff --git a/CSLightStudio/core/CSLightEvil/C#LE/Log.txt b/CSLightStudio/core/CSLightEvil/C#LE/Log.txt index 1170890..7f36563 100644 --- a/CSLightStudio/core/CSLightEvil/C#LE/Log.txt +++ b/CSLightStudio/core/CSLightEvil/C#LE/Log.txt @@ -1,4 +1,16 @@ -2014-09-10 0.49.1Beta【Graphics修改】 +2014-09-29 0.49.4Beta +修正了if(null==xxx)这种表达式 +修正了用子类访问父类的静态成员的问题 + + +2014-09-22 0.49.3Beta +结构体没有默认构造函数,修改此问题 + + +2014-09-21 0.49.2Beta +修改了一个string+null 会崩溃的bug + +2014-09-10 0.49.1Beta【Graphics修改】 加入了long的支持 从新编写了算数运算部分,更统一。 diff --git a/CSLightStudio/core/CSLightEvil/C#LE/RegHelper/RegHelper_Type.cs b/CSLightStudio/core/CSLightEvil/C#LE/RegHelper/RegHelper_Type.cs index e643c29..d3aa751 100644 --- a/CSLightStudio/core/CSLightEvil/C#LE/RegHelper/RegHelper_Type.cs +++ b/CSLightStudio/core/CSLightEvil/C#LE/RegHelper/RegHelper_Type.cs @@ -24,7 +24,14 @@ public virtual CLS_Content.Value New(CLS_Content environment, IList _params) @@ -45,10 +52,10 @@ public virtual CLS_Content.Value StaticCall(CLS_Content environment, string func } } var targetop = type.GetMethod(function, types.ToArray()); - if (targetop == null && type.BaseType != null)//加上父类型静态函数查找,典型的现象是 GameObject.Destory - { - targetop = type.BaseType.GetMethod(function, types.ToArray()); - } + //if (targetop == null && type.BaseType != null)//加上父类型静态函数查找,典型的现象是 GameObject.Destory + //{ + // targetop = type.BaseType.GetMethod(function, types.ToArray()); + //} if (targetop == null) { if (function[function.Length - 1] == '>')//这是一个临时的模板函数调用 @@ -66,9 +73,20 @@ public virtual CLS_Content.Value StaticCall(CLS_Content environment, string func } else { - throw new Exception("函数不存在function:" + type.ToString() + "." + function); + Type ptype = type.BaseType; + while(ptype!=null) + { + targetop = ptype.GetMethod(function, types.ToArray()); + if (targetop != null) break; + ptype = ptype.BaseType; + } + } } + if(targetop==null) + { + throw new Exception("函数不存在function:" + type.ToString() + "." + function); + } CLS_Content.Value v = new CLS_Content.Value(); v.value = targetop.Invoke(null, _oparams.ToArray()); v.type = targetop.ReturnType; @@ -118,8 +136,13 @@ public virtual CLS_Content.Value StaticValueGet(CLS_Content environment, string } } } + if(type.BaseType!=null) + { + return environment.environment.GetType(type.BaseType).function.StaticValueGet(environment, valuename); + } - return null; + + throw new NotImplementedException(); } public virtual void StaticValueSet(CLS_Content content, string valuename, object value) @@ -151,7 +174,11 @@ public virtual void StaticValueSet(CLS_Content content, string valuename, object return; } } - + if (type.BaseType != null) + { + content.environment.GetType(type.BaseType).function.StaticValueSet(content, valuename,value); + return; + } throw new NotImplementedException(); diff --git a/CSLightStudio/core/CSLightEvil/C#LE/Type/CLS_Type_String.cs b/CSLightStudio/core/CSLightEvil/C#LE/Type/CLS_Type_String.cs index 4f7dd1b..a2399cc 100644 --- a/CSLightStudio/core/CSLightEvil/C#LE/Type/CLS_Type_String.cs +++ b/CSLightStudio/core/CSLightEvil/C#LE/Type/CLS_Type_String.cs @@ -1,78 +1,86 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace CSLE -{ - class CLS_Type_String : ICLS_Type - { - public CLS_Type_String() - { - function = new RegHelper_TypeFunction(typeof(string)); - } - public string keyword - { - get { return "string"; } - } - public string _namespace - { - get { return ""; } - } - public CLType type - { - get { return typeof(string); } - } - - public ICLS_Value MakeValue(object value) - { - CLS_Value_Value v = new CLS_Value_Value(); - v.value_value = (string)value; - - return v; - - } - - public object ConvertTo(CLS_Content env, object src, CLType targetType) - { - if (targetType == type) return src; - if ((Type)targetType == typeof(void)) - { - return null; - } - throw new NotImplementedException(); - } - - public object Math2Value(CLS_Content env, char code, object left, CLS_Content.Value right, out CLType returntype) - { - returntype = typeof(string); - if (code == '+') - return (string)left + right.value.ToString(); - - throw new NotImplementedException(); - } - - public bool MathLogic(CLS_Content env, logictoken code, object left, CLS_Content.Value right) - { - if (code == logictoken.equal) - { - return (string)left == (string)right.value; - } - else if(code== logictoken.not_equal) - { - return (string)left != (string)right.value; - } - throw new NotImplementedException(); - } - - - public ICLS_TypeFunction function - { - get; - private set; - } - public object DefValue - { - get { return null; } - } - } -} +using System; +using System.Collections.Generic; +using System.Text; + +namespace CSLE +{ + class CLS_Type_String : ICLS_Type + { + public CLS_Type_String() + { + function = new RegHelper_TypeFunction(typeof(string)); + } + public string keyword + { + get { return "string"; } + } + public string _namespace + { + get { return ""; } + } + public CLType type + { + get { return typeof(string); } + } + + public ICLS_Value MakeValue(object value) + { + CLS_Value_Value v = new CLS_Value_Value(); + v.value_value = (string)value; + + return v; + + } + + public object ConvertTo(CLS_Content env, object src, CLType targetType) + { + if (targetType == type) return src; + if ((Type)targetType == typeof(void)) + { + return null; + } + throw new NotImplementedException(); + } + + public object Math2Value(CLS_Content env, char code, object left, CLS_Content.Value right, out CLType returntype) + { + returntype = typeof(string); + if (code == '+') + { + if (right.value == null) + { + return (string)left + "null"; + } + else + { + return (string)left + right.value.ToString(); + } + } + throw new NotImplementedException(); + } + + public bool MathLogic(CLS_Content env, logictoken code, object left, CLS_Content.Value right) + { + if (code == logictoken.equal) + { + return (string)left == (string)right.value; + } + else if(code== logictoken.not_equal) + { + return (string)left != (string)right.value; + } + throw new NotImplementedException(); + } + + + public ICLS_TypeFunction function + { + get; + private set; + } + public object DefValue + { + get { return null; } + } + } +} diff --git a/CSLightStudio/cslight_unity.zip b/CSLightStudio/cslight_unity.zip new file mode 100644 index 0000000..901df43 Binary files /dev/null and b/CSLightStudio/cslight_unity.zip differ diff --git a/CSLightStudio/windows/CSEvilTestor/script/test07/Test07.cs b/CSLightStudio/windows/CSEvilTestor/script/test07/Test07.cs index ba06d4c..6541bdc 100644 --- a/CSLightStudio/windows/CSEvilTestor/script/test07/Test07.cs +++ b/CSLightStudio/windows/CSEvilTestor/script/test07/Test07.cs @@ -32,6 +32,7 @@ public void Fun2() { return; } + Debug.Log("Fun3"); } } diff --git a/readme.txt b/readme.txt index d06131c..22c23ba 100644 --- a/readme.txt +++ b/readme.txt @@ -5,6 +5,15 @@ 具体信息可移步http://crazylights.cnblogs.com/ 有问题可以加QQ群研讨:223823428 +2014-09-29 0.49.4Beta +修正了if(null==xxx)这种表达式 +修正了用子类访问父类的静态成员的问题 + +2014-09-22 0.49.3Beta +结构体没有默认构造函数,修改此问题 + +2014-09-21 0.49.2Beta +修改了一个string+null 会崩溃的bug 2014-09-10 0.49.1Beta【Graphics修改】 加入了long的支持