bixbite 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (194) hide show
  1. data/LICENSE +20 -0
  2. data/README.markdown +49 -0
  3. data/VERSION +1 -0
  4. data/bin/bixbite +73 -0
  5. data/lib/bixbite.rb +13 -0
  6. data/lib/bixbite/command.rb +14 -0
  7. data/lib/bixbite/create.rb +76 -0
  8. data/template/Rakefile +25 -0
  9. data/template/assets/bixbite/Rakefile.rb +297 -0
  10. data/template/assets/naturaldocs/NaturalDocs/Config/Languages.txt +286 -0
  11. data/template/assets/naturaldocs/NaturalDocs/Config/Topics.txt +382 -0
  12. data/template/assets/naturaldocs/NaturalDocs/Help/customizinglanguages.html +52 -0
  13. data/template/assets/naturaldocs/NaturalDocs/Help/customizingtopics.html +74 -0
  14. data/template/assets/naturaldocs/NaturalDocs/Help/documenting.html +58 -0
  15. data/template/assets/naturaldocs/NaturalDocs/Help/documenting/reference.html +146 -0
  16. data/template/assets/naturaldocs/NaturalDocs/Help/documenting/walkthrough.html +180 -0
  17. data/template/assets/naturaldocs/NaturalDocs/Help/example/Default.css +528 -0
  18. data/template/assets/naturaldocs/NaturalDocs/Help/example/NaturalDocs.js +204 -0
  19. data/template/assets/naturaldocs/NaturalDocs/Help/examples.css +90 -0
  20. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/background.png +0 -0
  21. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/leftside.png +0 -0
  22. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/logo.png +0 -0
  23. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbody.png +0 -0
  24. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overbodybg.png +0 -0
  25. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overleftmargin.png +0 -0
  26. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenu.png +0 -0
  27. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/overmenubg.png +0 -0
  28. data/template/assets/naturaldocs/NaturalDocs/Help/images/header/rightside.png +0 -0
  29. data/template/assets/naturaldocs/NaturalDocs/Help/images/logo.gif +0 -0
  30. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/about.png +0 -0
  31. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/background.png +0 -0
  32. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomleft.png +0 -0
  33. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/bottomright.png +0 -0
  34. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/community.png +0 -0
  35. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/customizing.png +0 -0
  36. data/template/assets/naturaldocs/NaturalDocs/Help/images/menu/using.png +0 -0
  37. data/template/assets/naturaldocs/NaturalDocs/Help/index.html +9 -0
  38. data/template/assets/naturaldocs/NaturalDocs/Help/javascript/BrowserStyles.js +77 -0
  39. data/template/assets/naturaldocs/NaturalDocs/Help/javascript/PNGHandling.js +72 -0
  40. data/template/assets/naturaldocs/NaturalDocs/Help/keywords.html +38 -0
  41. data/template/assets/naturaldocs/NaturalDocs/Help/languages.html +32 -0
  42. data/template/assets/naturaldocs/NaturalDocs/Help/menu.html +79 -0
  43. data/template/assets/naturaldocs/NaturalDocs/Help/output.html +84 -0
  44. data/template/assets/naturaldocs/NaturalDocs/Help/running.html +40 -0
  45. data/template/assets/naturaldocs/NaturalDocs/Help/styles.css +290 -0
  46. data/template/assets/naturaldocs/NaturalDocs/Help/styles.html +52 -0
  47. data/template/assets/naturaldocs/NaturalDocs/Help/troubleshooting.html +18 -0
  48. data/template/assets/naturaldocs/NaturalDocs/Info/CSSGuide.txt +947 -0
  49. data/template/assets/naturaldocs/NaturalDocs/Info/File Parsing.txt +83 -0
  50. data/template/assets/naturaldocs/NaturalDocs/Info/HTMLTestCases.pm +269 -0
  51. data/template/assets/naturaldocs/NaturalDocs/Info/Languages.txt +107 -0
  52. data/template/assets/naturaldocs/NaturalDocs/Info/NDMarkup.txt +91 -0
  53. data/template/assets/naturaldocs/NaturalDocs/Info/Symbol Management.txt +59 -0
  54. data/template/assets/naturaldocs/NaturalDocs/Info/images/Logo.png +0 -0
  55. data/template/assets/naturaldocs/NaturalDocs/JavaScript/NaturalDocs.js +836 -0
  56. data/template/assets/naturaldocs/NaturalDocs/License-GPL.txt +341 -0
  57. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/BinaryFile.pm +294 -0
  58. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder.pm +280 -0
  59. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/Base.pm +348 -0
  60. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/FramedHTML.pm +345 -0
  61. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTML.pm +398 -0
  62. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Builder/HTMLBase.pm +3693 -0
  63. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy.pm +860 -0
  64. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/Class.pm +412 -0
  65. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ClassHierarchy/File.pm +157 -0
  66. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ConfigFile.pm +497 -0
  67. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Constants.pm +165 -0
  68. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/DefineMembers.pm +100 -0
  69. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Error.pm +305 -0
  70. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/File.pm +540 -0
  71. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable.pm +383 -0
  72. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/Reference.pm +44 -0
  73. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ImageReferenceTable/String.pm +110 -0
  74. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages.pm +1475 -0
  75. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/ActionScript.pm +1473 -0
  76. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Ada.pm +38 -0
  77. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced.pm +828 -0
  78. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/Scope.pm +95 -0
  79. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Advanced/ScopeChange.pm +70 -0
  80. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Base.pm +832 -0
  81. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/CSharp.pm +1484 -0
  82. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/PLSQL.pm +319 -0
  83. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Pascal.pm +143 -0
  84. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Perl.pm +1370 -0
  85. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype.pm +92 -0
  86. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Prototype/Parameter.pm +87 -0
  87. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Simple.pm +503 -0
  88. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Languages/Tcl.pm +219 -0
  89. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu.pm +3406 -0
  90. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Menu/Entry.pm +201 -0
  91. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/NDMarkup.pm +76 -0
  92. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser.pm +1331 -0
  93. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/JavaDoc.pm +464 -0
  94. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/Native.pm +1060 -0
  95. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Parser/ParsedTopic.pm +253 -0
  96. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project.pm +1402 -0
  97. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/ImageFile.pm +160 -0
  98. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Project/SourceFile.pm +113 -0
  99. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/ReferenceString.pm +334 -0
  100. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings.pm +1418 -0
  101. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Settings/BuildTarget.pm +66 -0
  102. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB.pm +678 -0
  103. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Extension.pm +84 -0
  104. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/File.pm +129 -0
  105. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/Item.pm +201 -0
  106. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/ItemDefinition.pm +45 -0
  107. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SourceDB/WatchedFileDefinitions.pm +159 -0
  108. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/StatusMessage.pm +102 -0
  109. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolString.pm +212 -0
  110. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable.pm +1984 -0
  111. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/File.pm +186 -0
  112. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/IndexElement.pm +522 -0
  113. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Reference.pm +273 -0
  114. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/ReferenceTarget.pm +97 -0
  115. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/Symbol.pm +428 -0
  116. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/SymbolTable/SymbolDefinition.pm +96 -0
  117. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics.pm +1319 -0
  118. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Topics/Type.pm +151 -0
  119. data/template/assets/naturaldocs/NaturalDocs/Modules/NaturalDocs/Version.pm +384 -0
  120. data/template/assets/naturaldocs/NaturalDocs/NaturalDocs +400 -0
  121. data/template/assets/naturaldocs/NaturalDocs/NaturalDocs.bat +17 -0
  122. data/template/assets/naturaldocs/NaturalDocs/Styles/Default.css +767 -0
  123. data/template/assets/naturaldocs/NaturalDocs/Styles/Roman.css +765 -0
  124. data/template/assets/naturaldocs/NaturalDocs/Styles/Small.css +763 -0
  125. data/template/assets/utilities/pngout +0 -0
  126. data/template/deploy/public_html/.htaccess +0 -0
  127. data/template/documentation/js/.htaccess +0 -0
  128. data/template/src/html/.htaccess +76 -0
  129. data/template/src/html/css/cmn/global.css +96 -0
  130. data/template/src/html/css/cmn/ie.css +15 -0
  131. data/template/src/html/css/cmn/ie6.css +15 -0
  132. data/template/src/html/images/cmn/.htaccess +0 -0
  133. data/template/src/html/images/tmp/.htaccess +0 -0
  134. data/template/src/html/includes/debug.inc +5 -0
  135. data/template/src/html/includes/footer.inc +52 -0
  136. data/template/src/html/includes/header.inc +61 -0
  137. data/template/src/html/includes/html.inc +3 -0
  138. data/template/src/html/includes/namespace.inc +19 -0
  139. data/template/src/html/includes/page.inc +151 -0
  140. data/template/src/html/index.html +35 -0
  141. data/template/src/html/js/cmn/bootstrap.js +74 -0
  142. data/template/src/html/js/cmn/global.js +142 -0
  143. data/template/src/html/js/cmn/lib/LAB.js +348 -0
  144. data/template/src/html/min/.htaccess +4 -0
  145. data/template/src/html/min/MinifyCLI.php +19 -0
  146. data/template/src/html/min/README.txt +132 -0
  147. data/template/src/html/min/builder/_index.js +242 -0
  148. data/template/src/html/min/builder/bm.js +36 -0
  149. data/template/src/html/min/builder/index.php +182 -0
  150. data/template/src/html/min/builder/ocCheck.php +36 -0
  151. data/template/src/html/min/builder/rewriteTest.js +1 -0
  152. data/template/src/html/min/config.php +187 -0
  153. data/template/src/html/min/groupsConfig.php +34 -0
  154. data/template/src/html/min/index.php +66 -0
  155. data/template/src/html/min/lib/FirePHP.php +1370 -0
  156. data/template/src/html/min/lib/HTTP/ConditionalGet.php +348 -0
  157. data/template/src/html/min/lib/HTTP/Encoder.php +326 -0
  158. data/template/src/html/min/lib/JSMin.php +314 -0
  159. data/template/src/html/min/lib/JSMinPlus.php +1872 -0
  160. data/template/src/html/min/lib/Minify.php +532 -0
  161. data/template/src/html/min/lib/Minify/Build.php +103 -0
  162. data/template/src/html/min/lib/Minify/CSS.php +83 -0
  163. data/template/src/html/min/lib/Minify/CSS/Compressor.php +250 -0
  164. data/template/src/html/min/lib/Minify/CSS/UriRewriter.php +270 -0
  165. data/template/src/html/min/lib/Minify/Cache/APC.php +130 -0
  166. data/template/src/html/min/lib/Minify/Cache/File.php +125 -0
  167. data/template/src/html/min/lib/Minify/Cache/Memcache.php +137 -0
  168. data/template/src/html/min/lib/Minify/ClosureCompiler.php +85 -0
  169. data/template/src/html/min/lib/Minify/CommentPreserver.php +90 -0
  170. data/template/src/html/min/lib/Minify/Controller/Base.php +202 -0
  171. data/template/src/html/min/lib/Minify/Controller/Files.php +78 -0
  172. data/template/src/html/min/lib/Minify/Controller/Groups.php +94 -0
  173. data/template/src/html/min/lib/Minify/Controller/MinApp.php +132 -0
  174. data/template/src/html/min/lib/Minify/Controller/Page.php +82 -0
  175. data/template/src/html/min/lib/Minify/Controller/Version1.php +118 -0
  176. data/template/src/html/min/lib/Minify/HTML.php +245 -0
  177. data/template/src/html/min/lib/Minify/ImportProcessor.php +157 -0
  178. data/template/src/html/min/lib/Minify/Lines.php +131 -0
  179. data/template/src/html/min/lib/Minify/Logger.php +45 -0
  180. data/template/src/html/min/lib/Minify/Packer.php +37 -0
  181. data/template/src/html/min/lib/Minify/Source.php +187 -0
  182. data/template/src/html/min/lib/Minify/YUICompressor.php +139 -0
  183. data/template/src/html/min/lib/Solar/Dir.php +199 -0
  184. data/template/src/html/min/lib/closure-compiler.jar +0 -0
  185. data/template/src/html/min/lib/yuicompressor-2.4.2.jar +0 -0
  186. data/template/src/html/min/utils.php +90 -0
  187. data/template/src/templates/css/template.css +7 -0
  188. data/template/src/templates/js/template.js +72 -0
  189. data/template/src/templates/template.html +18 -0
  190. data/template/src/yaml/config.yml +46 -0
  191. data/template/src/yaml/deploy.yml +35 -0
  192. data/test/bixbite_test.rb +7 -0
  193. data/test/test_helper.rb +10 -0
  194. metadata +278 -0
