/parsing/d/switchstmtunit.d

http://github.com/wilkie/djehuty · D · 61 lines · 41 code · 11 blank · 9 comment · 9 complexity · 05189bd7a6538d9c35cdd130c8d8b4d1 MD5 · raw file

  1. /*
  2. * expressionunit.d
  3. *
  4. * This module parses expressions.
  5. *
  6. */
  7. module parsing.d.switchstmtunit;
  8. import parsing.parseunit;
  9. import parsing.token;
  10. import parsing.d.tokens;
  11. import parsing.d.nodes;
  12. import parsing.d.expressionunit;
  13. import parsing.d.blockstmtunit;
  14. import io.console;
  15. import djehuty;
  16. class SwitchStmtUnit : ParseUnit {
  17. override bool tokenFound(Token current) {
  18. switch (current.type) {
  19. case DToken.LeftParen:
  20. if (this.state != 0) {
  21. }
  22. Console.putln("Switch:");
  23. auto tree = expand!(ExpressionUnit)();
  24. this.state = 1;
  25. break;
  26. case DToken.RightParen:
  27. if (this.state != 1) {
  28. }
  29. this.state = 2;
  30. break;
  31. case DToken.LeftCurly:
  32. if (this.state == 0) {
  33. }
  34. if (this.state == 1) {
  35. }
  36. auto tree = expand!(BlockStmtUnit)();
  37. // Done.
  38. return false;
  39. default:
  40. // Error
  41. // TODO:
  42. break;
  43. }
  44. return true;
  45. }
  46. protected:
  47. string cur_string = "";
  48. static const string _common_error_msg = "";
  49. static const string[] _common_error_usages = null;
  50. }