Skip to content

Fixes #8 by allowing quotes in string fields instead of ignoring then#39

Open
rddtz wants to merge 1 commit intomasterfrom
iss8
Open

Fixes #8 by allowing quotes in string fields instead of ignoring then#39
rddtz wants to merge 1 commit intomasterfrom
iss8

Conversation

@rddtz
Copy link
Collaborator

@rddtz rddtz commented Jan 14, 2026

This pull request attempts to resolve issue #8.

The problem

The behavior of pj_dump parser was to ignore any quotes. For example, the content of this file (links.trace):

...
0 PROCESS 0 "PROCESS"
4 LINK 0 PROCESS PROCESS "LINK"
6 0.000000000 p1 PROCESS 0 "p1"
6 0.000000000 p2 PROCESS 0 "p2"
6 0.000000000 p3 PROCESS 0 "p3"
16 0.240000000 0 LINK p1 c myKey-001
19 1.020000000 0 LINK p2 c myKey-001
16 1.040000000 0 LINK p1 c myKey-002
19 2.100000000 0 LINK p3 c myKey-002

would be dumped as follows by pj_dump:

Container, 0, 0, 0, 2.1, 2.1, 0
Link, 0, LINK, 0.240000, 1.020000, 0.780000, c, p1, p2, myKey-001
Link, 0, LINK, 1.040000, 2.100000, 1.060000, c, p1, p3, myKey-002
Container, 0, PROCESS, 0, 2.1, 2.1, p3
Container, 0, PROCESS, 0, 2.1, 2.1, p2
Container, 0, PROCESS, 0, 2.1, 2.1, p1

It is possible to see that even though there is quotes in the definitions ("PROCESS", "LINK", "p1", "p2" and "p3"), the quotes vanished (were ignored) when parsed by the standard pj_dump parser. This behavior caused the problem seen on issue #8. By using the flex parser option --flex, the quotes are not ignored, meaning that the quotes presents in the pj file definition are still there after the pj_dump, to exemplify here is the output of pj_dump --flex links.trace:

Container, 0, 0, 0, 2.1, 2.1, 0
Link, 0, "LINK", 0.240000, 1.020000, 0.780000, c, "p1", "p2", myKey-001
Link, 0, "LINK", 1.040000, 2.100000, 1.060000, c, "p1", "p3", myKey-002
Container, 0, "PROCESS", 0, 2.1, 2.1, "p3"
Container, 0, "PROCESS", 0, 2.1, 2.1, "p2"
Container, 0, "PROCESS", 0, 2.1, 2.1, "p1"

It is possible to see that the quotes weren't ignored this time, and because of this it worked as workaround to solve this problem.

Changes made

As I think that makes sense to keep the quotes when it appears in the paje file, this pull request make small changes in the event decoder in order to the output to keep the quotes.

It was necessary to change the test also, because the tests results also expected the quotes to be ignored. So I used the current version with the --flex option to replace the output of the tests by the one that didn't ignore the quotes.

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.

1 participant