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

kw expansion doesn't work if trying to Insert compound expression all at once #41

Open
disconcision opened this issue Nov 4, 2024 · 3 comments

Comments

@disconcision
Copy link
Member

Trying to parse whole expressions from strings. simple infix sequences and parens seem to work, but nothing else.

If I try to do Edit.perform(Insert("let x "), Zipper.empty) I get "let >< x" (infix grout), and if I try Edit.perform(Insert("let x ="), Zipper.empty) it crashes with:

--- Stack.link/failed neq assert ---
14:53:46.395 +fs_fake.js:333 t = >_|_<
14:53:46.397 +fs_fake.js:333 sw = [(Tile
    (Pat,
     { rctx =
       [(T 'case') (NT Exp) (T '|') • (T '=>') (NT Exp) ((T '|') (NT Pat)
         (T '=>') (NT Exp))*];
14:53:46.397 +fs_fake.js:333        prec = 1; sort = Exp }))]
14:53:46.398 +fs_fake.js:333 c = {cursor: , obligs: [1] -> (Grout (Pat, (Conv, Conv)))
 , dirty: [0; 0] ->  
 [0; 2] ->  
 [2] ->  
14:53:46.399 +fs_fake.js:333  , degrouted: false | {{} "_" {}} <> {}}
14:53:46.399 +fs_fake.js:333 stack = { slope = []; bound = ROOT }

14:53:46.400 +fs_fake.js:333   (Failure "expected neq swing")

not totally sure this is actually supported... should i be dividing into tokens and feed it in iteratively?

@dm0n3y
Copy link
Contributor

dm0n3y commented Nov 4, 2024

hmm that's unexpected. let's see if we can work around it for now. try calling Labeler.label on the string to get a list(Token.Unmolded.t), each of which will have a .text field to get the individual lexeme text to pass with the Insert action.

@disconcision
Copy link
Member Author

It works! with some caveats. still can't parse expressions with nested expanding kw forms due to #42, eg:

parse("let f = fun z -> 9 in f(9)")

results in

Screenshot 2024-11-04 at 4 38 30 PM

i tried working around this by having multiple spaces in the parse string but it doesn't work

@dm0n3y
Copy link
Contributor

dm0n3y commented Nov 4, 2024

cool. looking at #42 now.

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

No branches or pull requests

2 participants