Пример #1
0
/*
 fileIn reads in a module definition
 */
void fileIn(FILE *fd, boolean printit)
{
    while (fgets(textBuffer, TextBufferSize, fd) != NULL)
    {
        lexinit(textBuffer);
        if (token == inputend)
            ; /* do nothing, get next line */
        else if ((token == binary) && streq(tokenString, "\""))
            ; /* do nothing, its a comment */
        /* Syntax for Class and Methods definitions
         
         Number extend [
           radiusToArea [
             ^self squared * Float pi
           ]
           radiusToCircumference [
             ^self * 2 * Float pi
           ]
         ]
        */
        else if ((token == nameconst) && streq(tokenString,"Class"))
            readClassDeclaration();
        else if ((token == nameconst) && streq(tokenString,"Methods"))
            readMethods(fd, printit);
        else
            sysError("unrecognized line", textBuffer);
    }
}
Пример #2
0
bool GeneratorNG::loadData(const QByteArray &data)
{
    const QJsonDocument document = QJsonDocument::fromJson(data);

    m_types = readTypes(document);
    m_solvedTypes = solveTypes(m_types);

    m_methods = readMethods(document);

    return !(m_types.isEmpty() || m_solvedTypes.isEmpty() | m_methods.isEmpty());
}
Пример #3
0
/*
    fileIn reads in a module definition
*/
void fileIn(FILE* fd, bool printit)
{
    textBuffer = new char[TextBufferSize];
    while(fgets(textBuffer, TextBufferSize, fd) != NULL) 
    {
        ll.reset(textBuffer);
        if (ll.currentToken() == inputend)
            ; /* do nothing, get next line */
        else if ((ll.currentToken() == binary) && ll.strToken().compare("*") == 0)
            ; /* do nothing, its a comment */
        else if ((ll.currentToken() == nameconst) && ll.strToken().compare("RawClass") == 0)
            readRawClassDeclaration();
        else if ((ll.currentToken() == nameconst) && ll.strToken().compare("Class") == 0)
            readClassDeclaration();
        else if ((ll.currentToken() == nameconst) && ll.strToken().compare("Methods") == 0)
            readMethods(fd, printit);
        else 
            sysError("unrecognized line", textBuffer);
        MemoryManager::Instance()->garbageCollect();
    }
    delete[](textBuffer);
}