private boolean CustomParsing() { CBaseToken tok = GetCurrentToken(); if (tok.GetKeyword() == null) return false; CFPacElement el = null; if (tok.GetKeyword().m_Name.startsWith("IPF")) { CFPacInputFile file = new CFPacInputFile(tok.getLine()); el = file; m_arrInputFiles.add(file); } else if (tok.GetKeyword().m_Name.startsWith("OPF")) { CFPacOutputFile file = new CFPacOutputFile(tok.getLine()); m_arrOutputFiles.add(file); el = file; } else if (tok.GetKeyword().m_Name.startsWith("UPF")) { CFPacUpdateFile file = new CFPacUpdateFile(tok.getLine()); m_arrUpdateFiles.add(file); el = file; } else if (tok.GetKeyword() == CFPacKeywordList.PARM) { tok = GetNext(); if (tok.GetType() == CTokenType.EQUALS) { tok = GetNext(); boolean bDone = false; while (!bDone) { if (tok.GetType() == CTokenType.CONSTANT) { CConstantTerminal term = new CConstantTerminal(tok.GetValue()); m_arrParams.add(term); } else { Transcoder.logError(tok.getLine(), "Expecting CONSTANT after PARM"); return false; } tok = GetNext(); if (tok.GetType() == CTokenType.COMMA) { tok = GetNext(); } else { bDone = true; } } } else { Transcoder.logError(tok.getLine(), "Expecting '=' after PARM"); return false; } } else return false; if (el != null) { if (!Parse(el)) return false; } return true; }
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) { 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; }
@Override protected CParser<CMapSetElement> doParsing(CTokenList lst) { CBMSParser parser = new CBMSParser(); if (parser.StartParsing(lst)) { CGlobalEntityCounter.GetInstance().CountBMSFile(); return parser; } else { Transcoder.logError("BMS parsing failed"); return null; } }
protected boolean DoParsing() { CBaseToken tok = GetCurrentToken(); // if (tok.GetKeyword() == CCobolKeywordList.) { tok = GetNext(); } String cs = ""; tok = GetCurrentToken(); while (tok.GetKeyword() != CCobolKeywordList.END_EXEC) { cs += tok.GetDisplay() + " "; tok = GetNext(); } if (tok.GetKeyword() != CCobolKeywordList.END_EXEC) { Transcoder.logError(getLine(), "Error while parsing EXEC CICS CONNECT"); return false; } StepNext(); return true; }
protected CTerminal ReadTerminal() { CBaseToken tok = GetCurrentToken(); if (tok.GetKeyword() == CFPacKeywordList.C) { tok = GetNext(); if (tok.GetType() == CTokenType.STRING) { String cs = tok.GetValue(); CTerminal term = new CStringTerminal(cs); StepNext(); return term; } else { Transcoder.logError(tok.getLine(), "Expecting 'STRING' after 'C'"); return null; } } else if (tok.GetKeyword() == CFPacKeywordList.C) { String cs = tok.GetValue(); CTerminal term = new CStringTerminal(cs); StepNext(); return term; } else if (tok.GetKeyword() == CFPacKeywordList.P) { tok = GetNext(); if (tok.GetType() == CTokenType.STRING) { String cs = tok.GetValue(); CTerminal term = new CNumberTerminal(cs); StepNext(); return term; } else { Transcoder.logError(tok.getLine(), "Expecting 'STRING' after 'P'"); return null; } } else if (tok.GetKeyword() == CFPacKeywordList.F) { tok = GetNext(); if (tok.GetType() == CTokenType.STRING) { String cs = tok.GetValue(); CTerminal term = new CNumberTerminal(cs); StepNext(); return term; } else { Transcoder.logError(tok.getLine(), "Expecting 'STRING' after 'F'"); return null; } } else if (tok.GetKeyword() == CFPacKeywordList.X) { tok = GetNext(); if (tok.GetType() == CTokenType.STRING) { String cs = tok.GetValue(); CTerminal term = new CNumberTerminal("0x" + cs); StepNext(); return term; } else { Transcoder.logError(tok.getLine(), "Expecting 'STRING' after 'X'"); return null; } } else if (tok.GetType() == CTokenType.NUMBER) { CAddressTerminal term = new CAddressTerminal(tok.GetValue()); tok = GetNext(); return term; } else if (tok.GetType() == CTokenType.IDENTIFIER) { CIdentifier id = ReadIdentifier(); if (id != null) { CIdentifierTerminal term = new CIdentifierTerminal(id); return term; } else { // ... } } else if (tok.GetType() == CTokenType.STRING) { String cs = tok.GetValue(); CTerminal term = new CStringTerminal(cs); StepNext(); return term; } else { Transcoder.logError( tok.getLine(), "Unexpecting token while reading terminal : " + tok.toString()); return null; } return null; }
protected CExpression ReadExpression() { CBaseToken tok = GetCurrentToken(); CFPacGenericExpression exp = new CFPacGenericExpression(tok.getLine()); boolean bOk = true; while (bOk) { tok = GetCurrentToken(); if (tok.GetKeyword() == CFPacKeywordList.P) { tok = GetNext(); if (tok.GetType() == CTokenType.STRING) { String cs = tok.GetValue(); CTerminal term = new CNumberTerminal(cs); exp.AddTerm(new CTermExpression(tok.getLine(), term)); } else { Transcoder.logError(tok.getLine(), "Expecting 'STRING' after 'P'"); return null; } tok = GetNext(); } else if (tok.GetKeyword() == CFPacKeywordList.C) { tok = GetNext(); if (tok.GetType() == CTokenType.STRING) { String cs = tok.GetValue(); CTerminal term = new CStringTerminal(cs); exp.AddTerm(new CTermExpression(tok.getLine(), term)); } else { Transcoder.logError(tok.getLine(), "Expecting 'STRING' after 'C'"); return null; } tok = GetNext(); } else if (tok.GetType() == CTokenType.STRING) { String cs = tok.GetValue(); CTerminal term = new CStringTerminal(cs); exp.AddTerm(new CTermExpression(tok.getLine(), term)); tok = GetNext(); } else if (tok.GetKeyword() == CFPacKeywordList.X) { tok = GetNext(); if (tok.GetType() == CTokenType.STRING) { String cs = tok.GetValue(); CTerminal term = new CNumberTerminal("0x" + cs); exp.AddTerm(new CTermExpression(tok.getLine(), term)); } else { Transcoder.logError(tok.getLine(), "Expecting 'STRING' after 'X'"); return null; } tok = GetNext(); } else if (tok.GetKeyword() == CFPacKeywordList.E) { tok = GetNext(); if (tok.GetType() == CTokenType.STRING) { String cs = tok.GetValue(); CTerminal term = new CStringTerminal(cs); exp.AddTerm(new CTermExpression(tok.getLine(), term)); } else { Transcoder.logError(tok.getLine(), "Expecting 'STRING' after 'E'"); return null; } tok = GetNext(); } else if (tok.GetKeyword() == CFPacKeywordList.F) { tok = GetNext(); if (tok.GetType() == CTokenType.STRING) { String cs = tok.GetValue(); CTerminal term = new CNumberTerminal(cs); exp.AddTerm(new CTermExpression(tok.getLine(), term)); } else { Transcoder.logError(tok.getLine(), "Expecting 'STRING' after 'F'"); return null; } tok = GetNext(); } else if (tok.GetKeyword() == CFPacKeywordList.EQ || tok.GetKeyword() == CFPacKeywordList.NE || tok.GetKeyword() == CFPacKeywordList.GE || tok.GetKeyword() == CFPacKeywordList.GT || tok.GetKeyword() == CFPacKeywordList.LE || tok.GetKeyword() == CFPacKeywordList.LT || tok.GetKeyword() == CFPacKeywordList.NUMERIC || tok.GetKeyword() == CFPacKeywordList.SPACE) { exp.SetKeyword(tok.GetKeyword()); tok = GetNext(); } else if (tok.GetType() == CTokenType.NUMBER) { CTerminal term = new CAddressTerminal(tok.GetValue()); CExpression e = new CTermExpression(tok.getLine(), term); tok = GetNext(); if (tok.GetType() == CTokenType.PLUS) { tok = GetNext(); CExpression exp2 = ReadTerminalExpression(); if (exp2 == null) { Transcoder.logError(tok.getLine(), "Expecting expression after '+'"); return null; } CSumExpression sum = new CSumExpression(tok.getLine(), e, exp2, CSumExpression.CSumType.ADD); exp.AddTerm(sum); } else { exp.AddTerm(e); } } else if (tok.GetType() == CTokenType.IDENTIFIER) { CIdentifier id = new CIdentifier(tok.GetValue()); tok = GetNext(); if (tok.GetType() == CTokenType.MINUS) { tok = GetNext(); if (tok.GetType() == CTokenType.NUMBER) { CExpression e = new CTermExpression(0, new CAddressTerminal(tok.GetValue())); // id.SetSubStringReference(exp, null) ; CTerminal term = new CIdentifierTerminal(id); exp.AddTerm(new CTermExpression(tok.getLine(), term)); exp.AddTerm(e); tok = GetNext(); } else { Transcoder.logError( tok.getLine(), "Expecting number instead of token : " + tok.toString()); return null; } } else if (tok.GetType() == CTokenType.PLUS) { tok = GetNext(); CExpression e = ReadTerminalExpression(); if (e == null) { Transcoder.logError(tok.getLine(), "Expecting expression after '+'"); return null; } CSumExpression sum = new CSumExpression( tok.getLine(), new CTermExpression(tok.getLine(), new CIdentifierTerminal(id)), e, CSumExpression.CSumType.ADD); exp.AddTerm(sum); } else if (tok.GetType() == CTokenType.COMMA) { CTerminal term = new CIdentifierTerminal(id); exp.AddTerm(new CTermExpression(tok.getLine(), term)); } else { Transcoder.logError(tok.getLine(), "Unexpecting token : " + tok.toString()); return null; } } tok = GetCurrentToken(); if (tok.GetType() == CTokenType.COMMA) { tok = GetNext(); } else { bOk = false; } } return exp; }
protected boolean DoParsing() { CBaseToken tok = GetCurrentToken(); if (tok.GetKeyword() == CCobolKeywordList.READPREV) { tok = GetNext(); } boolean bDone = false; while (!bDone) { tok = GetCurrentToken(); if (tok.GetKeyword() == CCobolKeywordList.FILE && m_ReadType == null) { m_ReadType = CCobolKeywordList.FILE; tok = GetNext(); if (tok.GetType() == CTokenType.LEFT_BRACKET) { tok = GetNext(); m_FileName = ReadTerminal(); tok = GetCurrentToken(); if (tok.GetType() == CTokenType.RIGHT_BRACKET) { tok = GetNext(); } } } else if (tok.GetKeyword() == CCobolKeywordList.DATASET && m_ReadType == null) { m_ReadType = CCobolKeywordList.DATASET; tok = GetNext(); if (tok.GetType() == CTokenType.LEFT_BRACKET) { tok = GetNext(); m_FileName = ReadTerminal(); tok = GetCurrentToken(); if (tok.GetType() == CTokenType.RIGHT_BRACKET) { tok = GetNext(); } } } else if (tok.GetKeyword() == CCobolKeywordList.INTO) { tok = GetNext(); if (tok.GetType() == CTokenType.LEFT_BRACKET) { tok = GetNext(); m_DataInto = ReadIdentifier(); tok = GetCurrentToken(); if (tok.GetType() == CTokenType.RIGHT_BRACKET) { tok = GetNext(); } } } else if (tok.GetValue().equals("RIDFLD")) { tok = GetNext(); if (tok.GetType() == CTokenType.LEFT_BRACKET) { tok = GetNext(); m_RecIDField = ReadIdentifier(); tok = GetCurrentToken(); if (tok.GetType() == CTokenType.RIGHT_BRACKET) { tok = GetNext(); } } } else if (tok.GetKeyword() == CCobolKeywordList.LENGTH) { tok = GetNext(); if (tok.GetType() == CTokenType.LEFT_BRACKET) { tok = GetNext(); m_Length = ReadTerminal(); tok = GetCurrentToken(); if (tok.GetType() == CTokenType.RIGHT_BRACKET) { tok = GetNext(); } } } else if (tok.GetValue().equals("KEYLENGTH")) { tok = GetNext(); if (tok.GetType() == CTokenType.LEFT_BRACKET) { tok = GetNext(); m_KeyLength = ReadTerminal(); tok = GetCurrentToken(); if (tok.GetType() == CTokenType.RIGHT_BRACKET) { tok = GetNext(); } } } else { bDone = true; } } if (tok.GetKeyword() != CCobolKeywordList.END_EXEC) { Transcoder.logError(tok.getLine(), "Error while parsing EXEC CICS READ"); return false; } StepNext(); return true; }
/* (non-Javadoc) * @see parser.CBMSElement#InterpretKeyword(lexer.CReservedKeyword, lexer.CTokenList) */ protected boolean InterpretKeyword(CReservedKeyword kw, CTokenList lstTokens) { if (kw == CBMSKeywordList.POS) { // POS=(001,001) CBaseToken tok = GetCurrentToken(); if (tok.GetType() != CTokenType.LEFT_BRACKET) { Transcoder.logError(getLine(), "Expecting LEFT_BRACKET"); return false; } tok = GetNext(); if (tok.GetType() != CTokenType.NUMBER) { Transcoder.logError(getLine(), "Expecting NUMBER"); return false; } m_PosLine = tok.GetIntValue(); tok = GetNext(); if (tok.GetType() != CTokenType.COMMA) { Transcoder.logError(getLine(), "Expecting COMMA"); return false; } tok = GetNext(); if (tok.GetType() != CTokenType.NUMBER) { Transcoder.logError(getLine(), "Expecting NUMBER"); return false; } m_PosCol = tok.GetIntValue(); tok = GetNext(); if (tok.GetType() != CTokenType.RIGHT_BRACKET) { Transcoder.logError(getLine(), "Expecting RIGHT_BRACKET"); return false; } StepNext(); } else if (kw == CBMSKeywordList.LENGTH) { // LENGTH=006 CBaseToken tok = GetCurrentToken(); if (tok.GetType() == CTokenType.NUMBER) { m_Length = tok.GetIntValue(); } else { Transcoder.logError(getLine(), "Expecting NUMBER"); return false; } StepNext(); } else if (kw == CBMSKeywordList.COLOR) { // COLOR=TURQUOISE CBaseToken tok = GetCurrentToken(); if (tok.GetConstant() == CBMSConstantList.TURQUOISE || tok.GetConstant() == CBMSConstantList.GREEN || tok.GetConstant() == CBMSConstantList.YELLOW || tok.GetConstant() == CBMSConstantList.RED || tok.GetConstant() == CBMSConstantList.BLUE || tok.GetConstant() == CBMSConstantList.PINK || tok.GetConstant() == CBMSConstantList.NEUTRAL || tok.GetConstant() == CBMSConstantList.DEFAULT) { m_Color = tok.GetConstant(); } else { Transcoder.logError(getLine(), "Unexpecting COLOR : " + tok.GetValue()); return false; } StepNext(); } else if (kw == CBMSKeywordList.HILIGHT) { // HILIGHT=OFF CBaseToken tok = GetCurrentToken(); if (tok.GetConstant() == CBMSConstantList.OFF || tok.GetConstant() == CBMSConstantList.REVERSE || tok.GetConstant() == CBMSConstantList.UNDERLINE) { m_HighLight = tok.GetConstant(); } else { Transcoder.logError(getLine(), "Unexpecting HIGHLIGHT : " + tok.GetValue()); return false; } StepNext(); } else if (kw == CBMSKeywordList.ATTRB) { // ATTRB=(ASKIP,NORM) CBaseToken tok = GetCurrentToken(); if (tok.GetType() != CTokenType.LEFT_BRACKET) { Transcoder.logError(getLine(), "Expecting LEFT_BRACKET"); return false; } tok = GetNext(); boolean bDone = false; while (!bDone) { tok = GetCurrentToken(); if (tok.GetConstant() == CBMSConstantList.ASKIP || tok.GetConstant() == CBMSConstantList.DRK || tok.GetConstant() == CBMSConstantList.PROT || tok.GetConstant() == CBMSConstantList.UNPROT || tok.GetConstant() == CBMSConstantList.BRT || tok.GetConstant() == CBMSConstantList.NUM || tok.GetConstant() == CBMSConstantList.IC || tok.GetConstant() == CBMSConstantList.FSET || tok.GetConstant() == CBMSConstantList.NORM) { m_arrATTRB.addElement(tok.GetValue()); } else if (tok.GetType() == CTokenType.RIGHT_BRACKET) { bDone = true; } else if (tok.GetType() == CTokenType.COMMA) { } else { Transcoder.logError(getLine(), "Unexpecting ATTRIBUTE : " + tok.GetValue()); return false; } StepNext(); } } else if (kw == CBMSKeywordList.JUSTIFY) { // JUSTIFY=(LEFT,BLANK) CBaseToken tok = GetCurrentToken(); if (tok.GetType() != CTokenType.LEFT_BRACKET) { Transcoder.logError(getLine(), "Expecting LEFT_BRACKET"); return false; } tok = GetNext(); boolean bDone = false; while (!bDone) { tok = GetCurrentToken(); if (tok.GetConstant() == CBMSConstantList.LEFT || tok.GetConstant() == CBMSConstantList.RIGHT || tok.GetConstant() == CBMSConstantList.ZERO || tok.GetConstant() == CBMSConstantList.BLANK) { m_arrJustify.addElement(tok.GetValue()); } else if (tok.GetType() == CTokenType.RIGHT_BRACKET) { bDone = true; } else if (tok.GetType() == CTokenType.COMMA) { } else { Transcoder.logError(getLine(), "Unexpecting JUSTIFY : " + tok.GetValue()); return false; } StepNext(); } } else if (kw == CBMSKeywordList.INITIAL) { // CBaseToken tok = GetCurrentToken(); if (tok.GetType() == CTokenType.STRING) { m_Value = tok.GetValue(); } else { Transcoder.logError(getLine(), "Expecting STRING"); return false; } StepNext(); } else if (kw == CBMSKeywordList.GRPNAME) { // CBaseToken tok = GetCurrentToken(); m_GrpName = tok.GetValue(); StepNext(); } else if (kw == CBMSKeywordList.PICIN) { // CBaseToken tok = GetCurrentToken(); m_PicIn = tok.GetValue(); StepNext(); } else if (kw == CBMSKeywordList.PICOUT) { // CBaseToken tok = GetCurrentToken(); m_PicOut = tok.GetValue(); StepNext(); } else { Transcoder.logError(getLine(), "Unexpecting keyword : " + kw.m_Name); return false; } return true; }
/* (non-Javadoc) * @see parser.CLanguageElement#Parse(lexer.CTokenList) */ protected boolean DoParsing() { CProcedureSection curSection = null; boolean bDone = false; while (!bDone) { CBaseToken tok = GetCurrentToken(); if (tok == null) { return true; } if (tok.GetType() == CTokenType.IDENTIFIER || tok.GetType() == CTokenType.NUMBER) { // maybe a label ? // m_ProcedureDivisionBloc = new CBaseProcedure(getLine()); // PJD: Uncomment this line if // we wanted to always have ProcedureDivision() method. It's not needed if we just have a // paragraph or section immediatelly after the PROCEDURE DIVISION String csLabel = tok.GetValue(); GetNext(); CBaseToken tokSection = GetCurrentToken(); if (tokSection.IsKeyword() && tokSection.GetKeyword() == CCobolKeywordList.SECTION) { // maybe the starting of a section CBaseToken tokDot = GetNext(); if (tokDot.GetType() != CTokenType.DOT) { Transcoder.logError(getLine(), "Expecting 'DOT'"); return false; } else { GetNext(); } curSection = new CProcedureSection(csLabel, tok.getLine()); AddChild(curSection); if (!Parse(curSection)) { return false; } } else if (tokSection.IsKeyword() && tokSection.GetKeyword() == CCobolKeywordList.LABEL_SENTENCE) { // maybe the starting of a section CBaseToken tokDot = GetNext(); if (tokDot.GetType() != CTokenType.DOT) { Transcoder.logError(getLine(), "Expecting 'DOT'"); return false; } else { GetNext(); } // CProcedureLabelSentence labelSentence = new CProcedureLabelSentence(csLabel, // tok.getLine()) ; curSection = new CProcedureSection(csLabel, tok.getLine()); curSection.setForcedLabelSentence(); AddChild(curSection); if (!Parse(curSection)) { return false; } } else if (tokSection.GetType() == CTokenType.DOT) { CProcedure eProc = new CProcedure(csLabel, tokSection.getLine()); if (curSection == null) { AddChild(eProc); } else { curSection.AddProcedure(eProc); } if (!Parse(eProc)) { return false; } } else { Transcoder.logError(tokSection.getLine(), "Unexpecting token : " + tokSection.GetValue()); return false; } } else if (tok.GetType() == CTokenType.KEYWORD) { m_ProcedureDivisionBloc = new CBaseProcedure(getLine()); CBaseToken tok1 = GetCurrentToken(); if (!Parse(m_ProcedureDivisionBloc)) { return false; } CBaseToken tok2 = GetCurrentToken(); if (tok2 == tok1) { Transcoder.logError(tok1.getLine(), "Token not parsed : " + tok1.GetValue()); GetNext(); } // else if (tok2.GetType() == CTokenType.DOT) // { // GetNext() ; // } } else if (tok.GetType() == CTokenType.END_OF_BLOCK) { GetNext(); } else { Transcoder.logError(tok.getLine(), "Unexpecting token : " + tok.GetValue()); GetNext(); } } return true; }
protected CBaseLanguageEntity DoCustomSemanticAnalysis( CBaseLanguageEntity parent, CBaseEntityFactory factory) { Transcoder.logError(getLine(), "No Semantic Analysis for EXEC CICS CONNECT"); return null; }
/* (non-Javadoc) * @see parser.CLanguageElement#Parse(lexer.CTokenList) */ protected boolean DoParsing() { CBaseToken tok88 = GetCurrentToken(); if (tok88.GetType() != CTokenType.NUMBER || !tok88.GetValue().equals("88")) { Transcoder.logError(getLine(), "Expecting '88' keyword"); return false; } CGlobalEntityCounter.GetInstance().CountCobolVerb("NAMED_CONDITION"); CBaseToken tok = GetNext(); if (tok.GetType() != CTokenType.IDENTIFIER) { Transcoder.logError(getLine(), "Expecting an identifier after '88' keyword"); return false; } m_csIdentifier = tok.GetValue(); tok = GetNext(); if (tok.GetKeyword() != CCobolKeywordList.VALUE && tok.GetKeyword() != CCobolKeywordList.VALUES) { Transcoder.logError(getLine(), "Expecting 'VALUE' keyword"); return false; } tok = GetNext(); if (tok.GetKeyword() == CCobolKeywordList.IS || tok.GetKeyword() == CCobolKeywordList.ARE) { tok = GetNext(); } boolean bDone = false; while (!bDone) { CBaseToken tokVal = GetCurrentToken(); CTerminal val; if (tokVal.GetType() == CTokenType.COMMA) { tokVal = GetNext(); } if (tokVal.GetType() == CTokenType.STRING || tokVal.GetType() == CTokenType.NUMBER || tokVal.GetType() == CTokenType.CONSTANT || tokVal.GetType() == CTokenType.MINUS) { val = ReadTerminal(); m_arrValues.addElement(val); CBaseToken tokNext = GetCurrentToken(); if (tokNext.GetType() == CTokenType.COMMA) { m_arrValues.addElement( val); // values are intervals, so for a single value, it is added twice, as an // interval of one single value GetNext(); // consume "," } else if (tokNext.GetType() == CTokenType.STRING || tokNext.GetType() == CTokenType.NUMBER || tokNext.GetType() == CTokenType.CONSTANT) { m_arrValues.addElement( val); // values are intervals, so for a single value, it is added twice, as an // interval of one single value } else if (tokNext.GetKeyword() == CCobolKeywordList.THROUGH || tokNext.GetKeyword() == CCobolKeywordList.THRU) { tokNext = GetNext(); if (tokNext.GetType() == CTokenType.STRING || tokNext.GetType() == CTokenType.NUMBER || tokNext.GetType() == CTokenType.CONSTANT) { val = ReadTerminal(); m_arrValues.addElement(val); } else { Transcoder.logError(tokNext.getLine(), "Unexpecting token : " + tokNext.GetValue()); return false; } } else { m_arrValues.addElement( val); // values are intervals, so for a single value, it is added twice, as an // interval of one single value bDone = true; } } else { bDone = true; } } tok = GetCurrentToken(); if (tok.GetType() == CTokenType.DOT) { GetNext(); // consume DOT at the end of the statement } if (m_arrValues.size() > 0) { return true; } else { return false; } }
private CEntityResourceFormContainer importRESResource( String inputFileName, String csApplication, CTransApplicationGroup grp, boolean bResources) { String csOutputFile = generateOutputFileName(inputFileName); CTransApplicationGroup grpResources = m_cat.getGroupResources(); String csFullInputFileName = grpResources.m_csOutputPath + inputFileName; // String csOutputFile = generateOutputFileName(inputFileName) ; // createDirIsRequired(grp.m_csOutputPath, csApplication); // For .res output Tag tagRoot = Tag.createFromFile(csFullInputFileName); if (tagRoot == null) return null; if (grp.m_csOutputPath != null) createDirIsRequired(grp.m_csOutputPath, csApplication); // For .java output CBMSParser BMSParser = parseRESResource(tagRoot); if (BMSParser != null) { Transcoder.logInfo("Transcoding resource " + inputFileName); // exportXMLToFile(BMSParser, "D:/Dev/naca/Pub2000Cobol/Inter/BMS/RS01A05b.xml") ; // Reexport // XML NotificationEngine engine = new NotificationEngine(); doPopulateSpecialActionHandlers(engine); COriginalLisiting listing = new COriginalLisiting(); CObjectCatalog cat = new CObjectCatalog(m_cat, listing, grp.m_eType, engine); try { if (grp.m_csOutputPath != null) { String csJavaOutFileName = FileSystem.appendFilePath( grp.m_csOutputPath + csApplication, ReplaceExtensionFileName(csOutputFile, "java")); CEntityResourceFormContainer ext = doSemanticAnalysis(BMSParser, csJavaOutFileName, cat, grp, bResources); if (ext != null) { // To reexport .res file, uncomment below // String csResOutFileName = grp.m_csOutputPath + // ReplaceExtensionFileName(csOutputFile, "res"); // ext.setExportFilePath(csResOutFileName); // // Transcoder.logInfo("Exporting resource file "+csResOutFileName); // ext.MakeXMLOutput(true) ; m_cat.RegisterFormContainer(inputFileName, ext); // PJD 08/08/2007 Uncomment to export xxx.java screen copy file. These are duplicated // files generated twice beforecorrect generation export by // Transcoder.logInfo("Exporting java file "+csJavaOutFileName); // ext.StartExport() ; String fileNameJavaS = FileSystem.appendFilePath( grp.m_csOutputPath + csApplication, ReplaceExtensionFileNameWithSuffix(csOutputFile, "S", "java")); // String fileNameJavaS = grp.m_csOutputPath + csApplication + "/" + // ReplaceExtensionFileNameWithSuffix(csOutputFile, "S", "java"); CJavaExporter outjavaS = new CJavaExporter(ext.getExporter(), fileNameJavaS); CJavaEntityFactory factoryS0 = new CJavaEntityFactory(ext.m_ProgramCatalog, outjavaS); m_cat = ms_BMSTranscoderEngine.getGlobalCatalog(); CJavaEntityFactory factoryS = new CJavaEntityFactory(cat, outjavaS); ext.clearSavCopy(factoryS); CEntityResourceFormContainer eSav = ext.MakeSavCopy( factoryS, true); // we are generating directly form a .res file; the name of variables in // *S.java file is not very well managed in taht case, so, the flag ... if (ext.GetSavCopy() != null) { // PJD 08/08/2007 Uncomment to export xxxS.java screen copy file. These are duplicated // files generated twice beforecorrect generation export by // Transcoder.logInfo("Exporting javaS file "+fileNameJavaS); // ext.GetSavCopy().StartExport() ; } } return ext; } } catch (NacaTransAssertException e) { Transcoder.logError( "Failure while transcoding " + csFullInputFileName + " : " + e.m_csMessage); } } return null; }