question: public void parseLib ( Map < String , Object > dataModel , String fullText ) throws ParseException { Matcher m ; fullText = tmplHelper . normalizeText ( fullText ) ; m = commentPat . matcher ( fullText ) ; if ( ! m . find ( ) ) { throw new ParseException ( "Missing file top comment" ) ; } String introText = tmplHelper . stripCommentLeadingAsterix ( tmplHelper . cleanTextValue ( m . group ( 1 ) ) ) ; dataModel . put ( "introText" , introText ) ; Matcher introm = tmplHelper . getFirstLineMatcher ( introText ) ; if ( introm . matches ( ) ) { dataModel . put ( "pageTitle" , tmplHelper . cleanTextValue ( introm . group ( 1 ) ) ) ; dataModel . put ( "pageDesc" , tmplHelper . cleanTextValue ( introm . group ( 2 ) ) ) ; } String currentSectionName = "default" ; Map < String , Object > sectionInfo = makeObjectMap ( ) ; sectionInfo . put ( "name" , currentSectionName ) ; sectionInfo . put ( "title" , null ) ; sectionInfo . put ( "type" , "default" ) ; sectionInfo . put ( "comment" , "" ) ; Map < String , Map < String , Object > > sectionEntryMap = makeDataMap ( ) ; sectionInfo . put ( "entryMap" , sectionEntryMap ) ; Map < String , Map < String , Object > > entryMap = makeDataMap ( ) ; Map < String , Map < String , Object > > sectionMap = makeDataMap ( ) ; sectionMap . put ( "default" , sectionInfo ) ; while ( m . find ( ) ) { String comment = tmplHelper . cleanTextValue ( m . group ( 1 ) ) ; Matcher subm ; subm = sectionPat . matcher ( comment ) ; if ( subm . matches ( ) ) { currentSectionName = tmplHelper . cleanTextValue ( subm . group ( 1 ) ) ; sectionInfo = makeObjectMap ( ) ; sectionInfo . put ( "name" , currentSectionName ) ; sectionInfo . put ( "title" , currentSectionName ) ; sectionInfo . put ( "type" , "sub" ) ; sectionInfo . put ( "comment" , tmplHelper . cleanTextValue ( tmplHelper . stripCommentLeadingAsterix ( subm . group ( 2 ) ) ) ) ; sectionEntryMap = makeDataMap ( ) ; sectionInfo . put ( "entryMap" , sectionEntryMap ) ; sectionMap . put ( currentSectionName , sectionInfo ) ; } else { subm = entryPat . matcher ( comment ) ; if ( subm . matches ( ) ) { String entryTitle = tmplHelper . cleanTextValue ( subm . group ( 1 ) ) ; String entryBody = tmplHelper . cleanTextValue ( subm . group ( 2 ) ) ; String postEntryText = fullText . substring ( m . end ( ) ) ; try { Map < String , Object > entryInfo = parseEntry ( entryTitle , entryBody , postEntryText ) ; entryInfo . put ( "sectionName" , currentSectionName ) ; String entryName = ( String ) entryInfo . get ( "name" ) ; if ( entryName == null || entryName . isEmpty ( ) ) { throw new ParseException ( "Could not determine a formal name for the entry (function, macro or variable name)" ) ; } if ( entryMap . containsKey ( entryName ) ) { throw new ParseException ( "Duplicate entry: " + entryName ) ; } entryMap . put ( entryName , entryInfo ) ; sectionEntryMap . put ( entryName , entryInfo ) ; } catch ( ParseException e ) { throw new ParseException ( "Error parsing entry '" + entryTitle + "': " + e . getMessage ( ) , e ) ; } } else { ; } } } msgHandler . logInfo ( " - entries: " + entryMap . size ( ) + ", sections: " + sectionMap . size ( ) ) ; dataModel . put ( "sectionMap" , sectionMap ) ; dataModel . put ( "entryMap" , entryMap ) ; }
target:  Main lib parsing method. <p> NOTE: this is very inefficient, but doesn't matter.