//TH-Header //***************************************************************************************** // Copyright (c) 2001 Michael Kurz // All rights reserved. // If you want to use this source in your applications conatct: // // $FileName : cSrcLineParser.pkg // $ProjectName : Codemax // $Author : Michael Kurz // $Created : 19.05.2001 09:37 // // Contents: // A lineParser which is designed to parse VDF SrcCode Lines, generally it parses // with Blanks as seperators but statement between " " or () are treated as one part. //***************************************************************************************** //TH-RevisionStart //TH-RevisionEnd Class cSrcLineParser Is an Array Procedure Construct_Object Forward Send Construct_Object Property String psComment Public "" Property integer piSkipComments Public True End_Procedure Procedure ParseLine String sLine Integer inString inParenthesis Integer iStartPos iLen iChar iC iPos String sChar sPart sComment Send Delete_Data Move (Trim(sLine)) To sLine Move (Length(sLine)) To iLen If (piSkipComments(Self)) Begin Move (Pos(("/"+"/"),sLine)) To iPos If (iPos Gt 0) Begin Move (Right(sLine,iLen-iPos-1)) To sComment Move (Left(sLine,iPos-1)) To sLine Set psComment To sComment End Else Set psComment To "" End Else Set psComment To "" Move (Replaces(Character(9),sLine," ")) To sLine // Replace TABS with Blanks. Append sLine " " For iChar From 1 To iLen Move (Mid(sLine,1,iChar)) To sChar If sChar Ne " " If iStartPos Eq 0 Move iChar To iStartPos If sChar Eq "(" Increment inParenthesis If sChar Eq ")" Decrement inParenthesis If sChar Eq (Character(34)) Begin If inString Move 0 To inString Else Move 1 To inString End If inParenthesis Eq 0 If inString Eq 0 If sChar Eq " " Begin Move (Trim(Mid(sLine,iChar-iStartPos,iStartPos))) To sPart If sPart Ne "" Set value Item (Item_Count(Self)) To sPart Move 0 To iStartPos End End If iStartPos Gt 0 Begin Move (Trim(Mid(sLine,iChar-iStartPos,iStartPos))) To sPart If sPart Ne "" Set value Item (Item_Count(Self)) To sPart End End_Procedure End_Class