{"action":"created","comment":{"url":"https://api.github.com/repos/erikrose/parsimonious/pulls/comments/25674234","id":25674234,"diff_hunk":"@@ -151,10 +161,32 @@ def _uncached_match(self, text, pos, cache, error):\n         if text.startswith(self.literal, pos):\n             return Node(self.name, text, pos, pos + len(self.literal))\n \n+    def _uncached_match_list(self, token_list, pos, cache, error):","path":"parsimonious/expressions.py","position":37,"original_position":37,"commit_id":"6b59b243b4904e7c3717f65aad7e58f40844573e","original_commit_id":"6b59b243b4904e7c3717f65aad7e58f40844573e","user":{"login":"bloff","id":3836039,"avatar_url":"https://avatars.githubusercontent.com/u/3836039?v=3","gravatar_id":"","url":"https://api.github.com/users/bloff","html_url":"https://github.com/bloff","followers_url":"https://api.github.com/users/bloff/followers","following_url":"https://api.github.com/users/bloff/following{/other_user}","gists_url":"https://api.github.com/users/bloff/gists{/gist_id}","starred_url":"https://api.github.com/users/bloff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloff/subscriptions","organizations_url":"https://api.github.com/users/bloff/orgs","repos_url":"https://api.github.com/users/bloff/repos","events_url":"https://api.github.com/users/bloff/events{/privacy}","received_events_url":"https://api.github.com/users/bloff/received_events","type":"User","site_admin":false},"body":"That is silly, I don't remember why I wrote it like that.\r\n\r\nAs you can see, what it does is to assume that a \"Token\" instance also has a \"text\" attribute (containing, for instance, the text which the lexer put together to form the token, but could be anything, really), and compares it with that. But it has been a while, I don't remember why I needed it, or thought I needed it.\r\n\r\nI am actually not using parsimonious for my project anymore, in the end my use case was so unique that I had to come up with a custom parsing method --- I had all sorts of requirements such as the language to be parsed changing dynamically by instructions of the language itself, and this didn't easily conform to grammar-based parsing.","created_at":"2015-03-03T09:51:26Z","updated_at":"2015-03-03T09:51:26Z","html_url":"https://github.com/erikrose/parsimonious/pull/40#discussion_r25674234","pull_request_url":"https://api.github.com/repos/erikrose/parsimonious/pulls/40","_links":{"self":{"href":"https://api.github.com/repos/erikrose/parsimonious/pulls/comments/25674234"},"html":{"href":"https://github.com/erikrose/parsimonious/pull/40#discussion_r25674234"},"pull_request":{"href":"https://api.github.com/repos/erikrose/parsimonious/pulls/40"}}},"pull_request":{"url":"https://api.github.com/repos/erikrose/parsimonious/pulls/40","id":15694231,"html_url":"https://github.com/erikrose/parsimonious/pull/40","diff_url":"https://github.com/erikrose/parsimonious/pull/40.diff","patch_url":"https://github.com/erikrose/parsimonious/pull/40.patch","issue_url":"https://api.github.com/repos/erikrose/parsimonious/issues/40","number":40,"state":"closed","locked":false,"title":"Added the ability of parsimonious to parse lists of tokens.","user":{"login":"bloff","id":3836039,"avatar_url":"https://avatars.githubusercontent.com/u/3836039?v=3","gravatar_id":"","url":"https://api.github.com/users/bloff","html_url":"https://github.com/bloff","followers_url":"https://api.github.com/users/bloff/followers","following_url":"https://api.github.com/users/bloff/following{/other_user}","gists_url":"https://api.github.com/users/bloff/gists{/gist_id}","starred_url":"https://api.github.com/users/bloff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloff/subscriptions","organizations_url":"https://api.github.com/users/bloff/orgs","repos_url":"https://api.github.com/users/bloff/repos","events_url":"https://api.github.com/users/bloff/events{/privacy}","received_events_url":"https://api.github.com/users/bloff/received_events","type":"User","site_admin":false},"body":"Not sure you wanted this in parsimonious, but I needed it. I implemented a language with Python-like indentation; this indentation is usually implemented in the lexer. I am using PLY.\r\n\r\nHowever, LALR(1) grammars suck, so I wanted something with more lookahead. But all PEG grammars insisted on doing the lexing themselves (bah!).\r\n\r\nBut parsimonious was so simply written that it was trivial to change to do what I needed.\r\n\r\nNow if you call grammar.parse on a list, it will assume that the list is a list of \"tokens\": a token is an instance with a member called \"type\".\r\n\r\nTo match a token of a given type, you may use the syntax %TOKEN_TYPE% in the grammar.\r\n\r\nExample usage:\r\n\r\ngrammar = Grammar(\"\"\"foo = %TOKEN1% %TOKEN2%\"\"\")\r\nassert(grammar.parse([Token(\"TOKEN1\"), Token(\"TOKEN2\")]) is not None)\r\n\r\n\r\nI've already tested it on my project, it works just fine :-)","created_at":"2014-05-09T10:00:21Z","updated_at":"2015-03-03T09:51:26Z","closed_at":"2015-03-03T07:29:13Z","merged_at":null,"merge_commit_sha":"afbbf17f8b37cf1cf74a6047c1a6c2399e63a2e5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/erikrose/parsimonious/pulls/40/commits","review_comments_url":"https://api.github.com/repos/erikrose/parsimonious/pulls/40/comments","review_comment_url":"https://api.github.com/repos/erikrose/parsimonious/pulls/comments{/number}","comments_url":"https://api.github.com/repos/erikrose/parsimonious/issues/40/comments","statuses_url":"https://api.github.com/repos/erikrose/parsimonious/statuses/6b59b243b4904e7c3717f65aad7e58f40844573e","head":{"label":"bloff:master","ref":"master","sha":"6b59b243b4904e7c3717f65aad7e58f40844573e","user":{"login":"bloff","id":3836039,"avatar_url":"https://avatars.githubusercontent.com/u/3836039?v=3","gravatar_id":"","url":"https://api.github.com/users/bloff","html_url":"https://github.com/bloff","followers_url":"https://api.github.com/users/bloff/followers","following_url":"https://api.github.com/users/bloff/following{/other_user}","gists_url":"https://api.github.com/users/bloff/gists{/gist_id}","starred_url":"https://api.github.com/users/bloff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloff/subscriptions","organizations_url":"https://api.github.com/users/bloff/orgs","repos_url":"https://api.github.com/users/bloff/repos","events_url":"https://api.github.com/users/bloff/events{/privacy}","received_events_url":"https://api.github.com/users/bloff/received_events","type":"User","site_admin":false},"repo":{"id":19570306,"name":"parsimonious","full_name":"bloff/parsimonious","owner":{"login":"bloff","id":3836039,"avatar_url":"https://avatars.githubusercontent.com/u/3836039?v=3","gravatar_id":"","url":"https://api.github.com/users/bloff","html_url":"https://github.com/bloff","followers_url":"https://api.github.com/users/bloff/followers","following_url":"https://api.github.com/users/bloff/following{/other_user}","gists_url":"https://api.github.com/users/bloff/gists{/gist_id}","starred_url":"https://api.github.com/users/bloff/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bloff/subscriptions","organizations_url":"https://api.github.com/users/bloff/orgs","repos_url":"https://api.github.com/users/bloff/repos","events_url":"https://api.github.com/users/bloff/events{/privacy}","received_events_url":"https://api.github.com/users/bloff/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bloff/parsimonious","description":"A fork of parsimonious to allow for an external lexer.","fork":true,"url":"https://api.github.com/repos/bloff/parsimonious","forks_url":"https://api.github.com/repos/bloff/parsimonious/forks","keys_url":"https://api.github.com/repos/bloff/parsimonious/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bloff/parsimonious/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bloff/parsimonious/teams","hooks_url":"https://api.github.com/repos/bloff/parsimonious/hooks","issue_events_url":"https://api.github.com/repos/bloff/parsimonious/issues/events{/number}","events_url":"https://api.github.com/repos/bloff/parsimonious/events","assignees_url":"https://api.github.com/repos/bloff/parsimonious/assignees{/user}","branches_url":"https://api.github.com/repos/bloff/parsimonious/branches{/branch}","tags_url":"https://api.github.com/repos/bloff/parsimonious/tags","blobs_url":"https://api.github.com/repos/bloff/parsimonious/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bloff/parsimonious/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bloff/parsimonious/git/refs{/sha}","trees_url":"https://api.github.com/repos/bloff/parsimonious/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bloff/parsimonious/statuses/{sha}","languages_url":"https://api.github.com/repos/bloff/parsimonious/languages","stargazers_url":"https://api.github.com/repos/bloff/parsimonious/stargazers","contributors_url":"https://api.github.com/repos/bloff/parsimonious/contributors","subscribers_url":"https://api.github.com/repos/bloff/parsimonious/subscribers","subscription_url":"https://api.github.com/repos/bloff/parsimonious/subscription","commits_url":"https://api.github.com/repos/bloff/parsimonious/commits{/sha}","git_commits_url":"https://api.github.com/repos/bloff/parsimonious/git/commits{/sha}","comments_url":"https://api.github.com/repos/bloff/parsimonious/comments{/number}","issue_comment_url":"https://api.github.com/repos/bloff/parsimonious/issues/comments{/number}","contents_url":"https://api.github.com/repos/bloff/parsimonious/contents/{+path}","compare_url":"https://api.github.com/repos/bloff/parsimonious/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bloff/parsimonious/merges","archive_url":"https://api.github.com/repos/bloff/parsimonious/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bloff/parsimonious/downloads","issues_url":"https://api.github.com/repos/bloff/parsimonious/issues{/number}","pulls_url":"https://api.github.com/repos/bloff/parsimonious/pulls{/number}","milestones_url":"https://api.github.com/repos/bloff/parsimonious/milestones{/number}","notifications_url":"https://api.github.com/repos/bloff/parsimonious/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bloff/parsimonious/labels{/name}","releases_url":"https://api.github.com/repos/bloff/parsimonious/releases{/id}","created_at":"2014-05-08T10:57:28Z","updated_at":"2014-05-09T10:00:21Z","pushed_at":"2014-05-08T13:53:50Z","git_url":"git://github.com/bloff/parsimonious.git","ssh_url":"git@github.com:bloff/parsimonious.git","clone_url":"https://github.com/bloff/parsimonious.git","svn_url":"https://github.com/bloff/parsimonious","homepage":"","size":335,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"erikrose:master","ref":"master","sha":"eb66c22fb45f6abcf9aba05e9bedc94617cfd620","user":{"login":"erikrose","id":295816,"avatar_url":"https://avatars.githubusercontent.com/u/295816?v=3","gravatar_id":"","url":"https://api.github.com/users/erikrose","html_url":"https://github.com/erikrose","followers_url":"https://api.github.com/users/erikrose/followers","following_url":"https://api.github.com/users/erikrose/following{/other_user}","gists_url":"https://api.github.com/users/erikrose/gists{/gist_id}","starred_url":"https://api.github.com/users/erikrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikrose/subscriptions","organizations_url":"https://api.github.com/users/erikrose/orgs","repos_url":"https://api.github.com/users/erikrose/repos","events_url":"https://api.github.com/users/erikrose/events{/privacy}","received_events_url":"https://api.github.com/users/erikrose/received_events","type":"User","site_admin":false},"repo":{"id":3343080,"name":"parsimonious","full_name":"erikrose/parsimonious","owner":{"login":"erikrose","id":295816,"avatar_url":"https://avatars.githubusercontent.com/u/295816?v=3","gravatar_id":"","url":"https://api.github.com/users/erikrose","html_url":"https://github.com/erikrose","followers_url":"https://api.github.com/users/erikrose/followers","following_url":"https://api.github.com/users/erikrose/following{/other_user}","gists_url":"https://api.github.com/users/erikrose/gists{/gist_id}","starred_url":"https://api.github.com/users/erikrose/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erikrose/subscriptions","organizations_url":"https://api.github.com/users/erikrose/orgs","repos_url":"https://api.github.com/users/erikrose/repos","events_url":"https://api.github.com/users/erikrose/events{/privacy}","received_events_url":"https://api.github.com/users/erikrose/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/erikrose/parsimonious","description":"The fastest pure-Python PEG parser I can muster","fork":false,"url":"https://api.github.com/repos/erikrose/parsimonious","forks_url":"https://api.github.com/repos/erikrose/parsimonious/forks","keys_url":"https://api.github.com/repos/erikrose/parsimonious/keys{/key_id}","collaborators_url":"https://api.github.com/repos/erikrose/parsimonious/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/erikrose/parsimonious/teams","hooks_url":"https://api.github.com/repos/erikrose/parsimonious/hooks","issue_events_url":"https://api.github.com/repos/erikrose/parsimonious/issues/events{/number}","events_url":"https://api.github.com/repos/erikrose/parsimonious/events","assignees_url":"https://api.github.com/repos/erikrose/parsimonious/assignees{/user}","branches_url":"https://api.github.com/repos/erikrose/parsimonious/branches{/branch}","tags_url":"https://api.github.com/repos/erikrose/parsimonious/tags","blobs_url":"https://api.github.com/repos/erikrose/parsimonious/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/erikrose/parsimonious/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/erikrose/parsimonious/git/refs{/sha}","trees_url":"https://api.github.com/repos/erikrose/parsimonious/git/trees{/sha}","statuses_url":"https://api.github.com/repos/erikrose/parsimonious/statuses/{sha}","languages_url":"https://api.github.com/repos/erikrose/parsimonious/languages","stargazers_url":"https://api.github.com/repos/erikrose/parsimonious/stargazers","contributors_url":"https://api.github.com/repos/erikrose/parsimonious/contributors","subscribers_url":"https://api.github.com/repos/erikrose/parsimonious/subscribers","subscription_url":"https://api.github.com/repos/erikrose/parsimonious/subscription","commits_url":"https://api.github.com/repos/erikrose/parsimonious/commits{/sha}","git_commits_url":"https://api.github.com/repos/erikrose/parsimonious/git/commits{/sha}","comments_url":"https://api.github.com/repos/erikrose/parsimonious/comments{/number}","issue_comment_url":"https://api.github.com/repos/erikrose/parsimonious/issues/comments{/number}","contents_url":"https://api.github.com/repos/erikrose/parsimonious/contents/{+path}","compare_url":"https://api.github.com/repos/erikrose/parsimonious/compare/{base}...{head}","merges_url":"https://api.github.com/repos/erikrose/parsimonious/merges","archive_url":"https://api.github.com/repos/erikrose/parsimonious/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/erikrose/parsimonious/downloads","issues_url":"https://api.github.com/repos/erikrose/parsimonious/issues{/number}","pulls_url":"https://api.github.com/repos/erikrose/parsimonious/pulls{/number}","milestones_url":"https://api.github.com/repos/erikrose/parsimonious/milestones{/number}","notifications_url":"https://api.github.com/repos/erikrose/parsimonious/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/erikrose/parsimonious/labels{/name}","releases_url":"https://api.github.com/repos/erikrose/parsimonious/releases{/id}","created_at":"2012-02-03T09:10:42Z","updated_at":"2015-03-01T23:29:28Z","pushed_at":"2015-03-03T07:40:57Z","git_url":"git://github.com/erikrose/parsimonious.git","ssh_url":"git@github.com:erikrose/parsimonious.git","clone_url":"https://github.com/erikrose/parsimonious.git","svn_url":"https://github.com/erikrose/parsimonious","homepage":"","size":720,"stargazers_count":343,"watchers_count":343,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":29,"mirror_url":null,"open_issues_count":28,"forks":29,"open_issues":28,"watchers":343,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/erikrose/parsimonious/pulls/40"},"html":{"href":"https://github.com/erikrose/parsimonious/pull/40"},"issue":{"href":"https://api.github.com/repos/erikrose/parsimonious/issues/40"},"comments":{"href":"https://api.github.com/repos/erikrose/parsimonious/issues/40/comments"},"review_comments":{"href":"https://api.github.com/repos/erikrose/parsimonious/pulls/40/comments"},"review_comment":{"href":"https://api.github.com/repos/erikrose/parsimonious/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/erikrose/parsimonious/pulls/40/commits"},"statuses":{"href":"https://api.github.com/repos/erikrose/parsimonious/statuses/6b59b243b4904e7c3717f65aad7e58f40844573e"}}}}