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.

Convert tabs to spaces (×4)

Christian Klauser (Apr 27, 2021, 1:05 PM +0200) 5cc127ec 103dccf4

+38 -38
+38 -38
Prexonite/Compiler/Grammar/Parser.GlobalScope.atg
··· 69 69 70 70 /*---- Meta information ----*/ 71 71 72 - MetaAssignment<IHasMetaTable metaTable> (. string key = null; MetaEntry entry = null; .) 72 + MetaAssignment<IHasMetaTable metaTable> (. string key = null; MetaEntry entry = null; .) 73 73 = 74 - ( is (. entry = true; .) 75 - [not (. entry = false; .) 76 - ] 77 - GlobalId<out key> 74 + ( is (. entry = true; .) 75 + [not (. entry = false; .) 76 + ] 77 + GlobalId<out key> 78 78 | not (. entry = false; .) 79 79 GlobalId<out key> 80 80 | 81 - GlobalId<out key> 82 - ( enabled (. entry = true; .) 83 - | disabled (. entry = false; .) 84 - | MetaExpr<out entry> 85 - | (. entry = true; .) 86 - ) 81 + GlobalId<out key> 82 + ( enabled (. entry = true; .) 83 + | disabled (. entry = false; .) 84 + | MetaExpr<out entry> 85 + | (. entry = true; .) 86 + ) 87 87 | add (. MetaEntry subEntry; .) 88 88 MetaExpr<out subEntry> (. if(!subEntry.IsList) subEntry = (MetaEntry) subEntry.List; .) 89 89 to ··· 97 97 entry = subEntry; 98 98 } 99 99 .) 100 - ) (. if(entry == null || key == null) 100 + ) (. if(entry == null || key == null) 101 101 SemErr("Meta assignment did not generate an entry."); 102 102 else 103 103 metaTable.Meta[key] = entry; 104 - .) 104 + .) 105 105 . 106 106 107 107 MetaExpr<out MetaEntry entry> 108 108 (. bool sw; int i; double r; entry = null; string str; Version v; .) 109 - = 110 - Boolean<out sw> (. entry = sw; .) 111 - | Integer<out i> (. entry = i.ToString(CultureInfo.InvariantCulture); .) 112 - | Real<out r> (. entry = r.ToString(CultureInfo.InvariantCulture); .) 109 + = 110 + Boolean<out sw> (. entry = sw; .) 111 + | Integer<out i> (. entry = i.ToString(CultureInfo.InvariantCulture); .) 112 + | Real<out r> (. entry = r.ToString(CultureInfo.InvariantCulture); .) 113 113 | ( String<out str> (. entry = str; .) 114 114 | GlobalQualifiedId<out str> 115 115 (. entry = str; .) ··· 138 138 139 139 /* ---- Global variable definition --- */ 140 140 141 - GlobalVariableDefinition (. 141 + GlobalVariableDefinition (. 142 142 string id = null; 143 143 List<string> aliases = new List<string>(); 144 144 string primaryAlias = null; ··· 167 167 Symbols.Declare(alias, entry); 168 168 DefineGlobalVariable(id,out vari); 169 169 .) 170 - [ lbrack //Meta block for variables 170 + [ lbrack //Meta block for variables 171 171 [ MetaAssignment<vari> 172 - { semicolon 172 + { semicolon 173 173 [ MetaAssignment<vari> ] 174 174 } 175 175 ] ··· 177 177 ] (. if(primaryAlias != null && !_suppressPrimarySymbol(vari)) 178 178 Symbols.Declare(primaryAlias, entry); 179 179 .) 180 - [ (. _pushLexerState(LocalState); .) 180 + [ (. _pushLexerState(LocalState); .) 181 181 assign (. _PushScope(FunctionTargets[Application.InitializationId]); 182 182 AstExpr expr; 183 183 .) ··· 274 274 { comma [ DeclarationInstance2<entityFactory,module,runBuilder.Clone(),preventOverride:true> ] } 275 275 } 276 276 rbrace 277 - | lpar (. bool wasComma = false; .) 277 + | lpar (. bool wasComma = false; .) 278 278 [ MExprBasedDeclaration 279 279 { comma (. if(wasComma) 280 280 { ··· 343 343 | pointer (. builder.ReferenceTo(); .) 344 344 ) 345 345 SymbolDirective<entityFactory,module,builder,out lhsId,preventOverride:preventOverride> 346 - | IF(isSymbolDirective("INFO")) 346 + | IF(isSymbolDirective("INFO")) 347 347 id 348 348 MessageDirective<entityFactory,module,builder, out lhsId,MessageSeverity.Info,preventOverride:preventOverride> 349 - | IF(isSymbolDirective("WARN")) 349 + | IF(isSymbolDirective("WARN")) 350 350 id 351 351 MessageDirective<entityFactory,module,builder, out lhsId,MessageSeverity.Warning,preventOverride:preventOverride> 352 - | IF(isSymbolDirective("ERROR")) 352 + | IF(isSymbolDirective("ERROR")) 353 353 id 354 354 MessageDirective<entityFactory,module,builder, out lhsId,MessageSeverity.Error,preventOverride:preventOverride> 355 355 | (. ISourcePosition position = GetPosition(); .) ··· 381 381 string rhsId; 382 382 ISourcePosition position = GetPosition(); 383 383 .) 384 - = 384 + = 385 385 SymbolDirective<entityFactory,module,builder,out lhsId,preventOverride:preventOverride> 386 386 (. rhsId = lhsId; .) 387 387 [ as Id<out rhsId> ] ··· 414 414 else 415 415 { 416 416 var msg = Message.Error(string.Format(Resources.Parser_Could_not_find_previous_declaration, lhsId), 417 - position,MessageClasses.SymbolNotResolved); 417 + position,MessageClasses.SymbolNotResolved); 418 418 // We report the message AND store it as a message symbol. 419 419 // That way, the symbol is at least declared, avoiding a spurious 420 420 // symbol not found message. ··· 471 471 _pushLexerState(LocalState); 472 472 .) 473 473 474 - [ does ] 474 + [ does ] 475 475 StatementBlock<target.Ast> 476 476 477 477 (. _popLexerState(); ··· 482 482 483 483 /* ---- Global Code ---- */ 484 484 485 - GlobalCode (. PFunction func = TargetApplication._InitializationFunction; 485 + GlobalCode (. PFunction func = TargetApplication._InitializationFunction; 486 486 CompilerTarget ft = FunctionTargets[func]; 487 487 ISourcePosition position; 488 488 if(ft == null) ··· 547 547 ISourcePosition position; 548 548 bool missingArg = false; //Allow trailing comma, but not (,,) in formal arg list 549 549 .) 550 - = 550 + = 551 551 ( lazy [function] (. isLazy = true; .) 552 552 | function 553 553 | coroutine (. isCoroutine = true; .) ··· 638 638 { 639 639 if(isLazy) 640 640 ft = ct; 641 - } 641 + } 642 642 .) 643 643 [ lpar 644 - [ FormalArg<ft> 645 - { comma (. if(missingArg) 644 + [ FormalArg<ft> 645 + { comma (. if(missingArg) 646 646 { 647 647 SemErr("Missing formal argument (two consecutive commas)."); 648 648 } ··· 657 657 { [comma] 658 658 FormalArg<ft> 659 659 } 660 - ] (. if(isNested && isLazy) // keep this assignment for maintainability 660 + ] (. if(isNested && isLazy) // keep this assignment for maintainability 661 661 // ReSharper disable RedundantAssignment 662 662 ft = cst; 663 663 // ReSharper restore RedundantAssignment ··· 673 673 else 674 674 symEntry = Symbol.CreateDereference(symEntry); 675 675 676 - foreach(var alias in funcAliases) 676 + foreach(var alias in funcAliases) 677 677 Symbols.Declare(alias, symEntry); 678 678 679 679 //Store the original (logical id, mentioned in the source code) ··· 825 825 func = derStub; 826 826 827 827 //Generate code for the stub 828 - AstExpr retVal; 828 + AstExpr retVal; 829 829 830 830 if(isNested) 831 831 { ··· 848 848 ct.Ast.InsertRange(0,inject); 849 849 } 850 850 else 851 - { 851 + { 852 852 //Global lazy functions don't technically need a stub. Might be removed later on 853 853 var call = Create.Call(position,EntityRef.Function.Create(ct.Function.Id, TargetModule.Name)); 854 854 ··· 864 864 } 865 865 866 866 retVal = call; 867 - } 867 + } 868 868 869 869 870 870 //Assemble return statement