Parser.js 81 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215
  1. smalltalk.addClass('PPParser', smalltalk.Object, ['memo'], 'Parser');
  2. smalltalk.addMethod(
  3. '_initialize',
  4. smalltalk.method({
  5. selector: 'initialize',
  6. category: 'initialization',
  7. fn: function (){
  8. var self=this;
  9. self['@memo']=smalltalk.send(smalltalk.Dictionary, "_new", []);
  10. return self;},
  11. source: unescape('initialize%0A%09memo%20%3A%3D%20Dictionary%20new%0A')}),
  12. smalltalk.PPParser);
  13. smalltalk.addMethod(
  14. '_memo',
  15. smalltalk.method({
  16. selector: 'memo',
  17. category: 'accessing',
  18. fn: function (){
  19. var self=this;
  20. return self['@memo'];
  21. return self;},
  22. source: unescape('memo%0A%09%5Ememo%0A')}),
  23. smalltalk.PPParser);
  24. smalltalk.addMethod(
  25. '_onFailure_',
  26. smalltalk.method({
  27. selector: 'onFailure:',
  28. category: 'error handling',
  29. fn: function (aBlock){
  30. var self=this;
  31. return smalltalk.send(smalltalk.PPFailureActionParser, "_on_block_", [self, aBlock]);
  32. return self;},
  33. source: unescape('onFailure%3A%20aBlock%0A%09%5EPPFailureActionParser%20on%3A%20self%20block%3A%20aBlock%0A')}),
  34. smalltalk.PPParser);
  35. smalltalk.addMethod(
  36. '_flatten',
  37. smalltalk.method({
  38. selector: 'flatten',
  39. category: 'operations',
  40. fn: function (){
  41. var self=this;
  42. return smalltalk.send(smalltalk.PPFlattenParser, "_on_", [self]);
  43. return self;},
  44. source: unescape('flatten%0A%09%5EPPFlattenParser%20on%3A%20self%0A')}),
  45. smalltalk.PPParser);
  46. smalltalk.addMethod(
  47. '_withSource',
  48. smalltalk.method({
  49. selector: 'withSource',
  50. category: 'operations',
  51. fn: function (){
  52. var self=this;
  53. return smalltalk.send(smalltalk.PPSourceParser, "_on_", [self]);
  54. return self;},
  55. source: unescape('withSource%0A%09%5EPPSourceParser%20on%3A%20self%0A')}),
  56. smalltalk.PPParser);
  57. smalltalk.addMethod(
  58. '__eq_eq_gt',
  59. smalltalk.method({
  60. selector: '==>',
  61. category: 'operations',
  62. fn: function (aBlock){
  63. var self=this;
  64. return smalltalk.send(smalltalk.PPActionParser, "_on_block_", [self, aBlock]);
  65. return self;},
  66. source: unescape('%3D%3D%3E%20aBlock%0A%09%5EPPActionParser%20on%3A%20self%20block%3A%20aBlock%0A')}),
  67. smalltalk.PPParser);
  68. smalltalk.addMethod(
  69. '__comma',
  70. smalltalk.method({
  71. selector: ',',
  72. category: 'operations',
  73. fn: function (aParser){
  74. var self=this;
  75. return smalltalk.send(smalltalk.PPSequenceParser, "_with_with_", [self, aParser]);
  76. return self;},
  77. source: unescape('%2C%20aParser%0A%09%5EPPSequenceParser%20with%3A%20self%20with%3A%20aParser%0A')}),
  78. smalltalk.PPParser);
  79. smalltalk.addMethod(
  80. '__slash',
  81. smalltalk.method({
  82. selector: '/',
  83. category: 'operations',
  84. fn: function (aParser){
  85. var self=this;
  86. return smalltalk.send(smalltalk.PPChoiceParser, "_with_with_", [self, aParser]);
  87. return self;},
  88. source: unescape('/%20aParser%0A%09%5EPPChoiceParser%20with%3A%20self%20with%3A%20aParser%0A')}),
  89. smalltalk.PPParser);
  90. smalltalk.addMethod(
  91. '_plus',
  92. smalltalk.method({
  93. selector: 'plus',
  94. category: 'operations',
  95. fn: function (){
  96. var self=this;
  97. return smalltalk.send(smalltalk.PPRepeatingParser, "_on_min_", [self, (1)]);
  98. return self;},
  99. source: unescape('plus%0A%09%5EPPRepeatingParser%20on%3A%20self%20min%3A%201%0A')}),
  100. smalltalk.PPParser);
  101. smalltalk.addMethod(
  102. '_star',
  103. smalltalk.method({
  104. selector: 'star',
  105. category: 'operations',
  106. fn: function (){
  107. var self=this;
  108. return smalltalk.send(smalltalk.PPRepeatingParser, "_on_min_", [self, (0)]);
  109. return self;},
  110. source: unescape('star%0A%09%5EPPRepeatingParser%20on%3A%20self%20min%3A%200%0A')}),
  111. smalltalk.PPParser);
  112. smalltalk.addMethod(
  113. '_not',
  114. smalltalk.method({
  115. selector: 'not',
  116. category: 'operations',
  117. fn: function (){
  118. var self=this;
  119. return smalltalk.send(smalltalk.PPNotParser, "_on_", [self]);
  120. return self;},
  121. source: unescape('not%0A%09%5EPPNotParser%20on%3A%20self%0A')}),
  122. smalltalk.PPParser);
  123. smalltalk.addMethod(
  124. '_optional',
  125. smalltalk.method({
  126. selector: 'optional',
  127. category: 'operations',
  128. fn: function (){
  129. var self=this;
  130. return smalltalk.send(self, "__slash", [smalltalk.send(smalltalk.PPEpsilonParser, "_new", [])]);
  131. return self;},
  132. source: unescape('optional%0A%09%5Eself%20/%20PPEpsilonParser%20new%0A')}),
  133. smalltalk.PPParser);
  134. smalltalk.addMethod(
  135. '_memoizedParse_',
  136. smalltalk.method({
  137. selector: 'memoizedParse:',
  138. category: 'operations',
  139. fn: function (aStream){
  140. var self=this;
  141. var start=nil;
  142. var end=nil;
  143. var node=nil;
  144. start=smalltalk.send(aStream, "_position", []);
  145. return smalltalk.send(smalltalk.send(self, "_memo", []), "_at_ifPresent_ifAbsent_", [start, (function(value){smalltalk.send(aStream, "_position_", [smalltalk.send(smalltalk.send(smalltalk.send(self, "_memo", []), "_at_", [start]), "_second", [])]);return smalltalk.send(value, "_first", []);}), (function(){node=smalltalk.send(self, "_parse_", [aStream]);end=smalltalk.send(aStream, "_position", []);smalltalk.send(smalltalk.send(self, "_memo", []), "_at_put_", [start, smalltalk.send(smalltalk.Array, "_with_with_", [node, end])]);return node;})]);
  146. return self;},
  147. source: unescape('memoizedParse%3A%20aStream%0A%09%7C%20start%20end%20node%20%7C%0A%09start%20%3A%3D%20aStream%20position.%0A%09%5Eself%20memo%20at%3A%20start%20%0A%09%20%20%20%20ifPresent%3A%20%5B%3Avalue%20%7C%0A%09%09aStream%20position%3A%20%28self%20memo%20at%3A%20start%29%20second.%0A%09%09value%20first%5D%0A%09%20%20%20%20ifAbsent%3A%20%5B%0A%09%09node%20%3A%3D%20self%20parse%3A%20aStream.%0A%09%09end%20%3A%3D%20aStream%20position.%0A%09%09self%20memo%20at%3A%20start%20put%3A%20%28Array%20with%3A%20node%20with%3A%20end%29.%0A%09%09node%5D%0A')}),
  148. smalltalk.PPParser);
  149. smalltalk.addMethod(
  150. '_parse_',
  151. smalltalk.method({
  152. selector: 'parse:',
  153. category: 'parsing',
  154. fn: function (aStream){
  155. var self=this;
  156. smalltalk.send(self, "_subclassResponsibility", []);
  157. return self;},
  158. source: unescape('parse%3A%20aStream%0A%09self%20subclassResponsibility%0A')}),
  159. smalltalk.PPParser);
  160. smalltalk.addMethod(
  161. '_parseAll_',
  162. smalltalk.method({
  163. selector: 'parseAll:',
  164. category: 'parsing',
  165. fn: function (aStream){
  166. var self=this;
  167. var result=nil;
  168. result=smalltalk.send(smalltalk.send(smalltalk.PPSequenceParser, "_with_with_", [self, smalltalk.send(smalltalk.PPEOFParser, "_new", [])]), "_memoizedParse_", [aStream]);
  169. return smalltalk.send(smalltalk.send(result, "_isParseFailure", []), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(self, "_error_", [smalltalk.send(result, "_messageFor_", [smalltalk.send(aStream, "_contents", [])])]);}), (function(){return smalltalk.send(result, "_first", []);})]);
  170. return self;},
  171. source: unescape('parseAll%3A%20aStream%0A%09%7C%20result%20%7C%0A%09result%20%3A%3D%20%28PPSequenceParser%20with%3A%20self%20with%3A%20PPEOFParser%20new%29%20memoizedParse%3A%20aStream.%0A%09%5Eresult%20isParseFailure%20%0A%09%20%20%20%20ifTrue%3A%20%5Bself%20error%3A%20%28result%20messageFor%3A%20aStream%20contents%29%5D%0A%09%20%20%20%20ifFalse%3A%20%5Bresult%20first%5D%0A')}),
  172. smalltalk.PPParser);
  173. smalltalk.addClass('PPEOFParser', smalltalk.PPParser, [], 'Parser');
  174. smalltalk.addMethod(
  175. '_parse_',
  176. smalltalk.method({
  177. selector: 'parse:',
  178. category: 'parsing',
  179. fn: function (aStream){
  180. var self=this;
  181. return smalltalk.send(smalltalk.send(aStream, "_atEnd", []), "_ifFalse_ifTrue_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.PPFailure, "_new", []), "_reason_at_", ["EOF expected", smalltalk.send(aStream, "_position", [])]);}), (function(){return nil;})]);
  182. return self;},
  183. source: unescape('parse%3A%20aStream%0A%09%5EaStream%20atEnd%20%0A%09%20%20%20%20ifFalse%3A%20%5B%0A%09%09PPFailure%20new%20reason%3A%20%27EOF%20expected%27%20at%3A%20aStream%20position%5D%0A%09%20%20%20%20ifTrue%3A%20%5Bnil%5D%0A')}),
  184. smalltalk.PPEOFParser);
  185. smalltalk.addClass('PPAnyParser', smalltalk.PPParser, [], 'Parser');
  186. smalltalk.addMethod(
  187. '_parse_',
  188. smalltalk.method({
  189. selector: 'parse:',
  190. category: 'parsing',
  191. fn: function (aStream){
  192. var self=this;
  193. return smalltalk.send(smalltalk.send(aStream, "_atEnd", []), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.PPFailure, "_new", []), "_reason_at_", ["did not expect EOF", smalltalk.send(aStream, "_position", [])]);}), (function(){return smalltalk.send(aStream, "_next", []);})]);
  194. return self;},
  195. source: unescape('parse%3A%20aStream%0A%09%5EaStream%20atEnd%0A%09%20%20%20%20ifTrue%3A%20%5BPPFailure%20new%0A%09%09%09%20reason%3A%20%27did%20not%20expect%20EOF%27%20at%3A%20aStream%20position%5D%0A%09%20%20%20%20ifFalse%3A%20%5BaStream%20next%5D%0A')}),
  196. smalltalk.PPAnyParser);
  197. smalltalk.addClass('PPEpsilonParser', smalltalk.PPParser, [], 'Parser');
  198. smalltalk.addMethod(
  199. '_parse_',
  200. smalltalk.method({
  201. selector: 'parse:',
  202. category: 'parsing',
  203. fn: function (aStream){
  204. var self=this;
  205. return nil;
  206. return self;},
  207. source: unescape('parse%3A%20aStream%0A%09%5Enil%0A')}),
  208. smalltalk.PPEpsilonParser);
  209. smalltalk.addClass('PPStringParser', smalltalk.PPParser, ['string'], 'Parser');
  210. smalltalk.addMethod(
  211. '_string',
  212. smalltalk.method({
  213. selector: 'string',
  214. category: 'accessing',
  215. fn: function (){
  216. var self=this;
  217. return self['@string'];
  218. return self;},
  219. source: unescape('string%0A%09%5Estring%0A')}),
  220. smalltalk.PPStringParser);
  221. smalltalk.addMethod(
  222. '_string_',
  223. smalltalk.method({
  224. selector: 'string:',
  225. category: 'accessing',
  226. fn: function (aString){
  227. var self=this;
  228. self['@string']=aString;
  229. return self;},
  230. source: unescape('string%3A%20aString%0A%09string%20%3A%3D%20aString%0A')}),
  231. smalltalk.PPStringParser);
  232. smalltalk.addMethod(
  233. '_parse_',
  234. smalltalk.method({
  235. selector: 'parse:',
  236. category: 'parsing',
  237. fn: function (aStream){
  238. var self=this;
  239. var position=nil;
  240. var result=nil;
  241. position=smalltalk.send(aStream, "_position", []);
  242. result=smalltalk.send(aStream, "_next_", [smalltalk.send(smalltalk.send(self, "_string", []), "_size", [])]);
  243. return smalltalk.send(smalltalk.send(result, "__eq", [smalltalk.send(self, "_string", [])]), "_ifTrue_ifFalse_", [(function(){return result;}), (function(){smalltalk.send(aStream, "_position_", [position]);return (function($rec){smalltalk.send($rec, "_reason_", [smalltalk.send(smalltalk.send(smalltalk.send("Expected ", "__comma", [smalltalk.send(self, "_string", [])]), "__comma", [" but got "]), "__comma", [smalltalk.send(smalltalk.send(result, "_at_", [position]), "_printString", [])])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(smalltalk.PPFailure, "_new", []));})]);
  244. return self;},
  245. source: unescape('parse%3A%20aStream%0A%09%7C%20position%20result%20%7C%0A%09position%20%3A%3D%20aStream%20position.%0A%09result%20%3A%3D%20aStream%20next%3A%20self%20string%20size.%0A%09%5Eresult%20%3D%20self%20string%0A%09%20%20%20%20ifTrue%3A%20%5Bresult%5D%0A%09%20%20%20%20ifFalse%3A%20%5B%0A%09%09aStream%20position%3A%20position.%0A%09%09PPFailure%20new%20reason%3A%20%27Expected%20%27%2C%20self%20string%2C%20%27%20but%20got%20%27%2C%20%28result%20at%3A%20position%29%20printString%3B%20yourself%5D%0A')}),
  246. smalltalk.PPStringParser);
  247. smalltalk.addClass('PPCharacterParser', smalltalk.PPParser, ['regexp'], 'Parser');
  248. smalltalk.addMethod(
  249. '_string_',
  250. smalltalk.method({
  251. selector: 'string:',
  252. category: 'accessing',
  253. fn: function (aString){
  254. var self=this;
  255. self['@regexp']=smalltalk.send(smalltalk.RegularExpression, "_fromString_", [smalltalk.send(smalltalk.send(unescape("%5B"), "__comma", [aString]), "__comma", [unescape("%5D")])]);
  256. return self;},
  257. source: unescape('string%3A%20aString%0A%09regexp%20%3A%3D%20RegularExpression%20fromString%3A%20%27%5B%27%2C%20aString%2C%20%27%5D%27%0A')}),
  258. smalltalk.PPCharacterParser);
  259. smalltalk.addMethod(
  260. '_parse_',
  261. smalltalk.method({
  262. selector: 'parse:',
  263. category: 'parsing',
  264. fn: function (aStream){
  265. var self=this;
  266. return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aStream, "_peek", []), "_notNil", []), "_and_", [(function(){return smalltalk.send(self, "_match_", [smalltalk.send(aStream, "_peek", [])]);})]), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(aStream, "_next", []);}), (function(){return smalltalk.send(smalltalk.send(smalltalk.PPFailure, "_new", []), "_reason_at_", ["Could not match", smalltalk.send(aStream, "_position", [])]);})]);
  267. return self;},
  268. source: unescape('parse%3A%20aStream%0A%09%5E%28aStream%20peek%20notNil%20and%3A%20%5Bself%20match%3A%20aStream%20peek%5D%29%0A%09%20%20%20%20ifTrue%3A%20%5BaStream%20next%5D%0A%09%20%20%20%20ifFalse%3A%20%5BPPFailure%20new%20reason%3A%20%27Could%20not%20match%27%20at%3A%20aStream%20position%5D%0A')}),
  269. smalltalk.PPCharacterParser);
  270. smalltalk.addMethod(
  271. '_match_',
  272. smalltalk.method({
  273. selector: 'match:',
  274. category: 'private',
  275. fn: function (aString){
  276. var self=this;
  277. return smalltalk.send(aString, "_match_", [self['@regexp']]);
  278. return self;},
  279. source: unescape('match%3A%20aString%0A%09%5EaString%20match%3A%20regexp%0A')}),
  280. smalltalk.PPCharacterParser);
  281. smalltalk.addClass('PPListParser', smalltalk.PPParser, ['parsers'], 'Parser');
  282. smalltalk.addMethod(
  283. '_parsers',
  284. smalltalk.method({
  285. selector: 'parsers',
  286. category: 'accessing',
  287. fn: function (){
  288. var self=this;
  289. return smalltalk.send(self['@parsers'], "_ifNil_", [(function(){return [];})]);
  290. return self;},
  291. source: unescape('parsers%0A%09%5Eparsers%20ifNil%3A%20%5B%23%28%29%5D%0A')}),
  292. smalltalk.PPListParser);
  293. smalltalk.addMethod(
  294. '_parsers_',
  295. smalltalk.method({
  296. selector: 'parsers:',
  297. category: 'accessing',
  298. fn: function (aCollection){
  299. var self=this;
  300. self['@parsers']=aCollection;
  301. return self;},
  302. source: unescape('parsers%3A%20aCollection%0A%09parsers%20%3A%3D%20aCollection%0A')}),
  303. smalltalk.PPListParser);
  304. smalltalk.addMethod(
  305. '_copyWith_',
  306. smalltalk.method({
  307. selector: 'copyWith:',
  308. category: 'copying',
  309. fn: function (aParser){
  310. var self=this;
  311. return smalltalk.send(smalltalk.send(self, "_class", []), "_withAll_", [smalltalk.send(smalltalk.send(self, "_parsers", []), "_copyWith_", [aParser])]);
  312. return self;},
  313. source: unescape('copyWith%3A%20aParser%0A%09%5Eself%20class%20withAll%3A%20%28self%20parsers%20copyWith%3A%20aParser%29%0A')}),
  314. smalltalk.PPListParser);
  315. smalltalk.addMethod(
  316. '_withAll_',
  317. smalltalk.method({
  318. selector: 'withAll:',
  319. category: 'instance creation',
  320. fn: function (aCollection){
  321. var self=this;
  322. return (function($rec){smalltalk.send($rec, "_parsers_", [aCollection]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  323. return self;},
  324. source: unescape('withAll%3A%20aCollection%0A%09%20%20%20%20%5Eself%20new%0A%09%09parsers%3A%20aCollection%3B%0A%09%09yourself%0A')}),
  325. smalltalk.PPListParser.klass);
  326. smalltalk.addMethod(
  327. '_with_with_',
  328. smalltalk.method({
  329. selector: 'with:with:',
  330. category: 'instance creation',
  331. fn: function (aParser, anotherParser){
  332. var self=this;
  333. return smalltalk.send(self, "_withAll_", [smalltalk.send(smalltalk.Array, "_with_with_", [aParser, anotherParser])]);
  334. return self;},
  335. source: unescape('with%3A%20aParser%20with%3A%20anotherParser%0A%09%20%20%20%20%5Eself%20withAll%3A%20%28Array%20with%3A%20aParser%20with%3A%20anotherParser%29%0A')}),
  336. smalltalk.PPListParser.klass);
  337. smalltalk.addClass('PPSequenceParser', smalltalk.PPListParser, [], 'Parser');
  338. smalltalk.addMethod(
  339. '__comma',
  340. smalltalk.method({
  341. selector: ',',
  342. category: 'copying',
  343. fn: function (aRule){
  344. var self=this;
  345. return smalltalk.send(self, "_copyWith_", [aRule]);
  346. return self;},
  347. source: unescape('%2C%20aRule%0A%09%5Eself%20copyWith%3A%20aRule%0A')}),
  348. smalltalk.PPSequenceParser);
  349. smalltalk.addMethod(
  350. '_parse_',
  351. smalltalk.method({
  352. selector: 'parse:',
  353. category: 'parsing',
  354. fn: function (aStream){
  355. var self=this;
  356. var start=nil;
  357. var elements=nil;
  358. var element=nil;
  359. start=smalltalk.send(aStream, "_position", []);
  360. elements=[];
  361. smalltalk.send(smalltalk.send(self, "_parsers", []), "_detect_ifNone_", [(function(each){element=smalltalk.send(each, "_memoizedParse_", [aStream]);smalltalk.send(elements, "_add_", [element]);return smalltalk.send(element, "_isParseFailure", []);}), (function(){return nil;})]);
  362. return smalltalk.send(smalltalk.send(element, "_isParseFailure", []), "_ifFalse_ifTrue_", [(function(){return elements;}), (function(){smalltalk.send(aStream, "_position_", [start]);return element;})]);
  363. return self;},
  364. source: unescape('parse%3A%20aStream%0A%09%7C%20start%20elements%20element%20%7C%0A%09start%20%3A%3D%20aStream%20position.%0A%09elements%20%3A%3D%20%23%28%29.%0A%09self%20parsers%20%0A%09%20%20%20%20detect%3A%20%5B%3Aeach%20%7C%0A%09%09element%20%3A%3D%20each%20memoizedParse%3A%20aStream.%0A%09%09elements%20add%3A%20element.%0A%09%09element%20isParseFailure%5D%20%0A%09%20%20%20%20ifNone%3A%20%5B%5D.%0A%09%5Eelement%20isParseFailure%0A%09%20%20%20%20ifFalse%3A%20%5Belements%5D%0A%09%20%20%20%20ifTrue%3A%20%5BaStream%20position%3A%20start.%20element%5D%0A')}),
  365. smalltalk.PPSequenceParser);
  366. smalltalk.addClass('PPChoiceParser', smalltalk.PPListParser, [], 'Parser');
  367. smalltalk.addMethod(
  368. '__slash',
  369. smalltalk.method({
  370. selector: '/',
  371. category: 'copying',
  372. fn: function (aRule){
  373. var self=this;
  374. return smalltalk.send(self, "_copyWith_", [aRule]);
  375. return self;},
  376. source: unescape('/%20aRule%0A%09%5Eself%20copyWith%3A%20aRule%0A')}),
  377. smalltalk.PPChoiceParser);
  378. smalltalk.addMethod(
  379. '_parse_',
  380. smalltalk.method({
  381. selector: 'parse:',
  382. category: 'parsing',
  383. fn: function (aStream){
  384. var self=this;
  385. var result=nil;
  386. smalltalk.send(smalltalk.send(self, "_parsers", []), "_detect_ifNone_", [(function(each){result=smalltalk.send(each, "_memoizedParse_", [aStream]);return smalltalk.send(smalltalk.send(result, "_isParseFailure", []), "_not", []);}), (function(){return nil;})]);
  387. return result;
  388. return self;},
  389. source: unescape('parse%3A%20aStream%0A%09%7C%20result%20%7C%0A%09self%20parsers%0A%20%20%20%20%09%20%20%20%20detect%3A%20%5B%3Aeach%20%7C%0A%09%09result%20%3A%3D%20each%20memoizedParse%3A%20aStream.%0A%09%09result%20isParseFailure%20not%5D%0A%09%20%20%20%20ifNone%3A%20%5B%5D.%0A%09%5Eresult%0A')}),
  390. smalltalk.PPChoiceParser);
  391. smalltalk.addClass('PPDelegateParser', smalltalk.PPParser, ['parser'], 'Parser');
  392. smalltalk.addMethod(
  393. '_parser',
  394. smalltalk.method({
  395. selector: 'parser',
  396. category: 'accessing',
  397. fn: function (){
  398. var self=this;
  399. return self['@parser'];
  400. return self;},
  401. source: unescape('parser%0A%09%5Eparser%0A')}),
  402. smalltalk.PPDelegateParser);
  403. smalltalk.addMethod(
  404. '_parser_',
  405. smalltalk.method({
  406. selector: 'parser:',
  407. category: 'accessing',
  408. fn: function (aParser){
  409. var self=this;
  410. self['@parser']=aParser;
  411. return self;},
  412. source: unescape('parser%3A%20aParser%0A%09parser%20%3A%3D%20aParser%0A')}),
  413. smalltalk.PPDelegateParser);
  414. smalltalk.addMethod(
  415. '_parse_',
  416. smalltalk.method({
  417. selector: 'parse:',
  418. category: 'parsing',
  419. fn: function (aStream){
  420. var self=this;
  421. return smalltalk.send(smalltalk.send(self, "_parser", []), "_memoizedParse_", [aStream]);
  422. return self;},
  423. source: unescape('parse%3A%20aStream%0A%09%5Eself%20parser%20memoizedParse%3A%20aStream%0A')}),
  424. smalltalk.PPDelegateParser);
  425. smalltalk.addMethod(
  426. '_on_',
  427. smalltalk.method({
  428. selector: 'on:',
  429. category: 'instance creation',
  430. fn: function (aParser){
  431. var self=this;
  432. return (function($rec){smalltalk.send($rec, "_parser_", [aParser]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  433. return self;},
  434. source: unescape('on%3A%20aParser%0A%09%20%20%20%20%5Eself%20new%0A%09%09parser%3A%20aParser%3B%0A%09%09yourself%0A')}),
  435. smalltalk.PPDelegateParser.klass);
  436. smalltalk.addClass('PPAndParser', smalltalk.PPDelegateParser, [], 'Parser');
  437. smalltalk.addMethod(
  438. '_parse_',
  439. smalltalk.method({
  440. selector: 'parse:',
  441. category: 'parsing',
  442. fn: function (aStream){
  443. var self=this;
  444. return smalltalk.send(self, "_basicParse_", [aStream]);
  445. return self;},
  446. source: unescape('parse%3A%20aStream%0A%09%5Eself%20basicParse%3A%20aStream%0A')}),
  447. smalltalk.PPAndParser);
  448. smalltalk.addMethod(
  449. '_basicParse_',
  450. smalltalk.method({
  451. selector: 'basicParse:',
  452. category: 'parsing',
  453. fn: function (aStream){
  454. var self=this;
  455. var element=nil;
  456. var position=nil;
  457. position=smalltalk.send(aStream, "_position", []);
  458. element=smalltalk.send(smalltalk.send(self, "_parser", []), "_memoizedParse_", [aStream]);
  459. smalltalk.send(aStream, "_position_", [position]);
  460. return element;
  461. return self;},
  462. source: unescape('basicParse%3A%20aStream%0A%09%7C%20element%20position%20%7C%0A%09position%20%3A%3D%20aStream%20position.%0A%09element%20%3A%3D%20self%20parser%20memoizedParse%3A%20aStream.%0A%09aStream%20position%3A%20position.%0A%09%5Eelement%0A')}),
  463. smalltalk.PPAndParser);
  464. smalltalk.addClass('PPNotParser', smalltalk.PPAndParser, [], 'Parser');
  465. smalltalk.addMethod(
  466. '_parse_',
  467. smalltalk.method({
  468. selector: 'parse:',
  469. category: 'parsing',
  470. fn: function (aStream){
  471. var self=this;
  472. var element=nil;
  473. element=smalltalk.send(self, "_basicParse_", [aStream]);
  474. return smalltalk.send(smalltalk.send(element, "_isParseFailure", []), "_ifTrue_ifFalse_", [(function(){return nil;}), (function(){return smalltalk.send(smalltalk.PPFailure, "_reason_at_", [element, smalltalk.send(aStream, "_position", [])]);})]);
  475. return self;},
  476. source: unescape('parse%3A%20aStream%0A%09%7C%20element%20%7C%0A%09element%20%3A%3D%20self%20basicParse%3A%20aStream.%0A%09%5Eelement%20isParseFailure%20%0A%09%20%20%20%20ifTrue%3A%20%5Bnil%5D%0A%09%20%20%20%20ifFalse%3A%20%5BPPFailure%20reason%3A%20element%20at%3A%20aStream%20position%5D%0A')}),
  477. smalltalk.PPNotParser);
  478. smalltalk.addClass('PPActionParser', smalltalk.PPDelegateParser, ['block'], 'Parser');
  479. smalltalk.addMethod(
  480. '_block',
  481. smalltalk.method({
  482. selector: 'block',
  483. category: 'accessing',
  484. fn: function (){
  485. var self=this;
  486. return self['@block'];
  487. return self;},
  488. source: unescape('block%0A%09%5Eblock%0A')}),
  489. smalltalk.PPActionParser);
  490. smalltalk.addMethod(
  491. '_block_',
  492. smalltalk.method({
  493. selector: 'block:',
  494. category: 'accessing',
  495. fn: function (aBlock){
  496. var self=this;
  497. self['@block']=aBlock;
  498. return self;},
  499. source: unescape('block%3A%20aBlock%0A%09block%20%3A%3D%20aBlock%0A')}),
  500. smalltalk.PPActionParser);
  501. smalltalk.addMethod(
  502. '_parse_',
  503. smalltalk.method({
  504. selector: 'parse:',
  505. category: 'parsing',
  506. fn: function (aStream){
  507. var self=this;
  508. var element=nil;
  509. element=smalltalk.send(smalltalk.send(self, "_parser", []), "_memoizedParse_", [aStream]);
  510. return smalltalk.send(smalltalk.send(element, "_isParseFailure", []), "_ifFalse_ifTrue_", [(function(){return smalltalk.send(smalltalk.send(self, "_block", []), "_value_", [element]);}), (function(){return element;})]);
  511. return self;},
  512. source: unescape('parse%3A%20aStream%0A%09%7C%20element%20%7C%0A%09element%20%3A%3D%20self%20parser%20memoizedParse%3A%20aStream.%0A%09%5Eelement%20isParseFailure%0A%09%20%20%20%20ifFalse%3A%20%5Bself%20block%20value%3A%20element%5D%0A%09%20%20%20%20ifTrue%3A%20%5Belement%5D%0A')}),
  513. smalltalk.PPActionParser);
  514. smalltalk.addMethod(
  515. '_on_block_',
  516. smalltalk.method({
  517. selector: 'on:block:',
  518. category: 'instance creation',
  519. fn: function (aParser, aBlock){
  520. var self=this;
  521. return (function($rec){smalltalk.send($rec, "_parser_", [aParser]);smalltalk.send($rec, "_block_", [aBlock]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  522. return self;},
  523. source: unescape('on%3A%20aParser%20block%3A%20aBlock%0A%09%20%20%20%20%5Eself%20new%0A%09%09parser%3A%20aParser%3B%0A%09%09block%3A%20aBlock%3B%0A%09%09yourself%0A')}),
  524. smalltalk.PPActionParser.klass);
  525. smalltalk.addClass('PPFlattenParser', smalltalk.PPDelegateParser, [], 'Parser');
  526. smalltalk.addMethod(
  527. '_parse_',
  528. smalltalk.method({
  529. selector: 'parse:',
  530. category: 'parsing',
  531. fn: function (aStream){
  532. var self=this;
  533. var start=nil;
  534. var element=nil;
  535. var stop=nil;
  536. start=smalltalk.send(aStream, "_position", []);
  537. element=smalltalk.send(smalltalk.send(self, "_parser", []), "_memoizedParse_", [aStream]);
  538. return smalltalk.send(smalltalk.send(element, "_isParseFailure", []), "_ifTrue_ifFalse_", [(function(){return element;}), (function(){return smalltalk.send(smalltalk.send(aStream, "_collection", []), "_copyFrom_to_", [smalltalk.send(start, "__plus", [(1)]), smalltalk.send(aStream, "_position", [])]);})]);
  539. return self;},
  540. source: unescape('parse%3A%20aStream%0A%09%7C%20start%20element%20stop%20%7C%0A%09start%20%3A%3D%20aStream%20position.%0A%09element%20%3A%3D%20self%20parser%20memoizedParse%3A%20aStream.%0A%09%5Eelement%20isParseFailure%0A%09%20%20%20%20ifTrue%3A%20%5Belement%5D%0A%09%20%20%20%20ifFalse%3A%20%5BaStream%20collection%20%0A%09%09copyFrom%3A%20start%20+%201%20%0A%09%09to%3A%20aStream%20position%5D%0A')}),
  541. smalltalk.PPFlattenParser);
  542. smalltalk.addClass('PPSourceParser', smalltalk.PPDelegateParser, [], 'Parser');
  543. smalltalk.addMethod(
  544. '_parse_',
  545. smalltalk.method({
  546. selector: 'parse:',
  547. category: 'parsing',
  548. fn: function (aStream){
  549. var self=this;
  550. var start=nil;
  551. var element=nil;
  552. var stop=nil;
  553. var result=nil;
  554. start=smalltalk.send(aStream, "_position", []);
  555. element=smalltalk.send(smalltalk.send(self, "_parser", []), "_memoizedParse_", [aStream]);
  556. return smalltalk.send(smalltalk.send(element, "_isParseFailure", []), "_ifTrue_ifFalse_", [(function(){return element;}), (function(){result=smalltalk.send(smalltalk.send(aStream, "_collection", []), "_copyFrom_to_", [smalltalk.send(start, "__plus", [(1)]), smalltalk.send(aStream, "_position", [])]);return smalltalk.send(smalltalk.Array, "_with_with_", [element, result]);})]);
  557. return self;},
  558. source: unescape('parse%3A%20aStream%0A%09%7C%20start%20element%20stop%20result%20%7C%0A%09start%20%3A%3D%20aStream%20position.%0A%09element%20%3A%3D%20self%20parser%20memoizedParse%3A%20aStream.%0A%09%5Eelement%20isParseFailure%0A%09%09ifTrue%3A%20%5Belement%5D%0A%09%09ifFalse%3A%20%5Bresult%20%3A%3D%20aStream%20collection%20copyFrom%3A%20start%20+%201%20to%3A%20aStream%20position.%0A%09%09%09Array%20with%3A%20element%20with%3A%20result%5D.%0A')}),
  559. smalltalk.PPSourceParser);
  560. smalltalk.addClass('PPRepeatingParser', smalltalk.PPDelegateParser, ['min'], 'Parser');
  561. smalltalk.addMethod(
  562. '_min',
  563. smalltalk.method({
  564. selector: 'min',
  565. category: 'accessing',
  566. fn: function (){
  567. var self=this;
  568. return self['@min'];
  569. return self;},
  570. source: unescape('min%0A%09%5Emin%0A')}),
  571. smalltalk.PPRepeatingParser);
  572. smalltalk.addMethod(
  573. '_min_',
  574. smalltalk.method({
  575. selector: 'min:',
  576. category: 'accessing',
  577. fn: function (aNumber){
  578. var self=this;
  579. self['@min']=aNumber;
  580. return self;},
  581. source: unescape('min%3A%20aNumber%0A%09min%20%3A%3D%20aNumber%0A')}),
  582. smalltalk.PPRepeatingParser);
  583. smalltalk.addMethod(
  584. '_parse_',
  585. smalltalk.method({
  586. selector: 'parse:',
  587. category: 'parsing',
  588. fn: function (aStream){
  589. var self=this;
  590. var start=nil;
  591. var element=nil;
  592. var elements=nil;
  593. var failure=nil;
  594. start=smalltalk.send(aStream, "_position", []);
  595. elements=smalltalk.send(smalltalk.Array, "_new", []);
  596. smalltalk.send((function(){return smalltalk.send(smalltalk.send(smalltalk.send(elements, "_size", []), "__lt", [smalltalk.send(self, "_min", [])]), "_and_", [(function(){return smalltalk.send(failure, "_isNil", []);})]);}), "_whileTrue_", [(function(){element=smalltalk.send(smalltalk.send(self, "_parser", []), "_memoizedParse_", [aStream]);return smalltalk.send(smalltalk.send(element, "_isParseFailure", []), "_ifFalse_ifTrue_", [(function(){return smalltalk.send(elements, "_addLast_", [element]);}), (function(){smalltalk.send(aStream, "_position_", [start]);return failure=element;})]);})]);
  597. return smalltalk.send(failure, "_ifNil_ifNotNil_", [(function(){smalltalk.send((function(){return smalltalk.send(failure, "_isNil", []);}), "_whileTrue_", [(function(){element=smalltalk.send(smalltalk.send(self, "_parser", []), "_memoizedParse_", [aStream]);return smalltalk.send(smalltalk.send(element, "_isParseFailure", []), "_ifTrue_ifFalse_", [(function(){return failure=element;}), (function(){return smalltalk.send(elements, "_addLast_", [element]);})]);})]);return elements;}), (function(){return failure;})]);
  598. return self;},
  599. source: unescape('parse%3A%20aStream%0A%09%7C%20start%20element%20elements%20failure%20%7C%0A%09start%20%3A%3D%20aStream%20position.%0A%09elements%20%3A%3D%20Array%20new.%0A%09%5B%28elements%20size%20%3C%20self%20min%29%20and%3A%20%5Bfailure%20isNil%5D%5D%20whileTrue%3A%20%5B%0A%09%20%20%20%20element%20%3A%3D%20self%20parser%20memoizedParse%3A%20aStream.%0A%09%20%20%20%20element%20isParseFailure%0A%09%09%09ifFalse%3A%20%5Belements%20addLast%3A%20element%5D%0A%09%09%09ifTrue%3A%20%5BaStream%20position%3A%20start.%0A%09%09%09%09%20failure%20%3A%3D%20element%5D%5D.%0A%09%5Efailure%20ifNil%3A%20%5B%0A%09%20%20%20%20%5Bfailure%20isNil%5D%20whileTrue%3A%20%5B%0A%09%09%09element%20%3A%3D%20self%20parser%20memoizedParse%3A%20aStream.%0A%09%20%09%09element%20isParseFailure%0A%09%09%09%09ifTrue%3A%20%5Bfailure%20%3A%3D%20element%5D%0A%09%09%09%09ifFalse%3A%20%5Belements%20addLast%3A%20element%5D%5D.%0A%09%09%09%09elements%5D%0A%09%09ifNotNil%3A%20%5Bfailure%5D.%0A')}),
  600. smalltalk.PPRepeatingParser);
  601. smalltalk.addMethod(
  602. '_on_min_',
  603. smalltalk.method({
  604. selector: 'on:min:',
  605. category: 'instance creation',
  606. fn: function (aParser, aNumber){
  607. var self=this;
  608. return (function($rec){smalltalk.send($rec, "_parser_", [aParser]);smalltalk.send($rec, "_min_", [aNumber]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  609. return self;},
  610. source: unescape('on%3A%20aParser%20min%3A%20aNumber%0A%09%20%20%20%20%5Eself%20new%0A%09%09parser%3A%20aParser%3B%0A%09%09min%3A%20aNumber%3B%0A%09%09yourself%0A')}),
  611. smalltalk.PPRepeatingParser.klass);
  612. smalltalk.addClass('PPFailure', smalltalk.Object, ['position', 'reason'], 'Parser');
  613. smalltalk.addMethod(
  614. '_position',
  615. smalltalk.method({
  616. selector: 'position',
  617. category: 'accessing',
  618. fn: function (){
  619. var self=this;
  620. return smalltalk.send(self['@position'], "_ifNil_", [(function(){return (0);})]);
  621. return self;},
  622. source: unescape('position%0A%09%5Eposition%20ifNil%3A%20%5B0%5D%0A')}),
  623. smalltalk.PPFailure);
  624. smalltalk.addMethod(
  625. '_position_',
  626. smalltalk.method({
  627. selector: 'position:',
  628. category: 'accessing',
  629. fn: function (aNumber){
  630. var self=this;
  631. self['@position']=aNumber;
  632. return self;},
  633. source: unescape('position%3A%20aNumber%0A%09position%20%3A%3D%20aNumber%0A')}),
  634. smalltalk.PPFailure);
  635. smalltalk.addMethod(
  636. '_reason',
  637. smalltalk.method({
  638. selector: 'reason',
  639. category: 'accessing',
  640. fn: function (){
  641. var self=this;
  642. return smalltalk.send(self['@reason'], "_ifNil_", [(function(){return "";})]);
  643. return self;},
  644. source: unescape('reason%0A%09%5Ereason%20ifNil%3A%20%5B%27%27%5D%0A')}),
  645. smalltalk.PPFailure);
  646. smalltalk.addMethod(
  647. '_reason_',
  648. smalltalk.method({
  649. selector: 'reason:',
  650. category: 'accessing',
  651. fn: function (aString){
  652. var self=this;
  653. self['@reason']=aString;
  654. return self;},
  655. source: unescape('reason%3A%20aString%0A%09reason%20%3A%3D%20aString%0A')}),
  656. smalltalk.PPFailure);
  657. smalltalk.addMethod(
  658. '_reason_at_',
  659. smalltalk.method({
  660. selector: 'reason:at:',
  661. category: 'accessing',
  662. fn: function (aString, anInteger){
  663. var self=this;
  664. (function($rec){smalltalk.send($rec, "_reason_", [aString]);return smalltalk.send($rec, "_position_", [anInteger]);})(self);
  665. return self;},
  666. source: unescape('reason%3A%20aString%20at%3A%20anInteger%0A%09self%20%0A%09%20%20%20%20reason%3A%20aString%3B%20%0A%09%20%20%20%20position%3A%20anInteger%0A')}),
  667. smalltalk.PPFailure);
  668. smalltalk.addMethod(
  669. '_isParseFailure',
  670. smalltalk.method({
  671. selector: 'isParseFailure',
  672. category: 'testing',
  673. fn: function (){
  674. var self=this;
  675. return true;
  676. return self;},
  677. source: unescape('isParseFailure%0A%09%5Etrue%0A')}),
  678. smalltalk.PPFailure);
  679. smalltalk.addMethod(
  680. '_reason_at_',
  681. smalltalk.method({
  682. selector: 'reason:at:',
  683. category: 'instance creation',
  684. fn: function (aString, anInteger){
  685. var self=this;
  686. return (function($rec){smalltalk.send($rec, "_reason_at_", [aString, anInteger]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(self, "_new", []));
  687. return self;},
  688. source: unescape('reason%3A%20aString%20at%3A%20anInteger%0A%09%20%20%20%20%5Eself%20new%0A%09%09reason%3A%20aString%20at%3A%20anInteger%3B%0A%09%09yourself%0A')}),
  689. smalltalk.PPFailure.klass);
  690. smalltalk.addClass('SmalltalkParser', smalltalk.Object, [], 'Parser');
  691. smalltalk.addMethod(
  692. '_parse_',
  693. smalltalk.method({
  694. selector: 'parse:',
  695. category: 'parsing',
  696. fn: function (aStream){
  697. var self=this;
  698. return smalltalk.send(smalltalk.send(self, "_parser", []), "_parse_", [aStream]);
  699. return self;},
  700. source: unescape('parse%3A%20aStream%0A%09%5Eself%20parser%20parse%3A%20aStream%0A')}),
  701. smalltalk.SmalltalkParser);
  702. smalltalk.addMethod(
  703. '_parser',
  704. smalltalk.method({
  705. selector: 'parser',
  706. category: 'grammar',
  707. fn: function (){
  708. var self=this;
  709. var method=nil;
  710. var expression=nil;
  711. var separator=nil;
  712. var comment=nil;
  713. var ws=nil;
  714. var identifier=nil;
  715. var keyword=nil;
  716. var className=nil;
  717. var string=nil;
  718. var symbol=nil;
  719. var number=nil;
  720. var literalArray=nil;
  721. var variable=nil;
  722. var reference=nil;
  723. var classReference=nil;
  724. var literal=nil;
  725. var ret=nil;
  726. var methodParser=nil;
  727. var expressionParser=nil;
  728. var keyword=nil;
  729. var unarySelector=nil;
  730. var binarySelector=nil;
  731. var keywordPattern=nil;
  732. var unaryPattern=nil;
  733. var binaryPattern=nil;
  734. var assignment=nil;
  735. var temps=nil;
  736. var blockParamList=nil;
  737. var block=nil;
  738. var expression=nil;
  739. var expressions=nil;
  740. var subexpression=nil;
  741. var statements=nil;
  742. var sequence=nil;
  743. var operand=nil;
  744. var unaryMessage=nil;
  745. var unarySend=nil;
  746. var unaryTail=nil;
  747. var binaryMessage=nil;
  748. var binarySend=nil;
  749. var binaryTail=nil;
  750. var keywordMessage=nil;
  751. var keywordSend=nil;
  752. var keywordPair=nil;
  753. var cascade=nil;
  754. var message=nil;
  755. var jsStatement=nil;
  756. separator=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.String, "_cr", []), "__comma", [smalltalk.send(smalltalk.String, "_space", [])]), "__comma", [smalltalk.send(smalltalk.String, "_lf", [])]), "__comma", [smalltalk.send(smalltalk.String, "_tab", [])]), "_asChoiceParser", []);
  757. comment=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("%22"), "_asCharacterParser", []), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("%22"), "_asParser", []), "_not", []), "__comma", [smalltalk.send(smalltalk.PPAnyParser, "_new", [])]), "_star", [])]), "__comma", [smalltalk.send(unescape("%22"), "_asCharacterParser", [])]), "_flatten", []);
  758. ws=smalltalk.send(smalltalk.send(separator, "__slash", [comment]), "_star", []);
  759. identifier=smalltalk.send(smalltalk.send(smalltalk.send(unescape("a-z"), "_asCharacterParser", []), "__comma", [smalltalk.send(smalltalk.send(unescape("a-zA-Z0-9"), "_asCharacterParser", []), "_star", [])]), "_flatten", []);
  760. keyword=smalltalk.send(smalltalk.send(identifier, "__comma", [smalltalk.send(":", "_asParser", [])]), "_flatten", []);
  761. className=smalltalk.send(smalltalk.send(smalltalk.send(unescape("A-Z"), "_asCharacterParser", []), "__comma", [smalltalk.send(smalltalk.send(unescape("a-zA-Z0-9"), "_asCharacterParser", []), "_star", [])]), "_flatten", []);
  762. string=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("%27"), "_asParser", []), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("%27%27"), "_asParser", []), "__slash", [smalltalk.send(smalltalk.send(smalltalk.send(unescape("%27"), "_asParser", []), "_not", []), "__comma", [smalltalk.send(smalltalk.PPAnyParser, "_new", [])])]), "_star", []), "_flatten", [])]), "__comma", [smalltalk.send(unescape("%27"), "_asParser", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(smalltalk.ValueNode, "_new", []), "_value_", [smalltalk.send(smalltalk.send(node, "_at_", [(2)]), "_replace_with_", [unescape("%27%27"), unescape("%27")])]);})]);
  763. symbol=smalltalk.send(smalltalk.send(smalltalk.send(unescape("%23"), "_asParser", []), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(unescape("a-zA-Z0-9"), "_asCharacterParser", []), "_plus", []), "_flatten", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(smalltalk.ValueNode, "_new", []), "_value_", [smalltalk.send(node, "_second", [])]);})]);
  764. number=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("0-9"), "_asCharacterParser", []), "_plus", []), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(".", "_asParser", []), "__comma", [smalltalk.send(smalltalk.send(unescape("0-9"), "_asCharacterParser", []), "_plus", [])]), "_optional", [])]), "_flatten", []), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(smalltalk.ValueNode, "_new", []), "_value_", [smalltalk.send(node, "_asNumber", [])]);})]);
  765. literal=smalltalk.send(smalltalk.PPDelegateParser, "_new", []);
  766. literalArray=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("%23%28"), "_asParser", []), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(ws, "__comma", [literal]), "__comma", [ws]), "_star", [])]), "__comma", [smalltalk.send(unescape("%29"), "_asParser", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(smalltalk.ValueNode, "_new", []), "_value_", [smalltalk.send(smalltalk.Array, "_withAll_", [smalltalk.send(smalltalk.send(node, "_second", []), "_collect_", [(function(each){return smalltalk.send(smalltalk.send(each, "_second", []), "_value", []);})])])]);})]);
  767. variable=smalltalk.send(identifier, "__eq_eq_gt", [(function(token){return smalltalk.send(smalltalk.send(smalltalk.VariableNode, "_new", []), "_value_", [token]);})]);
  768. classReference=smalltalk.send(className, "__eq_eq_gt", [(function(token){return smalltalk.send(smalltalk.send(smalltalk.ClassReferenceNode, "_new", []), "_value_", [token]);})]);
  769. reference=smalltalk.send(variable, "__slash", [classReference]);
  770. binarySelector=smalltalk.send(smalltalk.send(smalltalk.send(unescape("+*/%3D%3E%3C%2C@%25%7E-"), "_asCharacterParser", []), "_plus", []), "_flatten", []);
  771. unarySelector=identifier;
  772. keywordPattern=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ws, "__comma", [keyword]), "__comma", [ws]), "__comma", [identifier]), "_plus", []), "__eq_eq_gt", [(function(nodes){return smalltalk.send(smalltalk.Array, "_with_with_", [smalltalk.send(smalltalk.send(nodes, "_collect_", [(function(each){return smalltalk.send(each, "_at_", [(2)]);})]), "_join_", [""]), smalltalk.send(nodes, "_collect_", [(function(each){return smalltalk.send(each, "_at_", [(4)]);})])]);})]);
  773. binaryPattern=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ws, "__comma", [binarySelector]), "__comma", [ws]), "__comma", [identifier]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.Array, "_with_with_", [smalltalk.send(node, "_second", []), smalltalk.send(smalltalk.Array, "_with_", [smalltalk.send(node, "_fourth", [])])]);})]);
  774. unaryPattern=smalltalk.send(smalltalk.send(ws, "__comma", [unarySelector]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.Array, "_with_with_", [smalltalk.send(node, "_second", []), smalltalk.send(smalltalk.Array, "_new", [])]);})]);
  775. expression=smalltalk.send(smalltalk.PPDelegateParser, "_new", []);
  776. expressions=smalltalk.send(smalltalk.send(expression, "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ws, "__comma", [smalltalk.send(".", "_asParser", [])]), "__comma", [ws]), "__comma", [expression]), "__eq_eq_gt", [(function(node){return smalltalk.send(node, "_fourth", []);})]), "_star", [])]), "__eq_eq_gt", [(function(node){var result=nil;
  777. result=smalltalk.send(smalltalk.Array, "_with_", [smalltalk.send(node, "_first", [])]);smalltalk.send(smalltalk.send(node, "_second", []), "_do_", [(function(each){return smalltalk.send(result, "_add_", [each]);})]);return result;})]);
  778. assignment=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(reference, "__comma", [ws]), "__comma", [smalltalk.send(unescape("%3A%3D"), "_asParser", [])]), "__comma", [ws]), "__comma", [expression]), "__eq_eq_gt", [(function(node){return (function($rec){smalltalk.send($rec, "_left_", [smalltalk.send(node, "_first", [])]);return smalltalk.send($rec, "_right_", [smalltalk.send(node, "_at_", [(5)])]);})(smalltalk.send(smalltalk.AssignmentNode, "_new", []));})]);
  779. ret=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("%5E"), "_asParser", []), "__comma", [ws]), "__comma", [expression]), "__comma", [ws]), "__comma", [smalltalk.send(smalltalk.send(".", "_asParser", []), "_optional", [])]), "__eq_eq_gt", [(function(node){return (function($rec){smalltalk.send($rec, "_addNode_", [smalltalk.send(node, "_third", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(smalltalk.ReturnNode, "_new", []));})]);
  780. temps=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("%7C"), "_asParser", []), "__comma", [smalltalk.send(smalltalk.send(ws, "__comma", [identifier]), "_star", [])]), "__comma", [ws]), "__comma", [smalltalk.send(unescape("%7C"), "_asParser", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(node, "_second", []), "_collect_", [(function(each){return smalltalk.send(each, "_second", []);})]);})]);
  781. blockParamList=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(":", "_asParser", []), "__comma", [identifier]), "__comma", [ws]), "_plus", []), "__comma", [smalltalk.send(unescape("%7C"), "_asParser", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(node, "_first", []), "_collect_", [(function(each){return smalltalk.send(each, "_second", []);})]);})]);
  782. subexpression=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("%28"), "_asParser", []), "__comma", [ws]), "__comma", [expression]), "__comma", [ws]), "__comma", [smalltalk.send(unescape("%29"), "_asParser", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(node, "_third", []);})]);
  783. statements=smalltalk.send(smalltalk.send(smalltalk.send(ret, "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.Array, "_with_", [node]);})]), "__slash", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(expressions, "__comma", [ws]), "__comma", [smalltalk.send(".", "_asParser", [])]), "__comma", [ws]), "__comma", [ret]), "__eq_eq_gt", [(function(node){return (function($rec){smalltalk.send($rec, "_add_", [smalltalk.send(node, "_at_", [(5)])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(node, "_first", []));})])]), "__slash", [smalltalk.send(smalltalk.send(expressions, "__comma", [smalltalk.send(smalltalk.send(".", "_asParser", []), "_optional", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(node, "_first", []);})])]);
  784. sequence=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(temps, "_optional", []), "__comma", [ws]), "__comma", [smalltalk.send(statements, "_optional", [])]), "__comma", [ws]), "__eq_eq_gt", [(function(node){return (function($rec){smalltalk.send($rec, "_temps_", [smalltalk.send(node, "_first", [])]);smalltalk.send($rec, "_nodes_", [smalltalk.send(node, "_third", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(smalltalk.SequenceNode, "_new", []));})]);
  785. block=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("%5B"), "_asParser", []), "__comma", [ws]), "__comma", [smalltalk.send(blockParamList, "_optional", [])]), "__comma", [ws]), "__comma", [smalltalk.send(sequence, "_optional", [])]), "__comma", [ws]), "__comma", [smalltalk.send(unescape("%5D"), "_asParser", [])]), "__eq_eq_gt", [(function(node){return (function($rec){smalltalk.send($rec, "_parameters_", [smalltalk.send(node, "_third", [])]);return smalltalk.send($rec, "_addNode_", [smalltalk.send(smalltalk.send(node, "_at_", [(5)]), "_asBlockSequenceNode", [])]);})(smalltalk.send(smalltalk.BlockNode, "_new", []));})]);
  786. operand=smalltalk.send(smalltalk.send(literal, "__slash", [reference]), "__slash", [subexpression]);
  787. smalltalk.send(literal, "_parser_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(number, "__slash", [string]), "__slash", [literalArray]), "__slash", [symbol]), "__slash", [block])]);
  788. unaryMessage=smalltalk.send(smalltalk.send(smalltalk.send(ws, "__comma", [unarySelector]), "__comma", [smalltalk.send(smalltalk.send(":", "_asParser", []), "_not", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(smalltalk.SendNode, "_new", []), "_selector_", [smalltalk.send(node, "_second", [])]);})]);
  789. unaryTail=smalltalk.send(smalltalk.PPDelegateParser, "_new", []);
  790. smalltalk.send(unaryTail, "_parser_", [smalltalk.send(smalltalk.send(unaryMessage, "__comma", [smalltalk.send(unaryTail, "_optional", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(node, "_second", []), "_ifNil_ifNotNil_", [(function(){return smalltalk.send(node, "_first", []);}), (function(){return smalltalk.send(smalltalk.send(node, "_second", []), "_valueForReceiver_", [smalltalk.send(node, "_first", [])]);})]);})])]);
  791. unarySend=smalltalk.send(smalltalk.send(operand, "__comma", [smalltalk.send(unaryTail, "_optional", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(node, "_second", []), "_ifNil_ifNotNil_", [(function(){return smalltalk.send(node, "_first", []);}), (function(){return smalltalk.send(smalltalk.send(node, "_second", []), "_valueForReceiver_", [smalltalk.send(node, "_first", [])]);})]);})]);
  792. binaryMessage=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ws, "__comma", [binarySelector]), "__comma", [ws]), "__comma", [smalltalk.send(unarySend, "__slash", [operand])]), "__eq_eq_gt", [(function(node){return (function($rec){smalltalk.send($rec, "_selector_", [smalltalk.send(node, "_second", [])]);return smalltalk.send($rec, "_arguments_", [smalltalk.send(smalltalk.Array, "_with_", [smalltalk.send(node, "_fourth", [])])]);})(smalltalk.send(smalltalk.SendNode, "_new", []));})]);
  793. binaryTail=smalltalk.send(smalltalk.PPDelegateParser, "_new", []);
  794. smalltalk.send(binaryTail, "_parser_", [smalltalk.send(smalltalk.send(binaryMessage, "__comma", [smalltalk.send(binaryTail, "_optional", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(node, "_second", []), "_ifNil_ifNotNil_", [(function(){return smalltalk.send(node, "_first", []);}), (function(){return smalltalk.send(smalltalk.send(node, "_second", []), "_valueForReceiver_", [smalltalk.send(node, "_first", [])]);})]);})])]);
  795. binarySend=smalltalk.send(smalltalk.send(unarySend, "__comma", [smalltalk.send(binaryTail, "_optional", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(node, "_second", []), "_ifNil_ifNotNil_", [(function(){return smalltalk.send(node, "_first", []);}), (function(){return smalltalk.send(smalltalk.send(node, "_second", []), "_valueForReceiver_", [smalltalk.send(node, "_first", [])]);})]);})]);
  796. keywordPair=smalltalk.send(smalltalk.send(keyword, "__comma", [ws]), "__comma", [binarySend]);
  797. keywordMessage=smalltalk.send(smalltalk.send(smalltalk.send(ws, "__comma", [keywordPair]), "_plus", []), "__eq_eq_gt", [(function(nodes){return (function($rec){smalltalk.send($rec, "_selector_", [smalltalk.send(smalltalk.send(nodes, "_collect_", [(function(each){return smalltalk.send(smalltalk.send(each, "_second", []), "_first", []);})]), "_join_", [""])]);return smalltalk.send($rec, "_arguments_", [smalltalk.send(nodes, "_collect_", [(function(each){return smalltalk.send(smalltalk.send(each, "_second", []), "_third", []);})])]);})(smalltalk.send(smalltalk.SendNode, "_new", []));})]);
  798. keywordSend=smalltalk.send(smalltalk.send(binarySend, "__comma", [keywordMessage]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(node, "_second", []), "_valueForReceiver_", [smalltalk.send(node, "_first", [])]);})]);
  799. message=smalltalk.send(smalltalk.send(binaryMessage, "__slash", [unaryMessage]), "__slash", [keywordMessage]);
  800. cascade=smalltalk.send(smalltalk.send(smalltalk.send(keywordSend, "__slash", [binarySend]), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(ws, "__comma", [smalltalk.send(unescape("%3B"), "_asParser", [])]), "__comma", [message]), "_plus", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(node, "_first", []), "_cascadeNodeWithMessages_", [smalltalk.send(smalltalk.send(node, "_second", []), "_collect_", [(function(each){return smalltalk.send(each, "_third", []);})])]);})]);
  801. jsStatement=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("%7B"), "_asParser", []), "__comma", [ws]), "__comma", [string]), "__comma", [ws]), "__comma", [smalltalk.send(unescape("%7D"), "_asParser", [])]), "__eq_eq_gt", [(function(node){return (function($rec){smalltalk.send($rec, "_source_", [smalltalk.send(node, "_third", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(smalltalk.JSStatementNode, "_new", []));})]);
  802. smalltalk.send(expression, "_parser_", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(assignment, "__slash", [cascade]), "__slash", [keywordSend]), "__slash", [binarySend]), "__slash", [jsStatement])]);
  803. method=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(ws, "__comma", [smalltalk.send(smalltalk.send(keywordPattern, "__slash", [binaryPattern]), "__slash", [unaryPattern])]), "__comma", [ws]), "__comma", [smalltalk.send(sequence, "_optional", [])]), "__comma", [ws]), "_withSource", []), "__eq_eq_gt", [(function(node){return (function($rec){smalltalk.send($rec, "_selector_", [smalltalk.send(smalltalk.send(smalltalk.send(node, "_first", []), "_second", []), "_first", [])]);smalltalk.send($rec, "_arguments_", [smalltalk.send(smalltalk.send(smalltalk.send(node, "_first", []), "_second", []), "_second", [])]);smalltalk.send($rec, "_addNode_", [smalltalk.send(smalltalk.send(node, "_first", []), "_fourth", [])]);smalltalk.send($rec, "_source_", [smalltalk.send(node, "_second", [])]);return smalltalk.send($rec, "_yourself", []);})(smalltalk.send(smalltalk.MethodNode, "_new", []));})]);
  804. return smalltalk.send(smalltalk.send(method, "__comma", [smalltalk.send(smalltalk.PPEOFParser, "_new", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(node, "_first", []);})]);
  805. return self;},
  806. source: unescape('parser%0A%09%7C%20method%20expression%20separator%20comment%20ws%20identifier%20keyword%20className%20string%20symbol%20number%20literalArray%20variable%20reference%20classReference%20literal%20ret%20methodParser%20expressionParser%20keyword%20unarySelector%20binarySelector%20keywordPattern%20unaryPattern%20binaryPattern%20assignment%20temps%20blockParamList%20block%20expression%20expressions%20subexpression%20statements%20sequence%20operand%20unaryMessage%20unarySend%20unaryTail%20binaryMessage%20binarySend%20binaryTail%20keywordMessage%20keywordSend%20keywordPair%20cascade%20message%20jsStatement%20%7C%0A%09%0A%09separator%20%3A%3D%20%28String%20cr%2C%20String%20space%2C%20String%20lf%2C%20String%20tab%29%20asChoiceParser.%0A%09comment%20%3A%3D%20%28%27%22%27%20asCharacterParser%2C%20%28%27%22%27%20asParser%20not%2C%20PPAnyParser%20new%29%20star%2C%20%27%22%27%20asCharacterParser%29%20flatten.%0A%0A%09ws%20%3A%3D%20%28separator%20/%20comment%29%20star.%0A%09%0A%09identifier%20%3A%3D%20%28%27a-z%27%20asCharacterParser%2C%20%27a-zA-Z0-9%27%20asCharacterParser%20star%29%20flatten.%0A%0A%09keyword%20%3A%3D%20%28identifier%2C%20%27%3A%27%20asParser%29%20flatten.%0A%0A%09className%20%3A%3D%20%28%27A-Z%27%20asCharacterParser%2C%20%27a-zA-Z0-9%27%20asCharacterParser%20star%29%20flatten.%0A%0A%09string%20%3A%3D%20%27%27%27%27%20asParser%2C%20%28%27%27%27%27%27%27%20asParser%20/%20%28%27%27%27%27%20asParser%20not%2C%20PPAnyParser%20new%29%29%20star%20flatten%2C%20%27%27%27%27%20asParser%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%20ValueNode%20new%20value%3A%20%28%28node%20at%3A%202%29%20replace%3A%20%27%27%27%27%27%27%20with%3A%20%27%27%27%27%29%5D.%0A%0A%09symbol%20%3A%3D%20%27%23%27%20asParser%2C%20%27a-zA-Z0-9%27%20asCharacterParser%20plus%20flatten%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%20ValueNode%20new%20value%3A%20node%20second%5D.%0A%0A%09number%20%3A%3D%20%28%270-9%27%20asCharacterParser%20plus%2C%20%28%27.%27%20asParser%2C%20%270-9%27%20asCharacterParser%20plus%29%20optional%29%20flatten%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%20ValueNode%20new%20value%3A%20node%20asNumber%5D.%0A%0A%09literal%20%3A%3D%20PPDelegateParser%20new.%0A%0A%09literalArray%20%3A%3D%20%27%23%28%27%20asParser%2C%20%28ws%2C%20literal%2C%20ws%29%20star%2C%20%27%29%27%20asParser%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%20ValueNode%20new%20value%3A%20%28Array%20withAll%3A%20%28node%20second%20collect%3A%20%5B%3Aeach%20%7C%20each%20second%20value%5D%29%29%5D.%0A%0A%09variable%20%3A%3D%20identifier%20%3D%3D%3E%20%5B%3Atoken%20%7C%20VariableNode%20new%20value%3A%20token%5D.%0A%0A%09classReference%20%3A%3D%20className%20%3D%3D%3E%20%5B%3Atoken%20%7C%20ClassReferenceNode%20new%20value%3A%20token%5D.%0A%0A%09reference%20%3A%3D%20variable%20/%20classReference.%0A%0A%09binarySelector%20%3A%3D%20%27+*/%3D%3E%3C%2C@%25%7E-%27%20asCharacterParser%20plus%20flatten.%0A%0A%09unarySelector%20%3A%3D%20identifier.%0A%0A%09keywordPattern%20%3A%3D%20%28ws%2C%20keyword%2C%20ws%2C%20identifier%29%20plus%0A%09%09%3D%3D%3E%20%5B%3Anodes%20%7C%20Array%0A%09%09%09%09%20%20with%3A%20%28%28nodes%20collect%3A%20%5B%3Aeach%20%7C%20each%20at%3A%202%5D%29%20join%3A%20%27%27%29%0A%09%09%09%09%20%20with%3A%20%28nodes%20collect%3A%20%5B%3Aeach%20%7C%20each%20at%3A%204%5D%29%5D.%0A%0A%09binaryPattern%20%3A%3D%20ws%2C%20binarySelector%2C%20ws%2C%20identifier%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%20Array%20with%3A%20node%20second%20with%3A%20%28Array%20with%3A%20node%20fourth%29%5D.%0A%0A%09unaryPattern%20%3A%3D%20ws%2C%20unarySelector%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%20Array%20with%3A%20node%20second%20with%3A%20Array%20new%5D.%0A%09%0A%09expression%20%3A%3D%20PPDelegateParser%20new.%0A%0A%09expressions%20%3A%3D%20expression%2C%20%28%28ws%2C%20%27.%27%20asParser%2C%20ws%2C%20expression%29%20%3D%3D%3E%20%5B%3Anode%20%7C%20node%20fourth%5D%29%20star%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%7C%20result%20%7C%0A%09%09%20%20%20%20result%20%3A%3D%20Array%20with%3A%20node%20first.%0A%09%09%20%20%20%20node%20second%20do%3A%20%5B%3Aeach%20%7C%20result%20add%3A%20each%5D.%0A%09%09%20%20%20%20result%5D.%0A%0A%09assignment%20%3A%3D%20reference%2C%20ws%2C%20%27%3A%3D%27%20asParser%2C%20ws%2C%20expression%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%20AssignmentNode%20new%20left%3A%20node%20first%3B%20right%3A%20%28node%20at%3A%205%29%5D.%0A%0A%09ret%20%3A%3D%20%27%5E%27%20asParser%2C%20ws%2C%20expression%2C%20ws%2C%20%27.%27%20asParser%20optional%0A%09%20%20%20%20%3D%3D%3E%20%5B%3Anode%20%7C%20ReturnNode%20new%0A%09%09%09%20%20%20%20%20addNode%3A%20node%20third%3B%0A%09%09%09%20%20%20%20%20yourself%5D.%0A%0A%09temps%20%3A%3D%20%27%7C%27%20asParser%2C%20%28ws%2C%20identifier%29%20star%2C%20ws%2C%20%27%7C%27%20asParser%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%20node%20second%20collect%3A%20%5B%3Aeach%20%7C%20each%20second%5D%5D.%0A%0A%09blockParamList%20%3A%3D%20%28%27%3A%27%20asParser%2C%20identifier%2C%20ws%29%20plus%2C%20%27%7C%27%20asParser%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%20node%20first%20collect%3A%20%5B%3Aeach%20%7C%20each%20second%5D%5D.%0A%0A%09subexpression%20%3A%3D%20%27%28%27%20asParser%2C%20ws%2C%20expression%2C%20ws%2C%20%27%29%27%20asParser%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%20node%20third%5D.%0A%0A%09statements%20%3A%3D%20%28ret%20%3D%3D%3E%20%5B%3Anode%20%7C%20Array%20with%3A%20node%5D%29%20/%20%28expressions%2C%20ws%2C%20%27.%27%20asParser%2C%20ws%2C%20ret%20%3D%3D%3E%20%5B%3Anode%20%7C%20node%20first%20add%3A%20%28node%20at%3A%205%29%3B%20yourself%5D%29%20/%20%28expressions%20%2C%20%27.%27%20asParser%20optional%20%3D%3D%3E%20%5B%3Anode%20%7C%20node%20first%5D%29.%0A%0A%09sequence%20%3A%3D%20temps%20optional%2C%20ws%2C%20statements%20optional%2C%20ws%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%20SequenceNode%20new%0A%09%09%09%09%20temps%3A%20node%20first%3B%0A%09%09%09%09%20nodes%3A%20node%20third%3B%0A%09%09%09%09%20yourself%5D.%0A%0A%09block%20%3A%3D%20%27%5B%27%20asParser%2C%20ws%2C%20blockParamList%20optional%2C%20ws%2C%20sequence%20optional%2C%20ws%2C%20%27%5D%27%20asParser%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%0A%09%09%20%20%20%20BlockNode%20new%0A%09%09%09parameters%3A%20node%20third%3B%0A%09%09%09addNode%3A%20%28node%20at%3A%205%29%20asBlockSequenceNode%5D.%0A%0A%09operand%20%3A%3D%20literal%20/%20reference%20/%20subexpression.%0A%0A%09literal%20parser%3A%20number%20/%20string%20/%20literalArray%20/%20symbol%20/%20block.%0A%0A%09unaryMessage%20%3A%3D%20ws%2C%20unarySelector%2C%20%27%3A%27%20asParser%20not%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%20SendNode%20new%20selector%3A%20node%20second%5D.%0A%0A%09unaryTail%20%3A%3D%20PPDelegateParser%20new.%0A%09unaryTail%20parser%3A%20%28unaryMessage%2C%20unaryTail%20optional%0A%09%09%09%20%20%20%20%20%20%20%3D%3D%3E%20%5B%3Anode%20%7C%0A%09%09%09%09%20%20%20node%20second%0A%09%09%09%09%09%20%20%20ifNil%3A%20%5Bnode%20first%5D%0A%09%09%09%09%09%20%20%20ifNotNil%3A%20%5Bnode%20second%20valueForReceiver%3A%20node%20first%5D%5D%29.%0A%0A%09unarySend%20%3A%3D%20operand%2C%20unaryTail%20optional%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%0A%09%09%20%20%20%20node%20second%20%0A%09%09%09ifNil%3A%20%5Bnode%20first%5D%0A%09%09%09ifNotNil%3A%20%5Bnode%20second%20valueForReceiver%3A%20node%20first%5D%5D.%0A%0A%09binaryMessage%20%3A%3D%20ws%2C%20binarySelector%2C%20ws%2C%20%28unarySend%20/%20operand%29%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%0A%09%09%20%20%20%20SendNode%20new%0A%09%09%09selector%3A%20node%20second%3B%0A%09%09%09arguments%3A%20%28Array%20with%3A%20node%20fourth%29%5D.%0A%0A%09binaryTail%20%3A%3D%20PPDelegateParser%20new.%0A%09binaryTail%20parser%3A%20%28binaryMessage%2C%20binaryTail%20optional%0A%09%09%09%09%20%20%20%20%3D%3D%3E%20%5B%3Anode%20%7C%0A%09%09%09%09%09node%20second%20%0A%09%09%09%09%09%20%20%20%20ifNil%3A%20%5Bnode%20first%5D%0A%09%09%09%09%09%20%20%20%20ifNotNil%3A%20%5B%20node%20second%20valueForReceiver%3A%20node%20first%5D%5D%29.%0A%0A%09binarySend%20%3A%3D%20unarySend%2C%20binaryTail%20optional%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%0A%09%09%20%20%20%20node%20second%0A%09%09%09ifNil%3A%20%5Bnode%20first%5D%0A%09%09%09ifNotNil%3A%20%5Bnode%20second%20valueForReceiver%3A%20node%20first%5D%5D.%0A%0A%09keywordPair%20%3A%3D%20keyword%2C%20ws%2C%20binarySend.%0A%0A%09keywordMessage%20%3A%3D%20%28ws%2C%20keywordPair%29%20plus%0A%09%09%3D%3D%3E%20%5B%3Anodes%20%7C%0A%09%09%20%20%20%20SendNode%20new%0A%09%09%09selector%3A%20%28%28nodes%20collect%3A%20%5B%3Aeach%20%7C%20each%20second%20first%5D%29%20join%3A%20%27%27%29%3B%0A%09%09%09arguments%3A%20%28nodes%20collect%3A%20%5B%3Aeach%20%7C%20each%20second%20third%5D%29%5D.%0A%0A%09keywordSend%20%3A%3D%20binarySend%2C%20keywordMessage%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%0A%09%09%20%20%20%20node%20second%20valueForReceiver%3A%20node%20first%5D.%0A%0A%09message%20%3A%3D%20binaryMessage%20/%20unaryMessage%20/%20keywordMessage.%0A%0A%09cascade%20%3A%3D%20%28keywordSend%20/%20binarySend%29%2C%20%28ws%2C%20%27%3B%27%20asParser%2C%20message%29%20plus%0A%09%09%3D%3D%3E%20%5B%3Anode%20%7C%0A%09%09%20%20%20%20node%20first%20cascadeNodeWithMessages%3A%20%0A%09%09%09%28node%20second%20collect%3A%20%5B%3Aeach%20%7C%20each%20third%5D%29%5D.%0A%0A%09jsStatement%20%3A%3D%20%27%7B%27%20asParser%2C%20ws%2C%20string%2C%20ws%2C%20%27%7D%27%20asParser%0A%09%20%20%20%20%3D%3D%3E%20%5B%3Anode%20%7C%20JSStatementNode%20new%0A%09%09%09%20%20%20%20%20source%3A%20node%20third%3B%0A%09%09%09%20%20%20%20%20yourself%5D.%0A%0A%09expression%20parser%3A%20assignment%20/%20cascade%20/%20keywordSend%20/%20binarySend%20/%20jsStatement.%0A%0A%09method%20%3A%3D%20%28ws%2C%20%28keywordPattern%20/%20binaryPattern%20/%20unaryPattern%29%2C%20ws%2C%20sequence%20optional%2C%20ws%29%20withSource%0A%09%20%20%20%20%3D%3D%3E%20%5B%3Anode%20%7C%0A%09%09MethodNode%20new%0A%09%09%20%20%20%20selector%3A%20node%20first%20second%20first%3B%0A%09%09%20%20%20%20arguments%3A%20node%20first%20second%20second%3B%0A%09%09%20%20%20%20addNode%3A%20node%20first%20fourth%3B%0A%09%09%20%20%20%20source%3A%20node%20second%3B%0A%09%09%20%20%20%20yourself%5D.%0A%09%0A%09%5Emethod%2C%20PPEOFParser%20new%20%3D%3D%3E%20%5B%3Anode%20%7C%20node%20first%5D%0A')}),
  807. smalltalk.SmalltalkParser);
  808. smalltalk.addMethod(
  809. '_parse_',
  810. smalltalk.method({
  811. selector: 'parse:',
  812. category: 'instance creation',
  813. fn: function (aStream){
  814. var self=this;
  815. return smalltalk.send(smalltalk.send(self, "_new", []), "_parse_", [aStream]);
  816. return self;},
  817. source: unescape('parse%3A%20aStream%0A%09%20%20%20%20%5Eself%20new%0A%09%09parse%3A%20aStream%0A')}),
  818. smalltalk.SmalltalkParser.klass);
  819. smalltalk.addClass('Chunk', smalltalk.Object, ['contents'], 'Parser');
  820. smalltalk.addMethod(
  821. '_contents',
  822. smalltalk.method({
  823. selector: 'contents',
  824. category: 'accessing',
  825. fn: function (){
  826. var self=this;
  827. return smalltalk.send(self['@contents'], "_ifNil_", [(function(){return "";})]);
  828. return self;},
  829. source: unescape('contents%0A%09%5Econtents%20ifNil%3A%20%5B%27%27%5D%0A')}),
  830. smalltalk.Chunk);
  831. smalltalk.addMethod(
  832. '_contents_',
  833. smalltalk.method({
  834. selector: 'contents:',
  835. category: 'accessing',
  836. fn: function (aString){
  837. var self=this;
  838. self['@contents']=aString;
  839. return self;},
  840. source: unescape('contents%3A%20aString%0A%09contents%20%3A%3D%20aString%0A')}),
  841. smalltalk.Chunk);
  842. smalltalk.addMethod(
  843. '_isEmptyChunk',
  844. smalltalk.method({
  845. selector: 'isEmptyChunk',
  846. category: 'testing',
  847. fn: function (){
  848. var self=this;
  849. return false;
  850. return self;},
  851. source: unescape('isEmptyChunk%0A%09%5Efalse%0A')}),
  852. smalltalk.Chunk);
  853. smalltalk.addMethod(
  854. '_isInstructionChunk',
  855. smalltalk.method({
  856. selector: 'isInstructionChunk',
  857. category: 'testing',
  858. fn: function (){
  859. var self=this;
  860. return false;
  861. return self;},
  862. source: unescape('isInstructionChunk%0A%09%5Efalse%0A')}),
  863. smalltalk.Chunk);
  864. smalltalk.addClass('InstructionChunk', smalltalk.Chunk, [], 'Parser');
  865. smalltalk.addMethod(
  866. '_isInstructionChunk',
  867. smalltalk.method({
  868. selector: 'isInstructionChunk',
  869. category: 'testing',
  870. fn: function (){
  871. var self=this;
  872. return true;
  873. return self;},
  874. source: unescape('isInstructionChunk%0A%09%5Etrue%0A')}),
  875. smalltalk.InstructionChunk);
  876. smalltalk.addClass('EmptyChunk', smalltalk.Chunk, [], 'Parser');
  877. smalltalk.addMethod(
  878. '_isEmptyChunk',
  879. smalltalk.method({
  880. selector: 'isEmptyChunk',
  881. category: 'testing',
  882. fn: function (){
  883. var self=this;
  884. return true;
  885. return self;},
  886. source: unescape('isEmptyChunk%0A%09%5Etrue%0A')}),
  887. smalltalk.EmptyChunk);
  888. smalltalk.addClass('ChunkParser', smalltalk.Object, ['parser', 'separator', 'eof', 'ws', 'chunk', 'emptyChunk', 'instructionChunk'], 'Parser');
  889. smalltalk.addMethod(
  890. '_parser',
  891. smalltalk.method({
  892. selector: 'parser',
  893. category: 'accessing',
  894. fn: function (){
  895. var self=this;
  896. return smalltalk.send(self['@parser'], "_ifNil_", [(function(){return self['@parser']=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_instructionChunk", []), "__slash", [smalltalk.send(self, "_emptyChunk", [])]), "__slash", [smalltalk.send(self, "_chunk", [])]), "__slash", [smalltalk.send(self, "_eof", [])]);})]);
  897. return self;},
  898. source: unescape('parser%0A%09%5Eparser%20ifNil%3A%20%5B%0A%09%20%20%20%20parser%20%3A%3D%20self%20instructionChunk%20/%20self%20emptyChunk%20/%20self%20chunk%20/%20self%20eof%5D%0A')}),
  899. smalltalk.ChunkParser);
  900. smalltalk.addMethod(
  901. '_eof',
  902. smalltalk.method({
  903. selector: 'eof',
  904. category: 'accessing',
  905. fn: function (){
  906. var self=this;
  907. return smalltalk.send(self['@eof'], "_ifNil_", [(function(){return self['@eof']=smalltalk.send(smalltalk.send(smalltalk.send(self, "_ws", []), "__comma", [smalltalk.send(smalltalk.PPEOFParser, "_new", [])]), "__eq_eq_gt", [(function(node){return nil;})]);})]);
  908. return self;},
  909. source: unescape('eof%0A%09%5Eeof%20ifNil%3A%20%5Beof%20%3A%3D%20self%20ws%2C%20PPEOFParser%20new%20%3D%3D%3E%20%5B%3Anode%20%7C%20nil%5D%5D%0A')}),
  910. smalltalk.ChunkParser);
  911. smalltalk.addMethod(
  912. '_separator',
  913. smalltalk.method({
  914. selector: 'separator',
  915. category: 'accessing',
  916. fn: function (){
  917. var self=this;
  918. return smalltalk.send(self['@separator'], "_ifNil_", [(function(){return self['@separator']=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.String, "_cr", []), "__comma", [smalltalk.send(smalltalk.String, "_space", [])]), "__comma", [smalltalk.send(smalltalk.String, "_lf", [])]), "__comma", [smalltalk.send(smalltalk.String, "_tab", [])]), "_asChoiceParser", []);})]);
  919. return self;},
  920. source: unescape('separator%0A%09%5Eseparator%20ifNil%3A%20%5Bseparator%20%3A%3D%20%28String%20cr%2C%20String%20space%2C%20String%20lf%2C%20String%20tab%29%20asChoiceParser%5D%0A')}),
  921. smalltalk.ChunkParser);
  922. smalltalk.addMethod(
  923. '_ws',
  924. smalltalk.method({
  925. selector: 'ws',
  926. category: 'accessing',
  927. fn: function (){
  928. var self=this;
  929. return smalltalk.send(self['@ws'], "_ifNil_", [(function(){return self['@ws']=smalltalk.send(smalltalk.send(self, "_separator", []), "_star", []);})]);
  930. return self;},
  931. source: unescape('ws%0A%09%5Ews%20ifNil%3A%20%5Bws%20%3A%3D%20self%20separator%20star%5D%0A')}),
  932. smalltalk.ChunkParser);
  933. smalltalk.addMethod(
  934. '_chunk',
  935. smalltalk.method({
  936. selector: 'chunk',
  937. category: 'accessing',
  938. fn: function (){
  939. var self=this;
  940. return smalltalk.send(self['@chunk'], "_ifNil_", [(function(){return self['@chunk']=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_ws", []), "__comma", [smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(unescape("%21%21"), "_asParser", []), "__slash", [smalltalk.send(smalltalk.send(smalltalk.send(unescape("%21"), "_asParser", []), "_not", []), "__comma", [smalltalk.send(smalltalk.PPAnyParser, "_new", [])])]), "_plus", []), "_flatten", [])]), "__comma", [smalltalk.send(unescape("%21"), "_asParser", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(smalltalk.Chunk, "_new", []), "_contents_", [smalltalk.send(smalltalk.send(node, "_second", []), "_replace_with_", [unescape("%21%21"), unescape("%21")])]);})]);})]);
  941. return self;},
  942. source: unescape('chunk%0A%09%5Echunk%20ifNil%3A%20%5Bchunk%20%3A%3D%20self%20ws%2C%20%28%27%21%21%27%20asParser%20/%20%28%27%21%27%20asParser%20not%2C%20PPAnyParser%20new%29%29%20plus%20flatten%2C%20%27%21%27%20asParser%20%3D%3D%3E%20%5B%3Anode%20%7C%20Chunk%20new%20contents%3A%20%28node%20second%20replace%3A%20%27%21%21%27%20with%3A%20%27%21%27%29%5D%5D%0A')}),
  943. smalltalk.ChunkParser);
  944. smalltalk.addMethod(
  945. '_emptyChunk',
  946. smalltalk.method({
  947. selector: 'emptyChunk',
  948. category: 'accessing',
  949. fn: function (){
  950. var self=this;
  951. return smalltalk.send(self['@emptyChunk'], "_ifNil_", [(function(){return self['@emptyChunk']=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_separator", []), "_plus", []), "__comma", [smalltalk.send(unescape("%21"), "_asParser", [])]), "__comma", [smalltalk.send(self, "_ws", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.EmptyChunk, "_new", []);})]);})]);
  952. return self;},
  953. source: unescape('emptyChunk%0A%09%5EemptyChunk%20ifNil%3A%20%5BemptyChunk%20%3A%3D%20self%20separator%20plus%2C%20%27%21%27%20asParser%2C%20self%20ws%20%3D%3D%3E%20%5B%3Anode%20%7C%20EmptyChunk%20new%5D%5D%0A')}),
  954. smalltalk.ChunkParser);
  955. smalltalk.addMethod(
  956. '_instructionChunk',
  957. smalltalk.method({
  958. selector: 'instructionChunk',
  959. category: '',
  960. fn: function (){
  961. var self=this;
  962. return smalltalk.send(self['@instructionChunk'], "_ifNil_", [(function(){return self['@instructionChunk']=smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(self, "_ws", []), "__comma", [smalltalk.send(unescape("%21"), "_asParser", [])]), "__comma", [smalltalk.send(self, "_chunk", [])]), "__eq_eq_gt", [(function(node){return smalltalk.send(smalltalk.send(smalltalk.InstructionChunk, "_new", []), "_contents_", [smalltalk.send(smalltalk.send(node, "_last", []), "_contents", [])]);})]);})]);
  963. return self;},
  964. source: unescape('instructionChunk%0A%09%5EinstructionChunk%20ifNil%3A%20%5B%0A%09%20%20%20%20instructionChunk%20%3A%3D%20self%20ws%2C%20%27%21%27%20asParser%2C%20self%20chunk%0A%09%20%20%20%20%3D%3D%3E%20%5B%3Anode%20%7C%20InstructionChunk%20new%20contents%3A%20node%20last%20contents%5D%5D%0A')}),
  965. smalltalk.ChunkParser);
  966. smalltalk.addClass('Importer', smalltalk.Object, ['chunkParser'], 'Parser');
  967. smalltalk.addMethod(
  968. '_chunkParser',
  969. smalltalk.method({
  970. selector: 'chunkParser',
  971. category: 'accessing',
  972. fn: function (){
  973. var self=this;
  974. return smalltalk.send(self['@chunkParser'], "_ifNil_", [(function(){return self['@chunkParser']=smalltalk.send(smalltalk.send(smalltalk.ChunkParser, "_new", []), "_parser", []);})]);
  975. return self;},
  976. source: unescape('chunkParser%0A%09%5EchunkParser%20ifNil%3A%20%5BchunkParser%20%3A%3D%20ChunkParser%20new%20parser%5D%0A')}),
  977. smalltalk.Importer);
  978. smalltalk.addMethod(
  979. '_import_',
  980. smalltalk.method({
  981. selector: 'import:',
  982. category: 'fileIn',
  983. fn: function (aStream){
  984. var self=this;
  985. smalltalk.send(smalltalk.send(aStream, "_atEnd", []), "_ifFalse_", [(function(){var nextChunk=nil;
  986. nextChunk=smalltalk.send(smalltalk.send(self, "_chunkParser", []), "_parse_", [aStream]);return smalltalk.send(nextChunk, "_ifNotNil_", [(function(){smalltalk.send(smalltalk.send(nextChunk, "_isInstructionChunk", []), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Compiler, "_new", []), "_loadExpression_", [smalltalk.send(nextChunk, "_contents", [])]), "_scanFrom_", [aStream]);}), (function(){return smalltalk.send(smalltalk.send(smalltalk.Compiler, "_new", []), "_loadExpression_", [smalltalk.send(nextChunk, "_contents", [])]);})]);return smalltalk.send(self, "_import_", [aStream]);})]);})]);
  987. return self;},
  988. source: unescape('import%3A%20aStream%0A%09aStream%20atEnd%20ifFalse%3A%20%5B%0A%09%20%20%20%20%7C%20nextChunk%20%7C%0A%09%20%20%20%20nextChunk%20%3A%3D%20self%20chunkParser%20parse%3A%20aStream.%0A%09%20%20%20%20nextChunk%20ifNotNil%3A%20%5B%0A%09%09nextChunk%20isInstructionChunk%20%0A%09%09%20%20%20%20ifTrue%3A%20%5B%28Compiler%20new%20loadExpression%3A%20nextChunk%20contents%29%0A%09%09%09%09%09%20scanFrom%3A%20aStream%5D%0A%09%09%20%20%20%20ifFalse%3A%20%5BCompiler%20new%20loadExpression%3A%20nextChunk%20contents%5D.%0A%09%09self%20import%3A%20aStream%5D%5D%0A')}),
  989. smalltalk.Importer);
  990. smalltalk.addClass('Exporter', smalltalk.Object, [], 'Parser');
  991. smalltalk.addMethod(
  992. '_exportCategory_',
  993. smalltalk.method({
  994. selector: 'exportCategory:',
  995. category: 'fileOut',
  996. fn: function (aString){
  997. var self=this;
  998. var stream=nil;
  999. stream=smalltalk.send("", "_writeStream", []);
  1000. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Smalltalk, "_current", []), "_classes", []), "_select_", [(function(each){return smalltalk.send(smalltalk.send(each, "_category", []), "__eq", [aString]);})]), "_do_", [(function(each){return smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(self, "_export_", [each])]);})]);
  1001. return smalltalk.send(stream, "_contents", []);
  1002. return self;},
  1003. source: unescape('exportCategory%3A%20aString%0A%09%7C%20stream%20%7C%0A%09stream%20%3A%3D%20%27%27%20writeStream.%0A%09%28Smalltalk%20current%20classes%20%0A%09%20%20%20%20select%3A%20%5B%3Aeach%20%7C%20each%20category%20%3D%20aString%5D%29%0A%09%20%20%20%20do%3A%20%5B%3Aeach%20%7C%20stream%20nextPutAll%3A%20%28self%20export%3A%20each%29%5D.%0A%09%5Estream%20contents%0A')}),
  1004. smalltalk.Exporter);
  1005. smalltalk.addMethod(
  1006. '_export_',
  1007. smalltalk.method({
  1008. selector: 'export:',
  1009. category: 'fileOut',
  1010. fn: function (aClass){
  1011. var self=this;
  1012. var stream=nil;
  1013. stream=smalltalk.send("", "_writeStream", []);
  1014. smalltalk.send(self, "_exportDefinitionOf_on_", [aClass, stream]);
  1015. smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(smalltalk.String, "_cr", [])]);
  1016. smalltalk.send(self, "_exportMethodsOf_on_", [aClass, stream]);
  1017. smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(smalltalk.String, "_cr", [])]);
  1018. smalltalk.send(self, "_exportMetaDefinitionOf_on_", [aClass, stream]);
  1019. smalltalk.send(self, "_exportMethodsOf_on_", [smalltalk.send(aClass, "_class", []), stream]);
  1020. smalltalk.send(stream, "_nextPutAll_", [smalltalk.send(smalltalk.String, "_cr", [])]);
  1021. return smalltalk.send(stream, "_contents", []);
  1022. return self;},
  1023. source: unescape('export%3A%20aClass%0A%09%7C%20stream%20%7C%0A%09stream%20%3A%3D%20%27%27%20writeStream.%0A%09self%20exportDefinitionOf%3A%20aClass%20on%3A%20stream.%0A%09stream%20nextPutAll%3A%20String%20cr.%0A%09self%20exportMethodsOf%3A%20aClass%20on%3A%20stream.%0A%09stream%20nextPutAll%3A%20String%20cr.%0A%09self%20exportMetaDefinitionOf%3A%20aClass%20on%3A%20stream.%0A%09self%20exportMethodsOf%3A%20aClass%20class%20on%3A%20stream.%0A%09stream%20nextPutAll%3A%20String%20cr.%0A%09%5Estream%20contents%0A')}),
  1024. smalltalk.Exporter);
  1025. smalltalk.addMethod(
  1026. '_exportDefinitionOf_on_',
  1027. smalltalk.method({
  1028. selector: 'exportDefinitionOf:on:',
  1029. category: 'private',
  1030. fn: function (aClass, aStream){
  1031. var self=this;
  1032. (function($rec){smalltalk.send($rec, "_nextPutAll_", [unescape("smalltalk.addClass%28")]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(unescape("%27"), "__comma", [smalltalk.send(self, "_classNameFor_", [aClass])]), "__comma", [unescape("%27%2C%20")])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send("smalltalk.", "__comma", [smalltalk.send(self, "_classNameFor_", [smalltalk.send(aClass, "_superclass", [])])])]);return smalltalk.send($rec, "_nextPutAll_", [unescape("%2C%20%5B")]);})(aStream);
  1033. smalltalk.send(smalltalk.send(aClass, "_instanceVariableNames", []), "_do_separatedBy_", [(function(each){return smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(smalltalk.send(unescape("%27"), "__comma", [each]), "__comma", [unescape("%27")])]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [unescape("%2C%20")]);})]);
  1034. (function($rec){smalltalk.send($rec, "_nextPutAll_", [unescape("%5D%2C%20%27")]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(aClass, "_category", []), "__comma", [unescape("%27")])]);return smalltalk.send($rec, "_nextPutAll_", [unescape("%29%3B")]);})(aStream);
  1035. smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_comment", []), "_notEmpty", []), "_ifTrue_", [(function(){return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.String, "_cr", [])]);smalltalk.send($rec, "_nextPutAll_", ["smalltalk."]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(self, "_classNameFor_", [aClass])]);smalltalk.send($rec, "_nextPutAll_", [unescape(".comment%3D")]);return smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(unescape("unescape%28%27"), "__comma", [smalltalk.send(smalltalk.send(aClass, "_comment", []), "_escaped", [])]), "__comma", [unescape("%27%29")])]);})(aStream);})]);
  1036. return self;},
  1037. source: unescape('exportDefinitionOf%3A%20aClass%20on%3A%20aStream%0A%09aStream%20%0A%09%20%20%20%20nextPutAll%3A%20%27smalltalk.addClass%28%27%3B%0A%09%20%20%20%20nextPutAll%3A%20%27%27%27%27%2C%20%28self%20classNameFor%3A%20aClass%29%2C%20%27%27%27%2C%20%27%3B%0A%09%20%20%20%20nextPutAll%3A%20%27smalltalk.%27%2C%20%28self%20classNameFor%3A%20aClass%20superclass%29%3B%0A%09%20%20%20%20nextPutAll%3A%20%27%2C%20%5B%27.%0A%09aClass%20instanceVariableNames%20%0A%09%20%20%20%20do%3A%20%5B%3Aeach%20%7C%20aStream%20nextPutAll%3A%20%27%27%27%27%2C%20each%2C%20%27%27%27%27%5D%0A%09%20%20%20%20separatedBy%3A%20%5BaStream%20nextPutAll%3A%20%27%2C%20%27%5D.%0A%09aStream%09%0A%09%20%20%20%20nextPutAll%3A%20%27%5D%2C%20%27%27%27%3B%0A%09%20%20%20%20nextPutAll%3A%20aClass%20category%2C%20%27%27%27%27%3B%0A%09%20%20%20%20nextPutAll%3A%20%27%29%3B%27.%0A%09aClass%20comment%20notEmpty%20ifTrue%3A%20%5B%0A%09%20%20%20%20aStream%20%0A%09%20%20%20%20%09nextPutAll%3A%20String%20cr%3B%0A%09%09nextPutAll%3A%20%27smalltalk.%27%3B%0A%09%09nextPutAll%3A%20%28self%20classNameFor%3A%20aClass%29%3B%0A%09%09nextPutAll%3A%20%27.comment%3D%27%3B%0A%09%09nextPutAll%3A%20%27unescape%28%27%27%27%2C%20aClass%20comment%20escaped%2C%20%27%27%27%29%27%5D%0A')}),
  1038. smalltalk.Exporter);
  1039. smalltalk.addMethod(
  1040. '_exportMetaDefinitionOf_on_',
  1041. smalltalk.method({
  1042. selector: 'exportMetaDefinitionOf:on:',
  1043. category: 'private',
  1044. fn: function (aClass, aStream){
  1045. var self=this;
  1046. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_instanceVariableNames", []), "_isEmpty", []), "_ifFalse_", [(function(){(function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send("smalltalk.", "__comma", [smalltalk.send(self, "_classNameFor_", [smalltalk.send(aClass, "_class", [])])])]);return smalltalk.send($rec, "_nextPutAll_", [unescape(".iVarNames%20%3D%20%5B")]);})(aStream);smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_class", []), "_instanceVariableNames", []), "_do_separatedBy_", [(function(each){return smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(smalltalk.send(unescape("%27"), "__comma", [each]), "__comma", [unescape("%27")])]);}), (function(){return smalltalk.send(aStream, "_nextPutAll_", [unescape("%2C")]);})]);return smalltalk.send(aStream, "_nextPutAll_", [smalltalk.send(unescape("%5D%3B"), "__comma", [smalltalk.send(smalltalk.String, "_cr", [])])]);})]);
  1047. return self;},
  1048. source: unescape('exportMetaDefinitionOf%3A%20aClass%20on%3A%20aStream%0A%09aClass%20class%20instanceVariableNames%20isEmpty%20ifFalse%3A%20%5B%0A%09%20%20%20%20aStream%20%0A%09%09nextPutAll%3A%20%27smalltalk.%27%2C%20%28self%20classNameFor%3A%20aClass%20class%29%3B%0A%09%09nextPutAll%3A%20%27.iVarNames%20%3D%20%5B%27.%0A%09%20%20%20%20aClass%20class%20instanceVariableNames%0A%09%09do%3A%20%5B%3Aeach%20%7C%20aStream%20nextPutAll%3A%20%27%27%27%27%2C%20each%2C%20%27%27%27%27%5D%0A%09%09separatedBy%3A%20%5BaStream%20nextPutAll%3A%20%27%2C%27%5D.%0A%09%20%20%20%20aStream%20nextPutAll%3A%20%27%5D%3B%27%2C%20String%20cr%5D%0A')}),
  1049. smalltalk.Exporter);
  1050. smalltalk.addMethod(
  1051. '_exportMethodsOf_on_',
  1052. smalltalk.method({
  1053. selector: 'exportMethodsOf:on:',
  1054. category: 'private',
  1055. fn: function (aClass, aStream){
  1056. var self=this;
  1057. smalltalk.send(smalltalk.send(aClass, "_methodDictionary", []), "_keysAndValuesDo_", [(function(key, value){return (function($rec){smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(unescape("smalltalk.addMethod%28"), "__comma", [smalltalk.send(smalltalk.String, "_cr", [])])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(unescape("%27"), "__comma", [smalltalk.send(smalltalk.send(value, "_selector", []), "_asSelector", [])]), "__comma", [unescape("%27%2C")]), "__comma", [smalltalk.send(smalltalk.String, "_cr", [])])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(unescape("smalltalk.method%28%7B"), "__comma", [smalltalk.send(smalltalk.String, "_cr", [])])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(unescape("selector%3A%20%27"), "__comma", [smalltalk.send(value, "_selector", [])]), "__comma", [unescape("%27%2C")]), "__comma", [smalltalk.send(smalltalk.String, "_cr", [])])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send(unescape("category%3A%20%27"), "__comma", [smalltalk.send(value, "_category", [])]), "__comma", [unescape("%27%2C")]), "__comma", [smalltalk.send(smalltalk.String, "_cr", [])])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(smalltalk.send("fn: ", "__comma", [smalltalk.send(smalltalk.send(value, "_fn", []), "_compiledSource", [])]), "__comma", [unescape("%2C")]), "__comma", [smalltalk.send(smalltalk.String, "_cr", [])])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(unescape("source%3A%20unescape%28%27"), "__comma", [smalltalk.send(smalltalk.send(value, "_source", []), "_escaped", [])]), "__comma", [unescape("%27%29")])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(unescape("%7D%29%2C"), "__comma", [smalltalk.send(smalltalk.String, "_cr", [])])]);smalltalk.send($rec, "_nextPutAll_", [smalltalk.send("smalltalk.", "__comma", [smalltalk.send(self, "_classNameFor_", [aClass])])]);return smalltalk.send($rec, "_nextPutAll_", [smalltalk.send(smalltalk.send(unescape("%29%3B"), "__comma", [smalltalk.send(smalltalk.String, "_cr", [])]), "__comma", [smalltalk.send(smalltalk.String, "_cr", [])])]);})(aStream);})]);
  1058. return self;},
  1059. source: unescape('exportMethodsOf%3A%20aClass%20on%3A%20aStream%0A%09aClass%20methodDictionary%20keysAndValuesDo%3A%20%5B%3Akey%20%3Avalue%20%7C%0A%09%20%20%20%20aStream%20%0A%09%09nextPutAll%3A%20%27smalltalk.addMethod%28%27%2C%20String%20cr%3B%0A%09%09nextPutAll%3A%20%27%27%27%27%2C%20value%20selector%20asSelector%2C%20%27%27%27%2C%27%2C%20String%20cr%3B%0A%09%09nextPutAll%3A%20%27smalltalk.method%28%7B%27%2C%20String%20cr%3B%0A%09%09nextPutAll%3A%20%27selector%3A%20%27%27%27%2C%20value%20selector%2C%20%27%27%27%2C%27%2C%20String%20cr%3B%0A%09%09nextPutAll%3A%20%27category%3A%20%27%27%27%2C%20value%20category%2C%20%27%27%27%2C%27%2C%20String%20cr%3B%0A%09%09nextPutAll%3A%20%27fn%3A%20%27%2C%20value%20fn%20compiledSource%2C%20%27%2C%27%2C%20String%20cr%3B%0A%09%09nextPutAll%3A%20%27source%3A%20unescape%28%27%27%27%2C%20value%20source%20escaped%2C%20%27%27%27%29%27%3B%0A%09%09nextPutAll%3A%20%27%7D%29%2C%27%2C%20String%20cr%3B%0A%09%09nextPutAll%3A%20%27smalltalk.%27%2C%20%28self%20classNameFor%3A%20aClass%29%3B%0A%09%09nextPutAll%3A%20%27%29%3B%27%2C%20String%20cr%2C%20String%20cr%5D%0A')}),
  1060. smalltalk.Exporter);
  1061. smalltalk.addMethod(
  1062. '_classNameFor_',
  1063. smalltalk.method({
  1064. selector: 'classNameFor:',
  1065. category: 'private',
  1066. fn: function (aClass){
  1067. var self=this;
  1068. return smalltalk.send(smalltalk.send(aClass, "_isMetaclass", []), "_ifTrue_ifFalse_", [(function(){return smalltalk.send(smalltalk.send(smalltalk.send(aClass, "_instanceClass", []), "_name", []), "__comma", [".klass"]);}), (function(){return smalltalk.send(smalltalk.send(aClass, "_isNil", []), "_ifTrue_ifFalse_", [(function(){return "nil";}), (function(){return smalltalk.send(aClass, "_name", []);})]);})]);
  1069. return self;},
  1070. source: unescape('classNameFor%3A%20aClass%0A%09%5EaClass%20isMetaclass%0A%09%20%20%20%20ifTrue%3A%20%5BaClass%20instanceClass%20name%2C%20%27.klass%27%5D%0A%09%20%20%20%20ifFalse%3A%20%5B%0A%09%09aClass%20isNil%0A%09%09%20%20%20%20ifTrue%3A%20%5B%27nil%27%5D%0A%09%09%20%20%20%20ifFalse%3A%20%5BaClass%20name%5D%5D%0A')}),
  1071. smalltalk.Exporter);
  1072. smalltalk.addMethod(
  1073. '_exportAll',
  1074. smalltalk.method({
  1075. selector: 'exportAll',
  1076. category: 'fileOut',
  1077. fn: function (){
  1078. var self=this;
  1079. var categories=nil;
  1080. categories=smalltalk.send(smalltalk.Array, "_new", []);
  1081. smalltalk.send(smalltalk.send(smalltalk.send(smalltalk.Smalltalk, "_current", []), "_classes", []), "_do_", [(function(each){return smalltalk.send(smalltalk.send(categories, "_includes_", [smalltalk.send(each, "_category", [])]), "_ifFalse_", [(function(){return smalltalk.send(categories, "_add_", [smalltalk.send(each, "_category", [])]);})]);})]);
  1082. smalltalk.send(categories, "_do_", [(function(each){return smalltalk.send(self, "_exportCategory_", [each]);})]);
  1083. return self;},
  1084. source: unescape('exportAll%0A%20%20%20%20%7C%20categories%20%7C%0A%20%20%20%20categories%20%3A%3D%20Array%20new.%0A%20%20%20%20Smalltalk%20current%20classes%20do%3A%20%5B%3Aeach%20%7C%0A%09%28categories%20includes%3A%20each%20category%29%20ifFalse%3A%20%5B%0A%09%20%20%20%20categories%20add%3A%20each%20category%5D%5D.%0A%09categories%20do%3A%20%5B%3Aeach%20%7C%0A%09%09self%20exportCategory%3A%20each%5D')}),
  1085. smalltalk.Exporter);