Giter Site home page Giter Site logo

codetranslator's People

Contributors

calinou avatar hasa1002 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

codetranslator's Issues

`negative` operation not recognized

Version: 0.7-dev (Last Build 2021-01-28 01:30)

Description of the problem:
Negative operations such as -42 are not correctly handled.
Steps to reproduce:
See code.
Code:

Source Code
func _ready():
    var f = File.new()
    f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
Output
[codeblocks]
[gdscript]
func _ready():
    var f = File.new()
    f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
[/gdscript]
[csharp]
public override void _Ready()
{
    var f = new File();
    f.Store16() - 42); // This wraps around and stores 65494 (2^16 - 42).
}
[/csharp]
[/codeblocks]
Expected Output
public override void _Ready()
{
    var f = new File();
    f.Store16(-42); // This wraps around and stores 65494 (2^16 - 42).
}
Warnings
[1] No return value provided. Assuming void. Use -> RETVAL to specify
[3] If constant is enum refer to documentation for correct syntax.

event ist not recognized as keyword

Version: 0.7-dev (Last Build 2020-09-13 01:30)

Description of the problem:
event needs to be @event when used as parameter

Steps to reproduce:

Code:

Source Code
# Prevents the InputEvent to reach other Editor classes
func forward_spatial_gui_input(camera, event):
    var forward = true
    return forward
Output
[codeblocks]
[gdscript]
# Prevents the InputEvent to reach other Editor classes
func forward_spatial_gui_input(camera, event):
    var forward = true
    return forward
[/gdscript]
[csharp]
// Prevents the InputEvent to reach other Editor classes
public void ForwardSpatialGuiInput(?TYPE? camera, ?TYPE? event)
{
    ?VAR? forward = true;
    return forward;
}
[/csharp]
[/codeblocks]
Expected Output
// Prevents the InputEvent to reach other Editor classes
public void ForwardSpatialGuiInput(?TYPE? camera, ?TYPE? @event)
{
    ?VAR? forward = true;
    return forward;
}
Warnings
[2] No return value provided. Assuming void. Use -> RETVAL to specify
[2] No type provided. Consider type hinting with NAME:TYPE
[2] No type provided. Consider type hinting with NAME:TYPE
[3] Type of declaration is unknown

Can't paste code from the clipboard (windows)

Version: 0.1 (Build 2020-08-02 1:38)
Windows 10
Firefox 79.0

Description of the problem:
Can't paste code using the online tool

Steps to reproduce:
Try copy paste some gdscript code and paste it
It'll not paste the code

Code:
N/A

Source Code
Output
Expected Output N/A
Warnings N/A

Add Dictionary Support

GDScript Dictionaries can be created using

var dict = {"a": 10, "some": Vector2(10, 11)}

In C# we can use a similar syntax

var dict = new Godot.Collections.Dictionary {
	{"a", 10},
	{"some", Vector2(10, 11)}
};

bitwise ops are not recognized

Version: 0.7-dev (Last Build 2020-09-13 01:30)

Description of the problem:
Bitwise operators like <<, >> are not recognized
Steps to reproduce:

Code:

Source Code
const MAX_15B = 1 << 15
const MAX_16B = 1 << 16

func unsigned16_to_signed(unsigned):
    return (unsigned   MAX_15B) % MAX_16B - MAX_15B

