/parsing/d/basictypeunit.d

http://github.com/wilkie/djehuty · D · 77 lines · 50 code · 14 blank · 13 comment · 1 complexity · ee5f2e60829b79915d614a5c2fd12ea4 MD5 · raw file

  1. /*
  2. * typedeclarationunit.d
  3. *
  4. */
  5. module parsing.d.basictypeunit;
  6. import parsing.parseunit;
  7. import parsing.token;
  8. import parsing.d.tokens;
  9. import parsing.d.nodes;
  10. import parsing.d.staticunit;
  11. import parsing.d.declaratorunit;
  12. import djehuty;
  13. import io.console;
  14. class BasicTypeUnit : ParseUnit {
  15. override bool tokenFound(Token current) {
  16. switch (current.type) {
  17. case DToken.Bool:
  18. case DToken.Byte:
  19. case DToken.Ubyte:
  20. case DToken.Short:
  21. case DToken.Ushort:
  22. case DToken.Int:
  23. case DToken.Uint:
  24. case DToken.Long:
  25. case DToken.Ulong:
  26. case DToken.Char:
  27. case DToken.Wchar:
  28. case DToken.Dchar:
  29. case DToken.Float:
  30. case DToken.Double:
  31. case DToken.Real:
  32. case DToken.Ifloat:
  33. case DToken.Idouble:
  34. case DToken.Ireal:
  35. case DToken.Cfloat:
  36. case DToken.Cdouble:
  37. case DToken.Creal:
  38. case DToken.Void:
  39. // We have a basic type
  40. Console.putln("BasicType ");
  41. // Done.
  42. return false;
  43. case DToken.Identifier:
  44. // Named Type, could be a scoped list
  45. // TODO:
  46. break;
  47. // Scope Operator
  48. case DToken.Dot:
  49. // TODO:
  50. break;
  51. case DToken.Typeof:
  52. // TypeOfExpression
  53. // TODO: this
  54. break;
  55. default:
  56. // We will pass this off to a Declarator
  57. auto tree = expand!(DeclaratorUnit)();
  58. this.state = 1;
  59. break;
  60. }
  61. return true;
  62. }
  63. }