Example #1
0
/* records */
static void parseKeywords (tokenInfo * const token, boolean local)
{
	switch (token->keyword)
	{
	case KEYWORD_END:
		fileSkipToCharacter (';');
		break;
	case KEYWORD_CONSTANT:
		parseConstant (local);
		break;
	case KEYWORD_TYPE:
		parseTypes (token);
		break;
	case KEYWORD_SUBTYPE:
		parseTypes (token);
		break;
	case KEYWORD_ENTITY:
		parseModule (token);
		break;
	case KEYWORD_COMPONENT:
		parseModule (token);
		break;
	case KEYWORD_FUNCTION:
		parseSubProgram (token);
		break;
	case KEYWORD_PROCEDURE:
		parseSubProgram (token);
		break;
	case KEYWORD_PACKAGE:
		parsePackage (token);
		break;
	default:
		break;
	}
}
Example #2
0
JSWASMModule* WASMModuleParser::parse(ExecState* exec, String& errorMessage)
{
    parseModule(exec);
    if (!m_errorMessage.isNull()) {
        errorMessage = m_errorMessage;
        return nullptr;
    }
    return m_module.get();
}
Example #3
0
bool KICADPCB::parsePCB( SEXPR::SEXPR* data )
{
    if( NULL == data )
        return false;

    if( data->IsList() )
    {
        size_t nc = data->GetNumberOfChildren();
        SEXPR::SEXPR* child = data->GetChild( 0 );
        std::string name = child->GetSymbol();

        if( name != "kicad_pcb" )
        {
            std::ostringstream ostr;
            ostr << "* data is not a valid PCB file: '" << m_filename << "'\n";
            wxLogMessage( "%s\n", ostr.str().c_str() );
            return false;
        }

        bool result = true;

        for( size_t i = 1; i < nc && result; ++i )
        {
            child = data->GetChild( i );

            if( !child->IsList() )
            {
                std::ostringstream ostr;
                ostr << "* corrupt PCB file: '" << m_filename << "'\n";
                wxLogMessage( "%s\n", ostr.str().c_str() );
                return false;
            }

            std::string symname( child->GetChild( 0 )->GetSymbol() );

            if( symname == "general" )
                result = result && parseGeneral( child );
            else if( symname == "module" )
                result = result && parseModule( child );
            else if( symname == "gr_arc" )
                result = result && parseCurve( child, CURVE_ARC );
            else if( symname == "gr_line" )
                result = result && parseCurve( child, CURVE_LINE );
            else if( symname == "gr_circle" )
                result = result && parseCurve( child, CURVE_CIRCLE );
        }

        return result;
    }

    std::ostringstream ostr;
    ostr << "* data is not a valid PCB file: '" << m_filename << "'\n";
    wxLogMessage( "%s\n", ostr.str().c_str() );

    return false;
}
Example #4
0
JSWASMModule* WASMModuleParser::parse(VM& vm, JSGlobalObject* globalObject, String& errorMessage)
{
    m_module.set(vm, JSWASMModule::create(vm, globalObject->wasmModuleStructure()));
    parseModule();
    if (!m_errorMessage.isNull()) {
        errorMessage = m_errorMessage;
        return nullptr;
    }
    return m_module.get();
}
void ExtQualModuleNames::parseModuleName()
{
  // <module name> ::= [[<catalog>.]<schema>.]<module> <qualifiers>
  std::string cat, sch, mod, grp, tgt, ver;
  ThreePartModuleName eqmn;
  switch(nextToken()) {
  case ID:
    parseModule(cat, sch, mod);
    parseQualifiers(grp, tgt, ver);
    composeEQMN(grp, cat, sch, mod, tgt, ver, eqmn);
    modules_.push_back(eqmn);
    break;
  default:
    break;
  }
}
Example #6
0
    bool compile(const std::string& file)
    {
        std::ifstream fin(file.c_str());

        if (!fin.is_open())
        {
            reporter_->fileNotFound(file);
            return false;
        }

        if (boost::optional<cst::Module> module = parseFile(file, fin, logger_))
        {
            ast::Module parsed = parseModule(*module, logger_);

            if (!logger_.errors().empty()) return true;

            FunctionAddrMap fam;

            generateBytecode(parsed, fam).swap(bytecode_);
        }

        return true;
    }
Example #7
0
BibleQuoteModule::BibleQuoteModule(QString pathToModule)
{
    //        DEBUG_FUNC_NAME;
    parseModule(pathToModule);
}
void CCArcticManager::parseFrameModules(CCArcticFileData* afd, CCArcticFrame* arcticFrame, CCAFCFrame* afcFrame, int offsetX, int offsetY, CCAFCClipMapping* mapping) {
	for(int j = 0; j < arcticFrame->moduleCount; j++) {
		CCAFCClip* afcClip = CCAFCClip::create();
		
		// arctic frame module
		CCArcticFrameModule* arcticFrameModule = afd->m_frameModules + j + arcticFrame->firstModuleIndex;
		
		// index, maybe module or hyper frame
		int index = ((arcticFrameModule->flags & AS_INDEX_EX_MASK) << AS_INDEX_EX_SHIFT) | arcticFrameModule->index;
		
		// is hyper frame?
		if((arcticFrameModule->flags & AS_HYPER_FM) != 0) {
			CCArcticFrame* hyperFrame = afd->m_frames + index;
			parseFrameModules(afd, hyperFrame, afcFrame, arcticFrameModule->x, arcticFrameModule->y, mapping);
		} else {
			// need search clip mapping first
			CCAFCClipMappingRule* rule = NULL;
			if(mapping)
				rule = mapping->findRule(index);
			
			// depend on this rule, build clip way different
			if(!rule) {
				// arctic module
				CCArcticModule* arcticModule = afd->m_modules + index;
				parseModule(arcticModule, arcticFrameModule, afcClip, index, offsetX, offsetY);

				// set index
				afcClip->setIndex(index);
			} else {
				switch(rule->type) {
					case AFC_CMR_INTERNAL_CLIP:
					{
						// if internal mapping, redirect clip index
						if(rule)
							index = rule->icr.destClipIndex;

						// arctic module
						CCArcticModule* arcticModule = afd->m_modules + index;
						parseModule(arcticModule, arcticFrameModule, afcClip, index, offsetX, offsetY);

						break;
					}
					case AFC_CMR_EXTERNAL_CLIP:
					{
						// get external file data
						CCArcticFileData* externalAFD = getArcticFileData(rule->ecr.path);
						if(!externalAFD)
							continue;

						// parse arctic module
						CCArcticModule* arcticModule = externalAFD->m_modules + rule->ecr.destClipIndex;
						parseModule(arcticModule, arcticFrameModule, afcClip, rule->ecr.destClipIndex, offsetX, offsetY);

						// need redirect sheet to external sheet
						afcClip->getData().i.sheet = rule->ecr.sheet;

						break;
					}
					case AFC_CMR_EXTERNAL_ATLAS:
					{
						CCAFCClipData& clipData = afcClip->getData();

						// sheet
						clipData.i.sheet = rule->ear.sheet;

						// clip pos
						clipData.clipPos = ccPointMake(resolve(arcticFrameModule->x) + rule->ear.pos.x,
								resolve(-arcticFrameModule->y) + rule->ear.pos.y);

						// clip image rect
						clipData.i.rect = rule->ear.texRect;

						// flip flag
						clipData.i.flipX = rule->ear.flipX;
						clipData.i.rotation = rule->ear.rotation;

						break;
					}
				}
			}
			
			// add clip
			afcFrame->addClip(afcClip);
		}
	}
	
	// collision rects
	if(arcticFrame->collisionRectCount > 0) {
		ccRect* cr = arcticFrame->collisionRects;
		for(int i = 0; i < arcticFrame->collisionRectCount; i++, cr++) {
			CCAFCClip* afcClip = CCAFCClip::create();
			CCAFCClipData& afcClipData = afcClip->getData();
			
			// set type
			afcClip->setType(AFC_CLIP_COLLISION_RECT);
			
			// clip pos
			// ASprite y axis is reversed with opengl y axis, and origin is top left corner
			afcClipData.clipPos = ccPointMake(resolve(cr->x + cr->width / 2 + offsetX),
					resolve(-cr->y - cr->height / 2 - offsetY));
			
			// set rect
			afcClipData.cr.size = ccSizeMake(resolve(cr->width), resolve(cr->height));
			
			// add clip
			afcFrame->addClip(afcClip);
		}
	}
}
void CCAuroraManager::parseFrameModules(CCAuroraFileData* afd, CCAuroraFrame* auroraFrame, CCAFCFrame* afcFrame, int offsetX, int offsetY, CCAFCClipMapping* mapping) {
	for(int j = 0; j < auroraFrame->moduleCount; j++) {
		CCAFCClip* afcClip = CCAFCClip::create();
		
		// aurora frame module
		CCAuroraFrameModule* auroraFrameModule = afd->m_frameModules + j + auroraFrame->firstModuleIndex;
		
		// get index, maybe module or frame index
		int index = ((auroraFrameModule->flags & BS_INDEX_EX_MASK) << BS_INDEX_EX_SHIFT) | auroraFrameModule->index;
		
		// is hyper frame?
		if((auroraFrameModule->flags & BS_HYPER_FM) != 0) {
			CCAuroraFrame* hyperFrame = afd->m_frames + index;
			parseFrameModules(afd, hyperFrame, afcFrame, auroraFrameModule->x, auroraFrameModule->y, mapping);
		} else {
			// need search clip mapping first
			CCAFCClipMappingRule* rule = NULL;
			if(mapping)
				rule = mapping->findRule(index);
			
			// depend on this rule, build clip way different
			if(!rule) {
				// parse aurora module
				CCAuroraModule* auroraModule = afd->m_modules + index;
				parseModule(auroraModule, auroraFrameModule, afcClip, index, offsetX, offsetY);
			} else {
				switch(rule->type) {
					case AFC_CMR_INTERNAL_CLIP:
					{
						// redirect index
						index = rule->icr.destClipIndex;
						
						// parse aurora module
						CCAuroraModule* auroraModule = afd->m_modules + index;
						parseModule(auroraModule, auroraFrameModule, afcClip, index, offsetX, offsetY);
						break;
					}
					case AFC_CMR_EXTERNAL_CLIP:
					{
						// get external file data
						CCAuroraFileData* externalAFD = getAuroraFileData(rule->ecr.path);
						if(!externalAFD)
							continue;

						// parse aurora module
						CCAuroraModule* auroraModule = externalAFD->m_modules + rule->ecr.destClipIndex;
						parseModule(auroraModule, auroraFrameModule, afcClip, rule->ecr.destClipIndex, offsetX, offsetY);
						
						// need redirect sheet to external sheet
						afcClip->getData().i.sheet = rule->ecr.sheet;
						
						break;
					}
					case AFC_CMR_EXTERNAL_ATLAS:
					{
						CCAFCClipData& clipData = afcClip->getData();
						
						// sheet
						clipData.i.sheet = rule->ear.sheet;
						
						// clip pos
						clipData.clipPos = ccpt(resolve(auroraFrameModule->x) + rule->ear.pos.x,
								resolve(-auroraFrameModule->y) + rule->ear.pos.y);
						
						// clip image rect
						clipData.i.rect = rule->ear.texRect;
						
						// flip flag
						clipData.i.flipX = rule->ear.flipX;
						clipData.i.rotation = rule->ear.rotation;
						
						break;
					}
				}
			}
			
			// add clip
			afcFrame->addClip(afcClip);	
		}
	}
}
Example #10
0
 void ParserTests::runTests()
 {
   parseModule();
   parseList();
 }