aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2024-07-24 12:38:53 +0200
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2024-07-24 12:38:53 +0200
commit03782a2c778632c4fbd97678ee7b06c339d9d9dc (patch)
tree1ecfbc799a15cc91d3bc9d861880c3ceb125114c
parentd0ad5177aac3051be772f869005b857705c48eb7 (diff)
downloadproperties-03782a2c778632c4fbd97678ee7b06c339d9d9dc.tar.gz
properties-03782a2c778632c4fbd97678ee7b06c339d9d9dc.zip
Trim the key of a property
-rw-r--r--properties.l3
1 files changed, 2 insertions, 1 deletions
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 */