{"action":"created","issue":{"url":"https://api.github.com/repos/eleme/thriftpy/issues/78","labels_url":"https://api.github.com/repos/eleme/thriftpy/issues/78/labels{/name}","comments_url":"https://api.github.com/repos/eleme/thriftpy/issues/78/comments","events_url":"https://api.github.com/repos/eleme/thriftpy/issues/78/events","html_url":"https://github.com/eleme/thriftpy/pull/78","id":54738577,"number":78,"title":"New parser","user":{"login":"hit9","id":1687443,"avatar_url":"https://avatars.githubusercontent.com/u/1687443?v=3","gravatar_id":"","url":"https://api.github.com/users/hit9","html_url":"https://github.com/hit9","followers_url":"https://api.github.com/users/hit9/followers","following_url":"https://api.github.com/users/hit9/following{/other_user}","gists_url":"https://api.github.com/users/hit9/gists{/gist_id}","starred_url":"https://api.github.com/users/hit9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hit9/subscriptions","organizations_url":"https://api.github.com/users/hit9/orgs","repos_url":"https://api.github.com/users/hit9/repos","events_url":"https://api.github.com/users/hit9/events{/privacy}","received_events_url":"https://api.github.com/users/hit9/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-01-19T08:46:00Z","updated_at":"2015-01-19T09:58:55Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/eleme/thriftpy/pulls/78","html_url":"https://github.com/eleme/thriftpy/pull/78","diff_url":"https://github.com/eleme/thriftpy/pull/78.diff","patch_url":"https://github.com/eleme/thriftpy/pull/78.patch"},"body":"**Dont Merge Now.**\r\n\r\nNew parser with bugs fixes:\r\n\r\n1. #69 constant value from referenced constant or enum.\r\n2.  #75 similar to #69, but requires typedefs && ttypes (as field_type)\r\n3.  Enable optional semicolon at the end of a head_unit or definition_unit.\r\n4.  Remove union (wont support)\r\n\r\ne.g.\r\n\r\n1. \r\n   ```thrift\r\n   enum Country {\r\n       CN = 1\r\n   }\r\n\r\n   struct Person {\r\n       1: Country country = Country.CN\r\n   }\r\n   ```\r\n   => \r\n\r\n   ```python\r\n   {\r\n     \"ttypes\": {\r\n         \"Country\": {\r\n         \"CN\": 1\r\n      },\r\n       \"Person\": {\r\n          \"country\": {\r\n           \"id\": 1,\r\n           \"required\": true,\r\n           \"type\": \"Country\",\r\n           \"value\": 1\r\n         }\r\n       }\r\n     }\r\n   }\r\n   ```\r\n\r\nTodo steps:\r\n\r\n* tests\r\n* typedefs as a part of  field_type\r\n\r\nIn-plan unsupported parsing:\r\n\r\n```thrift\r\nstruct Persion {\r\n  1: string name\r\n  2: i32 age\r\n}\r\n\r\nconst Person liming = {\"name\": \"liming\", \"age\": 17}\r\n```\r\n\r\n```thrift\r\ntypedef i32 Int\r\nconst Int myint = 32\r\n```"},"comment":{"url":"https://api.github.com/repos/eleme/thriftpy/issues/comments/70469384","html_url":"https://github.com/eleme/thriftpy/pull/78#issuecomment-70469384","issue_url":"https://api.github.com/repos/eleme/thriftpy/issues/78","id":70469384,"user":{"login":"hit9","id":1687443,"avatar_url":"https://avatars.githubusercontent.com/u/1687443?v=3","gravatar_id":"","url":"https://api.github.com/users/hit9","html_url":"https://github.com/hit9","followers_url":"https://api.github.com/users/hit9/followers","following_url":"https://api.github.com/users/hit9/following{/other_user}","gists_url":"https://api.github.com/users/hit9/gists{/gist_id}","starred_url":"https://api.github.com/users/hit9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hit9/subscriptions","organizations_url":"https://api.github.com/users/hit9/orgs","repos_url":"https://api.github.com/users/hit9/repos","events_url":"https://api.github.com/users/hit9/events{/privacy}","received_events_url":"https://api.github.com/users/hit9/received_events","type":"User","site_admin":false},"created_at":"2015-01-19T09:58:55Z","updated_at":"2015-01-19T09:58:55Z","body":"和 @maralla 讨论后，parser/__init__ 中的load部分直接分散到ply的p_函数中去，即parser.parse直接返回一个thrift module对象。"}}