*ptr++ = '-';
value = - value;
}
- snprintf(ptr, sizeof buffer - 1, "%x ", value);
+ qsnprintf(ptr, sizeof buffer - 1, "%x ", value);
m_data.append(buffer);
}
/**
void RplContainer::addInt(qint64 value) {
addType(TAG_INT);
char buffer[128];
- snprintf(buffer, sizeof buffer, "%llx ", value);
+ qsnprintf(buffer, sizeof buffer, "%llx ", value);
m_data.append(buffer);
}
if(m_typeList.length() != 0) {
char buffer[128];
// RPL&1 0a b5[2]cis: !12
- snprintf(buffer, sizeof buffer, "%x[%d]%s:", (unsigned int) m_data.length(),
+ qsnprintf(buffer, sizeof buffer, "%x[%d]%s:", (unsigned int) m_data.length(),
m_countBags, m_typeList.data());
char header[128+8];
- snprintf(header, sizeof header, "%s%02x%s", MAGIC_1,
+ qsnprintf(header, sizeof header, "%s%02x%s", MAGIC_1,
(unsigned int) strlen(buffer), buffer);
m_data.insert(0, header);
}
char buffer[64000];
va_list ap;
va_start(ap, format);
- vsnprintf(buffer, sizeof buffer, format, ap);
+ qvsnprintf(buffer, sizeof buffer, format, ap);
va_end(ap);
m_message = buffer;
}
char buffer[64000];
va_list ap;
va_start(ap, format);
- vsnprintf(buffer, sizeof buffer, format, ap);
+ qvsnprintf(buffer, sizeof buffer, format, ap);
va_end(ap);
m_message = buffer;
if(logger == NULL)
char buffer[64000];
if(message == NULL)
message = "value outside limits";
- snprintf(buffer, sizeof buffer, "%s: %lu [%lu, %lu]",
+ qsnprintf(buffer, sizeof buffer, "%s: %lu [%lu, %lu]",
message == NULL ? "" : message,
current, lbound, ubound);
if(logger == NULL)
size_t ix;
char* ptr = buffer + strlen(buffer);
for(ix = 0; ix < dataSize; ix++) {
- snprintf(ptr, sizeof(buffer) - (ptr - buffer) - 1, "%02x ",
+ qsnprintf(ptr, sizeof(buffer) - (ptr - buffer) - 1, "%02x ",
((unsigned char*) data)[ix]);
ptr += strlen(ptr);
}
char buffer[64000];
va_list ap;
va_start(ap, format);
- vsnprintf(buffer, sizeof buffer, format, ap);
+ qvsnprintf(buffer, sizeof buffer, format, ap);
va_end(ap);
return log(level, location, buffer);
}
char buffer[64000];
va_list ap;
va_start(ap, format);
- vsnprintf(buffer, sizeof buffer, format, ap);
+ qvsnprintf(buffer, sizeof buffer, format, ap);
va_end(ap);
return log(level, location, buffer);
}
bool RplLogger::log(RplLoggerLevel level, int location, const char* format,
va_list& varlist) {
char buffer[64000];
- vsnprintf(buffer, sizeof buffer, format, varlist);
+ qvsnprintf(buffer, sizeof buffer, format, varlist);
return log(level, location, buffer);
}
time_t now = time(NULL);
struct tm* now2 = localtime(&now);
char buffer[64];
- snprintf(buffer, sizeof buffer, "%c%d.%02d.%02d %02d:%02d:%02d (%d): ",
+ qsnprintf(buffer, sizeof buffer, "%c%d.%02d.%02d %02d:%02d:%02d (%d): ",
getPrefixOfLevel(level),
now2->tm_year + 1900,
now2->tm_mon + 1,
if(m_fp != NULL)
fclose(m_fp);
char fullName[512];
- snprintf(fullName, sizeof fullName, "%s.%03d.log", m_prefix.data(),
+ qsnprintf(fullName, sizeof fullName, "%s.%03d.log", m_prefix.data(),
++m_currentNo);
m_fp = fopen(fullName, "a");
if(m_fp == NULL)
char buffer[16];
for(int lineNo = 0; lineNo < fullLines; lineNo++) {
for(col = 0; col < bytesPerLine; col++) {
- snprintf(buffer, sizeof buffer, "%02x ", data[ixData + col]);
+ qsnprintf(buffer, sizeof buffer, "%02x ", data[ixData + col]);
rc.append(buffer);
}
rc.append(' ');
int restBytes = length - ixData;
if(restBytes > 0) {
for(col = 0; col < restBytes; col++) {
- snprintf(buffer, sizeof buffer, "%02x ", data[ixData + col]);
+ qsnprintf(buffer, sizeof buffer, "%02x ", data[ixData + col]);
rc.append(buffer);
}
for(col = restBytes; col < bytesPerLine; col++) {
default:
{
char buffer[5];
- snprintf(buffer, sizeof buffer, "\\x%02x",
+ qsnprintf(buffer, sizeof buffer, "\\x%02x",
((unsigned int) cc) % 0xff);
rc += buffer;
break;
*/
QByteArray RplString::toNumber(int value, const char* format) {
char buffer[128];
- snprintf(buffer, sizeof buffer, format, value);
+ qsnprintf(buffer, sizeof buffer, format, value);
return QByteArray(buffer);
}
QByteArray currentContent = RplString::read(current, true);
if (expectedContent.isEmpty()){
char buffer[512];
- snprintf(buffer, sizeof buffer, "%s has no content. Does it exist?",
+ qsnprintf(buffer, sizeof buffer, "%s has no content. Does it exist?",
expected);
error(buffer);
} else if (currentContent.isEmpty()){
char buffer[512];
- snprintf(buffer, sizeof buffer, "%s has no content. Does it exist?",
+ qsnprintf(buffer, sizeof buffer, "%s has no content. Does it exist?",
current);
error(buffer);
} else {
char buffer[64000];
va_list ap;
va_start(ap, format);
- vsnprintf(buffer, sizeof buffer, format, ap);
+ qvsnprintf(buffer, sizeof buffer, format, ap);
va_end(ap);
writeLine(buffer);
}
void RplWriter::write(va_list ap, const char* format)
{
char buffer[64000];
- vsnprintf(buffer, sizeof buffer, format, ap);
+ qvsnprintf(buffer, sizeof buffer, format, ap);
write(buffer);
}
char buffer[64000];
va_list ap;
va_start(ap, format);
- vsnprintf(buffer, sizeof buffer, format, ap);
+ qvsnprintf(buffer, sizeof buffer, format, ap);
va_end(ap);
writeLine(buffer);
}
*
* @param scope the status of the scope at start.
*/
-void RplSymbolSpace::finishScope(RplASScope& scope)
+void RplSymbolSpace::finishScope(int endOfScope, RplASScope& scope)
{
// in methods/classes not needed:
- for (int ix = scope.m_varNoAtStart; ix < m_listOfVars.size(); ix++){
- const QString& name = m_listOfVars[ix]->name();
+ int ix = scope.m_varNoAtStart - scope.m_builtInVars;
+ int last = m_listOfVars.size();
+ for (; ix < last; ix++){
+ RplASVarDefinition* var = m_listOfVars[ix];
+ var->setEndOfScope(endOfScope);
+ const QString& name = var->name();
if (m_variables.contains(name))
m_variables.remove(name);
}
}
}
- if (m_variables.size() > 0){
+ if (m_listOfVars.size() > 0){
writer.writeIndented(indent, "== Variables:");
- sorted.clear();
- sorted.reserve(m_variables.size());
- VariableMap::iterator it5;
- for (it5 = m_variables.begin(); it5 != m_variables.end(); it5++){
- sorted.append(it5.key());
- }
- qSort(sorted.begin(), sorted.end(), qLess<QString>());
QList<QString>::iterator it6;
- for (it6 = sorted.begin(); it6 != sorted.end(); it6++){
- RplASVarDefinition* var = m_variables[*it6];
+ for (int ix = 0; ix < m_listOfVars.size(); ix++){
+ RplASVarDefinition* var = m_listOfVars[ix];
var->dump(writer, indent);
}
}
class RplASScope
{
public:
+ int m_builtInVars;
int m_varNoAtStart;
};
virtual ~RplSymbolSpace();
public:
void startScope(RplASScope& scope);
- void finishScope(RplASScope& scope);
+ void finishScope(int endOfScope, RplASScope& scope);
RplASVarDefinition* findVariable(const QString& name) const;
RplASClass* findClass(const QString& name) const;
RplASMethod* findMethod(const QString& name) const;
char buffer[64000];
if (position != NULL)
m_message = position->toString().toUtf8();
- vsnprintf(buffer, sizeof buffer, format, varList);
+ qvsnprintf(buffer, sizeof buffer, format, varList);
m_message += buffer;
}
{
char buffer[1024];
int halfBufferSize = (sizeof buffer) / 2;
- snprintf(buffer, halfBufferSize, "id: %d [%s]:", m_id,
+ qsnprintf(buffer, halfBufferSize, "id: %d [%s]:", m_id,
positionStr(buffer + halfBufferSize, halfBufferSize));
int length = strlen(buffer);
va_list ap;
va_start(ap, format);
- vsnprintf(buffer + length, (sizeof buffer) - length, format, ap);
+ qvsnprintf(buffer + length, (sizeof buffer) - length, format, ap);
va_end(ap);
logger->log(LOG_ERROR, location, buffer);
}
m_attributes(attributes),
m_dataType(dataType),
m_symbolSpace(space),
- m_variableNo(0)
+ m_variableNo(-1)
{
}
*/
RplASVarDefinition::RplASVarDefinition() :
RplASNode3(AST_VAR_DEFINITION),
- RplASStatement()
+ RplASStatement(),
+ m_endOfScope(0)
{
m_flags |= NF_STATEMENT;
}
{
RplASNamedValue* namedValue = dynamic_cast<RplASNamedValue*>(m_child2);
QByteArray name = namedValue->name().toUtf8();
+ char endOfScope[32];
+ endOfScope[0] = '\0';
+ if (m_endOfScope > 0)
+ qsnprintf(endOfScope, sizeof endOfScope, "-%d:0", m_endOfScope);
char buffer[256];
- writer.formatIndented(indent, "varDef %s id: %d namedValue: %d value: %d succ: %d %s",
+ writer.formatIndented(indent, "varDef %s %s id: %d namedValue: %d value: %d succ: %d %s%s",
+ namedValue == NULL || namedValue->dataType() == NULL
+ ? "?" : namedValue->dataType()->name().toUtf8().constData(),
name.constData(), m_id,
m_child2 == NULL ? 0 : m_child2->id(),
m_child3 == NULL ? 0 : m_child3->id(),
m_child == NULL ? 0 : m_child->id(),
- positionStr(buffer, sizeof buffer));
+ positionStr(buffer, sizeof buffer), endOfScope);
if (m_child2 != NULL)
m_child2->dump(writer, indent + 1);
if (m_child3 != NULL)
RplASClass* rc = namedValue->dataType();
return rc;
}
+/**
+ * @brief Returns the column of the scope end.
+ *
+ * 0 means end of method or end of class
+ *
+ * @return 0 or the column of the scope end
+ */
+int RplASVarDefinition::endOfScope() const
+{
+ return m_endOfScope;
+}
+
+/**
+ * @brief Sets the column of the scope end.
+ *
+ * @param endOfScope the column of the scope end
+ */
+void RplASVarDefinition::setEndOfScope(int endOfScope)
+{
+ m_endOfScope = endOfScope;
+}
+
/**
* @brief Executes the statement.
*
* @param variable NULL or the iterator variable
*/
-RplASForIterated::RplASForIterated(RplASNamedValue* variable) :
+RplASForIterated::RplASForIterated(RplASVarDefinition* variable) :
RplASNode4(AST_ITERATED_FOR),
RplASStatement()
{
*
* @param variable NULL or the counter variable
*/
-RplASForCounted::RplASForCounted(RplASNamedValue* variable) :
+RplASForCounted::RplASForCounted(RplASVarDefinition* variable) :
RplASNode6(AST_ITERATED_FOR),
RplASStatement()
{
void dump(RplWriter& writer, int indent);
const QString& name() const;
RplASClass* datatype() const;
+ int endOfScope() const;
+ void setEndOfScope(int endOfScope);
+
+private:
+ /// the column of the blockend containing the definition.
+ /// if 0: end is end of method or end of class
+ /// Note: the source unit is stored in <code>RplASItem::m_sourcePosition</code>
+ int m_endOfScope;
};
class RplASExprStatement : public RplASNode2, public RplASStatement
class RplASForIterated : public RplASNode4, public RplASStatement
{
public:
- RplASForIterated(RplASNamedValue* variable);
+ RplASForIterated(RplASVarDefinition* variable);
public:
virtual void execute(RplVMThread& thread);
virtual void dump(RplWriter& writer, int indent);
class RplASForCounted : public RplASNode6, public RplASStatement
{
public:
- RplASForCounted(RplASNamedValue* variable);
+ RplASForCounted(RplASVarDefinition* variable);
public:
virtual void execute(RplVMThread& thread);
virtual void dump(RplWriter& writer, int indent);
#define CHAR_INFO_SIZE (int(sizeof m_charInfo / sizeof m_charInfo[0]))
-RplLexer* RplLexer::m_active = NULL;
/** @class RplToken rpllexer.hpp "rplexpr/rpllexer.hpp"
*
m_message = position.toString().toUtf8();
va_list ap;
va_start(ap, format);
- vsnprintf(buffer, sizeof buffer, format, ap);
+ qvsnprintf(buffer, sizeof buffer, format, ap);
va_end(ap);
m_message += buffer;
}
return rc;
}
+/**
+ * @brief Returns the description of the current token.
+ *
+ * @return a description of the instance
+ */
+QByteArray RplToken::dump() const
+{
+ QByteArray rc;
+ rc = nameOfType(m_tokenType);
+ rc.append(": ").append(this->asUtf8());
+ return rc;
+}
+QByteArray RplToken::asUtf8() const
+{
+ char buffer[4096];
+ buffer[0] = '\0';
+
+ switch(m_tokenType){
+ case TOKEN_UNDEF:
+ break;
+ case TOKEN_STRING:
+ qsnprintf(buffer, sizeof buffer, "'%.*s'", int(sizeof buffer) - 1,
+ m_printableString.toUtf8().constData());
+ break;
+ case TOKEN_NUMBER:
+ qsnprintf(buffer, sizeof buffer, "%lld", m_value.m_integer);
+ break;
+ case TOKEN_REAL:
+ qsnprintf(buffer, sizeof buffer, "%f", m_value.m_real);
+ break;
+ case TOKEN_KEYWORD:
+ case TOKEN_OPERATOR:
+ qsnprintf(buffer, sizeof buffer, "%lld", (int) m_value.m_id);
+ break;
+ case TOKEN_ID:
+ qsnprintf(buffer, sizeof buffer, "'%.*s'", int(sizeof buffer) - 1,
+ m_string.toUtf8().constData());
+ break;
+ case TOKEN_COMMENT_REST_OF_LINE:
+ case TOKEN_COMMENT_START:
+ case TOKEN_COMMENT_END:
+ case TOKEN_SPACE:
+ case TOKEN_END_OF_SOURCE:
+ default:
+ break;
+ }
+ return buffer;
+}
+/**
+ * @brief Returns then name of a token type.
+ * @param type the type to convert
+ * @return the token type name
+ */
+const char* RplToken::nameOfType(RplTokenType type)
+{
+ const char* rc = "?";
+
+ switch(type){
+ case TOKEN_UNDEF:
+ rc = "undef";
+ break;
+ case TOKEN_STRING:
+ rc = "String";
+ break;
+ case TOKEN_NUMBER:
+ rc = "Number";
+ break;
+ case TOKEN_REAL:
+ rc = "Real";
+ break;
+ case TOKEN_KEYWORD:
+ rc = "Keyword";
+ break;
+ case TOKEN_OPERATOR:
+ rc = "Operator";
+ break;
+ case TOKEN_ID:
+ rc = "Id";
+ break;
+ case TOKEN_COMMENT_REST_OF_LINE:
+ rc = "Comment-1-line";
+ break;
+ case TOKEN_COMMENT_START:
+ rc = "Comment-m-line";
+ break;
+ case TOKEN_COMMENT_END:
+ rc = "end of comment";
+ break;
+ case TOKEN_SPACE:
+ rc = "space";
+ break;
+ case TOKEN_END_OF_SOURCE:
+ rc = "end of source";
+ break;
+ default:
+ break;
+ }
+ return rc;
+}
+
/** @class RplLexer rpllexer.hpp "rplexpr/rpllexer.hpp"
*
m_storageFlags(storageFlags),
// m_prioOfOp
// m_assocOfOp
+ #if defined (RPL_LEXER_TRACE)
+ m_trace(true),
+ #endif
m_opNames()
{
memset(m_prioOfOp, 0, sizeof m_prioOfOp);
charClassToCharInfo(restCharsId, CC_REST_ID, m_charInfo);
initializeComments(comments);
m_input.reserve(m_maxTokenLength*2);
- if (m_active == NULL)
- m_active = this;
}
/**
* @brief Destructor.
*/
RplLexer::~RplLexer()
{
- if (m_active == this)
- m_active = NULL;
}
/**
m_input.remove(0, length);
m_currentCol += length;
}
+#if defined (RPL_LEXER_TRACE)
+bool RplLexer::trace() const
+{
+ return m_trace;
+}
+
+void RplLexer::setTrace(bool trace)
+{
+ m_trace = trace;
+}
+#endif
/**
* @brief Returns the last read token.
*
"unknown lexical symbol: %s", symbol.toUtf8().constData());
}
}
+#if defined (RPL_LEXER_TRACE)
+ if (m_trace){
+ char buffer[256];
+ printf("token: %s pos: %s\n", m_currentToken->dump().constData(),
+ m_currentPosition->utf8(buffer, sizeof buffer));
+ if (strcmp(buffer, "<test>:2:6") == 0)
+ buffer[0] = 0;
+ }
+#endif
return rc;
}
/**
m_waitingToken = m_currentToken;
m_currentToken = m_currentToken == &m_token1 ? &m_token2 : &m_token1;
m_waitingPosition1 = m_currentPosition;
+#if defined (RPL_LEXER_TRACE)
+ if (m_trace){
+ char buffer[256];
+ printf("undo last token: waiting-token: %s pos: %s\n",
+ m_waitingToken->dump().constData(),
+ m_waitingPosition1->utf8(buffer, sizeof buffer));
+ if (strcmp(buffer, "<test>:2:6") == 0)
+ buffer[0] = 0;
+ }
+#endif
}
/**
bool isKeyword(int expected, int alternative = 0) const;
void clear();
bool isCapitalizedId() const;
+ QByteArray dump() const;
+ static const char* nameOfType(RplTokenType type);
+ QByteArray asUtf8() const;
protected:
RplTokenType m_tokenType;
QString m_string;
bool isRightAssociative(int op) const;
const RplSourcePosition* currentPosition() const;
RplToken* currentToken() const;
+ bool trace() const;
+ void setTrace(bool trace);
private:
void prepareOperators(const char* operators, const char* rightAssociatives);
char m_prioOfOp[128];
char m_assocOfOp[128];
QList<QByteArray> m_opNames;
-public:
- static RplLexer* m_active;
+//#define RPL_LEXER_TRACE
+#if defined (RPL_LEXER_TRACE)
+ bool m_trace;
+#endif
};
return rc;
}
+/**
+ * @brief Creates a variable definition for a builtin variable.
+ * @param var the basic variable data
+ * @return
+ */
+RplASVarDefinition* RplMFParser::buildVarDef(RplASNamedValue* var)
+{
+ RplASVarDefinition* rc = new RplASVarDefinition();
+ rc->setPosition(var->position());
+ rc->setChild2(var);
+ RplSymbolSpace* symbols = m_tree.currentSpace();
+ int varNo;
+ symbols->addVariable(rc, varNo);
+ var->setVariableNo(varNo);
+ return rc;
+}
+
/**
* @brief Parses a for statement.
*
*/
RplASItem* RplMFParser::parseFor()
{
+ int builtinVars = 1;
RplASNode2* rc = NULL;
const RplSourcePosition* startPosition = m_lexer.currentPosition();
RplToken* token = m_lexer.nextNonSpaceToken();
token = m_lexer.nextNonSpaceToken();
}
if (token->isKeyword(K_IN)){
- RplASForIterated* node = new RplASForIterated(var);
+ RplASVarDefinition* varDef = buildVarDef(var);
+ RplASForIterated* node = new RplASForIterated(varDef);
rc = node;
node->setPosition(startPosition);
node->setChild3(var);
RplASItem* iterable = parseExpr(0);
node->setChild4(iterable);
} else {
- RplASForCounted* node = new RplASForCounted(var);
+ if (var == NULL){
+ char name[32];
+ // Build a unique name inside the scope:
+ qsnprintf(name, sizeof name, "$%d_%d", startPosition->lineNo(),
+ startPosition->column());
+ var = new RplASNamedValue(RplASInteger::m_instance,
+ m_tree.currentSpace(), name,
+ RplASNamedValue::A_LOOP);
+ var->setPosition(startPosition);
+ }
+ RplASVarDefinition* varDef = buildVarDef(var);
+ RplASForCounted* node = new RplASForCounted(varDef);
rc = node;
node->setPosition(startPosition);
node->setChild3(var);
}
if (! m_lexer.currentToken()->isKeyword(K_DO))
syntaxError(L_PARSE_FOR_NO_TO, "'to' expected");
- rc->setChild2(parseBody(K_OD));
+ rc->setChild2(parseBody(K_OD, K_UNDEF, builtinVars));
m_lexer.nextNonSpaceToken();
return rc;
}
RplASItem* rc = NULL;
if (parent == NULL){
RplSymbolSpace* space = m_tree.currentSpace();
- RplASVarDefinition* var = space->findVariable(var->name());
+ RplASVarDefinition* var = space->findVariable(name);
RplASClass* clazz = NULL;
if (var != NULL)
clazz = var->datatype();
case TOKEN_ID:
{
QString name = token->toString();
+ if (name == "a")
+ name = "a";
token = m_lexer.nextNonSpaceToken();
startPosition = m_lexer.currentPosition();
if (token->tokenType() != TOKEN_OPERATOR){
*
* @param keywordStop the first possible keyword which finishes the stm. list
* @param keywordStop2 the 2nd possible keyword which finishes the statements
- * @param opStop the first possible delimiting operator
- * @param opStop2 the 2nd possible delimiting operator
+ * @param builtinVars number of variables valid only in this body
* @return the first element of the statement list
*/
RplASItem* RplMFParser::parseBody(Keyword keywordStop, Keyword keywordStop2,
- Operator opStop, Operator opStop2)
+ int builtinVars)
{
RplToken* token = m_lexer.nextNonSpaceToken();
RplASItem* item = NULL;
RplASNode1* lastStatement = NULL;
RplASScope scope;
m_tree.currentSpace()->startScope(scope);
+ scope.m_builtInVars = builtinVars;
bool again = true;
const RplSourcePosition* lastPos = NULL;
do {
switch(token->tokenType())
{
case TOKEN_OPERATOR:
- if (opStop != O_UNDEF && token->isOperator(opStop, opStop2)){
- again = false;
- break;
- }
- // fall through
case TOKEN_STRING:
case TOKEN_NUMBER:
case TOKEN_REAL:
error(L_PARSE_BODY_WRONG_ITEM, "wrong item type: %d",
item == NULL ? 0 : item->nodeType());
token = m_lexer.currentToken();
- if ((keywordStop != K_UNDEF
+ if (keywordStop != K_UNDEF
&& token->isKeyword(keywordStop, keywordStop2))
- || (opStop != O_UNDEF
- && token->isOperator(opStop, opStop2)))
again = false;
}
} catch(RplSyntaxError exc){
}
} while(again);
- if (keywordStop != K_ENDF && keywordStop != K_ENDC)
- m_tree.currentSpace()->finishScope(scope);
+ if (keywordStop != K_ENDF && keywordStop != K_ENDC
+ && keywordStop != K_UNDEF)
+ m_tree.currentSpace()->finishScope(m_lexer.currentPosition()->lineNo(),
+ scope);
return body;
}
RplASItem* parseVarDefinition(RplASNamedValue::Attributes attribute);
RplASItem* parseExpr(int depth);
RplASItem* parseBody(Keyword keywordStop, Keyword keywordStop2 = K_UNDEF,
- Operator opStop = O_UNDEF, Operator opStop2 = O_UNDEF);
+ int builtinVars = 0);
void parseMethod();
void parseClass();
void parseImport();
RplASItem* parent);
RplASExprStatement*parseParameterList();
RplASItem* parseLocalVar();
+ RplASVarDefinition* buildVarDef(RplASNamedValue* var);
protected:
static RplASBinaryOp::BinOperator convertBinaryOp(int op);
static RplASUnaryOp::UnaryOp convertUnaryOp(int op);
const char* message){
char buffer[2048];
QString msg;
- snprintf(buffer, sizeof buffer, "%c%04d %s:%d-%d: ", prefix, location,
+ qsnprintf(buffer, sizeof buffer, "%c%04d %s:%d-%d: ", prefix, location,
position->sourceUnit()->name(),
position->lineNo(), position->column());
int used = strlen(buffer);
const RplSourcePosition* position,
const char* format, va_list varList){
char buffer[2048];
- vsnprintf(buffer, sizeof buffer, format, varList);
+ qvsnprintf(buffer, sizeof buffer, format, varList);
addSimpleMessage(prefix, location, position, buffer);
}
{
char buffer[256];
char buffer2[512];
- snprintf(buffer2, sizeof buffer2,
+ qsnprintf(buffer2, sizeof buffer2,
"The starting symbol %s is located here. Missing point: %s",
symbol, m_lexer.currentPosition()->utf8(buffer, sizeof buffer));
*/
char* RplSourcePosition::utf8(char buffer[], size_t bufferSize) const
{
- snprintf(buffer, bufferSize, "%s:%d:%d",
+ qsnprintf(buffer, bufferSize, "%s:%d:%d",
m_sourceUnit == NULL ? "" : m_sourceUnit->name(),
m_lineNo, m_column);
return buffer;
char buffer[16000];
va_list ap;
va_start(ap, format);
- vsnprintf(buffer, sizeof buffer, format, ap);
+ qvsnprintf(buffer, sizeof buffer, format, ap);
va_end(ap);
m_message = buffer;
}
va_list args;
va_start(args, format);
- vsnprintf(buffer, sizeof buffer, format, args);
+ qvsnprintf(buffer, sizeof buffer, format, args);
va_end(args);
m_message += buffer;
}
char buffer[128];
Tuple2 minMaxi(minMax());
QByteArray rc;
- snprintf(buffer, sizeof buffer, format, minMaxi.m_value1);
+ qsnprintf(buffer, sizeof buffer, format, minMaxi.m_value1);
int length = strlen(buffer);
- snprintf(buffer, sizeof buffer, format, minMaxi.m_value2);
+ qsnprintf(buffer, sizeof buffer, format, minMaxi.m_value2);
int length2 = strlen(buffer);
if (length < length2)
length = length2;
- snprintf(buffer, sizeof buffer, format,
+ qsnprintf(buffer, sizeof buffer, format,
(minMaxi.m_value1 + minMaxi.m_value2) / 2);
length2 = strlen(buffer);
if (length < length2)
rc += "[";
for (int row = 0; row < m_rows; row++){
for (int col = 0; col < m_cols; col++){
- snprintf(buffer, sizeof buffer, format, m_values[m_cols*row + col]);
+ qsnprintf(buffer, sizeof buffer, format, m_values[m_cols*row + col]);
rc += buffer;
rc += colSeparator;
}
+++ /dev/null
-Int i = 3; const lazy Str s = 'Hi'; const List l;
-= <test> (module) parent: $global
-== Variables:
-varDef i id: 2 namedValue: 1 value: 3 succ: 5 <test>:1:4
- namedValue i id: 1 attr: 0x0 <test>:1:4
- const id: 3 value: 3 <test>:1:8
-varDef l id: 8 namedValue: 7 value: 0 succ: 0 <test>:1:47
- namedValue l id: 7 attr: 0x2 <test>:1:47
-varDef s id: 5 namedValue: 4 value: 6 succ: 8 <test>:1:26
- namedValue s id: 4 attr: 0x12 <test>:1:26
- const id: 6 value: 'Hi' <test>:1:30
-== Body:
-varDef i id: 2 namedValue: 1 value: 3 succ: 5 <test>:1:4
- namedValue i id: 1 attr: 0x0 <test>:1:4
- const id: 3 value: 3 <test>:1:8
-varDef s id: 5 namedValue: 4 value: 6 succ: 8 <test>:1:26
- namedValue s id: 4 attr: 0x12 <test>:1:26
- const id: 6 value: 'Hi' <test>:1:30
-varDef l id: 8 namedValue: 7 value: 0 succ: 0 <test>:1:47
- namedValue l id: 7 attr: 0x2 <test>:1:47
od
= <test> (module) parent: $global
== Variables:
-varDef a id: 2 namedValue: 1 value: 0 succ: 4 <test>:1:4
+varDef Int a id: 2 namedValue: 1 value: 0 succ: 5 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
+varDef Int b id: 4 namedValue: 3 value: 0 succ: 0 <test>:2:4-3:0
+ namedValue b id: 3 attr: 0x40 <test>:2:4
== Body:
-varDef a id: 2 namedValue: 1 value: 0 succ: 4 <test>:1:4
+varDef Int a id: 2 namedValue: 1 value: 0 succ: 5 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
-forC id: 4 var: 3 from: 5 to: 6 step: 7 body: 12 succ: 0 <test>:1:7
- namedValue b id: 3 attr: 0x0 <test>:2:4
- const id: 5 value: 10 <test>:2:11
- const id: 6 value: 1 <test>:2:17
- Unary 7 op: - (2) expr: 8 <test>:2:24
- const id: 8 value: 2 <test>:2:25
- Expr id: 12 expr: 10 succ: 0 <test>:3:2
- BinOp id: 10 op: += (2) left: 9 right: 11 <test>:3:2
- namedValue a id: 9 attr: 0x0 <test>:3:2
- const id: 11 value: 1 <test>:3:5
+forC id: 5 var: 3 from: 6 to: 7 step: 8 body: 13 succ: 0 <test>:1:7
+ namedValue b id: 3 attr: 0x40 <test>:2:4
+ const id: 6 value: 10 <test>:2:11
+ const id: 7 value: 1 <test>:2:17
+ Unary 8 op: - (2) expr: 9 <test>:2:24
+ const id: 9 value: 2 <test>:2:25
+ Expr id: 13 expr: 11 succ: 0 <test>:3:2
+ BinOp id: 11 op: += (2) left: 10 right: 12 <test>:3:2
+ namedValue a id: 10 attr: 0x0 <test>:3:2
+ const id: 12 value: 1 <test>:3:5
Int a; for to 10 do a += 1 od
= <test> (module) parent: $global
== Variables:
-varDef a id: 2 namedValue: 1 value: 0 succ: 3 <test>:1:4
+varDef Int a id: 2 namedValue: 1 value: 0 succ: 5 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
+varDef Int $1_7 id: 4 namedValue: 3 value: 0 succ: 0 <test>:1:7-1:0
+ namedValue $1_7 id: 3 attr: 0x40 <test>:1:7
== Body:
-varDef a id: 2 namedValue: 1 value: 0 succ: 3 <test>:1:4
+varDef Int a id: 2 namedValue: 1 value: 0 succ: 5 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
-forC id: 3 var: 0 from: 0 to: 4 step: 0 body: 8 succ: 0 <test>:1:7
- const id: 4 value: 10 <test>:1:14
- Expr id: 8 expr: 6 succ: 0 <test>:1:22
- BinOp id: 6 op: += (2) left: 5 right: 7 <test>:1:22
- namedValue a id: 5 attr: 0x0 <test>:1:22
- const id: 7 value: 1 <test>:1:25
+forC id: 5 var: 3 from: 0 to: 6 step: 0 body: 10 succ: 0 <test>:1:7
+ namedValue $1_7 id: 3 attr: 0x40 <test>:1:7
+ const id: 6 value: 10 <test>:1:14
+ Expr id: 10 expr: 8 succ: 0 <test>:1:22
+ BinOp id: 8 op: += (2) left: 7 right: 9 <test>:1:22
+ namedValue a id: 7 attr: 0x0 <test>:1:22
+ const id: 9 value: 1 <test>:1:25
od
= <test> (module) parent: $global
== Variables:
-varDef a id: 2 namedValue: 1 value: 0 succ: 4 <test>:1:4
+varDef Map a id: 2 namedValue: 1 value: 0 succ: 5 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
+varDef Int x id: 4 namedValue: 3 value: 0 succ: 0 <test>:2:4-3:0
+ namedValue x id: 3 attr: 0x40 <test>:2:4
== Body:
-varDef a id: 2 namedValue: 1 value: 0 succ: 4 <test>:1:4
+varDef Map a id: 2 namedValue: 1 value: 0 succ: 5 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
-forIt id: 4 var: 3 set: 5 body: 9 succ: 0 <test>:1:7
- namedValue x id: 3 attr: 0x0 <test>:2:4
- namedValue a id: 5 attr: 0x0 <test>:2:11
- Expr id: 9 expr: 7 succ: 0 <test>:3:2
- BinOp id: 7 op: += (2) left: 6 right: 8 <test>:3:2
- namedValue a id: 6 attr: 0x0 <test>:3:2
- const id: 8 value: 1 <test>:3:5
+forIt id: 5 var: 3 set: 6 body: 10 succ: 0 <test>:1:7
+ namedValue x id: 3 attr: 0x40 <test>:2:4
+ namedValue a id: 6 attr: 0x0 <test>:2:11
+ Expr id: 10 expr: 8 succ: 0 <test>:3:2
+ BinOp id: 8 op: += (2) left: 7 right: 9 <test>:3:2
+ namedValue a id: 7 attr: 0x0 <test>:3:2
+ const id: 9 value: 1 <test>:3:5
List b = [];
= <test> (module) parent: $global
== Variables:
-varDef b id: 2 namedValue: 1 value: 3 succ: 0 <test>:1:5
+varDef List b id: 2 namedValue: 1 value: 3 succ: 0 <test>:1:5
namedValue b id: 1 attr: 0x0 <test>:1:5
listConst id: 3 <test>:1:9
[]
== Body:
-varDef b id: 2 namedValue: 1 value: 3 succ: 0 <test>:1:5
+varDef List b id: 2 namedValue: 1 value: 3 succ: 0 <test>:1:5
namedValue b id: 1 attr: 0x0 <test>:1:5
listConst id: 3 <test>:1:9
[]
List a = [2+3, 3.14, 7, 'hi', a]; List b = [];
= <test> (module) parent: $global
== Variables:
-varDef a id: 2 namedValue: 1 value: 3 succ: 11 <test>:1:5
+varDef List a id: 2 namedValue: 1 value: 3 succ: 11 <test>:1:5
namedValue a id: 1 attr: 0x0 <test>:1:5
listConst id: 3 <test>:1:9
[<formula 7>,3.140000,7,'hi',<formula 9>]
-varDef b id: 11 namedValue: 10 value: 12 succ: 0 <test>:1:39
+varDef List b id: 11 namedValue: 10 value: 12 succ: 0 <test>:1:39
namedValue b id: 10 attr: 0x0 <test>:1:39
listConst id: 12 <test>:1:43
[]
== Body:
-varDef a id: 2 namedValue: 1 value: 3 succ: 11 <test>:1:5
+varDef List a id: 2 namedValue: 1 value: 3 succ: 11 <test>:1:5
namedValue a id: 1 attr: 0x0 <test>:1:5
listConst id: 3 <test>:1:9
[<formula 7>,3.140000,7,'hi',<formula 9>]
-varDef b id: 11 namedValue: 10 value: 12 succ: 0 <test>:1:39
+varDef List b id: 11 namedValue: 10 value: 12 succ: 0 <test>:1:39
namedValue b id: 10 attr: 0x0 <test>:1:39
listConst id: 12 <test>:1:43
[]
Map a = {};
= <test> (module) parent: $global
== Variables:
-varDef a id: 2 namedValue: 1 value: 3 succ: 0 <test>:1:4
+varDef Map a id: 2 namedValue: 1 value: 3 succ: 0 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
mapConst id: 3 <test>:1:8
{}
== Body:
-varDef a id: 2 namedValue: 1 value: 3 succ: 0 <test>:1:4
+varDef Map a id: 2 namedValue: 1 value: 3 succ: 0 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
mapConst id: 3 <test>:1:8
{}
Map b = {};
= <test> (module) parent: $global
== Variables:
-varDef a id: 2 namedValue: 1 value: 3 succ: 11 <test>:1:4
+varDef Map a id: 2 namedValue: 1 value: 3 succ: 11 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
mapConst id: 3 <test>:1:8
{'a':<formula 7>,'bcd':3.140000,'ccc':7,'hi':<formula 9>}
-varDef b id: 11 namedValue: 10 value: 12 succ: 0 <test>:2:4
+varDef Map b id: 11 namedValue: 10 value: 12 succ: 0 <test>:2:4
namedValue b id: 10 attr: 0x0 <test>:2:4
mapConst id: 12 <test>:2:8
{}
== Body:
-varDef a id: 2 namedValue: 1 value: 3 succ: 11 <test>:1:4
+varDef Map a id: 2 namedValue: 1 value: 3 succ: 11 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
mapConst id: 3 <test>:1:8
{'a':<formula 7>,'bcd':3.140000,'ccc':7,'hi':<formula 9>}
-varDef b id: 11 namedValue: 10 value: 12 succ: 0 <test>:2:4
+varDef Map b id: 11 namedValue: 10 value: 12 succ: 0 <test>:2:4
namedValue b id: 10 attr: 0x0 <test>:2:4
mapConst id: 12 <test>:2:8
{}
== Methods:
Method <NoneType> fac() id: 1 parent: <test> args: 4 body: 6 <test>:0:55
Expr id: 4 expr: 3 succ: 0
- varDef n id: 3 namedValue: 2 value: 0 succ: 0 <test>:1:23
+ varDef Int n id: 3 namedValue: 2 value: 0 succ: 0 <test>:1:23
namedValue n id: 2 attr: 0x22 <test>:1:23
- varDef rc id: 6 namedValue: 5 value: 0 succ: 7 <test>:2:4
+ varDef Int rc id: 6 namedValue: 5 value: 0 succ: 7 <test>:2:4
namedValue rc id: 5 attr: 0x0 <test>:2:4
If id: 7 condition: 9 then: 14 else: 24 succ: 26<test>:2:8
BinOp id: 9 op: <= (34) left: 8 right: 10 <test>:2:14
namedValue rc id: 25 attr: 0x0 <test>:3:3
= <test>.fac (method) parent: <test>
== Variables:
- varDef n id: 3 namedValue: 2 value: 0 succ: 0 <test>:1:23
+ varDef Int n id: 3 namedValue: 2 value: 0 succ: 0 <test>:1:23
namedValue n id: 2 attr: 0x22 <test>:1:23
- varDef rc id: 6 namedValue: 5 value: 0 succ: 7 <test>:2:4
+ varDef Int rc id: 6 namedValue: 5 value: 0 succ: 7 <test>:2:4
namedValue rc id: 5 attr: 0x0 <test>:2:4
== Methods:
Method <NoneType> max() id: 21 parent: <test> args: 24 body: 40 <test>:5:5
Expr id: 24 expr: 23 succ: 27
- varDef a id: 23 namedValue: 22 value: 0 succ: 0 <test>:6:23
+ varDef Int a id: 23 namedValue: 22 value: 0 succ: 0 <test>:6:23
namedValue a id: 22 attr: 0x22 <test>:6:23
Expr id: 40 expr: 31 succ: 0 <test>:7:3
call max Id: 31 args: 33 parent: 0 succ: 0 <test>:7:3
namedValue c id: 37 attr: 0x0 <test>:7:15
= <test>.max (method) parent: <test>
== Variables:
- varDef a id: 23 namedValue: 22 value: 0 succ: 0 <test>:6:23
+ varDef Int a id: 23 namedValue: 22 value: 0 succ: 0 <test>:6:23
namedValue a id: 22 attr: 0x22 <test>:6:23
- varDef b id: 26 namedValue: 25 value: 0 succ: 0 <test>:6:30
+ varDef Int b id: 26 namedValue: 25 value: 0 succ: 0 <test>:6:30
namedValue b id: 25 attr: 0x20 <test>:6:30
- varDef c id: 29 namedValue: 28 value: 0 succ: 0 <test>:6:37
+ varDef Int c id: 29 namedValue: 28 value: 0 succ: 0 <test>:6:37
namedValue c id: 28 attr: 0x20 <test>:6:37
== Methods:
Method <NoneType> max() id: 1 parent: <test> args: 4 body: 40 <test>:0:4
Expr id: 4 expr: 3 succ: 7
- varDef a id: 3 namedValue: 2 value: 0 succ: 0 <test>:1:23
+ varDef Int a id: 3 namedValue: 2 value: 0 succ: 0 <test>:1:23
namedValue a id: 2 attr: 0x22 <test>:1:23
Expr id: 40 expr: 31 succ: 0 <test>:7:3
call max Id: 31 args: 33 parent: 0 succ: 0 <test>:7:3
== Methods:
Method <NoneType> max() id: 11 parent: <test>.max args: 14 body: 19 <test>:1:41
Expr id: 14 expr: 13 succ: 17
- varDef a id: 13 namedValue: 12 value: 0 succ: 0 <test>:2:17
+ varDef Int a id: 13 namedValue: 12 value: 0 succ: 0 <test>:2:17
namedValue a id: 12 attr: 0x20 <test>:2:17
- varDef rc id: 19 namedValue: 18 value: 20 succ: 21 <test>:3:5
+ varDef Int rc id: 19 namedValue: 18 value: 20 succ: 21 <test>:3:5
namedValue rc id: 18 attr: 0x0 <test>:3:5
namedValue a id: 20 attr: 0x0 <test>:3:11
If id: 21 condition: 23 then: 28 else: 0 succ: 30<test>:3:13
namedValue rc id: 29 attr: 0x0 <test>:5:3
= <test>.max.max (method) parent: <test>.max
== Variables:
- varDef a id: 13 namedValue: 12 value: 0 succ: 0 <test>:2:17
+ varDef Int a id: 13 namedValue: 12 value: 0 succ: 0 <test>:2:17
namedValue a id: 12 attr: 0x20 <test>:2:17
- varDef b id: 16 namedValue: 15 value: 0 succ: 0 <test>:2:24
+ varDef Int b id: 16 namedValue: 15 value: 0 succ: 0 <test>:2:24
namedValue b id: 15 attr: 0x20 <test>:2:24
- varDef rc id: 19 namedValue: 18 value: 20 succ: 21 <test>:3:5
+ varDef Int rc id: 19 namedValue: 18 value: 20 succ: 21 <test>:3:5
namedValue rc id: 18 attr: 0x0 <test>:3:5
namedValue a id: 20 attr: 0x0 <test>:3:11
== Variables:
- varDef a id: 3 namedValue: 2 value: 0 succ: 0 <test>:1:23
+ varDef Int a id: 3 namedValue: 2 value: 0 succ: 0 <test>:1:23
namedValue a id: 2 attr: 0x22 <test>:1:23
- varDef b id: 6 namedValue: 5 value: 0 succ: 0 <test>:1:30
+ varDef Int b id: 6 namedValue: 5 value: 0 succ: 0 <test>:1:30
namedValue b id: 5 attr: 0x20 <test>:1:30
- varDef c id: 9 namedValue: 8 value: 0 succ: 0 <test>:1:37
+ varDef Int c id: 9 namedValue: 8 value: 0 succ: 0 <test>:1:37
namedValue c id: 8 attr: 0x20 <test>:1:37
a=b=(a+(b-2)*3)
= <test> (module) parent: $global
== Variables:
-varDef a id: 2 namedValue: 1 value: 3 succ: 5 <test>:1:4
+varDef Int a id: 2 namedValue: 1 value: 3 succ: 5 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
const id: 3 value: 1 <test>:1:8
-varDef b id: 5 namedValue: 4 value: 6 succ: 9 <test>:2:4
+varDef Int b id: 5 namedValue: 4 value: 6 succ: 9 <test>:2:4
namedValue b id: 4 attr: 0x0 <test>:2:4
const id: 6 value: 100 <test>:2:8
== Body:
-varDef a id: 2 namedValue: 1 value: 3 succ: 5 <test>:1:4
+varDef Int a id: 2 namedValue: 1 value: 3 succ: 5 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
const id: 3 value: 1 <test>:1:8
-varDef b id: 5 namedValue: 4 value: 6 succ: 9 <test>:2:4
+varDef Int b id: 5 namedValue: 4 value: 6 succ: 9 <test>:2:4
namedValue b id: 4 attr: 0x0 <test>:2:4
const id: 6 value: 100 <test>:2:8
Expr id: 9 expr: 7 succ: 12 <test>:2:13
until a != 2 * 3;
= <test> (module) parent: $global
== Variables:
-varDef a id: 2 namedValue: 1 value: 0 succ: 3 <test>:1:4
+varDef Int a id: 2 namedValue: 1 value: 0 succ: 3 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
== Body:
-varDef a id: 2 namedValue: 1 value: 0 succ: 3 <test>:1:4
+varDef Int a id: 2 namedValue: 1 value: 0 succ: 3 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
repeat id: 3 condition: 8 body: 6 succ: 0 <test>:1:7
BinOp id: 8 op: != (33) left: 7 right: 10 <test>:4:8
--- /dev/null
+const lazy Str s = 'Hi';
+const List l;
+Int i = 3;
+= <test> (module) parent: $global
+== Variables:
+varDef Str s id: 2 namedValue: 1 value: 3 succ: 5 <test>:1:15
+ namedValue s id: 1 attr: 0x12 <test>:1:15
+ const id: 3 value: 'Hi' <test>:1:19
+varDef List l id: 5 namedValue: 4 value: 0 succ: 7 <test>:2:11
+ namedValue l id: 4 attr: 0x2 <test>:2:11
+varDef Int i id: 7 namedValue: 6 value: 8 succ: 0 <test>:3:4
+ namedValue i id: 6 attr: 0x0 <test>:3:4
+ const id: 8 value: 3 <test>:3:8
+== Body:
+varDef Str s id: 2 namedValue: 1 value: 3 succ: 5 <test>:1:15
+ namedValue s id: 1 attr: 0x12 <test>:1:15
+ const id: 3 value: 'Hi' <test>:1:19
+varDef List l id: 5 namedValue: 4 value: 0 succ: 7 <test>:2:11
+ namedValue l id: 4 attr: 0x2 <test>:2:11
+varDef Int i id: 7 namedValue: 6 value: 8 succ: 0 <test>:3:4
+ namedValue i id: 6 attr: 0x0 <test>:3:4
+ const id: 8 value: 3 <test>:3:8
od
= <test> (module) parent: $global
== Variables:
-varDef a id: 2 namedValue: 1 value: 3 succ: 4 <test>:1:4
+varDef Int a id: 2 namedValue: 1 value: 3 succ: 4 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
const id: 3 value: 20 <test>:1:8
== Body:
-varDef a id: 2 namedValue: 1 value: 3 succ: 4 <test>:1:4
+varDef Int a id: 2 namedValue: 1 value: 3 succ: 4 <test>:1:4
namedValue a id: 1 attr: 0x0 <test>:1:4
const id: 3 value: 20 <test>:1:8
while id: 4 condition: 6 body: 11 succ: 0 <test>:1:12
testRplBenchmark();
extern void testRplVM();
- //testRplVM();
+ testRplVM();
extern void testRplMFParser();
testRplMFParser();
checkAST("baseTest.txt", __LINE__);
}
- void defTest(){
- setSource("Int i = 3; const lazy Str s = 'Hi'; const List l;");
+ void varDefTest(){
+ setSource("const lazy Str s = 'Hi';\nconst List l;\nInt i = 3;");
RplMFParser parser(m_source, m_tree);
parser.parse();
- checkAST("defTest.txt", __LINE__);
+ checkAST("varDefTest.txt", __LINE__);
}
void ifTest(){
checkAST("meth4.txt", __LINE__);
}
virtual void doIt(void) {
+ varDefTest();
+ repeatTest();
+ baseTest();
+ whileTest();
methodTest();
fieldTest();
methodCallTest();
forCTest();
listTest();
opTest();
- ifTest();
- whileTest();
- repeatTest();
- defTest();
- baseTest();
}
};
void testRplMFParser() {
reader.addSource("source1", m_content1_1 + m_content1_2);
reader.addSource("source2", m_content2);
RplSourceUnit* unit = reader.openSourceUnit("source1");
+ checkNN(unit);
checkE("source1", unit->name());
checkE(0, unit->lineNo());
checkOne(6, reader);