{"action":"created","comment":{"url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls/comments/38053659","id":38053659,"diff_hunk":"@@ -0,0 +1,140 @@\n+<link rel=\"import\" href=\"common.html\">\n+<script>\n+function ShadeyCssLexer() {\n+  'use strict';\n+  // NOTE(cdata): Generally, tokens are structured as three-valued tuple,\n+  // where the first value is the token value, the second value is the token\n+  // type and the third value is the cursor index after consuming the raw\n+  // source.\n+\n+  var common = ShadeyCssCommon();\n+  var matcher = common.matcher;\n+  var tokenType = common.tokenType;\n+\n+  function Whitespace(source, offset) {\n+    var start = offset;\n+\n+    while (matcher.whitespace.test(source[offset])) {\n+      ++offset;\n+    }\n+\n+    return [\n+      source.substr(start, offset - start),\n+      tokenType.whitespace,\n+      offset\n+    ];\n+  }\n+\n+  function Boundary(source, offset) {\n+    var token;\n+\n+    if (matcher.boundary.test(source[offset])) {\n+      return [\n+        source[offset],\n+        tokenType.boundary,\n+        offset + 1\n+      ];\n+    }\n+\n+    return [\n+      null,\n+      tokenType.none,\n+      offset\n+    ];\n+  }\n+\n+  function StringValue(source, offset) {\n+    var quotation = source[offset];\n+    var escaped = false;\n+    var string = quotation;\n+    var character;\n+\n+    if (!matcher.quotation.test(quotation)) {\n+      throw new Error('Expected quotation mark, but got ' + quotation + ' at ' + offset);\n+    }\n+\n+    while (character = source[++offset]) {\n+      string += character;\n+\n+      if (escaped) {\n+        escaped = false;\n+        continue;\n+      }\n+\n+      if (character === quotation) {\n+        return [\n+          string,\n+          tokenType.string,\n+          offset + 1\n+        ];\n+      }\n+\n+      if (character === '\\\\') {\n+        escaped = true;\n+      }\n+    }\n+\n+    return [\n+      null,\n+      tokenType.none,\n+      offset\n+    ];\n+  }\n+\n+  function Word(source, offset) {\n+    var word = null;\n+    var character;\n+\n+    while ((character = source[offset]) && !matcher.boundary.test(character)) {\n+      word = word || '';\n+      word += character;\n+      ++offset;\n+    }\n+\n+    return [\n+      word,\n+      word == null ? tokenType.none : tokenType.word,\n+      offset\n+    ];\n+  }\n+\n+  function Token(source, offset) {\n+    var token = Whitespace(source, offset);\n+\n+    if (token[0]) {\n+      return token;\n+    }\n+\n+    token = Boundary(source, token[2]);\n+\n+    switch(token[0]) {\n+      case null:\n+        break;\n+      case '\"':\n+      case '\\'':\n+        return StringValue(source, token[2] - 1);\n+      default:\n+        return token;\n+    }\n+\n+    return Word(source, token[2]);\n+  }\n+\n+  function lex(source) {\n+    var tokens = [];\n+    var offset = 0;\n+    var token;\n+\n+    while ((token = Token(source, offset)) && token[0] != null) {","path":"lexer.html","position":128,"original_position":128,"commit_id":"8c3ba5feed340007316d5feb8e8104996a9a2244","original_commit_id":"8c3ba5feed340007316d5feb8e8104996a9a2244","user":{"login":"cdata","id":240083,"avatar_url":"https://avatars.githubusercontent.com/u/240083?v=3","gravatar_id":"","url":"https://api.github.com/users/cdata","html_url":"https://github.com/cdata","followers_url":"https://api.github.com/users/cdata/followers","following_url":"https://api.github.com/users/cdata/following{/other_user}","gists_url":"https://api.github.com/users/cdata/gists{/gist_id}","starred_url":"https://api.github.com/users/cdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdata/subscriptions","organizations_url":"https://api.github.com/users/cdata/orgs","repos_url":"https://api.github.com/users/cdata/repos","events_url":"https://api.github.com/users/cdata/events{/privacy}","received_events_url":"https://api.github.com/users/cdata/received_events","type":"User","site_admin":false},"body":"Will move implementation into this function.","created_at":"2015-08-27T01:08:52Z","updated_at":"2015-08-27T01:08:52Z","html_url":"https://github.com/PolymerLabs/shady-css-parser/pull/1#discussion_r38053659","pull_request_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls/comments/38053659"},"html":{"href":"https://github.com/PolymerLabs/shady-css-parser/pull/1#discussion_r38053659"},"pull_request":{"href":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls/1","id":43365340,"html_url":"https://github.com/PolymerLabs/shady-css-parser/pull/1","diff_url":"https://github.com/PolymerLabs/shady-css-parser/pull/1.diff","patch_url":"https://github.com/PolymerLabs/shady-css-parser/pull/1.patch","issue_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/issues/1","number":1,"state":"open","locked":false,"title":"Initial implementation.","user":{"login":"cdata","id":240083,"avatar_url":"https://avatars.githubusercontent.com/u/240083?v=3","gravatar_id":"","url":"https://api.github.com/users/cdata","html_url":"https://github.com/cdata","followers_url":"https://api.github.com/users/cdata/followers","following_url":"https://api.github.com/users/cdata/following{/other_user}","gists_url":"https://api.github.com/users/cdata/gists{/gist_id}","starred_url":"https://api.github.com/users/cdata/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cdata/subscriptions","organizations_url":"https://api.github.com/users/cdata/orgs","repos_url":"https://api.github.com/users/cdata/repos","events_url":"https://api.github.com/users/cdata/events{/privacy}","received_events_url":"https://api.github.com/users/cdata/received_events","type":"User","site_admin":false},"body":" - Hooks could be implemented as dependency injections; arguments passed to the parser factory could hook into different parsing stages.\r\n - No module system was used, but this was done in the interest of not expressing an opinion.\r\n - As a first pass, there is still some fairly messy implementation in places that could stand to be formalized or cleaned up.\r\n - There is at least one known failure case right now: parsing data url values for properties.\r\n - Along the lines of the above failure case, more thorough parsing should be added for `property` and `at-rule` values.\r\n - The parser doesn't attempt to do any whitespace trimming around most values, but it probably should.\r\n - Demo dependencies are pulled in from Polygit, so no `bower install` is required.","created_at":"2015-08-26T05:26:47Z","updated_at":"2015-08-27T01:08:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf3cb63c45ed363f4eee93d6010273673e08d7a9","assignee":{"login":"justinfagnani","id":522948,"avatar_url":"https://avatars.githubusercontent.com/u/522948?v=3","gravatar_id":"","url":"https://api.github.com/users/justinfagnani","html_url":"https://github.com/justinfagnani","followers_url":"https://api.github.com/users/justinfagnani/followers","following_url":"https://api.github.com/users/justinfagnani/following{/other_user}","gists_url":"https://api.github.com/users/justinfagnani/gists{/gist_id}","starred_url":"https://api.github.com/users/justinfagnani/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/justinfagnani/subscriptions","organizations_url":"https://api.github.com/users/justinfagnani/orgs","repos_url":"https://api.github.com/users/justinfagnani/repos","events_url":"https://api.github.com/users/justinfagnani/events{/privacy}","received_events_url":"https://api.github.com/users/justinfagnani/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls/1/commits","review_comments_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls/1/comments","review_comment_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls/comments{/number}","comments_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/issues/1/comments","statuses_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/statuses/8c3ba5feed340007316d5feb8e8104996a9a2244","head":{"label":"PolymerLabs:initial-implementation","ref":"initial-implementation","sha":"8c3ba5feed340007316d5feb8e8104996a9a2244","user":{"login":"PolymerLabs","id":5912903,"avatar_url":"https://avatars.githubusercontent.com/u/5912903?v=3","gravatar_id":"","url":"https://api.github.com/users/PolymerLabs","html_url":"https://github.com/PolymerLabs","followers_url":"https://api.github.com/users/PolymerLabs/followers","following_url":"https://api.github.com/users/PolymerLabs/following{/other_user}","gists_url":"https://api.github.com/users/PolymerLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/PolymerLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolymerLabs/subscriptions","organizations_url":"https://api.github.com/users/PolymerLabs/orgs","repos_url":"https://api.github.com/users/PolymerLabs/repos","events_url":"https://api.github.com/users/PolymerLabs/events{/privacy}","received_events_url":"https://api.github.com/users/PolymerLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":41405911,"name":"shady-css-parser","full_name":"PolymerLabs/shady-css-parser","owner":{"login":"PolymerLabs","id":5912903,"avatar_url":"https://avatars.githubusercontent.com/u/5912903?v=3","gravatar_id":"","url":"https://api.github.com/users/PolymerLabs","html_url":"https://github.com/PolymerLabs","followers_url":"https://api.github.com/users/PolymerLabs/followers","following_url":"https://api.github.com/users/PolymerLabs/following{/other_user}","gists_url":"https://api.github.com/users/PolymerLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/PolymerLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolymerLabs/subscriptions","organizations_url":"https://api.github.com/users/PolymerLabs/orgs","repos_url":"https://api.github.com/users/PolymerLabs/repos","events_url":"https://api.github.com/users/PolymerLabs/events{/privacy}","received_events_url":"https://api.github.com/users/PolymerLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PolymerLabs/shady-css-parser","description":"","fork":false,"url":"https://api.github.com/repos/PolymerLabs/shady-css-parser","forks_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/forks","keys_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/teams","hooks_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/hooks","issue_events_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/issues/events{/number}","events_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/events","assignees_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/assignees{/user}","branches_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/branches{/branch}","tags_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/tags","blobs_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/git/refs{/sha}","trees_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/statuses/{sha}","languages_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/languages","stargazers_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/stargazers","contributors_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/contributors","subscribers_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/subscribers","subscription_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/subscription","commits_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/commits{/sha}","git_commits_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/git/commits{/sha}","comments_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/comments{/number}","issue_comment_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/issues/comments{/number}","contents_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/contents/{+path}","compare_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/merges","archive_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/downloads","issues_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/issues{/number}","pulls_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls{/number}","milestones_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/milestones{/number}","notifications_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/labels{/name}","releases_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/releases{/id}","created_at":"2015-08-26T05:18:33Z","updated_at":"2015-08-26T18:05:00Z","pushed_at":"2015-08-26T06:19:42Z","git_url":"git://github.com/PolymerLabs/shady-css-parser.git","ssh_url":"git@github.com:PolymerLabs/shady-css-parser.git","clone_url":"https://github.com/PolymerLabs/shady-css-parser.git","svn_url":"https://github.com/PolymerLabs/shady-css-parser","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"PolymerLabs:master","ref":"master","sha":"91e45109713bcc5f0e882b27c34c1b8030dd72a9","user":{"login":"PolymerLabs","id":5912903,"avatar_url":"https://avatars.githubusercontent.com/u/5912903?v=3","gravatar_id":"","url":"https://api.github.com/users/PolymerLabs","html_url":"https://github.com/PolymerLabs","followers_url":"https://api.github.com/users/PolymerLabs/followers","following_url":"https://api.github.com/users/PolymerLabs/following{/other_user}","gists_url":"https://api.github.com/users/PolymerLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/PolymerLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolymerLabs/subscriptions","organizations_url":"https://api.github.com/users/PolymerLabs/orgs","repos_url":"https://api.github.com/users/PolymerLabs/repos","events_url":"https://api.github.com/users/PolymerLabs/events{/privacy}","received_events_url":"https://api.github.com/users/PolymerLabs/received_events","type":"Organization","site_admin":false},"repo":{"id":41405911,"name":"shady-css-parser","full_name":"PolymerLabs/shady-css-parser","owner":{"login":"PolymerLabs","id":5912903,"avatar_url":"https://avatars.githubusercontent.com/u/5912903?v=3","gravatar_id":"","url":"https://api.github.com/users/PolymerLabs","html_url":"https://github.com/PolymerLabs","followers_url":"https://api.github.com/users/PolymerLabs/followers","following_url":"https://api.github.com/users/PolymerLabs/following{/other_user}","gists_url":"https://api.github.com/users/PolymerLabs/gists{/gist_id}","starred_url":"https://api.github.com/users/PolymerLabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PolymerLabs/subscriptions","organizations_url":"https://api.github.com/users/PolymerLabs/orgs","repos_url":"https://api.github.com/users/PolymerLabs/repos","events_url":"https://api.github.com/users/PolymerLabs/events{/privacy}","received_events_url":"https://api.github.com/users/PolymerLabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/PolymerLabs/shady-css-parser","description":"","fork":false,"url":"https://api.github.com/repos/PolymerLabs/shady-css-parser","forks_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/forks","keys_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/keys{/key_id}","collaborators_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/teams","hooks_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/hooks","issue_events_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/issues/events{/number}","events_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/events","assignees_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/assignees{/user}","branches_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/branches{/branch}","tags_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/tags","blobs_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/git/refs{/sha}","trees_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/git/trees{/sha}","statuses_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/statuses/{sha}","languages_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/languages","stargazers_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/stargazers","contributors_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/contributors","subscribers_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/subscribers","subscription_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/subscription","commits_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/commits{/sha}","git_commits_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/git/commits{/sha}","comments_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/comments{/number}","issue_comment_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/issues/comments{/number}","contents_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/contents/{+path}","compare_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/compare/{base}...{head}","merges_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/merges","archive_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/downloads","issues_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/issues{/number}","pulls_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls{/number}","milestones_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/milestones{/number}","notifications_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/labels{/name}","releases_url":"https://api.github.com/repos/PolymerLabs/shady-css-parser/releases{/id}","created_at":"2015-08-26T05:18:33Z","updated_at":"2015-08-26T18:05:00Z","pushed_at":"2015-08-26T06:19:42Z","git_url":"git://github.com/PolymerLabs/shady-css-parser.git","ssh_url":"git@github.com:PolymerLabs/shady-css-parser.git","clone_url":"https://github.com/PolymerLabs/shady-css-parser.git","svn_url":"https://github.com/PolymerLabs/shady-css-parser","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls/1"},"html":{"href":"https://github.com/PolymerLabs/shady-css-parser/pull/1"},"issue":{"href":"https://api.github.com/repos/PolymerLabs/shady-css-parser/issues/1"},"comments":{"href":"https://api.github.com/repos/PolymerLabs/shady-css-parser/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/PolymerLabs/shady-css-parser/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/PolymerLabs/shady-css-parser/statuses/8c3ba5feed340007316d5feb8e8104996a9a2244"}}}}