summaryrefslogtreecommitdiff
path: root/idl
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-02-15 15:36:14 +0200
committerNoel Grandin <noel@peralex.com>2016-02-15 15:47:30 +0200
commit645394f02334548d6158187308cffd65b0b4ec77 (patch)
treec3f8eae03b77955d93a2441d5968662d8bb64a5e /idl
parentf7520bbc80b571a15adca5279cc7fc5e8965e53c (diff)
cid#1352218 and cid#1352216 in .SDI parser
Change-Id: I273d80b4e9fb45955c5496cf5559df5dd4b057b0
Diffstat (limited to 'idl')
-rw-r--r--idl/inc/parser.hxx6
-rw-r--r--idl/source/prj/command.cxx3
-rw-r--r--idl/source/prj/parser.cxx53
3 files changed, 16 insertions, 46 deletions
diff --git a/idl/inc/parser.hxx b/idl/inc/parser.hxx
index ccd2f64ae06d..225836967c00 100644
--- a/idl/inc/parser.hxx
+++ b/idl/inc/parser.hxx
@@ -36,9 +36,9 @@ class SvIdlParser
SvTokenStream & rInStm;
public:
SvIdlParser( SvIdlDataBase& rBase_, SvTokenStream & rInStrm_) : rBase(rBase_), rInStm(rInStrm_) {}
- bool ReadSvIdl( bool bImported, const OUString & rPath );
- bool ReadModuleHeader(SvMetaModule& rModule);
- bool ReadModuleBody(SvMetaModule& rModule);
+ void ReadSvIdl( bool bImported, const OUString & rPath );
+ void ReadModuleHeader(SvMetaModule& rModule);
+ void ReadModuleBody(SvMetaModule& rModule);
void ReadModuleElement( SvMetaModule& rModule );
void ReadInclude( SvMetaModule& rModule );
void ReadInterfaceOrShell( SvMetaModule& rModule, MetaTypeType aMetaTypeType );
diff --git a/idl/source/prj/command.cxx b/idl/source/prj/command.cxx
index 3b4467948526..c12c1e755523 100644
--- a/idl/source/prj/command.cxx
+++ b/idl/source/prj/command.cxx
@@ -126,8 +126,7 @@ bool ReadIdl( SvIdlWorkingBase * pDataBase, const SvCommand & rCommand )
SvTokenStream aTokStm( aFileName );
try {
SvIdlParser aParser(*pDataBase, aTokStm);
- if( !aParser.ReadSvIdl( false, rCommand.aPath ) )
- return false;
+ aParser.ReadSvIdl( false, rCommand.aPath );
} catch (const SvParseException& ex) {
pDataBase->SetError(ex.aError);
pDataBase->WriteError(aTokStm);
diff --git a/idl/source/prj/parser.cxx b/idl/source/prj/parser.cxx
index cdd80dfecbff..8f368b4d2c32 100644
--- a/idl/source/prj/parser.cxx
+++ b/idl/source/prj/parser.cxx
@@ -26,63 +26,38 @@
#include <globals.hxx>
#include <osl/file.hxx>
-bool SvIdlParser::ReadSvIdl( bool bImported, const OUString & rPath )
+void SvIdlParser::ReadSvIdl( bool bImported, const OUString & rPath )
{
rBase.SetPath(rPath); // only valid for this iteration
- bool bOk = true;
SvToken& rTok = rInStm.GetToken();
- while( bOk )
+ while( true )
{
rTok = rInStm.GetToken();
if( rTok.IsEof() )
- return true;
+ return;
if( rTok.Is( SvHash_module() ) )
{
tools::SvRef<SvMetaModule> aModule = new SvMetaModule( bImported );
- if( ReadModuleHeader(*aModule) )
- rBase.GetModuleList().push_back( aModule );
- else
- bOk = false;
+ ReadModuleHeader(*aModule);
+ rBase.GetModuleList().push_back( aModule );
}
- else
- bOk = false;
- }
- if( !bOk || !rTok.IsEof() )
- {
- // error treatment
- rBase.WriteError( rInStm );
- return false;
}
- return true;
}
-bool SvIdlParser::ReadModuleHeader(SvMetaModule& rModule)
+void SvIdlParser::ReadModuleHeader(SvMetaModule& rModule)
{
- sal_uInt32 nTokPos = rInStm.Tell();
- SvToken& rTok = rInStm.GetToken_Next();
- bool bOk = true;
-
- rTok = rInStm.GetToken_Next();
- if( !rTok.IsIdentifier() )
- {
- rInStm.Seek( nTokPos );
- return false;
- }
+ rInStm.GetToken_Next();
+ OString aName = ReadIdentifier();
rBase.Push( &rModule ); // onto the context stack
- rModule.SetName( rTok.GetString() );
- bOk = ReadModuleBody(rModule);
+ rModule.SetName( aName );
+ ReadModuleBody(rModule);
rBase.GetStack().pop_back(); // remove from stack
- if( !bOk )
- rInStm.Seek( nTokPos );
- return bOk;
}
-bool SvIdlParser::ReadModuleBody(SvMetaModule& rModule)
+void SvIdlParser::ReadModuleBody(SvMetaModule& rModule)
{
- sal_uInt32 nTokPos = rInStm.Tell();
- bool bOk = true;
if( rInStm.ReadIf( '[' ) )
{
while( true )
@@ -100,7 +75,7 @@ bool SvIdlParser::ReadModuleBody(SvMetaModule& rModule)
}
if( !rInStm.ReadIf( '{' ) )
- return bOk;
+ return;
sal_uInt32 nBeginPos = 0;
while( nBeginPos != rInStm.Tell() )
@@ -110,10 +85,6 @@ bool SvIdlParser::ReadModuleBody(SvMetaModule& rModule)
rInStm.ReadIfDelimiter();
}
ReadChar( '}' );
-
- if( !bOk )
- rInStm.Seek( nTokPos );
- return bOk;
}
void SvIdlParser::ReadModuleElement( SvMetaModule& rModule )