问题描述
我公司开发人员对一个代码库的修改历史。请用C#来编写一个词法分析(Parse)程序来提取以下要求的字段组成的修改纪录,并将结果写入一个或多个文件中。字段之间(field)用'|'分隔。具体分析的结果要求如下:a)每个纪录应包含下列字段:ChangeID:给每项修改记录分配一个唯一的序号。ChangedDate:提取原始修改记录中的MM/DD/YYYY格式的日期。ChangedBy:提取原始修改记录中紧跟在日期之后的开发人员名字。Summary:提取原始修改记录中由'*)'给出的修改摘要。Description:提取原始修改记录中由'Description:'给出的修改说明。Purpose:提取原始修改记录中由'Purpose:'给出的修改目的说明。ChangedFiles:提取原始修改记录中由'ChangedFiles:'给出的修改文件列表。AddedFiles:提取原始修改记录中由'AddedFiles:'给出的新增文件列表。b)请用'*)'作为一项修改的标示(而不是日期)。因为一个开发人员在同一天可以做多项修改。在同一日期下的多个'*)'应被分割成多个修改纪录。c)在"Description:"下可能会有多项由"-"给出的说明项。代码库的修改历史如下:ChangeHistory:11/12/2004,Simon*)Addedthisfile.11/16/2004,Johnason*)SupportsavingTDFfileChangedFiles:SystemConfig.cpp/hAddedfiles:TDF.cpp/hDescription:-AddNIST_SUPPORTincls_cls.cfg-Addcls_nist.cfg.Asampleandexplainationisputinmisc-AddanewclassCTDF,whichcallssomefunctionsoflscvt.libandtdf.lib.Comments:-CTDFneedtobeenhanced.Thebasicideaistouseabaseclassforiniting,readingexistingTDFfileandsavingrepackedTDFfile.Nobindingdata(avirtualfunction)inbaseclass.Threenewclasswillbederivedfromthebaseclasstobindthreekindsofdata:fromWinCtrlSet,cls_nist.cfg,images.ThenClsMainandClsDataEntrycancalldifferentclassastheyrequired.11/23/2004,Johnason*)FloridapaymentinterfaceChangedfiles:SystemConfig.cpp/hDescription:-ItmapFirstName,LastName,MidName,SufNamebefore.NowitonlymaptheNamefield.*)FlatAppVersionChangedfiles:SystemConfig.cpp/hDescription:-ReadnFlatAppVersioninCls_cls.cfg12/01/2004,Johnason*)Addcodetodeletetransactionsfromnist_ipa,nist_ipa_pm,nist_ipa_print,nist_ipa_print_pmChangedfiles:-SystemTrans.cpp-SystemTransNew.cpp-SystemTrans.hDescription:-Addonenewfunction:CLSTransDeleteException-CallthisnewfunctioninCLSTransDeleteRec()andCLSTransNewDeleteRec()-Inthiscase,thesefourtablesshouldnotbeputinINFO_TABLE.Beforeweputthemintoit,whichwillcauseabug:Whenthetransactionhasexceptionandhasbeenscanned,theexceptionwillberemovedifuserviewsdemoandsavesit.12/02/2004,Johnason*)AddconfigitemFLAT_PHOTOincls_scan.cfgChangedfiles:-SystemConfig.cpp-SystemDb.hDescription:-AddcodetoreadFLAT_PHOTOincls_scan.cfg.12/02/2004,Eric*)UpdatedlogicofcheckingFBIresponsesChangedfiles:-DaoQTransNew.cppDescription:-NewlogictocheckFBIresponse12/06/2004,Eric*)UpdatedCLSTransInsertEmailRec()Changedfiles:-SystemTrans.cppDescription:-ThevariableszTblRevneedsmemset12/08/2004,Eric*)AddednewSEND_OPTIONtocls_cls.cfgDescription:-Checkwhetherallmandatorydatahavebeencapturedandtransactionisreadyforsendingout-SEND_OPTION=11111100DataEntry|TP|Palm|Photo|Sign|DemoImage|Reserved|ReservedChangedfiles:SystemConfig.cpp/h,SystemTransNew.cpp/h12/09/2004,Eric*)AddednewCLEAN_WHEN_LOGOFFtocls_cls.cfgThisistodeleteallcompletedtransactionswhenlog-off(forUSSS-Child)Changedfiles:-SystemConfig.cpp/h12/10/2004,Johnason*)AddaconfigitemPALM_CHECK_VERSIONincls_scan.cfgChangedfiles:SystemConfig.cpp/hDescription:Thedefaultvalueis0.Ifitissetto2,usethenewalgorithmofpalmsequencecheck.12/11/2004,Johnason*)Addseverlparametersforpalmsequencecheckincls_scan.cfgChangedfiles:SystemConfig.cpp/hDescription:AddthemfornewalgorithmofpalmsequencecheckDefaultvaluesare012/13/2004,Johnason*)AddCHECK_IMAGE_BEFORE_SCANincls_scan.cfgChangedfiles:SystemConfig.cpp/hDescription:AddClsCfgScan.bCheckImageBeforeScanforCHECK_IMAGE_BEFORE_SCAN.Thedefaultvalueisfalse.*)Addamessageincls_msg.cfg.itisusetoshowamessagetoaskuserwhetherignoretheexistingimages.Changedfiles:LSGlobal.cppDescription:EnlargeCLSCfgMsgsizeto39,andaddthenewmessageitem.12/13/2004,Johnason*)FixalogicprobleminFilterChangedFiles:SystemTransNew.cpp,DaoQTransNew.cppPurpose:-Filterdidn'tworkforthetransactionsthatcamefrombridgeserver.-ReasonisintheFilterSQLstatement,itputthewrongconditionorderforANDandORstatement.Description:-ChangecodeinLoadNewQTrans,CLSTransNewLoadQfunctions-Addparenthesisesforconditionstatementandadjustthesequence.12/16/2004,Simon*)AddedanewfunctionCLSIoLogSprintftosupportflexibleloggingcapabilitywhichintroducesthedependencyoninclude/af_log.handgdslib/gd_pub.h.Changedfiles:SystemIo.cpp/h12/17/2004,Eric*)Addedanewconfigitemtocls_scan.cfg,FLAT_PALM_OPTIONALChangedfiles:SystemConfig.cpp/h*)Addedanewconfigitemtocls_scan.cfg,EXCEPTION_ALWAYSAlwayssaveexcpetiondata(ForMexico)Changedfiles:SystemConfig.cpp/h*)AddedanewfunctioncallCLSDbDeleteRecord()Changedfiles:SystemDb.cpp/h01/06/2005,Simon*)ChangeddatastructureCLS_CFG_CALLTABandfunctionsCLSCfgLoadCalltab()andCLSIoCallApp()tosupportapplicationmoduleinDLLmode;*)AddedfunctionCLSCfgGetFileNametogetconfigurationfileinordertoreduceredundantcode;*)Addedcls_*.cfgforreference.ChangedFiles:SystemConfig.cpp/h,SystemIo.cpp/hAddedFiles:cls_*.cfgDescription:-Newchangeskeepcompatiblewithpreviousinstallations.Onlywhenthebinaryextensionis'dll',thesystemwilltrytoloadthegivenDLLatruntimeandgetthefunction'StartDllModule'tolaunchtheDLLmodule.01/07/2005,Simon*)AddednewconfigurationitemUID_POLICYincls_login_ldap.cfgtocontrolbehaviorwhenuidcannotobtainedfromActiveDirectory.Purpose:ThischangeistoaccommodatechangesmadeincoldapitoeliminiatetherequirementofmaintainingUIDbyenduserssuchasUSSS.ChangedFiles:SystemConfig.cpp/h,cls_login_ldap.cfg01/10/2005,Eric*)IncreasedCLS_TRANS_NEWQ_TXSNO_LENto30inSystemTransNew.h,toenlargetrans_nobufferto30charlong*)UpdateCLSCfgGetAutoTransNo()inSystemConfig.cpp,tosupportautoserialas13charlong01/18/2005,Simon*)FixedfunctionprototypesofStartDllModuleforruntimeloading.ChangesFiles:SystemIo.h
解决方案
解决方案二:
看看编译原理,随便整个状态机就ok了我做过,难度不大