phoenix-pilot / phoenix-pilot-core

2 stars 0 forks source link

Incorrect regex patterns #186

Closed kemonats closed 1 year ago

kemonats commented 1 year ago

Examples that are considered correct

@STRUCT;1 HEADER="STRUCT;1"

@STRUCT=1 FIELD_NAME="@STRUCT" VALUE="1"

INT1===1 FIELD_NAME="INT1==" VALUE="1"

@2STRUCT1 Whether the first character can be a digit?

In addition, the line type check can be simplified. Since the input file has a simple format , you can do parsing without using regex, it will probably be faster.

By the way, for which processors it is provided.

PNieck commented 1 year ago

Most of these example are not consistent with our file syntax

First character can be a digit

PNieck commented 1 year ago

As for the processors in this project we use armv7a9-zynq7000(Xilinx Zynq 7000)

kemonats commented 1 year ago

That is why I showed them that they do not conform to your file syntax and are considered appropiate.

First example: line = @STRUCT;1\n

#define WORD "[A-Za-z0-9_.,-\\+]"
#define HEADER_PATTERN "^[[:space:]]*@(" WORD "+)[[[:space:]]*(#.*)?[[[:space:]]*$"

substituting WORD we have

HEADER_PATTERN "^[[:space:]]*@([A-Za-z0-9_.,-\\+]+)[[:space:]]*(#.*)?{[:space:]]*$"

Short description:

That is, the parser will interpret this line as a header with the name STRUCT;1. The header name can contain uppercase and lowercase letters, digits, an underscore character, a period, characters between 0x2c-0x5c, a \ , plus sign.

If this pattern is to follow your file syntax it should look like this:

HEADER_PATTERN "^[[:space:]]*@([A-Za-z0-9_]+)[[:space:]]*(#.*)?$"

i.e.

PNieck commented 1 year ago

Ok, yes I agree. Now I see where is the problem.