bixbite 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,319 @@
1
+ ###############################################################################
2
+ #
3
+ # Class: NaturalDocs::Languages::PLSQL
4
+ #
5
+ ###############################################################################
6
+ #
7
+ # A subclass to handle the language variations of PL/SQL.
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::PLSQL;
18
+
19
+ use base 'NaturalDocs::Languages::Simple';
20
+
21
+
22
+ #
23
+ # Function: OnPrototypeEnd
24
+ #
25
+ # Microsoft's SQL specifies parameters as shown below.
26
+ #
27
+ # > CREATE PROCEDURE Test @as int, @foo int AS ...
28
+ #
29
+ # Having a parameter @is or @as is perfectly valid even though those words are also used to end the prototype. We need to
30
+ # ignore text-based enders preceded by an at sign. Also note that it does not have parenthesis for parameter lists. We need to
31
+ # skip all commas if the prototype doesn't have parenthesis but does have @ characters.
32
+ #
33
+ # Identifiers such as function names may contain the characters $, #, and _, so if "as" or "is" appears directly after one of them
34
+ # we need to ignore the ender there as well.
35
+ #
36
+ # > FUNCTION Something_is_something ...
37
+ #
38
+ # Parameters:
39
+ #
40
+ # type - The <TopicType> of the prototype.
41
+ # prototypeRef - A reference to the prototype so far, minus the ender in dispute.
42
+ # ender - The ender symbol.
43
+ #
44
+ # Returns:
45
+ #
46
+ # ENDER_ACCEPT - The ender is accepted and the prototype is finished.
47
+ # ENDER_IGNORE - The ender is rejected and parsing should continue. Note that the prototype will be rejected as a whole
48
+ # if all enders are ignored before reaching the end of the code.
49
+ # ENDER_ACCEPT_AND_CONTINUE - The ender is accepted so the prototype may stand as is. However, the prototype might
50
+ # also continue on so continue parsing. If there is no accepted ender between here and
51
+ # the end of the code this version will be accepted instead.
52
+ # ENDER_REVERT_TO_ACCEPTED - The expedition from ENDER_ACCEPT_AND_CONTINUE failed. Use the last accepted
53
+ # version and end parsing.
54
+ #
55
+ sub OnPrototypeEnd #(type, prototypeRef, ender)
56
+ {
57
+ my ($self, $type, $prototypeRef, $ender) = @_;
58
+
59
+ # _ should be handled already.
60
+ if ($ender =~ /^[a-z]+$/i && substr($$prototypeRef, -1) =~ /^[\@\$\#]$/)
61
+ { return ::ENDER_IGNORE(); }
62
+
63
+ elsif ($type eq ::TOPIC_FUNCTION() && $ender eq ',')
64
+ {
65
+ if ($$prototypeRef =~ /^[^\(]*\@/)
66
+ { return ::ENDER_IGNORE(); }
67
+ else
68
+ { return ::ENDER_ACCEPT(); };
69
+ }
70
+
71
+ else
72
+ { return ::ENDER_ACCEPT(); };
73
+ };
74
+
75
+
76
+ #
77
+ # Function: ParsePrototype
78
+ #
79
+ # Overridden to handle Microsoft's parenthesisless version. Otherwise just throws to the parent.
80
+ #
81
+ # Parameters:
82
+ #
83
+ # type - The <TopicType>.
84
+ # prototype - The text prototype.
85
+ #
86
+ # Returns:
87
+ #
88
+ # A <NaturalDocs::Languages::Prototype> object.
89
+ #
90
+ sub ParsePrototype #(type, prototype)
91
+ {
92
+ my ($self, $type, $prototype) = @_;
93
+
94
+ my $noParenthesisParameters = ($type eq ::TOPIC_FUNCTION() && $prototype =~ /^[^\(]*\@/);
95
+
96
+ if ($prototype !~ /\(.*[^ ].*\)/ && !$noParenthesisParameters)
97
+ { return $self->SUPER::ParsePrototype($type, $prototype); };
98
+
99
+
100
+
101
+ my ($beforeParameters, $afterParameters, $isAfterParameters);
102
+
103
+ if ($noParenthesisParameters)
104
+ {
105
+ ($beforeParameters, $prototype) = split(/\@/, $prototype, 2);
106
+ $prototype = '@' . $prototype;
107
+ };
108
+
109
+ my @tokens = $prototype =~ /([^\(\)\[\]\{\}\<\>\'\"\,]+|.)/g;
110
+
111
+ my $parameter;
112
+ my @parameterLines;
113
+
114
+ my @symbolStack;
115
+
116
+ foreach my $token (@tokens)
117
+ {
118
+ if ($isAfterParameters)
119
+ { $afterParameters .= $token; }
120
+
121
+ elsif ($symbolStack[-1] eq '\'' || $symbolStack[-1] eq '"')
122
+ {
123
+ if ($noParenthesisParameters || $symbolStack[0] eq '(')
124
+ { $parameter .= $token; }
125
+ else
126
+ { $beforeParameters .= $token; };
127
+
128
+ if ($token eq $symbolStack[-1])
129
+ { pop @symbolStack; };
130
+ }
131
+
132
+ elsif ($token =~ /^[\(\[\{\<\'\"]$/)
133
+ {
134
+ if ($noParenthesisParameters || $symbolStack[0] eq '(')
135
+ { $parameter .= $token; }
136
+ else
137
+ { $beforeParameters .= $token; };
138
+
139
+ push @symbolStack, $token;
140
+ }
141
+
142
+ elsif ( ($token eq ')' && $symbolStack[-1] eq '(') ||
143
+ ($token eq ']' && $symbolStack[-1] eq '[') ||
144
+ ($token eq '}' && $symbolStack[-1] eq '{') ||
145
+ ($token eq '>' && $symbolStack[-1] eq '<') )
146
+ {
147
+ if (!$noParenthesisParameters && $token eq ')' && scalar @symbolStack == 1 && $symbolStack[0] eq '(')
148
+ {
149
+ $afterParameters .= $token;
150
+ $isAfterParameters = 1;
151
+ }
152
+ else
153
+ { $parameter .= $token; };
154
+
155
+ pop @symbolStack;
156
+ }
157
+
158
+ elsif ($token eq ',')
159
+ {
160
+ if (!scalar @symbolStack)
161
+ {
162
+ if ($noParenthesisParameters)
163
+ {
164
+ push @parameterLines, $parameter . $token;
165
+ $parameter = undef;
166
+ }
167
+ else
168
+ {
169
+ $beforeParameters .= $token;
170
+ };
171
+ }
172
+ else
173
+ {
174
+ if (scalar @symbolStack == 1 && $symbolStack[0] eq '(' && !$noParenthesisParameters)
175
+ {
176
+ push @parameterLines, $parameter . $token;
177
+ $parameter = undef;
178
+ }
179
+ else
180
+ {
181
+ $parameter .= $token;
182
+ };
183
+ };
184
+ }
185
+
186
+ else
187
+ {
188
+ if ($noParenthesisParameters || $symbolStack[0] eq '(')
189
+ { $parameter .= $token; }
190
+ else
191
+ { $beforeParameters .= $token; };
192
+ };
193
+ };
194
+
195
+ push @parameterLines, $parameter;
196
+
197
+ foreach my $item (\$beforeParameters, \$afterParameters)
198
+ {
199
+ $$item =~ s/^ //;
200
+ $$item =~ s/ $//;
201
+ }
202
+
203
+ my $prototypeObject = NaturalDocs::Languages::Prototype->New($beforeParameters, $afterParameters);
204
+
205
+
206
+ # Parse the actual parameters.
207
+
208
+ foreach my $parameterLine (@parameterLines)
209
+ {
210
+ $prototypeObject->AddParameter( $self->ParseParameterLine($parameterLine) );
211
+ };
212
+
213
+ return $prototypeObject;
214
+ };
215
+
216
+
217
+ #
218
+ # Function: ParseParameterLine
219
+ #
220
+ # Parses a prototype parameter line and returns it as a <NaturalDocs::Languages::Prototype::Parameter> object.
221
+ #
222
+ sub ParseParameterLine #(line)
223
+ {
224
+ my ($self, $line) = @_;
225
+
226
+ $line =~ s/^ //;
227
+ $line =~ s/ $//;
228
+
229
+ my @tokens = $line =~ /([^\(\)\[\]\{\}\<\>\'\"\:\=\ ]+|\:\=|.)/g;
230
+
231
+ my ($name, $type, $defaultValue, $defaultValuePrefix, $inType, $inDefaultValue);
232
+
233
+
234
+ my @symbolStack;
235
+
236
+ foreach my $token (@tokens)
237
+ {
238
+ if ($inDefaultValue)
239
+ { $defaultValue .= $token; }
240
+
241
+ elsif ($symbolStack[-1] eq '\'' || $symbolStack[-1] eq '"')
242
+ {
243
+ if ($inType)
244
+ { $type .= $token; }
245
+ else
246
+ { $name .= $token; };
247
+
248
+ if ($token eq $symbolStack[-1])
249
+ { pop @symbolStack; };
250
+ }
251
+
252
+ elsif ($token =~ /^[\(\[\{\<\'\"]$/)
253
+ {
254
+ if ($inType)
255
+ { $type .= $token; }
256
+ else
257
+ { $name .= $token; };
258
+
259
+ push @symbolStack, $token;
260
+ }
261
+
262
+ elsif ( ($token eq ')' && $symbolStack[-1] eq '(') ||
263
+ ($token eq ']' && $symbolStack[-1] eq '[') ||
264
+ ($token eq '}' && $symbolStack[-1] eq '{') ||
265
+ ($token eq '>' && $symbolStack[-1] eq '<') )
266
+ {
267
+ if ($inType)
268
+ { $type .= $token; }
269
+ else
270
+ { $name .= $token; };
271
+
272
+ pop @symbolStack;
273
+ }
274
+
275
+ elsif ($token eq ' ')
276
+ {
277
+ if ($inType)
278
+ { $type .= $token; }
279
+ elsif (!scalar @symbolStack)
280
+ { $inType = 1; }
281
+ else
282
+ { $name .= $token; };
283
+ }
284
+
285
+ elsif ($token eq ':=' || $token eq '=')
286
+ {
287
+ if (!scalar @symbolStack)
288
+ {
289
+ $defaultValuePrefix = $token;
290
+ $inDefaultValue = 1;
291
+ }
292
+ elsif ($inType)
293
+ { $type .= $token; }
294
+ else
295
+ { $name .= $token; };
296
+ }
297
+
298
+ else
299
+ {
300
+ if ($inType)
301
+ { $type .= $token; }
302
+ else
303
+ { $name .= $token; };
304
+ };
305
+ };
306
+
307
+ foreach my $part (\$type, \$defaultValue)
308
+ {
309
+ $$part =~ s/ $//;
310
+ };
311
+
312
+ return NaturalDocs::Languages::Prototype::Parameter->New($type, undef, $name, undef, $defaultValue, $defaultValuePrefix);
313
+ };
314
+
315
+
316
+ sub TypeBeforeParameter
317
+ { return 0; };
318
+
319
+ 1;
@@ -0,0 +1,143 @@
1
+ ###############################################################################
2
+ #
3
+ # Class: NaturalDocs::Languages::Pascal
4
+ #
5
+ ###############################################################################
6
+ #
7
+ # A subclass to handle the language variations of Pascal and Delphi.
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::Pascal;
18
+
19
+ use base 'NaturalDocs::Languages::Simple';
20
+
21
+
22
+ #
23
+ # hash: prototypeDirectives
24
+ #
25
+ # An existence hash of all the directives that can appear after a function prototype and will be included. The keys are the all
26
+ # lowercase keywords.
27
+ #
28
+ my %prototypeDirectives = ( 'overload' => 1,
29
+ 'override' => 1,
30
+ 'virtual' => 1,
31
+ 'abstract' => 1,
32
+ 'reintroduce' => 1,
33
+ 'export' => 1,
34
+ 'public' => 1,
35
+ 'interrupt' => 1,
36
+ 'register' => 1,
37
+ 'pascal' => 1,
38
+ 'cdecl' => 1,
39
+ 'stdcall' => 1,
40
+ 'popstack' => 1,
41
+ 'saveregisters' => 1,
42
+ 'inline' => 1,
43
+ 'safecall' => 1 );
44
+
45
+ #
46
+ # hash: longPrototypeDirectives
47
+ #
48
+ # An existence hash of all the directives with parameters that can appear after a function prototype and will be included. The
49
+ # keys are the all lowercase keywords.
50
+ #
51
+ my %longPrototypeDirectives = ( 'alias' => 1,
52
+ 'external' => 1 );
53
+
54
+ #
55
+ # bool: checkingForDirectives
56
+ #
57
+ # Set after the first function semicolon, which means we're in directives mode.
58
+ #
59
+ my $checkingForDirectives;
60
+
61
+
62
+ #
63
+ # Function: OnCode
64
+ #
65
+ # Just overridden to reset <checkingForDirectives>.
66
+ #
67
+ sub OnCode #(...)
68
+ {
69
+ my ($self, @parameters) = @_;
70
+
71
+ $checkingForDirectives = 0;
72
+
73
+ return $self->SUPER::OnCode(@parameters);
74
+ };
75
+
76
+
77
+ #
78
+ # Function: OnPrototypeEnd
79
+ #
80
+ # Pascal's syntax has directives after the prototype that should be included.
81
+ #
82
+ # > function MyFunction ( param1: type ); virtual; abstract;
83
+ #
84
+ # Parameters:
85
+ #
86
+ # type - The <TopicType> of the prototype.
87
+ # prototypeRef - A reference to the prototype so far, minus the ender in dispute.
88
+ # ender - The ender symbol.
89
+ #
90
+ # Returns:
91
+ #
92
+ # ENDER_ACCEPT - The ender is accepted and the prototype is finished.
93
+ # ENDER_IGNORE - The ender is rejected and parsing should continue. Note that the prototype will be rejected as a whole
94
+ # if all enders are ignored before reaching the end of the code.
95
+ # ENDER_ACCEPT_AND_CONTINUE - The ender is accepted so the prototype may stand as is. However, the prototype might
96
+ # also continue on so continue parsing. If there is no accepted ender between here and
97
+ # the end of the code this version will be accepted instead.
98
+ # ENDER_REVERT_TO_ACCEPTED - The expedition from ENDER_ACCEPT_AND_CONTINUE failed. Use the last accepted
99
+ # version and end parsing.
100
+ #
101
+ sub OnPrototypeEnd #(type, prototypeRef, ender)
102
+ {
103
+ my ($self, $type, $prototypeRef, $ender) = @_;
104
+
105
+ if ($type eq ::TOPIC_FUNCTION() && $ender eq ';')
106
+ {
107
+ if (!$checkingForDirectives)
108
+ {
109
+ $checkingForDirectives = 1;
110
+ return ::ENDER_ACCEPT_AND_CONTINUE();
111
+ }
112
+ elsif ($$prototypeRef =~ /;[ \t]*([a-z]+)([^;]*)$/i)
113
+ {
114
+ my ($lastDirective, $extra) = (lc($1), $2);
115
+
116
+ if (exists $prototypeDirectives{$lastDirective} && $extra =~ /^[ \t]*$/)
117
+ { return ::ENDER_ACCEPT_AND_CONTINUE(); }
118
+ elsif (exists $longPrototypeDirectives{$lastDirective})
119
+ { return ::ENDER_ACCEPT_AND_CONTINUE(); }
120
+ else
121
+ { return ::ENDER_REVERT_TO_ACCEPTED(); };
122
+ }
123
+ else
124
+ { return ::ENDER_REVERT_TO_ACCEPTED(); };
125
+ }
126
+ else
127
+ { return ::ENDER_ACCEPT(); };
128
+ };
129
+
130
+
131
+ sub ParseParameterLine #(...)
132
+ {
133
+ my ($self, @params) = @_;
134
+ return $self->SUPER::ParsePascalParameterLine(@params);
135
+ };
136
+
137
+ sub TypeBeforeParameter
138
+ {
139
+ return 0;
140
+ };
141
+
142
+
143
+ 1;