/* (non-Javadoc) * @see parser.CBaseElement#DoCustomSemanticAnalysis(semantic.CBaseSemanticEntity, semantic.CBaseSemanticEntityFactory) */ protected CBaseLanguageEntity DoCustomSemanticAnalysis( CBaseLanguageEntity parent, CBaseEntityFactory factory) { if (factory.m_ProgramCatalog.isMissingIncludeStructure()) { Transcoder.logError( "Some include structure are missing: ProcedureDivision code generation cannot be done"); return null; } // Insert deferred children before procedure division ArrayList<DeferredItem> arrDeferredChildren = parent.getDeferredChildren(); if (arrDeferredChildren != null) { for (int n = 0; n < arrDeferredChildren.size(); n++) { DeferredItem deferredItem = arrDeferredChildren.get(n); CLanguageElement el = deferredItem.getElement(); CBaseLanguageEntity entity = deferredItem.getEntity(); el.DoDeferredSemanticAnalysisForChildren(entity, factory); parent.AddChild(entity); } } CEntityProcedureDivision pro = factory.NewEntityProcedureDivision(getLine()); parent.AddChild(pro); for (int i = 0; i < m_arrUsingRef.size(); i++) { CIdentifier id = m_arrUsingRef.get(i); CDataEntity e = id.GetDataReference(getLine(), factory); pro.AddCallParameter(e); } if (m_ProcedureDivisionBloc != null) { CEntityBloc e = (CEntityBloc) m_ProcedureDivisionBloc.DoSemanticAnalysis(pro, factory); pro.SetProcedureBloc(e); } return parent; }
protected CBaseLanguageEntity DoCustomSemanticAnalysis( CBaseLanguageEntity parent, CBaseEntityFactory factory) { CEntityCICSRead Read = factory.NewEntityCICSRead(getLine(), CEntityCICSRead.CEntityCICSReadMode.PREVIOUS); parent.AddChild(Read); CDataEntity filename = m_FileName.GetDataEntity(getLine(), factory); if (m_ReadType == CCobolKeywordList.FILE) { Read.ReadFile(filename); } else if (m_ReadType == CCobolKeywordList.DATASET) { Read.ReadDataSet(filename); } else { Transcoder.logError(getLine(), "Error in semantic analysis of EXEC CICS READPREV"); return null; } if (m_DataInto != null) { CDataEntity edata = m_DataInto.GetDataReference(getLine(), factory); CDataEntity edatalen = null; if (m_DataLength != null) { edatalen = m_DataLength.GetDataEntity(getLine(), factory); } Read.SetDataInto(edata, edatalen); } if (m_KeyLength != null) { Read.SetKeyLength(m_KeyLength.GetDataEntity(getLine(), factory)); } if (m_RecIDField != null) { CDataEntity edata = m_RecIDField.GetDataReference(getLine(), factory); Read.SetRecIDField(edata); } return Read; }
/* (non-Javadoc) * @see parser.CBaseElement#DoCustomSemanticAnalysis(semantic.CBaseSemanticEntity, semantic.CBaseSemanticEntityFactory) */ protected CBaseLanguageEntity DoCustomSemanticAnalysis( CBaseLanguageEntity parent, CBaseEntityFactory factory) { CEntityNamedCondition eCond = factory.NewEntityNamedCondition(getLine(), m_csIdentifier); parent.AddChild(eCond); for (int i = 0; i < m_arrValues.size(); i += 2) { CTerminal term1 = m_arrValues.get(i); CTerminal term2 = m_arrValues.get(i + 1); if (term1.GetValue().equals(term2.GetValue())) { CDataEntity eVal = term1.GetDataEntity(getLine(), factory); if (eVal == null && !term1.IsReference()) { String cs = term1.GetValue(); if (cs.equals(CCobolConstantList.HIGH_VALUE.m_Name) || cs.equals(CCobolConstantList.HIGH_VALUES.m_Name)) { eVal = factory.NewEntityConstant(CEntityConstant.Value.HIGH_VALUE); } else { eVal = factory.NewEntityUnknownReference(getLine(), term1.toString()); } } eCond.AddValue(eVal); } else { CDataEntity eVal1 = term1.GetDataEntity(getLine(), factory); CDataEntity eVal2 = term2.GetDataEntity(getLine(), factory); eCond.AddInterval(eVal1, eVal2); } } return eCond; }
/* (non-Javadoc) * @see parser.CBaseElement#DoCustomSemanticAnalysis(semantic.CBaseSemanticEntity, semantic.CBaseSemanticEntityFactory) */ protected CBaseLanguageEntity DoCustomSemanticAnalysis( CBaseLanguageEntity parent, CBaseEntityFactory factory) { CEntityCase e = factory.NewEntityCase(getLine(), m_nEndLine); if (m_cond.IsConstant() || m_cond.GetConstantValue().equals("OTHER")) { e.SetCondition(null); } else { CBaseEntityCondition eCond = m_cond.AnalyseCondition(factory); e.SetCondition(eCond); } parent.AddChild(e); return e; }
@Override protected CBaseLanguageEntity DoCustomSemanticAnalysis( CBaseLanguageEntity parent, CBaseEntityFactory factory) { CEntityDataSection data = factory.NewEntityDataSection(getLine(), "DeclarationSection"); for (CConstantTerminal c : m_arrParams) { // TODO do semantic analysis } for (CFPacInputFile f : m_arrInputFiles) { f.DoSemanticAnalysis(data, factory); } for (CFPacOutputFile f : m_arrOutputFiles) { f.DoSemanticAnalysis(data, factory); } for (CFPacUpdateFile f : m_arrUpdateFiles) { f.DoSemanticAnalysis(data, factory); } parent.AddChild(data); return data; }
protected CBaseLanguageEntity DoCustomSemanticAnalysis( CBaseLanguageEntity parent, CBaseEntityFactory factory) { CEntitySQLCommit eRB = factory.NewEntitySQLCommit(getLine()); parent.AddChild(eRB); return eRB; }