2424
2525namespace cling {
2626
27- MetaParser::MetaParser (MetaSema* Actions) : m_Lexer( " " ) {
28- m_Actions. reset (Actions);
29- const InvocationOptions& Opts = Actions-> getInterpreter ().getOptions ();
27+ MetaParser::MetaParser (MetaSema & Actions, llvm::StringRef Line) :
28+ m_Lexer (Line), m_Actions(Actions) {
29+ const InvocationOptions& Opts = Actions. getInterpreter ().getOptions ();
3030 MetaLexer metaSymbolLexer (Opts.MetaString );
3131 Token Tok;
3232 while (true ) {
@@ -37,11 +37,6 @@ namespace cling {
3737 }
3838 }
3939
40- void MetaParser::enterNewInputLine (llvm::StringRef Line) {
41- m_Lexer.reset (Line);
42- m_TokenCache.clear ();
43- }
44-
4540 void MetaParser::consumeToken () {
4641 if (m_TokenCache.size ())
4742 m_TokenCache.erase (m_TokenCache.begin ());
@@ -102,7 +97,7 @@ namespace cling {
10297 }
10398
10499 bool MetaParser::isQuitRequested () const {
105- return m_Actions-> isQuitRequested ();
100+ return m_Actions. isQuitRequested ();
106101 }
107102
108103 bool MetaParser::isCommandSymbol () {
@@ -143,11 +138,11 @@ namespace cling {
143138 consumeAnyStringToken (tok::comment);
144139 if (getCurTok ().is (tok::raw_ident)) {
145140 result = true ;
146- actionResult = m_Actions-> actOnLCommand (getCurTok ().getIdent ());
141+ actionResult = m_Actions. actOnLCommand (getCurTok ().getIdent ());
147142 consumeToken ();
148143 if (getCurTok ().is (tok::comment)) {
149144 consumeAnyStringToken (tok::eof);
150- m_Actions-> actOnComment (getCurTok ().getIdent ());
145+ m_Actions. actOnComment (getCurTok ().getIdent ());
151146 }
152147 }
153148 }
@@ -168,7 +163,7 @@ namespace cling {
168163 if (getCurTok ().is (tok::raw_ident)) {
169164 result = true ;
170165 std::string outputFile = getCurTok ().getIdent ();
171- actionResult = m_Actions-> actOnTCommand (inputFile, outputFile);
166+ actionResult = m_Actions. actOnTCommand (inputFile, outputFile);
172167 }
173168 }
174169 }
@@ -257,9 +252,9 @@ namespace cling {
257252 }
258253 // Empty file means std.
259254 actionResult =
260- m_Actions-> actOnRedirectCommand (file/* file*/ ,
261- stream/* which stream to redirect*/ ,
262- append/* append mode*/ );
255+ m_Actions. actOnRedirectCommand (file/* file*/ ,
256+ stream/* which stream to redirect*/ ,
257+ append/* append mode*/ );
263258 return true ;
264259 }
265260 return false ;
@@ -316,7 +311,7 @@ namespace cling {
316311
317312 if (args.empty ())
318313 args = " ()" ;
319- actionResult = m_Actions-> actOnxCommand (file, args, resultValue);
314+ actionResult = m_Actions. actOnxCommand (file, args, resultValue);
320315 return true ;
321316 }
322317
@@ -335,7 +330,7 @@ namespace cling {
335330 bool result = false ;
336331 if (getCurTok ().is (tok::ident) && getCurTok ().getIdent ().equals (" q" )) {
337332 result = true ;
338- m_Actions-> actOnqCommand ();
333+ m_Actions. actOnqCommand ();
339334 }
340335 return result;
341336 }
@@ -346,7 +341,7 @@ namespace cling {
346341 llvm::StringRef path;
347342 if (getCurTok ().is (tok::raw_ident)) {
348343 path = getCurTok ().getIdent ();
349- actionResult = m_Actions-> actOnUCommand (path);
344+ actionResult = m_Actions. actOnUCommand (path);
350345 return true ;
351346 }
352347 }
@@ -361,7 +356,7 @@ namespace cling {
361356 llvm::StringRef path;
362357 if (getCurTok ().is (tok::raw_ident))
363358 path = getCurTok ().getIdent ();
364- m_Actions-> actOnICommand (path);
359+ m_Actions. actOnICommand (path);
365360 return true ;
366361 }
367362 return false ;
@@ -378,7 +373,7 @@ namespace cling {
378373 consumeAnyStringToken (tok::eof);
379374 if (getCurTok ().is (tok::raw_ident))
380375 return false ;
381- actionResult = m_Actions-> actOnOCommand (level);
376+ actionResult = m_Actions. actOnOCommand (level);
382377 return true ;
383378 }
384379 } else {
@@ -389,11 +384,11 @@ namespace cling {
389384 int level = 0 ;
390385 if (!lastStringToken.getIdent ().getAsInteger (10 , level)
391386 && level >= 0 ) {
392- actionResult = m_Actions-> actOnOCommand (level);
387+ actionResult = m_Actions. actOnOCommand (level);
393388 return true ;
394389 }
395390 } else {
396- m_Actions-> actOnOCommand ();
391+ m_Actions. actOnOCommand ();
397392 actionResult = MetaSema::AR_Success;
398393 return true ;
399394 }
@@ -409,7 +404,7 @@ namespace cling {
409404 ) {
410405 consumeToken ();
411406 skipWhitespace ();
412- m_Actions-> actOnAtCommand ();
407+ m_Actions. actOnAtCommand ();
413408 return true ;
414409 }
415410 return false ;
@@ -423,7 +418,7 @@ namespace cling {
423418 skipWhitespace ();
424419 if (getCurTok ().is (tok::constant))
425420 mode = (MetaSema::SwitchMode)getCurTok ().getConstantAsBool ();
426- m_Actions-> actOnrawInputCommand (mode);
421+ m_Actions. actOnrawInputCommand (mode);
427422 return true ;
428423 }
429424 return false ;
@@ -437,7 +432,7 @@ namespace cling {
437432 skipWhitespace ();
438433 if (getCurTok ().is (tok::constant))
439434 mode = getCurTok ().getConstant ();
440- m_Actions-> actOndebugCommand (mode);
435+ m_Actions. actOndebugCommand (mode);
441436 return true ;
442437 }
443438 return false ;
@@ -451,7 +446,7 @@ namespace cling {
451446 skipWhitespace ();
452447 if (getCurTok ().is (tok::constant))
453448 mode = (MetaSema::SwitchMode)getCurTok ().getConstantAsBool ();
454- m_Actions-> actOnprintDebugCommand (mode);
449+ m_Actions. actOnprintDebugCommand (mode);
455450 return true ;
456451 }
457452 return false ;
@@ -467,7 +462,7 @@ namespace cling {
467462 return false ; // FIXME: Issue proper diagnostics
468463 std::string ident = getCurTok ().getIdentNoQuotes ();
469464 consumeToken ();
470- m_Actions-> actOnstoreStateCommand (ident);
465+ m_Actions. actOnstoreStateCommand (ident);
471466 return true ;
472467 }
473468 return false ;
@@ -483,7 +478,7 @@ namespace cling {
483478 return false ; // FIXME: Issue proper diagnostics
484479 std::string ident = getCurTok ().getIdentNoQuotes ();
485480 consumeToken ();
486- m_Actions-> actOncompareStateCommand (ident);
481+ m_Actions. actOncompareStateCommand (ident);
487482 return true ;
488483 }
489484 return false ;
@@ -500,7 +495,7 @@ namespace cling {
500495 consumeToken ();
501496 skipWhitespace ();
502497 const Token& next = getCurTok ();
503- m_Actions-> actOnstatsCommand (what, next.is (tok::ident)
498+ m_Actions. actOnstatsCommand (what, next.is (tok::ident)
504499 ? next.getIdent () : llvm::StringRef ());
505500 return true ;
506501 }
@@ -518,7 +513,7 @@ namespace cling {
518513 llvm::StringRef ident = getCurTok ().getIdent ();
519514 consumeToken ();
520515 skipWhitespace ();
521- m_Actions-> actOnstatsCommand (ident.equals (" ast" )
516+ m_Actions. actOnstatsCommand (ident.equals (" ast" )
522517 ? llvm::StringRef (" asttree" ) : ident,
523518 getCurTok ().is (tok::ident) ? getCurTok ().getIdent () : llvm::StringRef ());
524519 consumeToken ();
@@ -534,9 +529,9 @@ namespace cling {
534529 skipWhitespace ();
535530 const Token& next = getCurTok ();
536531 if (next.is (tok::constant))
537- m_Actions-> actOnUndoCommand (next.getConstant ());
532+ m_Actions. actOnUndoCommand (next.getConstant ());
538533 else
539- m_Actions-> actOnUndoCommand ();
534+ m_Actions. actOnUndoCommand ();
540535 return true ;
541536 }
542537 return false ;
@@ -550,7 +545,7 @@ namespace cling {
550545 skipWhitespace ();
551546 if (getCurTok ().is (tok::constant))
552547 mode = (MetaSema::SwitchMode)getCurTok ().getConstantAsBool ();
553- m_Actions-> actOndynamicExtensionsCommand (mode);
548+ m_Actions. actOndynamicExtensionsCommand (mode);
554549 return true ;
555550 }
556551 return false ;
@@ -560,23 +555,23 @@ namespace cling {
560555 const Token& Tok = getCurTok ();
561556 if (Tok.is (tok::quest_mark) ||
562557 (Tok.is (tok::ident) && Tok.getIdent ().equals (" help" ))) {
563- m_Actions-> actOnhelpCommand ();
558+ m_Actions. actOnhelpCommand ();
564559 return true ;
565560 }
566561 return false ;
567562 }
568563
569564 bool MetaParser::isfileExCommand () {
570565 if (getCurTok ().is (tok::ident) && getCurTok ().getIdent ().equals (" fileEx" )) {
571- m_Actions-> actOnfileExCommand ();
566+ m_Actions. actOnfileExCommand ();
572567 return true ;
573568 }
574569 return false ;
575570 }
576571
577572 bool MetaParser::isfilesCommand () {
578573 if (getCurTok ().is (tok::ident) && getCurTok ().getIdent ().equals (" files" )) {
579- m_Actions-> actOnfilesCommand ();
574+ m_Actions. actOnfilesCommand ();
580575 return true ;
581576 }
582577 return false ;
@@ -591,11 +586,11 @@ namespace cling {
591586 llvm::StringRef className;
592587 if (NextTok.is (tok::raw_ident))
593588 className = NextTok.getIdent ();
594- m_Actions-> actOnclassCommand (className);
589+ m_Actions. actOnclassCommand (className);
595590 return true ;
596591 }
597592 else if (Tok.getIdent ().equals (" Class" )) {
598- m_Actions-> actOnClassCommand ();
593+ m_Actions. actOnClassCommand ();
599594 return true ;
600595 }
601596 }
@@ -609,7 +604,7 @@ namespace cling {
609604 consumeAnyStringToken (tok::eof);
610605 if (getCurTok ().is (tok::raw_ident))
611606 return false ;
612- m_Actions-> actOnNamespaceCommand ();
607+ m_Actions. actOnNamespaceCommand ();
613608 return true ;
614609 }
615610 }
@@ -623,7 +618,7 @@ namespace cling {
623618 llvm::StringRef varName;
624619 if (getCurTok ().is (tok::ident))
625620 varName = getCurTok ().getIdent ();
626- m_Actions-> actOngCommand (varName);
621+ m_Actions. actOngCommand (varName);
627622 return true ;
628623 }
629624 return false ;
@@ -638,7 +633,7 @@ namespace cling {
638633 llvm::StringRef typedefName;
639634 if (NextTok.is (tok::raw_ident))
640635 typedefName = NextTok.getIdent ();
641- m_Actions-> actOnTypedefCommand (typedefName);
636+ m_Actions. actOnTypedefCommand (typedefName);
642637 return true ;
643638 }
644639 }
@@ -656,7 +651,7 @@ namespace cling {
656651 if (NextTok.is (tok::raw_ident)) {
657652 llvm::StringRef commandLine (NextTok.getIdent ());
658653 if (!commandLine.empty ())
659- actionResult = m_Actions-> actOnShellCommand (commandLine,
654+ actionResult = m_Actions. actOnShellCommand (commandLine,
660655 resultValue);
661656 }
662657 return true ;
0 commit comments