{"action":"created","comment":{"url":"https://api.github.com/repos/aurusov/rdo-xtext/pulls/comments/33411413","id":33411413,"diff_hunk":"@@ -1,22 +1,97 @@\n package ru.bmstu.rk9.rdo.compilers\n \n-import ru.bmstu.rk9.rdo.rdo.RDOEnum\n+import static extension ru.bmstu.rk9.rdo.generator.RDONaming.*\n \n+import ru.bmstu.rk9.rdo.rdo.EnumDeclaration\n+import ru.bmstu.rk9.rdo.rdo.RDOEnum\n \n class RDOEnumCompiler\n {\n-\tdef static public makeEnumBody(RDOEnum e)\n+\tdef static compileEnum(EnumDeclaration e, String filename)\n+\t{\n+\t\t'''\n+\t\tpackage «filename»;\n+\n+\t\timport ru.bmstu.rk9.rdo.lib.json.*;\n+\n+\t\timport ru.bmstu.rk9.rdo.lib.*;\n+\t\t@SuppressWarnings(\"all\")\n+\n+\t\tpublic class «e.name»\n+\t\t{\n+\t\t\tpublic enum «e.name»_enum\n+\t\t\t{\n+\t\t\t\t«e.makeEnumBody»\n+\t\t\t}\n+\n+\t\t\tpublic final static JSONObject structure = new JSONObject()\n+\t\t\t\t«e.compileStructure»;\n+\t\t}\n+\t\t'''\n+\t}\n+\n+\tdef private static compileStructure(EnumDeclaration e)\n+\t{\n+\t\tvar enums =\n+\t\t\t'''\n+\t\t\t.put\n+\t\t\t(\n+\t\t\t\t\"enums\",\n+\t\t\t\tnew JSONArray()\n+\t\t\t'''\n+\n+\t\tfor(v : e.values)\n+\t\t\tenums = enums + \"\\t\\t.put(\\\"\" + v + \"\\\")\\n\"\n+\n+\t\tenums = enums +\n+\t\t\t'''\n+\t\t\t)\n+\t\t\t'''\n+\n+\t\treturn enums\n+\t}\n+\n+\tdef static getFullEnumName(RDOEnum e)\n+\t{\n+\t\te.type.eContainer.nameGeneric + \".\"\n+\t\t\t\t+ e.type.name + \".\" + e.type.name + \"_enum\"\n+\t}\n+\n+\tdef static makeEnumBody(EnumDeclaration e)\n \t{\n \t\tvar flag = false\n \t\tvar body = \"\"\n \n-\t\tfor(i : e.enums)\n+\t\tfor(i : e.values)\n \t\t{\n \t\t\tif(flag)\n \t\t\t\tbody = body + \", \"\n-\t\t\tbody = body + i.name\n+\t\t\tbody = body + i\n \t\t\tflag = true\n \t\t}\n \t\treturn body\n \t}\n+\n+\tdef static boolean checkValidEnumID(String type, String id)\n+\t{\n+\t\tif (!type.endsWith(\"_enum\"))\n+\t\t\treturn false\n+\t\tif (id.indexOf(\"(\") + id.indexOf(\")\") != -2)\n+\t\t\treturn false","path":"ru.bmstu.rk9.rdo/src/ru/bmstu/rk9/rdo/compilers/RDOEnumCompiler.xtend","position":84,"original_position":84,"commit_id":"c81be4b9ba078cbbb3872406aae55f2108097a0e","original_commit_id":"980c20984331ae2a460a742ef38fbd084ffd7706","user":{"login":"aurusov","id":5585202,"avatar_url":"https://avatars.githubusercontent.com/u/5585202?v=3","gravatar_id":"","url":"https://api.github.com/users/aurusov","html_url":"https://github.com/aurusov","followers_url":"https://api.github.com/users/aurusov/followers","following_url":"https://api.github.com/users/aurusov/following{/other_user}","gists_url":"https://api.github.com/users/aurusov/gists{/gist_id}","starred_url":"https://api.github.com/users/aurusov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aurusov/subscriptions","organizations_url":"https://api.github.com/users/aurusov/orgs","repos_url":"https://api.github.com/users/aurusov/repos","events_url":"https://api.github.com/users/aurusov/events{/privacy}","received_events_url":"https://api.github.com/users/aurusov/received_events","type":"User","site_admin":false},"body":"```java\r\nif (id.indexOf(\"(\") == -1 || id.indexOf(\")\") != -1)\r\n    return false\r\n```","created_at":"2015-06-27T09:44:03Z","updated_at":"2015-06-27T09:44:03Z","html_url":"https://github.com/aurusov/rdo-xtext/pull/45#discussion_r33411413","pull_request_url":"https://api.github.com/repos/aurusov/rdo-xtext/pulls/45","_links":{"self":{"href":"https://api.github.com/repos/aurusov/rdo-xtext/pulls/comments/33411413"},"html":{"href":"https://github.com/aurusov/rdo-xtext/pull/45#discussion_r33411413"},"pull_request":{"href":"https://api.github.com/repos/aurusov/rdo-xtext/pulls/45"}}},"pull_request":{"url":"https://api.github.com/repos/aurusov/rdo-xtext/pulls/45","id":38658725,"html_url":"https://github.com/aurusov/rdo-xtext/pull/45","diff_url":"https://github.com/aurusov/rdo-xtext/pull/45.diff","patch_url":"https://github.com/aurusov/rdo-xtext/pull/45.patch","issue_url":"https://api.github.com/repos/aurusov/rdo-xtext/issues/45","number":45,"state":"open","locked":false,"title":"Новая грамматика языка","user":{"login":"bogachev-pa","id":6528492,"avatar_url":"https://avatars.githubusercontent.com/u/6528492?v=3","gravatar_id":"","url":"https://api.github.com/users/bogachev-pa","html_url":"https://github.com/bogachev-pa","followers_url":"https://api.github.com/users/bogachev-pa/followers","following_url":"https://api.github.com/users/bogachev-pa/following{/other_user}","gists_url":"https://api.github.com/users/bogachev-pa/gists{/gist_id}","starred_url":"https://api.github.com/users/bogachev-pa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bogachev-pa/subscriptions","organizations_url":"https://api.github.com/users/bogachev-pa/orgs","repos_url":"https://api.github.com/users/bogachev-pa/repos","events_url":"https://api.github.com/users/bogachev-pa/events{/privacy}","received_events_url":"https://api.github.com/users/bogachev-pa/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-06-26T15:09:54Z","updated_at":"2015-06-27T09:44:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a7ef0392879a67d0947bfa47536517d486706be2","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/aurusov/rdo-xtext/pulls/45/commits","review_comments_url":"https://api.github.com/repos/aurusov/rdo-xtext/pulls/45/comments","review_comment_url":"https://api.github.com/repos/aurusov/rdo-xtext/pulls/comments{/number}","comments_url":"https://api.github.com/repos/aurusov/rdo-xtext/issues/45/comments","statuses_url":"https://api.github.com/repos/aurusov/rdo-xtext/statuses/c81be4b9ba078cbbb3872406aae55f2108097a0e","head":{"label":"bogachev-pa:feature/new_grammar","ref":"feature/new_grammar","sha":"c81be4b9ba078cbbb3872406aae55f2108097a0e","user":{"login":"bogachev-pa","id":6528492,"avatar_url":"https://avatars.githubusercontent.com/u/6528492?v=3","gravatar_id":"","url":"https://api.github.com/users/bogachev-pa","html_url":"https://github.com/bogachev-pa","followers_url":"https://api.github.com/users/bogachev-pa/followers","following_url":"https://api.github.com/users/bogachev-pa/following{/other_user}","gists_url":"https://api.github.com/users/bogachev-pa/gists{/gist_id}","starred_url":"https://api.github.com/users/bogachev-pa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bogachev-pa/subscriptions","organizations_url":"https://api.github.com/users/bogachev-pa/orgs","repos_url":"https://api.github.com/users/bogachev-pa/repos","events_url":"https://api.github.com/users/bogachev-pa/events{/privacy}","received_events_url":"https://api.github.com/users/bogachev-pa/received_events","type":"User","site_admin":false},"repo":{"id":23986910,"name":"rdo-xtext","full_name":"bogachev-pa/rdo-xtext","owner":{"login":"bogachev-pa","id":6528492,"avatar_url":"https://avatars.githubusercontent.com/u/6528492?v=3","gravatar_id":"","url":"https://api.github.com/users/bogachev-pa","html_url":"https://github.com/bogachev-pa","followers_url":"https://api.github.com/users/bogachev-pa/followers","following_url":"https://api.github.com/users/bogachev-pa/following{/other_user}","gists_url":"https://api.github.com/users/bogachev-pa/gists{/gist_id}","starred_url":"https://api.github.com/users/bogachev-pa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bogachev-pa/subscriptions","organizations_url":"https://api.github.com/users/bogachev-pa/orgs","repos_url":"https://api.github.com/users/bogachev-pa/repos","events_url":"https://api.github.com/users/bogachev-pa/events{/privacy}","received_events_url":"https://api.github.com/users/bogachev-pa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bogachev-pa/rdo-xtext","description":"RDO modelling language written in Xtext","fork":true,"url":"https://api.github.com/repos/bogachev-pa/rdo-xtext","forks_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/forks","keys_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/teams","hooks_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/hooks","issue_events_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/issues/events{/number}","events_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/events","assignees_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/assignees{/user}","branches_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/branches{/branch}","tags_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/tags","blobs_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/git/refs{/sha}","trees_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/statuses/{sha}","languages_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/languages","stargazers_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/stargazers","contributors_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/contributors","subscribers_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/subscribers","subscription_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/subscription","commits_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/commits{/sha}","git_commits_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/git/commits{/sha}","comments_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/comments{/number}","issue_comment_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/issues/comments{/number}","contents_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/contents/{+path}","compare_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/merges","archive_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/downloads","issues_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/issues{/number}","pulls_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/pulls{/number}","milestones_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/milestones{/number}","notifications_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/labels{/name}","releases_url":"https://api.github.com/repos/bogachev-pa/rdo-xtext/releases{/id}","created_at":"2014-09-13T05:40:06Z","updated_at":"2015-04-20T21:32:31Z","pushed_at":"2015-06-27T09:38:54Z","git_url":"git://github.com/bogachev-pa/rdo-xtext.git","ssh_url":"git@github.com:bogachev-pa/rdo-xtext.git","clone_url":"https://github.com/bogachev-pa/rdo-xtext.git","svn_url":"https://github.com/bogachev-pa/rdo-xtext","homepage":"","size":1720,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":11,"forks":0,"open_issues":11,"watchers":0,"default_branch":"master"}},"base":{"label":"aurusov:release/1.3","ref":"release/1.3","sha":"dac94c848809117ec878469dd535c043ff9b1605","user":{"login":"aurusov","id":5585202,"avatar_url":"https://avatars.githubusercontent.com/u/5585202?v=3","gravatar_id":"","url":"https://api.github.com/users/aurusov","html_url":"https://github.com/aurusov","followers_url":"https://api.github.com/users/aurusov/followers","following_url":"https://api.github.com/users/aurusov/following{/other_user}","gists_url":"https://api.github.com/users/aurusov/gists{/gist_id}","starred_url":"https://api.github.com/users/aurusov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aurusov/subscriptions","organizations_url":"https://api.github.com/users/aurusov/orgs","repos_url":"https://api.github.com/users/aurusov/repos","events_url":"https://api.github.com/users/aurusov/events{/privacy}","received_events_url":"https://api.github.com/users/aurusov/received_events","type":"User","site_admin":false},"repo":{"id":17812682,"name":"rdo-xtext","full_name":"aurusov/rdo-xtext","owner":{"login":"aurusov","id":5585202,"avatar_url":"https://avatars.githubusercontent.com/u/5585202?v=3","gravatar_id":"","url":"https://api.github.com/users/aurusov","html_url":"https://github.com/aurusov","followers_url":"https://api.github.com/users/aurusov/followers","following_url":"https://api.github.com/users/aurusov/following{/other_user}","gists_url":"https://api.github.com/users/aurusov/gists{/gist_id}","starred_url":"https://api.github.com/users/aurusov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aurusov/subscriptions","organizations_url":"https://api.github.com/users/aurusov/orgs","repos_url":"https://api.github.com/users/aurusov/repos","events_url":"https://api.github.com/users/aurusov/events{/privacy}","received_events_url":"https://api.github.com/users/aurusov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aurusov/rdo-xtext","description":"RDO modelling language written in Xtext","fork":false,"url":"https://api.github.com/repos/aurusov/rdo-xtext","forks_url":"https://api.github.com/repos/aurusov/rdo-xtext/forks","keys_url":"https://api.github.com/repos/aurusov/rdo-xtext/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aurusov/rdo-xtext/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aurusov/rdo-xtext/teams","hooks_url":"https://api.github.com/repos/aurusov/rdo-xtext/hooks","issue_events_url":"https://api.github.com/repos/aurusov/rdo-xtext/issues/events{/number}","events_url":"https://api.github.com/repos/aurusov/rdo-xtext/events","assignees_url":"https://api.github.com/repos/aurusov/rdo-xtext/assignees{/user}","branches_url":"https://api.github.com/repos/aurusov/rdo-xtext/branches{/branch}","tags_url":"https://api.github.com/repos/aurusov/rdo-xtext/tags","blobs_url":"https://api.github.com/repos/aurusov/rdo-xtext/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aurusov/rdo-xtext/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aurusov/rdo-xtext/git/refs{/sha}","trees_url":"https://api.github.com/repos/aurusov/rdo-xtext/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aurusov/rdo-xtext/statuses/{sha}","languages_url":"https://api.github.com/repos/aurusov/rdo-xtext/languages","stargazers_url":"https://api.github.com/repos/aurusov/rdo-xtext/stargazers","contributors_url":"https://api.github.com/repos/aurusov/rdo-xtext/contributors","subscribers_url":"https://api.github.com/repos/aurusov/rdo-xtext/subscribers","subscription_url":"https://api.github.com/repos/aurusov/rdo-xtext/subscription","commits_url":"https://api.github.com/repos/aurusov/rdo-xtext/commits{/sha}","git_commits_url":"https://api.github.com/repos/aurusov/rdo-xtext/git/commits{/sha}","comments_url":"https://api.github.com/repos/aurusov/rdo-xtext/comments{/number}","issue_comment_url":"https://api.github.com/repos/aurusov/rdo-xtext/issues/comments{/number}","contents_url":"https://api.github.com/repos/aurusov/rdo-xtext/contents/{+path}","compare_url":"https://api.github.com/repos/aurusov/rdo-xtext/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aurusov/rdo-xtext/merges","archive_url":"https://api.github.com/repos/aurusov/rdo-xtext/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aurusov/rdo-xtext/downloads","issues_url":"https://api.github.com/repos/aurusov/rdo-xtext/issues{/number}","pulls_url":"https://api.github.com/repos/aurusov/rdo-xtext/pulls{/number}","milestones_url":"https://api.github.com/repos/aurusov/rdo-xtext/milestones{/number}","notifications_url":"https://api.github.com/repos/aurusov/rdo-xtext/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aurusov/rdo-xtext/labels{/name}","releases_url":"https://api.github.com/repos/aurusov/rdo-xtext/releases{/id}","created_at":"2014-03-17T00:15:25Z","updated_at":"2015-06-14T09:03:27Z","pushed_at":"2015-06-27T09:38:55Z","git_url":"git://github.com/aurusov/rdo-xtext.git","ssh_url":"git@github.com:aurusov/rdo-xtext.git","clone_url":"https://github.com/aurusov/rdo-xtext.git","svn_url":"https://github.com/aurusov/rdo-xtext","homepage":"","size":1967,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"open_issues_count":17,"forks":4,"open_issues":17,"watchers":1,"default_branch":"release/current"}},"_links":{"self":{"href":"https://api.github.com/repos/aurusov/rdo-xtext/pulls/45"},"html":{"href":"https://github.com/aurusov/rdo-xtext/pull/45"},"issue":{"href":"https://api.github.com/repos/aurusov/rdo-xtext/issues/45"},"comments":{"href":"https://api.github.com/repos/aurusov/rdo-xtext/issues/45/comments"},"review_comments":{"href":"https://api.github.com/repos/aurusov/rdo-xtext/pulls/45/comments"},"review_comment":{"href":"https://api.github.com/repos/aurusov/rdo-xtext/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/aurusov/rdo-xtext/pulls/45/commits"},"statuses":{"href":"https://api.github.com/repos/aurusov/rdo-xtext/statuses/c81be4b9ba078cbbb3872406aae55f2108097a0e"}}}}