/* (non-Javadoc) * @see parser.CBaseElement#GetNext() */ @Override protected CBaseToken GetNext() { CBaseToken tok = super.GetNext(); while (tok != null && tok.IsWhiteSpace()) { tok = super.GetNext(); } return tok; }
protected boolean DoParsing() { CBaseToken tok = GetCurrentToken(); m_Token = tok.GetValue(); GetNext(); m_Token += ReadStringUntilEOL(); Transcoder.logWarn(tok.getLine(), "Unparsed Token : " + m_Token); return true; }
protected CExpression ReadCondition() { CExpression exp = ReadAndCondition(); CBaseToken tok = GetCurrentToken(); if (tok.GetKeyword() == CFPacKeywordList.OR) { StepNext(); CExpression exp2 = ReadCondition(); CCondOrStatement st = new CCondOrStatement(tok.getLine(), exp, exp2); return st; } return exp; }
protected boolean DoParsing() { CBaseToken tok = GetCurrentToken(); if (tok.GetKeyword() == CCobolKeywordList.COMMIT) { tok = GetNext(); } if (tok.GetKeyword() == CCobolKeywordList.WORK) { tok = GetNext(); } return true; }
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 CIdentifier ReadIdentifier() { CBaseToken tok = GetCurrentToken(); CIdentifier ident = null; if (tok.GetType() == CTokenType.IDENTIFIER) { String id = tok.GetValue(); id = id.toUpperCase(); ident = new CIdentifier(id); tok = GetNext(); if (tok.GetType() == CTokenType.MINUS) { tok = GetNext(); } else { return ident; } } if (tok.GetType() == CTokenType.NUMBER) { if (ident == null) { ident = new CIdentifier(""); } String csStart = tok.GetValue(); CExpression eStart = new CTermExpression(0, new CNumberTerminal(csStart)); CExpression eLength = null; tok = GetNext(); if (tok.GetType() == CTokenType.COMMA) { tok = GetNext(); if (tok.GetType() == CTokenType.NUMBER) { String csLength = tok.GetValue(); eLength = new CTermExpression(0, new CNumberTerminal(csLength)); StepNext(); } } ident.SetSubStringReference(eStart, eLength); } return ident; }
/* (non-Javadoc) * @see parser.CLanguageElement#ExportCustom(org.w3c.dom.Document) */ protected boolean DoParsing(CFlag fCheckForNextSentence) { CBaseToken tok = GetCurrentToken(); if (tok.GetType() == CTokenType.KEYWORD && tok.GetKeyword() == CCobolKeywordList.ELSE) { GetNext(); } if (!super.DoParsing()) { return false; } if (fCheckForNextSentence != null) { fCheckForNextSentence.Set(m_fCheckForNextSentence.ISSet()); } tok = GetCurrentToken(); if (tok.GetType() == CTokenType.DOT) { // end of IF statement m_nEndLine = tok.getLine(); return true; } else if (tok.GetKeyword() == CCobolKeywordList.END_IF) { m_nEndLine = tok.getLine(); StepNext(); } return true; }
protected void StepNext() { CBaseToken tok = super.GetNext(); while (tok != null && tok.IsWhiteSpace()) { tok = super.GetNext(); } }
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; }
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; }
/* (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; }
/* (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; } }