public override void ExitTypePrimitive([NotNull] SBP.TypePrimitiveContext context) { this.PushType("ExitTypePrimitive", context.GetText(), context.Start); }
public override void ExitTypePrimitive([NotNull] SBP.TypePrimitiveContext context) { Type type = null; var arrRank = (context.ChildCount > 1) ? context.children[1].GetText().Where(c => c == '[').Count() : 0; if (arrRank == 0) { switch (context.Start.Type) { case SBP.BOOL: type = typeof(bool); break; case SBP.INT_: type = typeof(long); break; case SBP.INTEGER: type = typeof(long); break; case SBP.DECIMAL: type = typeof(double); break; case SBP.DOUBLE: type = typeof(double); break; case SBP.VERDICT: type = typeof(Verdict); break; case SBP.DATETIME: type = typeof(DateTime); break; case SBP.TIMESPAN: type = typeof(TimeSpan); break; case SBP.STRING: type = typeof(string); break; case SBP.OBJECT: type = typeof(object); break; default: throw new NotImplementedException(); } } else if (arrRank == 1) { switch (context.Start.Type) { case SBP.BOOL: type = typeof(List <bool>); break; case SBP.INT_: type = typeof(List <long>); break; case SBP.INTEGER: type = typeof(List <long>); break; case SBP.DECIMAL: type = typeof(List <double>); break; case SBP.DOUBLE: type = typeof(List <double>); break; case SBP.VERDICT: type = typeof(List <Verdict>); break; case SBP.DATETIME: type = typeof(List <DateTime>); break; case SBP.TIMESPAN: type = typeof(List <TimeSpan>); break; case SBP.STRING: type = typeof(List <string>); break; case SBP.OBJECT: type = typeof(List <object>); break; default: throw new NotImplementedException(); } } else if (arrRank == 2) { switch (context.Start.Type) { case SBP.BOOL: type = typeof(List <List <bool> >); break; case SBP.INT_: type = typeof(List <List <long> >); break; case SBP.INTEGER: type = typeof(List <List <long> >); break; case SBP.DECIMAL: type = typeof(List <List <double> >); break; case SBP.DOUBLE: type = typeof(List <List <double> >); break; case SBP.VERDICT: type = typeof(List <List <Verdict> >); break; case SBP.DATETIME: type = typeof(List <List <DateTime> >); break; case SBP.TIMESPAN: type = typeof(List <List <TimeSpan> >); break; case SBP.STRING: type = typeof(List <List <string> >); break; case SBP.OBJECT: type = typeof(List <List <object> >); break; default: throw new NotImplementedException(); } } m_typeStack.Push((TypeReference)type); }