当前位置: 首页>>代码示例>>C++>>正文


C++ SourceCode类代码示例

本文整理汇总了C++中SourceCode的典型用法代码示例。如果您正苦于以下问题:C++ SourceCode类的具体用法?C++ SourceCode怎么用?C++ SourceCode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了SourceCode类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setCode

void Lexer::setCode(const SourceCode& source, ParserArena& arena)
{
    m_arena = &arena.identifierArena();

    m_lineNumber = source.firstLine();
    m_delimited = false;
    m_lastToken = -1;

    const UChar* data = source.provider()->data();

    m_source = &source;
    m_codeStart = data;
    m_code = data + source.startOffset();
    m_codeEnd = data + source.endOffset();
    m_error = false;
    m_atLineStart = true;

    m_buffer8.reserveInitialCapacity(initialReadBufferCapacity);
    m_buffer16.reserveInitialCapacity((m_codeEnd - m_code) / 2);

    if (LIKELY(m_code < m_codeEnd))
        m_current = *m_code;
    else
        m_current = -1;
    ASSERT(currentOffset() == source.startOffset());
}
开发者ID:0omega,项目名称:platform_external_webkit,代码行数:26,代码来源:Lexer.cpp

示例2: constructFunction

// ECMA 15.3.2 The Function Constructor
JSObject* constructFunction(ExecState* exec, const ArgList& args, const Identifier& functionName, const UString& sourceURL, int lineNumber)
{
    UString program;
    if (args.isEmpty())
        program = "(function(){})";
    else if (args.size() == 1)
        program = "(function(){" + args.at(exec, 0)->toString(exec) + "})";
    else {
        program = "(function(" + args.at(exec, 0)->toString(exec);
        for (size_t i = 1; i < args.size() - 1; i++)
            program += "," + args.at(exec, i)->toString(exec);
        program += "){" + args.at(exec, args.size() - 1)->toString(exec) + "})";
    }

    int errLine;
    UString errMsg;
    SourceCode source = makeSource(program, sourceURL, lineNumber);
    RefPtr<ProgramNode> programNode = exec->globalData().parser->parse<ProgramNode>(exec, exec->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);

    FunctionBodyNode* body = functionBody(programNode.get());
    if (!body)
        return throwError(exec, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url());

    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    ScopeChain scopeChain(globalObject, globalObject->globalData(), exec->globalThisValue());
    return new (exec) JSFunction(exec, functionName, body, scopeChain.node());
}
开发者ID:Fale,项目名称:qtmoko,代码行数:28,代码来源:FunctionConstructor.cpp

示例3: getSourceCode

SourceCode* getSourceCode()
{
	string SourceCodeNode = "SourceCode";
	TiXmlElement *pNode = NULL;

	vector<TiXmlElement *> Nodes;

	if (GetNodePointerByName(pProjectNodes,SourceCodeNode,pNode))
	{
		string urlNode = "Url";
		string versionNode = "Version";
		string localPathNode = "LocalPath";
		TiXmlElement *pTempNode = pNode;
		SourceCode* sourceCode = new SourceCode();
		if (GetChildNodeByName(pTempNode,urlNode,pNode))
		{
			sourceCode->SetUrl(pNode->GetText());
			if (GetChildNodeByName(pTempNode,versionNode,pNode))
			{
				sourceCode->SetVersion(pNode->GetText());
				if (GetChildNodeByName(pTempNode,localPathNode,pNode))
				{
					sourceCode->SetLocalPath(pNode->GetText());

					//delete pNode;
					//delete pTempNode;
					return sourceCode;
				}
			}
		}
	}

	return NULL;
}
开发者ID:songcser,项目名称:ALM,代码行数:34,代码来源:PDMBuilder.cpp

示例4: OnSingleLine

void OnSingleLine(SourceCode& sourceCode)
{
	while (sourceCode.IsPosValid())
		if (sourceCode.PeekChar() == '\n')
			return;
		else
			sourceCode.AdvanceChar();		
}
开发者ID:LYP951018,项目名称:FunnyThings,代码行数:8,代码来源:main.cpp

示例5: ScriptExecutable

FunctionExecutable::FunctionExecutable(VM& vm, const SourceCode& source, UnlinkedFunctionExecutable* unlinkedExecutable, unsigned firstLine, unsigned lastLine)
    : ScriptExecutable(vm.functionExecutableStructure.get(), vm, source, unlinkedExecutable->isInStrictContext())
    , m_unlinkedExecutable(vm, this, unlinkedExecutable)
{
    RELEASE_ASSERT(!source.isNull());
    ASSERT(source.length());
    m_firstLine = firstLine;
    m_lastLine = lastLine;
}
开发者ID:kamend,项目名称:javascriptcore-api-test,代码行数:9,代码来源:Executable.cpp

示例6: OnMultiLine

void OnMultiLine(SourceCode& sourceCode)
{
	while (sourceCode.IsPosValid())
		if (sourceCode.AdvanceIfMatch("*/"s))
			return;
		else
			sourceCode.AdvanceChar();
	throw SyntaxError("*/ lost");
}
开发者ID:LYP951018,项目名称:FunnyThings,代码行数:9,代码来源:main.cpp

示例7: ScriptExecutable

ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode& source)
    : ScriptExecutable(exec->vm().programExecutableStructure.get(), exec->vm(), source, false, DerivedContextType::None, false, EvalContextType::None, NoIntrinsic)
{
    ASSERT(source.provider()->sourceType() == SourceProviderSourceType::Program);
    m_typeProfilingStartOffset = 0;
    m_typeProfilingEndOffset = source.length() - 1;
    if (exec->vm().typeProfiler() || exec->vm().controlFlowProfiler())
        exec->vm().functionHasExecutedCache()->insertUnexecutedRange(sourceID(), m_typeProfilingStartOffset, m_typeProfilingEndOffset);
}
开发者ID:caiolima,项目名称:webkit,代码行数:9,代码来源:ProgramExecutable.cpp

示例8: normalizeUrl

 SourceCode *Interpreter::loadSourceCode(QString url) {
     url = normalizeUrl(url);
     SourceCode *source;
     if(!(source = sourceCodeIsAlreadyLoaded(url))) {
         source = LIU_SOURCE_CODE(url);
         sourceCodes()->set(Text::make(url), source);
         source->parse();
     }
     return source;
 }
开发者ID:mvila,项目名称:liu,代码行数:10,代码来源:interpreter.cpp

示例9: getCodeInfo

PDMBUILDER_API void getCodeInfo(char *url,char *version,char *localpath)
{
	SourceCode *sourceCode = getSourceCode();
	
	strcpy(url,sourceCode->GetUrl().c_str());
	strcpy(version,sourceCode->GetVersion().c_str());
	strcpy(localpath,sourceCode->GetLocalPath().c_str());

	delete sourceCode;
	//url = (char *)sourceCode->GetUrl().c_str();
	//version = (char *)sourceCode->GetVersion().c_str();
	//localpath = (char *)sourceCode->GetLocalPath().c_str();
}
开发者ID:songcser,项目名称:ALM,代码行数:13,代码来源:PDMBuilder.cpp

示例10: noValue

JSValue* DebuggerCallFrame::evaluate(const UString& script, JSValue*& exception) const
{
    if (!m_callFrame->codeBlock())
        return noValue();

    int errLine;
    UString errMsg;
    SourceCode source = makeSource(script);
    RefPtr<EvalNode> evalNode = m_callFrame->scopeChain()->globalData->parser->parse<EvalNode>(m_callFrame, m_callFrame->dynamicGlobalObject()->debugger(), source, &errLine, &errMsg);
    if (!evalNode)
        return Error::create(m_callFrame, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url());

    return m_callFrame->scopeChain()->globalData->interpreter->execute(evalNode.get(), m_callFrame, thisObject(), m_callFrame->scopeChain(), &exception);
}
开发者ID:jackiekaon,项目名称:owb-mirror,代码行数:14,代码来源:DebuggerCallFrame.cpp

示例11: ScriptExecutable

FunctionExecutable::FunctionExecutable(VM& vm, const SourceCode& source, UnlinkedFunctionExecutable* unlinkedExecutable, unsigned firstLine, unsigned lastLine, unsigned startColumn, unsigned endColumn, bool bodyIncludesBraces)
    : ScriptExecutable(vm.functionExecutableStructure.get(), vm, source, unlinkedExecutable->isInStrictContext())
    , m_unlinkedExecutable(vm, this, unlinkedExecutable)
    , m_bodyIncludesBraces(bodyIncludesBraces)
{
    RELEASE_ASSERT(!source.isNull());
    ASSERT(source.length());
    m_firstLine = firstLine;
    m_lastLine = lastLine;
    ASSERT(startColumn != UINT_MAX);
    ASSERT(endColumn != UINT_MAX);
    m_startColumn = startColumn;
    m_endColumn = endColumn;
}
开发者ID:kunalnaithani,项目名称:webkit,代码行数:14,代码来源:Executable.cpp

示例12: ScriptExecutable

ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode& source)
    : ScriptExecutable(exec->vm().programExecutableStructure.get(), exec->vm(), source, false)
{
    m_typeProfilingStartOffset = 0;
    m_typeProfilingEndOffset = source.length() - 1;
    if (exec->vm().typeProfiler() || exec->vm().controlFlowProfiler())
        exec->vm().functionHasExecutedCache()->insertUnexecutedRange(sourceID(), m_typeProfilingStartOffset, m_typeProfilingEndOffset);
}
开发者ID:buchongyu,项目名称:webkit,代码行数:8,代码来源:Executable.cpp

