1 43 44 package de.susebox.jtopas; 45 46 import java.util.Iterator ; 50 51 import junit.framework.Test; 52 import junit.framework.TestCase; 53 import junit.framework.TestSuite; 54 55 import de.susebox.TestUtilities; 56 import de.susebox.jtopas.spi.DataProvider; 57 import de.susebox.jtopas.spi.PatternHandler; 58 59 60 64 72 public class TestTokenizerProperties 73 extends TestCase 74 implements TokenizerPropertyListener 75 { 76 77 81 84 public static void main(String [] args) { 85 String [] tests = { TestTokenizerProperties.class.getName() }; 86 87 TestUtilities.run(tests, args); 88 } 89 90 91 95 101 public static Test suite() { 102 TestSuite suite = new TestSuite(TestTokenizerProperties.class.getName()); 103 104 suite.addTest(new TestTokenizerProperties("testAddingSequences")); 105 suite.addTest(new TestTokenizerProperties("testAddingKeywords")); 106 suite.addTest(new TestTokenizerProperties("testGenericProperties")); 107 suite.addTest(new TestTokenizerProperties("testDataHandlers")); 108 return suite; 109 } 110 111 112 116 120 public TestTokenizerProperties(String test) { 121 super(test); 122 } 123 124 125 129 133 protected void setUp() throws Exception { 134 _properties = new StandardTokenizerProperties(); 135 _properties.addTokenizerPropertyListener(this); 136 } 137 138 142 protected void tearDown() throws Exception { 143 _properties = null; 144 } 145 146 150 154 public void testDataHandlers() throws Throwable { 155 for (int index = 0; index < _testProperties.length; ++index) { 157 TokenizerProperty prop = _testProperties[index]; 158 159 _properties.addProperty(prop); 160 switch(prop.getType()) { 161 case Token.KEYWORD: 162 assertTrue("Keyword not found: " + prop, _properties.keywordExists(prop.getImages()[0])); 163 break; 164 case Token.STRING: 165 assertTrue("String not found: " + prop, _properties.stringExists(prop.getImages()[0])); 166 break; 167 case Token.BLOCK_COMMENT: 168 assertTrue("Block comment not found: " + prop, _properties.blockCommentExists(prop.getImages()[0])); 169 break; 170 case Token.LINE_COMMENT: 171 assertTrue("Line comment not found: " + prop, _properties.lineCommentExists(prop.getImages()[0])); 172 break; 173 case Token.SPECIAL_SEQUENCE: 174 assertTrue("Special sequence not found: " + prop, _properties.specialSequenceExists(prop.getImages()[0])); 175 break; 176 case Token.PATTERN: 177 assertTrue("Pattern not found: " + prop, _properties.patternExists(prop.getImages()[0])); 178 break; 179 } 180 } 181 182 de.susebox.jtopas.spi.KeywordHandler kh = (de.susebox.jtopas.spi.KeywordHandler)_properties; 184 de.susebox.jtopas.spi.SequenceHandler sh = (de.susebox.jtopas.spi.SequenceHandler)_properties; 185 186 for (int index = 0; index < _testProperties.length; ++index) { 187 TokenizerProperty prop = _testProperties[index]; 188 189 if (prop.getType() == Token.PATTERN) { 190 continue; 191 } 192 193 String image = prop.getImages()[0]; 195 TokenizerProperty isKeyword; 196 TokenizerProperty isSequence; 197 TokenizerProperty isPattern; 198 199 _currDataLength = image.length(); 200 System.arraycopy(image.toCharArray(), 0, _currData, _currStartPos, _currDataLength); 201 202 isKeyword = kh.isKeyword(new LocalDataProvider(this)); 203 isSequence = sh.startsWithSequenceCommentOrString(new LocalDataProvider(this)); 204 205 switch(prop.getType()) { 206 case Token.KEYWORD: 207 assertTrue("Keyword not found: " + prop, isKeyword != null); 208 assertTrue("Unexpectedly found sequence: " + prop, isSequence == null); 209 assertTrue("Expected keyword: " + prop + ", found: " + isKeyword, prop.equals(isKeyword)); 210 break; 211 case Token.STRING: 212 case Token.BLOCK_COMMENT: 213 case Token.LINE_COMMENT: 214 case Token.SPECIAL_SEQUENCE: 215 assertTrue("Sequence not found: " + prop, isSequence != null); 216 assertTrue("Unexpectedly found keyword: " + prop, isKeyword == null); 217 assertTrue("Expected sequence: " + prop + ", found: " + isSequence, prop.equals(isSequence)); 218 break; 219 } 220 221 _currStartPos += _currDataLength; 222 } 223 224 PatternHandler ph = (PatternHandler)_properties; 226 PatternHandler.Result result; 227 228 _currStartPos = 0; 229 for (int index = 0; index < _patternMatchingStrings.length; ++index) { 230 String image = _patternMatchingStrings[index]; 231 char[] complete = { ';' }; 232 233 _currDataLength = image.length(); 234 System.arraycopy(image.toCharArray(), 0, _currData, _currStartPos, _currDataLength); 235 result = ph.matches(new LocalDataProvider(this)); 236 assertTrue("Pattern matching failed for: " + image, result != null ); 237 assertTrue("Pattern matching returned wrong length: " + result.getLengthOfMatch(), result.getLengthOfMatch() == image.length()); 238 System.arraycopy(complete, 0, _currData, _currStartPos + _currDataLength, complete.length); 239 _currDataLength += complete.length; 240 result = ph.matches(new LocalDataProvider(this)); 241 assertTrue("Pattern matching failed for: " + image, result != null); 242 assertTrue("Pattern matching returned wrong length: " + result.getLengthOfMatch(), result.getLengthOfMatch() == image.length()); 243 _currStartPos += _currDataLength; 244 } 245 } 246 247 248 251 public void testAddingSequences() throws Throwable { 252 _properties.addString("'", "'", "\\"); 254 _properties.addString("\"", "\"", "\\"); 255 _properties.addLineComment("rem", null, Flags.F_NO_CASE); 256 _properties.addBlockComment("/*", "*/"); 257 _properties.addBlockComment("<!--", "-->"); 258 _properties.addSpecialSequence("<<"); 259 _properties.addSpecialSequence(">>"); 260 _properties.addSpecialSequence(">>>"); 261 _properties.addSpecialSequence("<H1>", null, Flags.F_NO_CASE); 262 _properties.addSpecialSequence("<H2>", null, Flags.F_NO_CASE); 263 _properties.addSpecialSequence("\u20AC", null, Flags.F_NO_CASE); _properties.addSpecialSequence("\u20ACuro", null, Flags.F_NO_CASE); _properties.addSpecialSequence("\u00A3", null, Flags.F_NO_CASE); 267 assertTrue("Couldn't find \"'\".", _properties.stringExists("'")); 268 assertTrue("Couldn't find \"\"\".", _properties.stringExists("\"")); 269 assertTrue("Couldn't find \"rem\".", _properties.lineCommentExists("rem")); 270 assertTrue("Couldn't find \"REM\".", _properties.lineCommentExists("REM")); 271 assertTrue("Couldn't find \"Rem\".", _properties.lineCommentExists("Rem")); 272 assertTrue("Couldn't find \"/*\".", _properties.blockCommentExists("/*")); 273 assertTrue("Couldn't find \"<!--\".", _properties.blockCommentExists("<!--")); 274 assertTrue("Couldn't find \"<<\".", _properties.specialSequenceExists("<<")); 275 assertTrue("Couldn't find \">>\".", _properties.specialSequenceExists(">>")); 276 assertTrue("Couldn't find \">>>\".", _properties.specialSequenceExists(">>>")); 277 assertTrue("Couldn't find \"<H1>\".", _properties.specialSequenceExists("<H1>")); 278 assertTrue("Couldn't find \"<h1>\".", _properties.specialSequenceExists("<h1>")); 279 assertTrue("Couldn't find \"<H2>\".", _properties.specialSequenceExists("<H2>")); 280 assertTrue("Couldn't find \"<h2>\".", _properties.specialSequenceExists("<h2>")); 281 assertTrue("Couldn't find \"\u20AC\".", _properties.specialSequenceExists("\u20AC")); 282 assertTrue("Couldn't find \"\u20ACuro\".", _properties.specialSequenceExists("\u20ACuro")); 283 assertTrue("Couldn't find \"\u20ACURO\".", _properties.specialSequenceExists("\u20ACURO")); 284 assertTrue("Couldn't find \"\u00A3\".", _properties.specialSequenceExists("\u00A3")); 285 286 assertTrue("Unexpectedly found \"''\".", ! _properties.stringExists("''")); 288 assertTrue("Unexpectedly found \"\"\"\".", ! _properties.stringExists("\"\"")); 289 assertTrue("Unexpectedly found \"re\".", ! _properties.lineCommentExists("re")); 290 assertTrue("Unexpectedly found \"RE\".", ! _properties.lineCommentExists("RE")); 291 assertTrue("Unexpectedly found \"Re\".", ! _properties.lineCommentExists("Re")); 292 assertTrue("Unexpectedly found \"*\".", ! _properties.blockCommentExists("*")); 293 assertTrue("Unexpectedly found \"<!-\".", ! _properties.blockCommentExists("<!-")); 294 assertTrue("Unexpectedly found \"<\".", ! _properties.specialSequenceExists("<")); 295 assertTrue("Unexpectedly found \">\".", ! _properties.specialSequenceExists(">")); 296 assertTrue("Unexpectedly found \">>>>\".", ! _properties.specialSequenceExists(">>>>")); 297 assertTrue("Unexpectedly found \"<H1\".", ! _properties.specialSequenceExists("<H1")); 298 assertTrue("Unexpectedly found \"h1>\".", ! _properties.specialSequenceExists("h1>")); 299 assertTrue("Unexpectedly found \"<H>\".", ! _properties.specialSequenceExists("<H>")); 300 assertTrue("Unexpectedly found \"<h2\".", ! _properties.specialSequenceExists("<h2")); 301 assertTrue("Unexpectedly found \"<<H>\".", ! _properties.specialSequenceExists("<<H>")); 302 assertTrue("Unexpectedly found \"<h2>>\".", ! _properties.specialSequenceExists("<h2>>")); 303 assertTrue("Unexpectedly found \"\u20ACur\".", ! _properties.specialSequenceExists("\u20ACur")); 304 305 Iterator iter; 307 int count; 308 309 iter = _properties.getStrings(); 310 count = 0; 311 while (iter.hasNext()) { 312 iter.next(); 313 count++; 314 } 315 assertTrue("Expected 2 strings, got " + count, count == 2); 316 317 iter = _properties.getLineComments(); 318 count = 0; 319 while (iter.hasNext()) { 320 iter.next(); 321 count++; 322 } 323 assertTrue("Expected 1 line comment, got " + count, count == 1); 324 325 iter = _properties.getBlockComments(); 326 count = 0; 327 while (iter.hasNext()) { 328 iter.next(); 329 count++; 330 } 331 assertTrue("Expected 2 block comments, got " + count, count == 2); 332 333 iter = _properties.getSpecialSequences(); 334 count = 0; 335 while (iter.hasNext()) { 336 iter.next(); 337 count++; 338 } 339 assertTrue("Expected 8 special sequences, got " + count, count == 8); 340 341 _properties.removeString("'"); 343 assertTrue("Still found \"'\".", ! _properties.stringExists("'")); 344 345 _properties.removeString("\""); 346 assertTrue("Still found \"\"\".", ! _properties.stringExists("\"")); 347 348 _properties.removeLineComment("rem"); 349 assertTrue("Still found \"rem\".", ! _properties.lineCommentExists("rem")); 350 351 _properties.removeBlockComment("/*"); 352 assertTrue("Still found \"/*\".", ! _properties.blockCommentExists("/*")); 353 354 _properties.removeBlockComment("<!--"); 355 assertTrue("Still found \"<!--\".", ! _properties.blockCommentExists("<!--")); 356 357 _properties.removeSpecialSequence("<<"); 358 assertTrue("Still found \"<<\".", ! _properties.specialSequenceExists("<<")); 359 360 _properties.removeSpecialSequence(">>"); 361 assertTrue("Still found \">>\".", ! _properties.specialSequenceExists(">>")); 362 363 _properties.removeSpecialSequence(">>>"); 364 assertTrue("Still found \">>>\".", ! _properties.specialSequenceExists(">>>")); 365 366 _properties.removeSpecialSequence("<H1>"); 367 assertTrue("Still found \"<H1>\".", ! _properties.specialSequenceExists("<H1>")); 368 369 _properties.removeSpecialSequence("<H2>"); 370 assertTrue("Still found \"<H2>\".", ! _properties.specialSequenceExists("<H2>")); 371 372 _properties.removeSpecialSequence("\u20AC"); 373 assertTrue("Still found \"\u20AC\".", ! _properties.specialSequenceExists("\u20AC")); 374 375 _properties.removeSpecialSequence("\u20ACuro"); 376 assertTrue("Still found \"\u20ACuro\".", ! _properties.specialSequenceExists("\u20ACuro")); 377 378 _properties.removeSpecialSequence("\u00A3"); 379 assertTrue("Still found \"\u00A3\".", ! _properties.specialSequenceExists("\u00A3")); 380 381 iter = _properties.getStrings(); 383 assertTrue("Still contains strings.", ! iter.hasNext()); 384 385 iter = _properties.getLineComments(); 386 assertTrue("Still contains line comments.", ! iter.hasNext()); 387 388 iter = _properties.getBlockComments(); 389 assertTrue("Still contains block comments.", ! iter.hasNext()); 390 391 iter = _properties.getSpecialSequences(); 392 assertTrue("Still contains special sequences.", ! iter.hasNext()); 393 } 394 395 396 400 public void testAddingKeywords() throws Throwable { 401 final String [] keywordsCase = { 402 "if", 403 "else", 404 "elsif", 405 "end", 406 "integ", 407 "while", 408 "loop", 409 "case", 410 "switch", 411 "return", 412 "break" 413 }; 414 final String [] keywordsNoCase = { 415 "char", 416 "int", 417 "class", 418 "interface", 419 "integer" 420 }; 421 422 for (int index = 0; index < keywordsCase.length; ++index) { 424 _currEvent = null; 425 _properties.addKeyword(keywordsCase[index]); 426 assertTrue("No TokenizerPropertyEvent happened.", _currEvent != null); 427 assertTrue("Wrong type of event: " + _currEvent.getType(), _currEvent.getType() == TokenizerPropertyEvent.PROPERTY_ADDED); 428 assertTrue("Wrong property type: " + _currEvent.getProperty().getType(), 429 _currEvent.getProperty().getType() == Token.KEYWORD); 430 assertTrue("Wrong property image: " + _currEvent.getProperty().getImages()[0], 431 keywordsCase[index].equals(_currEvent.getProperty().getImages()[0])); 432 } 433 for (int index = 0; index < keywordsNoCase.length; ++index) { 434 _currEvent = null; 435 _properties.addKeyword(keywordsNoCase[index], null, Flags.F_NO_CASE); 436 assertTrue("No TokenizerPropertyEvent happened.", _currEvent != null); 437 assertTrue("Wrong type of event: " + _currEvent.getType(), _currEvent.getType() == TokenizerPropertyEvent.PROPERTY_ADDED); 438 assertTrue("Wrong property type: " + _currEvent.getProperty().getType(), 439 _currEvent.getProperty().getType() == Token.KEYWORD); 440 assertTrue("Wrong property image: " + _currEvent.getProperty().getImages()[0], 441 keywordsNoCase[index].equalsIgnoreCase(_currEvent.getProperty().getImages()[0])); 442 } 443 444 for (int index = 0; index < keywordsCase.length; ++index) { 446 String keyword = keywordsCase[index]; 447 assertTrue("Couldn't find \"" + keyword + "\".", _properties.keywordExists(keyword)); 448 assertTrue("Unexpectedly found \"" + keyword.toUpperCase() + "\".", ! _properties.keywordExists(keyword.toUpperCase())); 449 } 450 for (int index = 0; index < keywordsNoCase.length; ++index) { 451 String keyword = keywordsNoCase[index]; 452 assertTrue("Couldn't find \"" + keyword + "\".", _properties.keywordExists(keyword)); 453 assertTrue("Couldn't find \"" + keyword.toUpperCase() + "\".", _properties.keywordExists(keyword.toUpperCase())); 454 assertTrue("Couldn't find \"" + keyword.toLowerCase() + "\".", _properties.keywordExists(keyword.toLowerCase())); 455 } 456 457 Iterator iter = _properties.getKeywords(); 459 int count = 0; 460 461 while (iter.hasNext()) { 462 iter.next(); 463 count++; 464 } 465 assertTrue("More / less keywords than expected: " + count, count == keywordsCase.length + keywordsNoCase.length); 466 467 for (int index = 0; index < keywordsCase.length; ++index) { 469 _currEvent = null; 470 _properties.removeKeyword(keywordsCase[index]); 471 assertTrue("No TokenizerPropertyEvent happened.", _currEvent != null); 472 assertTrue("Wrong type of event: " + _currEvent.getType(), _currEvent.getType() == TokenizerPropertyEvent.PROPERTY_REMOVED); 473 assertTrue("Wrong property type: " + _currEvent.getProperty().getType(), 474 _currEvent.getProperty().getType() == Token.KEYWORD); 475 assertTrue("Wrong property image: " + _currEvent.getProperty().getImages()[0], 476 keywordsCase[index].equals(_currEvent.getProperty().getImages()[0])); 477 } 478 for (int index = 0; index < keywordsNoCase.length; ++index) { 479 _currEvent = null; 480 _properties.removeKeyword(keywordsNoCase[index]); 481 assertTrue("No TokenizerPropertyEvent happened.", _currEvent != null); 482 assertTrue("Wrong type of event: " + _currEvent.getType(), _currEvent.getType() == TokenizerPropertyEvent.PROPERTY_REMOVED); 483 assertTrue("Wrong property type: " + _currEvent.getProperty().getType(), 484 _currEvent.getProperty().getType() == Token.KEYWORD); 485 assertTrue("Wrong property image: " + _currEvent.getProperty().getImages()[0], 486 keywordsNoCase[index].equalsIgnoreCase(_currEvent.getProperty().getImages()[0])); 487 } 488 } 489 490 493 public void testGenericProperties() throws Throwable { 494 _properties.setWhitespaces(" "); 496 assertTrue("Wrong type of event.", _currEvent.getType() == TokenizerPropertyEvent.PROPERTY_MODIFIED); 497 assertTrue("Wrong property type in event.", _currEvent.getProperty().getType() == Token.WHITESPACE); 498 assertTrue("Wrong property in event.", _currEvent.getProperty().getImages()[0].equals(" ")); 499 500 _currEvent = null; 501 _properties.setSeparators(TokenizerProperties.DEFAULT_SEPARATORS); 502 assertTrue("Unexpected event happened.", _currEvent == null); 503 504 for (int index = 0; index < _testProperties.length; ++index) { 505 TokenizerProperty prop = _testProperties[index]; 506 507 _currEvent = null; 508 _properties.addProperty(prop); 509 assertTrue("No event.", _currEvent != null); 510 assertTrue("Wrong type of event.", _currEvent.getType() == TokenizerPropertyEvent.PROPERTY_ADDED); 511 assertTrue("Wrong property type in event.", _currEvent.getProperty().getType() == prop.getType()); 512 if ((prop.getFlags() & Flags.F_NO_CASE) != 0) { 513 assertTrue("Wrong property in event.", _currEvent.getProperty().getImages()[0].equalsIgnoreCase(prop.getImages()[0])); 514 } else { 515 assertTrue("Wrong property in event.", _currEvent.getProperty().getImages()[0].equals(prop.getImages()[0])); 516 } 517 assertTrue("Wrong companion in event.", _currEvent.getProperty().getCompanion() == prop.getCompanion()); 518 } 519 520 for (int index = 0; index < _testProperties.length; ++index) { 522 TokenizerProperty prop = _testProperties[index]; 523 524 _currEvent = null; 525 _properties.addProperty(prop); 526 assertTrue("Unexpected event while re-registering property.", _currEvent == null); 527 } 528 529 Iterator iter = _properties.getProperties(); 531 int count = 0; 532 533 while (iter.hasNext()) { 534 TokenizerProperty prop = (TokenizerProperty)iter.next(); 535 int index = 0; 536 537 count++; 538 System.out.println(prop); 539 while (index < _testProperties.length) { 540 if ( prop.getType() == _testProperties[index].getType() 543 && prop.getCompanion() == _testProperties[index].getCompanion() 544 && prop.getImages().length == _testProperties[index].getImages().length) { 545 int imageIndex = 0; 546 boolean noCase = _properties.isFlagSet(prop, Flags.F_NO_CASE); 547 548 while (imageIndex < prop.getImages().length) { 549 if (noCase && ! (prop.getImages()[imageIndex].equalsIgnoreCase(_testProperties[index].getImages()[imageIndex]))) { 550 break; 551 } else if ( ! noCase && ! (prop.getImages()[imageIndex].equals(_testProperties[index].getImages()[imageIndex]))) { 552 break; 553 } 554 imageIndex++; 555 } 556 if (imageIndex >= prop.getImages().length) { 557 break; 558 } 559 } 560 index++; 561 } 562 assertTrue("Unexpected property " + prop.toString() + ".", index < _testProperties.length); 563 } 564 assertTrue("Too many / few properties: " + count + ". Expected were " + _testProperties.length, count == _testProperties.length); 565 566 for (int index = 0; index < _testProperties.length; ++index) { 568 TokenizerProperty prop = _testProperties[index]; 569 570 assertTrue("Could't find property: " + prop, _properties.propertyExists(prop)); 571 } 572 573 iter = _properties.getProperties(); 575 count = 0; 576 while (iter.hasNext()) { 577 TokenizerProperty prop = (TokenizerProperty)iter.next(); 578 579 count++; 580 System.out.println("Removing: " + prop); 581 _currEvent = null; 582 iter.remove(); 583 assertTrue("No event.", _currEvent != null); 584 assertTrue("Wrong type of event.", _currEvent.getType() == TokenizerPropertyEvent.PROPERTY_REMOVED); 585 assertTrue("Wrong property type in event.", _currEvent.getProperty().getType() == prop.getType()); 586 if ((prop.getFlags() & Flags.F_NO_CASE) != 0) { 587 assertTrue("Wrong property in event.", _currEvent.getProperty().getImages()[0].equalsIgnoreCase(prop.getImages()[0])); 588 } else { 589 assertTrue("Wrong property in event.", _currEvent.getProperty().getImages()[0].equals(prop.getImages()[0])); 590 } 591 assertTrue("Wrong companion in event.", _currEvent.getProperty().getCompanion() == prop.getCompanion()); 592 assertTrue("Property still exists: " + prop, ! _properties.propertyExists(prop)); 593 } 594 assertTrue("Too many / few properties: " + count + ". Expected were " + _testProperties.length, count == _testProperties.length); 595 596 for (int index = 0; index < _testProperties.length; ++index) { 598 TokenizerProperty prop = _testProperties[index]; 599 600 assertTrue("Property still present: " + prop, ! _properties.propertyExists(prop)); 601 } 602 } 603 604 605 609 615 public void propertyChanged(TokenizerPropertyEvent event) { 616 _currEvent = event; 617 } 618 619 623 628 private final class LocalDataProvider implements DataProvider { 629 630 634 protected LocalDataProvider(TestTokenizerProperties parent) { 635 _parent = parent; 636 } 637 638 643 public char[] getData() { 644 return _parent._currData; 645 } 646 647 653 public char[] getDataCopy() { 654 char[] dst = new char[_parent._currDataLength]; 655 656 System.arraycopy(_parent._currData, _parent._currStartPos, dst, 0, _parent._currDataLength); 657 return dst; 658 } 659 660 667 public int getLength() { 668 return _parent._currDataLength; 669 } 670 671 676 public int getStartPosition() { 677 return _parent._currStartPos; 678 } 679 680 686 public char getCharAt(int index) { 687 return _parent._currData[_parent._currStartPos + index]; 688 } 689 690 696 public String toString() { 697 return new String (_parent._currData, _parent._currStartPos, _parent._currDataLength); 698 } 699 700 private TestTokenizerProperties _parent; 702 } 703 704 705 static final Object _companion1 = new Object (); 709 static final Object _companion2 = new Object (); 710 711 static final TokenizerProperty[] _testProperties = { 712 new TokenizerProperty(Token.KEYWORD, new String [] { "k1" }, null, Flags.F_NO_CASE), 713 new TokenizerProperty(Token.KEYWORD, new String [] { "k2" }, _companion1, Flags.F_NO_CASE), 714 new TokenizerProperty(Token.KEYWORD, new String [] { "k3" }, _companion2, Flags.F_NO_CASE), 715 new TokenizerProperty(Token.LINE_COMMENT, new String [] { "//" }, null, 0, Flags.F_NO_CASE), 716 new TokenizerProperty(Token.LINE_COMMENT, new String [] { "--" }, _companion1, 0, Flags.F_NO_CASE ), 717 new TokenizerProperty(Token.LINE_COMMENT, new String [] { "#" }, _companion2, 0, Flags.F_NO_CASE ), 718 new TokenizerProperty(Token.LINE_COMMENT, new String [] { "rem" }, null, Flags.F_NO_CASE), 719 new TokenizerProperty(Token.BLOCK_COMMENT, new String [] { "/*", "*/" }, null, 0, Flags.F_NO_CASE ), 720 new TokenizerProperty(Token.BLOCK_COMMENT, new String [] { "/**", "*/" }, _companion1, 0, Flags.F_NO_CASE), 721 new TokenizerProperty(Token.BLOCK_COMMENT, new String [] { "{", "}" }, _companion2, 0, Flags.F_NO_CASE), 722 new TokenizerProperty(Token.BLOCK_COMMENT, new String [] { "[startBlockComment]", "[endBlockComment]" }, null, Flags.F_NO_CASE), 723 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { ":=" }, null, 0, Flags.F_NO_CASE), 724 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "<>" }, _companion1, 0, Flags.F_NO_CASE), 725 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "!=" }, _companion2, 0, Flags.F_NO_CASE), 726 new TokenizerProperty(Token.STRING, new String [] { "\"", "\"", "\\" }, null, 0, Flags.F_NO_CASE), 727 new TokenizerProperty(Token.STRING, new String [] { "'", "'", "\\" }, null, 0, Flags.F_NO_CASE), 728 new TokenizerProperty(Token.PATTERN, new String [] { "[+\\-]?[0-9]+\\.?[0-9]*" }, _companion1, 0, Flags.F_NO_CASE), 729 new TokenizerProperty(Token.PATTERN, new String [] { "[A-Z_][A-Z0-9_]*" }, _companion2, Flags.F_NO_CASE), 730 new TokenizerProperty(Token.KEYWORD, new String [] { "if" }, new Object (), 0, Flags.F_NO_CASE), 731 new TokenizerProperty(Token.KEYWORD, new String [] { "then" }, new Object (), 0, Flags.F_NO_CASE), 732 new TokenizerProperty(Token.KEYWORD, new String [] { "while" }, new Object (), 0, Flags.F_NO_CASE ), 733 new TokenizerProperty(Token.KEYWORD, new String [] { "loop" }, new Object (), 0, Flags.F_NO_CASE ), 734 new TokenizerProperty(Token.KEYWORD, new String [] { "class" }, new Object (), 0, Flags.F_NO_CASE ), 735 new TokenizerProperty(Token.KEYWORD, new String [] { "interface" }, new Object (), 0, Flags.F_NO_CASE ), 736 new TokenizerProperty(Token.KEYWORD, new String [] { "final" }, null, 0, Flags.F_NO_CASE ), 737 new TokenizerProperty(Token.KEYWORD, new String [] { "implements" }, null, 0, Flags.F_NO_CASE ), 738 new TokenizerProperty(Token.KEYWORD, new String [] { "int" }, null, 0, Flags.F_NO_CASE ), 739 new TokenizerProperty(Token.KEYWORD, new String [] { "boolean" }, null, 0, Flags.F_NO_CASE ), 740 new TokenizerProperty(Token.KEYWORD, new String [] { "void" }, null, 0, Flags.F_NO_CASE ), 741 new TokenizerProperty(Token.KEYWORD, new String [] { "do" }, null, 0, Flags.F_NO_CASE ), 742 new TokenizerProperty(Token.KEYWORD, new String [] { "import" }, null, 0, Flags.F_NO_CASE ), 743 new TokenizerProperty(Token.KEYWORD, new String [] { "package" }, null, 0, Flags.F_NO_CASE ), 744 new TokenizerProperty(Token.KEYWORD, new String [] { "static" }, null, 0, Flags.F_NO_CASE ), 745 new TokenizerProperty(Token.KEYWORD, new String [] { "H1" }, null, Flags.F_NO_CASE), 746 new TokenizerProperty(Token.KEYWORD, new String [] { "H2" }, null, Flags.F_NO_CASE), 747 new TokenizerProperty(Token.KEYWORD, new String [] { "H3" }, null, Flags.F_NO_CASE), 748 new TokenizerProperty(Token.KEYWORD, new String [] { "table" }, null, Flags.F_NO_CASE), 749 new TokenizerProperty(Token.KEYWORD, new String [] { "span" }, null, Flags.F_NO_CASE), 750 new TokenizerProperty(Token.KEYWORD, new String [] { "layer" }, null, Flags.F_NO_CASE), 751 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { ">>>" }, new Object (), 0, Flags.F_NO_CASE ), 752 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { ">>" }, null, 0, Flags.F_NO_CASE ), 753 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "<<" }, new Object (), 0, Flags.F_NO_CASE ), 754 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "+=" }, null, 0, Flags.F_NO_CASE ), 755 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "-=" }, new Object (), 0, Flags.F_NO_CASE ), 756 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "++" }, null, 0, Flags.F_NO_CASE ), 757 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "+++" }, new Object (), 0, Flags.F_NO_CASE ), 758 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "*=" }, null, 0, Flags.F_NO_CASE ), 759 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "**" }, null, 0, Flags.F_NO_CASE ), 760 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "**=" }, null, 0, Flags.F_NO_CASE ), 761 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "/=" }, null, 0, Flags.F_NO_CASE ), 762 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "/" }, null, 0, Flags.F_NO_CASE ), 763 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "+" }, null, 0, Flags.F_NO_CASE ), 764 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "\u20AC" }, null, 0, Flags.F_NO_CASE ), new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "@" }, null, 0, Flags.F_NO_CASE ), 766 new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "\u00C4" }, null, Flags.F_NO_CASE ), new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "\u00D6" }, null, Flags.F_NO_CASE ), new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "\u00DC" }, null, Flags.F_NO_CASE ), new TokenizerProperty(Token.SPECIAL_SEQUENCE, new String [] { "\u00DF" }, null, Flags.F_NO_CASE ) }; 771 772 static final String _patternMatchingStrings[] = { 773 "1", 774 "23.95", 775 "-10435.3394", 776 "+2", 777 "+34543", 778 "+445.435345830", 779 "003", 780 "0234.000023", 781 "-0.0", 782 "+0.0", 783 "Gonzo", 784 "kermit", 785 "Kermit2", 786 "_myMuppet", 787 "_9934abc", 788 "_a_b_c_1_", 789 "a__1", 790 "aA_123B_C", 791 }; 792 793 794 private TokenizerProperties _properties = null; 798 private TokenizerPropertyEvent _currEvent = null; 799 private char[] _currData = new char[8192]; 800 private int _currStartPos = 0; 801 private int _currDataLength = 0; 802 } 803 | Popular Tags |