Closed kemonats closed 1 year ago
Most of these example are not consistent with our file syntax
First character can be a digit
As for the processors in this project we use armv7a9-zynq7000
(Xilinx Zynq 7000
)
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:
@
- header,STRUCT
- ok,;
(0x3b) is considered correct because it is in range ,-\
(0x2c - 0x5c
),1
- ok\n
- okThat 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.
[[:space:]]
@
_
([A-Za-z0-9_]+)
or instead of +
give {1,16}
(#.*)?
Ok, yes I agree. Now I see where is the problem.
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.