Advertisement
philippxp

Untitled

Aug 23rd, 2011
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.16 KB | None | 0 0
  1. input = "/*! Kommentar A
  2.  
  3. @superclass NSObject
  4. @abstract Testclass abstract
  5. @availability Available in BMWAppKit 1.0 and later.
  6.  
  7. */
  8. @interface    TestClass : NSObject {
  9.  
  10. }
  11.  
  12. /*! Kommentar B
  13.  
  14. @abstract Testclass abstract
  15. @availability
  16.  
  17. */
  18. @interface    TestClass : NSObject {
  19.  
  20. }
  21. "
  22.  
  23. array = input.scan(/(\/\*!)(\s*)(.*)(\s*)(@superclass{1}\s*.*)?\s*(@abstract{1}\s*.*)?\s*(@availability{1}\s*.*)?(\s*)(\*\/)(\s*)(@interface){1}(\s*)([a-zA-Z]*)(\s*):(\s*)([a-zA-Z]*)(\s*)(\{)(\s*)(\})/)
  24. for i in 0...array.length()
  25.   for j in 0...array[i].length()
  26.     if(array[i][j] != nil)
  27.       print j.to_s() + " " + array[i][j] + "\n"
  28.     end
  29.   end
  30.   print "\n"
  31.   #print array[i].inspect + "\n"
  32. end
  33.  
  34.  
  35. ###output
  36. 0 /*!
  37. 1  
  38. 2 Kommentar A
  39. 3
  40.  
  41.  
  42. 4 @superclass NSObject
  43. 5 @abstract Testclass abstract
  44. 6 @availability Available in BMWAppKit 1.0 and later.
  45. 7
  46.  
  47.  
  48. 8 */
  49. 9
  50.  
  51. 10 @interface
  52. 11    
  53. 12 TestClass
  54. 13  
  55. 14  
  56. 15 NSObject
  57. 16  
  58. 17 {
  59. 18
  60.  
  61.  
  62. 19 }
  63.  
  64. 0 /*!
  65. 1  
  66. 2 Kommentar B
  67. 3
  68.  
  69.  
  70. 5 @abstract Testclass abstract
  71. 6 @availability
  72.  
  73.  
  74. 7
  75. 8 */
  76. 9
  77.  
  78. 10 @interface
  79. 11    
  80. 12 TestClass
  81. 13  
  82. 14  
  83. 15 NSObject
  84. 16  
  85. 17 {
  86. 18
  87.  
  88.  
  89. 19 }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement