{"action":"created","comment":{"url":"https://api.github.com/repos/Marwes/gluon/pulls/comments/74019545","id":74019545,"diff_hunk":"@@ -0,0 +1,233 @@\n+use std::iter;\n+\n+use {Expr, Literal, Ident, MatchArm, Pattern, Type, TypeBinding, ValueBinding};\n+use tokenize::{Error, /*Location, */ Token};\n+\n+grammar<'input>(src: &'input str);\n+\n+extern {\n+    // type Location = Location;\n+    type Location = usize;\n+    type Error = Error;\n+\n+    enum Token<'input> {\n+        \"and\" => Token::And,\n+        \"else\" => Token::Else,\n+        \"if\" => Token::If,\n+        \"in\" => Token::In,\n+        \"let\" => Token::Let,\n+        \"match\" => Token::Match,\n+        \"then\" => Token::Then,\n+        \"type\" => Token::Type,\n+        \"with\" => Token::With,\n+\n+        \"Name\" => Token::Name(<&'input str>),\n+        \"Operator\" => Token::Operator(<&'input str>),\n+        \"ByteLiteral\" => Token::ByteLiteral(<u8>),\n+        \"IntLiteral\" => Token::IntLiteral(<i64>),\n+        \"FloatLiteral\" => Token::FloatLiteral(<f64>),\n+        \"StringLiteral\" => Token::StringLiteral(<String>),\n+        \"CharLiteral\" => Token::CharLiteral(<char>),\n+\n+        \":\" => Token::Colon,\n+        \",\" => Token::Comma,\n+        \".\" => Token::Dot,\n+        \"=\" => Token::Equals,\n+        \"\\\"\" => Token::Lambda,\n+        \"{\" => Token::LBrace,\n+        \"[\" => Token::LBracket,\n+        \"(\" => Token::LParen,\n+        \"|\" => Token::Pipe,\n+        \"->\" => Token::RArrow,\n+        \"}\" => Token::RBrace,\n+        \"]\" => Token::RBracket,\n+        \")\" => Token::RParen,\n+\n+        \"OpenBlock\" => Token::OpenBlock,\n+        \"CloseBlock\" => Token::CloseBlock,\n+        \"Separator\" => Token::Separator,\n+    }\n+}\n+\n+// Utils\n+\n+Comma<Rule>: Vec<Rule> =\n+    <rules: (<Rule> \",\")*> <last: Rule?> => {\n+        let mut rules = rules;\n+        rules.extend(last);\n+        rules\n+    };\n+\n+And<Rule>: Vec<Rule> =\n+    <rules: (<Rule> \"and\")*> <last: Rule> =>\n+        rules.into_iter().chain(iter::once(last)).collect();\n+\n+pub Ident: Ident = {\n+    \"Name\" => Ident::Name(<>.to_string()),\n+    \"(\" <op: \"Operator\"> \")\" => Ident::Operator(op.to_string()),\n+};\n+\n+// Types\n+\n+TypeBinding: TypeBinding =\n+    <id: Ident> <params: Ident*> \"=\" <body: Type> =>\n+        TypeBinding::new(id, Type::Abs(params, Box::new(body)));\n+\n+FieldType: (Ident, Type) =\n+    <id: Ident> \":\" <ty: Type> =>\n+        (id, ty);\n+\n+AtomicType: Type = {\n+    Ident =>\n+        Type::Ident(<>),\n+\n+    \"{\" <fields: Comma<FieldType>> \"}\" =>\n+        Type::Record(fields),\n+\n+    \"(\" <elems: Comma<Type>> \")\" =>\n+        if elems.len() == 1 {\n+            elems.into_iter().next().unwrap()\n+        } else {\n+            Type::tuple(elems)\n+        },\n+};\n+\n+AppType = {\n+    AtomicType,\n+\n+    <ty: AtomicType> <args: AtomicType+> =>\n+        Type::App(Box::new(ty), args),\n+};\n+\n+InfixType = {\n+    AppType,\n+\n+    <lhs: InfixType> <op: \"Operator\"> <rhs: AppType> =>\n+        Type::Infix(Box::new(lhs), op.to_string(), Box::new(rhs)),\n+};\n+\n+pub Type = {\n+    InfixType,\n+};\n+\n+// Patterns\n+\n+FieldPattern : (Ident, Pattern) = {\n+    <id: Ident> \"=\" <pat: Pattern> => (id, pat),\n+    <id: Ident> => (id.clone(), Pattern::Ident(id)),\n+};\n+\n+AtomicPattern: Pattern = {\n+    Ident =>\n+        Pattern::Ident(<>),\n+\n+    \"{\" <fields: Comma<FieldPattern>> \"}\" =>\n+        Pattern::Record(fields),\n+\n+    \"(\" <elems: Comma<Pattern>> \")\" =>\n+        if elems.len() == 1 {\n+            elems.into_iter().next().unwrap()\n+        } else {\n+            Pattern::tuple(elems)\n+        },\n+};\n+\n+Pattern = {\n+    AtomicPattern,\n+\n+    <id: Ident> <args: AtomicPattern+> =>\n+        Pattern::Ctor(id, args),\n+};\n+\n+// Expressions\n+\n+pub Literal: Literal = {\n+    \"StringLiteral\" => Literal::String(<>),\n+    \"CharLiteral\" => Literal::Char(<>),\n+    \"IntLiteral\" => Literal::Int(<>),\n+    \"ByteLiteral\" => Literal::Byte(<>),\n+    \"FloatLiteral\" => Literal::Float(<>),\n+};\n+\n+MatchArm: MatchArm =\n+    \"|\" <pat: Pattern> \"->\" <expr: Expr> =>\n+        MatchArm::new(pat, expr);\n+\n+FieldExpr: (Ident, Expr) =\n+    <id: Ident> \"=\" <body: Expr> =>\n+        (id, body);\n+\n+ValueBinding: ValueBinding = {\n+    <id: Ident> <args: AtomicPattern+> \"=\" <body: Expr> =>\n+        ValueBinding::new(Pattern::Ident(id), Expr::Lambda(args, Box::new(body))),\n+\n+    <pat: AtomicPattern> \"=\" <body: Expr> =>\n+        ValueBinding::new(pat, body),\n+};\n+\n+AtomicExpr: Expr = {\n+    Ident =>\n+        Expr::Ident(<>),\n+\n+    Literal =>\n+        Expr::Literal(<>),\n+\n+    \"(\" \".\" <id: Ident> \")\" =>\n+        Expr::Getter(id),","path":"parser2/src/grammar.lalrpop","position":176,"original_position":176,"commit_id":"08bf5ed75545ae02567b8c403a66121ff8e504a7","original_commit_id":"08bf5ed75545ae02567b8c403a66121ff8e504a7","user":{"login":"brendanzab","id":695077,"avatar_url":"https://avatars.githubusercontent.com/u/695077?v=3","gravatar_id":"","url":"https://api.github.com/users/brendanzab","html_url":"https://github.com/brendanzab","followers_url":"https://api.github.com/users/brendanzab/followers","following_url":"https://api.github.com/users/brendanzab/following{/other_user}","gists_url":"https://api.github.com/users/brendanzab/gists{/gist_id}","starred_url":"https://api.github.com/users/brendanzab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendanzab/subscriptions","organizations_url":"https://api.github.com/users/brendanzab/orgs","repos_url":"https://api.github.com/users/brendanzab/repos","events_url":"https://api.github.com/users/brendanzab/events{/privacy}","received_events_url":"https://api.github.com/users/brendanzab/received_events","type":"User","site_admin":false},"body":"Yup. Is that ok? Elm uses it - I'm sure there are others. I can remove though - was experimenting!","created_at":"2016-08-09T08:41:00Z","updated_at":"2016-08-09T08:41:00Z","html_url":"https://github.com/Marwes/gluon/pull/103#discussion_r74019545","pull_request_url":"https://api.github.com/repos/Marwes/gluon/pulls/103","_links":{"self":{"href":"https://api.github.com/repos/Marwes/gluon/pulls/comments/74019545"},"html":{"href":"https://github.com/Marwes/gluon/pull/103#discussion_r74019545"},"pull_request":{"href":"https://api.github.com/repos/Marwes/gluon/pulls/103"}}},"pull_request":{"url":"https://api.github.com/repos/Marwes/gluon/pulls/103","id":80417818,"html_url":"https://github.com/Marwes/gluon/pull/103","diff_url":"https://github.com/Marwes/gluon/pull/103.diff","patch_url":"https://github.com/Marwes/gluon/pull/103.patch","issue_url":"https://api.github.com/repos/Marwes/gluon/issues/103","number":103,"state":"open","locked":false,"title":"[WIP] Switch to using LALRPOP as for a parser generator","user":{"login":"brendanzab","id":695077,"avatar_url":"https://avatars.githubusercontent.com/u/695077?v=3","gravatar_id":"","url":"https://api.github.com/users/brendanzab","html_url":"https://github.com/brendanzab","followers_url":"https://api.github.com/users/brendanzab/followers","following_url":"https://api.github.com/users/brendanzab/following{/other_user}","gists_url":"https://api.github.com/users/brendanzab/gists{/gist_id}","starred_url":"https://api.github.com/users/brendanzab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendanzab/subscriptions","organizations_url":"https://api.github.com/users/brendanzab/orgs","repos_url":"https://api.github.com/users/brendanzab/repos","events_url":"https://api.github.com/users/brendanzab/events{/privacy}","received_events_url":"https://api.github.com/users/brendanzab/received_events","type":"User","site_admin":false},"body":"Fixes #69","created_at":"2016-08-08T09:15:51Z","updated_at":"2016-08-09T08:41:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b661bf94cfd5e51e6402ac9d53a03d60217cddc","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/Marwes/gluon/pulls/103/commits","review_comments_url":"https://api.github.com/repos/Marwes/gluon/pulls/103/comments","review_comment_url":"https://api.github.com/repos/Marwes/gluon/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Marwes/gluon/issues/103/comments","statuses_url":"https://api.github.com/repos/Marwes/gluon/statuses/08bf5ed75545ae02567b8c403a66121ff8e504a7","head":{"label":"brendanzab:lalrpop_parser","ref":"lalrpop_parser","sha":"08bf5ed75545ae02567b8c403a66121ff8e504a7","user":{"login":"brendanzab","id":695077,"avatar_url":"https://avatars.githubusercontent.com/u/695077?v=3","gravatar_id":"","url":"https://api.github.com/users/brendanzab","html_url":"https://github.com/brendanzab","followers_url":"https://api.github.com/users/brendanzab/followers","following_url":"https://api.github.com/users/brendanzab/following{/other_user}","gists_url":"https://api.github.com/users/brendanzab/gists{/gist_id}","starred_url":"https://api.github.com/users/brendanzab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendanzab/subscriptions","organizations_url":"https://api.github.com/users/brendanzab/orgs","repos_url":"https://api.github.com/users/brendanzab/repos","events_url":"https://api.github.com/users/brendanzab/events{/privacy}","received_events_url":"https://api.github.com/users/brendanzab/received_events","type":"User","site_admin":false},"repo":{"id":63468087,"name":"gluon","full_name":"brendanzab/gluon","owner":{"login":"brendanzab","id":695077,"avatar_url":"https://avatars.githubusercontent.com/u/695077?v=3","gravatar_id":"","url":"https://api.github.com/users/brendanzab","html_url":"https://github.com/brendanzab","followers_url":"https://api.github.com/users/brendanzab/followers","following_url":"https://api.github.com/users/brendanzab/following{/other_user}","gists_url":"https://api.github.com/users/brendanzab/gists{/gist_id}","starred_url":"https://api.github.com/users/brendanzab/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brendanzab/subscriptions","organizations_url":"https://api.github.com/users/brendanzab/orgs","repos_url":"https://api.github.com/users/brendanzab/repos","events_url":"https://api.github.com/users/brendanzab/events{/privacy}","received_events_url":"https://api.github.com/users/brendanzab/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/brendanzab/gluon","description":"A static, type inferred and embeddable language written in Rust.","fork":true,"url":"https://api.github.com/repos/brendanzab/gluon","forks_url":"https://api.github.com/repos/brendanzab/gluon/forks","keys_url":"https://api.github.com/repos/brendanzab/gluon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/brendanzab/gluon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/brendanzab/gluon/teams","hooks_url":"https://api.github.com/repos/brendanzab/gluon/hooks","issue_events_url":"https://api.github.com/repos/brendanzab/gluon/issues/events{/number}","events_url":"https://api.github.com/repos/brendanzab/gluon/events","assignees_url":"https://api.github.com/repos/brendanzab/gluon/assignees{/user}","branches_url":"https://api.github.com/repos/brendanzab/gluon/branches{/branch}","tags_url":"https://api.github.com/repos/brendanzab/gluon/tags","blobs_url":"https://api.github.com/repos/brendanzab/gluon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/brendanzab/gluon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/brendanzab/gluon/git/refs{/sha}","trees_url":"https://api.github.com/repos/brendanzab/gluon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/brendanzab/gluon/statuses/{sha}","languages_url":"https://api.github.com/repos/brendanzab/gluon/languages","stargazers_url":"https://api.github.com/repos/brendanzab/gluon/stargazers","contributors_url":"https://api.github.com/repos/brendanzab/gluon/contributors","subscribers_url":"https://api.github.com/repos/brendanzab/gluon/subscribers","subscription_url":"https://api.github.com/repos/brendanzab/gluon/subscription","commits_url":"https://api.github.com/repos/brendanzab/gluon/commits{/sha}","git_commits_url":"https://api.github.com/repos/brendanzab/gluon/git/commits{/sha}","comments_url":"https://api.github.com/repos/brendanzab/gluon/comments{/number}","issue_comment_url":"https://api.github.com/repos/brendanzab/gluon/issues/comments{/number}","contents_url":"https://api.github.com/repos/brendanzab/gluon/contents/{+path}","compare_url":"https://api.github.com/repos/brendanzab/gluon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/brendanzab/gluon/merges","archive_url":"https://api.github.com/repos/brendanzab/gluon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/brendanzab/gluon/downloads","issues_url":"https://api.github.com/repos/brendanzab/gluon/issues{/number}","pulls_url":"https://api.github.com/repos/brendanzab/gluon/pulls{/number}","milestones_url":"https://api.github.com/repos/brendanzab/gluon/milestones{/number}","notifications_url":"https://api.github.com/repos/brendanzab/gluon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/brendanzab/gluon/labels{/name}","releases_url":"https://api.github.com/repos/brendanzab/gluon/releases{/id}","deployments_url":"https://api.github.com/repos/brendanzab/gluon/deployments","created_at":"2016-07-16T06:01:05Z","updated_at":"2016-07-16T06:01:07Z","pushed_at":"2016-08-08T09:58:23Z","git_url":"git://github.com/brendanzab/gluon.git","ssh_url":"git@github.com:brendanzab/gluon.git","clone_url":"https://github.com/brendanzab/gluon.git","svn_url":"https://github.com/brendanzab/gluon","homepage":"","size":2143,"stargazers_count":0,"watchers_count":0,"language":"Rust","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":"Marwes:master","ref":"master","sha":"0987a3a3d11d8ff6f61f7160541311dbe8b86278","user":{"login":"Marwes","id":957312,"avatar_url":"https://avatars.githubusercontent.com/u/957312?v=3","gravatar_id":"","url":"https://api.github.com/users/Marwes","html_url":"https://github.com/Marwes","followers_url":"https://api.github.com/users/Marwes/followers","following_url":"https://api.github.com/users/Marwes/following{/other_user}","gists_url":"https://api.github.com/users/Marwes/gists{/gist_id}","starred_url":"https://api.github.com/users/Marwes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Marwes/subscriptions","organizations_url":"https://api.github.com/users/Marwes/orgs","repos_url":"https://api.github.com/users/Marwes/repos","events_url":"https://api.github.com/users/Marwes/events{/privacy}","received_events_url":"https://api.github.com/users/Marwes/received_events","type":"User","site_admin":false},"repo":{"id":40078838,"name":"gluon","full_name":"Marwes/gluon","owner":{"login":"Marwes","id":957312,"avatar_url":"https://avatars.githubusercontent.com/u/957312?v=3","gravatar_id":"","url":"https://api.github.com/users/Marwes","html_url":"https://github.com/Marwes","followers_url":"https://api.github.com/users/Marwes/followers","following_url":"https://api.github.com/users/Marwes/following{/other_user}","gists_url":"https://api.github.com/users/Marwes/gists{/gist_id}","starred_url":"https://api.github.com/users/Marwes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Marwes/subscriptions","organizations_url":"https://api.github.com/users/Marwes/orgs","repos_url":"https://api.github.com/users/Marwes/repos","events_url":"https://api.github.com/users/Marwes/events{/privacy}","received_events_url":"https://api.github.com/users/Marwes/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Marwes/gluon","description":"A static, type inferred and embeddable language written in Rust.","fork":false,"url":"https://api.github.com/repos/Marwes/gluon","forks_url":"https://api.github.com/repos/Marwes/gluon/forks","keys_url":"https://api.github.com/repos/Marwes/gluon/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Marwes/gluon/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Marwes/gluon/teams","hooks_url":"https://api.github.com/repos/Marwes/gluon/hooks","issue_events_url":"https://api.github.com/repos/Marwes/gluon/issues/events{/number}","events_url":"https://api.github.com/repos/Marwes/gluon/events","assignees_url":"https://api.github.com/repos/Marwes/gluon/assignees{/user}","branches_url":"https://api.github.com/repos/Marwes/gluon/branches{/branch}","tags_url":"https://api.github.com/repos/Marwes/gluon/tags","blobs_url":"https://api.github.com/repos/Marwes/gluon/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Marwes/gluon/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Marwes/gluon/git/refs{/sha}","trees_url":"https://api.github.com/repos/Marwes/gluon/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Marwes/gluon/statuses/{sha}","languages_url":"https://api.github.com/repos/Marwes/gluon/languages","stargazers_url":"https://api.github.com/repos/Marwes/gluon/stargazers","contributors_url":"https://api.github.com/repos/Marwes/gluon/contributors","subscribers_url":"https://api.github.com/repos/Marwes/gluon/subscribers","subscription_url":"https://api.github.com/repos/Marwes/gluon/subscription","commits_url":"https://api.github.com/repos/Marwes/gluon/commits{/sha}","git_commits_url":"https://api.github.com/repos/Marwes/gluon/git/commits{/sha}","comments_url":"https://api.github.com/repos/Marwes/gluon/comments{/number}","issue_comment_url":"https://api.github.com/repos/Marwes/gluon/issues/comments{/number}","contents_url":"https://api.github.com/repos/Marwes/gluon/contents/{+path}","compare_url":"https://api.github.com/repos/Marwes/gluon/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Marwes/gluon/merges","archive_url":"https://api.github.com/repos/Marwes/gluon/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Marwes/gluon/downloads","issues_url":"https://api.github.com/repos/Marwes/gluon/issues{/number}","pulls_url":"https://api.github.com/repos/Marwes/gluon/pulls{/number}","milestones_url":"https://api.github.com/repos/Marwes/gluon/milestones{/number}","notifications_url":"https://api.github.com/repos/Marwes/gluon/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Marwes/gluon/labels{/name}","releases_url":"https://api.github.com/repos/Marwes/gluon/releases{/id}","deployments_url":"https://api.github.com/repos/Marwes/gluon/deployments","created_at":"2015-08-02T12:35:56Z","updated_at":"2016-08-09T07:30:16Z","pushed_at":"2016-08-09T02:35:26Z","git_url":"git://github.com/Marwes/gluon.git","ssh_url":"git@github.com:Marwes/gluon.git","clone_url":"https://github.com/Marwes/gluon.git","svn_url":"https://github.com/Marwes/gluon","homepage":"","size":7293,"stargazers_count":460,"watchers_count":460,"language":"Rust","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":12,"mirror_url":null,"open_issues_count":48,"forks":12,"open_issues":48,"watchers":460,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Marwes/gluon/pulls/103"},"html":{"href":"https://github.com/Marwes/gluon/pull/103"},"issue":{"href":"https://api.github.com/repos/Marwes/gluon/issues/103"},"comments":{"href":"https://api.github.com/repos/Marwes/gluon/issues/103/comments"},"review_comments":{"href":"https://api.github.com/repos/Marwes/gluon/pulls/103/comments"},"review_comment":{"href":"https://api.github.com/repos/Marwes/gluon/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Marwes/gluon/pulls/103/commits"},"statuses":{"href":"https://api.github.com/repos/Marwes/gluon/statuses/08bf5ed75545ae02567b8c403a66121ff8e504a7"}}}}
{"actor":{"display_login":"brendanzab"}}