[anjuta] am-project: bgo #722989 - Project target name concatenated with variable wasn't processed



commit 603930b46760c392da93d3a50b4fb10c52011099
Author: Sébastien Granjoux <seb sfo free fr>
Date:   Sun Feb 23 19:16:43 2014 +0100

    am-project: bgo #722989 - Project target name concatenated with variable wasn't processed

 plugins/am-project/am-parser.y       |   86 +++++++++++++++++++++++++++------
 plugins/am-project/am-scanner.l      |    6 +-
 plugins/am-project/tests/gnucash.lst |   28 +++++++++++
 plugins/am-project/tests/variable.at |   28 +++++++++++
 4 files changed, 129 insertions(+), 19 deletions(-)
---
diff --git a/plugins/am-project/am-parser.y b/plugins/am-project/am-parser.y
index f7c5b50..11fffe0 100644
--- a/plugins/am-project/am-parser.y
+++ b/plugins/am-project/am-parser.y
@@ -119,7 +119,7 @@
 static gint
 amp_am_automake_variable (AnjutaToken *token)
 {
-    switch (anjuta_token_get_type (token))
+    switch (anjuta_token_get_type (anjuta_token_last (token)))
     {
     case SUBDIRS:               return AM_TOKEN_SUBDIRS;
     case DIST_SUBDIRS:          return AM_TOKEN_DIST_SUBDIRS;
@@ -185,7 +185,7 @@ statement:
        ;
 
 am_variable:
-       optional_space  automake_token  optional_space  equal_token  value_list {
+       optional_space  automake_head  optional_space  equal_token  value_list {
                $$ = anjuta_token_new_static (amp_am_automake_variable ($2), NULL);
                if ($1 != NULL) anjuta_token_set_type ($1, ANJUTA_TOKEN_START);
                anjuta_token_merge ($$, $2);
@@ -194,7 +194,7 @@ am_variable:
                anjuta_token_merge ($$, $5);
                amp_am_scanner_set_am_variable (scanner, $$);
        }
-       | optional_space automake_token optional_space equal_token
+       | optional_space automake_head optional_space equal_token
        {
                AnjutaToken *list;
                list = anjuta_token_new_static (ANJUTA_TOKEN_LIST, NULL);
@@ -305,7 +305,7 @@ head_list_body:
                anjuta_token_merge ($1, $2);
                anjuta_token_merge ($1, $3);
        }
-       | head_list_body  space  head {
+       | automake_head  space  next_head {
                anjuta_token_merge ($1, $2);
                anjuta_token_merge ($1, $3);
        }
@@ -371,6 +371,23 @@ space:
        }*/
        ;
 
+automake_head:
+       automake_token {
+               $$ = anjuta_token_new_static (ANJUTA_TOKEN_NAME, NULL);
+               anjuta_token_merge ($$, $1);
+       }
+       | target_automake_token {
+               $$ = anjuta_token_new_static (ANJUTA_TOKEN_NAME, NULL);
+               anjuta_token_merge ($$, $1);
+       }
+       | head target_automake_token {
+               anjuta_token_merge ($1, $2);
+       }
+       | automake_head target_automake_token {
+               anjuta_token_merge ($1, $2);
+       }
+       ;
+
 head:
        head_token {
                $$ = anjuta_token_new_static (ANJUTA_TOKEN_NAME, NULL);
@@ -399,10 +416,41 @@ head:
        | head ac_variable {
                anjuta_token_merge ($1, $2);
        }
+       | automake_head head_token {
+               anjuta_token_merge ($1, $2);
+       }
+       | automake_head automake_token {
+               anjuta_token_merge ($1, $2);
+       }
+       | automake_head include_token {
+               anjuta_token_merge ($1, $2);
+       }
+       | automake_head variable {
+               anjuta_token_merge ($1, $2);
+       }
+       | automake_head ac_variable {
+               anjuta_token_merge ($1, $2);
+       }
        ;
 
 next_head:
-       automake_token {
+       head_token {
+               $$ = anjuta_token_new_static (ANJUTA_TOKEN_NAME, NULL);
+               anjuta_token_merge ($$, $1);
+       }
+       | ac_variable {
+               $$ = anjuta_token_new_static (ANJUTA_TOKEN_NAME, NULL);
+               anjuta_token_merge ($$, $1);
+       }
+       | variable {
+               $$ = anjuta_token_new_static (ANJUTA_TOKEN_NAME, NULL);
+               anjuta_token_merge ($$, $1);
+       }
+       | automake_token {
+               $$ = anjuta_token_new_static (ANJUTA_TOKEN_NAME, NULL);
+               anjuta_token_merge ($$, $1);
+       }
+       | target_automake_token {
                $$ = anjuta_token_new_static (ANJUTA_TOKEN_NAME, NULL);
                anjuta_token_merge ($$, $1);
        }
@@ -487,6 +535,7 @@ not_eol_token:
 prerequisite_token:
        name_token
        | automake_token
+       | target_automake_token
        | equal_token
        | rule_token
        ;
@@ -495,6 +544,7 @@ command_token:
        name_token
        | variable_token
        | automake_token
+       | target_automake_token
        | equal_token
        | rule_token
        | depend_token
@@ -510,6 +560,7 @@ value_token:
        | depend_token
        | include_token
        | automake_token
+       | target_automake_token
        ;
 
 head_token:
@@ -564,7 +615,20 @@ variable_token:
 automake_token:
        SUBDIRS
        | DIST_SUBDIRS
-       | _DATA
+       | _LDFLAGS
+       | _CPPFLAGS
+       | _CFLAGS
+       | _CXXFLAGS
+       | _JAVACFLAGS
+       | _VALAFLAGS
+       | _FCFLAGS
+       | _OBJCFLAGS
+       | _LFLAGS
+       | _YFLAGS
+       ;
+
+target_automake_token:
+       _DATA
        | _HEADERS
        | _LIBRARIES
        | _LISP
@@ -577,16 +641,6 @@ automake_token:
        | _SOURCES
        | _TEXINFOS
        | _DIR
-       | _LDFLAGS
-       | _CPPFLAGS
-       | _CFLAGS
-       | _CXXFLAGS
-       | _JAVACFLAGS
-       | _VALAFLAGS
-       | _FCFLAGS
-       | _OBJCFLAGS
-       | _LFLAGS
-       | _YFLAGS
        | TARGET_LDFLAGS
        | TARGET_CPPFLAGS
        | TARGET_CFLAGS
diff --git a/plugins/am-project/am-scanner.l b/plugins/am-project/am-scanner.l
index 66e295e..fabfbed 100644
--- a/plugins/am-project/am-scanner.l
+++ b/plugins/am-project/am-scanner.l
@@ -106,11 +106,11 @@ NAME          [^ \t\n\r:#=$"'`&@\\]*
 
 <INITIAL>@{NAME}@                                      { RETURN (MACRO); }
 
-<INITIAL>\$\([^ \t\n\r:#=$)]+\)        { RETURN (VARIABLE); }
+<INITIAL>\$\([^)]+\)                                   { RETURN (VARIABLE); }
 
-<INITIAL>\$\{[^ \t\n\r:#=$}]+\}        { RETURN (VARIABLE); }
+<INITIAL>\$\{[^}]+\}                                   { RETURN (VARIABLE); }
 
-<INITIAL>\$[^ \t\n\r\(\{]                      { RETURN (VARIABLE); }
+<INITIAL>\$[^ \t\n\r\(\{]                              { RETURN (VARIABLE); }
 
 <INITIAL>:                                                     { RETURN (COLON); }
 
diff --git a/plugins/am-project/tests/gnucash.lst b/plugins/am-project/tests/gnucash.lst
index 5ebb70f..0522a00 100644
--- a/plugins/am-project/tests/gnucash.lst
+++ b/plugins/am-project/tests/gnucash.lst
@@ -1212,6 +1212,10 @@ ROOT (): gnucash
                     SOURCE (): src/gnome-utils/glade/transfer.glade
                 SOURCE (): src/gnome-utils/glade/Makefile.am
             GROUP (): schemas
+                PROPERTY (Installation directories): schemadir = @GCONF_SCHEMA_FILE_DIR@
+                TARGET (): schema
+                    PROPERTY (Installation directory): schemadir
+                    SOURCE (): src/gnome-utils/schemas/$(schemas_in_files:.schemas.in=.schemas)
                 SOURCE (): src/gnome-utils/schemas/Makefile.am
             GROUP (): test
                 TARGET (): test-link-module
@@ -1857,6 +1861,10 @@ ROOT (): gnucash
                     SOURCE (): src/gnome/glade/sched-xact.glade
                 SOURCE (): src/gnome/glade/Makefile.am
             GROUP (): schemas
+                PROPERTY (Installation directories): schemadir = @GCONF_SCHEMA_FILE_DIR@
+                TARGET (): schema
+                    PROPERTY (Installation directory): schemadir
+                    SOURCE (): src/gnome/schemas/$(schemas_in_files:.schemas.in=.schemas)
                 SOURCE (): src/gnome/schemas/Makefile.am
             GROUP (): ui
                 PROPERTY (Installation directories): uidir = $(GNC_UI_DIR)
@@ -1947,6 +1955,10 @@ ROOT (): gnucash
             PROPERTY (Installation directories): gncincludedir = ${GNC_INCLUDE_DIR} gladedir = 
${GNC_GLADE_DIR}
             PROPERTY (C preprocessor flags): -I${top_srcdir}/src -I${top_srcdir}/src/core-utils 
-I${top_srcdir}/src/engine -I${top_srcdir}/src/gnc-module -I${top_srcdir}/src/app-utils 
-I${top_srcdir}/src/gnome -I${top_srcdir}/src/gnome-utils -I${top_srcdir}/src/libqof/qof ${GNOME_CFLAGS} 
${GLADE_CFLAGS} ${GUILE_INCS} ${GLIB_CFLAGS}
             GROUP (): schemas
+                PROPERTY (Installation directories): schemadir = @GCONF_SCHEMA_FILE_DIR@
+                TARGET (): schema
+                    PROPERTY (Installation directory): schemadir
+                    SOURCE (): src/import-export/schemas/$(schemas_in_files:.schemas.in=.schemas)
                 SOURCE (): src/import-export/schemas/Makefile.am
             GROUP (): qif
                 PROPERTY (C preprocessor flags): -I${top_srcdir}/src -I${top_srcdir}/src/engine 
-I${top_srcdir}/src/gnc-module -I${top_srcdir}/src/app-utils -I${top_srcdir}/src/import-export 
-I${top_srcdir}/src/libqof/qof ${GLIB_CFLAGS} ${GUILE_INCS}
@@ -1985,6 +1997,10 @@ ROOT (): gnucash
                         SOURCE (): src/import-export/qif-import/test/test-link.c
                     SOURCE (): src/import-export/qif-import/test/Makefile.am
                 GROUP (): schemas
+                    PROPERTY (Installation directories): schemadir = @GCONF_SCHEMA_FILE_DIR@
+                    TARGET (): schema
+                        PROPERTY (Installation directory): schemadir
+                        SOURCE (): 
src/import-export/qif-import/schemas/$(schemas_in_files:.schemas.in=.schemas)
                     SOURCE (): src/import-export/qif-import/schemas/Makefile.am
                 TARGET (): libgncmod-qif-import.la
                     PROPERTY (Installation directory): pkglibdir
@@ -2133,6 +2149,10 @@ ROOT (): gnucash
                 PROPERTY (C compiler flags): -I${top_srcdir}/src -I${top_srcdir}/src/import-export 
-I${top_srcdir}/src/gnome -I${top_srcdir}/src/register/ledger-core 
-I${top_srcdir}/src/register/register-gnome -I${top_srcdir}/src/register/register-core 
-I${top_srcdir}/src/gnome-utils -I${top_srcdir}/src/app-utils -I${top_srcdir}/src/engine 
-I${top_srcdir}/src/core-utils -I${top_srcdir}/src/gnc-module -I${top_srcdir}/src/libqof/qof ${GNOME_CFLAGS} 
${GLADE_CFLAGS} ${GLIB_CFLAGS} ${AQBANKING_CFLAGS}
                 PROPERTY (Installation directories): uidir = $(GNC_UI_DIR) gladedir = $(GNC_GLADE_DIR)
                 GROUP (): schemas
+                    PROPERTY (Installation directories): schemadir = @GCONF_SCHEMA_FILE_DIR@
+                    TARGET (): schema
+                        PROPERTY (Installation directory): schemadir
+                        SOURCE (): 
src/import-export/aqbanking/schemas/$(schemas_in_files:.schemas.in=.schemas)
                     SOURCE (): src/import-export/aqbanking/schemas/Makefile.am
                 TARGET (): libgncmod-aqbanking.la
                     PROPERTY (Installation directory): pkglibdir
@@ -2184,6 +2204,10 @@ ROOT (): gnucash
                         SOURCE (): src/import-export/hbci/glade/hbciprefs.glade
                     SOURCE (): src/import-export/hbci/glade/Makefile.am
                 GROUP (): schemas
+                    PROPERTY (Installation directories): schemadir = @GCONF_SCHEMA_FILE_DIR@
+                    TARGET (): schema
+                        PROPERTY (Installation directory): schemadir
+                        SOURCE (): src/import-export/hbci/schemas/$(schemas_in_files:.schemas.in=.schemas)
                     SOURCE (): src/import-export/hbci/schemas/Makefile.am
                 GROUP (): test
                     TARGET (): test-link-module
@@ -2391,6 +2415,10 @@ ROOT (): gnucash
                         SOURCE (): src/business/business-gnome/glade/vendor.glade
                     SOURCE (): src/business/business-gnome/glade/Makefile.am
                 GROUP (): schemas
+                    PROPERTY (Installation directories): schemadir = @GCONF_SCHEMA_FILE_DIR@
+                    TARGET (): schema
+                        PROPERTY (Installation directory): schemadir
+                        SOURCE (): 
src/business/business-gnome/schemas/$(schemas_in_files:.schemas.in=.schemas)
                     SOURCE (): src/business/business-gnome/schemas/Makefile.am
                 GROUP (): ui
                     PROPERTY (Installation directories): uidir = $(GNC_UI_DIR)
diff --git a/plugins/am-project/tests/variable.at b/plugins/am-project/tests/variable.at
index 195b733..f98cf17 100644
--- a/plugins/am-project/tests/variable.at
+++ b/plugins/am-project/tests/variable.at
@@ -200,4 +200,32 @@ AT_CHECK([diff -b output expect])
 
 
 
+AS_MKDIR_P([variable6])
+AT_DATA([variable6/configure.ac],
+[[API=0
+AC_SUBST(API)
+AC_CONFIG_FILES(Makefile)
+]])
+AT_DATA([variable6/Makefile.am],
+[[
+bin_PROGRAMS = target API@
+target API@_SOURCES = \
+       source1.c
+target API@_LDFLAGS = -l
+]])
+AT_DATA([expect],
+[[ROOT (): variable6
+    TARGET (): target0
+        PROPERTY (Installation directory): bindir
+        PROPERTY (Linker flags): -l
+        SOURCE (): source1.c
+    SOURCE (): configure.ac
+    SOURCE (): Makefile.am
+]])
+AT_PARSER_CHECK([load variable6 \
+                list])
+AT_CHECK([diff -b output expect])
+
+
+
 AT_CLEANUP


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]