Пример #1
0
  /* (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;
  }
Пример #2
0
 /* (non-Javadoc)
  * @see parser.CBMSElement#DoSemanticAnalysis(semantic.CBaseEntityFactory)
  */
 public CBaseLanguageEntity DoSemanticAnalysis(
     CBaseLanguageEntity parent, CBaseEntityFactory factory) {
   CEntityResourceField ef;
   if (getName().equals("")) {
     ef = factory.NewEntityLabelField(getLine());
     ef.m_csInitialValue = m_Value;
   } else {
     ef = factory.NewEntityEntryField(getLine(), getName());
     if (!m_Value.equals("")) {
       ef.m_ResourceStrings = m_ResourceStrings;
       ef.m_csInitialValue = m_Value;
     }
   }
   ef.SetDisplayName(m_csDisplayName);
   ef.m_nPosCol = m_PosCol;
   ef.m_nPosLine = m_PosLine;
   ef.m_nLength = m_Length;
   if (m_HighLight != null) {
     ef.SetHighLight(m_HighLight.m_Name);
   }
   if (m_Color != null) {
     ef.SetColor(m_Color.m_Name);
   }
   for (int i = 0; i < m_arrATTRB.size(); i++) {
     String cs = m_arrATTRB.elementAt(i);
     if (cs.equals("ASKIP")) {
       ef.SetProtection("AUTOSKIP");
     } else if (cs.equals("UNPROT")) {
       ef.SetProtection("UNPROTECTED");
     } else if (cs.equals("NUM")) {
       ef.SetProtection("NUMERIC");
     } else if (cs.equals("NORM")) {
       ef.SetBrightness("NORMAL");
     } else if (cs.equals("DRK")) {
       ef.SetBrightness("DARK");
     } else if (cs.equals("BRT")) {
       ef.SetBrightness("BRIGHT");
     } else if (cs.equals("FSET")) {
       ef.SetModified();
     } else if (cs.equals("IC")) {
       ef.SetCursor();
     }
   }
   for (int i = 0; i < m_arrJustify.size(); i++) {
     String cs = m_arrJustify.elementAt(i);
     if (cs.equals("LEFT")) {
       ef.SetRightJustified(false);
     } else if (cs.equals("RIGHT")) {
       ef.SetRightJustified(true);
     } else if (cs.equals("BLANK")) {
       ef.SetFillValue("BLANK");
     } else if (cs.equals("ZERO") || cs.equals("ZEROS") || cs.equals("ZEROES")) {
       ef.SetFillValue("ZERO");
     }
   }
   return ef;
 }
Пример #3
0
  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;
  }
Пример #4
0
  /* (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;
  }
Пример #5
0
 /* (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;
 }
Пример #6
0
  @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;
  }
Пример #7
0
 protected CBaseLanguageEntity DoCustomSemanticAnalysis(
     CBaseLanguageEntity parent, CBaseEntityFactory factory) {
   CEntitySQLCommit eRB = factory.NewEntitySQLCommit(getLine());
   parent.AddChild(eRB);
   return eRB;
 }
Пример #8
0
 /** @see parser.expression.CTerminal#GetDataEntity(semantic.CBaseEntityFactory) */
 @Override
 public CDataEntity GetDataEntity(int nLine, CBaseEntityFactory factory) {
   return factory.NewEntityString(m_csFormat);
 }