ast.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package ast
  2. import "kumachan/interpreter/lang/common/source"
  3. type Node struct {
  4. Location source.Location
  5. }
  6. func NodeFromLocation(loc source.Location) Node {
  7. return Node { Location: loc }
  8. }
  9. func IterateNodeRegistry(f func(interface{})) {
  10. for _, node := range nodeRegistry {
  11. f(node)
  12. }
  13. }
  14. var nodeRegistry = [...] interface{} {
  15. Root {},
  16. ReplRoot {},
  17. ReplAssign {},
  18. ReplRun {},
  19. ReplEval {},
  20. VariousStatement {},
  21. DeclEntry {},
  22. DeclType {},
  23. Identifier {},
  24. Doc {},
  25. RefBase {},
  26. VariousTypeDef {},
  27. NativeTypeDef {},
  28. Interface {},
  29. Method {},
  30. Record {},
  31. RecordDef {},
  32. Field {},
  33. Union {},
  34. VariousUnionItem {},
  35. UnionItemDefConst {},
  36. UnionConstDef {},
  37. UnionItemUseType {},
  38. DeclOperator {},
  39. OperatorSignature {},
  40. Inputs {},
  41. VariousBody {},
  42. NativeBody {},
  43. Block {},
  44. DeclMethod {},
  45. DeclConst {},
  46. DeclMessage {},
  47. VariousMsgExpr {},
  48. MsgExprPlain {},
  49. MsgExprSingularPlural {},
  50. Type {},
  51. Ref {},
  52. Expr {},
  53. Cast {},
  54. VariousTerm {},
  55. VariousPipe {},
  56. VariousPipeCall {},
  57. CallOrdered {},
  58. CallUnordered {},
  59. ArgumentMapping {},
  60. PipeUfcs {},
  61. PipeCast {},
  62. PipeGet {},
  63. PipeInterior {},
  64. InfixTerm {},
  65. Lambda {},
  66. If {},
  67. ElIf {},
  68. When {},
  69. Branch {},
  70. BranchPattern {},
  71. VariousPattern {},
  72. PatternSingle {},
  73. PatternMultiple {},
  74. VariousBinding {},
  75. BindingPlain {},
  76. BindingCps {},
  77. RefTerm {},
  78. CharLiteral {},
  79. IntegerLiteral {},
  80. FloatLiteral {},
  81. StringLiteral {},
  82. Text {},
  83. VariousStringPart {},
  84. StringPartContent {},
  85. }