Skip to content

add expression separator ; to support one line variable#55

Open
hiberabyss wants to merge 8 commits into
arecarn:masterfrom
hiberabyss:master
Open

add expression separator ; to support one line variable#55
hiberabyss wants to merge 8 commits into
arecarn:masterfrom
hiberabyss:master

Conversation

@hiberabyss

Copy link
Copy Markdown

No description provided.

@arecarn

arecarn commented May 23, 2018

Copy link
Copy Markdown
Owner

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
Copy Markdown
Author

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

Comment thread autoload/crunch.vim
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Author

Hi @arecarn , any update for this PR?

@arecarn

arecarn commented Jun 4, 2018

Copy link
Copy Markdown
Owner

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

@arecarn

arecarn commented Jun 17, 2018

Copy link
Copy Markdown
Owner

@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

hiberabyss commented Jun 19, 2018

Copy link
Copy Markdown
Author

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

@arecarn

arecarn commented Jun 22, 2018

Copy link
Copy Markdown
Owner

@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