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,273 @@
1
+ ###############################################################################
2
+ #
3
+ # Package: NaturalDocs::SymbolTable::Reference
4
+ #
5
+ ###############################################################################
6
+ #
7
+ # A class representing a symbol or a potential symbol.
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::SymbolTable::Reference;
18
+
19
+
20
+ ###############################################################################
21
+ # Group: Implementation
22
+
23
+ #
24
+ # Constants: Members
25
+ #
26
+ # The class is implemented as a blessed arrayref. The following constants are its members.
27
+ #
28
+ # DEFINITIONS - An existence hashref of the <FileNames> that define this reference.
29
+ # INTERPRETATIONS - A hashref of the possible interpretations of this reference. The keys are the <SymbolStrings>
30
+ # and the values are the scores.
31
+ # CURRENT_INTERPRETATION - The interpretation currently used as the reference target. It will be the interpretation with
32
+ # the highest score that is actually defined. If none are defined, this item will be undef.
33
+ #
34
+
35
+ # DEPENDENCY: New() depends on the order of these constants. If they change, New() has to be updated.
36
+ use constant DEFINITIONS => 0;
37
+ use constant INTERPRETATIONS => 1;
38
+ use constant CURRENT_INTERPRETATION => 2;
39
+
40
+
41
+ ###############################################################################
42
+ # Group: Modification Functions
43
+
44
+
45
+ #
46
+ # Function: New
47
+ #
48
+ # Creates and returns a new object.
49
+ #
50
+ sub New
51
+ {
52
+ my $package = shift;
53
+
54
+ # Let's make it safe, since normally you can pass values to New. Having them just be ignored would be an obscure error.
55
+ if (scalar @_)
56
+ { die "You can't pass values to NaturalDocs::SymbolTable::Reference->New()\n"; };
57
+
58
+ # DEPENDENCY: This code depends on the order of the member constants.
59
+ my $object = [ { }, { }, undef ];
60
+ bless $object, $package;
61
+
62
+ return $object;
63
+ };
64
+
65
+
66
+ #
67
+ # Function: AddDefinition
68
+ #
69
+ # Adds a reference definition.
70
+ #
71
+ # Parameters:
72
+ #
73
+ # file - The <FileName> that defines the reference.
74
+ #
75
+ sub AddDefinition #(file)
76
+ {
77
+ my ($self, $file) = @_;
78
+
79
+ $self->[DEFINITIONS]{$file} = 1;
80
+ };
81
+
82
+
83
+ #
84
+ # Function: DeleteDefinition
85
+ #
86
+ # Removes a reference definition.
87
+ #
88
+ # Parameters:
89
+ #
90
+ # file - The <FileName> which has the definition to delete.
91
+ #
92
+ sub DeleteDefinition #(file)
93
+ {
94
+ my ($self, $file) = @_;
95
+
96
+ delete $self->[DEFINITIONS]{$file};
97
+ };
98
+
99
+
100
+ #
101
+ # Function: AddInterpretation
102
+ #
103
+ # Adds a symbol that this reference can be interpreted as.
104
+ #
105
+ # Parameters:
106
+ #
107
+ # symbol - The <SymbolString>.
108
+ # score - The score of this interpretation.
109
+ #
110
+ sub AddInterpretation #(symbol, score)
111
+ {
112
+ my ($self, $symbol, $score) = @_;
113
+
114
+ $self->[INTERPRETATIONS]{$symbol} = $score;
115
+ };
116
+
117
+
118
+ #
119
+ # Function: DeleteInterpretation
120
+ #
121
+ # Deletes a symbol that this reference can be interpreted as.
122
+ #
123
+ # Parameters:
124
+ #
125
+ # symbol - The <SymbolString> to delete.
126
+ #
127
+ sub DeleteInterpretation #(symbol)
128
+ {
129
+ my ($self, $symbol) = @_;
130
+
131
+ delete $self->[INTERPRETATIONS]{$symbol};
132
+ };
133
+
134
+
135
+ #
136
+ # Function: DeleteAllInterpretationsButCurrent
137
+ #
138
+ # Deletes all interpretations except for the current one.
139
+ #
140
+ sub DeleteAllInterpretationsButCurrent
141
+ {
142
+ my $self = shift;
143
+
144
+ if ($self->HasCurrentInterpretation())
145
+ {
146
+ my $score = $self->CurrentScore();
147
+
148
+ # Fastest way to clear a hash except for one item? Make a new hash with just that item.
149
+ %{$self->[INTERPRETATIONS]} = ( $self->[CURRENT_INTERPRETATION] => $score );
150
+ };
151
+ };
152
+
153
+
154
+ #
155
+ # Function: SetCurrentInterpretation
156
+ #
157
+ # Changes the current interpretation. The new one must already have been added via <AddInterpretation()>.
158
+ #
159
+ # Parameters:
160
+ #
161
+ # symbol - The <SymbolString>l to make the current interpretation. Can be set to undef to clear it.
162
+ #
163
+ sub SetCurrentInterpretation #(symbol)
164
+ {
165
+ my ($self, $symbol) = @_;
166
+
167
+ $self->[CURRENT_INTERPRETATION] = $symbol;
168
+ };
169
+
170
+
171
+ ###############################################################################
172
+ # Group: Information Functions
173
+
174
+
175
+ #
176
+ # Function: Definitions
177
+ #
178
+ # Returns an array of all the <FileNames> that define this reference. If none do, returns an empty array.
179
+ #
180
+ sub Definitions
181
+ {
182
+ return keys %{$_[0]->[DEFINITIONS]};
183
+ };
184
+
185
+
186
+ #
187
+ # Function: IsDefined
188
+ #
189
+ # Returns whether the reference has any definitions or not.
190
+ #
191
+ sub IsDefined
192
+ {
193
+ return scalar keys %{$_[0]->[DEFINITIONS]};
194
+ };
195
+
196
+
197
+ #
198
+ # Function: IsDefinedIn
199
+ #
200
+ # Returns whether the reference is defined in the passed <FileName>.
201
+ #
202
+ sub IsDefinedIn #(file)
203
+ {
204
+ my ($self, $file) = @_;
205
+
206
+ return exists $self->[DEFINITIONS]{$file};
207
+ };
208
+
209
+
210
+ #
211
+ # Function: Interpretations
212
+ #
213
+ # Returns an array of all the <SymbolStrings> that this reference can be interpreted as. If none, returns an empty array.
214
+ #
215
+ sub Interpretations
216
+ {
217
+ return keys %{$_[0]->[INTERPRETATIONS]};
218
+ };
219
+
220
+
221
+ #
222
+ # Function: InterpretationsAndScores
223
+ #
224
+ # Returns a hash of all the <SymbolStrings> that this reference can be interpreted as and their scores. The keys are the <SymbolStrings>
225
+ # and the values are the scores. If none, returns an empty hash.
226
+ #
227
+ sub InterpretationsAndScores
228
+ {
229
+ return %{$_[0]->[INTERPRETATIONS]};
230
+ };
231
+
232
+
233
+ #
234
+ # Function: HasCurrentInterpretation
235
+ #
236
+ # Returns whether the reference has a current interpretation or not.
237
+ #
238
+ sub HasCurrentInterpretation
239
+ {
240
+ return defined $_[0]->[CURRENT_INTERPRETATION];
241
+ };
242
+
243
+
244
+ #
245
+ # Function: CurrentInterpretation
246
+ #
247
+ # Returns the <SymbolString> of the current interpretation, or undef if none.
248
+ #
249
+ sub CurrentInterpretation
250
+ {
251
+ return $_[0]->[CURRENT_INTERPRETATION];
252
+ };
253
+
254
+
255
+ #
256
+ # Function: CurrentScore
257
+ #
258
+ # Returns the score of the current interpretation, or undef if none.
259
+ #
260
+ sub CurrentScore
261
+ {
262
+ my $self = shift;
263
+
264
+ if (defined $self->[CURRENT_INTERPRETATION])
265
+ {
266
+ return $self->[INTERPRETATIONS]{ $self->[CURRENT_INTERPRETATION] };
267
+ }
268
+ else
269
+ { return undef; };
270
+ };
271
+
272
+
273
+ 1;
@@ -0,0 +1,97 @@
1
+ ###############################################################################
2
+ #
3
+ # Class: NaturalDocs::SymbolTable::ReferenceTarget
4
+ #
5
+ ###############################################################################
6
+ #
7
+ # A class for storing information about a reference target.
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::SymbolTable::ReferenceTarget;
18
+
19
+
20
+ ###############################################################################
21
+ # Group: Implementation
22
+
23
+ #
24
+ # Constants: Members
25
+ #
26
+ # The class is implemented as a blessed arrayref. The following constants are its members.
27
+ #
28
+ # SYMBOL - The target <SymbolString>.
29
+ # FILE - The <FileName> the target is defined in.
30
+ # TYPE - The target <TopicType>.
31
+ # PROTOTYPE - The target's prototype, or undef if none.
32
+ # SUMMARY - The target's summary, or undef if none.
33
+ #
34
+
35
+ # DEPENDENCY: New() depends on the order of these constants. If they change, New() has to be updated.
36
+ use constant SYMBOL => 0;
37
+ use constant FILE => 1;
38
+ use constant TYPE => 2;
39
+ use constant PROTOTYPE => 3;
40
+ use constant SUMMARY => 4;
41
+
42
+ ###############################################################################
43
+ # Group: Functions
44
+
45
+
46
+ #
47
+ # Function: New
48
+ #
49
+ # Creates and returns a new object.
50
+ #
51
+ # Parameters:
52
+ #
53
+ # symbol - The target <SymbolString>.
54
+ # file - The <FileName> the target is defined in.
55
+ # type - The <TopicType> of the target symbol.
56
+ # prototype - The target's prototype. Set to undef if not defined or not applicable.
57
+ # summary - The target's summary. Set to undef if not defined or not applicable.
58
+ #
59
+ sub New #(symbol, file, type, prototype, summary)
60
+ {
61
+ # DEPENDENCY: This code depends on the order of the member constants.
62
+
63
+ my $package = shift;
64
+
65
+ my $object = [ @_ ];
66
+ bless $object, $package;
67
+
68
+ return $object;
69
+ };
70
+
71
+
72
+ # Function: Symbol
73
+ # Returns the target's <SymbolString>.
74
+ sub Symbol
75
+ { return $_[0]->[SYMBOL]; };
76
+
77
+ # Function: File
78
+ # Returns the <FileName> the target is defined in.
79
+ sub File
80
+ { return $_[0]->[FILE]; };
81
+
82
+ # Function: Type
83
+ # Returns the target's <TopicType>.
84
+ sub Type
85
+ { return $_[0]->[TYPE]; };
86
+
87
+ # Function: Prototype
88
+ # Returns the target's prototype, or undef if not defined or not applicable.
89
+ sub Prototype
90
+ { return $_[0]->[PROTOTYPE]; };
91
+
92
+ # Function: Summary
93
+ # Returns the target's summary, or undef if not defined or not applicable.
94
+ sub Summary
95
+ { return $_[0]->[SUMMARY]; };
96
+
97
+ 1;
@@ -0,0 +1,428 @@
1
+ ###############################################################################
2
+ #
3
+ # Package: NaturalDocs::SymbolTable::Symbol
4
+ #
5
+ ###############################################################################
6
+ #
7
+ # A class representing a symbol or a potential symbol.
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::SymbolTable::Symbol;
18
+
19
+
20
+ ###############################################################################
21
+ # Group: Implementation
22
+
23
+ #
24
+ # Constants: Members
25
+ #
26
+ # The class is implemented as a blessed arrayref. The following constants are its members.
27
+ #
28
+ # DEFINITIONS - A hashref of all the files which define this symbol. The keys are the <FileNames>, and the values are
29
+ # <NaturalDocs::SymbolTable::SymbolDefinition> objects. If no files define this symbol, this item will
30
+ # be undef.
31
+ # GLOBAL_DEFINITION - The <FileName> which defines the global version of the symbol, which is what is used if
32
+ # a file references the symbol but does not have its own definition. If there are no definitions, this
33
+ # item will be undef.
34
+ # REFERENCES - A hashref of the references that can be interpreted as this symbol. This doesn't mean these
35
+ # references necessarily are. The keys are the reference strings, and the values are the scores of
36
+ # the interpretations. If no references can be interpreted as this symbol, this item will be undef.
37
+ #
38
+ use constant DEFINITIONS => 0;
39
+ use constant GLOBAL_DEFINITION => 1;
40
+ use constant REFERENCES => 2;
41
+
42
+
43
+ ###############################################################################
44
+ # Group: Modification Functions
45
+
46
+ #
47
+ # Function: New
48
+ #
49
+ # Creates and returns a new object.
50
+ #
51
+ sub New
52
+ {
53
+ my $package = shift;
54
+
55
+ # Let's make it safe, since normally you can pass values to New. Having them just be ignored would be an obscure error.
56
+ if (scalar @_)
57
+ { die "You can't pass values to NaturalDocs::SymbolTable::Symbol->New()\n"; };
58
+
59
+ my $object = [ undef, undef, undef ];
60
+ bless $object, $package;
61
+
62
+ return $object;
63
+ };
64
+
65
+ #
66
+ # Function: AddDefinition
67
+ #
68
+ # Adds a symbol definition. If this is the first definition for this symbol, it will become the global definition. If the definition
69
+ # already exists for the file, it will be ignored.
70
+ #
71
+ # Parameters:
72
+ #
73
+ # file - The <FileName> that defines the symbol.
74
+ # type - The <TopicType> of the definition.
75
+ # prototype - The prototype of the definition, if applicable. Undef otherwise.
76
+ # summary - The summary for the definition, if applicable. Undef otherwise.
77
+ #
78
+ # Returns:
79
+ #
80
+ # Whether this provided the first definition for this symbol.
81
+ #
82
+ sub AddDefinition #(file, type, prototype, summary)
83
+ {
84
+ my ($self, $file, $type, $prototype, $summary) = @_;
85
+
86
+ my $isFirst;
87
+
88
+ if (!defined $self->[DEFINITIONS])
89
+ {
90
+ $self->[DEFINITIONS] = { };
91
+ $self->[GLOBAL_DEFINITION] = $file;
92
+ $isFirst = 1;
93
+ };
94
+
95
+ if (!exists $self->[DEFINITIONS]{$file})
96
+ {
97
+ $self->[DEFINITIONS]{$file} = NaturalDocs::SymbolTable::SymbolDefinition->New($type, $prototype, $summary);
98
+ };
99
+
100
+ return $isFirst;
101
+ };
102
+
103
+
104
+ #
105
+ # Function: ChangeDefinition
106
+ #
107
+ # Changes the information about an existing definition.
108
+ #
109
+ # Parameters:
110
+ #
111
+ # file - The <FileName> that defines the symbol. Must exist.
112
+ # type - The new <TopicType> of the definition.
113
+ # prototype - The new prototype of the definition, if applicable. Undef otherwise.
114
+ # summary - The new summary of the definition, if applicable. Undef otherwise.
115
+ #
116
+ sub ChangeDefinition #(file, type, prototype, summary)
117
+ {
118
+ my ($self, $file, $type, $prototype, $summary) = @_;
119
+
120
+ if (defined $self->[DEFINITIONS] &&
121
+ exists $self->[DEFINITIONS]{$file})
122
+ {
123
+ $self->[DEFINITIONS]{$file}->SetType($type);
124
+ $self->[DEFINITIONS]{$file}->SetPrototype($prototype);
125
+ $self->[DEFINITIONS]{$file}->SetSummary($summary);
126
+ };
127
+ };
128
+
129
+
130
+ #
131
+ # Function: DeleteDefinition
132
+ #
133
+ # Removes a symbol definition. If the definition served as the global definition, a new one will be selected.
134
+ #
135
+ # Parameters:
136
+ #
137
+ # file - The <FileName> which contains definition to delete.
138
+ #
139
+ # Returns:
140
+ #
141
+ # Whether that was the only definition, and the symbol is now undefined.
142
+ #
143
+ sub DeleteDefinition #(file)
144
+ {
145
+ my ($self, $file) = @_;
146
+
147
+ # If there are no definitions...
148
+ if (!defined $self->[DEFINITIONS])
149
+ { return undef; };
150
+
151
+ delete $self->[DEFINITIONS]{$file};
152
+
153
+ # If there are no more definitions...
154
+ if (!scalar keys %{$self->[DEFINITIONS]})
155
+ {
156
+ $self->[DEFINITIONS] = undef;
157
+
158
+ # If definitions was previously defined, and now is empty, we can safely assume that the global definition was just deleted
159
+ # without checking it against $file.
160
+
161
+ $self->[GLOBAL_DEFINITION] = undef;
162
+
163
+ return 1;
164
+ }
165
+
166
+ # If there are more definitions and the global one was just deleted...
167
+ elsif ($self->[GLOBAL_DEFINITION] eq $file)
168
+ {
169
+ # Which one becomes global is pretty much random.
170
+ $self->[GLOBAL_DEFINITION] = (keys %{$self->[DEFINITIONS]})[0];
171
+ return undef;
172
+ };
173
+ };
174
+
175
+
176
+ #
177
+ # Function: AddReference
178
+ #
179
+ # Adds a reference that can be interpreted as this symbol. It can be, but not necessarily is.
180
+ #
181
+ # Parameters:
182
+ #
183
+ # referenceString - The string of the reference.
184
+ # score - The score of this interpretation.
185
+ #
186
+ sub AddReference #(referenceString, score)
187
+ {
188
+ my ($self, $referenceString, $score) = @_;
189
+
190
+ if (!defined $self->[REFERENCES])
191
+ { $self->[REFERENCES] = { }; };
192
+
193
+ $self->[REFERENCES]{$referenceString} = $score;
194
+ };
195
+
196
+
197
+ #
198
+ # Function: DeleteReference
199
+ #
200
+ # Deletes a reference that can be interpreted as this symbol.
201
+ #
202
+ # Parameters:
203
+ #
204
+ # referenceString - The string of the reference to delete.
205
+ #
206
+ sub DeleteReference #(referenceString)
207
+ {
208
+ my ($self, $referenceString) = @_;
209
+
210
+ # If there are no definitions...
211
+ if (!defined $self->[REFERENCES])
212
+ { return; };
213
+
214
+ delete $self->[REFERENCES]{$referenceString};
215
+
216
+ # If there are no more definitions...
217
+ if (!scalar keys %{$self->[REFERENCES]})
218
+ {
219
+ $self->[REFERENCES] = undef;
220
+ };
221
+ };
222
+
223
+
224
+ #
225
+ # Function: DeleteAllReferences
226
+ #
227
+ # Removes all references that can be interpreted as this symbol.
228
+ #
229
+ sub DeleteAllReferences
230
+ {
231
+ $_[0]->[REFERENCES] = undef;
232
+ };
233
+
234
+
235
+ ###############################################################################
236
+ # Group: Information Functions
237
+
238
+ #
239
+ # Function: IsDefined
240
+ #
241
+ # Returns whether the symbol is defined anywhere or not. If it's not, that means it's just a potential interpretation of a
242
+ # reference.
243
+ #
244
+ sub IsDefined
245
+ {
246
+ return defined $_[0]->[GLOBAL_DEFINITION];
247
+ };
248
+
249
+ #
250
+ # Function: IsDefinedIn
251
+ #
252
+ # Returns whether the symbol is defined in the passed <FileName>.
253
+ #
254
+ sub IsDefinedIn #(file)
255
+ {
256
+ my ($self, $file) = @_;
257
+ return ($self->IsDefined() && exists $self->[DEFINITIONS]{$file});
258
+ };
259
+
260
+
261
+ #
262
+ # Function: Definitions
263
+ #
264
+ # Returns an array of all the <FileNames> that define this symbol. If none do, will return an empty array.
265
+ #
266
+ sub Definitions
267
+ {
268
+ my $self = shift;
269
+
270
+ if ($self->IsDefined())
271
+ { return keys %{$self->[DEFINITIONS]}; }
272
+ else
273
+ { return ( ); };
274
+ };
275
+
276
+
277
+ #
278
+ # Function: GlobalDefinition
279
+ #
280
+ # Returns the <FileName> that contains the global definition of this symbol, or undef if the symbol isn't defined.
281
+ #
282
+ sub GlobalDefinition
283
+ {
284
+ return $_[0]->[GLOBAL_DEFINITION];
285
+ };
286
+
287
+
288
+ #
289
+ # Function: TypeDefinedIn
290
+ #
291
+ # Returns the <TopicType> of the symbol defined in the passed <FileName>, or undef if it's not defined in that file.
292
+ #
293
+ sub TypeDefinedIn #(file)
294
+ {
295
+ my ($self, $file) = @_;
296
+
297
+ if ($self->IsDefined())
298
+ { return $self->[DEFINITIONS]{$file}->Type(); }
299
+ else
300
+ { return undef; };
301
+ };
302
+
303
+
304
+ #
305
+ # Function: GlobalType
306
+ #
307
+ # Returns the <TopicType> of the global definition, or undef if the symbol isn't defined.
308
+ #
309
+ sub GlobalType
310
+ {
311
+ my $self = shift;
312
+
313
+ my $globalDefinition = $self->GlobalDefinition();
314
+
315
+ if (!defined $globalDefinition)
316
+ { return undef; }
317
+ else
318
+ { return $self->[DEFINITIONS]{$globalDefinition}->Type(); };
319
+ };
320
+
321
+
322
+ #
323
+ # Function: PrototypeDefinedIn
324
+ #
325
+ # Returns the prototype of symbol defined in the passed <FileName>, or undef if it doesn't exist or is not defined in that file.
326
+ #
327
+ sub PrototypeDefinedIn #(file)
328
+ {
329
+ my ($self, $file) = @_;
330
+
331
+ if ($self->IsDefined())
332
+ { return $self->[DEFINITIONS]{$file}->Prototype(); }
333
+ else
334
+ { return undef; };
335
+ };
336
+
337
+
338
+ #
339
+ # Function: GlobalPrototype
340
+ #
341
+ # Returns the prototype of the global definition. Will be undef if it doesn't exist or the symbol isn't defined.
342
+ #
343
+ sub GlobalPrototype
344
+ {
345
+ my $self = shift;
346
+
347
+ my $globalDefinition = $self->GlobalDefinition();
348
+
349
+ if (!defined $globalDefinition)
350
+ { return undef; }
351
+ else
352
+ { return $self->[DEFINITIONS]{$globalDefinition}->Prototype(); };
353
+ };
354
+
355
+
356
+ #
357
+ # Function: SummaryDefinedIn
358
+ #
359
+ # Returns the summary of symbol defined in the passed <FileName>, or undef if it doesn't exist or is not defined in that file.
360
+ #
361
+ sub SummaryDefinedIn #(file)
362
+ {
363
+ my ($self, $file) = @_;
364
+
365
+ if ($self->IsDefined())
366
+ { return $self->[DEFINITIONS]{$file}->Summary(); }
367
+ else
368
+ { return undef; };
369
+ };
370
+
371
+
372
+ #
373
+ # Function: GlobalSummary
374
+ #
375
+ # Returns the summary of the global definition. Will be undef if it doesn't exist or the symbol isn't defined.
376
+ #
377
+ sub GlobalSummary
378
+ {
379
+ my $self = shift;
380
+
381
+ my $globalDefinition = $self->GlobalDefinition();
382
+
383
+ if (!defined $globalDefinition)
384
+ { return undef; }
385
+ else
386
+ { return $self->[DEFINITIONS]{$globalDefinition}->Summary(); };
387
+ };
388
+
389
+
390
+ #
391
+ # Function: HasReferences
392
+ #
393
+ # Returns whether the symbol can be interpreted as any references.
394
+ #
395
+ sub HasReferences
396
+ {
397
+ return defined $_[0]->[REFERENCES];
398
+ };
399
+
400
+ #
401
+ # Function: References
402
+ #
403
+ # Returns an array of all the reference strings that can be interpreted as this symbol. If none, will return an empty array.
404
+ #
405
+ sub References
406
+ {
407
+ if (defined $_[0]->[REFERENCES])
408
+ { return keys %{$_[0]->[REFERENCES]}; }
409
+ else
410
+ { return ( ); };
411
+ };
412
+
413
+
414
+ #
415
+ # Function: ReferencesAndScores
416
+ #
417
+ # Returns a hash of all the references that can be interpreted as this symbol and their scores. The keys are the reference
418
+ # strings, and the values are the scores. If none, will return an empty hash.
419
+ #
420
+ sub ReferencesAndScores
421
+ {
422
+ if (defined $_[0]->[REFERENCES])
423
+ { return %{$_[0]->[REFERENCES]}; }
424
+ else
425
+ { return ( ); };
426
+ };
427
+
428
+ 1;