]> git.ipfire.org Git - pakfire.git/commitdiff
libpakfire: parser: Rename T_NEWLINE to T_EOL
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 15 Mar 2019 04:43:41 +0000 (04:43 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 15 Mar 2019 04:43:41 +0000 (04:43 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/parser/grammar.y
src/libpakfire/parser/scanner.l

index 0daf8ad0611fe895ecc577c5155b833e1642945d..6f193746fc4b3b2d9f717de233657933aad56f7d 100644 (file)
@@ -68,7 +68,7 @@ char* current_block = NULL;
 %token                                                 T_END
 %token <string>                                        T_EQUALS
 %token <string>                                        T_IF
-%token                                                 T_NEWLINE
+%token                                                 T_EOL
 %token <string>                                        T_WORD
 
 %type <string>                                 define;
@@ -99,7 +99,7 @@ thing                                         : assignment
                                                        | empty
                                                        ;
 
-empty                                          : T_NEWLINE
+empty                                          : T_EOL
                                                        ;
 
 variable                                       : T_WORD;
@@ -124,12 +124,12 @@ words                                             : word
                                                                }
                                                        };
 
-line                                           : words T_NEWLINE
+line                                           : words T_EOL
                                                        {
                                                                // Only forward words
                                                                $$ = $1;
                                                        }
-                                                       | T_NEWLINE {
+                                                       | T_EOL {
                                                                $$ = NULL;
                                                        };
 
@@ -144,17 +144,17 @@ text                                              : text line
                                                        | line
                                                        ;
 
-if_stmt                                                : T_IF T_WORD T_EQUALS T_WORD T_NEWLINE block_assignments end
+if_stmt                                                : T_IF T_WORD T_EQUALS T_WORD T_EOL block_assignments end
                                                        {
                                                                printf("IF STATEMENT NOT EVALUATED, YET: %s %s\n", $2, $4);
                                                        };
 
-block_opening                          : variable T_NEWLINE
+block_opening                          : variable T_EOL
                                                        {
                                                                current_block = pakfire_strdup($1);
                                                        };
 
-block_closing                          : T_END T_NEWLINE
+block_closing                          : T_END T_EOL
                                                        {
                                                                pakfire_free(current_block);
                                                                current_block = NULL;
@@ -169,13 +169,13 @@ block_assignment                  : assignment
                                                        | if_stmt
                                                        | empty;
 
-assignment                                     : variable T_ASSIGN value T_NEWLINE
+assignment                                     : variable T_ASSIGN value T_EOL
                                                        {
                                                                int r = pakfire_parser_add_declaration(pakfire, declarations, $1, $3);
                                                                if (r < 0)
                                                                        ABORT;
                                                        }
-                                                       | variable T_APPEND value T_NEWLINE
+                                                       | variable T_APPEND value T_EOL
                                                        {
                                                                int r = pakfire_parser_append_declaration(pakfire, declarations, $1, $3);
                                                                if (r < 0)
@@ -188,16 +188,16 @@ assignment                                        : variable T_ASSIGN value T_NEWLINE
                                                                        ABORT;
                                                        };
 
-define                                         : T_DEFINE variable T_NEWLINE
+define                                         : T_DEFINE variable T_EOL
                                                        {
                                                                $$ = $2;
                                                        }
-                                                       | variable T_NEWLINE
+                                                       | variable T_EOL
                                                        {
                                                                $$ = $1;
                                                        };
 
-end                                                    : T_END T_NEWLINE;
+end                                                    : T_END T_EOL;
 
 %%
 
index cb41d5b32734b7e9fab7052199ed17bfb79fb6bb..c746142ebb811a9b70d1f99e6db36772d579d51d 100644 (file)
@@ -43,7 +43,7 @@ word                  ({quoted_string}|({digit}|{letter}|{special})+)
 
 #.*$                   { /* ignore comments */ }
 {whitespace}   {}
-\n                             { num_lines++; return T_NEWLINE; }
+\n                             { num_lines++; return T_EOL; }
 
 "=="                   { return T_EQUALS; }
 "="                            { return T_ASSIGN; }