Giter Club home page Giter Club logo

parseclj's People

Contributors

bbatsov avatar dawranliou avatar ikappaki avatar plexus avatar r0man avatar tarsius avatar vemv avatar volrath avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

parseclj's Issues

`(void-function key)`

This is an error report I worked out with @lambdam privately.

He's facing the following when performing clj-refactor.el cljr-slash:

Debugger entered--Lisp error: (void-function key)
  key((inst uuid))
  parseclj-alist-merge(((inst . #f(compiled-function (s) #<bytecode 0x19c8fd5>)) (uuid . #f(compiled-function (s) #<bytecode 0x19c8fe1>))) nil)
  parseedn-reduce-branch((ig-repl ((:token-type . :lbrace) (:form . "{") (:pos . 7)) :clj ((:token-type . :lbrace) (:form . "{") (:pos . 1))) ((:token-type . :lparen) (:form . "(") (:pos . 16)) (integrant\.repl) ((:tag-readers)))
  parseclj--reduce-coll((integrant\.repl ((:token-type . :lparen) (:form . "(") (:pos . 16)) ig-repl ((:token-type . :lbrace) (:form . "{") (:pos . 7)) :clj ((:token-type . :lbrace) (:form . "{") (:pos . 1))) ((:token-type . :rparen) (:form . ")") (:pos . 31)) parseedn-reduce-branch ((:tag-readers)))
  parseclj-parser(parseedn-reduce-leaf parseedn-reduce-branch ((:tag-readers)))
  parseedn-read(nil)
  parseedn-read-str("{:clj {ig-repl (integrant.repl), d (datomic.api)}, :cljs {}}")
  cljr--call-middleware-for-namespace-aliases()
  eval((cljr--call-middleware-for-namespace-aliases) nil)
  eval-expression((cljr--call-middleware-for-namespace-aliases) nil nil 127)
  funcall-interactively(eval-expression (cljr--call-middleware-for-namespace-aliases) nil nil 127)
  call-interactively(eval-expression nil nil)
  command-execute(eval-expression)

This resonates with various error reports so it would be quite crucial to come up with a fix.

Dependency a.el still required

First of all, thanks for making this package!

The recent commit 089160a has dropped a.el from the list of declared dependencies, but the code still requires it. I can't tell for sure whether the require is actually needed or just a leftover from before the inlining - dropping it from parseclj-ast.el and parseclj-parser.el doesn't cause errors for me.

Device 1 is not a termcap terminal device

Hi! Thanks for your work on parseclj and parseedn. I’m still a novice at Emacs and hope you can help me. Also, I wasn’t sure in which repository to file this issue, but I suspect this one is where the problem originates.

I’ve installed the parseedn package and tried to use it on a simple value, like this:

(parseclj-read-str "42")

It gives me no result and the following message:

Device 1 is not a termcap terminal device

Same for parseclj-read-str, parseedn-print-str and parseclj-print-str.

I’m using Emacs Doom on NixOS with Emacs daemon (but I tried it without daemon running and the effect was the same).

(emacs-version)

GNU Emacs 27.2 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.27, cairo version 1.16.0)

I’ve installed the package by adding the following to my ~/.doom.d/packages.el.

(package! parseclj
    :recipe (:host github :repo "clojure-emacs/parseclj"))

(package! parseedn
    :recipe (:host github :repo "clojure-emacs/parseedn"))

Any help will be appreciated.

Enhance the README a bit

I'd move the intro of the design document to the README (and maybe some other parts of it) and link to the document from there. Otherwise people checking out the project might omit a lot of interesting and important information about it.

Better handling of invalid tokens

Currenty, when there's an invalid token, the lexer returns: (concat ":(" (char-to-string char)), and keeps the cursor at the same position where it was before. This behavior mixed with the fact that parseclj-parse loops calling parseclj-lex-next until it reaches :eof, makes up for infinite loop freezing when there are invalid tokens in the text to parse.

I'm opening this issue since I'm not entirely sure what was the decision behind not having the lexer raise on invalid tokens. Would it be better to raise in the parser?

Parser should error on unmatched closing paren/brace

e.g. I would have expected the following example with an unmatched closing brace

(require 'parseclj)
(cl-prettyprint (parseclj-parse-clojure "{:a 1}}"))

to give an error such as "At position 7, unmatched :rbrace",

but it returns an emtpy AST

((:node-type . :root)
 (:position . 1)
 (:children ((:node-type) (:position) (:children))))

Can't parse symbols with pipe chars

Hi,

the parser fails to parse symbols or keywords containing the pipe | char, which is otherwise a valid symbol char in Clojure:

user> {:one|two 'three|four}
{:one|two three|four}

To reproduce, eval the following

  1. (parseclj-parse-clojure ":one|two")
  2. the following error is raised
(parseclj-parser-error ("Invalid token at 5: \"|\""))

Tiny PR to follow, thanks.

Parse in boundaries

I'm currently in the need of parsing just a fraction of a buffer, so I thought on changing the signature of parseclj-parse-clojure to something like:

(defun parseclj-parse-clojure (&optional bounds-or-string options)
  ...)

bounds-or-string can be either a list (or cons) with positions/markers, a string that will be put into a temp buffer and scanned from (point-min) to (point-max), or nil, in which case just scans from (point) til the end (current default behavior)

I wanted to hear your thoughts on it before implementing.

My temporary solution is to use narrowing:

(save-excursion
  (goto-char (car bounds))
  (apply #'narrow-to-region bounds)
  (prog1 (parseclj-parse-clojure)
    (widen)))

But I think it's not ideal.

Caching for Repeated Parsing

I'm working on a performance-critical project that requires repeated parsing with parseclj. I'm interested in knowing whether there's built-in support for caching parsed results. If not, would memoization be an effective way to add this feature? Additionally, are there any caveats or issues to be aware of when implementing caching in conjunction with parseclj? If there's any places I should look, let me know.

Thanks!

Backlog

  • Syntax features
    • regular expressions
    • hexadecimals (0x...)
    • namespaced maps
    • metadata
    • #=(...)
    • #?() / #?@()
    • quote / backquote / unquote / splice
    • var literal #'
  • parseedn
    • lossless output format
    • unify string/buffer usage (optional first string arg)
    • raise errors on non-EDN syntax
  • parseclj-ast
    • implement parseclj-ast-value
    • zippers / AST traversal helpers
  • General
    • Add more docstrings
    • propagate lex errors when :fail-fast

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.