RE: keyword value(s) newline

[email protected] Wed, 12 May 2004 15:28:34 +0200
Newsgroups perl.recdescent
Message-ID <[email protected]>
Sorry, small typo in my mail - the startrule is actually 
called "mmpfile" in my script. So the (non-working) script is:

> -----Original Message-----
> From: ext [mailto:[email protected]]
 
> $parser = Parse::RecDescent->new(q(
> 
> mmpfile: chunk(s) /^\Z/
> 
> chunk: comment | <skip: /[ \t]*/> assignment | <error>
> 
> comment: c_comment | cpp_comment
> 
> cpp_comment: m{//([^\n]*)} { 	
> 	push @::cpp_comment, $1;
> 	1;
> }
> 
> c_comment: m{/[*](.*?)[*]/}s {
> 	push @::c_comment, $1;
> 	1;
> }
> 
> assignment: keyword value(s) /\n/ {
> 	push @::keyword, $item{keyword};
> 	push @::value, join ' ', @{$item{'value(s)'};
> 	1;
> }
> 
> value: file | type | uid
> 
> file: m{[\w\\/.-]+}
> 
> type: /APP/i | /DLL/i
> 
> uid: /0x[0-9A-F]+/i
> 
> keyword: 
> 	/^AIF/im |
> 	/^DOCUMENT/im |
> 	/^LANG/im |
> 	/^LIBRARY/im |
> 	/^RESOURCE/im |
> 	/^SOURCE/im |
> 	/^SOURCEPATH/im |
> 	/^SYSTEMINCLUDE/im |
> 	/^TARGETPATH/im |
> 	/^TARGETTYPE/im |
> 	/^TARGET/im |
> 	/^UID/im |
> 	/^USERINCLUDE/im
> 
> )) or die 'Bad grammar';
> $text .= $_ while (<DATA>);
> defined $parser->mmpfile($text) or die 'bad text';
> 
> __DATA__
> 
> TARGET		CNetB.dll
> TARGETTYPE	dll
> UID			0x10000e5e 0x102F43DB
> 
> SOURCEPATH	..\NetBSrc 
> SOURCE		CNetB.cpp  CNetBSerialBase.cpp 
> CNetBBluetoothModule.cpp
> SOURCE		CSnakeActiveWrapper.cpp
> 
> USERINCLUDE	..\NetBInc
> SYSTEMINCLUDE	\Epoc32\include \Epoc32\include\oem
> 
> LIBRARY		euser.lib efsrv.lib c32.lib // added on 
> 01.01.2002
> LIBRARY		esock.lib bluetooth.lib btdevice.lib 
> btmanclient.lib
> LIBRARY		btextnotifiers.lib sdpagent.lib
> 
> /*
> START WINS
> BASEADDRESS     0x46200000
> END
> 
> #if ( (defined ( WINS ) ) || ( defined (WINSCW) ) )
> SOURCEPATH      ..\SwImp\src
> SOURCE          CApiCamSpecsImpSw.cpp
> #else
> SOURCEPATH      ..\Mirage1\src
> SOURCE          CApiCamHandlerImpMirage1.cpp
> #endif
> */
> 


And the error message is here (for some reason keyword doesn't match):

|assignment|Trying subrule: [keyword]             |
|assignment|<<Didn't match subrule: [keyword]>>   |