{"action":"created","comment":{"url":"https://api.github.com/repos/posborne/cmsis-svd/pulls/comments/39863228","id":39863228,"diff_hunk":"@@ -83,12 +84,25 @@ def _parse_field(self, field_node):\n         enumerated_values = []\n         for enumerated_value_node in field_node.findall(\"./enumeratedValues/enumeratedValue\"):\n             enumerated_values.append(self._parse_enumerated_value(enumerated_value_node))\n+\t\t\t\n+        bitRange=_get_text(field_node, 'bitRange')\n+        bitOffset=_get_int(field_node, 'bitOffset')\n+        bitWidth=_get_int(field_node, 'bitWidth')\n+        msb=_get_int(field_node, 'msb')\n+        lsb=_get_int(field_node, 'lsb')\n+        if bitRange is not None:\n+            m = re.search('\\[([0-9]+):([0-9]+)\\]', bitRange)\n+            bitOffset = int(m.group(2))\n+            bitWidth = 1 + (int(m.group(1)) - int(m.group(2)))     \n+        elif msb is not None:\n+            bitOffset = lsb;\n+            bitWidth = 1 + (msb - lsb);","path":"python/cmsis_svd/parser.py","position":24,"original_position":24,"commit_id":"c7cc8b6c121e20794142174a84a9c2dfe812b176","original_commit_id":"c7cc8b6c121e20794142174a84a9c2dfe812b176","user":{"login":"posborne","id":41714,"avatar_url":"https://avatars.githubusercontent.com/u/41714?v=3","gravatar_id":"","url":"https://api.github.com/users/posborne","html_url":"https://github.com/posborne","followers_url":"https://api.github.com/users/posborne/followers","following_url":"https://api.github.com/users/posborne/following{/other_user}","gists_url":"https://api.github.com/users/posborne/gists{/gist_id}","starred_url":"https://api.github.com/users/posborne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/posborne/subscriptions","organizations_url":"https://api.github.com/users/posborne/orgs","repos_url":"https://api.github.com/users/posborne/repos","events_url":"https://api.github.com/users/posborne/events{/privacy}","received_events_url":"https://api.github.com/users/posborne/received_events","type":"User","site_admin":false},"body":"Change looks good in content.  A couple style things to comply with PEP8 (https://www.python.org/dev/peps/pep-0008/):\r\n\r\n* Variables should be named snake-case (`bitRange` -> `bit_range`)\r\n* Whitespace around operators (`msb = _get_int(...)`).  Assignment for kwargs (e.g. SVDField constructor) is an exception.\r\n* Python doesn't need the semicolons; they should be removed\r\n\r\n\r\nYou can get a quick check here: http://pep8online.com/.  There are some violations (line length, etc.) in the existing code but it can give you a quick linter.  There is a pep8 command-line checker as well.","created_at":"2015-09-18T14:54:14Z","updated_at":"2015-09-18T14:54:14Z","html_url":"https://github.com/posborne/cmsis-svd/pull/12#discussion_r39863228","pull_request_url":"https://api.github.com/repos/posborne/cmsis-svd/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/posborne/cmsis-svd/pulls/comments/39863228"},"html":{"href":"https://github.com/posborne/cmsis-svd/pull/12#discussion_r39863228"},"pull_request":{"href":"https://api.github.com/repos/posborne/cmsis-svd/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/posborne/cmsis-svd/pulls/12","id":45404479,"html_url":"https://github.com/posborne/cmsis-svd/pull/12","diff_url":"https://github.com/posborne/cmsis-svd/pull/12.diff","patch_url":"https://github.com/posborne/cmsis-svd/pull/12.patch","issue_url":"https://api.github.com/repos/posborne/cmsis-svd/issues/12","number":12,"state":"open","locked":false,"title":"Master","user":{"login":"porkybrain","id":10760132,"avatar_url":"https://avatars.githubusercontent.com/u/10760132?v=3","gravatar_id":"","url":"https://api.github.com/users/porkybrain","html_url":"https://github.com/porkybrain","followers_url":"https://api.github.com/users/porkybrain/followers","following_url":"https://api.github.com/users/porkybrain/following{/other_user}","gists_url":"https://api.github.com/users/porkybrain/gists{/gist_id}","starred_url":"https://api.github.com/users/porkybrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porkybrain/subscriptions","organizations_url":"https://api.github.com/users/porkybrain/orgs","repos_url":"https://api.github.com/users/porkybrain/repos","events_url":"https://api.github.com/users/porkybrain/events{/privacy}","received_events_url":"https://api.github.com/users/porkybrain/received_events","type":"User","site_admin":false},"body":"Patched in support for other formats of bit range expression. Be sure and review it well, my python skills are super elementary at this point.","created_at":"2015-09-18T13:12:01Z","updated_at":"2015-09-18T14:54:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7cbc71137a8b12069752c8ac60f5371ff57d1583","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/posborne/cmsis-svd/pulls/12/commits","review_comments_url":"https://api.github.com/repos/posborne/cmsis-svd/pulls/12/comments","review_comment_url":"https://api.github.com/repos/posborne/cmsis-svd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/posborne/cmsis-svd/issues/12/comments","statuses_url":"https://api.github.com/repos/posborne/cmsis-svd/statuses/c7cc8b6c121e20794142174a84a9c2dfe812b176","head":{"label":"porkybrain:master","ref":"master","sha":"c7cc8b6c121e20794142174a84a9c2dfe812b176","user":{"login":"porkybrain","id":10760132,"avatar_url":"https://avatars.githubusercontent.com/u/10760132?v=3","gravatar_id":"","url":"https://api.github.com/users/porkybrain","html_url":"https://github.com/porkybrain","followers_url":"https://api.github.com/users/porkybrain/followers","following_url":"https://api.github.com/users/porkybrain/following{/other_user}","gists_url":"https://api.github.com/users/porkybrain/gists{/gist_id}","starred_url":"https://api.github.com/users/porkybrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porkybrain/subscriptions","organizations_url":"https://api.github.com/users/porkybrain/orgs","repos_url":"https://api.github.com/users/porkybrain/repos","events_url":"https://api.github.com/users/porkybrain/events{/privacy}","received_events_url":"https://api.github.com/users/porkybrain/received_events","type":"User","site_admin":false},"repo":{"id":42436937,"name":"cmsis-svd","full_name":"porkybrain/cmsis-svd","owner":{"login":"porkybrain","id":10760132,"avatar_url":"https://avatars.githubusercontent.com/u/10760132?v=3","gravatar_id":"","url":"https://api.github.com/users/porkybrain","html_url":"https://github.com/porkybrain","followers_url":"https://api.github.com/users/porkybrain/followers","following_url":"https://api.github.com/users/porkybrain/following{/other_user}","gists_url":"https://api.github.com/users/porkybrain/gists{/gist_id}","starred_url":"https://api.github.com/users/porkybrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/porkybrain/subscriptions","organizations_url":"https://api.github.com/users/porkybrain/orgs","repos_url":"https://api.github.com/users/porkybrain/repos","events_url":"https://api.github.com/users/porkybrain/events{/privacy}","received_events_url":"https://api.github.com/users/porkybrain/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/porkybrain/cmsis-svd","description":"Aggegration of ARM Cortex-M CMSIS SVDs and related tools","fork":true,"url":"https://api.github.com/repos/porkybrain/cmsis-svd","forks_url":"https://api.github.com/repos/porkybrain/cmsis-svd/forks","keys_url":"https://api.github.com/repos/porkybrain/cmsis-svd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/porkybrain/cmsis-svd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/porkybrain/cmsis-svd/teams","hooks_url":"https://api.github.com/repos/porkybrain/cmsis-svd/hooks","issue_events_url":"https://api.github.com/repos/porkybrain/cmsis-svd/issues/events{/number}","events_url":"https://api.github.com/repos/porkybrain/cmsis-svd/events","assignees_url":"https://api.github.com/repos/porkybrain/cmsis-svd/assignees{/user}","branches_url":"https://api.github.com/repos/porkybrain/cmsis-svd/branches{/branch}","tags_url":"https://api.github.com/repos/porkybrain/cmsis-svd/tags","blobs_url":"https://api.github.com/repos/porkybrain/cmsis-svd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/porkybrain/cmsis-svd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/porkybrain/cmsis-svd/git/refs{/sha}","trees_url":"https://api.github.com/repos/porkybrain/cmsis-svd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/porkybrain/cmsis-svd/statuses/{sha}","languages_url":"https://api.github.com/repos/porkybrain/cmsis-svd/languages","stargazers_url":"https://api.github.com/repos/porkybrain/cmsis-svd/stargazers","contributors_url":"https://api.github.com/repos/porkybrain/cmsis-svd/contributors","subscribers_url":"https://api.github.com/repos/porkybrain/cmsis-svd/subscribers","subscription_url":"https://api.github.com/repos/porkybrain/cmsis-svd/subscription","commits_url":"https://api.github.com/repos/porkybrain/cmsis-svd/commits{/sha}","git_commits_url":"https://api.github.com/repos/porkybrain/cmsis-svd/git/commits{/sha}","comments_url":"https://api.github.com/repos/porkybrain/cmsis-svd/comments{/number}","issue_comment_url":"https://api.github.com/repos/porkybrain/cmsis-svd/issues/comments{/number}","contents_url":"https://api.github.com/repos/porkybrain/cmsis-svd/contents/{+path}","compare_url":"https://api.github.com/repos/porkybrain/cmsis-svd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/porkybrain/cmsis-svd/merges","archive_url":"https://api.github.com/repos/porkybrain/cmsis-svd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/porkybrain/cmsis-svd/downloads","issues_url":"https://api.github.com/repos/porkybrain/cmsis-svd/issues{/number}","pulls_url":"https://api.github.com/repos/porkybrain/cmsis-svd/pulls{/number}","milestones_url":"https://api.github.com/repos/porkybrain/cmsis-svd/milestones{/number}","notifications_url":"https://api.github.com/repos/porkybrain/cmsis-svd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/porkybrain/cmsis-svd/labels{/name}","releases_url":"https://api.github.com/repos/porkybrain/cmsis-svd/releases{/id}","created_at":"2015-09-14T08:36:01Z","updated_at":"2015-09-14T08:36:14Z","pushed_at":"2015-09-18T13:10:15Z","git_url":"git://github.com/porkybrain/cmsis-svd.git","ssh_url":"git@github.com:porkybrain/cmsis-svd.git","clone_url":"https://github.com/porkybrain/cmsis-svd.git","svn_url":"https://github.com/porkybrain/cmsis-svd","homepage":null,"size":6096,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"posborne:master","ref":"master","sha":"9f2ca607848e5b368f89e0888a0e13c7b43cf764","user":{"login":"posborne","id":41714,"avatar_url":"https://avatars.githubusercontent.com/u/41714?v=3","gravatar_id":"","url":"https://api.github.com/users/posborne","html_url":"https://github.com/posborne","followers_url":"https://api.github.com/users/posborne/followers","following_url":"https://api.github.com/users/posborne/following{/other_user}","gists_url":"https://api.github.com/users/posborne/gists{/gist_id}","starred_url":"https://api.github.com/users/posborne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/posborne/subscriptions","organizations_url":"https://api.github.com/users/posborne/orgs","repos_url":"https://api.github.com/users/posborne/repos","events_url":"https://api.github.com/users/posborne/events{/privacy}","received_events_url":"https://api.github.com/users/posborne/received_events","type":"User","site_admin":false},"repo":{"id":37240503,"name":"cmsis-svd","full_name":"posborne/cmsis-svd","owner":{"login":"posborne","id":41714,"avatar_url":"https://avatars.githubusercontent.com/u/41714?v=3","gravatar_id":"","url":"https://api.github.com/users/posborne","html_url":"https://github.com/posborne","followers_url":"https://api.github.com/users/posborne/followers","following_url":"https://api.github.com/users/posborne/following{/other_user}","gists_url":"https://api.github.com/users/posborne/gists{/gist_id}","starred_url":"https://api.github.com/users/posborne/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/posborne/subscriptions","organizations_url":"https://api.github.com/users/posborne/orgs","repos_url":"https://api.github.com/users/posborne/repos","events_url":"https://api.github.com/users/posborne/events{/privacy}","received_events_url":"https://api.github.com/users/posborne/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/posborne/cmsis-svd","description":"Aggegration of ARM Cortex-M CMSIS SVDs and related tools","fork":false,"url":"https://api.github.com/repos/posborne/cmsis-svd","forks_url":"https://api.github.com/repos/posborne/cmsis-svd/forks","keys_url":"https://api.github.com/repos/posborne/cmsis-svd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/posborne/cmsis-svd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/posborne/cmsis-svd/teams","hooks_url":"https://api.github.com/repos/posborne/cmsis-svd/hooks","issue_events_url":"https://api.github.com/repos/posborne/cmsis-svd/issues/events{/number}","events_url":"https://api.github.com/repos/posborne/cmsis-svd/events","assignees_url":"https://api.github.com/repos/posborne/cmsis-svd/assignees{/user}","branches_url":"https://api.github.com/repos/posborne/cmsis-svd/branches{/branch}","tags_url":"https://api.github.com/repos/posborne/cmsis-svd/tags","blobs_url":"https://api.github.com/repos/posborne/cmsis-svd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/posborne/cmsis-svd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/posborne/cmsis-svd/git/refs{/sha}","trees_url":"https://api.github.com/repos/posborne/cmsis-svd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/posborne/cmsis-svd/statuses/{sha}","languages_url":"https://api.github.com/repos/posborne/cmsis-svd/languages","stargazers_url":"https://api.github.com/repos/posborne/cmsis-svd/stargazers","contributors_url":"https://api.github.com/repos/posborne/cmsis-svd/contributors","subscribers_url":"https://api.github.com/repos/posborne/cmsis-svd/subscribers","subscription_url":"https://api.github.com/repos/posborne/cmsis-svd/subscription","commits_url":"https://api.github.com/repos/posborne/cmsis-svd/commits{/sha}","git_commits_url":"https://api.github.com/repos/posborne/cmsis-svd/git/commits{/sha}","comments_url":"https://api.github.com/repos/posborne/cmsis-svd/comments{/number}","issue_comment_url":"https://api.github.com/repos/posborne/cmsis-svd/issues/comments{/number}","contents_url":"https://api.github.com/repos/posborne/cmsis-svd/contents/{+path}","compare_url":"https://api.github.com/repos/posborne/cmsis-svd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/posborne/cmsis-svd/merges","archive_url":"https://api.github.com/repos/posborne/cmsis-svd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/posborne/cmsis-svd/downloads","issues_url":"https://api.github.com/repos/posborne/cmsis-svd/issues{/number}","pulls_url":"https://api.github.com/repos/posborne/cmsis-svd/pulls{/number}","milestones_url":"https://api.github.com/repos/posborne/cmsis-svd/milestones{/number}","notifications_url":"https://api.github.com/repos/posborne/cmsis-svd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/posborne/cmsis-svd/labels{/name}","releases_url":"https://api.github.com/repos/posborne/cmsis-svd/releases{/id}","created_at":"2015-06-11T05:10:14Z","updated_at":"2015-09-14T10:08:43Z","pushed_at":"2015-09-18T13:12:01Z","git_url":"git://github.com/posborne/cmsis-svd.git","ssh_url":"git@github.com:posborne/cmsis-svd.git","clone_url":"https://github.com/posborne/cmsis-svd.git","svn_url":"https://github.com/posborne/cmsis-svd","homepage":null,"size":5868,"stargazers_count":6,"watchers_count":6,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":5,"forks":3,"open_issues":5,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/posborne/cmsis-svd/pulls/12"},"html":{"href":"https://github.com/posborne/cmsis-svd/pull/12"},"issue":{"href":"https://api.github.com/repos/posborne/cmsis-svd/issues/12"},"comments":{"href":"https://api.github.com/repos/posborne/cmsis-svd/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/posborne/cmsis-svd/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/posborne/cmsis-svd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/posborne/cmsis-svd/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/posborne/cmsis-svd/statuses/c7cc8b6c121e20794142174a84a9c2dfe812b176"}}}}