Assign.cs 946 B

123456789101112131415161718192021222324252627282930
  1. using System;
  2. using System.Xml.Linq;
  3. namespace csharp_sccd_compiler
  4. {
  5. public class Assign : SubAction
  6. {
  7. public LValue lvalue { get; private set; }
  8. public Expression expression { get; private set; }
  9. public Assign(XElement xml)
  10. {
  11. XAttribute ident_attribute = xml.Attribute("ident");
  12. if (ident_attribute == null)
  13. throw new ActionException("Missing \"ident\" attribute for assignment.");
  14. this.lvalue = new LValue(ident_attribute.Value.Trim());
  15. XAttribute expression_attribute = xml.Attribute("expr");
  16. if (expression_attribute == null)
  17. throw new ActionException("Missing \"expr\" attribute for assignment.");
  18. this.expression = new Expression(expression_attribute.Value.Trim());
  19. }
  20. public override void accept(Visitor visitor)
  21. {
  22. visitor.visit (this);
  23. }
  24. }
  25. }