Skip to content
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

Added \\ processing, fixed parsing bug #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Kalimehtar
Copy link

@Kalimehtar Kalimehtar commented Jun 25, 2020

There was a bug.

list 1 2 3
  list 4 5

raised a error, because it was parsed as (list 1 2 3 (list 4 . 5))
Now it's fixed.

And now \ can be not only an empty head, but also can be used to split a list.

let
  \\
    a 1 \\ b 2 \\ c 3
  {a + b + c}

or

map $ lambda (x) {1 / x} \\ '(1 2 3)

Theare was a bug.
```
list 1 2 3
  list 4 5
```
raised a error, because it was parsed as (list 1 2 3 (list 4 . 5))
Now it's fixed.

And now \\ let not only be an empty head, but alsu can be used to slit a list.
```
let
  \\
    a 1 \\ b 2 \\ c 3
  {a + b + c}
```
or
```
map $ lambda (x) {1 / x} \\ '(1 2 3)
```
@AlexKnauth
Copy link
Collaborator

In what situation did that nested list expression parse as (list 1 2 3 (list 4 . 5))?

I'm having trouble reproducing that bug:

#lang sweet-exp racket
list 1 2 3
  list 4 5

produces (list 1 2 3 (list 4 5)) as expected.

@Kalimehtar
Copy link
Author

Delete last newline. If "5" is the last character of the file, then branch [(eof-object? rest) (cons new-level first)] returns item, while a list is expected.

@AlexKnauth AlexKnauth self-assigned this Jul 30, 2022
@AlexKnauth
Copy link
Collaborator

AlexKnauth commented Jul 30, 2022

The precedence between $ sublist and \\ split is off. I thought something like

map $ lambda (x) {1 / x} \\ '(1 2 3)

was supposed to parse as

(map (lambda (x) (/ 1 x)))
'(1 2 3)

and not as

(map (lambda (x) (/ 1 x))
     '(1 2 3))

@Kalimehtar
Copy link
Author

Then raise block [(e1 ... (~and $ (~datum $)) e2 ...) ...] before [(before ... (e1 (~literal \\) e2) after ...). It will switch the precedence.

@Kalimehtar
Copy link
Author

I'm wrong. \\ processed (in my commit) first, so map $ lambda (x) {1 / x} \\ '(1 2 3) is really

map $ lambda (x) {1 / x}
'(1 2 3)

@AlexKnauth
Copy link
Collaborator

Okay. This definitely needs some tests then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants