libfyaml icon indicating copy to clipboard operation
libfyaml copied to clipboard

dump_scan_token prints KEY twice

Open geert56 opened this issue 2 years ago • 11 comments

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 avatar Dec 30 '22 02:12 geert56

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?

geert56 avatar Jan 03 '23 22:01 geert56

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.

pantoniou avatar Feb 07 '23 05:02 pantoniou

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.

geert56 avatar Feb 07 '23 14:02 geert56

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

pantoniou avatar Feb 07 '23 14:02 pantoniou

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");

geert56 avatar Feb 07 '23 14:02 geert56

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.

pantoniou avatar Feb 07 '23 14:02 pantoniou

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 avatar Feb 07 '23 14:02 geert56

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.

geert56 avatar Feb 07 '23 14:02 geert56

Sure, but the scan token interface is completely non-standard.

The event interface is probably what you need.

On Tue, Feb 7, 2023 at 4:50 PM Geert Janssen @.***> wrote:

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.

— Reply to this email directly, view it on GitHub https://github.com/pantoniou/libfyaml/issues/65#issuecomment-1420901125, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQGJWWBN36KVEB6KAAMKFLWWJOKVANCNFSM6AAAAAATMRS3P4 . You are receiving this because you commented.Message ID: @.***>

pantoniou avatar Feb 07 '23 15:02 pantoniou

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

geert56 avatar Feb 07 '23 16:02 geert56

You need to fork and create the PR from your fork.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork

On Tue, Feb 7, 2023 at 6:16 PM Geert Janssen @.***> wrote:

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

— Reply to this email directly, view it on GitHub https://github.com/pantoniou/libfyaml/issues/65#issuecomment-1421040120, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQGJWT2WTOFKCM2X4LB4YTWWJYNLANCNFSM6AAAAAATMRS3P4 . You are receiving this because you commented.Message ID: @.***>

pantoniou avatar Feb 07 '23 17:02 pantoniou