-
Notifications
You must be signed in to change notification settings - Fork 12
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
More atom types #2
Comments
You're right. That is annoying. I'll see what I can do to fix it. |
Any progress on this? If not, would you like me to write a PR for it? |
Uhh sure. Sorry this fell off my stack. I had some uncommitted code that I now no longer recognize. A pr would be most welcome. |
My current implementation adds a new atom |
I don't think so. Now that I think about it, I'm not sure I want a different representation for |
Real Lisps tend to make |
Clojure for example just doesn't give you a syntax for a symbol with whitespace in it. You can construct them programmatically |
Hey, sorry to necro-bump this issue. I am considering using this crate as the basis for some SEXP based communication in a client/server architecture. SEXP are much nicer than JSON, and I love Scheme in case my motives are intriguing. I was thinking that the @porglezomp you basically said as much already, but I wanted to emphasize how Anyway, I too would like a true difference between symbols and strings (perhaps even keyword, but that likely escapes the scope of this project). So, @cgaebel do you intend to be active on this crate anymore, and would you still like a PR? Finally, I am willing to put work into this, but I should state that I think the Anyway, cheers, and excellent foundational work on this! |
I think my eventual solution here was I just wrote my own S-expression crate, ess. You can see if that already serves your needs, or if you'd need changes there too. |
@porglezomp thank you. I like how you keep the source location. Your crate seems an ideal starting point for language parsing in order to tell the user the location of errors. My parser focuses on providing a type hierarchy and translation into a simple IR that can be used for simple data marshalling or for compilation (but compilers will lose source location after Anyway, I am gonna have my crate public later this week I think. I will drop a link here if you want to see it. |
Work around Sexp crate issue with handling quotes The sexp crate has a bug around handling quoted strings that makes it impossible to differentiate between a quoted and an unquoted string. cgaebel/sexp#2 The short version is that quotes are added on output strings based on heuristics that include the presence of quotes in the original string, so giving a quoted string to sexp yields a doubly quoted string, and giving an unquoted string yields an unquoted string, resulting in no way to generate a Sexp structure that will output a quoted string with the Display trait, unless that string meets one of the following criteria: 1. Contains a quote 2. Contains whitespace 3. Is a number For CIL filecon statements, we need to include quoted strings, which meet none of these criteria. The sexp crate project appears to be abandoned, so a PR will not be fruitful. Rather than higher level of effort approaches such as forking the project or migrating to a different sexp crate, this commit simply works around the issue by adding a simple new display function that does no quote special handling. This requires us to manage quotes internally, but that's really what we want anyways."
Currently it seems impossible to distinguish when an atom was quoted or unquoted, which is annoying for use in a lot of different contexts. It'd be nice to be able to distinguish
(print "hello")
from(print hello)
.The text was updated successfully, but these errors were encountered: