{"action":"created","comment":{"url":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls/comments/43458751","id":43458751,"diff_hunk":"@@ -232,6 +232,111 @@ module GRXML\n           grammar.inline!.should == inline_grammar\n           grammar.should == inline_grammar\n         end\n+\n+        context \"nested\" do\n+          context \"in a self-referencial infinite loop\" do\n+            subject do\n+              RubySpeech::GRXML.draw mode: :dtmf, root: \"main\" do\n+                rule id: :main, scope: \"public\" do\n+                  ruleref uri: \"#paradox\"\n+                end\n+                rule id: \"paradox\" do\n+                  ruleref uri: \"#paradox\"\n+                end\n+              end\n+            end\n+\n+            it \"should be rejected with an error\" do\n+              expect { subject.inline }.to raise_error ArgumentError, /Max ruleref recursion level of 25 has been exceeded./\n+            end\n+          end\n+\n+          context \"with an invalid-reference\" do\n+            subject do\n+              RubySpeech::GRXML.draw mode: :dtmf, root: \"main\" do\n+                rule id: :main, scope: \"public\" do\n+                  ruleref uri: \"#lost\"\n+                end\n+              end.inline\n+            end\n+\n+            it \"should raise a descriptive exception\" do\n+              expect { subject }.to raise_error ArgumentError, 'The Ruleref \"#lost\" is referenced but not defined'\n+            end\n+          end\n+\n+          context \"deeply\" do\n+            before :each do\n+              subject.root = \"main\"\n+              subject << Rule.new(doc, id: \"main\", scope: \"public\") do\n+                ruleref uri: \"#level0\"\n+              end\n+\n+              levels.times do |i|\n+                next_ref = i + 1\n+                subject << if next_ref < levels\n+                   Rule.new(doc, id: \"level#{i}\") do\n+                    ruleref uri: \"#level#{next_ref}\"\n+                  end\n+                else","path":"spec/ruby_speech/grxml/grammar_spec.rb","position":50,"original_position":50,"commit_id":"b248294b1a7c874623f4888df51784eb4a7e0104","original_commit_id":"499bf42887b4342613a501c853747ba2a8b402b8","user":{"login":"benlangfeld","id":210221,"avatar_url":"https://avatars.githubusercontent.com/u/210221?v=3","gravatar_id":"","url":"https://api.github.com/users/benlangfeld","html_url":"https://github.com/benlangfeld","followers_url":"https://api.github.com/users/benlangfeld/followers","following_url":"https://api.github.com/users/benlangfeld/following{/other_user}","gists_url":"https://api.github.com/users/benlangfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/benlangfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benlangfeld/subscriptions","organizations_url":"https://api.github.com/users/benlangfeld/orgs","repos_url":"https://api.github.com/users/benlangfeld/repos","events_url":"https://api.github.com/users/benlangfeld/events{/privacy}","received_events_url":"https://api.github.com/users/benlangfeld/received_events","type":"User","site_admin":false},"body":"I don't have strong feelings about this either way :)","created_at":"2015-10-29T23:47:39Z","updated_at":"2015-10-29T23:47:39Z","html_url":"https://github.com/benlangfeld/ruby_speech/pull/34#discussion_r43458751","pull_request_url":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls/34","_links":{"self":{"href":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls/comments/43458751"},"html":{"href":"https://github.com/benlangfeld/ruby_speech/pull/34#discussion_r43458751"},"pull_request":{"href":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls/34"}}},"pull_request":{"url":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls/34","id":22908378,"html_url":"https://github.com/benlangfeld/ruby_speech/pull/34","diff_url":"https://github.com/benlangfeld/ruby_speech/pull/34.diff","patch_url":"https://github.com/benlangfeld/ruby_speech/pull/34.patch","issue_url":"https://api.github.com/repos/benlangfeld/ruby_speech/issues/34","number":34,"state":"open","locked":false,"title":"[BUGFIX] Ensure that Rulerefs n-levels deep are expanded","user":{"login":"sfgeorge","id":208529,"avatar_url":"https://avatars.githubusercontent.com/u/208529?v=3","gravatar_id":"","url":"https://api.github.com/users/sfgeorge","html_url":"https://github.com/sfgeorge","followers_url":"https://api.github.com/users/sfgeorge/followers","following_url":"https://api.github.com/users/sfgeorge/following{/other_user}","gists_url":"https://api.github.com/users/sfgeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/sfgeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfgeorge/subscriptions","organizations_url":"https://api.github.com/users/sfgeorge/orgs","repos_url":"https://api.github.com/users/sfgeorge/repos","events_url":"https://api.github.com/users/sfgeorge/events{/privacy}","received_events_url":"https://api.github.com/users/sfgeorge/received_events","type":"User","site_admin":false},"body":"When grammars are interpreted _inline_ by RubySpeech itself, the intention was to expand all internal rulerefs to other, literal elements.\r\n\r\nThe problem: If a nesting exists in which a referenced rule references yet another rule, the expansion would be incomplete and inline matching would fail.\r\n\r\nThis fixes the issue by ensuring that rulerefs continue to be expanded until no more exist.\r\n\r\n * [x] Ensure that Rulerefs n-levels deep are expanded\r\n * [x] Improve invalid ruleref error message\r\n * [x] Ensure self-referencial Rules don't cause infinite loops","created_at":"2014-10-17T07:50:45Z","updated_at":"2015-10-29T23:47:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cb685cd2cac4ac359cebf30a8d84fe08ec4cf97f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls/34/commits","review_comments_url":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls/34/comments","review_comment_url":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls/comments{/number}","comments_url":"https://api.github.com/repos/benlangfeld/ruby_speech/issues/34/comments","statuses_url":"https://api.github.com/repos/benlangfeld/ruby_speech/statuses/b248294b1a7c874623f4888df51784eb4a7e0104","head":{"label":"sfgeorge:feature/ruleref-nesting","ref":"feature/ruleref-nesting","sha":"b248294b1a7c874623f4888df51784eb4a7e0104","user":{"login":"sfgeorge","id":208529,"avatar_url":"https://avatars.githubusercontent.com/u/208529?v=3","gravatar_id":"","url":"https://api.github.com/users/sfgeorge","html_url":"https://github.com/sfgeorge","followers_url":"https://api.github.com/users/sfgeorge/followers","following_url":"https://api.github.com/users/sfgeorge/following{/other_user}","gists_url":"https://api.github.com/users/sfgeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/sfgeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfgeorge/subscriptions","organizations_url":"https://api.github.com/users/sfgeorge/orgs","repos_url":"https://api.github.com/users/sfgeorge/repos","events_url":"https://api.github.com/users/sfgeorge/events{/privacy}","received_events_url":"https://api.github.com/users/sfgeorge/received_events","type":"User","site_admin":false},"repo":{"id":18302244,"name":"ruby_speech","full_name":"sfgeorge/ruby_speech","owner":{"login":"sfgeorge","id":208529,"avatar_url":"https://avatars.githubusercontent.com/u/208529?v=3","gravatar_id":"","url":"https://api.github.com/users/sfgeorge","html_url":"https://github.com/sfgeorge","followers_url":"https://api.github.com/users/sfgeorge/followers","following_url":"https://api.github.com/users/sfgeorge/following{/other_user}","gists_url":"https://api.github.com/users/sfgeorge/gists{/gist_id}","starred_url":"https://api.github.com/users/sfgeorge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfgeorge/subscriptions","organizations_url":"https://api.github.com/users/sfgeorge/orgs","repos_url":"https://api.github.com/users/sfgeorge/repos","events_url":"https://api.github.com/users/sfgeorge/events{/privacy}","received_events_url":"https://api.github.com/users/sfgeorge/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sfgeorge/ruby_speech","description":"A ruby library for TTS & ASR document preparation","fork":true,"url":"https://api.github.com/repos/sfgeorge/ruby_speech","forks_url":"https://api.github.com/repos/sfgeorge/ruby_speech/forks","keys_url":"https://api.github.com/repos/sfgeorge/ruby_speech/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sfgeorge/ruby_speech/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sfgeorge/ruby_speech/teams","hooks_url":"https://api.github.com/repos/sfgeorge/ruby_speech/hooks","issue_events_url":"https://api.github.com/repos/sfgeorge/ruby_speech/issues/events{/number}","events_url":"https://api.github.com/repos/sfgeorge/ruby_speech/events","assignees_url":"https://api.github.com/repos/sfgeorge/ruby_speech/assignees{/user}","branches_url":"https://api.github.com/repos/sfgeorge/ruby_speech/branches{/branch}","tags_url":"https://api.github.com/repos/sfgeorge/ruby_speech/tags","blobs_url":"https://api.github.com/repos/sfgeorge/ruby_speech/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sfgeorge/ruby_speech/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sfgeorge/ruby_speech/git/refs{/sha}","trees_url":"https://api.github.com/repos/sfgeorge/ruby_speech/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sfgeorge/ruby_speech/statuses/{sha}","languages_url":"https://api.github.com/repos/sfgeorge/ruby_speech/languages","stargazers_url":"https://api.github.com/repos/sfgeorge/ruby_speech/stargazers","contributors_url":"https://api.github.com/repos/sfgeorge/ruby_speech/contributors","subscribers_url":"https://api.github.com/repos/sfgeorge/ruby_speech/subscribers","subscription_url":"https://api.github.com/repos/sfgeorge/ruby_speech/subscription","commits_url":"https://api.github.com/repos/sfgeorge/ruby_speech/commits{/sha}","git_commits_url":"https://api.github.com/repos/sfgeorge/ruby_speech/git/commits{/sha}","comments_url":"https://api.github.com/repos/sfgeorge/ruby_speech/comments{/number}","issue_comment_url":"https://api.github.com/repos/sfgeorge/ruby_speech/issues/comments{/number}","contents_url":"https://api.github.com/repos/sfgeorge/ruby_speech/contents/{+path}","compare_url":"https://api.github.com/repos/sfgeorge/ruby_speech/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sfgeorge/ruby_speech/merges","archive_url":"https://api.github.com/repos/sfgeorge/ruby_speech/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sfgeorge/ruby_speech/downloads","issues_url":"https://api.github.com/repos/sfgeorge/ruby_speech/issues{/number}","pulls_url":"https://api.github.com/repos/sfgeorge/ruby_speech/pulls{/number}","milestones_url":"https://api.github.com/repos/sfgeorge/ruby_speech/milestones{/number}","notifications_url":"https://api.github.com/repos/sfgeorge/ruby_speech/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sfgeorge/ruby_speech/labels{/name}","releases_url":"https://api.github.com/repos/sfgeorge/ruby_speech/releases{/id}","created_at":"2014-03-31T17:48:13Z","updated_at":"2014-04-01T15:59:52Z","pushed_at":"2015-10-29T22:17:58Z","git_url":"git://github.com/sfgeorge/ruby_speech.git","ssh_url":"git@github.com:sfgeorge/ruby_speech.git","clone_url":"https://github.com/sfgeorge/ruby_speech.git","svn_url":"https://github.com/sfgeorge/ruby_speech","homepage":"","size":788,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"develop"}},"base":{"label":"benlangfeld:develop","ref":"develop","sha":"303f90fcbb87dd235fb3a49ffa0c197cf8451eac","user":{"login":"benlangfeld","id":210221,"avatar_url":"https://avatars.githubusercontent.com/u/210221?v=3","gravatar_id":"","url":"https://api.github.com/users/benlangfeld","html_url":"https://github.com/benlangfeld","followers_url":"https://api.github.com/users/benlangfeld/followers","following_url":"https://api.github.com/users/benlangfeld/following{/other_user}","gists_url":"https://api.github.com/users/benlangfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/benlangfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benlangfeld/subscriptions","organizations_url":"https://api.github.com/users/benlangfeld/orgs","repos_url":"https://api.github.com/users/benlangfeld/repos","events_url":"https://api.github.com/users/benlangfeld/events{/privacy}","received_events_url":"https://api.github.com/users/benlangfeld/received_events","type":"User","site_admin":false},"repo":{"id":1915064,"name":"ruby_speech","full_name":"benlangfeld/ruby_speech","owner":{"login":"benlangfeld","id":210221,"avatar_url":"https://avatars.githubusercontent.com/u/210221?v=3","gravatar_id":"","url":"https://api.github.com/users/benlangfeld","html_url":"https://github.com/benlangfeld","followers_url":"https://api.github.com/users/benlangfeld/followers","following_url":"https://api.github.com/users/benlangfeld/following{/other_user}","gists_url":"https://api.github.com/users/benlangfeld/gists{/gist_id}","starred_url":"https://api.github.com/users/benlangfeld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benlangfeld/subscriptions","organizations_url":"https://api.github.com/users/benlangfeld/orgs","repos_url":"https://api.github.com/users/benlangfeld/repos","events_url":"https://api.github.com/users/benlangfeld/events{/privacy}","received_events_url":"https://api.github.com/users/benlangfeld/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/benlangfeld/ruby_speech","description":"A ruby library for TTS & ASR document preparation","fork":false,"url":"https://api.github.com/repos/benlangfeld/ruby_speech","forks_url":"https://api.github.com/repos/benlangfeld/ruby_speech/forks","keys_url":"https://api.github.com/repos/benlangfeld/ruby_speech/keys{/key_id}","collaborators_url":"https://api.github.com/repos/benlangfeld/ruby_speech/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/benlangfeld/ruby_speech/teams","hooks_url":"https://api.github.com/repos/benlangfeld/ruby_speech/hooks","issue_events_url":"https://api.github.com/repos/benlangfeld/ruby_speech/issues/events{/number}","events_url":"https://api.github.com/repos/benlangfeld/ruby_speech/events","assignees_url":"https://api.github.com/repos/benlangfeld/ruby_speech/assignees{/user}","branches_url":"https://api.github.com/repos/benlangfeld/ruby_speech/branches{/branch}","tags_url":"https://api.github.com/repos/benlangfeld/ruby_speech/tags","blobs_url":"https://api.github.com/repos/benlangfeld/ruby_speech/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/benlangfeld/ruby_speech/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/benlangfeld/ruby_speech/git/refs{/sha}","trees_url":"https://api.github.com/repos/benlangfeld/ruby_speech/git/trees{/sha}","statuses_url":"https://api.github.com/repos/benlangfeld/ruby_speech/statuses/{sha}","languages_url":"https://api.github.com/repos/benlangfeld/ruby_speech/languages","stargazers_url":"https://api.github.com/repos/benlangfeld/ruby_speech/stargazers","contributors_url":"https://api.github.com/repos/benlangfeld/ruby_speech/contributors","subscribers_url":"https://api.github.com/repos/benlangfeld/ruby_speech/subscribers","subscription_url":"https://api.github.com/repos/benlangfeld/ruby_speech/subscription","commits_url":"https://api.github.com/repos/benlangfeld/ruby_speech/commits{/sha}","git_commits_url":"https://api.github.com/repos/benlangfeld/ruby_speech/git/commits{/sha}","comments_url":"https://api.github.com/repos/benlangfeld/ruby_speech/comments{/number}","issue_comment_url":"https://api.github.com/repos/benlangfeld/ruby_speech/issues/comments{/number}","contents_url":"https://api.github.com/repos/benlangfeld/ruby_speech/contents/{+path}","compare_url":"https://api.github.com/repos/benlangfeld/ruby_speech/compare/{base}...{head}","merges_url":"https://api.github.com/repos/benlangfeld/ruby_speech/merges","archive_url":"https://api.github.com/repos/benlangfeld/ruby_speech/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/benlangfeld/ruby_speech/downloads","issues_url":"https://api.github.com/repos/benlangfeld/ruby_speech/issues{/number}","pulls_url":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls{/number}","milestones_url":"https://api.github.com/repos/benlangfeld/ruby_speech/milestones{/number}","notifications_url":"https://api.github.com/repos/benlangfeld/ruby_speech/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/benlangfeld/ruby_speech/labels{/name}","releases_url":"https://api.github.com/repos/benlangfeld/ruby_speech/releases{/id}","created_at":"2011-06-18T09:19:59Z","updated_at":"2015-10-22T08:38:50Z","pushed_at":"2015-10-29T22:17:59Z","git_url":"git://github.com/benlangfeld/ruby_speech.git","ssh_url":"git@github.com:benlangfeld/ruby_speech.git","clone_url":"https://github.com/benlangfeld/ruby_speech.git","svn_url":"https://github.com/benlangfeld/ruby_speech","homepage":"","size":1854,"stargazers_count":66,"watchers_count":66,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":12,"forks":17,"open_issues":12,"watchers":66,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls/34"},"html":{"href":"https://github.com/benlangfeld/ruby_speech/pull/34"},"issue":{"href":"https://api.github.com/repos/benlangfeld/ruby_speech/issues/34"},"comments":{"href":"https://api.github.com/repos/benlangfeld/ruby_speech/issues/34/comments"},"review_comments":{"href":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls/34/comments"},"review_comment":{"href":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/benlangfeld/ruby_speech/pulls/34/commits"},"statuses":{"href":"https://api.github.com/repos/benlangfeld/ruby_speech/statuses/b248294b1a7c874623f4888df51784eb4a7e0104"}}}}