-
Notifications
You must be signed in to change notification settings - Fork 14
Add docstrings and follow up on some conventions #9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Also moves string/char parsing functions to `parseedn`.
Place unparse logic in `parseclj-ast`.
@@ -103,6 +186,8 @@ handlers as an optional argument to the reader functions.") | |||
(parseedn-print-kvs next))))) | |||
|
|||
(defun parseedn-print (datum) | |||
"Insert DATUM as EDN into the current buffer. | |||
DATUM can be any Emacs Lisp value." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this true? not entirely sure. If it isn't, maybe we should add a t
clause at the end that catches possible errors.
parseedn.el
Outdated
(require 'parseclj-lex) | ||
|
||
(defun parseedn--string (s) | ||
"" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Intentionally left this one blank. Not quite sure I understand everything going on here and I thought it was better to ask you for clarification. Maybe we could add some one-line comments to each of the replace-regexp-string
s as well.
(if (parseclj-lex-at-eof?) | ||
"Consume characters at point and return the next lexical token. | ||
|
||
See `parseclj-lex-token'." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really happy with this docstring, I feel it should have a little bit more content, but I'm not sure what else to put here. thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some other extra comments.
This commit also moves `leaf-token-value` to `parseclj-lex`
According to our conversation yesterday, I moved the shift/reduce parser to its own module. Called it I also moved the Now |
Reduction was returning only the reduced tag without the rest of the stack, so all previous elements were lost.
Fix `parseclj-ast--reduce-branch` for tags.
A few things to notice:
parseclj--leaf-tokens
andparseclj--closing-tokens
toparseclj-lex.el
, since tokens are lexical structures.parseclj--string
,parseclj--character
andparseclj--leaf-token-value
toparseedn.el
. Reasoning behind it is that these function produce emacs lisp values, which goes with everything else inparseedn
.format-message
messages should start with capital letters, and I didn't thinkparseclj:
should be capitalized.) After reading through the Signaling Errors documentation, I started thinking that maybe we should take a different approach with the way we are signaling. Maybe instead of providing a single string message, we provide a tuple of position (int) and message (str). This way is more similar to other errors likewrong-type-argument
orwrong-number-of-arguments
. Also, documentation says that:And
parseclj-parse-error
's message is already"parseclj: Syntax Error"
. But I'm not 100% sure if this covers everything we want from an error message.parseclj-unparse
. These functions are only for unparsing our AST data structure definition anyway.