Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

trailing comma are supported for dict, list, set, import, can. #579

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ThakeeNathees
Copy link
Collaborator

Below is the test file with the added trailing comma syntax.

"""
This test file is to ensure the valid syntax of jac lang.
Add new jac syntax here to test if it compile without any issue.
"""

# Import statement without trailing comma.
import:py from time {
  sleep,
  timezone,
  tzname
}


# Import statement with trailing comma.
import:py from os {
  path,
  getenv,
  getpid,
}


enum WithoutTrailComma {
    FOO = "FOO",
    BAR = "BAR"
}


enum WithTrailComma {
    FOO = "FOO",
    BAR = "BAR",
}


can without_trail_comma(a:int, b:int) {}

can with_trail_comma(
      a:int,
      b:int,
      c:int,
    ) {}


with entry {

    dict_without_trail_comma = { "key" : "value" };
    dict_with_trail_comma = {
        "key" : "val",
    };

    list_without_trail_comma = [ "foo", "bar" ];
    list_with_trail_comma = [
        "foo",
        "bar",
    ];

    set_without_trail_comma = { "foo", "bar" };
    set_with_trail_comma = {
      "foo",
      "bar",
    };

    print("Code compiled and ran successfully!");
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant