[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdevelop-devel
Subject:    regexp for the (custom makefiles project) makefile parser
From:       Alexander Neundorf <neundorf () kde ! org>
Date:       2005-12-07 20:51:31
Message-ID: 200512072151.31736.neundorf () kde ! org
[Download RAW message or body]

Hi, 

the custom project part tries to parse the makefiles to find the targets from 
the makefiles.
It uses the following QRegExp:

QRegExp re("^([^($%.#][^)\\s]+) *:.*$");

Do I understand correctly that this means:

1) beginning of line
2) then one character which is not ($%.#
3) the at least one character which is not )\\s
4) some space or not
5) the character :

This seems to have several problems:
1) it should exclude a \\tab from the first position
2) why does it exclude the % from the first position ?

%target_with_percent:
        echo "target with percent"

$ make %target_with_percent
echo "target with percent"
target with percent

This appparently works on my system.

3) why does it exclude the ( from the first position ?

(target_mit_klammer_auf:
        echo "target mit klammer auf"

$ make "(target_mit_klammer_auf"
echo "target mit klammer auf"
target mit klammer auf

Works on my system.

4) why does it exclude the ")" from the target ?

target_mit_klammer_zu):
        echo "klammer zu"

$ make "target_mit_klammer_zu)"
echo "klammer zu"
klammer zu

Works on my system.

5) it excludes spaces before the name of the target. This too works apparently 
on my system.

I think the following regexp is better, and I committed it to the kdevelop 3.4 
branch. What do you think about it ?

QRegExp re("^ *([^\\t$.#]\\S+) *:.*$");

the old one was: "QRegExp re("^([^($%.#][^)\\s]+) *:.*$");"

Bye
Alex
-- 
Work: alexander.neundorf@jenoptik.com - http://www.jenoptik-los.de
Home: neundorf@kde.org                - http://www.kde.org
      alex@neundorf.net               - http://www.neundorf.net

_______________________________________________
KDevelop-devel mailing list
KDevelop-devel@barney.cs.uni-potsdam.de
http://barney.cs.uni-potsdam.de/mailman/listinfo/kdevelop-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic