5.1.1.2.1.3.1.1. pycropml.transpiler.rules.csharpRules module

class pycropml.transpiler.rules.csharpRules.CsharpRules[source]

Bases: pycropml.transpiler.rules.generalRule.GeneralRule

binary_op = {'!=': '!=', '*': '*', '+': '+', '-': '-', '/': '/', '<': '<', '<=': '<=', '==': '==', '>': '>', '>=': '>=', 'and': '&&', 'not': '!', 'or': '||'}
constructor = '\n public %s()\n {\n \n }\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 {\n _%s[i] = toCopy._%s[i];\n }\n '
copy_constrList = '\n for (int i = 0; i < toCopy.%s.Count; i++)\n {\n %s.Add(toCopy.%s[i]);\n }\n '
copy_constr_compo = '\n public %s(%s toCopy): this() // copy constructor \n {\n'
functions = {'datetime': {'datetime': ' new DateTime'}, 'io': {'print': 'Display', 'read': 'Console.ReadLine', 'read_file': 'File.ReadAllText', 'write_file': 'File.WriteAllText'}, 'math': {'acos': 'Math.Acos', 'asin': 'Math.Asin', 'atan': 'Math.Atan', 'ceil': 'Math.Ceiling', 'cos': 'Math.Cos', 'exp': 'Math.Exp', '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', 'max': 'Math.Max', 'min': 'Math.Min', 'pow': 'Math.Pow'}}
methods = {'array': {'append': '.Add', 'len': <function translateLenArray>}, 'dict': {'get': <function translateget>, 'keys': <function translatekeyDict>, 'len': <function translateLenDict>}, 'float': {'int': '(int)'}, 'int': {'float': '(double)'}, 'list': {'append': '.Add', 'contains?': '.Contains', 'index': '.IndexOf', 'insert_at': '.Insert', 'len': <function translateLenList>, 'not contains?': <function translateNotContains>, 'pop': '.RemoveAt', 'sum': <function translateSum>}, 'str': {'find': '.IndexOf', 'int': '(int)'}}
public_properties = '\n {\n get\n {\n return this._%s;\n }\n set\n {\n this._%s= value;\n } \n }'
public_properties_compo = '\n {\n get\n {\n return _%s.%s;\n }\n set\n {\n %s\n } \n }\n '
public_properties_wrap = '{ get { return %s.%s;}} \n '
types = {'DateTime': 'DateTime', 'array': '%s[] %s= new %s', 'bool': 'bool', 'datetime': 'DateTime', 'dict': 'Dictionary', 'float': 'double', 'int': 'int', 'list': 'List', 'str': 'string', 'tuple': 'Tuple'}
unary_op = {'+': '+', '-': '-', 'not': '!', '~': '~'}
pycropml.transpiler.rules.csharpRules.translateLenArray(node)[source]
pycropml.transpiler.rules.csharpRules.translateLenDict(node)[source]
pycropml.transpiler.rules.csharpRules.translateLenList(node)[source]
pycropml.transpiler.rules.csharpRules.translateNotContains(node)[source]
pycropml.transpiler.rules.csharpRules.translateSum(node)[source]
pycropml.transpiler.rules.csharpRules.translateget(node)[source]
pycropml.transpiler.rules.csharpRules.translatekeyDict(node)[source]