{"action":"created","comment":{"url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/comments/33232268","id":33232268,"diff_hunk":"@@ -415,31 +406,46 @@ ContextParserHandlebars.prototype.analyzeAst = function(ast, contextParser, char\n         for (var j = 0, len = tree.length, node; j < len; j++) {\n             node = tree[j];\n \n-            if (node.type === 'html') {\n+            if (node.type === handlebarsUtils.AST_HTML) {\n                 \n                 output += parser.contextualize(node.content);\n \n-            } else if (node.type === 'escapeexpression' ||\n-                node.type === 'rawexpression') {\n+            } else if (node.type === handlebarsUtils.ESCAPE_EXPRESSION ||\n+                node.type === handlebarsUtils.RAW_EXPRESSION) {\n \n                 // lookupStateForHandlebarsOpenBraceChar from current state before handle it\n                 parser.setCurrentState(ContextParserHandlebars.lookupStateForHandlebarsOpenBraceChar[parser.state]);\n                 this.clearBuffer();\n-                this.handleTemplate(node.content, 0, parser);\n+                this.handleEscapeAndRawTemplate(node.content, 0, parser);\n                 output += this.getOutput();\n \n-            } else if (node.type === 'node') {\n+            } else if (node.type === handlebarsUtils.AST_NODE) {\n                 \n                 t = this.analyzeAst(node.content, parser, node.startPos);\n                 parser.cloneStates(t.parser);\n \n                 output += t.output;\n \n-            } else if (node.type === 'rawblock' ||\n-                node.type === 'expression' || \n-                node.type === 'branchstart' ||\n-                node.type === 'branchelse' ||\n-                node.type === 'branchend') {\n+            } else if (node.type === handlebarsUtils.RAW_BLOCK ||\n+                node.type === handlebarsUtils.PARTIAL_EXPRESSION ||\n+                node.type === handlebarsUtils.AMPERSAND_EXPRESSION ||\n+                node.type === handlebarsUtils.BRANCH_EXPRESSION ||\n+                node.type === handlebarsUtils.BRANCH_END_EXPRESSION ||\n+                node.type === handlebarsUtils.ELSE_EXPRESSION ||\n+                node.type === handlebarsUtils.COMMENT_EXPRESSION_SHORT_FORM ||\n+                node.type === handlebarsUtils.COMMENT_EXPRESSION_LONG_FORM) {\n+\n+                // if the 'rawblock', 'partial expression' and 'ampersand expression' are not in Data State, \n+                // we should warn the developers or throw exception in strict mode\n+                if ((node.type === handlebarsUtils.RAW_BLOCK ||\n+                    node.type === handlebarsUtils.PARTIAL_EXPRESSION ||\n+                    node.type === handlebarsUtils.AMPERSAND_EXPRESSION) && parser.getCurrentState() !== stateMachine.State.STATE_DATA) {","path":"src/context-parser-handlebars.js","position":159,"original_position":159,"commit_id":"74ee89c6671182f8b66b6aba7176041925cd2348","original_commit_id":"74ee89c6671182f8b66b6aba7176041925cd2348","user":{"login":"adon-at-work","id":8486533,"avatar_url":"https://avatars.githubusercontent.com/u/8486533?v=3","gravatar_id":"","url":"https://api.github.com/users/adon-at-work","html_url":"https://github.com/adon-at-work","followers_url":"https://api.github.com/users/adon-at-work/followers","following_url":"https://api.github.com/users/adon-at-work/following{/other_user}","gists_url":"https://api.github.com/users/adon-at-work/gists{/gist_id}","starred_url":"https://api.github.com/users/adon-at-work/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adon-at-work/subscriptions","organizations_url":"https://api.github.com/users/adon-at-work/orgs","repos_url":"https://api.github.com/users/adon-at-work/repos","events_url":"https://api.github.com/users/adon-at-work/events{/privacy}","received_events_url":"https://api.github.com/users/adon-at-work/received_events","type":"User","site_admin":false},"body":"can you separate these 3 ifs as another `else if` in one layer (line 429) up","created_at":"2015-06-25T08:28:33Z","updated_at":"2015-06-25T08:28:33Z","html_url":"https://github.com/yahoo/secure-handlebars/pull/94#discussion_r33232268","pull_request_url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/94","_links":{"self":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/comments/33232268"},"html":{"href":"https://github.com/yahoo/secure-handlebars/pull/94#discussion_r33232268"},"pull_request":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/94"}}},"pull_request":{"url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/94","id":38519139,"html_url":"https://github.com/yahoo/secure-handlebars/pull/94","diff_url":"https://github.com/yahoo/secure-handlebars/pull/94.diff","patch_url":"https://github.com/yahoo/secure-handlebars/pull/94.patch","issue_url":"https://api.github.com/repos/yahoo/secure-handlebars/issues/94","number":94,"state":"open","locked":false,"title":"handling the partial/rawblock in non data state.","user":{"login":"neraliu","id":291417,"avatar_url":"https://avatars.githubusercontent.com/u/291417?v=3","gravatar_id":"","url":"https://api.github.com/users/neraliu","html_url":"https://github.com/neraliu","followers_url":"https://api.github.com/users/neraliu/followers","following_url":"https://api.github.com/users/neraliu/following{/other_user}","gists_url":"https://api.github.com/users/neraliu/gists{/gist_id}","starred_url":"https://api.github.com/users/neraliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neraliu/subscriptions","organizations_url":"https://api.github.com/users/neraliu/orgs","repos_url":"https://api.github.com/users/neraliu/repos","events_url":"https://api.github.com/users/neraliu/events{/privacy}","received_events_url":"https://api.github.com/users/neraliu/received_events","type":"User","site_admin":false},"body":"- using enum type for the AST node type\r\n- adding the logic to warn the developer if the partial / rawblock and raw expression {{&expression}} is in non-data state.","created_at":"2015-06-25T07:30:23Z","updated_at":"2015-06-25T08:28:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7715b8dbf4fc47c4a544979e5c969fc317b9f26e","assignee":null,"milestone":{"url":"https://api.github.com/repos/yahoo/secure-handlebars/milestones/1","html_url":"https://github.com/yahoo/secure-handlebars/milestones/v1.0.6","labels_url":"https://api.github.com/repos/yahoo/secure-handlebars/milestones/1/labels","id":1180537,"number":1,"title":"v1.0.6","description":null,"creator":{"login":"neraliu","id":291417,"avatar_url":"https://avatars.githubusercontent.com/u/291417?v=3","gravatar_id":"","url":"https://api.github.com/users/neraliu","html_url":"https://github.com/neraliu","followers_url":"https://api.github.com/users/neraliu/followers","following_url":"https://api.github.com/users/neraliu/following{/other_user}","gists_url":"https://api.github.com/users/neraliu/gists{/gist_id}","starred_url":"https://api.github.com/users/neraliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neraliu/subscriptions","organizations_url":"https://api.github.com/users/neraliu/orgs","repos_url":"https://api.github.com/users/neraliu/repos","events_url":"https://api.github.com/users/neraliu/events{/privacy}","received_events_url":"https://api.github.com/users/neraliu/received_events","type":"User","site_admin":false},"open_issues":3,"closed_issues":2,"state":"open","created_at":"2015-06-25T07:55:58Z","updated_at":"2015-06-25T08:17:06Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/94/commits","review_comments_url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/94/comments","review_comment_url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yahoo/secure-handlebars/issues/94/comments","statuses_url":"https://api.github.com/repos/yahoo/secure-handlebars/statuses/74ee89c6671182f8b66b6aba7176041925cd2348","head":{"label":"neraliu:warning-non-data-context-usage","ref":"warning-non-data-context-usage","sha":"74ee89c6671182f8b66b6aba7176041925cd2348","user":{"login":"neraliu","id":291417,"avatar_url":"https://avatars.githubusercontent.com/u/291417?v=3","gravatar_id":"","url":"https://api.github.com/users/neraliu","html_url":"https://github.com/neraliu","followers_url":"https://api.github.com/users/neraliu/followers","following_url":"https://api.github.com/users/neraliu/following{/other_user}","gists_url":"https://api.github.com/users/neraliu/gists{/gist_id}","starred_url":"https://api.github.com/users/neraliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neraliu/subscriptions","organizations_url":"https://api.github.com/users/neraliu/orgs","repos_url":"https://api.github.com/users/neraliu/repos","events_url":"https://api.github.com/users/neraliu/events{/privacy}","received_events_url":"https://api.github.com/users/neraliu/received_events","type":"User","site_admin":false},"repo":{"id":36727100,"name":"secure-handlebars","full_name":"neraliu/secure-handlebars","owner":{"login":"neraliu","id":291417,"avatar_url":"https://avatars.githubusercontent.com/u/291417?v=3","gravatar_id":"","url":"https://api.github.com/users/neraliu","html_url":"https://github.com/neraliu","followers_url":"https://api.github.com/users/neraliu/followers","following_url":"https://api.github.com/users/neraliu/following{/other_user}","gists_url":"https://api.github.com/users/neraliu/gists{/gist_id}","starred_url":"https://api.github.com/users/neraliu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/neraliu/subscriptions","organizations_url":"https://api.github.com/users/neraliu/orgs","repos_url":"https://api.github.com/users/neraliu/repos","events_url":"https://api.github.com/users/neraliu/events{/privacy}","received_events_url":"https://api.github.com/users/neraliu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/neraliu/secure-handlebars","description":"Handlebars Context Pre-compiler","fork":true,"url":"https://api.github.com/repos/neraliu/secure-handlebars","forks_url":"https://api.github.com/repos/neraliu/secure-handlebars/forks","keys_url":"https://api.github.com/repos/neraliu/secure-handlebars/keys{/key_id}","collaborators_url":"https://api.github.com/repos/neraliu/secure-handlebars/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/neraliu/secure-handlebars/teams","hooks_url":"https://api.github.com/repos/neraliu/secure-handlebars/hooks","issue_events_url":"https://api.github.com/repos/neraliu/secure-handlebars/issues/events{/number}","events_url":"https://api.github.com/repos/neraliu/secure-handlebars/events","assignees_url":"https://api.github.com/repos/neraliu/secure-handlebars/assignees{/user}","branches_url":"https://api.github.com/repos/neraliu/secure-handlebars/branches{/branch}","tags_url":"https://api.github.com/repos/neraliu/secure-handlebars/tags","blobs_url":"https://api.github.com/repos/neraliu/secure-handlebars/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/neraliu/secure-handlebars/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/neraliu/secure-handlebars/git/refs{/sha}","trees_url":"https://api.github.com/repos/neraliu/secure-handlebars/git/trees{/sha}","statuses_url":"https://api.github.com/repos/neraliu/secure-handlebars/statuses/{sha}","languages_url":"https://api.github.com/repos/neraliu/secure-handlebars/languages","stargazers_url":"https://api.github.com/repos/neraliu/secure-handlebars/stargazers","contributors_url":"https://api.github.com/repos/neraliu/secure-handlebars/contributors","subscribers_url":"https://api.github.com/repos/neraliu/secure-handlebars/subscribers","subscription_url":"https://api.github.com/repos/neraliu/secure-handlebars/subscription","commits_url":"https://api.github.com/repos/neraliu/secure-handlebars/commits{/sha}","git_commits_url":"https://api.github.com/repos/neraliu/secure-handlebars/git/commits{/sha}","comments_url":"https://api.github.com/repos/neraliu/secure-handlebars/comments{/number}","issue_comment_url":"https://api.github.com/repos/neraliu/secure-handlebars/issues/comments{/number}","contents_url":"https://api.github.com/repos/neraliu/secure-handlebars/contents/{+path}","compare_url":"https://api.github.com/repos/neraliu/secure-handlebars/compare/{base}...{head}","merges_url":"https://api.github.com/repos/neraliu/secure-handlebars/merges","archive_url":"https://api.github.com/repos/neraliu/secure-handlebars/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/neraliu/secure-handlebars/downloads","issues_url":"https://api.github.com/repos/neraliu/secure-handlebars/issues{/number}","pulls_url":"https://api.github.com/repos/neraliu/secure-handlebars/pulls{/number}","milestones_url":"https://api.github.com/repos/neraliu/secure-handlebars/milestones{/number}","notifications_url":"https://api.github.com/repos/neraliu/secure-handlebars/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/neraliu/secure-handlebars/labels{/name}","releases_url":"https://api.github.com/repos/neraliu/secure-handlebars/releases{/id}","created_at":"2015-06-02T10:57:53Z","updated_at":"2015-06-02T10:57:53Z","pushed_at":"2015-06-25T08:05:51Z","git_url":"git://github.com/neraliu/secure-handlebars.git","ssh_url":"git@github.com:neraliu/secure-handlebars.git","clone_url":"https://github.com/neraliu/secure-handlebars.git","svn_url":"https://github.com/neraliu/secure-handlebars","homepage":"","size":2021,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"yahoo:master","ref":"master","sha":"102fe1e6a809326e479e2732d06c8c9570312cef","user":{"login":"yahoo","id":16574,"avatar_url":"https://avatars.githubusercontent.com/u/16574?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoo","html_url":"https://github.com/yahoo","followers_url":"https://api.github.com/users/yahoo/followers","following_url":"https://api.github.com/users/yahoo/following{/other_user}","gists_url":"https://api.github.com/users/yahoo/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoo/subscriptions","organizations_url":"https://api.github.com/users/yahoo/orgs","repos_url":"https://api.github.com/users/yahoo/repos","events_url":"https://api.github.com/users/yahoo/events{/privacy}","received_events_url":"https://api.github.com/users/yahoo/received_events","type":"Organization","site_admin":false},"repo":{"id":30554349,"name":"secure-handlebars","full_name":"yahoo/secure-handlebars","owner":{"login":"yahoo","id":16574,"avatar_url":"https://avatars.githubusercontent.com/u/16574?v=3","gravatar_id":"","url":"https://api.github.com/users/yahoo","html_url":"https://github.com/yahoo","followers_url":"https://api.github.com/users/yahoo/followers","following_url":"https://api.github.com/users/yahoo/following{/other_user}","gists_url":"https://api.github.com/users/yahoo/gists{/gist_id}","starred_url":"https://api.github.com/users/yahoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yahoo/subscriptions","organizations_url":"https://api.github.com/users/yahoo/orgs","repos_url":"https://api.github.com/users/yahoo/repos","events_url":"https://api.github.com/users/yahoo/events{/privacy}","received_events_url":"https://api.github.com/users/yahoo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yahoo/secure-handlebars","description":"Handlebars Context Pre-compiler","fork":false,"url":"https://api.github.com/repos/yahoo/secure-handlebars","forks_url":"https://api.github.com/repos/yahoo/secure-handlebars/forks","keys_url":"https://api.github.com/repos/yahoo/secure-handlebars/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yahoo/secure-handlebars/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yahoo/secure-handlebars/teams","hooks_url":"https://api.github.com/repos/yahoo/secure-handlebars/hooks","issue_events_url":"https://api.github.com/repos/yahoo/secure-handlebars/issues/events{/number}","events_url":"https://api.github.com/repos/yahoo/secure-handlebars/events","assignees_url":"https://api.github.com/repos/yahoo/secure-handlebars/assignees{/user}","branches_url":"https://api.github.com/repos/yahoo/secure-handlebars/branches{/branch}","tags_url":"https://api.github.com/repos/yahoo/secure-handlebars/tags","blobs_url":"https://api.github.com/repos/yahoo/secure-handlebars/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yahoo/secure-handlebars/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yahoo/secure-handlebars/git/refs{/sha}","trees_url":"https://api.github.com/repos/yahoo/secure-handlebars/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yahoo/secure-handlebars/statuses/{sha}","languages_url":"https://api.github.com/repos/yahoo/secure-handlebars/languages","stargazers_url":"https://api.github.com/repos/yahoo/secure-handlebars/stargazers","contributors_url":"https://api.github.com/repos/yahoo/secure-handlebars/contributors","subscribers_url":"https://api.github.com/repos/yahoo/secure-handlebars/subscribers","subscription_url":"https://api.github.com/repos/yahoo/secure-handlebars/subscription","commits_url":"https://api.github.com/repos/yahoo/secure-handlebars/commits{/sha}","git_commits_url":"https://api.github.com/repos/yahoo/secure-handlebars/git/commits{/sha}","comments_url":"https://api.github.com/repos/yahoo/secure-handlebars/comments{/number}","issue_comment_url":"https://api.github.com/repos/yahoo/secure-handlebars/issues/comments{/number}","contents_url":"https://api.github.com/repos/yahoo/secure-handlebars/contents/{+path}","compare_url":"https://api.github.com/repos/yahoo/secure-handlebars/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yahoo/secure-handlebars/merges","archive_url":"https://api.github.com/repos/yahoo/secure-handlebars/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yahoo/secure-handlebars/downloads","issues_url":"https://api.github.com/repos/yahoo/secure-handlebars/issues{/number}","pulls_url":"https://api.github.com/repos/yahoo/secure-handlebars/pulls{/number}","milestones_url":"https://api.github.com/repos/yahoo/secure-handlebars/milestones{/number}","notifications_url":"https://api.github.com/repos/yahoo/secure-handlebars/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yahoo/secure-handlebars/labels{/name}","releases_url":"https://api.github.com/repos/yahoo/secure-handlebars/releases{/id}","created_at":"2015-02-09T19:35:28Z","updated_at":"2015-06-18T20:34:13Z","pushed_at":"2015-06-25T08:17:06Z","git_url":"git://github.com/yahoo/secure-handlebars.git","ssh_url":"git@github.com:yahoo/secure-handlebars.git","clone_url":"https://github.com/yahoo/secure-handlebars.git","svn_url":"https://github.com/yahoo/secure-handlebars","homepage":"","size":3152,"stargazers_count":10,"watchers_count":10,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":5,"mirror_url":null,"open_issues_count":7,"forks":5,"open_issues":7,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/94"},"html":{"href":"https://github.com/yahoo/secure-handlebars/pull/94"},"issue":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/issues/94"},"comments":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/issues/94/comments"},"review_comments":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/94/comments"},"review_comment":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/pulls/94/commits"},"statuses":{"href":"https://api.github.com/repos/yahoo/secure-handlebars/statuses/74ee89c6671182f8b66b6aba7176041925cd2348"}}}}