{"action":"created","comment":{"url":"https://api.github.com/repos/Alexey-Girin/homework/pulls/comments/93701891","pull_request_review_id":14235794,"id":93701891,"diff_hunk":"@@ -0,0 +1,213 @@\n+#include <iostream>\n+#include <string>\n+#include \"stack.h\"\n+\n+using namespace std;\n+\n+bool isOperand(char &sign)\n+{\n+\tif (sign >= '0' && sign <= '9')\n+\t{\n+\t\treturn true;\n+\t}\n+\treturn false;\n+}\n+\n+bool isOperator(char &sign)\n+{\n+\tif (sign == '+' || sign == '-' || sign == '*' || sign == '/')\n+\t{\n+\t\treturn true;\n+\t}\n+\treturn false;\n+}\n+\n+bool isCorrectInfix(string infix)\n+{\n+\tinfix = \"+\" + infix + \"+\";\n+\tint bracketBalance = 0;\n+\tint infixSize = infix.size();\n+\tfor (int i = 1; i < infixSize - 1; i++)\n+\t{\n+\t\tif (isOperator(infix[i]) && \n+\t\t\t!isOperator(infix[i - 1]) && \n+\t\t\t!isOperator(infix[i+1]))\n+\t\t{\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (infix[i] == '(' && \n+\t\t\t(isOperand(infix[i + 1]) || infix[i + 1] == '(') && \n+\t\t\t(isOperator(infix[i - 1]) || infix[i - 1] == '('))\n+\t\t{\n+\t\t\tbracketBalance++;\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (infix[i] == ')' &&\n+\t\t\t(isOperand(infix[i - 1]) || infix[i - 1] == ')') &&\n+\t\t\t(isOperator(infix[i + 1]) || infix[i + 1] == ')'))\n+\t\t{\n+\t\t\tif (bracketBalance == 0)\n+\t\t\t{\n+\t\t\t\treturn false;\n+\t\t\t}\n+\t\t\tbracketBalance--;\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (!isOperand(infix[i]))\n+\t\t{\n+\t\t\treturn false;\n+\t\t}\n+\t}\n+\tif (bracketBalance == 0)\n+\t{\n+\t\treturn true;\n+\t}\n+\treturn false;\n+}\n+\n+bool isPrecedenceOverTopStack(char &firstSign, char &secondSign)\n+{\n+\tif (secondSign == '(')\n+\t{\n+\t\treturn true;\n+\t}\n+\tif (firstSign == '+' || firstSign == '-')\n+\t{\n+\t\treturn false;\n+\t}\n+\tif ((firstSign == '*' || firstSign == '/') &&\n+\t\t(secondSign == '*' || secondSign == '/'))\n+\t{\n+\t\treturn false;\n+\t}\n+\treturn true;\n+}\n+\n+void pushOperator(Stack *&stack, string &postfix, char &sign)\n+{\n+\tif (isEmpty(stack))\n+\t{\n+\t\tpush(stack, sign);\n+\t\treturn;\n+\t}\n+\tchar topStackSign = peek(stack);\n+\twhile (!isPrecedenceOverTopStack(sign, topStackSign))\n+\t{\n+\t\tpostfix += topStackSign;\n+\t\tpop(stack);\n+\t\tif (isEmpty(stack))\n+\t\t{\n+\t\t\tbreak;\n+\t\t}\n+\t\ttopStackSign = peek(stack);\n+\t}\n+\tpush(stack, sign);\n+}\n+\n+void popBeforeBracket(Stack *&stack, string &postfix)\n+{\n+\tchar topStackSign = peek(stack);\n+\twhile (topStackSign != '(')\n+\t{\n+\t\tpostfix += topStackSign;\n+\t\tpop(stack);\n+\t\ttopStackSign = peek(stack);\n+\t}\n+\tpop(stack);\n+}\n+\n+string shuntingYard(Stack *&stack, string infix)\n+{\n+\tstring postfix = \"\";\n+\tint infixSize = infix.size();\n+\tfor (int i = 0; i < infixSize; i++)\n+\t{\n+\t\tchar sign = infix[i];\n+\t\tif (isOperand(sign))\n+\t\t{\n+\t\t\tpostfix += sign;\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (isOperator(sign))\n+\t\t{\n+\t\t\tpushOperator(stack, postfix, sign);\n+\t\t\tcontinue;\n+\t\t} \n+\t\tif (sign == '(')\n+\t\t{ \n+\t\t\tpush(stack, sign);\n+\t\t\tcontinue;\n+\t\t}\n+\t\tif (sign == ')')\n+\t\t{\n+\t\t\tpopBeforeBracket(stack, postfix);\n+\t\t\tcontinue;\n+\t\t}\n+\t}\n+\tstring remainder = stackRemainder(stack);\n+\treturn postfix + remainder;\n+}\n+\n+bool test(string &infix, string &resultTrue)\n+{\n+\tif (!isCorrectInfix(infix) && resultTrue == \"������ �����\")\n+\t{\n+\t\treturn true;\n+\t}\n+\tStack *stack = createStack();\n+\tstring resultTest = shuntingYard(stack, infix);\n+\tdeleteStack(stack);\n+\treturn resultTest == resultTrue;\n+}\n+bool test1()","path":"homework_6/6.3/Source.cpp","position":162,"original_position":162,"commit_id":"995e5733b9a599a149476f75caba886547daffd0","original_commit_id":"995e5733b9a599a149476f75caba886547daffd0","user":{"login":"yurii-litvinov","id":706768,"avatar_url":"https://avatars.githubusercontent.com/u/706768?v=3","gravatar_id":"","url":"https://api.github.com/users/yurii-litvinov","html_url":"https://github.com/yurii-litvinov","followers_url":"https://api.github.com/users/yurii-litvinov/followers","following_url":"https://api.github.com/users/yurii-litvinov/following{/other_user}","gists_url":"https://api.github.com/users/yurii-litvinov/gists{/gist_id}","starred_url":"https://api.github.com/users/yurii-litvinov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yurii-litvinov/subscriptions","organizations_url":"https://api.github.com/users/yurii-litvinov/orgs","repos_url":"https://api.github.com/users/yurii-litvinov/repos","events_url":"https://api.github.com/users/yurii-litvinov/events{/privacy}","received_events_url":"https://api.github.com/users/yurii-litvinov/received_events","type":"User","site_admin":false},"body":"Надо пустую строчку между функциями","created_at":"2016-12-22T21:49:13Z","updated_at":"2016-12-22T21:50:15Z","html_url":"https://github.com/Alexey-Girin/homework/pull/5#discussion_r93701891","pull_request_url":"https://api.github.com/repos/Alexey-Girin/homework/pulls/5","_links":{"self":{"href":"https://api.github.com/repos/Alexey-Girin/homework/pulls/comments/93701891"},"html":{"href":"https://github.com/Alexey-Girin/homework/pull/5#discussion_r93701891"},"pull_request":{"href":"https://api.github.com/repos/Alexey-Girin/homework/pulls/5"}}},"pull_request":{"url":"https://api.github.com/repos/Alexey-Girin/homework/pulls/5","id":92104464,"html_url":"https://github.com/Alexey-Girin/homework/pull/5","diff_url":"https://github.com/Alexey-Girin/homework/pull/5.diff","patch_url":"https://github.com/Alexey-Girin/homework/pull/5.patch","issue_url":"https://api.github.com/repos/Alexey-Girin/homework/issues/5","number":5,"state":"open","locked":false,"title":"Homework 6.3","user":{"login":"Alexey-Girin","id":23011731,"avatar_url":"https://avatars.githubusercontent.com/u/23011731?v=3","gravatar_id":"","url":"https://api.github.com/users/Alexey-Girin","html_url":"https://github.com/Alexey-Girin","followers_url":"https://api.github.com/users/Alexey-Girin/followers","following_url":"https://api.github.com/users/Alexey-Girin/following{/other_user}","gists_url":"https://api.github.com/users/Alexey-Girin/gists{/gist_id}","starred_url":"https://api.github.com/users/Alexey-Girin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alexey-Girin/subscriptions","organizations_url":"https://api.github.com/users/Alexey-Girin/orgs","repos_url":"https://api.github.com/users/Alexey-Girin/repos","events_url":"https://api.github.com/users/Alexey-Girin/events{/privacy}","received_events_url":"https://api.github.com/users/Alexey-Girin/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-03T07:08:26Z","updated_at":"2016-12-22T21:50:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"57d345f0a01bd9d6a665cfaf18a49d5785791b76","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Alexey-Girin/homework/pulls/5/commits","review_comments_url":"https://api.github.com/repos/Alexey-Girin/homework/pulls/5/comments","review_comment_url":"https://api.github.com/repos/Alexey-Girin/homework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Alexey-Girin/homework/issues/5/comments","statuses_url":"https://api.github.com/repos/Alexey-Girin/homework/statuses/995e5733b9a599a149476f75caba886547daffd0","head":{"label":"Alexey-Girin:homework-6.3","ref":"homework-6.3","sha":"995e5733b9a599a149476f75caba886547daffd0","user":{"login":"Alexey-Girin","id":23011731,"avatar_url":"https://avatars.githubusercontent.com/u/23011731?v=3","gravatar_id":"","url":"https://api.github.com/users/Alexey-Girin","html_url":"https://github.com/Alexey-Girin","followers_url":"https://api.github.com/users/Alexey-Girin/followers","following_url":"https://api.github.com/users/Alexey-Girin/following{/other_user}","gists_url":"https://api.github.com/users/Alexey-Girin/gists{/gist_id}","starred_url":"https://api.github.com/users/Alexey-Girin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alexey-Girin/subscriptions","organizations_url":"https://api.github.com/users/Alexey-Girin/orgs","repos_url":"https://api.github.com/users/Alexey-Girin/repos","events_url":"https://api.github.com/users/Alexey-Girin/events{/privacy}","received_events_url":"https://api.github.com/users/Alexey-Girin/received_events","type":"User","site_admin":false},"repo":{"id":72298505,"name":"homework","full_name":"Alexey-Girin/homework","owner":{"login":"Alexey-Girin","id":23011731,"avatar_url":"https://avatars.githubusercontent.com/u/23011731?v=3","gravatar_id":"","url":"https://api.github.com/users/Alexey-Girin","html_url":"https://github.com/Alexey-Girin","followers_url":"https://api.github.com/users/Alexey-Girin/followers","following_url":"https://api.github.com/users/Alexey-Girin/following{/other_user}","gists_url":"https://api.github.com/users/Alexey-Girin/gists{/gist_id}","starred_url":"https://api.github.com/users/Alexey-Girin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alexey-Girin/subscriptions","organizations_url":"https://api.github.com/users/Alexey-Girin/orgs","repos_url":"https://api.github.com/users/Alexey-Girin/repos","events_url":"https://api.github.com/users/Alexey-Girin/events{/privacy}","received_events_url":"https://api.github.com/users/Alexey-Girin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Alexey-Girin/homework","description":null,"fork":false,"url":"https://api.github.com/repos/Alexey-Girin/homework","forks_url":"https://api.github.com/repos/Alexey-Girin/homework/forks","keys_url":"https://api.github.com/repos/Alexey-Girin/homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Alexey-Girin/homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Alexey-Girin/homework/teams","hooks_url":"https://api.github.com/repos/Alexey-Girin/homework/hooks","issue_events_url":"https://api.github.com/repos/Alexey-Girin/homework/issues/events{/number}","events_url":"https://api.github.com/repos/Alexey-Girin/homework/events","assignees_url":"https://api.github.com/repos/Alexey-Girin/homework/assignees{/user}","branches_url":"https://api.github.com/repos/Alexey-Girin/homework/branches{/branch}","tags_url":"https://api.github.com/repos/Alexey-Girin/homework/tags","blobs_url":"https://api.github.com/repos/Alexey-Girin/homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Alexey-Girin/homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Alexey-Girin/homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/Alexey-Girin/homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Alexey-Girin/homework/statuses/{sha}","languages_url":"https://api.github.com/repos/Alexey-Girin/homework/languages","stargazers_url":"https://api.github.com/repos/Alexey-Girin/homework/stargazers","contributors_url":"https://api.github.com/repos/Alexey-Girin/homework/contributors","subscribers_url":"https://api.github.com/repos/Alexey-Girin/homework/subscribers","subscription_url":"https://api.github.com/repos/Alexey-Girin/homework/subscription","commits_url":"https://api.github.com/repos/Alexey-Girin/homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/Alexey-Girin/homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/Alexey-Girin/homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/Alexey-Girin/homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/Alexey-Girin/homework/contents/{+path}","compare_url":"https://api.github.com/repos/Alexey-Girin/homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Alexey-Girin/homework/merges","archive_url":"https://api.github.com/repos/Alexey-Girin/homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Alexey-Girin/homework/downloads","issues_url":"https://api.github.com/repos/Alexey-Girin/homework/issues{/number}","pulls_url":"https://api.github.com/repos/Alexey-Girin/homework/pulls{/number}","milestones_url":"https://api.github.com/repos/Alexey-Girin/homework/milestones{/number}","notifications_url":"https://api.github.com/repos/Alexey-Girin/homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Alexey-Girin/homework/labels{/name}","releases_url":"https://api.github.com/repos/Alexey-Girin/homework/releases{/id}","deployments_url":"https://api.github.com/repos/Alexey-Girin/homework/deployments","created_at":"2016-10-29T17:09:55Z","updated_at":"2016-12-03T11:57:36Z","pushed_at":"2016-12-22T21:47:32Z","git_url":"git://github.com/Alexey-Girin/homework.git","ssh_url":"git@github.com:Alexey-Girin/homework.git","clone_url":"https://github.com/Alexey-Girin/homework.git","svn_url":"https://github.com/Alexey-Girin/homework","homepage":null,"size":85,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"base":{"label":"Alexey-Girin:master","ref":"master","sha":"c227f66753649bc32edf7daebc9175fdf8ed2347","user":{"login":"Alexey-Girin","id":23011731,"avatar_url":"https://avatars.githubusercontent.com/u/23011731?v=3","gravatar_id":"","url":"https://api.github.com/users/Alexey-Girin","html_url":"https://github.com/Alexey-Girin","followers_url":"https://api.github.com/users/Alexey-Girin/followers","following_url":"https://api.github.com/users/Alexey-Girin/following{/other_user}","gists_url":"https://api.github.com/users/Alexey-Girin/gists{/gist_id}","starred_url":"https://api.github.com/users/Alexey-Girin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alexey-Girin/subscriptions","organizations_url":"https://api.github.com/users/Alexey-Girin/orgs","repos_url":"https://api.github.com/users/Alexey-Girin/repos","events_url":"https://api.github.com/users/Alexey-Girin/events{/privacy}","received_events_url":"https://api.github.com/users/Alexey-Girin/received_events","type":"User","site_admin":false},"repo":{"id":72298505,"name":"homework","full_name":"Alexey-Girin/homework","owner":{"login":"Alexey-Girin","id":23011731,"avatar_url":"https://avatars.githubusercontent.com/u/23011731?v=3","gravatar_id":"","url":"https://api.github.com/users/Alexey-Girin","html_url":"https://github.com/Alexey-Girin","followers_url":"https://api.github.com/users/Alexey-Girin/followers","following_url":"https://api.github.com/users/Alexey-Girin/following{/other_user}","gists_url":"https://api.github.com/users/Alexey-Girin/gists{/gist_id}","starred_url":"https://api.github.com/users/Alexey-Girin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alexey-Girin/subscriptions","organizations_url":"https://api.github.com/users/Alexey-Girin/orgs","repos_url":"https://api.github.com/users/Alexey-Girin/repos","events_url":"https://api.github.com/users/Alexey-Girin/events{/privacy}","received_events_url":"https://api.github.com/users/Alexey-Girin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Alexey-Girin/homework","description":null,"fork":false,"url":"https://api.github.com/repos/Alexey-Girin/homework","forks_url":"https://api.github.com/repos/Alexey-Girin/homework/forks","keys_url":"https://api.github.com/repos/Alexey-Girin/homework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Alexey-Girin/homework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Alexey-Girin/homework/teams","hooks_url":"https://api.github.com/repos/Alexey-Girin/homework/hooks","issue_events_url":"https://api.github.com/repos/Alexey-Girin/homework/issues/events{/number}","events_url":"https://api.github.com/repos/Alexey-Girin/homework/events","assignees_url":"https://api.github.com/repos/Alexey-Girin/homework/assignees{/user}","branches_url":"https://api.github.com/repos/Alexey-Girin/homework/branches{/branch}","tags_url":"https://api.github.com/repos/Alexey-Girin/homework/tags","blobs_url":"https://api.github.com/repos/Alexey-Girin/homework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Alexey-Girin/homework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Alexey-Girin/homework/git/refs{/sha}","trees_url":"https://api.github.com/repos/Alexey-Girin/homework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Alexey-Girin/homework/statuses/{sha}","languages_url":"https://api.github.com/repos/Alexey-Girin/homework/languages","stargazers_url":"https://api.github.com/repos/Alexey-Girin/homework/stargazers","contributors_url":"https://api.github.com/repos/Alexey-Girin/homework/contributors","subscribers_url":"https://api.github.com/repos/Alexey-Girin/homework/subscribers","subscription_url":"https://api.github.com/repos/Alexey-Girin/homework/subscription","commits_url":"https://api.github.com/repos/Alexey-Girin/homework/commits{/sha}","git_commits_url":"https://api.github.com/repos/Alexey-Girin/homework/git/commits{/sha}","comments_url":"https://api.github.com/repos/Alexey-Girin/homework/comments{/number}","issue_comment_url":"https://api.github.com/repos/Alexey-Girin/homework/issues/comments{/number}","contents_url":"https://api.github.com/repos/Alexey-Girin/homework/contents/{+path}","compare_url":"https://api.github.com/repos/Alexey-Girin/homework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Alexey-Girin/homework/merges","archive_url":"https://api.github.com/repos/Alexey-Girin/homework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Alexey-Girin/homework/downloads","issues_url":"https://api.github.com/repos/Alexey-Girin/homework/issues{/number}","pulls_url":"https://api.github.com/repos/Alexey-Girin/homework/pulls{/number}","milestones_url":"https://api.github.com/repos/Alexey-Girin/homework/milestones{/number}","notifications_url":"https://api.github.com/repos/Alexey-Girin/homework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Alexey-Girin/homework/labels{/name}","releases_url":"https://api.github.com/repos/Alexey-Girin/homework/releases{/id}","deployments_url":"https://api.github.com/repos/Alexey-Girin/homework/deployments","created_at":"2016-10-29T17:09:55Z","updated_at":"2016-12-03T11:57:36Z","pushed_at":"2016-12-22T21:47:32Z","git_url":"git://github.com/Alexey-Girin/homework.git","ssh_url":"git@github.com:Alexey-Girin/homework.git","clone_url":"https://github.com/Alexey-Girin/homework.git","svn_url":"https://github.com/Alexey-Girin/homework","homepage":null,"size":85,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Alexey-Girin/homework/pulls/5"},"html":{"href":"https://github.com/Alexey-Girin/homework/pull/5"},"issue":{"href":"https://api.github.com/repos/Alexey-Girin/homework/issues/5"},"comments":{"href":"https://api.github.com/repos/Alexey-Girin/homework/issues/5/comments"},"review_comments":{"href":"https://api.github.com/repos/Alexey-Girin/homework/pulls/5/comments"},"review_comment":{"href":"https://api.github.com/repos/Alexey-Girin/homework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Alexey-Girin/homework/pulls/5/commits"},"statuses":{"href":"https://api.github.com/repos/Alexey-Girin/homework/statuses/995e5733b9a599a149476f75caba886547daffd0"}}}}
{"actor":{"display_login":"yurii-litvinov"}}