public void Visit(AsmRegisterExpression x) { }
public AbstractType Visit(AsmRegisterExpression x) { // TODO return(null); }
IExpression ParseAsmPrimaryExpression(IBlockNode Scope, IStatement Parent) { switch (laKind) { case OpenSquareBracket: Step(); var e = new PostfixExpression_Index() { EndLocation = t.EndLocation }; e.Arguments = new IExpression[] { ParseAsmExpression(Scope, Parent) }; Expect(CloseSquareBracket); return e; case Dollar: var ins = Parent as AsmStatement.InstructionStatement; if (ins == null || (!ins.IsJmpFamily && ins.Operation != AsmStatement.InstructionStatement.OpCode.call)) SynErr(Dollar, "The $ operator is only valid on jmp and call instructions!"); Step(); return new TokenExpression(t.Kind) { Location = t.Location, EndLocation = t.EndLocation }; case Literal: Step(); return new IdentifierExpression(t.LiteralValue, t.LiteralFormat, t.Subformat) { Location = t.Location, EndLocation = t.EndLocation }; // AsmTypePrefix case DTokens.Byte: case DTokens.Short: case DTokens.Int: case DTokens.Float: case DTokens.Double: case DTokens.Real: case __LOCAL_SIZE: Step (); return new TokenExpression(t.Kind) { Location = t.Location, EndLocation = t.EndLocation }; case Identifier: Step(); if (AsmRegisterExpression.IsRegister(t.Value)) { string reg = t.Value; if (reg == "ST" && laKind == OpenParenthesis) { reg += "("; Step(); Expect(Literal); reg += t.LiteralValue.ToString(); if (laKind != CloseParenthesis) SynErr(CloseParenthesis); else Step(); reg += ")"; } switch (reg) { case "ES": case "CS": case "SS": case "DS": case "GS": case "FS": if (laKind == Colon) { var ex = new AsmRegisterExpression() { Location = t.Location, EndLocation = t.EndLocation, Register = string.Intern(reg) }; Step(); // NOTE: DMD actually allows you to not have an expression after a // segment specifier, however I consider this a bug, and, as // such, am making an expression in that form fail to parse. return new UnaryExpression_SegmentBase() { RegisterExpression = ex, UnaryExpression = ParseAsmExpression(Scope, Parent) }; } break; } return new AsmRegisterExpression() { Location = t.Location, EndLocation = t.EndLocation, Register = string.Intern(reg) }; } else { IExpression outer = new IdentifierExpression(t.Value) { Location = t.Location, EndLocation = t.EndLocation }; while (laKind == Dot) { Step(); if (laKind != Identifier) SynErr(Identifier); outer = new PostfixExpression_Access() { AccessExpression = new IdentifierExpression(la.Value), PostfixForeExpression = outer }; Step(); } return outer; } default: SynErr(Identifier, "Expected a $, literal or an identifier!"); Step(); if (IsEOF) return new TokenExpression(Incomplete); return null; } }
public ISymbolValue Visit(AsmRegisterExpression x) { EvalError(x, "Cannot evaluate inline assembly."); return(null); }