Skip to content
This repository was archived by the owner on May 5, 2023. It is now read-only.

Conversation

@stsewd
Copy link
Contributor

@stsewd stsewd commented Aug 20, 2021

Fields are more of an identifier rather than an expression, I have renamed it to reflect this.

@stsewd stsewd marked this pull request as draft August 21, 2021 02:29
@stsewd
Copy link
Contributor Author

stsewd commented Aug 21, 2021

Found a bug with

let a = ',' .b. ','

or smaller example

let a = b.'.'

but it works if there is a space

let a = b .'.'

@stsewd stsewd force-pushed the fix-identifiers branch 2 times, most recently from a908fb3 to 3a4d04f Compare August 21, 2021 03:09
@stsewd
Copy link
Contributor Author

stsewd commented Aug 21, 2021

OK, I give up for today, in vimscript the . operator kind of depends on the expression being evaluated... This is the result with this change:

let a = foo.bar. ''  " This breaks, but in vimscript it's a concatenation
let a = foo.bar.''  " This breaks, but in vimscript it's a concatenation
let a = foo.bar . ''  " This is ok
let a = foo.bar . baz  " This is ok
let a = foo.bar .baz  " This is ok
let a = foo.bar. baz  " This is marked as a field, but in vimscript it's a concatenation

Previously this was

let a = foo.bar. ''  " This is marked as a field with a string as value.
let a = foo.bar.''  " This is marked as a field with a string as value.
let a = foo.bar . ''  " This is ok
let a = foo.bar . baz  " This is ok
let a = foo.bar .baz  " This is ok
let a = foo.bar. baz  " This is marked as a field, but in vimscript it's a concatenation

I'll try to play more whit this in the following days....

Copy link
Owner

@vigoux vigoux left a comment

Choose a reason for hiding this comment

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

I am quite against that tbh, the docs specify that fields are actually expressions, thus that's what they should be.

@vigoux
Copy link
Owner

vigoux commented Aug 22, 2021

Fields are horrible to work with because the . operator is type sensitive

@stsewd
Copy link
Contributor Author

stsewd commented Aug 23, 2021

the docs specify that fields are actually expressions

That isn't what the docs say, this is what they say

	expr8.name		entry in a |Dictionary|

Only the first part is an expression, the second part after that is a name, not an expression.

@vigoux
Copy link
Owner

vigoux commented Aug 23, 2021

Indeed you are right.

@vigoux
Copy link
Owner

vigoux commented Aug 23, 2021

But in any case I preffer having the field_expression to help quering the tree, the more we avoid repetitions, the better.

Comment on lines -551 to +545
field_expression: ($) =>
field: ($) =>
Copy link
Owner

Choose a reason for hiding this comment

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

I don't see the point of renaming this appart from breaking backward compatibility.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants