MCPcopy Create free account
hub / github.com/anjo76/angelscript / GetCleanExpressionString

Method GetCleanExpressionString

sdk/angelscript/source/as_builder.cpp:5118–5144  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5116#endif
5117
5118asCString asCBuilder::GetCleanExpressionString(asCScriptNode *node, asCScriptCode *file)
5119{
5120 asASSERT(node && node->nodeType == snExpression);
5121
5122 asCString str;
5123 str.Assign(file->code + node->tokenPos, node->tokenLength);
5124
5125 asCString cleanStr;
5126 for( asUINT n = 0; n < str.GetLength(); )
5127 {
5128 asUINT len = 0;
5129 asETokenClass tok = engine->ParseToken(str.AddressOf() + n, str.GetLength() - n, &len);
5130
5131 // Replace comments and whitespace with a single space
5132 if (tok == asTC_COMMENT || tok == asTC_WHITESPACE)
5133 {
5134 if (cleanStr.GetLength() && cleanStr[cleanStr.GetLength() - 1] != ' ')
5135 cleanStr += " ";
5136 }
5137 else
5138 cleanStr.Concatenate(str.AddressOf() + n, len);
5139
5140 n += len;
5141 }
5142
5143 return cleanStr;
5144}
5145
5146#ifndef AS_NO_COMPILER
5147int asCBuilder::RegisterScriptFunctionFromNode(asCScriptNode *node, asCScriptCode *file, asCObjectType *objType, bool isInterface, bool isGlobalFunction, asSNameSpace *ns, bool isExistingShared, bool isMixin, sClassDeclaration* decl)

Callers

nothing calls this directly

Calls 5

AssignMethod · 0.80
GetLengthMethod · 0.45
ParseTokenMethod · 0.45
AddressOfMethod · 0.45
ConcatenateMethod · 0.45

Tested by

no test coverage detected