/parsing/d/interfacedeclunit.d

http://github.com/wilkie/djehuty · D · 85 lines · 45 code · 16 blank · 24 comment · 9 complexity · 4bd4b48fafc67093a4216e489662cdf9 MD5 · raw file

  1. /*
  2. * expressionunit.d
  3. *
  4. * This module parses expressions.
  5. *
  6. */
  7. module parsing.d.interfacedeclunit;
  8. import parsing.parseunit;
  9. import parsing.token;
  10. import parsing.d.tokens;
  11. import parsing.d.nodes;
  12. import parsing.d.declarationunit;
  13. import parsing.d.interfacebodyunit;
  14. import io.console;
  15. import djehuty;
  16. class InterfaceDeclUnit : ParseUnit {
  17. override bool tokenFound(Token current) {
  18. switch (current.type) {
  19. // The start of the body
  20. case DToken.LeftCurly:
  21. auto tree = expand!(InterfaceBodyUnit)();
  22. // Done.
  23. return false;
  24. // Look for a template parameter list
  25. case DToken.LeftParen:
  26. if (cur_string == "") {
  27. // Error: No name?
  28. // TODO:
  29. }
  30. if (this.state >= 1) {
  31. // Error: Already have base class list or template parameters
  32. // TODO:
  33. }
  34. this.state = 1;
  35. // TODO: expand out parameter list
  36. break;
  37. // Look for inherited classes
  38. case DToken.Colon:
  39. if (cur_string == "") {
  40. // Error: No name?
  41. // TODO:
  42. }
  43. if (this.state >= 2) {
  44. // Error: Already have base class list
  45. // TODO:
  46. }
  47. this.state = 2;
  48. // TODO: expand out base class list
  49. break;
  50. // Name
  51. case DToken.Identifier:
  52. if (cur_string != "") {
  53. // Error: Two names?
  54. // TODO:
  55. }
  56. cur_string = current.value.toString();
  57. Console.putln("Interface: ", current.value);
  58. break;
  59. default:
  60. // Error: Unrecognized foo.
  61. break;
  62. }
  63. return true;
  64. }
  65. protected:
  66. string cur_string = "";
  67. static const string _common_error_msg = "";
  68. static const string[] _common_error_usages = null;
  69. }