{"action":"created","comment":{"url":"https://api.github.com/repos/katef/libfsm/pulls/comments/199146983","pull_request_review_id":133210148,"id":199146983,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDE5OTE0Njk4Mw==","diff_hunk":"@@ -0,0 +1,145 @@\n+#ifndef RE_AST_H\n+#define RE_AST_H\n+\n+#include <stdlib.h>\n+#include <stdio.h>\n+#include <assert.h>\n+\n+#include <re/re.h>\n+\n+#include <fsm/fsm.h>\n+#include <fsm/bool.h>\n+\n+#include \"re_char_class.h\"\n+\n+/* Because we're building with -NDEBUG */\n+#define FAIL(s)\t\t\t\t\t\\\n+\tdo {\t\t\t\t\t\\\n+\t\tfprintf(stderr, s);\t\t\\\n+\t\tabort();\t\t\t\\\n+\t} while(0)\n+\n+/* Parse tree / Abstract syntax tree.\n+ * None of this should be exposed to the public API. */\n+\n+enum ast_expr_type {\n+\tAST_EXPR_EMPTY,\n+\tAST_EXPR_CONCAT,\n+\tAST_EXPR_ALT,\n+\tAST_EXPR_LITERAL,\n+\tAST_EXPR_ANY,\n+\tAST_EXPR_MANY,\n+\tAST_EXPR_KLEENE,\n+\tAST_EXPR_PLUS,\n+\tAST_EXPR_OPT,","path":"src/libre/re_ast.h","position":34,"original_position":34,"commit_id":"56ff50d58c1bb27ba047500bcf4125cf03768e18","original_commit_id":"56ff50d58c1bb27ba047500bcf4125cf03768e18","user":{"login":"katef","id":1371085,"node_id":"MDQ6VXNlcjEzNzEwODU=","avatar_url":"https://avatars2.githubusercontent.com/u/1371085?v=4","gravatar_id":"","url":"https://api.github.com/users/katef","html_url":"https://github.com/katef","followers_url":"https://api.github.com/users/katef/followers","following_url":"https://api.github.com/users/katef/following{/other_user}","gists_url":"https://api.github.com/users/katef/gists{/gist_id}","starred_url":"https://api.github.com/users/katef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katef/subscriptions","organizations_url":"https://api.github.com/users/katef/orgs","repos_url":"https://api.github.com/users/katef/repos","events_url":"https://api.github.com/users/katef/events{/privacy}","received_events_url":"https://api.github.com/users/katef/received_events","type":"User","site_admin":false},"body":"`AST_EXPR_KLEENE` and friends still exist in `enum ast_expr_type`","created_at":"2018-06-29T12:45:39Z","updated_at":"2018-06-29T12:56:30Z","html_url":"https://github.com/katef/libfsm/pull/89#discussion_r199146983","pull_request_url":"https://api.github.com/repos/katef/libfsm/pulls/89","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/katef/libfsm/pulls/comments/199146983"},"html":{"href":"https://github.com/katef/libfsm/pull/89#discussion_r199146983"},"pull_request":{"href":"https://api.github.com/repos/katef/libfsm/pulls/89"}}},"pull_request":{"url":"https://api.github.com/repos/katef/libfsm/pulls/89","id":197252244,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3MjUyMjQ0","html_url":"https://github.com/katef/libfsm/pull/89","diff_url":"https://github.com/katef/libfsm/pull/89.diff","patch_url":"https://github.com/katef/libfsm/pull/89.patch","issue_url":"https://api.github.com/repos/katef/libfsm/issues/89","number":89,"state":"open","locked":false,"title":"Add ASTs for libre dialects","user":{"login":"silentbicycle","id":217280,"node_id":"MDQ6VXNlcjIxNzI4MA==","avatar_url":"https://avatars0.githubusercontent.com/u/217280?v=4","gravatar_id":"","url":"https://api.github.com/users/silentbicycle","html_url":"https://github.com/silentbicycle","followers_url":"https://api.github.com/users/silentbicycle/followers","following_url":"https://api.github.com/users/silentbicycle/following{/other_user}","gists_url":"https://api.github.com/users/silentbicycle/gists{/gist_id}","starred_url":"https://api.github.com/users/silentbicycle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silentbicycle/subscriptions","organizations_url":"https://api.github.com/users/silentbicycle/orgs","repos_url":"https://api.github.com/users/silentbicycle/repos","events_url":"https://api.github.com/users/silentbicycle/events{/privacy}","received_events_url":"https://api.github.com/users/silentbicycle/received_events","type":"User","site_admin":false},"body":"Add abstract syntax trees for the various dialects, so compilation can make decisions based on the entire parsed regex rather than building an FSM at parse time.\r\n\r\n- Remove some unnecessary states and epsilon transitions from the regexs' NFAs, since after parsing, it's clear they are no longer necessary. While minimization would remove them anyway, it should make other processing more efficient.\r\n\r\n- Add prettyprinting for the parsed AST. Rather than speculate too much about what output format might be useful (JSON? dot?), the current format is pretty basic, mostly to aid development.\r\n\r\n- Add some logging during AST construction and compilation. (Note that in its current form, this adds a couple warnings for variadic macros being used in an otherwise `-std=c89` codebase.)\r\n\r\n- Switch from distinct `CLASS_*` named character class token types to a single type, `NAMED_CHAR_CLASS`. This significantly reduces the surface area for the grammar and semantic actions, and will make it significantly easier to implement PCRE negated named character classes or other new character classes later.\r\n\r\n- Add a new error type, `<err-unsupported>`, for constructs (mostly in PCRE) that are detected at parse time but explicitly unsupported.\r\n\r\n- Add a distinct token type for named character classes.\r\n\r\n- Fix some bugs related to cases in PCRE where named character classes and character types have different rules.\r\n\r\n- Add PCRE character class ranges with character types and/or named character classes as well as character literals.\r\n\r\n- Correct some subtleties regarding PCRE's escaped character handling rules.\r\n\r\n- Add a link to the PCRE reference in its grammar.\r\n\r\n- Document part of the grammar that seems to require LL(2).\r\n\r\n- Fix pcre \\Qquoting\\E.\r\n\r\n- Add lots of tests, including some tests for expected error messages given for invalid regexes.\r\n\r\nNote: Some of the build config needs to be updated -- rather than using the overarching makefile setup to run tests, I've been using the `testdir` script, to focus on a particular dialect at a time.\r\n\r\nWith these changes, all of the dialect-related tests are passing except for:\r\n\r\n    - tests/pcre/in10.re: `\\c` is explicitly unsupported, so this won't work\r\n    - tests/pcre/in14.re: This doesn't seem to detect that `\\x00-\\xff` can be replaced with `.`\r\n    - tests/native/in8.re: ^ and $ anchors aren't implemented yet\r\n","created_at":"2018-06-25T22:23:02Z","updated_at":"2018-06-29T12:56:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2f60276788fc968e54a32416728ac476606ff389","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/katef/libfsm/pulls/89/commits","review_comments_url":"https://api.github.com/repos/katef/libfsm/pulls/89/comments","review_comment_url":"https://api.github.com/repos/katef/libfsm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/katef/libfsm/issues/89/comments","statuses_url":"https://api.github.com/repos/katef/libfsm/statuses/56ff50d58c1bb27ba047500bcf4125cf03768e18","head":{"label":"katef:sv/re-ast","ref":"sv/re-ast","sha":"56ff50d58c1bb27ba047500bcf4125cf03768e18","user":{"login":"katef","id":1371085,"node_id":"MDQ6VXNlcjEzNzEwODU=","avatar_url":"https://avatars2.githubusercontent.com/u/1371085?v=4","gravatar_id":"","url":"https://api.github.com/users/katef","html_url":"https://github.com/katef","followers_url":"https://api.github.com/users/katef/followers","following_url":"https://api.github.com/users/katef/following{/other_user}","gists_url":"https://api.github.com/users/katef/gists{/gist_id}","starred_url":"https://api.github.com/users/katef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katef/subscriptions","organizations_url":"https://api.github.com/users/katef/orgs","repos_url":"https://api.github.com/users/katef/repos","events_url":"https://api.github.com/users/katef/events{/privacy}","received_events_url":"https://api.github.com/users/katef/received_events","type":"User","site_admin":false},"repo":{"id":80573145,"node_id":"MDEwOlJlcG9zaXRvcnk4MDU3MzE0NQ==","name":"libfsm","full_name":"katef/libfsm","owner":{"login":"katef","id":1371085,"node_id":"MDQ6VXNlcjEzNzEwODU=","avatar_url":"https://avatars2.githubusercontent.com/u/1371085?v=4","gravatar_id":"","url":"https://api.github.com/users/katef","html_url":"https://github.com/katef","followers_url":"https://api.github.com/users/katef/followers","following_url":"https://api.github.com/users/katef/following{/other_user}","gists_url":"https://api.github.com/users/katef/gists{/gist_id}","starred_url":"https://api.github.com/users/katef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katef/subscriptions","organizations_url":"https://api.github.com/users/katef/orgs","repos_url":"https://api.github.com/users/katef/repos","events_url":"https://api.github.com/users/katef/events{/privacy}","received_events_url":"https://api.github.com/users/katef/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/katef/libfsm","description":"DFA regular expression library & friends","fork":false,"url":"https://api.github.com/repos/katef/libfsm","forks_url":"https://api.github.com/repos/katef/libfsm/forks","keys_url":"https://api.github.com/repos/katef/libfsm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/katef/libfsm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/katef/libfsm/teams","hooks_url":"https://api.github.com/repos/katef/libfsm/hooks","issue_events_url":"https://api.github.com/repos/katef/libfsm/issues/events{/number}","events_url":"https://api.github.com/repos/katef/libfsm/events","assignees_url":"https://api.github.com/repos/katef/libfsm/assignees{/user}","branches_url":"https://api.github.com/repos/katef/libfsm/branches{/branch}","tags_url":"https://api.github.com/repos/katef/libfsm/tags","blobs_url":"https://api.github.com/repos/katef/libfsm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/katef/libfsm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/katef/libfsm/git/refs{/sha}","trees_url":"https://api.github.com/repos/katef/libfsm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/katef/libfsm/statuses/{sha}","languages_url":"https://api.github.com/repos/katef/libfsm/languages","stargazers_url":"https://api.github.com/repos/katef/libfsm/stargazers","contributors_url":"https://api.github.com/repos/katef/libfsm/contributors","subscribers_url":"https://api.github.com/repos/katef/libfsm/subscribers","subscription_url":"https://api.github.com/repos/katef/libfsm/subscription","commits_url":"https://api.github.com/repos/katef/libfsm/commits{/sha}","git_commits_url":"https://api.github.com/repos/katef/libfsm/git/commits{/sha}","comments_url":"https://api.github.com/repos/katef/libfsm/comments{/number}","issue_comment_url":"https://api.github.com/repos/katef/libfsm/issues/comments{/number}","contents_url":"https://api.github.com/repos/katef/libfsm/contents/{+path}","compare_url":"https://api.github.com/repos/katef/libfsm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/katef/libfsm/merges","archive_url":"https://api.github.com/repos/katef/libfsm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/katef/libfsm/downloads","issues_url":"https://api.github.com/repos/katef/libfsm/issues{/number}","pulls_url":"https://api.github.com/repos/katef/libfsm/pulls{/number}","milestones_url":"https://api.github.com/repos/katef/libfsm/milestones{/number}","notifications_url":"https://api.github.com/repos/katef/libfsm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/katef/libfsm/labels{/name}","releases_url":"https://api.github.com/repos/katef/libfsm/releases{/id}","deployments_url":"https://api.github.com/repos/katef/libfsm/deployments","created_at":"2017-01-31T23:31:36Z","updated_at":"2018-06-22T07:37:19Z","pushed_at":"2018-06-28T14:34:13Z","git_url":"git://github.com/katef/libfsm.git","ssh_url":"git@github.com:katef/libfsm.git","clone_url":"https://github.com/katef/libfsm.git","svn_url":"https://github.com/katef/libfsm","homepage":null,"size":2752,"stargazers_count":45,"watchers_count":45,"language":"C","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause","node_id":"MDc6TGljZW5zZTQ="},"forks":10,"open_issues":11,"watchers":45,"default_branch":"master"}},"base":{"label":"katef:master","ref":"master","sha":"568a5ddbad06614f5daddd0cce691034dd76947e","user":{"login":"katef","id":1371085,"node_id":"MDQ6VXNlcjEzNzEwODU=","avatar_url":"https://avatars2.githubusercontent.com/u/1371085?v=4","gravatar_id":"","url":"https://api.github.com/users/katef","html_url":"https://github.com/katef","followers_url":"https://api.github.com/users/katef/followers","following_url":"https://api.github.com/users/katef/following{/other_user}","gists_url":"https://api.github.com/users/katef/gists{/gist_id}","starred_url":"https://api.github.com/users/katef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katef/subscriptions","organizations_url":"https://api.github.com/users/katef/orgs","repos_url":"https://api.github.com/users/katef/repos","events_url":"https://api.github.com/users/katef/events{/privacy}","received_events_url":"https://api.github.com/users/katef/received_events","type":"User","site_admin":false},"repo":{"id":80573145,"node_id":"MDEwOlJlcG9zaXRvcnk4MDU3MzE0NQ==","name":"libfsm","full_name":"katef/libfsm","owner":{"login":"katef","id":1371085,"node_id":"MDQ6VXNlcjEzNzEwODU=","avatar_url":"https://avatars2.githubusercontent.com/u/1371085?v=4","gravatar_id":"","url":"https://api.github.com/users/katef","html_url":"https://github.com/katef","followers_url":"https://api.github.com/users/katef/followers","following_url":"https://api.github.com/users/katef/following{/other_user}","gists_url":"https://api.github.com/users/katef/gists{/gist_id}","starred_url":"https://api.github.com/users/katef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/katef/subscriptions","organizations_url":"https://api.github.com/users/katef/orgs","repos_url":"https://api.github.com/users/katef/repos","events_url":"https://api.github.com/users/katef/events{/privacy}","received_events_url":"https://api.github.com/users/katef/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/katef/libfsm","description":"DFA regular expression library & friends","fork":false,"url":"https://api.github.com/repos/katef/libfsm","forks_url":"https://api.github.com/repos/katef/libfsm/forks","keys_url":"https://api.github.com/repos/katef/libfsm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/katef/libfsm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/katef/libfsm/teams","hooks_url":"https://api.github.com/repos/katef/libfsm/hooks","issue_events_url":"https://api.github.com/repos/katef/libfsm/issues/events{/number}","events_url":"https://api.github.com/repos/katef/libfsm/events","assignees_url":"https://api.github.com/repos/katef/libfsm/assignees{/user}","branches_url":"https://api.github.com/repos/katef/libfsm/branches{/branch}","tags_url":"https://api.github.com/repos/katef/libfsm/tags","blobs_url":"https://api.github.com/repos/katef/libfsm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/katef/libfsm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/katef/libfsm/git/refs{/sha}","trees_url":"https://api.github.com/repos/katef/libfsm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/katef/libfsm/statuses/{sha}","languages_url":"https://api.github.com/repos/katef/libfsm/languages","stargazers_url":"https://api.github.com/repos/katef/libfsm/stargazers","contributors_url":"https://api.github.com/repos/katef/libfsm/contributors","subscribers_url":"https://api.github.com/repos/katef/libfsm/subscribers","subscription_url":"https://api.github.com/repos/katef/libfsm/subscription","commits_url":"https://api.github.com/repos/katef/libfsm/commits{/sha}","git_commits_url":"https://api.github.com/repos/katef/libfsm/git/commits{/sha}","comments_url":"https://api.github.com/repos/katef/libfsm/comments{/number}","issue_comment_url":"https://api.github.com/repos/katef/libfsm/issues/comments{/number}","contents_url":"https://api.github.com/repos/katef/libfsm/contents/{+path}","compare_url":"https://api.github.com/repos/katef/libfsm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/katef/libfsm/merges","archive_url":"https://api.github.com/repos/katef/libfsm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/katef/libfsm/downloads","issues_url":"https://api.github.com/repos/katef/libfsm/issues{/number}","pulls_url":"https://api.github.com/repos/katef/libfsm/pulls{/number}","milestones_url":"https://api.github.com/repos/katef/libfsm/milestones{/number}","notifications_url":"https://api.github.com/repos/katef/libfsm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/katef/libfsm/labels{/name}","releases_url":"https://api.github.com/repos/katef/libfsm/releases{/id}","deployments_url":"https://api.github.com/repos/katef/libfsm/deployments","created_at":"2017-01-31T23:31:36Z","updated_at":"2018-06-22T07:37:19Z","pushed_at":"2018-06-28T14:34:13Z","git_url":"git://github.com/katef/libfsm.git","ssh_url":"git@github.com:katef/libfsm.git","clone_url":"https://github.com/katef/libfsm.git","svn_url":"https://github.com/katef/libfsm","homepage":null,"size":2752,"stargazers_count":45,"watchers_count":45,"language":"C","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":11,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause","node_id":"MDc6TGljZW5zZTQ="},"forks":10,"open_issues":11,"watchers":45,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/katef/libfsm/pulls/89"},"html":{"href":"https://github.com/katef/libfsm/pull/89"},"issue":{"href":"https://api.github.com/repos/katef/libfsm/issues/89"},"comments":{"href":"https://api.github.com/repos/katef/libfsm/issues/89/comments"},"review_comments":{"href":"https://api.github.com/repos/katef/libfsm/pulls/89/comments"},"review_comment":{"href":"https://api.github.com/repos/katef/libfsm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/katef/libfsm/pulls/89/commits"},"statuses":{"href":"https://api.github.com/repos/katef/libfsm/statuses/56ff50d58c1bb27ba047500bcf4125cf03768e18"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"katef"}}