示例13: import

PDMBUILDER_API string import()
{
	SourceCode *scode = getSourceCode();
	string sourceUrl = scode->GetUrl();

	int tagsIndex = sourceUrl.find("tags");
	int branchesIndex = sourceUrl.find("branches");
	int trunkIndex = sourceUrl.find("trunk");
	if (tagsIndex>0&&branchesIndex==string::npos&&trunkIndex==string::npos)
	{
		return "";
	}else if (tagsIndex>trunkIndex||tagsIndex>branchesIndex)
	{
		return "";
	}

	list<ImportStep *> *importStep = getImportStep();
	string log;

	for(list<ImportStep *>::iterator iter=importStep->begin();iter != importStep->end();++iter)
	{
		string name = (*iter)->GetName();
		string url = (*iter)->GetUrl();
		list<ImportItem *> item = (*iter)->GetItem();

		vector<string> source;
		vector<string> target;
		for(list<ImportItem *>::iterator iterItem=item.begin();iterItem != item.end();++iterItem)
		{
			string path =workspace+"\\"+(*iterItem)->GetSource();
			path = changeSeparator(path);
			source.push_back(path);
			
			target.push_back(changeSeparator((*iterItem)->GetTarget()));
		}
		//string logPath = workspace + "\\log";
		source.push_back(workspace+"\\log");
		target.push_back(".");
		//delete item;
		log += ImportLibStep(name,url,sourceUrl,source,target);
	}

	delete scode;
	delete importStep;
	return log;
}
开发者ID:songcser,项目名称:ALM,代码行数:46,代码来源:PDMBuilder.cpp

示例14: locker

void
TeamWindow::_HandleSourceCodeChanged()
{
	// If we don't have an active function anymore, the message is obsolete.
	if (fActiveFunction == NULL)
		return;

	// get a reference to the source code
	AutoLocker< ::Team> locker(fTeam);

	SourceCode* sourceCode = fActiveFunction->GetFunction()->GetSourceCode();
	LocatableFile* sourceFile = NULL;
	BString sourceText;
	BString truncatedText;
	if (sourceCode == NULL)
		sourceCode = fActiveFunction->GetSourceCode();

	if (sourceCode != NULL)
		sourceFile = fActiveFunction->GetFunctionDebugInfo()->SourceFile();

	if (sourceFile != NULL && !sourceFile->GetLocatedPath(sourceText))
		sourceFile->GetPath(sourceText);

	if (sourceCode != NULL && sourceCode->GetSourceFile() == NULL
		&& sourceFile != NULL) {
		sourceText.Prepend("Click to locate source file '");
		sourceText += "'";
		truncatedText = sourceText;
		fSourcePathView->TruncateString(&truncatedText, B_TRUNCATE_MIDDLE,
			fSourcePathView->Bounds().Width());
		if (sourceText != truncatedText)
			fSourcePathView->SetToolTip(sourceText.String());
		fSourcePathView->SetText(truncatedText.String());
	} else if (sourceFile != NULL) {
		sourceText.Prepend("File: ");
		fSourcePathView->SetText(sourceText.String());
	} else
		fSourcePathView->SetText("Source file unavailable.");

	BReference<SourceCode> sourceCodeReference(sourceCode);

	locker.Unlock();

	_SetActiveSourceCode(sourceCode);
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:45,代码来源:TeamWindow.cpp

示例15: SourceCode

FunctionExecutable* UnlinkedFunctionExecutable::link(VM& vm, const SourceCode& ownerSource, int overrideLineNumber)
{
    SourceCode source = m_sourceOverride ? SourceCode(m_sourceOverride) : ownerSource;
    unsigned firstLine = source.firstLine() + m_firstLineOffset;
    unsigned startOffset = source.startOffset() + m_startOffset;

    // Adjust to one-based indexing.
    bool startColumnIsOnFirstSourceLine = !m_firstLineOffset;
    unsigned startColumn = m_unlinkedBodyStartColumn + (startColumnIsOnFirstSourceLine ? source.startColumn() : 1);
    bool endColumnIsOnStartLine = !m_lineCount;
    unsigned endColumn = m_unlinkedBodyEndColumn + (endColumnIsOnStartLine ? startColumn : 1);

    SourceCode code(source.provider(), startOffset, startOffset + m_sourceLength, firstLine, startColumn);
    FunctionExecutable* result = FunctionExecutable::create(vm, code, this, firstLine, firstLine + m_lineCount, startColumn, endColumn);
    if (overrideLineNumber != -1)
        result->setOverrideLineNumber(overrideLineNumber);
    return result;
}
开发者ID:feel2d,项目名称:webkit,代码行数:18,代码来源:UnlinkedCodeBlock.cpp


注:本文中的SourceCode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。