Skip to content

add expression separator ; to support one line variable #55

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

hiberabyss
Copy link

No description provided.

@arecarn
Copy link
Owner

arecarn commented May 23, 2018

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.

@hiberabyss
Copy link
Author

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

@@ -78,7 +78,10 @@ function! crunch#eval(exprs) abort "{{{2
" Decho '== Inizilation =='
let s:variables = deepcopy(g:crunch_user_variables, 0)

let expr_list = split(a:exprs, '\n', 1)
let separator_magic = "\t \t \t\n"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to study this a bit before the merge and see if it's possible to not use the magic separator.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I didn't get any better method to remember the positions of ; and \n.

@hiberabyss
Copy link
Author

Hi @arecarn , any update for this PR?

@arecarn
Copy link
Owner

arecarn commented Jun 4, 2018

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

@arecarn
Copy link
Owner

arecarn commented Jun 17, 2018

@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 arecarn closed this Jun 17, 2018
@hiberabyss
Copy link
Author

hiberabyss commented Jun 19, 2018

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

@arecarn
Copy link
Owner

arecarn commented Jun 22, 2018

@hiberabyss good point.

@arecarn arecarn reopened this Jun 22, 2018
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