{"action":"closed","number":1219,"pull_request":{"url":"https://api.github.com/repos/antlr/grammars-v4/pulls/1219","id":214144654,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE0MTQ0NjU0","html_url":"https://github.com/antlr/grammars-v4/pull/1219","diff_url":"https://github.com/antlr/grammars-v4/pull/1219.diff","patch_url":"https://github.com/antlr/grammars-v4/pull/1219.patch","issue_url":"https://api.github.com/repos/antlr/grammars-v4/issues/1219","number":1219,"state":"closed","locked":false,"title":"C# target for Python 3 added","user":{"login":"inkoit","id":21327651,"node_id":"MDQ6VXNlcjIxMzI3NjUx","avatar_url":"https://avatars2.githubusercontent.com/u/21327651?v=4","gravatar_id":"","url":"https://api.github.com/users/inkoit","html_url":"https://github.com/inkoit","followers_url":"https://api.github.com/users/inkoit/followers","following_url":"https://api.github.com/users/inkoit/following{/other_user}","gists_url":"https://api.github.com/users/inkoit/gists{/gist_id}","starred_url":"https://api.github.com/users/inkoit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inkoit/subscriptions","organizations_url":"https://api.github.com/users/inkoit/orgs","repos_url":"https://api.github.com/users/inkoit/repos","events_url":"https://api.github.com/users/inkoit/events{/privacy}","received_events_url":"https://api.github.com/users/inkoit/received_events","type":"User","site_admin":false},"body":"This commit adds C# target for Python3.\r\n\r\nWorks with [Sam Harwell's runtime package](https://github.com/sharwell/antlr4cs) only due to a private field `Lexer._tokenFactorySourcePair` in the official runtime package.\r\n\r\nThis grammar has been tested against the Python 3's \r\n[standard library](https://hg.python.org/cpython/file/3.6/Lib), \r\nthe contents of the asyncio folder there is included in the examples section.\r\n\r\nAlso it has beed tested against the `test_grammar.py` file from the\r\nPython3 target.\r\n\r\nHere's my test code:\r\n\r\n```C#\r\nusing System;\r\nusing System.Text;\r\nusing System.IO;\r\nusing Antlr4.Runtime.Misc;\r\n\r\nnamespace AntlrPythonToCsharp\r\n{\r\n    class Program\r\n    {\r\n        public class Python3Visitor : Python3BaseVisitor<object>\r\n        {\r\n            private StreamWriter file;\r\n            private Antlr4.Runtime.CommonTokenStream tokenStream;\r\n            public Python3Visitor(Antlr4.Runtime.CommonTokenStream tokenStream, StreamWriter file)\r\n            {\r\n                this.tokenStream = tokenStream;\r\n                this.file = file;\r\n            }\r\n\r\n            public override object VisitStmt([NotNull] Python3Parser.StmtContext context)\r\n            {\r\n                file.WriteLine(\"{0} {1} \", context.Payload, context.SourceInterval);\r\n                StringBuilder line = new StringBuilder();\r\n                for (var i = context.SourceInterval.a; i <= context.SourceInterval.b; ++i)\r\n                {\r\n                    line.Append(tokenStream.Get(i).Text + ' ');\r\n                }\r\n                file.WriteLine(line);\r\n                file.Flush();\r\n\r\n                return base.VisitStmt(context);\r\n            }\r\n        }\r\n\r\n        static void Main(string[] args)\r\n        {\r\n            string[] fileEntries = Directory.GetFiles(\"examples\");\r\n            using (StreamWriter file = new StreamWriter(\"log.txt\", true))\r\n            {\r\n                foreach (string fileName in fileEntries)\r\n                {\r\n                    Console.WriteLine(\"Processing file {0}...\", fileName);\r\n                    var input = new StreamReader(fileName);\r\n                    var chars = new Antlr4.Runtime.AntlrInputStream(input);\r\n                    var lexer = new Python3Lexer(chars);\r\n                    var tokens = new Antlr4.Runtime.CommonTokenStream(lexer);\r\n                    var parser = new Python3Parser(tokens)\r\n                    {\r\n                        BuildParseTree = true\r\n                    };\r\n\r\n                    var visitor = new Python3Visitor(tokens, file);\r\n                    visitor.Visit(parser.file_input());\r\n\r\n                    Console.WriteLine(\"{0} processed\", fileName);\r\n                }\r\n            }\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nIt opens the `examples` folder and proccess every file in it. Also, it generates the `log.txt` file in the current directory with some information about parsing results.\r\n\r\nWorks fine (I suppose), with no exceptions.","created_at":"2018-09-09T13:11:10Z","updated_at":"2018-09-09T18:11:18Z","closed_at":"2018-09-09T18:11:18Z","merged_at":"2018-09-09T18:11:18Z","merge_commit_sha":"e3749f9e67455d3090d810699548482d76d84a52","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/antlr/grammars-v4/pulls/1219/commits","review_comments_url":"https://api.github.com/repos/antlr/grammars-v4/pulls/1219/comments","review_comment_url":"https://api.github.com/repos/antlr/grammars-v4/pulls/comments{/number}","comments_url":"https://api.github.com/repos/antlr/grammars-v4/issues/1219/comments","statuses_url":"https://api.github.com/repos/antlr/grammars-v4/statuses/45b8c8a2f6ab18d0a415cbd9442037fc86016149","head":{"label":"inkoit:csharp-target-for-python3","ref":"csharp-target-for-python3","sha":"45b8c8a2f6ab18d0a415cbd9442037fc86016149","user":{"login":"inkoit","id":21327651,"node_id":"MDQ6VXNlcjIxMzI3NjUx","avatar_url":"https://avatars2.githubusercontent.com/u/21327651?v=4","gravatar_id":"","url":"https://api.github.com/users/inkoit","html_url":"https://github.com/inkoit","followers_url":"https://api.github.com/users/inkoit/followers","following_url":"https://api.github.com/users/inkoit/following{/other_user}","gists_url":"https://api.github.com/users/inkoit/gists{/gist_id}","starred_url":"https://api.github.com/users/inkoit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inkoit/subscriptions","organizations_url":"https://api.github.com/users/inkoit/orgs","repos_url":"https://api.github.com/users/inkoit/repos","events_url":"https://api.github.com/users/inkoit/events{/privacy}","received_events_url":"https://api.github.com/users/inkoit/received_events","type":"User","site_admin":false},"repo":{"id":148024340,"node_id":"MDEwOlJlcG9zaXRvcnkxNDgwMjQzNDA=","name":"grammars-v4","full_name":"inkoit/grammars-v4","owner":{"login":"inkoit","id":21327651,"node_id":"MDQ6VXNlcjIxMzI3NjUx","avatar_url":"https://avatars2.githubusercontent.com/u/21327651?v=4","gravatar_id":"","url":"https://api.github.com/users/inkoit","html_url":"https://github.com/inkoit","followers_url":"https://api.github.com/users/inkoit/followers","following_url":"https://api.github.com/users/inkoit/following{/other_user}","gists_url":"https://api.github.com/users/inkoit/gists{/gist_id}","starred_url":"https://api.github.com/users/inkoit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/inkoit/subscriptions","organizations_url":"https://api.github.com/users/inkoit/orgs","repos_url":"https://api.github.com/users/inkoit/repos","events_url":"https://api.github.com/users/inkoit/events{/privacy}","received_events_url":"https://api.github.com/users/inkoit/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/inkoit/grammars-v4","description":"Grammars written for ANTLR v4; expectation that the grammars are free of actions.","fork":true,"url":"https://api.github.com/repos/inkoit/grammars-v4","forks_url":"https://api.github.com/repos/inkoit/grammars-v4/forks","keys_url":"https://api.github.com/repos/inkoit/grammars-v4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/inkoit/grammars-v4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/inkoit/grammars-v4/teams","hooks_url":"https://api.github.com/repos/inkoit/grammars-v4/hooks","issue_events_url":"https://api.github.com/repos/inkoit/grammars-v4/issues/events{/number}","events_url":"https://api.github.com/repos/inkoit/grammars-v4/events","assignees_url":"https://api.github.com/repos/inkoit/grammars-v4/assignees{/user}","branches_url":"https://api.github.com/repos/inkoit/grammars-v4/branches{/branch}","tags_url":"https://api.github.com/repos/inkoit/grammars-v4/tags","blobs_url":"https://api.github.com/repos/inkoit/grammars-v4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/inkoit/grammars-v4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/inkoit/grammars-v4/git/refs{/sha}","trees_url":"https://api.github.com/repos/inkoit/grammars-v4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/inkoit/grammars-v4/statuses/{sha}","languages_url":"https://api.github.com/repos/inkoit/grammars-v4/languages","stargazers_url":"https://api.github.com/repos/inkoit/grammars-v4/stargazers","contributors_url":"https://api.github.com/repos/inkoit/grammars-v4/contributors","subscribers_url":"https://api.github.com/repos/inkoit/grammars-v4/subscribers","subscription_url":"https://api.github.com/repos/inkoit/grammars-v4/subscription","commits_url":"https://api.github.com/repos/inkoit/grammars-v4/commits{/sha}","git_commits_url":"https://api.github.com/repos/inkoit/grammars-v4/git/commits{/sha}","comments_url":"https://api.github.com/repos/inkoit/grammars-v4/comments{/number}","issue_comment_url":"https://api.github.com/repos/inkoit/grammars-v4/issues/comments{/number}","contents_url":"https://api.github.com/repos/inkoit/grammars-v4/contents/{+path}","compare_url":"https://api.github.com/repos/inkoit/grammars-v4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/inkoit/grammars-v4/merges","archive_url":"https://api.github.com/repos/inkoit/grammars-v4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/inkoit/grammars-v4/downloads","issues_url":"https://api.github.com/repos/inkoit/grammars-v4/issues{/number}","pulls_url":"https://api.github.com/repos/inkoit/grammars-v4/pulls{/number}","milestones_url":"https://api.github.com/repos/inkoit/grammars-v4/milestones{/number}","notifications_url":"https://api.github.com/repos/inkoit/grammars-v4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/inkoit/grammars-v4/labels{/name}","releases_url":"https://api.github.com/repos/inkoit/grammars-v4/releases{/id}","deployments_url":"https://api.github.com/repos/inkoit/grammars-v4/deployments","created_at":"2018-09-09T12:43:58Z","updated_at":"2018-09-09T12:44:02Z","pushed_at":"2018-09-09T12:55:33Z","git_url":"git://github.com/inkoit/grammars-v4.git","ssh_url":"git@github.com:inkoit/grammars-v4.git","clone_url":"https://github.com/inkoit/grammars-v4.git","svn_url":"https://github.com/inkoit/grammars-v4","homepage":"","size":19053,"stargazers_count":0,"watchers_count":0,"language":"ANTLR","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"antlr:master","ref":"master","sha":"6f14cf4c61c730078f137d3785ea25c7e9b0f528","user":{"login":"antlr","id":80584,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgwNTg0","avatar_url":"https://avatars0.githubusercontent.com/u/80584?v=4","gravatar_id":"","url":"https://api.github.com/users/antlr","html_url":"https://github.com/antlr","followers_url":"https://api.github.com/users/antlr/followers","following_url":"https://api.github.com/users/antlr/following{/other_user}","gists_url":"https://api.github.com/users/antlr/gists{/gist_id}","starred_url":"https://api.github.com/users/antlr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antlr/subscriptions","organizations_url":"https://api.github.com/users/antlr/orgs","repos_url":"https://api.github.com/users/antlr/repos","events_url":"https://api.github.com/users/antlr/events{/privacy}","received_events_url":"https://api.github.com/users/antlr/received_events","type":"Organization","site_admin":false},"repo":{"id":5958314,"node_id":"MDEwOlJlcG9zaXRvcnk1OTU4MzE0","name":"grammars-v4","full_name":"antlr/grammars-v4","owner":{"login":"antlr","id":80584,"node_id":"MDEyOk9yZ2FuaXphdGlvbjgwNTg0","avatar_url":"https://avatars0.githubusercontent.com/u/80584?v=4","gravatar_id":"","url":"https://api.github.com/users/antlr","html_url":"https://github.com/antlr","followers_url":"https://api.github.com/users/antlr/followers","following_url":"https://api.github.com/users/antlr/following{/other_user}","gists_url":"https://api.github.com/users/antlr/gists{/gist_id}","starred_url":"https://api.github.com/users/antlr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/antlr/subscriptions","organizations_url":"https://api.github.com/users/antlr/orgs","repos_url":"https://api.github.com/users/antlr/repos","events_url":"https://api.github.com/users/antlr/events{/privacy}","received_events_url":"https://api.github.com/users/antlr/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/antlr/grammars-v4","description":"Grammars written for ANTLR v4; expectation that the grammars are free of actions.","fork":false,"url":"https://api.github.com/repos/antlr/grammars-v4","forks_url":"https://api.github.com/repos/antlr/grammars-v4/forks","keys_url":"https://api.github.com/repos/antlr/grammars-v4/keys{/key_id}","collaborators_url":"https://api.github.com/repos/antlr/grammars-v4/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/antlr/grammars-v4/teams","hooks_url":"https://api.github.com/repos/antlr/grammars-v4/hooks","issue_events_url":"https://api.github.com/repos/antlr/grammars-v4/issues/events{/number}","events_url":"https://api.github.com/repos/antlr/grammars-v4/events","assignees_url":"https://api.github.com/repos/antlr/grammars-v4/assignees{/user}","branches_url":"https://api.github.com/repos/antlr/grammars-v4/branches{/branch}","tags_url":"https://api.github.com/repos/antlr/grammars-v4/tags","blobs_url":"https://api.github.com/repos/antlr/grammars-v4/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/antlr/grammars-v4/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/antlr/grammars-v4/git/refs{/sha}","trees_url":"https://api.github.com/repos/antlr/grammars-v4/git/trees{/sha}","statuses_url":"https://api.github.com/repos/antlr/grammars-v4/statuses/{sha}","languages_url":"https://api.github.com/repos/antlr/grammars-v4/languages","stargazers_url":"https://api.github.com/repos/antlr/grammars-v4/stargazers","contributors_url":"https://api.github.com/repos/antlr/grammars-v4/contributors","subscribers_url":"https://api.github.com/repos/antlr/grammars-v4/subscribers","subscription_url":"https://api.github.com/repos/antlr/grammars-v4/subscription","commits_url":"https://api.github.com/repos/antlr/grammars-v4/commits{/sha}","git_commits_url":"https://api.github.com/repos/antlr/grammars-v4/git/commits{/sha}","comments_url":"https://api.github.com/repos/antlr/grammars-v4/comments{/number}","issue_comment_url":"https://api.github.com/repos/antlr/grammars-v4/issues/comments{/number}","contents_url":"https://api.github.com/repos/antlr/grammars-v4/contents/{+path}","compare_url":"https://api.github.com/repos/antlr/grammars-v4/compare/{base}...{head}","merges_url":"https://api.github.com/repos/antlr/grammars-v4/merges","archive_url":"https://api.github.com/repos/antlr/grammars-v4/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/antlr/grammars-v4/downloads","issues_url":"https://api.github.com/repos/antlr/grammars-v4/issues{/number}","pulls_url":"https://api.github.com/repos/antlr/grammars-v4/pulls{/number}","milestones_url":"https://api.github.com/repos/antlr/grammars-v4/milestones{/number}","notifications_url":"https://api.github.com/repos/antlr/grammars-v4/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/antlr/grammars-v4/labels{/name}","releases_url":"https://api.github.com/repos/antlr/grammars-v4/releases{/id}","deployments_url":"https://api.github.com/repos/antlr/grammars-v4/deployments","created_at":"2012-09-25T23:45:11Z","updated_at":"2018-09-09T14:54:37Z","pushed_at":"2018-09-09T18:11:18Z","git_url":"git://github.com/antlr/grammars-v4.git","ssh_url":"git@github.com:antlr/grammars-v4.git","clone_url":"https://github.com/antlr/grammars-v4.git","svn_url":"https://github.com/antlr/grammars-v4","homepage":"","size":19080,"stargazers_count":2905,"watchers_count":2905,"language":"ANTLR","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1254,"mirror_url":null,"archived":false,"open_issues_count":164,"license":null,"forks":1254,"open_issues":164,"watchers":2905,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/antlr/grammars-v4/pulls/1219"},"html":{"href":"https://github.com/antlr/grammars-v4/pull/1219"},"issue":{"href":"https://api.github.com/repos/antlr/grammars-v4/issues/1219"},"comments":{"href":"https://api.github.com/repos/antlr/grammars-v4/issues/1219/comments"},"review_comments":{"href":"https://api.github.com/repos/antlr/grammars-v4/pulls/1219/comments"},"review_comment":{"href":"https://api.github.com/repos/antlr/grammars-v4/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/antlr/grammars-v4/pulls/1219/commits"},"statuses":{"href":"https://api.github.com/repos/antlr/grammars-v4/statuses/45b8c8a2f6ab18d0a415cbd9442037fc86016149"}},"author_association":"NONE","merged":true,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":{"login":"teverett","id":1226086,"node_id":"MDQ6VXNlcjEyMjYwODY=","avatar_url":"https://avatars2.githubusercontent.com/u/1226086?v=4","gravatar_id":"","url":"https://api.github.com/users/teverett","html_url":"https://github.com/teverett","followers_url":"https://api.github.com/users/teverett/followers","following_url":"https://api.github.com/users/teverett/following{/other_user}","gists_url":"https://api.github.com/users/teverett/gists{/gist_id}","starred_url":"https://api.github.com/users/teverett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/teverett/subscriptions","organizations_url":"https://api.github.com/users/teverett/orgs","repos_url":"https://api.github.com/users/teverett/repos","events_url":"https://api.github.com/users/teverett/events{/privacy}","received_events_url":"https://api.github.com/users/teverett/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"maintainer_can_modify":false,"commits":1,"additions":13408,"deletions":0,"changed_files":28}}
{"actor":{"display_login":"teverett"}}