diff options
author | 2024-07-24 11:16:26 +0200 | |
---|---|---|
committer | 2024-07-24 11:16:26 +0200 | |
commit | 9e881b6ee3b556f8e68c814adb1b51f7f0abe056 (patch) | |
tree | 83fe4eb65252f3f4e8c4f5b088e8fdb760979edf /properties.l | |
parent | 2a20043edb282dff05c9832b1576bf8894dd6473 (diff) | |
download | properties-9e881b6ee3b556f8e68c814adb1b51f7f0abe056.tar.gz properties-9e881b6ee3b556f8e68c814adb1b51f7f0abe056.zip |
Remove the main function from properties.l
The next step is to define the whole grammar inside the parser.
Diffstat (limited to 'properties.l')
-rw-r--r-- | properties.l | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/properties.l b/properties.l index 73803fc..67a5c2a 100644 --- a/properties.l +++ b/properties.l @@ -10,54 +10,3 @@ . return VALUE; %% - -struct Properties { - char *key; - char *value; - struct Properties *next; -}; - -int -main(void) -{ - int token; - int next_token = KEY; - struct Properties properties; - properties.next = NULL; - - char *key; - char *value = calloc(2048, sizeof(char)); - int v = 0; - - do { - v = 0; - value = calloc(2048, sizeof(char)); - - token = yylex(); - - if (next_token == VALUE) { - if (token == VALUE) { - do { - *(value + v) = *yytext; - v++; - } while ((token = yylex()) == VALUE); - } - - next_token = KEY; - printf("%s --> %s|\n", key, value); - } - - if (token == KEY && next_token == KEY) { - next_token = DIV; - key = strdup(yytext); - } else if (token == DIV && next_token == DIV) { - next_token = VALUE; - } - } while (token != 0); - - while (properties.next != NULL) { - printf("%s ---> %s\n", properties.key, properties.value); - } - - return EXIT_SUCCESS; -} |