@@ -0,0 +1,92 @@
1
+ ###############################################################################
2
+ #
3
+ # Class: NaturalDocs::Languages::Prototype
4
+ #
5
+ ###############################################################################
6
+ #
7
+ # A data class for storing parsed prototypes.
8
+ #
9
+ ###############################################################################
10
+
11
+ # This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
12
+ # Natural Docs is licensed under the GPL
13
+
14
+ use strict;
15
+ use integer;
16
+
17
+ use NaturalDocs::Languages::Prototype::Parameter;
18
+
19
+
20
+ package NaturalDocs::Languages::Prototype;
21
+
22
+ use NaturalDocs::DefineMembers 'BEFORE_PARAMETERS', 'BeforeParameters()', 'SetBeforeParameters()',
23
+ 'AFTER_PARAMETERS', 'AfterParameters()', 'SetAfterParameters()',
24
+ 'PARAMETERS', 'Parameters()';
25
+ # Dependency: New(), constant order, no parents.
26
+
27
+
28
+ #
29
+ # Function: New
30
+ #
31
+ # Creates and returns a new prototype object.
32
+ #
33
+ # Parameters:
34
+ #
35
+ # beforeParameters - The part of the prototype before the parameter list.
36
+ # afterParameters - The part of the prototype after the parameter list.
37
+ #
38
+ # You cannot set the parameters from here. Use <AddParameter()>.
39
+ #
40
+ sub New #(beforeParameters, afterParameters)
41
+ {
42
+ my ($package, @params) = @_;
43
+
44
+ # Dependency: Constant order, no parents.
45
+
46
+ my $object = [ @params ];
47
+ bless $object, $package;
48
+
49
+ return $object;
50
+ };
51
+
52
+
53
+ #
54
+ # Functions: Members
55
+ #
56
+ # BeforeParameters - Returns the part of the prototype before the parameter list. If there is no parameter list, this will be the
57
+ # only thing that returns content.
58
+ # SetBeforeParameters - Replaces the part of the prototype before the parameter list.
59
+ # AfterParameters - Returns the part of the prototype after the parameter list, if any.
60
+ # SetAfterParameters - Replaces the part of the prototype after the parameter list.
61
+ # Parameters - Returns the parameter list as an arrayref of <NaturalDocs::Languages::Prototype::Parameters>, or undef if none.
62
+ #
63
+
64
+ #
65
+ # Function: AddParameter
66
+ #
67
+ # Adds a <NaturalDocs::Languages::Prototype::Parameter> to the list.
68
+ #
69
+ sub AddParameter #(parameter)
70
+ {
71
+ my ($self, $parameter) = @_;
72
+
73
+ if (!defined $self->[PARAMETERS])
74
+ { $self->[PARAMETERS] = [ ]; };
75
+
76
+ push @{$self->[PARAMETERS]}, $parameter;
77
+ };
78
+
79
+
80
+ #
81
+ # Function: OnlyBeforeParameters
82
+ #
83
+ # Returns whether <BeforeParameters()> is the only thing set.
84
+ #
85
+ sub OnlyBeforeParameters
86
+ {
87
+ my $self = shift;
88
+ return (!defined $self->[PARAMETERS] && !defined $self->[AFTER_PARAMETERS]);
89
+ };
90
+
91
+
92
+ 1;
@@ -0,0 +1,87 @@
1
+ ###############################################################################
2
+ #
3
+ # Class: NaturalDocs::Languages::Prototype::Parameter
4
+ #
5
+ ###############################################################################
6
+ #
7
+ # A data class for storing parsed prototype parameters.
8
+ #
9
+ ###############################################################################
10
+
11
+ # This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
12
+ # Natural Docs is licensed under the GPL
13
+
14
+ use strict;
15
+ use integer;
16
+
17
+ package NaturalDocs::Languages::Prototype::Parameter;
18
+
19
+ use NaturalDocs::DefineMembers 'TYPE', 'Type()', 'SetType()',
20
+ 'TYPE_PREFIX', 'TypePrefix()', 'SetTypePrefix()',
21
+ 'NAME', 'Name()', 'SetName()',
22
+ 'NAME_PREFIX', 'NamePrefix()', 'SetNamePrefix()',
23
+ 'DEFAULT_VALUE', 'DefaultValue()', 'SetDefaultValue()',
24
+ 'DEFAULT_VALUE_PREFIX', 'DefaultValuePrefix()', 'SetDefaultValuePrefix()';
25
+ # Dependency: New() depends on the order of these constants and that they don't inherit from another class.
26
+
27
+
28
+ #
29
+ # Constants: Members
30
+ #
31
+ # The object is implemented as a blessed arrayref, with the following constants as its indexes.
32
+ #
33
+ # TYPE - The parameter type, if any.
34
+ # TYPE_PREFIX - The parameter type prefix which should be aligned separately, if any.
35
+ # NAME - The parameter name.
36
+ # NAME_PREFIX - The parameter name prefix which should be aligned separately, if any.
37
+ # DEFAULT_VALUE - The default value expression, if any.
38
+ # DEFAULT_VALUE_PREFIX - The default value prefix which should be aligned separately, if any.
39
+ #
40
+
41
+ #
42
+ # Function: New
43
+ #
44
+ # Creates and returns a new prototype object.
45
+ #
46
+ # Parameters:
47
+ #
48
+ # type - The parameter type, if any.
49
+ # typePrefix - The parameter type prefix which should be aligned separately, if any.
50
+ # name - The parameter name.
51
+ # namePrefix - The parameter name prefix which should be aligned separately, if any.
52
+ # defaultValue - The default value expression, if any.
53
+ # defaultValuePrefix - The default value prefix which should be aligned separately, if any.
54
+ #
55
+ sub New #(type, typePrefix, name, namePrefix, defaultValue, defaultValuePrefix)
56
+ {
57
+ my ($package, @params) = @_;
58
+
59
+ # Dependency: This depends on the order of the parameters being the same as the order of the constants, and that the
60
+ # constants don't inherit from another class.
61
+
62
+ my $object = [ @params ];
63
+ bless $object, $package;
64
+
65
+ return $object;
66
+ };
67
+
68
+
69
+ #
70
+ # Functions: Members
71
+ #
72
+ # Type - The parameter type, if any.
73
+ # SetType - Replaces the parameter type.
74
+ # TypePrefix - The parameter type prefix, which should be aligned separately, if any.
75
+ # SetTypePrefix - Replaces the parameter type prefix.
76
+ # Name - The parameter name.
77
+ # SetName - Replaces the parameter name.
78
+ # NamePrefix - The parameter name prefix, which should be aligned separately, if any.
79
+ # SetNamePrefix - Replaces the parameter name prefix.
80
+ # DefaultValue - The default value expression, if any.
81
+ # SetDefaultValue - Replaces the default value expression.
82
+ # DefaultValuePrefix - The default value prefix, which should be aligned separately, if any.
83
+ # SetDefaultValuePrefix - Replaces the default value prefix.
84
+ #
85
+
86
+
87
+ 1;
@@ -0,0 +1,503 @@
1
+ ###############################################################################
2
+ #
3
+ # Class: NaturalDocs::Languages::Simple
4
+ #
5
+ ###############################################################################
6
+ #
7
+ # A class containing the characteristics of a particular programming language for basic support within Natural Docs.
8
+ # Also serves as a base class for languages that break from general conventions, such as not having parameter lists use
9
+ # parenthesis and commas.
10
+ #
11
+ ###############################################################################
12
+
13
+ # This file is part of Natural Docs, which is Copyright (C) 2003-2008 Greg Valure
14
+ # Natural Docs is licensed under the GPL
15
+
16
+ use strict;
17
+ use integer;
18
+
19
+ package NaturalDocs::Languages::Simple;
20
+
21
+ use base 'NaturalDocs::Languages::Base';
22
+ use base 'Exporter';
23
+
24
+ our @EXPORT = ( 'ENDER_ACCEPT', 'ENDER_IGNORE', 'ENDER_ACCEPT_AND_CONTINUE', 'ENDER_REVERT_TO_ACCEPTED' );
25
+
26
+
27
+ use NaturalDocs::DefineMembers 'LINE_COMMENT_SYMBOLS', 'LineCommentSymbols()', 'SetLineCommentSymbols() duparrayref',
28
+ 'BLOCK_COMMENT_SYMBOLS', 'BlockCommentSymbols()',
29
+ 'SetBlockCommentSymbols() duparrayref',
30
+ 'PROTOTYPE_ENDERS',
31
+ 'LINE_EXTENDER', 'LineExtender()', 'SetLineExtender()',
32
+ 'PACKAGE_SEPARATOR', 'PackageSeparator()',
33
+ 'PACKAGE_SEPARATOR_WAS_SET', 'PackageSeparatorWasSet()',
34
+ 'ENUM_VALUES', 'EnumValues()',
35
+ 'ENUM_VALUES_WAS_SET', 'EnumValuesWasSet()';
36
+
37
+ #
38
+ # Function: New
39
+ #
40
+ # Creates and returns a new object.
41
+ #
42
+ # Parameters:
43
+ #
44
+ # name - The name of the language.
45
+ #
46
+ sub New #(name)
47
+ {
48
+ my ($selfPackage, $name) = @_;
49
+
50
+ my $object = $selfPackage->SUPER::New($name);
51
+
52
+ $object->[ENUM_VALUES] = ::ENUM_GLOBAL();
53
+ $object->[PACKAGE_SEPARATOR] = '.';
54
+
55
+ return $object;
56
+ };
57
+
58
+
59
+ #
60
+ # Functions: Members
61
+ #
62
+ # LineCommentSymbols - Returns an arrayref of symbols that start a line comment, or undef if none.
63
+ # SetLineCommentSymbols - Replaces the arrayref of symbols that start a line comment.
64
+ # BlockCommentSymbols - Returns an arrayref of start/end symbol pairs that specify a block comment, or undef if none. Pairs
65
+ # are specified with two consecutive array entries.
66
+ # SetBlockCommentSymbols - Replaces the arrayref of start/end symbol pairs that specify a block comment. Pairs are
67
+ # specified with two consecutive array entries.
68
+ # LineExtender - Returns the symbol to ignore a line break in languages where line breaks are significant.
69
+ # SetLineExtender - Replaces the symbol to ignore a line break in languages where line breaks are significant.
70
+ # PackageSeparator - Returns the package separator symbol.
71
+ # PackageSeparatorWasSet - Returns whether the package separator symbol was ever changed from the default.
72
+ #
73
+
74
+ #
75
+ # Function: SetPackageSeparator
76
+ # Replaces the language's package separator string.
77
+ #
78
+ sub SetPackageSeparator #(separator)
79
+ {
80
+ my ($self, $separator) = @_;
81
+ $self->[PACKAGE_SEPARATOR] = $separator;
82
+ $self->[PACKAGE_SEPARATOR_WAS_SET] = 1;
83
+ };
84
+
85
+
86
+ #
87
+ # Functions: Members
88
+ #
89
+ # EnumValues - Returns the <EnumValuesType> that describes how the language handles enums.
90
+ # EnumValuesWasSet - Returns whether <EnumValues> was ever changed from the default.
91
+
92
+
93
+ #
94
+ # Function: SetEnumValues
95
+ # Replaces the <EnumValuesType> that describes how the language handles enums.
96
+ #
97
+ sub SetEnumValues #(EnumValuesType newBehavior)
98
+ {
99
+ my ($self, $behavior) = @_;
100
+ $self->[ENUM_VALUES] = $behavior;
101
+ $self->[ENUM_VALUES_WAS_SET] = 1;
102
+ };
103
+
104
+
105
+ #
106
+ # Function: PrototypeEndersFor
107
+ #
108
+ # Returns an arrayref of prototype ender symbols for the passed <TopicType>, or undef if none.
109
+ #
110
+ sub PrototypeEndersFor #(type)
111
+ {
112
+ my ($self, $type) = @_;
113
+
114
+ if (defined $self->[PROTOTYPE_ENDERS])
115
+ { return $self->[PROTOTYPE_ENDERS]->{$type}; }
116
+ else
117
+ { return undef; };
118
+ };
119
+
120
+
121
+ #
122
+ # Function: SetPrototypeEndersFor
123
+ #
124
+ # Replaces the arrayref of prototype ender symbols for the passed <TopicType>.
125
+ #
126
+ sub SetPrototypeEndersFor #(type, enders)
127
+ {
128
+ my ($self, $type, $enders) = @_;
129
+
130
+ if (!defined $self->[PROTOTYPE_ENDERS])
131
+ { $self->[PROTOTYPE_ENDERS] = { }; };
132
+
133
+ if (!defined $enders)
134
+ { delete $self->[PROTOTYPE_ENDERS]->{$type}; }
135
+ else
136
+ {
137
+ $self->[PROTOTYPE_ENDERS]->{$type} = [ @$enders ];
138
+ };
139
+ };
140
+
141
+
142
+
143
+
144
+ ###############################################################################
145
+ # Group: Parsing Functions
146
+
147
+
148
+ #
149
+ # Function: ParseFile
150
+ #
151
+ # Parses the passed source file, sending comments acceptable for documentation to <NaturalDocs::Parser->OnComment()>
152
+ # and all other sections to <OnCode()>.
153
+ #
154
+ # Parameters:
155
+ #
156
+ # sourceFile - The <FileName> of the source file to parse.
157
+ # topicList - A reference to the list of <NaturalDocs::Parser::ParsedTopics> being built by the file.
158
+ #
159
+ # Returns:
160
+ #
161
+ # Since this class cannot automatically document the code or generate a scope record, it always returns ( undef, undef ).
162
+ #
163
+ sub ParseFile #(sourceFile, topicsList)
164
+ {
165
+ my ($self, $sourceFile, $topicsList) = @_;
166
+
167
+ open(SOURCEFILEHANDLE, '<' . $sourceFile)
168
+ or die "Couldn't open input file " . $sourceFile . "\n";
169
+
170
+ my @commentLines;
171
+ my @codeLines;
172
+ my $lastCommentTopicCount = 0;
173
+
174
+ if ($self->Name() eq 'Text File')
175
+ {
176
+ my $line = <SOURCEFILEHANDLE>;
177
+
178
+ # On the very first line, remove a Unicode BOM if present. Information on it available at:
179
+ # http://www.unicode.org/faq/utf_bom.html#BOM
180
+ $line =~ s/^\xEF\xBB\xBF//;
181
+
182
+ while ($line)
183
+ {
184
+ ::XChomp(\$line);
185
+ push @commentLines, $line;
186
+ $line = <SOURCEFILEHANDLE>;
187
+ };
188
+
189
+ NaturalDocs::Parser->OnComment(\@commentLines, 1);
190
+ }
191
+
192
+ else
193
+ {
194
+ my $line = <SOURCEFILEHANDLE>;
195
+ my $lineNumber = 1;
196
+
197
+ # On the very first line, remove a Unicode BOM if present. Information on it available at:
198
+ # http://www.unicode.org/faq/utf_bom.html#BOM
199
+ $line =~ s/^\xEF\xBB\xBF//;
200
+
201
+ while (defined $line)
202
+ {
203
+ ::XChomp(\$line);
204
+ my $originalLine = $line;
205
+
206
+
207
+ # Retrieve single line comments. This leaves $line at the next line.
208
+
209
+ if ($self->StripOpeningSymbols(\$line, $self->LineCommentSymbols()))
210
+ {
211
+ do
212
+ {
213
+ push @commentLines, $line;
214
+ $line = <SOURCEFILEHANDLE>;
215
+
216
+ if (!defined $line)
217
+ { goto EndDo; };
218
+
219
+ ::XChomp(\$line);
220
+ }
221
+ while ($self->StripOpeningSymbols(\$line, $self->LineCommentSymbols()));
222
+
223
+ EndDo: # I hate Perl sometimes.
224
+ }
225
+
226
+
227
+ # Retrieve multiline comments. This leaves $line at the next line.
228
+
229
+ elsif (my $closingSymbol = $self->StripOpeningBlockSymbols(\$line, $self->BlockCommentSymbols()))
230
+ {
231
+ # Note that it is possible for a multiline comment to start correctly but not end so. We want those comments to stay in
232
+ # the code. For example, look at this prototype with this splint annotation:
233
+ #
234
+ # int get_array(integer_t id,
235
+ # /*@out@*/ array_t array);
236
+ #
237
+ # The annotation starts correctly but doesn't end so because it is followed by code on the same line.
238
+
239
+ my $lineRemainder;
240
+
241
+ for (;;)
242
+ {
243
+ $lineRemainder = $self->StripClosingSymbol(\$line, $closingSymbol);
244
+
245
+ push @commentLines, $line;
246
+
247
+ # If we found an end comment symbol...
248
+ if (defined $lineRemainder)
249
+ { last; };
250
+
251
+ $line = <SOURCEFILEHANDLE>;
252
+
253
+ if (!defined $line)
254
+ { last; };
255
+
256
+ ::XChomp(\$line);
257
+ };
258
+
259
+ if ($lineRemainder !~ /^[ \t]*$/)
260
+ {
261
+ # If there was something past the closing symbol this wasn't an acceptable comment, so move the lines to code.
262
+ push @codeLines, @commentLines;
263
+ @commentLines = ( );
264
+ };
265
+
266
+ $line = <SOURCEFILEHANDLE>;
267
+ }
268
+
269
+
270
+ # Otherwise just add it to the code.
271
+
272
+ else
273
+ {
274
+ push @codeLines, $line;
275
+ $line = <SOURCEFILEHANDLE>;
276
+ };
277
+
278
+
279
+ # If there were comments, send them to Parser->OnComment().
280
+
281
+ if (scalar @commentLines)
282
+ {
283
+ # First process any code lines before the comment.
284
+ if (scalar @codeLines)
285
+ {
286
+ $self->OnCode(\@codeLines, $lineNumber, $topicsList, $lastCommentTopicCount);
287
+ $lineNumber += scalar @codeLines;
288
+ @codeLines = ( );
289
+ };
290
+
291
+ $lastCommentTopicCount = NaturalDocs::Parser->OnComment(\@commentLines, $lineNumber);
292
+ $lineNumber += scalar @commentLines;
293
+ @commentLines = ( );
294
+ };
295
+
296
+ }; # while (defined $line)
297
+
298
+
299
+ # Clean up any remaining code.
300
+ if (scalar @codeLines)
301
+ {
302
+ $self->OnCode(\@codeLines, $lineNumber, $topicsList, $lastCommentTopicCount);
303
+ @codeLines = ( );
304
+ };
305
+
306
+ };
307
+
308
+ close(SOURCEFILEHANDLE);
309
+
310
+ return ( undef, undef );
311
+ };
312
+
313
+
314
+ #
315
+ # Function: OnCode
316
+ #
317
+ # Called whenever a section of code is encountered by the parser. Is used to find the prototype of the last topic created.
318
+ #
319
+ # Parameters:
320
+ #
321
+ # codeLines - The source code as an arrayref of lines.
322
+ # codeLineNumber - The line number of the first line of code.
323
+ # topicList - A reference to the list of <NaturalDocs::Parser::ParsedTopics> being built by the file.
324
+ # lastCommentTopicCount - The number of Natural Docs topics that were created by the last comment.
325
+ #
326
+ sub OnCode #(codeLines, codeLineNumber, topicList, lastCommentTopicCount)
327
+ {
328
+ my ($self, $codeLines, $codeLineNumber, $topicList, $lastCommentTopicCount) = @_;
329
+
330
+ if ($lastCommentTopicCount && defined $self->PrototypeEndersFor($topicList->[-1]->Type()))
331
+ {
332
+ my $lineIndex = 0;
333
+ my $prototype;
334
+
335
+ # Skip all blank lines before a prototype.
336
+ while ($lineIndex < scalar @$codeLines && $codeLines->[$lineIndex] =~ /^[ \t]*$/)
337
+ { $lineIndex++; };
338
+
339
+ my @tokens;
340
+ my $tokenIndex = 0;
341
+
342
+ my @brackets;
343
+ my $enders = $self->PrototypeEndersFor($topicList->[-1]->Type());
344
+
345
+ # Add prototype lines until we reach the end of the prototype or the end of the code lines.
346
+ while ($lineIndex < scalar @$codeLines)
347
+ {
348
+ my $line = $self->RemoveLineExtender($codeLines->[$lineIndex] . "\n");
349
+
350
+ push @tokens, $line =~ /([^\(\)\[\]\{\}\<\>]+|.)/g;
351
+
352
+ while ($tokenIndex < scalar @tokens)
353
+ {
354
+ # If we're not inside brackets, check for ender symbols.
355
+ if (!scalar @brackets)
356
+ {
357
+ my $startingIndex = 0;
358
+ my $testPrototype;
359
+
360
+ for (;;)
361
+ {
362
+ my ($enderIndex, $ender) = ::FindFirstSymbol($tokens[$tokenIndex], $enders, $startingIndex);
363
+
364
+ if ($enderIndex == -1)
365
+ { last; }
366
+ else
367
+ {
368
+ # We do this here so we don't duplicate prototype for every single token. Just the first time an ender symbol
369
+ # is found in one.
370
+ if (!defined $testPrototype)
371
+ { $testPrototype = $prototype; };
372
+
373
+ $testPrototype .= substr($tokens[$tokenIndex], $startingIndex, $enderIndex - $startingIndex);
374
+
375
+ my $enderResult;
376
+
377
+ # If the ender is all text and the character preceding or following it is as well, ignore it.
378
+ if ($ender =~ /^[a-z0-9]+$/i &&
379
+ ( ($enderIndex > 0 && substr($tokens[$tokenIndex], $enderIndex - 1, 1) =~ /^[a-z0-9_]$/i) ||
380
+ substr($tokens[$tokenIndex], $enderIndex + length($ender), 1) =~ /^[a-z0-9_]$/i ) )
381
+ { $enderResult = ENDER_IGNORE(); }
382
+ else
383
+ { $enderResult = $self->OnPrototypeEnd($topicList->[-1]->Type(), \$testPrototype, $ender); }
384
+
385
+ if ($enderResult == ENDER_IGNORE())
386
+ {
387
+ $testPrototype .= $ender;
388
+ $startingIndex = $enderIndex + length($ender);
389
+ }
390
+ elsif ($enderResult == ENDER_REVERT_TO_ACCEPTED())
391
+ {
392
+ return;
393
+ }
394
+ else # ENDER_ACCEPT || ENDER_ACCEPT_AND_CONTINUE
395
+ {
396
+ my $titleInPrototype = $topicList->[-1]->Title();
397
+
398
+ # Strip parenthesis so Function(2) and Function(int, int) will still match Function(anything).
399
+ $titleInPrototype =~ s/[\t ]*\([^\(]*$//;
400
+
401
+ if (index($testPrototype, $titleInPrototype) != -1)
402
+ {
403
+ $topicList->[-1]->SetPrototype( $self->NormalizePrototype($testPrototype) );
404
+ };
405
+
406
+ if ($enderResult == ENDER_ACCEPT())
407
+ { return; }
408
+ else # ENDER_ACCEPT_AND_CONTINUE
409
+ {
410
+ $testPrototype .= $ender;
411
+ $startingIndex = $enderIndex + length($ender);
412
+ };
413
+ };
414
+ };
415
+ };
416
+ }
417
+
418
+ # If we are inside brackets, check for closing symbols.
419
+ elsif ( ($tokens[$tokenIndex] eq ')' && $brackets[-1] eq '(') ||
420
+ ($tokens[$tokenIndex] eq ']' && $brackets[-1] eq '[') ||
421
+ ($tokens[$tokenIndex] eq '}' && $brackets[-1] eq '{') ||
422
+ ($tokens[$tokenIndex] eq '>' && $brackets[-1] eq '<') )
423
+ {
424
+ pop @brackets;
425
+ };
426
+
427
+ # Check for opening brackets.
428
+ if ($tokens[$tokenIndex] =~ /^[\(\[\{\<]$/)
429
+ {
430
+ push @brackets, $tokens[$tokenIndex];
431
+ };
432
+
433
+ $prototype .= $tokens[$tokenIndex];
434
+ $tokenIndex++;
435
+ };
436
+
437
+ $lineIndex++;
438
+ };
439
+
440
+ # If we got out of that while loop by running out of lines, there was no prototype.
441
+ };
442
+ };
443
+
444
+
445
+ use constant ENDER_ACCEPT => 1;
446
+ use constant ENDER_IGNORE => 2;
447
+ use constant ENDER_ACCEPT_AND_CONTINUE => 3;
448
+ use constant ENDER_REVERT_TO_ACCEPTED => 4;
449
+
450
+ #
451
+ # Function: OnPrototypeEnd
452
+ #
453
+ # Called whenever the end of a prototype is found so that there's a chance for derived classes to mark false positives.
454
+ #
455
+ # Parameters:
456
+ #
457
+ # type - The <TopicType> of the prototype.
458
+ # prototypeRef - A reference to the prototype so far, minus the ender in dispute.
459
+ # ender - The ender symbol.
460
+ #
461
+ # Returns:
462
+ #
463
+ # ENDER_ACCEPT - The ender is accepted and the prototype is finished.
464
+ # ENDER_IGNORE - The ender is rejected and parsing should continue. Note that the prototype will be rejected as a whole
465
+ # if all enders are ignored before reaching the end of the code.
466
+ # ENDER_ACCEPT_AND_CONTINUE - The ender is accepted so the prototype may stand as is. However, the prototype might
467
+ # also continue on so continue parsing. If there is no accepted ender between here and
468
+ # the end of the code this version will be accepted instead.
469
+ # ENDER_REVERT_TO_ACCEPTED - The expedition from ENDER_ACCEPT_AND_CONTINUE failed. Use the last accepted
470
+ # version and end parsing.
471
+ #
472
+ sub OnPrototypeEnd #(type, prototypeRef, ender)
473
+ {
474
+ return ENDER_ACCEPT();
475
+ };
476
+
477
+
478
+ #
479
+ # Function: RemoveLineExtender
480
+ #
481
+ # If the passed line has a line extender, returns it without the extender or the line break that follows. If it doesn't, or there are
482
+ # no line extenders defined, returns the passed line unchanged.
483
+ #
484
+ sub RemoveLineExtender #(line)
485
+ {
486
+ my ($self, $line) = @_;
487
+
488
+ if (defined $self->LineExtender())
489
+ {
490
+ my $lineExtenderIndex = rindex($line, $self->LineExtender());
491
+
492
+ if ($lineExtenderIndex != -1 &&
493
+ substr($line, $lineExtenderIndex + length($self->LineExtender())) =~ /^[ \t]*\n$/)
494
+ {
495
+ $line = substr($line, 0, $lineExtenderIndex) . ' ';
496
+ };
497
+ };
498
+
499
+ return $line;
500
+ };
501
+
502
+
503
+ 1;