-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Labels
Description
Parinfer is a lazy, partial reader— allowing it the opportunity to ignore most irrelevant differences between dialects, but it needs to support more specific dialect features
Parinfer assumes Clojure-like syntax— blowing past characters presumed to have no effect on parens and indentation. This allows some flexibility with other dialects, but eventually causes problems with other language features below:
See issues:
- Racket: support here-strings and reading-comments #172
- support for comment characters other than semicolon #195
- Allow unbalanced brackets in symbols #197
- Mishandling semicolon inside vertical bar literal oakmac/parinfer#16
Some dialects we look at:
- Racket
- Hy
- Common Lisp
- Janet
- Pico Lisp
- Scheme
- Fennel (should be identical to clj syntax)
Here-strings
strings delimited by custom phrases
- Racket:
#<<FOO\n ... \nFOO>>\ndoc-racket-here - Hy:
#[FOO[ ... ]FOO]doc-hy-here
Multi-line strings
- Janet:
`or``doc-janet-multi
Nestable block comments
may be nested, unlike in C /*.../*...*/...*/)
- Racket:
#|...|#doc-racket-block - Common Lisp:
#|...|#doc-cl-block - Pico Lisp:
#{...}#doc-pico-block
Bracket types
- Common Lisp: only
()are significant— allowing unbalanced{[in symbols doc-cl-bracket
Comment lines
- Janet:
# ...doc-janet-comment
Comment forms
A preceding # can re-interpret the usual ; comment as commenting the next form instead of to the end of line:
- Racket/Scheme:
#; ...doc-racket-comment-form and R6RS Scheme
Literal symbols
pipes |...| allow special characters inside symbols. Sometimes \| is allowed inside (CL, not Racket):
- Racket:
|foo;bar(baz|orfoo|;|bar|(|bazdoc-racket-pipe, doc-racket-pipe-sym - Common Lisp:
|foo;\|bar(baz|doc-cl-pipe
Reactions are currently unavailable