.O implemented.

This commit is contained in:
Timur Pocheptsov 2013-08-13 11:06:58 +02:00 committed by sftnight
parent 977f4c4dfc
commit b23e62fe11
2 changed files with 45 additions and 7 deletions

View File

@ -106,10 +106,10 @@ namespace cling {
*resultValue = StoredValueRef::invalidValue();
return isLCommand(actionResult)
|| isXCommand(actionResult, resultValue)
|| isqCommand()
|| isUCommand(actionResult) || isICommand() || israwInputCommand()
|| isprintASTCommand() || isdynamicExtensionsCommand() || ishelpCommand()
|| isfileExCommand() || isfilesCommand() || isClassCommand()
|| isqCommand() || isUCommand(actionResult) || isICommand()
|| isOCommand() || israwInputCommand() || isprintASTCommand()
|| isdynamicExtensionsCommand()
|| ishelpCommand() || isfileExCommand() || isfilesCommand() || isClassCommand()
|| isgCommand() || isTypedefCommand() || isprintIRCommand()
|| isShellCommand(actionResult, resultValue);
}
@ -204,6 +204,40 @@ namespace cling {
}
return false;
}
bool MetaParser::isOCommand() {
const Token& currTok = getCurTok();
if (currTok.is(tok::ident)) {
llvm::StringRef ident = currTok.getIdent();
if (ident.startswith("O")) {
if (ident.size() > 1) {
int level = 0;
if (!ident.substr(1).getAsInteger(10, level) && level >= 0) {
consumeAnyStringToken(tok::eof);
if (getCurTok().is(tok::raw_ident))
return false;
//TODO: Process .OXXX here as .O with level XXX.
return true;
}
} else {
consumeAnyStringToken(tok::eof);
const Token& lastStringToken = getCurTok();
if (lastStringToken.is(tok::raw_ident) && lastStringToken.getLength()) {
int level = 0;
if (!lastStringToken.getIdent().getAsInteger(10, level) && level >= 0) {
//TODO: process .O XXX
return true;
}
} else {
//TODO: process .O
return true;
}
}
}
}
return false;
}
bool MetaParser::israwInputCommand() {
if (getCurTok().is(tok::ident) &&

View File

@ -26,9 +26,9 @@ namespace cling {
// Command syntax: MetaCommand := <CommandSymbol><Command>
// CommandSymbol := '.' | '//.'
// Command := LCommand | XCommand | qCommand | UCommand
// ICommand | RawInputCommand | PrintASTCommand
// DynamicExtensionsCommand | HelpCommand |
// Command := LCommand | XCommand | qCommand | UCommand |
// ICommand | OCommand | RawInputCommand |
// PrintASTCommand | DynamicExtensionsCommand | HelpCommand |
// FileExCommand | FilesCommand | ClassCommand |
// GCommand | PrintIRCommand
// LCommand := 'L' FilePath
@ -36,6 +36,7 @@ namespace cling {
// XCommand := 'x' FilePath[ArgList] | 'X' FilePath[ArgList]
// UCommand := 'U'
// ICommand := 'I' [FilePath]
// OCommand := 'O'[' ']OptimizationLevel
// RawInputCommand := 'rawInput' [Constant]
// PrintASTCommand := 'printAST' [Constant]
// PrintIRCommand := 'printIR' [Constant]
@ -51,6 +52,8 @@ namespace cling {
// AnyString := *^(' ' | '\t')
// Constant := 0|1
// Ident := a-zA-Z{a-zA-Z0-9}
// OptimizationLevel := OptimizationLevel{0-9}
//
class MetaParser {
private:
llvm::OwningPtr<MetaLexer> m_Lexer;
@ -74,6 +77,7 @@ namespace cling {
bool isqCommand();
bool isUCommand(MetaSema::ActionResult& actionResult);
bool isICommand();
bool isOCommand();
bool israwInputCommand();
bool isprintASTCommand();
bool isprintIRCommand();