Submitting on behalf of gspencer@google.com
Submitting on behalf of gspencer@google.com

BUG=None
TEST=None

I added the abililty to specify command variable substitutions as
'<!(["python", "foo.py", "--arg"])'.

I also jazzed up the re searches for variable expansion so that they were more
accurate when they do replacement (they were kinda sloppy before because they
could replace multiple instances of the same variable incorrectly:

For instance, if you had:

"<(foo) is a <(bar) and a  <(foo)"

it would replace all the "<(foo)"s in the input first (possibly messing up
later substitutions), even though the matches were in the reverse order of
that.  It's bad for commands, since they might return different values each
time they're run (even with the same argument list), and only the first
execution would ever actually win.  It would be especially bad if <(foo)
expanded to something like the string "<(bar)", since that would do something
like the following:

Where bar="XXX" and foo="<(bar)"

after replacing match 1: "<(bar) is a <(bar) and a <(bar)"  [notice that it
replaces ALL foo's instead of just the one it matched]
after replacing match 2: "XXX is a XXX and a XXX"
after replacing match 3: ""XXX is a XXX and a XXX"  [notice that the leftmost
<(foo) is already replaced, so this iteration doesn't do anything.]

When the desired behavior is:

after replacing match 1: "<(foo) is a <(bar) and a <(bar)"
after replacing match 2: "<(foo) is a XXX and a <(bar)"
after replacing match 3: "<(bar) is a XXX and a <(bar)"

And at the same time I fixed the REs so they have named groups, so they are
easier to read (so instead of "match[2]", you have "match['command']").

Review URL: http://codereview.chromium.org/126224

git-svn-id: e7e1075985beda50ea81ac4472467b4f6e91fc78@518 78cadc50-ecff-11dd-a971-7dbc132099af

adblockplus/gyp,yangrongwei/gyp,LazyCodingCat/gyp,trafi/gyp,channing/gyp,erikge/watch_gyp,bulldy80/gyp_unofficial,Danath/gyp,tarc/gyp,openpeer/webrtc-gyp,sdklite/gyp,ttyangf/gyp,sanyaade-teachings/gyp,mistydemeo/gyp,mumble-voip/libmumble-gyp,cysp/gyp,Chilledheart/gyp,alexcrichton/gyp,carlTLR/gyp,chromium/gyp,brson/gyp,saghul/gyn,brson/gyp,springmeyer/gyp,amoikevin/gyp,duanhjlt/gyp,Omegaphora/external_chromium_org_tools_gyp,ryfx/gyp,LazyCodingCat/gyp,springmeyer/gyp,okwasi/gyp,okwasi/gyp,openpeer/webrtc-gyp,yinquan529/platform-external-chromium_org-tools-gyp,azunite/gyp,android-ia/platform_external_chromium_org_tools_gyp,cchamberlain/gyp,pandaxcl/gyp,cchamberlain/gyp,yjhjstz/gyp,Danath/gyp,svn2github/kgyp,AWhetter/gyp,ryfx/gyp,pandaxcl/gyp,carlTLR/gyp,brson/gyp,alexcrichton/gyp,pyokagan/gyp,clar/gyp,Chilledheart/gyp,bdarnell/gyp,brson/gyp,AOSPU/external_chromium_org_tools_gyp,sloanyang/gyp,LazyCodingCat/gyp,Jack-Q/GYP-copy,openpeer/webrtc-gyp,ttyangf/gyp,bnq4ever/gypgoogle,geekboxzone/lollipop_external_chromium_org_tools_gyp,bnoordhuis/gyp,Chilledheart/gyp,clar/gyp,sanyaade-teachings/gyp,dougbeal/gyp,lukeweber/gyp-override,azunite/gyp,turbulenz/gyp,enkripsi/gyp,AWhetter/gyp,Jack-Q/GYP-copy,azunite/gyp,trafi/gyp,turbulenz/gyp,geekboxzone/lollipop_external_chromium_org_tools_gyp,xin3liang/platform_external_chromium_org_tools_gyp,Danath/gyp,bpsinc-native/src_tools_gyp,saghul/gyn,kevinchen3315/gyp-git,lukeweber/gyp-override,duanhjlt/gyp,pyokagan/gyp,mapbox/gyp,Omegaphora/external_chromium_org_tools_gyp,bpsinc-native/src_tools_gyp,duanhjlt/gyp,sdklite/gyp,mumble-voip/libmumble-gyp,kevinchen3315/gyp-git,yjhjstz/gyp,Phuehvk/gyp,cysp/gyp,adblockplus/gyp,okumura/gyp,mapbox/gyp,svn2github/gyp,geekboxzone/lollipop_external_chromium_org_tools_gyp,bulldy80/gyp_unofficial,sanyaade-teachings/gyp,omasanori/gyp,Phuehvk/gyp,mkrautz/gyp-libmumble,bdarnell/gyp,chromium/gyp,enkripsi/gyp,sdklite/gyp,mgamer/gyp,adblockplus/gyp,trafi/gyp,adblockplus/gyp,svn2github/kgyp,sfiera/gyp,AOSPU/external_chromium_org_tools_gyp,bnq4ever/gypgoogle,saghul/gyn,svn2github/gyp,ryfx/gyp,yinquan529/platform-external-chromium_org-tools-gyp,dougbeal/gyp,Chilledheart/gyp,AWhetter/gyp,ttyangf/pdfium_gyp,channing/gyp,xin3liang/platform_external_chromium_org_tools_gyp,sloanyang/gyp,lianliuwei/gyp,amoikevin/gyp,springmeyer/gyp,sloanyang/gyp,sport-monkey/GYP,sport-monkey/GYP,sdklite/gyp,msc-/gyp,android-ia/platform_external_chromium_org_tools_gyp,tarc/gyp,pyokagan/gyp,chromium/gyp,svn2github/kgyp,sfiera/gyp,mkrautz/gyp-libmumble,android-ia/platform_external_chromium_org_tools_gyp,duanhjlt/gyp,turbulenz/gyp,bnoordhuis/gyp,luvit/gyp,bulldy80/gyp_unofficial,yjhjstz/gyp,bpsinc-native/src_tools_gyp,clar/gyp,dougbeal/gyp,ttyangf/gyp,tarc/gyp,azunite/gyp_20150930,lianliuwei/gyp,Phuehvk/gyp,mistydemeo/gyp,sanyaade-teachings/gyp,amoikevin/gyp,clar/gyp,xin3liang/platform_external_chromium_org_tools_gyp,msc-/gyp,Jack-Q/GYP-copy,lianliuwei/gyp,bnoordhuis/gyp,sanyaade-teachings/gyp,Jack-Q/GYP-copy,cysp/gyp,cysp/gyp,cchamberlain/gyp,sloanyang/gyp,saghul/gyn,geekboxzone/lollipop_external_chromium_org_tools_gyp,cchamberlain/gyp,sport-monkey/GYP,omasanori/gyp,IllusionRom-deprecated/android_platform_external_chromium_org_tools_gyp,msc-/gyp,bulldy80/gyp_unofficial,Omegaphora/external_chromium_org_tools_gyp,azunite/gyp_20150930,sport-monkey/GYP,carlTLR/gyp,bdarnell/gyp,bdarnell/gyp,pandaxcl/gyp,ryfx/gyp,mistydemeo/gyp,mgamer/gyp,springmeyer/gyp,xin3liang/platform_external_chromium_org_tools_gyp,Phuehvk/gyp,luvit/gyp,bpsinc-native/src_tools_gyp,IllusionRom-deprecated/android_platform_external_chromium_org_tools_gyp,channing/gyp,luvit/gyp,mapbox/gyp,openpeer/webrtc-gyp,enkripsi/gyp,cysp/gyp,sdklite/gyp,msc-/gyp,cchamberlain/gyp,carlTLR/gyp,sport-monkey/GYP,trafi/gyp,pandaxcl/gyp,Phuehvk/gyp,enkripsi/gyp,okumura/gyp,yinquan529/platform-external-chromium_org-tools-gyp,mumble-voip/libmumble-gyp,MIPS/external-chromium_org-tools-gyp,ttyangf/gyp,mistydemeo/gyp,duanhjlt/gyp,alexcrichton/gyp,amoikevin/gyp,pyokagan/gyp,yangrongwei/gyp,LazyCodingCat/gyp,ttyangf/pdfium_gyp,mgamer/gyp,AWhetter/gyp,AOSPU/external_chromium_org_tools_gyp,yjhjstz/gyp,MIPS/external-chromium_org-tools-gyp,kevinchen3315/gyp-git,svn2github/gyp,AOSPU/external_chromium_org_tools_gyp,yjhjstz/gyp,MIPS/external-chromium_org-tools-gyp,mkrautz/gyp-libmumble,erikge/watch_gyp,ttyangf/pdfium_gyp,erikge/watch_gyp,lianliuwei/gyp,mapbox/gyp,pandaxcl/gyp,tarc/gyp,Danath/gyp,azunite/gyp,IllusionRom-deprecated/android_platform_external_chromium_org_tools_gyp,svn2github/kgyp,adblockplus/gyp,pyokagan/gyp,yangrongwei/gyp,azunite/gyp,ttyangf/pdfium_gyp,turbulenz/gyp,channing/gyp,mapbox/gyp,springmeyer/gyp,bnq4ever/gypgoogle,msc-/gyp,Chilledheart/gyp,chromium/gyp,dougbeal/gyp,alexcrichton/gyp,android-ia/platform_external_chromium_org_tools_gyp,omasanori/gyp,IllusionRom-deprecated/android_platform_external_chromium_org_tools_gyp,mkrautz/gyp-libmumble,Jack-Q/GYP-copy,lukeweber/gyp-override,chromium/gyp,ryfx/gyp,okwasi/gyp,trafi/gyp,okumura/gyp,azunite/gyp_20150930,okwasi/gyp,AWhetter/gyp,LazyCodingCat/gyp,ttyangf/gyp,okumura/gyp,yinquan529/platform-external-chromium_org-tools-gyp,azunite/gyp_20150930,svn2github/kgyp,erikge/watch_gyp,bulldy80/gyp_unofficial,mgamer/gyp,clar/gyp,luvit/gyp,kevinchen3315/gyp-git,openpeer/webrtc-gyp,amoikevin/gyp,omasanori/gyp,enkripsi/gyp,MIPS/external-chromium_org-tools-gyp,bnq4ever/gypgoogle,mumble-voip/libmumble-gyp,sfiera/gyp,svn2github/gyp,azunite/gyp_20150930,tarc/gyp,carlTLR/gyp,lukeweber/gyp-override,bnoordhuis/gyp,dougbeal/gyp,bnq4ever/gypgoogle,Danath/gyp,saghul/gyn,mgamer/gyp,bnoordhuis/gyp,ttyangf/pdfium_gyp,svn2github/gyp,Omegaphora/external_chromium_org_tools_gyp,turbulenz/gyp,yangrongwei/gyp,erikge/watch_gyp