vim-crunch icon indicating copy to clipboard operation
vim-crunch copied to clipboard

add expression separator `;` to support one line variable

Open hiberabyss opened this issue 7 years ago • 7 comments

hiberabyss avatar May 21 '18 19:05 hiberabyss

Nice idea, please add an small example of using this to the docs and a simple test. Let me know if you have any questions.

arecarn avatar May 23 '18 03:05 arecarn

@arecarn Add an example in doc and also a test case.

hiberabyss avatar May 23 '18 16:05 hiberabyss

Hi @arecarn , any update for this PR?

hiberabyss avatar Jun 04 '18 02:06 hiberabyss

Hi @hiberabyss I don't have any updates yet, but I will get to it soon.

arecarn avatar Jun 04 '18 23:06 arecarn

@hiberabyss I finally got a chance to look at this and found it doesn't play well with the evaluation of expressions that with a crunch comments.

e.g.

" a = 1; b = 2; a + b

evaluates to

" a = 1; b = 2; a + b = Crunch error: value for a not found;

I would expect nothing to happen since this should be a comment that gets ignored by crunch.

" a = 1; b = 2; a + b

I also don't feel the motivation to dig into this feature to make it work in all cases. The good news is that someday I would like creating an actual parser for crunch and it would include semicolons to separate expression on a single line.

arecarn avatar Jun 17 '18 04:06 arecarn

Hi @arecarn , for this case, I think the comment lines and invalid lines should be removed before evaluating.

hiberabyss avatar Jun 19 '18 00:06 hiberabyss

@hiberabyss good point.

arecarn avatar Jun 22 '18 15:06 arecarn