From 03782a2c778632c4fbd97678ee7b06c339d9d9dc Mon Sep 17 00:00:00 2001 From: Alessandro Iezzi Date: Wed, 24 Jul 2024 12:38:53 +0200 Subject: Trim the key of a property --- properties.l | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/properties.l b/properties.l index 4e8f1d2..50acbd7 100644 --- a/properties.l +++ b/properties.l @@ -1,11 +1,12 @@ %{ #include "properties-parser.h" +#include "utils/string.h" %} %% =|: return DIV; -^[ \t]*[a-zA-Z0-9\.]*[ \t]* yylval.value = strdup(yytext); return KEY; +^[ \t]*[a-zA-Z0-9\.]*[ \t]* yylval.value = strdup(trim(yytext)); return KEY; \n ; /* Ignores empty lines with a single newline */ ^[ \t]*#.* ; /* Ignores comments */ ^[ \t]*/\r?\n ; /* /\r?\n get the end of line, ref: https://stackoverflow.com/a/56104754 */ -- cgit v1.2.3