cwLex.h/cpp: test() now returns an rc_t.

This commit is contained in:
kevin 2024-04-29 09:44:45 -04:00
parent 1c678700b7
commit 70ba7316bd
2 changed files with 7 additions and 4 deletions

View File

@ -853,7 +853,7 @@ namespace cw
//) //)
//( //(
void test() rc_t test()
{ {
rc_t rc = kOkRC; rc_t rc = kOkRC;
unsigned tid = kInvalidId; unsigned tid = kInvalidId;
@ -872,8 +872,8 @@ namespace cw
// initialize a lexer with a buffer of text // initialize a lexer with a buffer of text
if((rc = lex::create(h,buf,strlen(buf), kReturnSpaceLexFl | kReturnCommentsLexFl)) != kOkRC ) if((rc = lex::create(h,buf,strlen(buf), kReturnSpaceLexFl | kReturnCommentsLexFl)) != kOkRC )
{ {
cwLogError(rc,"Lexer initialization failed."); rc = cwLogError(rc,"Lexer initialization failed.");
return; goto errLabel;
} }
// register some additional recoginizers // register some additional recoginizers
@ -913,9 +913,12 @@ namespace cw
} }
errLabel:
// finalize the lexer // finalize the lexer
lex::destroy(h); lex::destroy(h);
return rc;
} }
} }
} }

View File

@ -129,7 +129,7 @@ namespace cw
const char* idToLabel( handle_t h, unsigned typeId ); const char* idToLabel( handle_t h, unsigned typeId );
// Lexer testing stub. // Lexer testing stub.
void test( ); rc_t test( );
} }
} }