Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Conversation

@dennwc
Copy link
Member

@dennwc dennwc commented May 30, 2019

Fix Unicode positions. Ideally this PR should also enable enable the token verifier, but it's not possible right now due to the way AST is structured. Some work in SDK is required to make it work.

Signed-off-by: Denys Smirnov [email protected]


This change is Reviewable

Signed-off-by: Denys Smirnov <[email protected]>
@dennwc dennwc requested review from bzz and creachadair May 30, 2019 10:42
@dennwc dennwc self-assigned this May 30, 2019
Copy link
Contributor

@creachadair creachadair left a comment

Choose a reason for hiding this comment

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

Reviewed 8 of 8 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @dennwc)


driver/fixtures/fixtures_test.go, line 37 at r1 (raw file):

		},
	},
	// TODO: This won't really work because of the C++ macros expansion.

I don't quite follow: Of course macro expansions affect position, but if the AST we generate doesn't expand the macro anyway aren't the locations correct?

Copy link
Member Author

@dennwc dennwc left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @creachadair)


driver/fixtures/fixtures_test.go, line 37 at r1 (raw file):

Previously, creachadair (M. J. Fromberger) wrote…

I don't quite follow: Of course macro expansions affect position, but if the AST we generate doesn't expand the macro anyway aren't the locations correct?

Turned out it does expand macros that are in the same file. It sill preserves the AST structure for it but breaks the positional info that we use.

To give an example, there was a macro that joins two values, so the source line is JOIN(3, 4). But the preprocessor actually replaces it with a string 34, so the token verification gets confused and can't verify it based on the source file.

So maybe other positional info is also incorrect for files that use macros.

Copy link
Contributor

@creachadair creachadair left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


driver/fixtures/fixtures_test.go, line 37 at r1 (raw file):

Previously, dennwc (Denys Smirnov) wrote…

Turned out it does expand macros that are in the same file. It sill preserves the AST structure for it but breaks the positional info that we use.

To give an example, there was a macro that joins two values, so the source line is JOIN(3, 4). But the preprocessor actually replaces it with a string 34, so the token verification gets confused and can't verify it based on the source file.

So maybe other positional info is also incorrect for files that use macros.

Urk, that's a little scary. I wonder if we can disable macro expansion entirely rather than have it depend on where the definition resides. Not a topic for this PR, though.

Copy link
Member Author

@dennwc dennwc left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved


driver/fixtures/fixtures_test.go, line 37 at r1 (raw file):

Previously, creachadair (M. J. Fromberger) wrote…

Urk, that's a little scary. I wonder if we can disable macro expansion entirely rather than have it depend on where the definition resides. Not a topic for this PR, though.

Opened an issue for it: #41

@dennwc dennwc merged commit bb726b6 into bblfsh:master May 30, 2019
@dennwc dennwc deleted the fix_unicode branch May 30, 2019 16:36
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.

3 participants