120120#define DEBUGVALS 0 /* 1 causes detailed internal state output to R console */
121121#define DEBUGMODE 0 /* 1 causes Bison output of parse state, to stdout or stderr */
122122
123- static Rboolean wCalls = TRUE ;
124- static Rboolean warnDups = FALSE ;
123+ static bool wCalls = true ;
124+ static bool warnDups = false ;
125125
126126#define YYERROR_VERBOSE 1
127127
@@ -208,7 +208,7 @@ struct ParseState {
208208 ParseState * prevState ;
209209};
210210
211- static Rboolean busy = FALSE ;
211+ static bool busy = false ;
212212static ParseState parseState ;
213213
214214#define PRESERVE_SV (x ) R_PreserveInMSet((x), parseState.mset)
@@ -3141,7 +3141,7 @@ static SEXP xxnewcommand(SEXP cmd, SEXP name, SEXP defn, YYLTYPE *lloc)
31413141#define START_MACRO -2
31423142#define END_MACRO -3
31433143
3144- static Rboolean isComment (SEXP elt )
3144+ static bool isComment (SEXP elt )
31453145{
31463146 SEXP a = getAttrib (elt , R_RdTagSymbol );
31473147 return isString (a ) && LENGTH (a ) == 1 &&
@@ -3552,9 +3552,9 @@ static void InitSymbols(void)
35523552 R_MacroSymbol = install ("macro" );
35533553}
35543554
3555- static SEXP ParseRd (ParseStatus * status , SEXP srcfile , Rboolean fragment , SEXP macros )
3555+ static SEXP ParseRd (ParseStatus * status , SEXP srcfile , bool fragment , SEXP macros )
35563556{
3557- Rboolean keepmacros = !isLogical (macros ) || asLogical (macros );
3557+ bool keepmacros = !isLogical (macros ) || asLogical (macros );
35583558
35593559 InitSymbols ();
35603560 R_ParseContextLast = 0 ;
@@ -3621,7 +3621,7 @@ static int con_getc(void)
36213621}
36223622
36233623static
3624- SEXP R_ParseRd (Rconnection con , ParseStatus * status , SEXP srcfile , Rboolean fragment , SEXP macros )
3624+ SEXP R_ParseRd (Rconnection con , ParseStatus * status , SEXP srcfile , bool fragment , SEXP macros )
36253625{
36263626 con_parse = con ;
36273627 ptr_getc = con_getc ;
@@ -4471,7 +4471,7 @@ static void PushState(void) {
44714471 parseState .prevState = prev ;
44724472 } else
44734473 parseState .prevState = NULL ;
4474- busy = TRUE ;
4474+ busy = true ;
44754475}
44764476
44774477static void PopState (void ) {
@@ -4480,7 +4480,7 @@ static void PopState(void) {
44804480 UseState (prev );
44814481 free (prev );
44824482 } else
4483- busy = FALSE ;
4483+ busy = false ;
44844484}
44854485
44864486/* "do_parseRd"
@@ -4495,7 +4495,7 @@ SEXP parseRd(SEXP call, SEXP op, SEXP args, SEXP env)
44954495
44964496 SEXP s = R_NilValue , source ;
44974497 Rconnection con ;
4498- Rboolean wasopen , fragment ;
4498+ bool wasopen , fragment ;
44994499 int ifile , wcall ;
45004500 ParseStatus status ;
45014501 RCNTXT cntxt ;
@@ -4521,13 +4521,13 @@ SEXP parseRd(SEXP call, SEXP op, SEXP args, SEXP env)
45214521 error (_ ("invalid '%s' value" ), "verbose" );
45224522 parseState .xxDebugTokens = asInteger (CAR (args )); args = CDR (args );
45234523 parseState .xxBasename = CHAR (STRING_ELT (CAR (args ), 0 )); args = CDR (args );
4524- fragment = asRboolean (CAR (args )); args = CDR (args );
4524+ fragment = asBool (CAR (args )); args = CDR (args );
45254525 wcall = asLogical (CAR (args )); args = CDR (args );
45264526 if (wcall == NA_LOGICAL )
45274527 error (_ ("invalid '%s' value" ), "warningCalls" );
4528- wCalls = (Rboolean ) wcall ;
4528+ wCalls = (bool ) wcall ;
45294529 macros = CAR (args ); args = CDR (args );
4530- warnDups = asRboolean (CAR (args ));
4530+ warnDups = asBool (CAR (args ));
45314531
45324532 if (ifile >= 3 ) {/* file != "" */
45334533 if (!wasopen ) {
@@ -4559,10 +4559,11 @@ SEXP parseRd(SEXP call, SEXP op, SEXP args, SEXP env)
45594559SEXP deparseRd (SEXP e , SEXP state )
45604560{
45614561 SEXP result ;
4562- int outlen , * statevals , quoteBraces , inRComment ;
4562+ int outlen , * statevals , quoteBraces ;
4563+ bool inRComment ;
45634564 const char * c ;
45644565 char * outbuf , * out , lookahead ;
4565- Rboolean escape ;
4566+ bool escape ;
45664567
45674568 if (!isString (e ) || LENGTH (e ) != 1 )
45684569 error (_ ("'deparseRd' only supports deparsing character elements" ));
@@ -4590,29 +4591,29 @@ SEXP deparseRd(SEXP e, SEXP state)
45904591 if (* c == '{' || * c == '}' || * c == '%' || * c == '\\' ) outlen ++ ;
45914592 }
45924593 out = outbuf = R_chk_calloc (outlen + 1 , sizeof (char ));
4593- inRComment = FALSE ;
4594+ inRComment = false ;
45944595 for (c = CHAR (e ); * c ; c ++ ) {
4595- escape = FALSE ;
4596+ escape = false ;
45964597 if (parseState .xxmode != UNKNOWNMODE ) {
45974598 switch (* c ) {
45984599 case '\\' :
45994600 if (parseState .xxmode == RLIKE && parseState .xxinRString ) {
46004601 lookahead = * (c + 1 );
46014602 if (lookahead == '\\' || lookahead == parseState .xxinRString || lookahead == 'l' )
4602- escape = TRUE ;
4603+ escape = true ;
46034604 break ;
46044605 } /* fall through to % case for non-strings... */
46054606 case '%' :
46064607 if (parseState .xxmode != COMMENTMODE && !parseState .xxinEqn )
4607- escape = TRUE ;
4608+ escape = true ;
46084609 break ;
46094610 case LBRACE :
46104611 case RBRACE :
46114612 if (quoteBraces || parseState .xxmode == LATEXLIKE )
4612- escape = TRUE ;
4613+ escape = true ;
46134614 else if (!parseState .xxinRString && !parseState .xxinEqn && (parseState .xxmode == RLIKE || parseState .xxmode == VERBATIM )) {
46144615 if (* c == LBRACE ) parseState .xxbraceDepth ++ ;
4615- else if (parseState .xxbraceDepth <= 0 ) escape = TRUE ;
4616+ else if (parseState .xxbraceDepth <= 0 ) escape = true ;
46164617 else parseState .xxbraceDepth -- ;
46174618 }
46184619 break ;
@@ -4627,10 +4628,10 @@ SEXP deparseRd(SEXP e, SEXP state)
46274628 break ;
46284629 case '#' :
46294630 if (parseState .xxmode == RLIKE && !parseState .xxinRString )
4630- inRComment = TRUE ;
4631+ inRComment = true ;
46314632 break ;
46324633 case '\n' :
4633- inRComment = FALSE ;
4634+ inRComment = false ;
46344635 break ;
46354636 }
46364637 }
0 commit comments