This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, gfortran] Cleanup the submodule tests


Hi Dominique,

> I am currently testing the following patch that handle both modules and submodules. It is a little bit clumsy and may not handle all the possible syntax variants. Any comment welcomed!-) Testing in progress.

so, how did the testing go?


>  proc list-module-names-1 { file } {
>      set result {}
> -    set tmp [grep $file "^\[ \t\]*((#)?\[ \t\]*include|\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\](?!\[ \t\]+\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+))\[ \t\]+.*" line]
> +    if {[file isdirectory $file]} {return}
> +    set tmp [igrep $file "^\\s*((#)?\\s*include|(sub)?module(?!\\s+(recursive\\s+)?(procedure|subroutine|function)\\s*))\\s*.*" line]

This is supposed to catch all lines including "module", but not
"module procedure", "module subroutine" etc, right? Why do you need
"recursive" here, but no other attributes like "pure" or "elemental"?


>      if {![string match "" $tmp]} {
>         foreach i $tmp {
> -           regexp "(\[0-9\]+)\[ \t\]+(?:(?:#)?\[ \t\]*include\[ \t\]+)\[\"\](\[^\"\]*)\[\"\]" $i dummy lineno include_file
> +           regexp -nocase "(\[0-9\]+)\\s+(?:(?:#)?\\s*include\\s+)\[\"\'\](\[^\"\'\]*)\[\"\'\]" $i dummy lineno include_file

My regex sorcery may be a bit rusty, but why does \\s need a double
escape while \t appears with single escape?


> @@ -99,7 +100,11 @@ proc list-module-names-1 { file } {
>                 }
>                 continue
>             }
> -           regexp "(\[0-9\]+)\[ \t\]+(?:(\[mM\]\[oO\]\[dD\]\[uU\]\[lL\]\[eE\]\[ \t\]+(?!\[pP\]\[rR\]\[oO\]\[cC\]\[eE\]\[dD\]\[uU\]\[rR\]\[eE\]\[ \t\]+)))(\[^ \t;\]*)" $i i lineno keyword mod
> +           regexp -nocase "(\[0-9\]+)\\s+(module|submodule)\\s*(\[^;\]*)" $i i lineno keyword mod
> +           regsub "\\s*!.*" $mod "" mod
> +           regsub ":\[^)\]*" $mod "" mod
> +           regsub "\\(\\s*" $mod "" mod
> +           regsub "\\s*\\)\\s*" $mod "@" mod
>             if {![info exists lineno]} {
>                 continue
>             }

Not sure I understand this part. Guess I'm spending too little time
with regexps to find them readable :(

Cheers,
Janus


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]