{"action":"created","comment":{"url":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls/comments/85756847","pull_request_review_id":6450944,"id":85756847,"diff_hunk":"@@ -4038,106 +4023,257 @@ function _checkUnicodeWildcard(i) {\n }\n \n /**\n- * Check if token is part of URI (e.g. `url('/css/styles.css')`)\n- * @param {Number} i Token's index number\n- * @returns {Number} Length of URI\n+ * Check if token is part of URI, e.g. `url('/css/styles.css')`\n+ * @param {number} i Token's index number\n+ * @returns {number} Length of URI\n  */\n function checkUri(i) {\n-  var start = i;\n+  const start = i;\n \n-  if (i >= tokensLength || tokens[i++].value !== 'url' ||\n-      i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis)\n-      return 0;\n+  if (i >= tokensLength || tokens[i].value !== 'url') return 0;\n \n-  return tokens[i].right - start + 1;\n+  // Skip url\n+  i++;\n+\n+  if (i >= tokensLength || tokens[i].type !== TokenType.LeftParenthesis)\n+    return 0;\n+\n+  // Store the opening parenthesis token as we will reference it's `right`\n+  // property to determine when the parentheses close\n+  const leftParenthesis = tokens[i];\n+\n+  // Skip (\n+  i++;\n+\n+  // Determine the type of URI\n+  if (checkUri1(i)) tokens[start].uriType = 1; // Raw based URI\n+  else if (checkUri2(i)) tokens[start].uriType = 2; // Non-raw based URI\n+  else return 0;\n+\n+  return leftParenthesis.right - start;\n }\n \n /**\n- * Get node with URI\n- * @returns {Array} `['uri', x]` where `x` is URI's nodes (without `url`\n- *      and braces, e.g. `['string', ''/css/styles.css'']`).\n+ * Get specific type of URI node\n+ * @returns {Node|number} Specific type of URI node\n  */\n function getUri() {\n-  let startPos = pos;\n-  let uriExcluding = {};\n-  let uri;\n-  let token;\n+  const uriType = tokens[pos].uriType;\n+\n+  if (uriType === 1) return getUri1();\n+  else if (uriType === 2) return getUri2();\n+  else return 0;\n+}\n+\n+/**\n+ * Check if token type is valid URI character\n+ * @param {number} i Token's index number\n+ * @returns {number} Whether or not token is valid\n+ */\n+function _checkUriRawCharacters(i) {\n+  switch (tokens[i].type) {\n+    case TokenType.ExclamationMark:\n+    case TokenType.QuotationMark:\n+    case TokenType.NumberSign:\n+    case TokenType.DollarSign:\n+    case TokenType.PercentSign:\n+    case TokenType.Ampersand:\n+    case TokenType.Apostrophe:\n+    case TokenType.Asterisk:\n+    case TokenType.PlusSign:\n+    case TokenType.Comma:\n+    case TokenType.HyphenMinus:\n+    case TokenType.FullStop:\n+    case TokenType.Solidus:\n+    case TokenType.Colon:\n+    case TokenType.Semicolon:\n+    case TokenType.EqualsSign:\n+    case TokenType.QuestionMark:\n+    case TokenType.CommercialAt:\n+    case TokenType.LeftSquareBracket:\n+    case TokenType.RightSquareBracket:\n+    case TokenType.LowLine:\n+    case TokenType.Tilde:\n+      return 1;\n+\n+    default:\n+      return 0;\n+  }\n+}\n+\n+/**\n+ * Check if content of URI can be contained within a raw node\n+ * @param {number} i Token's index number\n+ * @returns {number} Length of raw node\n+ */\n+function checkUriRaw(i) {\n+  const start = i;\n   let l;\n-  let raw;\n \n-  pos += 2;\n+  while (i < tokensLength) {\n+    if (checkInterpolation(i)) break;\n \n-  uriExcluding[TokenType.Space] = 1;\n-  uriExcluding[TokenType.Tab] = 1;\n-  uriExcluding[TokenType.Newline] = 1;\n-  uriExcluding[TokenType.LeftParenthesis] = 1;\n-  uriExcluding[TokenType.RightParenthesis] = 1;\n-\n-  if (checkUriContent(pos)) {\n-    uri = []\n-        .concat(getSC())\n-        .concat(getUriContent())\n-        .concat(getSC());\n-  } else {\n-    uri = [].concat(getSC());\n-    l = checkExcluding(uriExcluding, pos);\n-    token = tokens[pos];\n-    raw = newNode(NodeType.RawType, joinValues(pos, pos + l), token.ln,\n-        token.col);\n+    if (l = checkIdent(i)) i += l;\n+    else if (l = checkNumber(i)) i += l;\n+    else if (l = _checkUriRawCharacters(i)) i += l;\n+    // As comments are not allowed within the uri token, include as part of node\n+    else if (l = checkCommentML(i)) i += l;\n+    else break;\n+  }\n \n-    uri.push(raw);\n+  return i - start;","path":"src/scss/parse.js","position":159,"original_position":159,"commit_id":"0feda83ba7941f048b5271ac19fad78e6e3421a1","original_commit_id":"0feda83ba7941f048b5271ac19fad78e6e3421a1","user":{"login":"tonyganch","id":872004,"avatar_url":"https://avatars.githubusercontent.com/u/872004?v=3","gravatar_id":"","url":"https://api.github.com/users/tonyganch","html_url":"https://github.com/tonyganch","followers_url":"https://api.github.com/users/tonyganch/followers","following_url":"https://api.github.com/users/tonyganch/following{/other_user}","gists_url":"https://api.github.com/users/tonyganch/gists{/gist_id}","starred_url":"https://api.github.com/users/tonyganch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonyganch/subscriptions","organizations_url":"https://api.github.com/users/tonyganch/orgs","repos_url":"https://api.github.com/users/tonyganch/repos","events_url":"https://api.github.com/users/tonyganch/events{/privacy}","received_events_url":"https://api.github.com/users/tonyganch/received_events","type":"User","site_admin":false},"body":"You can store position of final token as `uri_end`, for example, in which case `getUriRaw` will not need to loop through characters again to find it.","created_at":"2016-10-31T15:03:15Z","updated_at":"2016-10-31T15:40:56Z","html_url":"https://github.com/tonyganch/gonzales-pe/pull/217#discussion_r85756847","pull_request_url":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls/217","_links":{"self":{"href":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls/comments/85756847"},"html":{"href":"https://github.com/tonyganch/gonzales-pe/pull/217#discussion_r85756847"},"pull_request":{"href":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls/217"}}},"pull_request":{"url":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls/217","id":82080436,"html_url":"https://github.com/tonyganch/gonzales-pe/pull/217","diff_url":"https://github.com/tonyganch/gonzales-pe/pull/217.diff","patch_url":"https://github.com/tonyganch/gonzales-pe/pull/217.patch","issue_url":"https://api.github.com/repos/tonyganch/gonzales-pe/issues/217","number":217,"state":"open","locked":false,"title":"[SCSS] Fixes issues with URIs when handling interp and unary ","user":{"login":"bgriffith","id":2854338,"avatar_url":"https://avatars.githubusercontent.com/u/2854338?v=3","gravatar_id":"","url":"https://api.github.com/users/bgriffith","html_url":"https://github.com/bgriffith","followers_url":"https://api.github.com/users/bgriffith/followers","following_url":"https://api.github.com/users/bgriffith/following{/other_user}","gists_url":"https://api.github.com/users/bgriffith/gists{/gist_id}","starred_url":"https://api.github.com/users/bgriffith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgriffith/subscriptions","organizations_url":"https://api.github.com/users/bgriffith/orgs","repos_url":"https://api.github.com/users/bgriffith/repos","events_url":"https://api.github.com/users/bgriffith/events{/privacy}","received_events_url":"https://api.github.com/users/bgriffith/received_events","type":"User","site_admin":false},"body":"This PR rewrites the way we handle URI nodes by allowing either a raw uri or non-raw uri that can be made up of multiple nodes (interps, numbers, idents, unary etc)\n\nIt solves issues highlighted in #85 \n\nOnly implement in SCSS but if approved I'll add it into Sass too.\n","created_at":"2016-08-20T14:49:57Z","updated_at":"2016-10-31T15:40:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b1025297ad5cd5829e126f8919b5601a91c824d","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls/217/commits","review_comments_url":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls/217/comments","review_comment_url":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tonyganch/gonzales-pe/issues/217/comments","statuses_url":"https://api.github.com/repos/tonyganch/gonzales-pe/statuses/0feda83ba7941f048b5271ac19fad78e6e3421a1","head":{"label":"bgriffith:feature/uri","ref":"feature/uri","sha":"0feda83ba7941f048b5271ac19fad78e6e3421a1","user":{"login":"bgriffith","id":2854338,"avatar_url":"https://avatars.githubusercontent.com/u/2854338?v=3","gravatar_id":"","url":"https://api.github.com/users/bgriffith","html_url":"https://github.com/bgriffith","followers_url":"https://api.github.com/users/bgriffith/followers","following_url":"https://api.github.com/users/bgriffith/following{/other_user}","gists_url":"https://api.github.com/users/bgriffith/gists{/gist_id}","starred_url":"https://api.github.com/users/bgriffith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgriffith/subscriptions","organizations_url":"https://api.github.com/users/bgriffith/orgs","repos_url":"https://api.github.com/users/bgriffith/repos","events_url":"https://api.github.com/users/bgriffith/events{/privacy}","received_events_url":"https://api.github.com/users/bgriffith/received_events","type":"User","site_admin":false},"repo":{"id":43920360,"name":"gonzales-pe","full_name":"bgriffith/gonzales-pe","owner":{"login":"bgriffith","id":2854338,"avatar_url":"https://avatars.githubusercontent.com/u/2854338?v=3","gravatar_id":"","url":"https://api.github.com/users/bgriffith","html_url":"https://github.com/bgriffith","followers_url":"https://api.github.com/users/bgriffith/followers","following_url":"https://api.github.com/users/bgriffith/following{/other_user}","gists_url":"https://api.github.com/users/bgriffith/gists{/gist_id}","starred_url":"https://api.github.com/users/bgriffith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgriffith/subscriptions","organizations_url":"https://api.github.com/users/bgriffith/orgs","repos_url":"https://api.github.com/users/bgriffith/repos","events_url":"https://api.github.com/users/bgriffith/events{/privacy}","received_events_url":"https://api.github.com/users/bgriffith/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bgriffith/gonzales-pe","description":"CSS parser with support of preprocessors","fork":true,"url":"https://api.github.com/repos/bgriffith/gonzales-pe","forks_url":"https://api.github.com/repos/bgriffith/gonzales-pe/forks","keys_url":"https://api.github.com/repos/bgriffith/gonzales-pe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bgriffith/gonzales-pe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bgriffith/gonzales-pe/teams","hooks_url":"https://api.github.com/repos/bgriffith/gonzales-pe/hooks","issue_events_url":"https://api.github.com/repos/bgriffith/gonzales-pe/issues/events{/number}","events_url":"https://api.github.com/repos/bgriffith/gonzales-pe/events","assignees_url":"https://api.github.com/repos/bgriffith/gonzales-pe/assignees{/user}","branches_url":"https://api.github.com/repos/bgriffith/gonzales-pe/branches{/branch}","tags_url":"https://api.github.com/repos/bgriffith/gonzales-pe/tags","blobs_url":"https://api.github.com/repos/bgriffith/gonzales-pe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bgriffith/gonzales-pe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bgriffith/gonzales-pe/git/refs{/sha}","trees_url":"https://api.github.com/repos/bgriffith/gonzales-pe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bgriffith/gonzales-pe/statuses/{sha}","languages_url":"https://api.github.com/repos/bgriffith/gonzales-pe/languages","stargazers_url":"https://api.github.com/repos/bgriffith/gonzales-pe/stargazers","contributors_url":"https://api.github.com/repos/bgriffith/gonzales-pe/contributors","subscribers_url":"https://api.github.com/repos/bgriffith/gonzales-pe/subscribers","subscription_url":"https://api.github.com/repos/bgriffith/gonzales-pe/subscription","commits_url":"https://api.github.com/repos/bgriffith/gonzales-pe/commits{/sha}","git_commits_url":"https://api.github.com/repos/bgriffith/gonzales-pe/git/commits{/sha}","comments_url":"https://api.github.com/repos/bgriffith/gonzales-pe/comments{/number}","issue_comment_url":"https://api.github.com/repos/bgriffith/gonzales-pe/issues/comments{/number}","contents_url":"https://api.github.com/repos/bgriffith/gonzales-pe/contents/{+path}","compare_url":"https://api.github.com/repos/bgriffith/gonzales-pe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bgriffith/gonzales-pe/merges","archive_url":"https://api.github.com/repos/bgriffith/gonzales-pe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bgriffith/gonzales-pe/downloads","issues_url":"https://api.github.com/repos/bgriffith/gonzales-pe/issues{/number}","pulls_url":"https://api.github.com/repos/bgriffith/gonzales-pe/pulls{/number}","milestones_url":"https://api.github.com/repos/bgriffith/gonzales-pe/milestones{/number}","notifications_url":"https://api.github.com/repos/bgriffith/gonzales-pe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bgriffith/gonzales-pe/labels{/name}","releases_url":"https://api.github.com/repos/bgriffith/gonzales-pe/releases{/id}","deployments_url":"https://api.github.com/repos/bgriffith/gonzales-pe/deployments","created_at":"2015-10-08T22:48:50Z","updated_at":"2015-10-08T22:48:52Z","pushed_at":"2016-10-31T01:05:09Z","git_url":"git://github.com/bgriffith/gonzales-pe.git","ssh_url":"git@github.com:bgriffith/gonzales-pe.git","clone_url":"https://github.com/bgriffith/gonzales-pe.git","svn_url":"https://github.com/bgriffith/gonzales-pe","homepage":"","size":4789,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"tonyganch:dev","ref":"dev","sha":"e76eb60ee09967d1d30ed3fbd040bb57a6ea0e24","user":{"login":"tonyganch","id":872004,"avatar_url":"https://avatars.githubusercontent.com/u/872004?v=3","gravatar_id":"","url":"https://api.github.com/users/tonyganch","html_url":"https://github.com/tonyganch","followers_url":"https://api.github.com/users/tonyganch/followers","following_url":"https://api.github.com/users/tonyganch/following{/other_user}","gists_url":"https://api.github.com/users/tonyganch/gists{/gist_id}","starred_url":"https://api.github.com/users/tonyganch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonyganch/subscriptions","organizations_url":"https://api.github.com/users/tonyganch/orgs","repos_url":"https://api.github.com/users/tonyganch/repos","events_url":"https://api.github.com/users/tonyganch/events{/privacy}","received_events_url":"https://api.github.com/users/tonyganch/received_events","type":"User","site_admin":false},"repo":{"id":13370349,"name":"gonzales-pe","full_name":"tonyganch/gonzales-pe","owner":{"login":"tonyganch","id":872004,"avatar_url":"https://avatars.githubusercontent.com/u/872004?v=3","gravatar_id":"","url":"https://api.github.com/users/tonyganch","html_url":"https://github.com/tonyganch","followers_url":"https://api.github.com/users/tonyganch/followers","following_url":"https://api.github.com/users/tonyganch/following{/other_user}","gists_url":"https://api.github.com/users/tonyganch/gists{/gist_id}","starred_url":"https://api.github.com/users/tonyganch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonyganch/subscriptions","organizations_url":"https://api.github.com/users/tonyganch/orgs","repos_url":"https://api.github.com/users/tonyganch/repos","events_url":"https://api.github.com/users/tonyganch/events{/privacy}","received_events_url":"https://api.github.com/users/tonyganch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tonyganch/gonzales-pe","description":"CSS parser with support of preprocessors","fork":false,"url":"https://api.github.com/repos/tonyganch/gonzales-pe","forks_url":"https://api.github.com/repos/tonyganch/gonzales-pe/forks","keys_url":"https://api.github.com/repos/tonyganch/gonzales-pe/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tonyganch/gonzales-pe/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tonyganch/gonzales-pe/teams","hooks_url":"https://api.github.com/repos/tonyganch/gonzales-pe/hooks","issue_events_url":"https://api.github.com/repos/tonyganch/gonzales-pe/issues/events{/number}","events_url":"https://api.github.com/repos/tonyganch/gonzales-pe/events","assignees_url":"https://api.github.com/repos/tonyganch/gonzales-pe/assignees{/user}","branches_url":"https://api.github.com/repos/tonyganch/gonzales-pe/branches{/branch}","tags_url":"https://api.github.com/repos/tonyganch/gonzales-pe/tags","blobs_url":"https://api.github.com/repos/tonyganch/gonzales-pe/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tonyganch/gonzales-pe/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tonyganch/gonzales-pe/git/refs{/sha}","trees_url":"https://api.github.com/repos/tonyganch/gonzales-pe/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tonyganch/gonzales-pe/statuses/{sha}","languages_url":"https://api.github.com/repos/tonyganch/gonzales-pe/languages","stargazers_url":"https://api.github.com/repos/tonyganch/gonzales-pe/stargazers","contributors_url":"https://api.github.com/repos/tonyganch/gonzales-pe/contributors","subscribers_url":"https://api.github.com/repos/tonyganch/gonzales-pe/subscribers","subscription_url":"https://api.github.com/repos/tonyganch/gonzales-pe/subscription","commits_url":"https://api.github.com/repos/tonyganch/gonzales-pe/commits{/sha}","git_commits_url":"https://api.github.com/repos/tonyganch/gonzales-pe/git/commits{/sha}","comments_url":"https://api.github.com/repos/tonyganch/gonzales-pe/comments{/number}","issue_comment_url":"https://api.github.com/repos/tonyganch/gonzales-pe/issues/comments{/number}","contents_url":"https://api.github.com/repos/tonyganch/gonzales-pe/contents/{+path}","compare_url":"https://api.github.com/repos/tonyganch/gonzales-pe/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tonyganch/gonzales-pe/merges","archive_url":"https://api.github.com/repos/tonyganch/gonzales-pe/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tonyganch/gonzales-pe/downloads","issues_url":"https://api.github.com/repos/tonyganch/gonzales-pe/issues{/number}","pulls_url":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls{/number}","milestones_url":"https://api.github.com/repos/tonyganch/gonzales-pe/milestones{/number}","notifications_url":"https://api.github.com/repos/tonyganch/gonzales-pe/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tonyganch/gonzales-pe/labels{/name}","releases_url":"https://api.github.com/repos/tonyganch/gonzales-pe/releases{/id}","deployments_url":"https://api.github.com/repos/tonyganch/gonzales-pe/deployments","created_at":"2013-10-06T22:06:58Z","updated_at":"2016-10-24T08:03:04Z","pushed_at":"2016-10-31T00:56:22Z","git_url":"git://github.com/tonyganch/gonzales-pe.git","ssh_url":"git@github.com:tonyganch/gonzales-pe.git","clone_url":"https://github.com/tonyganch/gonzales-pe.git","svn_url":"https://github.com/tonyganch/gonzales-pe","homepage":"","size":5446,"stargazers_count":161,"watchers_count":161,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":40,"mirror_url":null,"open_issues_count":42,"forks":40,"open_issues":42,"watchers":161,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls/217"},"html":{"href":"https://github.com/tonyganch/gonzales-pe/pull/217"},"issue":{"href":"https://api.github.com/repos/tonyganch/gonzales-pe/issues/217"},"comments":{"href":"https://api.github.com/repos/tonyganch/gonzales-pe/issues/217/comments"},"review_comments":{"href":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls/217/comments"},"review_comment":{"href":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tonyganch/gonzales-pe/pulls/217/commits"},"statuses":{"href":"https://api.github.com/repos/tonyganch/gonzales-pe/statuses/0feda83ba7941f048b5271ac19fad78e6e3421a1"}}}}
{"actor":{"display_login":"tonyganch"}}