private void UpdateParamCollection(SParamCollection sc) { if (sc.ParamReference is SParamNamed) { var sn = (SParamNamed)sc.ParamReference; sn.NamedReference = FindNamedSItem(sn.NamedRefString); } else if (sc.ParamReference is SParamCollection) { UpdateParamCollection((SParamCollection)sc.ParamReference); } }
private SParameter ProcessParameter() { SToken oneToken = SLexer.Tokenizer(_dataStream); bool isOptional = false; if (oneToken.TokenType == STokenType.OPTIONAL) { oneToken = SLexer.Tokenizer(_dataStream); isOptional = true; } bool isUnique = false; if (oneToken.TokenType == STokenType.UNIQUE) { isUnique = true; oneToken = SLexer.Tokenizer(_dataStream); } SParamType stype = SParameter.TokenTypeToAttribType(oneToken.TokenType); SParameter sParam; if (stype == SParamType.SET || stype == SParamType.LIST || stype == SParamType.ARRAY || stype == SParamType.BAG) { sParam = new SParamCollection(stype); var sParamCol = sParam as SParamCollection; // get leftbracket oneToken = SLexer.Tokenizer(_dataStream); // after adding lower bound, upper bound lexer oneToken = SLexer.Tokenizer(_dataStream); sParamCol.LBound = getBound(oneToken); // get colon oneToken = SLexer.Tokenizer(_dataStream); // get upper bound oneToken = SLexer.Tokenizer(_dataStream); sParamCol.UBound = getBound(oneToken); // get rightbracket oneToken = SLexer.Tokenizer(_dataStream); // get of oneToken = SLexer.Tokenizer(_dataStream); sParamCol.ParamReference = ProcessParameter(); } else if (stype == SParamType.NAMED) { sParam = new SParamNamed(oneToken.StringValue); } else { sParam = new SParameter(stype); } sParam.IsUnique = isUnique; sParam.IsOptional = isOptional; // either semi colon or left parenthesis //oneToken = SLexer.Tokenizer(DataStream); if (!(sParam is SParamCollection)) { oneToken = SLexer.Tokenizer(_dataStream); if (oneToken.TokenType == STokenType.LEFTPARENTHESIS) { oneToken = SLexer.Tokenizer(_dataStream); // integer // add integer sParam.TypeLength = (short)oneToken.IntegerValue; oneToken = SLexer.Tokenizer(_dataStream); // right parenthesis oneToken = SLexer.Tokenizer(_dataStream); if (oneToken.TokenType == STokenType.FIXED) { // process fixed sParam.IsFixed = true; // semicolon oneToken = SLexer.Tokenizer(_dataStream); } } } //SAttribute oneAttribute = new SAttribute(AttributeName, sParam); return sParam; }
private SParameter ProcessInverseParameter() { SToken oneToken = SLexer.Tokenizer(_dataStream); bool isOptional = false; if (oneToken.TokenType == STokenType.OPTIONAL) { oneToken = SLexer.Tokenizer(_dataStream); isOptional = true; } bool isUnique = false; if (oneToken.TokenType == STokenType.UNIQUE) { isUnique = true; oneToken = SLexer.Tokenizer(_dataStream); } SParamType stype = SParameter.TokenTypeToAttribType(oneToken.TokenType); SParameter sParam; if (stype == SParamType.SET || stype == SParamType.LIST || stype == SParamType.ARRAY || stype == SParamType.BAG) { sParam = new SParamCollection(stype); var sParamCol = sParam as SParamCollection; // get leftbracket oneToken = SLexer.Tokenizer(_dataStream); // after adding lower bound, upper bound lexer oneToken = SLexer.Tokenizer(_dataStream); sParamCol.LBound = getBound(oneToken); // get colon oneToken = SLexer.Tokenizer(_dataStream); // get upper bound oneToken = SLexer.Tokenizer(_dataStream); sParamCol.UBound = getBound(oneToken); // get rightbracket oneToken = SLexer.Tokenizer(_dataStream); // get of oneToken = SLexer.Tokenizer(_dataStream); sParamCol.ParamReference = ProcessInverseParameter(); } else if (stype == SParamType.NAMED) { sParam = new SParamNamed(oneToken.StringValue); } else { sParam = new SParameter(stype); } sParam.IsUnique = isUnique; sParam.IsOptional = isOptional; // either semi colon or left parenthesis //oneToken = SLexer.Tokenizer(DataStream); //if (!(sParam is SParamCollection)) //{ // oneToken = SLexer.Tokenizer(_dataStream); // if (oneToken.TokenType == STokenType.LEFTPARENTHESIS) // { // oneToken = SLexer.Tokenizer(_dataStream); // integer // // add integer // sParam.TypeLength = (short)oneToken.IntegerValue; // oneToken = SLexer.Tokenizer(_dataStream); // right parenthesis // oneToken = SLexer.Tokenizer(_dataStream); // if (oneToken.TokenType == STokenType.FIXED) // { // // process fixed // sParam.IsFixed = true; // // semicolon // oneToken = SLexer.Tokenizer(_dataStream); // } // } //} //SAttribute oneAttribute = new SAttribute(AttributeName, sParam); return(sParam); }
private void UpdateParamCollection(SParamCollection sc) { if (sc.ParamReference is SParamNamed) { var sn = (SParamNamed)sc.ParamReference; sn.NamedReference = FindNamedSItem (sn.NamedRefString); } else if (sc.ParamReference is SParamCollection) { UpdateParamCollection ((SParamCollection)sc.ParamReference); } }