7.1.1.2.1.4.1.2. pycropml.transpiler.rules.csharpRules module¶
- class pycropml.transpiler.rules.csharpRules.CsharpRules[source]¶
Bases:
GeneralRule- binary_op = {'!=': '!=', '*': '*', '+': '+', '-': '-', '/': '/', '<': '<', '<=': '<=', '==': '==', '>': '>', '>=': '>=', 'and': '&&', 'not': '!', 'or': '||'}¶
- constant = {'math': {'pi': 'Math.PI'}}¶
- constructor = '\n public %s() { }\n '¶
- copy_constr = '\n public %s(%s toCopy, bool copyAll) // copy constructor \n {\n if (copyAll)\n {\n '¶
- copy_constrArray = '\n for (int i = 0; i < %s; i++)\n { %s[i] = toCopy.%s[i]; }\n '¶
- copy_constrList = '\n for (int i = 0; i < toCopy.%s.Count; i++)\n { %s.Add(toCopy.%s[i]); }\n '¶
- copy_constr_compo = '\n public %s(%s toCopy): this() // copy constructor \n {\n'¶
- functions = {'datetime': {'datetime': ' new DateTime'}, 'io': {'print': <function translatePrint>, 'read': 'Console.ReadLine', 'read_file': 'File.ReadAllText', 'write_file': 'File.WriteAllText'}, 'math': {'acos': 'Math.Acos', 'asin': 'Math.Asin', 'atan': 'Math.Atan', 'ceil': '(int) Math.Ceiling', 'cos': 'Math.Cos', 'exp': 'Math.Exp', 'floor': 'Math.Floor', 'ln': 'Math.Log', 'log': 'Math.Log', 'pow': 'Math.Pow', 'round': 'Math.Round', 'sin': 'Math.Sin', 'sqrt': 'Math.Sqrt', 'tan': 'Math.Tan'}, 'system': {'abs': 'Math.Abs', 'copy': <function translateCopy>, 'max': 'Math.Max', 'min': 'Math.Min', 'pow': <function translatePow>, 'round': 'Math.Round'}}¶
- methods = {'array': {'allocate': <function CsharpRules.<lambda>>, 'append': '.Append', 'len': <function translateLenArray>, 'sum': <function translateSum>}, 'dict': {'get': <function translateget>, 'keys': <function translatekeyDict>, 'len': <function translateLenDict>, 'values': <function translatevalueDict>}, 'float': {'int': '(int)'}, 'int': {'float': '(double)'}, 'list': {'allocate': <function CsharpRules.<lambda>>, 'append': '.Add', 'contains?': '.Contains', 'extend': '.AddRange', 'index': '.IndexOf', 'insert_at': '.Insert', 'len': <function translateLenList>, 'map': <function CsharpRules.<lambda>>, 'not contains?': <function translateNotContains>, 'pop': '.RemoveAt', 'sum': <function translateSum>}, 'str': {'contains?': '.Contains', 'find': '.IndexOf', 'int': '(int)'}}¶
- public_properties = '\n {\n get { return this._%s; }\n set { this._%s= value; } \n }'¶
- public_properties_compo = '\n {\n get\n { return _%s.%s; }\n set\n { %s } \n }\n '¶
- public_properties_wrap = '{ get { return %s.%s;}} \n '¶
- types = {'DateTime': 'DateTime', 'array': '%s[] %s', 'bool': 'bool', 'datetime': 'DateTime', 'dict': 'Dictionary', 'float': 'double', 'int': 'int', 'list': 'List', 'str': 'string', 'tuple': 'Tuple'}¶
- unary_op = {'+': '+', '-': '-', 'not': '!', '~': '~'}¶