func _ready():
    var f = File.new()
    f.open(user://file.dat, File.WRITE_READ)
    f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
    f.store_16(121) # In bounds, will store 121.
    f.seek(0) # Go back to start to read the stored value.
    var read1 = f.get_16() # 65494
    var read2 = f.get_16() # 121
    var converted1 = unsigned16_to_signed(read1) # -42
    var converted2 = unsigned16_to_signed(read2) # 121
Output
[codeblocks]
[gdscript]
const MAX_15B = 1 << 15
const MAX_16B = 1 << 16

func unsigned16_to_signed(unsigned):
    return (unsigned   MAX_15B) % MAX_16B - MAX_15B

func _ready():
    var f = File.new()
    f.open(user://file.dat, File.WRITE_READ)
    f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
    f.store_16(121) # In bounds, will store 121.
    f.seek(0) # Go back to start to read the stored value.
    var read1 = f.get_16() # 65494
    var read2 = f.get_16() # 121
    var converted1 = unsigned16_to_signed(read1) # -42
    var converted2 = unsigned16_to_signed(read2) # 121
[/gdscript]
[csharp]
Const Max15b = 1 <  < 15;
Const Max16b = 1 <  < 16;

public void Unsigned16ToSigned(?TYPE? unsigned)
{
    return (unsigned   MAX_15B)% MAX_16B - MAX_15B;
}

public override void _Ready()
{
    var f = new File();
    f.Open(user://file.dat, File.WRITE_READ);
    f.Store16() - 42); // This wraps around and stores 65494 (2^16 - 42).
    f.Store16(121); // In bounds, will store 121.
    f.Seek(0); // Go back to start to read the stored value.
    ?VAR? read1 = f.Get16(); // 65494
    ?VAR? read2 = f.Get16(); // 121
    ?VAR? converted1 = Unsigned16ToSigned(read1); // -42
    ?VAR? converted2 = Unsigned16ToSigned(read2); // 121
}
[/csharp]
[/codeblocks]
Expected Output
Warnings
[4] No return value provided. Assuming void. Use -> RETVAL to specify
[4] No type provided. Consider type hinting with NAME:TYPE
[5] If constant is enum refer to documentation for correct syntax.
[5] If constant is enum refer to documentation for correct syntax.
[5] If constant is enum refer to documentation for correct syntax.
[7] No return value provided. Assuming void. Use -> RETVAL to specify
[9] If constant is enum refer to documentation for correct syntax.
[10] If constant is enum refer to documentation for correct syntax.
[13] Type of declaration is unknown
[14] Type of declaration is unknown
[15] Type of declaration is unknown
[16] Type of declaration is unknown

Commas leading to parsing bugs

Version: 0.7-dev (Last Build 2020-09-13 01:30)

Description of the problem:
Commas are leading to parsing bugs. Likely caused by the rewrite of the brace and comma detection.
Steps to reproduce:

Code:

Source Code
var img = Image.new()
img.create(img_width, img_height, false, Image.FORMAT_RGBA8)
img.set_pixelv(Vector2(x, y), color)
Output
[codeblocks]
[gdscript]
var img = Image.new()
img.create(img_width, img_height, false, Image.FORMAT_RGBA8)
img.set_pixelv(Vector2(x, y), color)
[/gdscript]
[csharp]
var img = new Image();
img.Create(ImgWidth, ImgHeight, false, Image.FORMAT_RGBA8);
img.SetPixelv(new Vector2(X), new Vector2(X, Y)., Color);
[/csharp]
[/codeblocks]
Expected Output
var img = new Image();
img.Create(ImgWidth, ImgHeight, false, Image.FORMAT_RGBA8);
img.SetPixelv(new Vector2(X, Y), Color);
Warnings
[2] If constant is enum refer to documentation for correct syntax.

`const` is not recognised as keyword

Version: 0.7-dev (Last Build 2020-09-13 01:30)

Description of the problem:
const is not recognised as keyword
Steps to reproduce:
See below
Code:

Source Code
const MAX_15B = 1 << 15
const MAX_16B = 1 << 16

func unsigned16_to_signed(unsigned):
    return (unsigned   MAX_15B) % MAX_16B - MAX_15B

func _ready():
    var f = File.new()
    f.open(user://file.dat, File.WRITE_READ)
    f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
    f.store_16(121) # In bounds, will store 121.
    f.seek(0) # Go back to start to read the stored value.
    var read1 = f.get_16() # 65494
    var read2 = f.get_16() # 121
    var converted1 = unsigned16_to_signed(read1) # -42
    var converted2 = unsigned16_to_signed(read2) # 121
Output
[codeblocks]
[gdscript]
const MAX_15B = 1 << 15
const MAX_16B = 1 << 16

func unsigned16_to_signed(unsigned):
    return (unsigned   MAX_15B) % MAX_16B - MAX_15B

func _ready():
    var f = File.new()
    f.open(user://file.dat, File.WRITE_READ)
    f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
    f.store_16(121) # In bounds, will store 121.
    f.seek(0) # Go back to start to read the stored value.
    var read1 = f.get_16() # 65494
    var read2 = f.get_16() # 121
    var converted1 = unsigned16_to_signed(read1) # -42
    var converted2 = unsigned16_to_signed(read2) # 121
[/gdscript]
[csharp]
Const Max15b = 1 <  < 15;
Const Max16b = 1 <  < 16;

public void Unsigned16ToSigned(?TYPE? unsigned)
{
    return (unsigned   MAX_15B)% MAX_16B - MAX_15B;
}

public override void _Ready()
{
    var f = new File();
    f.Open(user://file.dat, File.WRITE_READ);
    f.Store16() - 42); // This wraps around and stores 65494 (2^16 - 42).
    f.Store16(121); // In bounds, will store 121.
    f.Seek(0); // Go back to start to read the stored value.
    ?VAR? read1 = f.Get16(); // 65494
    ?VAR? read2 = f.Get16(); // 121
    ?VAR? converted1 = Unsigned16ToSigned(read1); // -42
    ?VAR? converted2 = Unsigned16ToSigned(read2); // 121
}
[/csharp]
[/codeblocks]
Expected Output
Warnings
[4] No return value provided. Assuming void. Use -> RETVAL to specify
[4] No type provided. Consider type hinting with NAME:TYPE
[5] If constant is enum refer to documentation for correct syntax.
[5] If constant is enum refer to documentation for correct syntax.
[5] If constant is enum refer to documentation for correct syntax.
[7] No return value provided. Assuming void. Use -> RETVAL to specify
[9] If constant is enum refer to documentation for correct syntax.
[10] If constant is enum refer to documentation for correct syntax.
[13] Type of declaration is unknown
[14] Type of declaration is unknown
[15] Type of declaration is unknown
[16] Type of declaration is unknown

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.