Skip to content
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

dump_scan_token prints KEY twice #65

Open
geert56 opened this issue Dec 30, 2022 · 11 comments
Open

dump_scan_token prints KEY twice #65

geert56 opened this issue Dec 30, 2022 · 11 comments

Comments

@geert56
Copy link

geert56 commented Dec 30, 2022

I assume that dump_scan_token in fy-tool.c in case of FYTT_VALUE should print VALUE or something like that, but not KEY.

@geert56
Copy link
Author

geert56 commented Jan 3, 2023

And I just learned that also BLOCK_ENTRY is printed both in case of FYTT_BLOCK_ENTRY and
FYTT_FLOW_ENTRY. I assume the latter must print FLOW_ENTRY?

@pantoniou
Copy link
Owner

Token scan mode is just a debugging aid. Are you trying to create a new YAML parser or something?

The interface is completely private and the documentation of the methods clearly state that this is just for YAML implementers.

@geert56
Copy link
Author

geert56 commented Feb 7, 2023

I am just pointing out what I think to be minor errors in the code. They probably would not affect regular use.
But I am interested to use fy-tool to generate the tokens output and in that case the indicated errors do cause the wrong output.

@pantoniou
Copy link
Owner

If you can share the input that causes this behavior we can have more concrete data to talk about.

@geert56
Copy link
Author

geert56 commented Feb 7, 2023

In master libfyaml/src/tool/fy-tool.c:

	case FYTT_BLOCK_ENTRY:
		if (colorize)
			fputs(A_BRIGHT_CYAN, stdout);
		printf("BLOCK_ENTRY");
		break;
	case FYTT_FLOW_ENTRY:
		if (colorize)
			fputs(A_BRIGHT_YELLOW, stdout);
		printf("BLOCK_ENTRY");

@pantoniou
Copy link
Owner

Oh, yeah, that's a bug - file a PR

As I said this is just a debugging aid, never been used for anything besides that until now.

@geert56
Copy link
Author

geert56 commented Feb 7, 2023

Same file fy-tool.c:

	case FYTT_KEY:
		if (colorize)
			fputs(A_BRIGHT_YELLOW, stdout);
		printf("KEY");
		break;
	case FYTT_VALUE:
		if (colorize)
			fputs(A_BRIGHT_YELLOW, stdout);
		printf("KEY");

@geert56
Copy link
Author

geert56 commented Feb 7, 2023

fy-tool is a great tool for YAML analyzers and processors. Useful to use in some AI pipeline to feed a model with YAML code.

@pantoniou
Copy link
Owner

pantoniou commented Feb 7, 2023 via email

@geert56
Copy link
Author

geert56 commented Feb 7, 2023

Am I allowed to create a pull request? I am trying to push my issue65 branch but am getting permission denied.

@pantoniou
Copy link
Owner

pantoniou commented Feb 7, 2023 via email

geert56 added a commit to geert56/libfyaml that referenced this issue Feb 7, 2023
geert56 added a commit to geert56/libfyaml that referenced this issue Feb 7, 2023
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

No branches or pull requests

2 participants