src/Generic/patterns/PatternSet.cpp
// Create the reference patterns (shortcuts).  Note that this is the only
// place where we allow patterns to contain shortcut labels.

Create the reference patterns (shortcuts).  Note that this is the only
place where we allow patterns to contain shortcut labels.
Create the reference patterns ( shortcuts ) . Note that this is the only place where we allow patterns to contain shortcut labels .
BOOST_FOREACH(Sexp *refSexp, referenceSexps) {
		int n_ref_patterns = refSexp->getNumChildren() - 1;
		for (int j = 0; j < n_ref_patterns; j++) {
			Sexp* refPatSexp = refSexp->getNthChild(j+1);
			Pattern_ptr refPattern = Pattern::parseSexp(
				refPatSexp, _entityLabels, _wordSets, true);
			Symbol shortcut = refPattern->getShortcut();
			if (shortcut.is_null())
				throwParseError(refPatSexp, "Reference patterns must have shortcut names");
			if (_referencePatterns.find(shortcut) != _referencePatterns.end())
				throwParseError(refPatSexp, "Duplicate shortcut name");
			try {
				refPattern = refPattern->replaceShortcuts(_referencePatterns);	
			} catch (UnexpectedInputException& e) {
				std::ostringstream err;
				err << "\n\nIn reference pattern: " << refPatSexp->to_debug_string() << "\n\n";
				err << e.getMessage();
				throw UnexpectedInputException("PatternSet::initializeFromSexp", err.str().c_str());
			}
			_referencePatterns[shortcut] = refPattern;
		}
	}
BOOST_FOREACH ( Sexp * refSexp , referenceSexps ) { int n_ref_patterns = refSexp -> getNumChildren ( ) - 1 ; for ( int j = 0 ; j < n_ref_patterns ; j ++ ) { Sexp * refPatSexp = refSexp -> getNthChild ( j + 1 ) ; Pattern_ptr refPattern = Pattern :: parseSexp ( refPatSexp , _entityLabels , _wordSets , true ) ; Symbol shortcut = refPattern -> getShortcut ( ) ; if ( shortcut . is_null ( ) ) throwParseError ( refPatSexp , " " ) ; if ( _referencePatterns . find ( shortcut ) != _referencePatterns . end ( ) ) throwParseError ( refPatSexp , " " ) ; try { refPattern = refPattern -> replaceShortcuts ( _referencePatterns ) ; } catch ( UnexpectedInputException & e ) { std :: ostringstream err ; err << " \n \n " << refPatSexp -> to_debug_string ( ) << " \n \n " ; err << e . getMessage ( ) ; throw UnexpectedInputException ( " " , err . str ( ) . c_str ( ) ) ; } _referencePatterns [ shortcut ] = refPattern ; } }
Create the reference patterns (shortcuts).
Create the reference patterns ( shortcuts ) .
// Create the reference pattern.
 // Get the shortcut name and make sure it's valid.
 // Resolve any shortcuts in the reference pattern.  Reference patterns
 // are only allowed to reference patterns that precede them in the list.
 // Add the reference pattern to _referencePatterns.  Note that we do this
 // after we replace shortcuts in refPattern -- no self-reference allowed!
