Ticket #30: 01-cobraTokCleanup.patch
File 01-cobraTokCleanup.patch, 5.9 KB (added by hopscc, 16 years ago) |
---|
cobraTokeniser - clearup some Todo items |
-
Source/CobraTokenizer.cobra
203 203 ] 204 204 205 205 get keywords as String is override 206 # CC: this should be multiline string with comments 207 return 'use import namespace enum class inherits implements interface struct extend where must be callable cue invariant def sig as get set pro var from has body test shared virtual override ref vari require ensure old this base is assert branch on off expect if else using while post for down to step break continue try catch success finally throw except event listen ignore raise and or not implies any every all to to\\? pass print stop trace return yield in bool char int uint decimal float of passthrough true false nil dynamic same instance where inlined end number global objc out inout' 206 return String.join(' ', @[ 207 'use', # specify namespaces used in module 208 'import', 209 'namespace', # specify namespace reside in 210 'enum', # define an enumeration 211 'class', # define a class 212 'inherits', # specify class inheritance (superclass) 213 'implements', # specify class interface(s) support 214 'interface', # define an Interface 215 'struct', # define a structure 216 'extend', 217 'where', # condition modifier on for 218 'must', 219 'be', 220 'callable', 221 'cue', 222 'invariant', # contracts: invariant across method 223 'def', # define method 224 'sig', # signature of method 225 'as', 226 'get', # property accessor 227 'set', # property mutator 228 'pro', # property 229 'var', # class variable 230 'from', 231 'has', 232 'body', # code body after contract 233 'test', # Test: unit test block 234 'shared', # class specific (java static) 235 'virtual', # isname: method modifier method overridable 236 'override', # isname: method modifier method being overriden 237 'ref', # take a reference (to a method) 238 'vari', # arglist variable length 239 'require', # contract: pre condition()s block 240 'ensure', # contract post condition()s block 241 'old', 242 'this', # reference to this instance 243 'base', # refernce to superclass 244 'is', # variable type, method return type 245 'assert', 246 'branch', # multiway condition ( java/C case) 247 'on', 248 'off', 249 'expect', # Test: expect and trap an exception 250 'if', 251 'else', 252 'using', 253 'while', 254 'post', 255 'for', # counted or Enumerable loop 256 'down', 257 'to', # Typing: cast 258 'step', 259 'break', 260 'continue', 261 'try', # exception trap boundary block 262 'catch', # trap an exception type 263 'success', # trap block succeeded - no exception 264 'finally', # regardless of exception trap success/failure do this 265 'throw', # throw an enception 266 'except', 267 'event', # define a .Net event 268 'listen', # define a listener ( callback delegate) for an event 269 'ignore', # ignore a raised event 270 'raise', # raise/generate/fire an event 271 'and', # logical and 272 'or', # logical or 273 'not', # logical negation 274 'implies', 275 'any', 276 'every', 277 'all', 278 'to', 279 'to\\?', 280 'pass', # placeholder for an empty block 281 'print', 282 'stop', 283 'trace', # define tracing parameters 284 'return', # method return value 285 'yield', # generator return value 286 'in', # set inclusion, isname: arg modifier - value passed into method (only) 287 'bool', # Type: Boolean 288 'char', # Type: character c'x' 289 'int', # Type: signed integer 290 'uint', # Type: Unsigned integer 291 'decimal', # Type: Decimal 292 'float', # Type: Float 293 'of', 294 'passthrough', # ?? 295 'true', # boolean Truth value 296 'false', # boolean false value 297 'nil', # null, None, 298 'dynamic', # Type: deferred or unspecified 299 'same', 300 'instance', 301 'where', 302 'inlined', 303 'end', 304 'number', # generic number type - bind to a numeric type elsewhere 305 'global', # ?? 306 'objc', # ?? 307 'out', # isname: arg modifier - value returned from a method 308 'inout', # isname: arg modifier - value passed in and returned from a method 309 ]) to ! 208 310 209 311 def _reset is override 210 312 base._reset … … 234 336 # CC: 235 337 # _tokenDefsByWhich['STRING_PART_SINGLE'].isActiveCall = def(tokenizer)=tokenizer.inSubstStringSingle 236 338 # _tokenDefsByWhich['STRING_STOP_SINGLE'].isActiveCall = def(tokenizer)=tokenizer.inSubstStringSingle 237 for which in 'RBRACKET_SPECIAL STRING_PART_SINGLE STRING_STOP_SINGLE STRING_PART_DOUBLE STRING_STOP_DOUBLE STRING_PART_FORMAT'.split(c' ') 238 _tokenDefsByWhich[which].isActive = false 339 for which in @[ 340 'RBRACKET_SPECIAL' , 341 #'RBRACKET_DBL_SPECIAL', 'RBRACKET_DBL', 342 'STRING_PART_SINGLE', 'STRING_STOP_SINGLE', 343 'STRING_PART_DOUBLE', 'STRING_STOP_DOUBLE', 344 'STRING_PART_FORMAT', 345 ] 346 _tokenDefsByWhich[which].isActive = false 239 347 240 348 def isActiveCall(tok as TokenDef) as bool is override 241 349 if tok.which=='STRING_PART_SINGLE' or tok.which=='STRING_STOP_SINGLE' … … 420 528 catch FormatException 421 529 assert false, 'not expecting to get here given regex' 422 530 catch OverflowException 423 assert false, 'TODO '531 assert false, 'TODO: DECIMAL_LIT Overflow' 424 532 return tok 425 533 426 534 def onFRACTIONAL_LIT(tok as IToken) as IToken? … … 430 538 catch FormatException 431 539 assert false, 'not expecting to get here given regex' 432 540 catch OverflowException 433 assert false, 'TODO '541 assert false, 'TODO: FRACTIONAL_LIT Overflow' 434 542 return tok 435 543 436 544 def onINTEGER_LIT(tok as IToken) as IToken? … … 439 547 catch FormatException 440 548 assert false, 'not expecting to get here given regex' 441 549 catch OverflowException 442 assert false, 'TODO '550 assert false, 'TODO: INTEGER_LIT Overflow' 443 551 return tok 444 552 445 553 def onINTEGER_LIT_SIGN(tok as IToken) as IToken?