{"action":"created","comment":{"url":"https://api.github.com/repos/goldshtn/etrace/pulls/comments/100241809","pull_request_review_id":20940977,"id":100241809,"diff_hunk":"@@ -120,18 +121,239 @@ public void PostParse()\n             }\n         }\n \n+        #region Filter Parsing \n+\n+        private Filter ParseFilter(string filter)\n+        {\n+            Filter result = null;\n+\n+            if (filter.Contains(MultipleFilter.MULTIPLE_FILTER_SIGN))\n+            {\n+                var subFilters = SplitMultipleFilter(filter, MultipleFilter.MULTIPLE_FILTER_SIGN);\n+                MultipleFilter multiFilter = new MultipleFilter();\n+\n+                foreach (var subFilter in subFilters)\n+                {\n+                    var paredFilter = ParseFilter(subFilter);\n+                    multiFilter.SubFilters.Add(paredFilter);\n+                }\n+\n+                result = multiFilter;\n+            }\n+            else\n+            {\n+                if (filter.Contains(Filter.GREATER_OR_EQUAL_SIGN))\n+                    result = ParseAnyOfFilter(filter, Filter.GREATER_OR_EQUAL_SIGN);\n+                if (filter.Contains(Filter.LESS_OR_EQUAL_SIGN))\n+                    result = ParseAnyOfFilter(filter, Filter.LESS_OR_EQUAL_SIGN);\n+                if (filter.Contains(Filter.GREATER_SIGN))\n+                    result = ParseAnyOfFilter(filter, Filter.GREATER_SIGN);\n+                else if (filter.Contains(Filter.LESS_SIGN))\n+                    result = ParseAnyOfFilter(filter, Filter.LESS_SIGN);\n+                else if (filter.Contains(Filter.NOT_EQUAL_SIGN))\n+                    result = ParseAnyOfFilter(filter, Filter.NOT_EQUAL_SIGN);\n+                else\n+                    result = ParseAnyOfFilter(filter, Filter.EQUAL_SIGN);\n+            }\n+\n+            return result;\n+        }\n+\n+        private string[] SplitMultipleFilter(string filter, string splitby)\n+        {\n+            filter = filter.Replace(\" \", \"\");\n+            string[] result = filter.Split(new string[] { splitby }, StringSplitOptions.RemoveEmptyEntries);\n+\n+            if (result.Length == 1)\n+                throw new ArgumentException($\"Invalid filter: {filter}\");\n+\n+            return result;\n+        }\n+\n+        private string[] SplitBinaryFilter(string filter, string splitby)\n+        {\n+            filter = filter.Replace(\" \", \"\");\n+            string[] result = filter.Split(new string[] { splitby }, StringSplitOptions.RemoveEmptyEntries);\n+\n+            if (result.Length != 2)\n+                throw new ArgumentException($\"Invalid filter: {filter}\");\n+\n+            return result;\n+        }\n+\n+        private Filter ParseAnyOfFilter(string filter, string @operator)\n+        {\n+            var splited = SplitBinaryFilter(filter, @operator);\n+            return new Filter(splited[0], splited[1], @operator);\n+        }\n+\n+        #endregion\n+\n         // TODO LINQ-like filter, e.g. `e[\"Duration\"] > 1000 && e.ProcessName == \"notepad\"`,\n         //      potentially also with `select new { ... }` which is what we print\n \n         // TODO Something that operates on event pairs, Event/Start and Event/Stop, and then\n         //      allows queries on duration\n \n-        // TODO Filters with greater-than or less-than operators\n-\n-        public Dictionary<string, Regex> ParsedFilters { get; } = new Dictionary<string, Regex>();\n+        public List<Filter> ParsedFilters { get; } = new List<Filter>();\n         public Regex ParsedRawFilter { get; private set; }\n         public bool IsFileSession => !String.IsNullOrEmpty(File);\n         public long ParsedClrKeywords { get; private set; } = 0;\n         public KernelTraceEventParser.Keywords ParsedKernelKeywords { get; private set; } = KernelTraceEventParser.Keywords.None;\n+\n+\n+        public class MultipleFilter : Filter\n+        {\n+            internal const string MULTIPLE_FILTER_SIGN = \"&&\";\n+\n+            internal MultipleFilter() : base ()\n+            {\n+                SubFilters = new List<Filter>();\n+            }\n+\n+            public List<Filter> SubFilters { get; set; }\n+\n+            /// <summary>","path":"etrace/Options.cs","position":null,"original_position":143,"commit_id":"c235adb5f40dae98200931b6a3d45ebb09147893","original_commit_id":"1e969cfbb4e493881cb8181e21a851d4fcee0745","user":{"login":"Pavel-Durov","id":6065236,"avatar_url":"https://avatars.githubusercontent.com/u/6065236?v=3","gravatar_id":"","url":"https://api.github.com/users/Pavel-Durov","html_url":"https://github.com/Pavel-Durov","followers_url":"https://api.github.com/users/Pavel-Durov/followers","following_url":"https://api.github.com/users/Pavel-Durov/following{/other_user}","gists_url":"https://api.github.com/users/Pavel-Durov/gists{/gist_id}","starred_url":"https://api.github.com/users/Pavel-Durov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pavel-Durov/subscriptions","organizations_url":"https://api.github.com/users/Pavel-Durov/orgs","repos_url":"https://api.github.com/users/Pavel-Durov/repos","events_url":"https://api.github.com/users/Pavel-Durov/events{/privacy}","received_events_url":"https://api.github.com/users/Pavel-Durov/received_events","type":"User","site_admin":false},"body":"removed","created_at":"2017-02-09T07:05:54Z","updated_at":"2017-02-09T07:05:54Z","html_url":"https://github.com/goldshtn/etrace/pull/8#discussion_r100241809","pull_request_url":"https://api.github.com/repos/goldshtn/etrace/pulls/8","_links":{"self":{"href":"https://api.github.com/repos/goldshtn/etrace/pulls/comments/100241809"},"html":{"href":"https://github.com/goldshtn/etrace/pull/8#discussion_r100241809"},"pull_request":{"href":"https://api.github.com/repos/goldshtn/etrace/pulls/8"}}},"pull_request":{"url":"https://api.github.com/repos/goldshtn/etrace/pulls/8","id":101743359,"html_url":"https://github.com/goldshtn/etrace/pull/8","diff_url":"https://github.com/goldshtn/etrace/pull/8.diff","patch_url":"https://github.com/goldshtn/etrace/pull/8.patch","issue_url":"https://api.github.com/repos/goldshtn/etrace/issues/8","number":8,"state":"open","locked":false,"title":"Issue #7 : More complex filters ","user":{"login":"Pavel-Durov","id":6065236,"avatar_url":"https://avatars.githubusercontent.com/u/6065236?v=3","gravatar_id":"","url":"https://api.github.com/users/Pavel-Durov","html_url":"https://github.com/Pavel-Durov","followers_url":"https://api.github.com/users/Pavel-Durov/followers","following_url":"https://api.github.com/users/Pavel-Durov/following{/other_user}","gists_url":"https://api.github.com/users/Pavel-Durov/gists{/gist_id}","starred_url":"https://api.github.com/users/Pavel-Durov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pavel-Durov/subscriptions","organizations_url":"https://api.github.com/users/Pavel-Durov/orgs","repos_url":"https://api.github.com/users/Pavel-Durov/repos","events_url":"https://api.github.com/users/Pavel-Durov/events{/privacy}","received_events_url":"https://api.github.com/users/Pavel-Durov/received_events","type":"User","site_admin":false},"body":"1. Added support for unlimited All-of filters.\r\n2. Added support for \">\", \"<\", \">=\", \"<=\", \"!=\"\r\n\r\nexample:\r\n`\r\netrace --kernel Proces --where \"ThreadId<20000 && ProcessName=git-lfs && ParentProcessID=19496\"\r\netrace --kernel Process --where \"ThreadId>=0 && ThreadId<99 && ProcessId!=2 && StackBase>89\"\r\netrace --kernel Process --where \"ThreadId>0\"\r\n #`\r\n\r\nFor some reason, when using the filter without quotes - \r\n`etrace --kernel Process --where ThreadId>0`\r\nParser.ParseArguments(args, options) ->  won't parse \">0\" string\r\n`options.Filters =     [0]: \"ThreadId\"`","created_at":"2017-01-16T19:05:39Z","updated_at":"2017-02-09T07:05:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"30f6513ef27b802eb9936f448ad9f50f654cab0e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/goldshtn/etrace/pulls/8/commits","review_comments_url":"https://api.github.com/repos/goldshtn/etrace/pulls/8/comments","review_comment_url":"https://api.github.com/repos/goldshtn/etrace/pulls/comments{/number}","comments_url":"https://api.github.com/repos/goldshtn/etrace/issues/8/comments","statuses_url":"https://api.github.com/repos/goldshtn/etrace/statuses/c235adb5f40dae98200931b6a3d45ebb09147893","head":{"label":"Pavel-Durov:master","ref":"master","sha":"c235adb5f40dae98200931b6a3d45ebb09147893","user":{"login":"Pavel-Durov","id":6065236,"avatar_url":"https://avatars.githubusercontent.com/u/6065236?v=3","gravatar_id":"","url":"https://api.github.com/users/Pavel-Durov","html_url":"https://github.com/Pavel-Durov","followers_url":"https://api.github.com/users/Pavel-Durov/followers","following_url":"https://api.github.com/users/Pavel-Durov/following{/other_user}","gists_url":"https://api.github.com/users/Pavel-Durov/gists{/gist_id}","starred_url":"https://api.github.com/users/Pavel-Durov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pavel-Durov/subscriptions","organizations_url":"https://api.github.com/users/Pavel-Durov/orgs","repos_url":"https://api.github.com/users/Pavel-Durov/repos","events_url":"https://api.github.com/users/Pavel-Durov/events{/privacy}","received_events_url":"https://api.github.com/users/Pavel-Durov/received_events","type":"User","site_admin":false},"repo":{"id":77612240,"name":"etrace","full_name":"Pavel-Durov/etrace","owner":{"login":"Pavel-Durov","id":6065236,"avatar_url":"https://avatars.githubusercontent.com/u/6065236?v=3","gravatar_id":"","url":"https://api.github.com/users/Pavel-Durov","html_url":"https://github.com/Pavel-Durov","followers_url":"https://api.github.com/users/Pavel-Durov/followers","following_url":"https://api.github.com/users/Pavel-Durov/following{/other_user}","gists_url":"https://api.github.com/users/Pavel-Durov/gists{/gist_id}","starred_url":"https://api.github.com/users/Pavel-Durov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pavel-Durov/subscriptions","organizations_url":"https://api.github.com/users/Pavel-Durov/orgs","repos_url":"https://api.github.com/users/Pavel-Durov/repos","events_url":"https://api.github.com/users/Pavel-Durov/events{/privacy}","received_events_url":"https://api.github.com/users/Pavel-Durov/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Pavel-Durov/etrace","description":"Command-line tool for ETW tracing on files and real-time events","fork":true,"url":"https://api.github.com/repos/Pavel-Durov/etrace","forks_url":"https://api.github.com/repos/Pavel-Durov/etrace/forks","keys_url":"https://api.github.com/repos/Pavel-Durov/etrace/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Pavel-Durov/etrace/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Pavel-Durov/etrace/teams","hooks_url":"https://api.github.com/repos/Pavel-Durov/etrace/hooks","issue_events_url":"https://api.github.com/repos/Pavel-Durov/etrace/issues/events{/number}","events_url":"https://api.github.com/repos/Pavel-Durov/etrace/events","assignees_url":"https://api.github.com/repos/Pavel-Durov/etrace/assignees{/user}","branches_url":"https://api.github.com/repos/Pavel-Durov/etrace/branches{/branch}","tags_url":"https://api.github.com/repos/Pavel-Durov/etrace/tags","blobs_url":"https://api.github.com/repos/Pavel-Durov/etrace/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Pavel-Durov/etrace/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Pavel-Durov/etrace/git/refs{/sha}","trees_url":"https://api.github.com/repos/Pavel-Durov/etrace/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Pavel-Durov/etrace/statuses/{sha}","languages_url":"https://api.github.com/repos/Pavel-Durov/etrace/languages","stargazers_url":"https://api.github.com/repos/Pavel-Durov/etrace/stargazers","contributors_url":"https://api.github.com/repos/Pavel-Durov/etrace/contributors","subscribers_url":"https://api.github.com/repos/Pavel-Durov/etrace/subscribers","subscription_url":"https://api.github.com/repos/Pavel-Durov/etrace/subscription","commits_url":"https://api.github.com/repos/Pavel-Durov/etrace/commits{/sha}","git_commits_url":"https://api.github.com/repos/Pavel-Durov/etrace/git/commits{/sha}","comments_url":"https://api.github.com/repos/Pavel-Durov/etrace/comments{/number}","issue_comment_url":"https://api.github.com/repos/Pavel-Durov/etrace/issues/comments{/number}","contents_url":"https://api.github.com/repos/Pavel-Durov/etrace/contents/{+path}","compare_url":"https://api.github.com/repos/Pavel-Durov/etrace/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Pavel-Durov/etrace/merges","archive_url":"https://api.github.com/repos/Pavel-Durov/etrace/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Pavel-Durov/etrace/downloads","issues_url":"https://api.github.com/repos/Pavel-Durov/etrace/issues{/number}","pulls_url":"https://api.github.com/repos/Pavel-Durov/etrace/pulls{/number}","milestones_url":"https://api.github.com/repos/Pavel-Durov/etrace/milestones{/number}","notifications_url":"https://api.github.com/repos/Pavel-Durov/etrace/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Pavel-Durov/etrace/labels{/name}","releases_url":"https://api.github.com/repos/Pavel-Durov/etrace/releases{/id}","deployments_url":"https://api.github.com/repos/Pavel-Durov/etrace/deployments","created_at":"2016-12-29T12:56:44Z","updated_at":"2016-12-29T12:56:46Z","pushed_at":"2017-01-17T16:16:21Z","git_url":"git://github.com/Pavel-Durov/etrace.git","ssh_url":"git@github.com:Pavel-Durov/etrace.git","clone_url":"https://github.com/Pavel-Durov/etrace.git","svn_url":"https://github.com/Pavel-Durov/etrace","homepage":null,"size":48,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"goldshtn:master","ref":"master","sha":"085ca748ab8c074a92581cc245771c7fd1c131b8","user":{"login":"goldshtn","id":1685437,"avatar_url":"https://avatars.githubusercontent.com/u/1685437?v=3","gravatar_id":"","url":"https://api.github.com/users/goldshtn","html_url":"https://github.com/goldshtn","followers_url":"https://api.github.com/users/goldshtn/followers","following_url":"https://api.github.com/users/goldshtn/following{/other_user}","gists_url":"https://api.github.com/users/goldshtn/gists{/gist_id}","starred_url":"https://api.github.com/users/goldshtn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goldshtn/subscriptions","organizations_url":"https://api.github.com/users/goldshtn/orgs","repos_url":"https://api.github.com/users/goldshtn/repos","events_url":"https://api.github.com/users/goldshtn/events{/privacy}","received_events_url":"https://api.github.com/users/goldshtn/received_events","type":"User","site_admin":false},"repo":{"id":68438975,"name":"etrace","full_name":"goldshtn/etrace","owner":{"login":"goldshtn","id":1685437,"avatar_url":"https://avatars.githubusercontent.com/u/1685437?v=3","gravatar_id":"","url":"https://api.github.com/users/goldshtn","html_url":"https://github.com/goldshtn","followers_url":"https://api.github.com/users/goldshtn/followers","following_url":"https://api.github.com/users/goldshtn/following{/other_user}","gists_url":"https://api.github.com/users/goldshtn/gists{/gist_id}","starred_url":"https://api.github.com/users/goldshtn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goldshtn/subscriptions","organizations_url":"https://api.github.com/users/goldshtn/orgs","repos_url":"https://api.github.com/users/goldshtn/repos","events_url":"https://api.github.com/users/goldshtn/events{/privacy}","received_events_url":"https://api.github.com/users/goldshtn/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/goldshtn/etrace","description":"Command-line tool for ETW tracing on files and real-time events","fork":false,"url":"https://api.github.com/repos/goldshtn/etrace","forks_url":"https://api.github.com/repos/goldshtn/etrace/forks","keys_url":"https://api.github.com/repos/goldshtn/etrace/keys{/key_id}","collaborators_url":"https://api.github.com/repos/goldshtn/etrace/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/goldshtn/etrace/teams","hooks_url":"https://api.github.com/repos/goldshtn/etrace/hooks","issue_events_url":"https://api.github.com/repos/goldshtn/etrace/issues/events{/number}","events_url":"https://api.github.com/repos/goldshtn/etrace/events","assignees_url":"https://api.github.com/repos/goldshtn/etrace/assignees{/user}","branches_url":"https://api.github.com/repos/goldshtn/etrace/branches{/branch}","tags_url":"https://api.github.com/repos/goldshtn/etrace/tags","blobs_url":"https://api.github.com/repos/goldshtn/etrace/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/goldshtn/etrace/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/goldshtn/etrace/git/refs{/sha}","trees_url":"https://api.github.com/repos/goldshtn/etrace/git/trees{/sha}","statuses_url":"https://api.github.com/repos/goldshtn/etrace/statuses/{sha}","languages_url":"https://api.github.com/repos/goldshtn/etrace/languages","stargazers_url":"https://api.github.com/repos/goldshtn/etrace/stargazers","contributors_url":"https://api.github.com/repos/goldshtn/etrace/contributors","subscribers_url":"https://api.github.com/repos/goldshtn/etrace/subscribers","subscription_url":"https://api.github.com/repos/goldshtn/etrace/subscription","commits_url":"https://api.github.com/repos/goldshtn/etrace/commits{/sha}","git_commits_url":"https://api.github.com/repos/goldshtn/etrace/git/commits{/sha}","comments_url":"https://api.github.com/repos/goldshtn/etrace/comments{/number}","issue_comment_url":"https://api.github.com/repos/goldshtn/etrace/issues/comments{/number}","contents_url":"https://api.github.com/repos/goldshtn/etrace/contents/{+path}","compare_url":"https://api.github.com/repos/goldshtn/etrace/compare/{base}...{head}","merges_url":"https://api.github.com/repos/goldshtn/etrace/merges","archive_url":"https://api.github.com/repos/goldshtn/etrace/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/goldshtn/etrace/downloads","issues_url":"https://api.github.com/repos/goldshtn/etrace/issues{/number}","pulls_url":"https://api.github.com/repos/goldshtn/etrace/pulls{/number}","milestones_url":"https://api.github.com/repos/goldshtn/etrace/milestones{/number}","notifications_url":"https://api.github.com/repos/goldshtn/etrace/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/goldshtn/etrace/labels{/name}","releases_url":"https://api.github.com/repos/goldshtn/etrace/releases{/id}","deployments_url":"https://api.github.com/repos/goldshtn/etrace/deployments","created_at":"2016-09-17T07:44:56Z","updated_at":"2017-02-05T16:22:40Z","pushed_at":"2017-01-17T16:16:23Z","git_url":"git://github.com/goldshtn/etrace.git","ssh_url":"git@github.com:goldshtn/etrace.git","clone_url":"https://github.com/goldshtn/etrace.git","svn_url":"https://github.com/goldshtn/etrace","homepage":null,"size":19,"stargazers_count":58,"watchers_count":58,"language":"C#","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":6,"forks":12,"open_issues":6,"watchers":58,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/goldshtn/etrace/pulls/8"},"html":{"href":"https://github.com/goldshtn/etrace/pull/8"},"issue":{"href":"https://api.github.com/repos/goldshtn/etrace/issues/8"},"comments":{"href":"https://api.github.com/repos/goldshtn/etrace/issues/8/comments"},"review_comments":{"href":"https://api.github.com/repos/goldshtn/etrace/pulls/8/comments"},"review_comment":{"href":"https://api.github.com/repos/goldshtn/etrace/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/goldshtn/etrace/pulls/8/commits"},"statuses":{"href":"https://api.github.com/repos/goldshtn/etrace/statuses/c235adb5f40dae98200931b6a3d45ebb09147893"}}}}
{"actor":{"display_login":"Pavel-Durov"}}