|
| 1 | +var ast = (function (exports) { |
| 2 | + 'use strict'; |
| 3 | + |
| 4 | + class Program { |
| 5 | + constructor(body) { |
| 6 | + this.body = body; |
| 7 | + } |
| 8 | + } |
| 9 | + |
| 10 | + class Type { |
| 11 | + constructor(name) { |
| 12 | + this.name = name; |
| 13 | + } |
| 14 | + } |
| 15 | + |
| 16 | + class Identifier { |
| 17 | + constructor(name) { |
| 18 | + this.name = name; |
| 19 | + } |
| 20 | + } |
| 21 | + |
| 22 | + class Literal { |
| 23 | + constructor(value, raw) { |
| 24 | + this.value = value; |
| 25 | + this.raw = raw; |
| 26 | + } |
| 27 | + } |
| 28 | + |
| 29 | + class VariableDeclaration { |
| 30 | + constructor(id, typeName) { |
| 31 | + Object.assign(this, { id, typeName }); |
| 32 | + } |
| 33 | + } |
| 34 | + |
| 35 | + class ArrayDeclaration { |
| 36 | + constructor(id, property, typeName) { |
| 37 | + Object.assign(this, { id, property, typeName }); |
| 38 | + } |
| 39 | + } |
| 40 | + |
| 41 | + class MemberExpression { |
| 42 | + constructor(object, property) { |
| 43 | + Object.assign(this, { object, property }); |
| 44 | + } |
| 45 | + } |
| 46 | + |
| 47 | + class CallExpression { |
| 48 | + constructor(callee, args, isStatement = false) { |
| 49 | + Object.assign(this, { callee, arguments: args, isStatement }); |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + class BinaryExpression { |
| 54 | + constructor(operator, left, right) { |
| 55 | + Object.assign(this, { operator, left, right }); |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + class UnaryExpression { |
| 60 | + constructor(operator, argument) { |
| 61 | + Object.assign(this, { operator, argument }); |
| 62 | + } |
| 63 | + } |
| 64 | + |
| 65 | + class AssignmentExpression { |
| 66 | + constructor(operator, left, right) { |
| 67 | + Object.assign(this, { operator, left, right }); |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + class LogicalExpression { |
| 72 | + constructor(operator, left, right) { |
| 73 | + Object.assign(this, { operator, left, right }); |
| 74 | + } |
| 75 | + } |
| 76 | + |
| 77 | + class InputStatement { |
| 78 | + constructor(id) { |
| 79 | + this.id = id; |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + class OutputStatement { |
| 84 | + constructor(args) { |
| 85 | + Object.assign(this, { arguments: args }); |
| 86 | + } |
| 87 | + } |
| 88 | + |
| 89 | + class CallStatement { |
| 90 | + constructor(argument) { |
| 91 | + Object.assign(this, { argument }); |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | + class ReturnStatement { |
| 96 | + constructor(argument) { |
| 97 | + Object.assign(this, { argument }); |
| 98 | + } |
| 99 | + } |
| 100 | + |
| 101 | + class IfStatement { |
| 102 | + constructor(test, consequent, alternative = null) { |
| 103 | + Object.assign(this, { test, consequent, alternative }); |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + class RepeatStatement { |
| 108 | + constructor(body, test) { |
| 109 | + Object.assign(this, { body, test }); |
| 110 | + } |
| 111 | + } |
| 112 | + |
| 113 | + class WhileStatement { |
| 114 | + constructor(test, body) { |
| 115 | + Object.assign(this, { body, test }); |
| 116 | + } |
| 117 | + } |
| 118 | + |
| 119 | + class ForStatement { |
| 120 | + constructor(id, start, stop, body, step = 1) { |
| 121 | + Object.assign(this, { id, start, stop, step, body }); |
| 122 | + } |
| 123 | + } |
| 124 | + |
| 125 | + class SwitchStatement { |
| 126 | + constructor(discriminant, cases) { |
| 127 | + Object.assign(this, { discriminant, cases }); |
| 128 | + } |
| 129 | + } |
| 130 | + |
| 131 | + class SwitchCase { |
| 132 | + constructor(test, consequent) { |
| 133 | + Object.assign(this, { test, consequent }); |
| 134 | + } |
| 135 | + } |
| 136 | + |
| 137 | + class FunctionDeclaration { |
| 138 | + constructor(id, params, body, procedure = false) { |
| 139 | + Object.assign(this, { id, params, body, procedure }); |
| 140 | + } |
| 141 | + } |
| 142 | + |
| 143 | + exports.Program = Program; |
| 144 | + exports.Type = Type; |
| 145 | + exports.Identifier = Identifier; |
| 146 | + exports.Literal = Literal; |
| 147 | + exports.VariableDeclaration = VariableDeclaration; |
| 148 | + exports.ArrayDeclaration = ArrayDeclaration; |
| 149 | + exports.MemberExpression = MemberExpression; |
| 150 | + exports.CallExpression = CallExpression; |
| 151 | + exports.BinaryExpression = BinaryExpression; |
| 152 | + exports.UnaryExpression = UnaryExpression; |
| 153 | + exports.AssignmentExpression = AssignmentExpression; |
| 154 | + exports.LogicalExpression = LogicalExpression; |
| 155 | + exports.InputStatement = InputStatement; |
| 156 | + exports.OutputStatement = OutputStatement; |
| 157 | + exports.CallStatement = CallStatement; |
| 158 | + exports.ReturnStatement = ReturnStatement; |
| 159 | + exports.IfStatement = IfStatement; |
| 160 | + exports.RepeatStatement = RepeatStatement; |
| 161 | + exports.WhileStatement = WhileStatement; |
| 162 | + exports.ForStatement = ForStatement; |
| 163 | + exports.SwitchStatement = SwitchStatement; |
| 164 | + exports.SwitchCase = SwitchCase; |
| 165 | + exports.FunctionDeclaration = FunctionDeclaration; |
| 166 | + |
| 167 | + return exports; |
| 168 | + |
| 169 | +}({})); |
0 commit comments