{"id":15941452,"url":"https://github.com/clojure-emacs/parseclj","last_synced_at":"2025-03-16T07:31:40.975Z","repository":{"id":22472951,"uuid":"94609391","full_name":"clojure-emacs/parseclj","owner":"clojure-emacs","description":"Clojure Parser for Emacs Lisp","archived":false,"fork":false,"pushed_at":"2023-12-03T19:05:22.000Z","size":254,"stargazers_count":60,"open_issues_count":4,"forks_count":14,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-02-27T05:24:36.588Z","etag":null,"topics":["ast","clojure","clojure-parser","emacs","emacs-lisp"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clojure-emacs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2017-06-17T07:59:08.000Z","updated_at":"2024-07-27T21:12:36.000Z","dependencies_parsed_at":"2023-12-03T20:19:59.101Z","dependency_job_id":"12472361-8079-41de-abf2-f15e843d0745","html_url":"https://github.com/clojure-emacs/parseclj","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojure-emacs%2Fparseclj","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojure-emacs%2Fparseclj/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojure-emacs%2Fparseclj/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clojure-emacs%2Fparseclj/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clojure-emacs","download_url":"https://codeload.github.com/clojure-emacs/parseclj/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243806032,"owners_count":20350773,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ast","clojure","clojure-parser","emacs","emacs-lisp"],"created_at":"2024-10-07T07:04:23.709Z","updated_at":"2025-03-16T07:31:40.675Z","avatar_url":"https://github.com/clojure-emacs.png","language":"Emacs Lisp","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/clojure-emacs/parseclj.svg?branch=master)](https://travis-ci.org/clojure-emacs/parseclj)\n\n# Clojure parser for Emacs Lisp\n\n`parseclj` is an Emacs Lisp library for parsing Clojure code and [EDN\ndata](https://github.com/edn-format/edn). It supports several input and output\nformats, all powered by the same shift-reduce parser function.\n\nTake a look at the [design document](DESIGN.md) for more details.\n\n`parseclj` is in **alpha** state right now, its API might be subject to change.\n\n## Installation\n\nAvailable on the major `package.el` community maintained repos -\n[MELPA Stable][] and [MELPA][] repos.\n\nMELPA Stable is the recommended repo as it has the latest stable\nversion.  MELPA has a development snapshot for users who don't mind\n(infrequent) breakage but don't want to run from a git checkout.\n\nYou can install `parseclj` using the following command:\n\n\u003ckbd\u003eM-x package-install [RET] parseclj [RET]\u003c/kbd\u003e\n\nor if you'd rather keep it in your dotfiles:\n\n```el\n(unless (package-installed-p 'parseclj)\n  (package-install 'parseclj))\n```\n\nIf the installation doesn't work try refreshing the package list:\n\n\u003ckbd\u003eM-x package-refresh-contents\u003c/kbd\u003e\n\n[melpa]: http://melpa.org\n[melpa stable]: http://stable.melpa.org\n\n## Usage\n\n`parseclj` contains function that return an\n[AST](https://en.wikipedia.org/wiki/Abstract_syntax_tree) that, for example,\ngiven as input `(1 2 [:a :b :c])`, it looks like this:\n\n``` emacs-lisp\n((:node-type . :root)\n (:position . 1)\n (:children ((:node-type . :list)\n             (:position . 1)\n             (:children ((:node-type . :number)\n                         (:position . 2)\n                         (:form . \"1\")\n                         (:value . 1))\n                        ((:node-type . :number)\n                         (:position . 4)\n                         (:form . \"2\")\n                         (:value . 2))\n                        ((:node-type . :vector)\n                         (:position . 6)\n                         (:children ((:node-type . :keyword)\n                                     (:position . 7)\n                                     (:form . \":a\")\n                                     (:value . :a))\n                                    ((:node-type . :keyword)\n                                     (:position . 10)\n                                     (:form . \":b\")\n                                     (:value . :b))\n                                    ((:node-type . :keyword)\n                                     (:position . 13)\n                                     (:form . \":c\")\n                                     (:value . :c))))))))\n```\n\nIn order to use any of these functions, you first need to require it:\n\n```emacs-lisp\n(require 'parseclj)\n```\n\nAnd then you will have the following functions at your disposal:\n\n- `parseclj-parse-clojure` \u0026rest string-and-options\n\n    When no arguments, parses Clojure source code into an AST and returns it.\n    When given a string as a first argument, parses it and returns the\n    corresponding AST.\n\n    A list of options can be passed down to the parsing process, particularly:\n    * `:lexical-preservation`: a boolean value to retain whitespace, comments,\n      and discards.  Defaults to nil.\n    * `:fail-fast`: a boolean value to raise an error when encountering invalid\n      syntax.  Defaults to t.\n\n    Examples:\n\n   ```emacs-lisp\n   (parseclj-parse-clojure) ;; will parse clojure code in the current buffer and return an AST\n   (parseclj-parse-clojure \"(1 2 3)\")  ;; =\u003e ((:node-type . :root) ... )\n   (parseclj-parse-clojure :lexical-preservation t) ;; will parse clojure code in current buffer preserving whitespaces, comments and discards\n   ```\n\n    \u003e Note: there's an open issue to extend this API to [parse clojure code within\n    \u003e some boundaries of a\n    \u003e buffer](https://github.com/clojure-emacs/parseclj/issues/13).  Pull requests\n    \u003e are welcome.\n\n- `parseclj-unparse-clojure` ast\n\n    Transform the given AST into Clojure source code and inserts it into the\n    current buffer.\n\n- `parseclj-unparse-clojure-to-string` ast\n\n    Transfrom the given AST into Clojure source code and returns it as a string.\n\n\n## License\n\n\u0026copy; 2017-2021 Arne Brasseur and contributors.\n\nDistributed under the terms of the GNU General Public License 3.0 or later. See\n[LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclojure-emacs%2Fparseclj","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclojure-emacs%2Fparseclj","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclojure-emacs%2Fparseclj/lists"}