1: ================================================================================ 2: 3: Smalltalk defineClass: #SynapseParseBlockTable 4: superclass: #{Core.Object} 5: indexedType: #none 6: private: false 7: instanceVariableNames: 'blockTable ' 8: classInstanceVariableNames: '' 9: imports: '' 10: category: '' 11: 12: ================================================================================ 13: 14: SynapseParseBlockTable method for 'accessing' 15: 16: block: aBlock symbol: aSymbol 17: 18: self blockTable add: aSymbol -> aBlock 19: 20: ------------------------------------------------------------ 21: 22: SynapseParseBlockTable method for 'accessing' 23: 24: blockTable 25: 26: blockTable ifNil: [blockTable := OrderedCollection new]. 27: ^blockTable 28: 29: ------------------------------------------------------------ 30: 31: SynapseParseBlockTable method for 'initialize-release' 32: 33: initialize 34: 35: blockTable := nil 36: 37: ------------------------------------------------------------ 38: 39: SynapseParseBlockTable method for 'accessing' 40: 41: symbol: aSymbol 42: 43: | symbolAndBlock pairOfSymbol aBlock | 44: symbolAndBlock := self blockTable 45: detect: [:anAssociation | anAssociation key = aSymbol] 46: ifNone: [nil]. 47: symbolAndBlock ifNotNil: [^symbolAndBlock value]. 48: pairOfSymbol := self class mapCollection 49: detect: [:anAssociation | anAssociation key = aSymbol] 50: ifNone: [nil]. 51: pairOfSymbol ifNil: [^nil]. 52: aBlock := self class perform: pairOfSymbol value. 53: aBlock ifNil: [^nil]. 54: self blockTable add: pairOfSymbol value -> aBlock. 55: ^aBlock 56: 57: ================================================================================ 58: 59: Smalltalk.SynapseParseBlockTable class 60: instanceVariableNames: '' 61: 62: ================================================================================ 63: 64: SynapseParseBlockTable class method for 'default blocks' 65: 66: Argument_to_STRING 67: 68: ^[:aSTRING | 'Argument(' , aSTRING , ')'] 69: 70: ------------------------------------------------------------ 71: 72: SynapseParseBlockTable class method for 'default blocks' 73: 74: Arguments_to_Argument 75: 76: ^[:anArgument | 'Arguments(' , anArgument , ')'] 77: 78: ------------------------------------------------------------ 79: 80: SynapseParseBlockTable class method for 'default blocks' 81: 82: Arguments_to_Arguments_COMMA_Argument 83: 84: ^[:anArguments :aCOMMA :anArgument | 'Arguments(' , anArguments , ', ' , aCOMMA , ', ' , anArgument , ')'] 85: 86: ------------------------------------------------------------ 87: 88: SynapseParseBlockTable class method for 'default blocks' 89: 90: Assignment_to_VariableName_GETS_Constructor 91: 92: ^[:aVariableName :aGETS :aConstructor | 'Assignment(' , aVariableName , ', ' , aGETS , ', ' , aConstructor , ')'] 93: 94: ------------------------------------------------------------ 95: 96: SynapseParseBlockTable class method for 'default blocks' 97: 98: Comment_to_COMMENT 99: 100: ^[:aCOMMENT | 'Comment(' , aCOMMENT , ')'] 101: 102: ------------------------------------------------------------ 103: 104: SynapseParseBlockTable class method for 'default blocks' 105: 106: Constructor_to_ConstructorName_LPAR_Arguments_RPAR 107: 108: ^ 109: [:aConstructorName :aLPAR :aArguments :aRPAR | 110: 'Constructor(' , aConstructorName , ', ' , aLPAR , ', ' , aArguments , ', ' 111: , aRPAR , ')'] 112: 113: ------------------------------------------------------------ 114: 115: SynapseParseBlockTable class method for 'default blocks' 116: 117: Constructor_to_ConstructorName_LPAR_RPAR 118: 119: ^[:aConstructorName :aLPAR :aRPAR | 'Constructor(' , aConstructorName , ', ' , aLPAR , ', ' , aRPAR , ')'] 120: 121: ------------------------------------------------------------ 122: 123: SynapseParseBlockTable class method for 'default blocks' 124: 125: ConstructorName_to_ID 126: 127: ^[:anID | 'ConstructorName(' , anID , ')'] 128: 129: ------------------------------------------------------------ 130: 131: SynapseParseBlockTable class method for 'examples' 132: 133: example 134: "KSU.SynapseParseBlockTable example." 135: 136: ^self new 137: 138: ------------------------------------------------------------ 139: 140: SynapseParseBlockTable class method for 'defaults' 141: 142: mapCollection 143: 144: ^(OrderedCollection new) 145: add: #Program_to_Statements -> #Program_to_Statements; 146: add: #Statements_to_ -> #Statements_to_; 147: add: #Statements_to_Statement -> #Statements_to_Statement; 148: add: #Statements_to_Statements_Statement -> #Statements_to_Statements_Statement; 149: add: #Statement_to_Assignment_SEMICOLON -> #Statement_to_Assignment_SEMICOLON; 150: add: #Statement_to_Synapse_SEMICOLON -> #Statement_to_Synapse_SEMICOLON; 151: add: #Statement_to_Comment -> #Statement_to_Comment; 152: add: #Assignment_to_VariableName_GETS_Constructor 153: -> #Assignment_to_VariableName_GETS_Constructor; 154: add: #Synapse_to_Variable_Mappings -> #Synapse_to_Variable_Mappings; 155: add: #Mappings_to_Mapping -> #Mappings_to_Mapping; 156: add: #Mappings_to_Mappings_Mapping -> #Mappings_to_Mappings_Mapping; 157: add: #Mapping_to_TO_Variable -> #Mapping_to_TO_Variable; 158: add: #Mapping_to_SEND_MemberName_TO_Variable 159: -> #Mapping_to_SEND_MemberName_TO_Variable; 160: add: #Variable_to_VariableName -> #Variable_to_VariableName; 161: add: #Variable_to_VariableName_PERIOD_MemberName 162: -> #Variable_to_VariableName_PERIOD_MemberName; 163: add: #VariableName_to_ID -> #VariableName_to_ID; 164: add: #MemberName_to_ID -> #MemberName_to_ID; 165: add: #Constructor_to_ConstructorName_LPAR_RPAR 166: -> #Constructor_to_ConstructorName_LPAR_RPAR; 167: add: #Constructor_to_ConstructorName_LPAR_Arguments_RPAR 168: -> #Constructor_to_ConstructorName_LPAR_Arguments_RPAR; 169: add: #ConstructorName_to_ID -> #ConstructorName_to_ID; 170: add: #Arguments_to_Argument -> #Arguments_to_Argument; 171: add: #Arguments_to_Arguments_COMMA_Argument 172: -> #Arguments_to_Arguments_COMMA_Argument; 173: add: #Argument_to_STRING -> #Argument_to_STRING; 174: add: #Comment -> #Comment; 175: yourself 176: 177: ------------------------------------------------------------ 178: 179: SynapseParseBlockTable class method for 'default blocks' 180: 181: Mapping_to_SEND_MemberName_TO_Variable 182: 183: ^[:aSEND :aMemberName :aTO :aVariable | 'Mapping(' , aSEND , ', ' , aMemberName , ', ' , aTO , ',' , aVariable , ')'] 184: 185: ------------------------------------------------------------ 186: 187: SynapseParseBlockTable class method for 'default blocks' 188: 189: Mapping_to_TO_Variable 190: 191: ^[:aTO :aVariable | 'Mapping(' , aTO , ',' , aVariable , ')'] 192: 193: ------------------------------------------------------------ 194: 195: SynapseParseBlockTable class method for 'default blocks' 196: 197: Mappings_to_Mapping 198: 199: ^[:aMapping | 'Mappings(' , aMapping , ')'] 200: 201: ------------------------------------------------------------ 202: 203: SynapseParseBlockTable class method for 'default blocks' 204: 205: Mappings_to_Mappings_Mapping 206: 207: ^[:aMappings :aMapping | 'Mappings(' , aMappings , ',' , aMapping , ')'] 208: 209: ------------------------------------------------------------ 210: 211: SynapseParseBlockTable class method for 'default blocks' 212: 213: MemberName_to_ID 214: 215: ^[:anID | 'MemberName(' , anID , ')'] 216: 217: ------------------------------------------------------------ 218: 219: SynapseParseBlockTable class method for 'instance creation' 220: 221: new 222: 223: ^(super new) 224: initialize; 225: yourself 226: 227: ------------------------------------------------------------ 228: 229: SynapseParseBlockTable class method for 'default blocks' 230: 231: Program_to_Statements 232: 233: ^[:aStatements | 'Program(' , aStatements , ')'] 234: 235: ------------------------------------------------------------ 236: 237: SynapseParseBlockTable class method for 'default blocks' 238: 239: Statement_to_Assignments_SEMICOLON 240: 241: ^[:anAssignments :aSEMICOLON | 'Statement(' , anAssignments , ', ' , aSEMICOLON , ')'] 242: 243: ------------------------------------------------------------ 244: 245: SynapseParseBlockTable class method for 'default blocks' 246: 247: Statement_to_Comment 248: 249: ^[:aComment | 'Statement(' , aComment , ')'] 250: 251: ------------------------------------------------------------ 252: 253: SynapseParseBlockTable class method for 'default blocks' 254: 255: Statement_to_Synapse_SEMICOLON 256: 257: ^[:aSynapse :aSEMICOLON | 'Statement(' , aSynapse , ', ' , aSEMICOLON , ')'] 258: 259: ------------------------------------------------------------ 260: 261: SynapseParseBlockTable class method for 'default blocks' 262: 263: Statements_to_Statement 264: 265: ^[:aStatement | 'Statements(' , aStatement , ')'] 266: 267: ------------------------------------------------------------ 268: 269: SynapseParseBlockTable class method for 'default blocks' 270: 271: Statements_to_Statements_Statement 272: 273: ^[:aStatements :aStatement | 'Statements(' , aStatements , ', ' , aStatement , ')'] 274: 275: ------------------------------------------------------------ 276: 277: SynapseParseBlockTable class method for 'default blocks' 278: 279: Synapse_to_Variable_Mappings 280: 281: ^[:aVariable :aMappings | 'Synapse(' , aVariable , ', ' , aMappings , ')'] 282: 283: ------------------------------------------------------------ 284: 285: SynapseParseBlockTable class method for 'default blocks' 286: 287: Variable_to_VariableName 288: 289: ^[:aVariableName | 'Variable(' , aVariableName , ')'] 290: 291: ------------------------------------------------------------ 292: 293: SynapseParseBlockTable class method for 'default blocks' 294: 295: Variable_to_VariableName_PERIOD_MemberName 296: 297: ^[:aVariableName :aPERIOD :aMemberName | 'Variable(' , aVariableName , ', ' , aPERIOD , ', ' , aMemberName , ')'] 298: 299: ------------------------------------------------------------ 300: 301: SynapseParseBlockTable class method for 'default blocks' 302: 303: VariableName_to_ID 304: 305: ^[:anID | 'VariableName(' , anID , ')'] 306: 307: ================================================================================
This document was generated by KSU.TextDoclet on 2013/02/22 at 01:01:17.