2
0

apirequest.sm 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. %start MainMap::Startup
  2. %class ApiRequest
  3. %map MainMap
  4. %%
  5. Startup
  6. {
  7. ApiResponse
  8. ApiResponseStarted
  9. {
  10. }
  11. }
  12. ApiResponseStarted
  13. {
  14. ContentLength
  15. ContentPreStarted
  16. {
  17. }
  18. }
  19. ContentPreStarted
  20. {
  21. BlankLine
  22. ContentStarted
  23. {
  24. }
  25. }
  26. ContentStarted
  27. {
  28. ProcessLine(line)
  29. [ctxt.add_content(line) == True]
  30. Startup
  31. {
  32. setRequestFinished(); callbackDeferred(ctxt.getResponse());
  33. }
  34. ProcessLine(line)
  35. nil
  36. {
  37. // for some reason, have to add doNothing() here or
  38. // importing smc will fail. looks like smc bug.
  39. doNothing();
  40. }
  41. }
  42. Default
  43. {
  44. BlankLine
  45. nil
  46. {
  47. setRequestFinished();
  48. errbackDeferred("Protocol failure - was not expecting blank line");
  49. }
  50. ContentFinished
  51. nil
  52. {
  53. setRequestFinished();
  54. errbackDeferred("Protocol failure - was not expecting content to be finished");
  55. }
  56. ContentLength
  57. nil
  58. {
  59. setRequestFinished();
  60. errbackDeferred("Protocol failure - was not expecting content-length header");
  61. }
  62. ApiResponse
  63. nil
  64. {
  65. setRequestFinished();
  66. errbackDeferred("Protocol failure - was not expecting api response");
  67. }
  68. ProcessLine(line)
  69. nil
  70. {
  71. setRequestFinished();
  72. errbackDeferred("Protocol failure - was not expecting needing to process a line");
  73. }
  74. }
  75. %%