/**
 * Finds the definition of a NAnt property or task.
 * 
 * @example This will search the current NAnt build file, and
* any included buildfiles. If you have selected (or have the caret in) the text
* <b>findme</b>, it searches for tags like
* <property name="findme"/> and
* <target name="findme"/>
* It also allows you to select ${findme}, "findme", or 'findme'
*/
_command void nant_def,nd()
{
   boolean matchFound = false;
   _str lineText = "";
   get_line(lineText);
   _str nantSymbolRe = '([a-zA-Z][a-zA-Z0-9\.\_]+)';
 
   _str lookFor = '';
 
   if (_isnull_selection()) {
      // See if the symbol surrounding the caret position is a valid
      // NAnt indentifier
      _str nantWordSearch = '(?:[^a-zA-Z0-9\.\_])'nantSymbolRe'(?:[^a-zA-Z0-9\.\_])';
      int start = 1;
      int found = pos(nantWordSearch, lineText, start, "U");
      while (found > 0) {
         int groupStart = pos('S1');
         int groupLen = pos('1');
         int groupEnd = groupStart + groupLen;
         _str symbol = substr(lineText, groupStart, groupLen);