Exemple #1
0
		private void Factor(out Expr e) {
			RARef r1, r2;
			Sheet s1 = null;
			double d;
			bool sheetError = false;
			e = null;
			switch (la.kind) {
				case 1: {
					Application(out e);
					break;
				}
				case 4:
				case 5:
				case 6:
				case 7:
				case 8:
				case 9:
				case 10:
				case 11:
				case 12:
				case 13:
				case 14: {
					if (StartOf(2)) {}
					else {
						Get();
						s1 = workbook[t.val.Substring(0, t.val.Length - 1)];
						if (s1 == null) {
							sheetError = true;
						}
					}
					Raref(out r1);
					if (StartOf(3)) {
						if (sheetError) {
							e = new Error(ErrorValue.refError);
						}
						else {
							e = new CellRef(s1, r1);
						}
					}
					else if (la.kind == 26) {
						Get();
						Raref(out r2);
						if (sheetError) {
							e = new Error(ErrorValue.refError);
						}
						else {
							e = new CellArea(s1, r1, r2);
						}
					}
					else {
						SynErr(37);
					}
					break;
				}
				case 2: {
					Number(out d);
					e = new NumberConst(d);
					break;
				}
				case 18: {
					Get();
					Factor(out e);
					if (e is NumberConst) {
						e = new NumberConst(-((NumberConst)e).value.value);
					}
					else {
						e = FunCall.Make("NEG", new Expr[] {e});
					}

					break;
				}
				case 15: {
					Get();
					e = new TextConst(t.val.Substring(1, t.val.Length - 2));
					break;
				}
				case 27: {
					Get();
					Expr(out e);
					Expect(28);
					break;
				}
				default:
					SynErr(38);
					break;
			}
		}
		public void CallVisitor(TextConst textConst) { result = new CGTextConst(textConst.value); }