Prexonite, a .NET hosted scripting language with a focus on meta-programming and embedded DSLs
0

Configure Feed

Select the types of activity you want to include in your feed.

Port test + test/meta_macro.pxs to Prx2

This also overhauls the test plugin registration so that
plugins no longer need to be declared but can be discovered
automatically. The plugin still needs to be part of the application compound.

Also:
* apply IDE suggestions to MetaEntry.cs

Christian Klauser (Dec 28, 2020, 9:54 PM +0100) d728d1b2 6491380a

+197 -203
+1 -1
Prexonite/Application.cs
··· 80 80 public const string InitializationGeneration = InitializationId; 81 81 82 82 /// <summary> 83 - /// Meta table key used for stroing the offset in the initialization function where 83 + /// Meta table key used for storing the offset in the initialization function where 84 84 /// execution should continue to complete initialization. 85 85 /// </summary> 86 86 [Obsolete("Prexonite no longer stores the initialization offset in a meta table.")]
+2 -1
Prexonite/Compiler/Prexonite.lex
··· 226 226 "@" { return tok(Parser._at); } 227 227 ">>" { return tok(Parser._appendright); } 228 228 "<<" { return tok(Parser._appendleft); } 229 + "!" { return tok(Parser._not); } 229 230 230 - .|\n { Console.WriteLine("Rogue Character: \"{0}\"", yytext()); } 231 + .|\n { throw new PrexoniteException(System.String.Format("Invalid character \"{0}\" detected on line {1} in {2}.", yytext(), yyline, File)); } 231 232 } 232 233 233 234 <String> {
+90 -132
Prexonite/Helper/MetaEntry.cs
··· 1 - // Prexonite 2 - // 3 - // Copyright (c) 2014, Christian Klauser 4 - // All rights reserved. 5 - // 6 - // Redistribution and use in source and binary forms, with or without modification, 7 - // are permitted provided that the following conditions are met: 8 - // 9 - // Redistributions of source code must retain the above copyright notice, 10 - // this list of conditions and the following disclaimer. 11 - // Redistributions in binary form must reproduce the above copyright notice, 12 - // this list of conditions and the following disclaimer in the 13 - // documentation and/or other materials provided with the distribution. 14 - // The names of the contributors may be used to endorse or 15 - // promote products derived from this software without specific prior written permission. 16 - // 17 - // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 - // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 - // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 - // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 21 - // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 - // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 - // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 - // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 - // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 1 + #nullable enable 26 2 using System; 27 3 using System.Collections.Generic; 28 4 using System.Diagnostics; 29 5 using System.Globalization; 6 + using System.Linq; 30 7 using System.Text; 8 + using JetBrains.Annotations; 31 9 using Prexonite.Types; 32 10 33 11 namespace Prexonite ··· 42 20 /// </summary> 43 21 public enum Type 44 22 { 45 - Invalid = 0, 46 - Text = 1, 23 + Text = 0, 47 24 List = 2, 48 25 Switch = 3 49 26 } ··· 51 28 /// <summary> 52 29 /// Holds a list in case the meta entry is a list entry 53 30 /// </summary> 54 - private readonly MetaEntry[] _list; 55 - 56 - /// <summary> 57 - /// Indicates the kind of meta entry 58 - /// </summary> 59 - private readonly Type _mtype; 31 + private readonly MetaEntry[]? _list; 60 32 61 33 /// <summary> 62 34 /// Holds a switch in case the meta entry is a switch entry ··· 66 38 /// <summary> 67 39 /// Holds text in case the meta entry is a text entry 68 40 /// </summary> 69 - private readonly string _text; 41 + private readonly string? _text; 42 + 43 + private static readonly MetaEntry[] EmptyList = new MetaEntry[0]; 70 44 71 45 #endregion 72 46 ··· 77 51 [DebuggerNonUserCode] 78 52 get 79 53 { 80 - switch (_mtype) 54 + switch (EntryType) 81 55 { 82 56 case Type.Text: 83 - return _text; 57 + return _text ?? ""; 84 58 case Type.Switch: 85 59 return _switch.ToString(); 86 60 case Type.List: ··· 107 81 [DebuggerNonUserCode] 108 82 get 109 83 { 110 - switch (_mtype) 84 + return EntryType switch 111 85 { 112 - case Type.List: 113 - return _list; 114 - case Type.Switch: 115 - return new MetaEntry[] {_switch}; 116 - case Type.Text: 117 - return new MetaEntry[] {_text}; 118 - default: 119 - throw new PrexoniteException("Unknown type in meta entry"); 120 - } 86 + Type.List => _list ?? EmptyList, 87 + Type.Switch => new MetaEntry[] {_switch}, 88 + Type.Text => string.IsNullOrEmpty(_text) ? EmptyList : new MetaEntry[] {_text ?? ""}, 89 + _ => throw new PrexoniteException("Unknown type in meta entry") 90 + }; 121 91 } 122 92 } 123 93 ··· 126 96 [DebuggerNonUserCode] 127 97 get 128 98 { 129 - switch (_mtype) 99 + switch (EntryType) 130 100 { 131 101 case Type.Text: 132 - bool sw; 133 - return bool.TryParse(_text, out sw) ? sw : false; 102 + return bool.TryParse(_text, out var sw) && sw; 134 103 case Type.Switch: 135 104 return _switch; 136 105 case Type.List: ··· 148 117 [DebuggerNonUserCode] 149 118 public MetaEntry(string text) 150 119 { 151 - if (text == null) 152 - throw new ArgumentNullException(nameof(text)); 153 - _mtype = Type.Text; 120 + EntryType = Type.Text; 154 121 _list = null; 155 122 _switch = false; 156 - _text = text; 123 + _text = text ?? throw new ArgumentNullException(nameof(text)); 157 124 } 158 125 159 126 [DebuggerNonUserCode] ··· 162 129 //Check sanity 163 130 if (list == null) 164 131 throw new ArgumentNullException(nameof(list)); 165 - foreach (var entry in list) 132 + if (list.Any(entry => entry == null)) 166 133 { 167 - if (entry == null) 168 - throw new ArgumentException( 169 - "A MetaEntry list must not contain null references.", nameof(list)); 134 + throw new ArgumentException( 135 + "A MetaEntry list must not contain null references.", nameof(list)); 170 136 } 171 - _mtype = Type.List; 137 + EntryType = Type.List; 172 138 _text = null; 173 139 _switch = false; 174 140 _list = list; 175 141 } 176 142 143 + [PublicAPI] 177 144 [DebuggerNonUserCode] 178 145 public MetaEntry(bool @switch) 179 146 { 180 - _mtype = Type.Switch; 147 + EntryType = Type.Switch; 181 148 _text = null; 182 149 _list = null; 183 150 _switch = @switch; ··· 187 154 188 155 #region Properties 189 156 190 - public Type EntryType 191 - { 192 - [DebuggerNonUserCode] 193 - get { return _mtype; } 194 - } 157 + /// <summary> 158 + /// Indicates the kind of meta entry 159 + /// </summary> 160 + public Type EntryType { get; } 195 161 196 - public bool IsText 197 - { 198 - [DebuggerNonUserCode] 199 - get { return _mtype == Type.Text; } 200 - } 162 + public bool IsText => EntryType == Type.Text; 201 163 202 - public bool IsList 203 - { 204 - [DebuggerNonUserCode] 205 - get { return _mtype == Type.List; } 206 - } 164 + public bool IsList => EntryType == Type.List; 207 165 208 - public bool IsSwitch 209 - { 210 - [DebuggerNonUserCode] 211 - get { return _mtype == Type.Switch; } 212 - } 166 + public bool IsSwitch => EntryType == Type.Switch; 213 167 214 168 #endregion 215 169 ··· 271 225 if (item == null) 272 226 throw new ArgumentNullException(nameof(item), 273 227 "A null reference cannot be implicitly converted to a meta entry."); 274 - switch (item._mtype) 228 + switch (item.EntryType) 275 229 { 276 230 case Type.Text: 277 231 return PType.String.CreatePValue(item._text); 278 232 case Type.Switch: 279 233 return PType.Bool.CreatePValue(item._switch); 280 234 case Type.List: 281 - var lst = new List<PValue>(item._list.Length); 282 - foreach (var entry in item._list) 283 - lst.Add(entry); 235 + List<PValue> lst; 236 + if (item._list != null) 237 + { 238 + lst = new List<PValue>(item._list.Length); 239 + foreach (var entry in item._list) 240 + lst.Add(entry); 241 + } 242 + else 243 + { 244 + lst = new List<PValue>(0); 245 + } 284 246 return PType.List.CreatePValue(lst); 285 247 default: 286 248 throw new PrexoniteException( ··· 288 250 } 289 251 } 290 252 291 - public static bool operator ==(MetaEntry a, MetaEntry b) 253 + public static bool operator ==(MetaEntry? a, MetaEntry? b) 292 254 { 293 - if ((object) a == null && (object) b == null) 255 + if (ReferenceEquals(a,null) && ReferenceEquals(b,null)) 294 256 return true; 295 - else if ((object) a == null || (object) b == null) 257 + else if (ReferenceEquals(a,null) || ReferenceEquals(b,null)) 296 258 return false; 297 259 else 298 260 { ··· 326 288 } 327 289 } 328 290 329 - public static bool operator !=(MetaEntry a, MetaEntry b) 291 + public static bool operator !=(MetaEntry? a, MetaEntry? b) 330 292 { 331 293 return !(a == b); 332 294 } 333 295 334 - public override bool Equals(object obj) 296 + public override bool Equals(object? obj) 335 297 { 336 298 if (obj == null) 337 299 return false; ··· 339 301 return true; 340 302 341 303 var entry = obj as MetaEntry; 342 - if (entry == null) 343 - return false; 344 - else 345 - return this == entry; 304 + return entry != null && this == entry; 346 305 } 347 306 348 307 public override int GetHashCode() 349 308 { 350 - switch (_mtype) 309 + return EntryType switch 351 310 { 352 - case Type.List: 353 - return _list.GetHashCode(); 354 - case Type.Switch: 355 - return _switch.GetHashCode(); 356 - case Type.Text: 357 - return _text.GetHashCode(); 358 - default: 359 - return -1; 360 - } 311 + Type.List => _list?.GetHashCode() ?? 0, 312 + Type.Switch => _switch.GetHashCode(), 313 + Type.Text => _text?.GetHashCode() ?? 0, 314 + _ => -1 315 + } ^ (EntryType.GetHashCode() + 23); 361 316 } 362 317 363 318 #endregion 364 319 365 320 #region Modification 366 321 322 + [PublicAPI] 367 323 public MetaEntry AddToList(params MetaEntry[] newEntries) 368 324 { 369 325 var list = _asList(); ··· 375 331 376 332 private MetaEntry[] _asList() 377 333 { 378 - MetaEntry[] list; 379 334 //Change type to list 380 - switch (_mtype) 335 + return EntryType switch 381 336 { 382 - case Type.Switch: 383 - list = new MetaEntry[] {_switch}; 384 - break; 385 - case Type.Text: 386 - list = new MetaEntry[] {_text}; 387 - break; 388 - case Type.List: 389 - list = _list; 390 - break; 391 - case Type.Invalid: 392 - default: 393 - throw new PrexoniteException("Invalid meta entry."); 394 - } 395 - return list; 337 + Type.Switch => new MetaEntry[] {_switch}, 338 + Type.Text => string.IsNullOrEmpty(_text) ? EmptyList : new MetaEntry[] {_text}, 339 + Type.List => _list ?? EmptyList, 340 + _ => throw new PrexoniteException("Invalid meta entry.") 341 + }; 396 342 } 397 343 344 + [PublicAPI] 398 345 public MetaEntry RemoveFromList(int index) 399 346 { 400 347 return RemoveFromList(index, 1); 401 348 } 402 349 350 + [PublicAPI] 403 351 public MetaEntry RemoveFromList(int index, int length) 404 352 { 405 353 MetaEntry[] list = _asList(); 406 354 if (index + length > list.Length - 1 || index < 0 || length < 0) 407 355 throw new ArgumentOutOfRangeException( 408 356 nameof(index), 409 - string.Format("The supplied index and length {0} are out of the range of 0..{1}.", index, (list.Length - 1))); 357 + $"The supplied index and length {index} are out of the range of 0..{(list.Length - 1)}."); 410 358 var newList = new MetaEntry[list.Length - 1]; 411 359 //Copy the elements before the ones to remove 412 360 if (index > 0) ··· 424 372 var proto = new List<MetaEntry>(elements.Count); 425 373 foreach (var pv in elements) 426 374 { 427 - PValue pventry; 428 - if (pv.TryConvertTo(sctx, typeof (MetaEntry), out pventry)) 429 - proto.Add((MetaEntry) pventry.Value); 430 - else if (pv.Type is ListPType) 431 - proto.Add((MetaEntry) CreateArray(sctx, (List<PValue>) pv.Value)); 432 - else if (pv.Type is BoolPType) 433 - proto.Add((bool) pv.Value); 434 - else 435 - proto.Add(pv.CallToString(sctx)); 375 + if (pv.TryConvertTo(sctx, typeof (MetaEntry), out var pvEntry)) 376 + proto.Add((MetaEntry) pvEntry.Value); 377 + else switch (pv.Type) 378 + { 379 + case ListPType _: 380 + proto.Add((MetaEntry) CreateArray(sctx, (List<PValue>) pv.Value)); 381 + break; 382 + case BoolPType _: 383 + proto.Add((bool) pv.Value); 384 + break; 385 + default: 386 + proto.Add(pv.CallToString(sctx)); 387 + break; 388 + } 436 389 } 437 390 return proto.ToArray(); 438 391 } ··· 448 401 { 449 402 if (buffer == null) 450 403 throw new ArgumentNullException(nameof(buffer)); 451 - switch (_mtype) 404 + switch (EntryType) 452 405 { 406 + case Type.List when _list == null: 407 + buffer.Append("{}"); 408 + break; 453 409 case Type.List: 454 410 buffer.Append("{"); 455 411 foreach (var entry in _list) ··· 466 422 case Type.Switch: 467 423 buffer.Append(_switch.ToString()); 468 424 break; 425 + case Type.Text when _text == null: 426 + buffer.Append("\"\""); 427 + break; 469 428 case Type.Text: 470 429 //Special case: allow integer numbers 471 - long num; 472 430 if (_text.Length <= LengthOfInt32MaxValue && _looksLikeNumber(_text) && 473 - Int64.TryParse(_text, out num)) 431 + long.TryParse(_text, out var num)) 474 432 { 475 433 var format = NumberFormatInfo.InvariantInfo; 476 434 var numStr = num.ToString(format); ··· 491 449 { 492 450 var end = Math.Min(text.Length, LengthOfInt32MaxValue); 493 451 for (var i = 0; i < end; i++) 494 - if (!Char.IsDigit(text[i])) 452 + if (!char.IsDigit(text[i])) 495 453 return false; 496 454 return true; 497 455 }
+34
Prx/psr/_2/psr/test.pxs
··· 1 + name psr::test; 2 + references { 3 + prx/1.0 4 + }; 5 + test\version "0.2"; 6 + 7 + namespace psr.test.v1 { 8 + // NOTE: test is not split up into impl and dependencies because it must not 9 + // have any dependencies. 10 + build does add("../../test.pxs"); 11 + } 12 + 13 + namespace psr.test {} export psr.test.v1( 14 + test\run_test => run_test, 15 + test\run_tests => run_tests, 16 + test\list_tests => list_tests, 17 + test\load_plugins => load_plugins 18 + ); 19 + 20 + namespace psr.test 21 + import sys(*) 22 + { 23 + function test_filters = psr.test.v1.test\test_filters >> seq.to_list; 24 + } 25 + 26 + namespace psr.test.ui {} export psr.test.v1( 27 + test\basic_ui => basic 28 + ); 29 + 30 + namespace psr.test.assertions {} export psr.test.v1( 31 + test\assert => assert, 32 + test\assert_eq => assert_eq, 33 + test\assert_neq => assert_neq 34 + );
+16
Prx/psr/_2/psr/test/meta_macro.pxs
··· 1 + name psr::test::meta_macro; 2 + references { 3 + prx/1.0 4 + }; 5 + 6 + namespace psr.test.meta_macro.v1 import psr.test.v1(*) { 7 + build does add("../../../test/meta_macro.pxs"); 8 + } 9 + 10 + namespace psr.test.meta_macro {} 11 + export psr.test.v1( 12 + test\execute_single_macro => execute_single_macro, 13 + test\run_single_macro_inspect => run_single_macro_inspect, 14 + test\run_single_macro => run_single_macro, 15 + test\macro_filter => macro_filter 16 + );
+47 -6
Prx/psr/test.pxs
··· 58 58 59 59 function trace(f,xs) 60 60 { 61 - var cargs = var args; 62 61 return coroutine () => { 63 - //println("TRACE.$(cargs >> count)(",cargs >> map(boxed(?)) >> foldl((l,r) => l + ", " + r,""),")"); 64 62 foreach(var x in xs) 65 63 { 66 - //print("ind [$(boxed(f))] of ($(boxed(x))) = "); 67 64 println(f.(x)); 68 65 yield x; 69 66 } ··· 73 70 var plugins_key = @"test\plugins"; 74 71 var app = asm(ldr.app); 75 72 println("::>>TEST-PLUGINS (",app.Compound >> count,")"); 76 - //println(all(trace(x => "->$x<-",app.Compound))); 77 73 78 74 app.Compound 79 75 >> trace(x => "comp: $(x.Module.Name)") ··· 93 89 loaded = true; 94 90 } 95 91 92 + /// test filters are functions that take a test case function and transform it, 93 + /// returning a potentially modified test function. The initialization code of test 94 + /// plugins should register their test functions. 96 95 var test\test_filters as test_filters = []; 97 96 97 + /// private; see register_test_filter 98 + /// filter~(testFunction => testFunction) 99 + function test\register_test_filter\impl(filter) { 100 + if(filter is null) 101 + return; 102 + test\test_filters[] = filter; 103 + } 104 + 105 + macro test\register_test_filter as register_test_filter(filter) 106 + { 107 + // Ensure this module is registered as a test plugin module 108 + var plugins_key = @"test\plugins"; 109 + var self_registered_key = @"test\plugins\registered_self"; 110 + var app = context.Application; 111 + if(not app.Meta[self_registered_key].Switch) { 112 + app.Meta[self_registered_key] = true~Prexonite::MetaEntry; 113 + var additional_entries = [app.Module.Name.ToMetaEntry()]~Object<"Prexonite.MetaEntry[]">; 114 + app.Meta[plugins_key] = app.Meta[plugins_key].AddToList(additional_entries); 115 + } 116 + 117 + // Emit call to register_test_filter\impl 118 + var call = context.Factory.IndirectCall(context.Invocation.Position, 119 + context.Factory.Reference(context.Invocation.Position, entityref_to(test\register_test_filter\impl)), 120 + context.Invocation.Call); 121 + var args >> each(call.Arguments.Add(?)); 122 + return call; 123 + } 124 + 125 + 126 + /// run_test(ui~Structure, testFunc~IIndirectCall) 127 + /// ui: a structure like the one returned from basic_ui; `null` means the basic ui gets used. 128 + /// testFunc: the test code 98 129 function test\run_test as run_test(ui, testFunc) 99 130 { 100 131 ui ??= basic_ui; ··· 106 137 println("::>>TEST-FILTERS"); 107 138 test_filters >> each(println("\t-> ",?)); 108 139 println("::<<END TEST-FILTERS"); 109 - testFunc = test_filters >> foldl(?1.(?0), testFunc); 140 + function create_transparent_wrapper(inner, original, filter) { 141 + var s = new Structure; 142 + s.\\("Call") = (self,id) => call\member(original, id, var args >> skip(2)); 143 + s.\\("IndirectCall") = (self) => filter.(inner, *skip(1, var args)); 144 + return s; 145 + } 146 + testFunc = test_filters >> foldl(new transparent_wrapper(?0, testFunc, ?1), testFunc); 110 147 111 148 ui.begin_running(testFunc); 112 149 var res = run_single_test(testFunc); ··· 126 163 >> where(f => tags >> forall(f.Meta[?] then ?.Switch)); 127 164 } 128 165 166 + /// run_tests(ui~Structure, testFunc~IIndirectCall) 167 + /// ui: a structure like the one returned from basic_ui 168 + /// testFunc: the test code 169 + /// run_tests(testFunc~IIndirectCall) 129 170 function test\run_tests as run_tests() 130 171 { 131 172 var args; ··· 239 280 assert(actual != expected, (if(msg.Length > 0) msg + "." else "") + "\n" + 240 281 "\tUnexpected: $(boxed(expected))\n" + 241 282 "\t Actual: $(boxed(actual))"); 242 - } 283 + }
+6 -63
Prx/psr/test/meta_macro.pxs
··· 1 - // Prexonite 2 - // 3 - // Copyright (c) 2014, Christian Klauser 4 - // All rights reserved. 5 - // 6 - // Redistribution and use in source and binary forms, with or without modification, 7 - // are permitted provided that the following conditions are met: 8 - // 9 - // Redistributions of source code must retain the above copyright notice, 10 - // this list of conditions and the following disclaimer. 11 - // Redistributions in binary form must reproduce the above copyright notice, 12 - // this list of conditions and the following disclaimer in the 13 - // documentation and/or other materials provided with the distribution. 14 - // The names of the contributors may be used to endorse or 15 - // promote products derived from this software without specific prior written permission. 16 - // 17 - // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 18 - // ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 19 - // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 - // IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 21 - // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 22 - // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 - // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 - // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 - // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 - 27 - test\plugins {}; 28 - 29 1 // This unit test plugin wraps test cases that need to be implemented as macros in infrastructure 30 2 // that executes the macro in an isolated environment. 31 - 32 - 33 - build 34 - { 35 - // If this file is loaded as a module (the preferred way), it needs to register itself in 36 - // the list of test plugins. Only that way, the test framework can trigger initialization 37 - // and thereby self-registration of test case filters. 38 - 39 - // Plugins need to add their module name to the list of test\plugins. Looks more complicated 40 - // than it is (because meta entries and arrays are involved) 41 - var app = asm(ldr.app); 42 - app.Meta[@"test\plugins"] = app.Meta[@"test\plugins"].AddToList([app.Module.Name.ToMetaEntry()]~Object<"Prexonite.MetaEntry[]">); 43 - } 44 3 45 4 function test\execute_single_macro as execute_single_macro(ldr, testMacro) 46 5 [Import {System, Prexonite, Prexonite::Types, Prexonite::Compiler, Prexonite::Compiler::Ast}] ··· 136 95 var ldr = run_single_macro_inspect(testMacro); 137 96 138 97 ldr.Warnings >> each(println(?)); 139 - if(ldr.Errors.Count > 0) 98 + if(ldr.Errors.Count > 0) { 99 + ldr.Errors >> skip(1) >> each(println(?)); 140 100 throw ldr.Errors[0].ToString; 101 + } 141 102 } 142 103 143 - function test\create_macro_function_wrapper as create_macro_function_wrapper(testMacroFunc) 144 - { 145 - var s = new Structure; 146 - s.\("self") = testMacroFunc; 147 - s.\\("Call") = (self,id) => call\member(self.self,id,var args >> skip(2)); 148 - s.\\("IndirectCall") = (self) => run_single_macro(self.self); 149 - 150 - return s; 151 - } 152 104 153 105 // This is the filter function that will be applied to each test. 154 106 // We wrap test cases that are macros in our wrapper and leave ··· 156 108 function test\macro_filter as macro_filter(testFunc) 157 109 { 158 110 if(testFunc.IsMacro) 159 - return new macro_function_wrapper(testFunc); 111 + return run_single_macro(testFunc); 160 112 else 161 113 return testFunc; 162 114 } 163 115 164 - { 165 - println(@"::>>INIT psr\test\meta_macro.pxs"); 166 - debug; 167 - 168 - // Register the filter function in the test-framework. 169 - test_filters[] = macro_filter(?); 170 - // Do remember to register this module as a test plugin if it is compiled separately. 171 - 172 - println("FILTERS ",test_filters); 173 - println(@"::<<END INIT psr\test\meta_macro.pxs"); 174 - } 116 + // Register the filter function in the test-framework. 117 + { test\register_test_filter = macro_filter(?); }
+1
prx.sln.DotSettings
··· 1 1 <wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> 2 + <s:Boolean x:Key="/Default/UserDictionary/Words/=fctx/@EntryIndexedValue">True</s:Boolean> 2 3 <s:Boolean x:Key="/Default/UserDictionary/Words/=predef/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>