super-quick-rb 0.0.1

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 (218) hide show
  1. checksums.yaml +7 -0
  2. data/rdoc-8.0.0/CONTRIBUTING.md +195 -0
  3. data/rdoc-8.0.0/CVE-2013-0256.rdoc +49 -0
  4. data/rdoc-8.0.0/History.rdoc +1668 -0
  5. data/rdoc-8.0.0/LEGAL.rdoc +56 -0
  6. data/rdoc-8.0.0/LICENSE.rdoc +63 -0
  7. data/rdoc-8.0.0/README.md +236 -0
  8. data/rdoc-8.0.0/RI.md +842 -0
  9. data/rdoc-8.0.0/TODO.rdoc +60 -0
  10. data/rdoc-8.0.0/doc/markup_reference/markdown.md +659 -0
  11. data/rdoc-8.0.0/doc/markup_reference/rdoc.rdoc +1169 -0
  12. data/rdoc-8.0.0/exe/rdoc +43 -0
  13. data/rdoc-8.0.0/exe/ri +12 -0
  14. data/rdoc-8.0.0/lib/rdoc/code_object/alias.rb +98 -0
  15. data/rdoc-8.0.0/lib/rdoc/code_object/any_method.rb +387 -0
  16. data/rdoc-8.0.0/lib/rdoc/code_object/attr.rb +178 -0
  17. data/rdoc-8.0.0/lib/rdoc/code_object/class_module.rb +969 -0
  18. data/rdoc-8.0.0/lib/rdoc/code_object/constant.rb +221 -0
  19. data/rdoc-8.0.0/lib/rdoc/code_object/context/section.rb +182 -0
  20. data/rdoc-8.0.0/lib/rdoc/code_object/context.rb +1238 -0
  21. data/rdoc-8.0.0/lib/rdoc/code_object/extend.rb +9 -0
  22. data/rdoc-8.0.0/lib/rdoc/code_object/include.rb +9 -0
  23. data/rdoc-8.0.0/lib/rdoc/code_object/method_attr.rb +417 -0
  24. data/rdoc-8.0.0/lib/rdoc/code_object/mixin.rb +123 -0
  25. data/rdoc-8.0.0/lib/rdoc/code_object/normal_class.rb +92 -0
  26. data/rdoc-8.0.0/lib/rdoc/code_object/normal_module.rb +73 -0
  27. data/rdoc-8.0.0/lib/rdoc/code_object/require.rb +51 -0
  28. data/rdoc-8.0.0/lib/rdoc/code_object/single_class.rb +30 -0
  29. data/rdoc-8.0.0/lib/rdoc/code_object/top_level.rb +286 -0
  30. data/rdoc-8.0.0/lib/rdoc/code_object.rb +393 -0
  31. data/rdoc-8.0.0/lib/rdoc/code_objects.rb +5 -0
  32. data/rdoc-8.0.0/lib/rdoc/comment.rb +353 -0
  33. data/rdoc-8.0.0/lib/rdoc/cross_reference.rb +215 -0
  34. data/rdoc-8.0.0/lib/rdoc/encoding.rb +120 -0
  35. data/rdoc-8.0.0/lib/rdoc/erb_partial.rb +18 -0
  36. data/rdoc-8.0.0/lib/rdoc/erbio.rb +37 -0
  37. data/rdoc-8.0.0/lib/rdoc/generator/aliki.rb +200 -0
  38. data/rdoc-8.0.0/lib/rdoc/generator/darkfish.rb +824 -0
  39. data/rdoc-8.0.0/lib/rdoc/generator/json_index.rb +284 -0
  40. data/rdoc-8.0.0/lib/rdoc/generator/markup.rb +196 -0
  41. data/rdoc-8.0.0/lib/rdoc/generator/pot/message_extractor.rb +68 -0
  42. data/rdoc-8.0.0/lib/rdoc/generator/pot/po.rb +84 -0
  43. data/rdoc-8.0.0/lib/rdoc/generator/pot/po_entry.rb +141 -0
  44. data/rdoc-8.0.0/lib/rdoc/generator/pot.rb +94 -0
  45. data/rdoc-8.0.0/lib/rdoc/generator/ri.rb +30 -0
  46. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/DESIGN.md +536 -0
  47. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_aside_toc.rhtml +8 -0
  48. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_footer.rhtml +23 -0
  49. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_head.rhtml +163 -0
  50. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_header.rhtml +56 -0
  51. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_icons.rhtml +208 -0
  52. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_ancestors.rhtml +16 -0
  53. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_classes.rhtml +15 -0
  54. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_extends.rhtml +27 -0
  55. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_includes.rhtml +27 -0
  56. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_installed.rhtml +16 -0
  57. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_methods.rhtml +41 -0
  58. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_pages.rhtml +67 -0
  59. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_search.rhtml +15 -0
  60. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_sections.rhtml +21 -0
  61. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/_sidebar_toggle.rhtml +3 -0
  62. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/class.rhtml +230 -0
  63. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/css/rdoc.css +2181 -0
  64. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/index.rhtml +22 -0
  65. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/aliki.js +513 -0
  66. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/bash_highlighter.js +167 -0
  67. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/c_highlighter.js +299 -0
  68. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_controller.js +129 -0
  69. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_navigation.js +105 -0
  70. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/search_ranker.js +239 -0
  71. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/js/theme-toggle.js +112 -0
  72. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/page.rhtml +18 -0
  73. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/servlet_not_found.rhtml +14 -0
  74. data/rdoc-8.0.0/lib/rdoc/generator/template/aliki/servlet_root.rhtml +65 -0
  75. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_footer.rhtml +5 -0
  76. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_head.rhtml +43 -0
  77. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_classes.rhtml +5 -0
  78. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_extends.rhtml +17 -0
  79. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_includes.rhtml +17 -0
  80. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_installed.rhtml +16 -0
  81. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_methods.rhtml +21 -0
  82. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_navigation.rhtml +11 -0
  83. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_pages.rhtml +32 -0
  84. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_parent.rhtml +6 -0
  85. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_search.rhtml +15 -0
  86. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_sections.rhtml +11 -0
  87. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_table_of_contents.rhtml +39 -0
  88. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/_sidebar_toggle.rhtml +3 -0
  89. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/class.rhtml +220 -0
  90. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/css/fonts.css +167 -0
  91. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/css/rdoc.css +701 -0
  92. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf +0 -0
  93. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf +0 -0
  94. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf +0 -0
  95. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf +0 -0
  96. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Bold.ttf +0 -0
  97. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/fonts/SourceCodePro-Regular.ttf +0 -0
  98. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/add.png +0 -0
  99. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/arrow_up.png +0 -0
  100. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/brick.png +0 -0
  101. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/brick_link.png +0 -0
  102. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bug.png +0 -0
  103. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_black.png +0 -0
  104. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_minus.png +0 -0
  105. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/bullet_toggle_plus.png +0 -0
  106. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/date.png +0 -0
  107. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/delete.png +0 -0
  108. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/find.png +0 -0
  109. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/loadingAnimation.gif +0 -0
  110. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/macFFBgHack.png +0 -0
  111. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/package.png +0 -0
  112. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_green.png +0 -0
  113. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_white_text.png +0 -0
  114. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/page_white_width.png +0 -0
  115. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/plugin.png +0 -0
  116. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/ruby.png +0 -0
  117. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/tag_blue.png +0 -0
  118. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/tag_green.png +0 -0
  119. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/transparent.png +0 -0
  120. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/wrench.png +0 -0
  121. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/wrench_orange.png +0 -0
  122. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/images/zoom.png +0 -0
  123. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/index.rhtml +24 -0
  124. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/js/darkfish.js +140 -0
  125. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/js/search.js +120 -0
  126. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/page.rhtml +19 -0
  127. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/servlet_not_found.rhtml +21 -0
  128. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/servlet_root.rhtml +65 -0
  129. data/rdoc-8.0.0/lib/rdoc/generator/template/darkfish/table_of_contents.rhtml +72 -0
  130. data/rdoc-8.0.0/lib/rdoc/generator/template/json_index/js/navigation.js +105 -0
  131. data/rdoc-8.0.0/lib/rdoc/generator/template/json_index/js/searcher.js +271 -0
  132. data/rdoc-8.0.0/lib/rdoc/generator.rb +52 -0
  133. data/rdoc-8.0.0/lib/rdoc/i18n/locale.rb +102 -0
  134. data/rdoc-8.0.0/lib/rdoc/i18n/text.rb +126 -0
  135. data/rdoc-8.0.0/lib/rdoc/i18n.rb +10 -0
  136. data/rdoc-8.0.0/lib/rdoc/known_classes.rb +74 -0
  137. data/rdoc-8.0.0/lib/rdoc/markdown/entities.rb +2131 -0
  138. data/rdoc-8.0.0/lib/rdoc/markdown/literals.kpeg +21 -0
  139. data/rdoc-8.0.0/lib/rdoc/markdown/literals.rb +454 -0
  140. data/rdoc-8.0.0/lib/rdoc/markdown.kpeg +1315 -0
  141. data/rdoc-8.0.0/lib/rdoc/markdown.rb +16865 -0
  142. data/rdoc-8.0.0/lib/rdoc/markup/blank_line.rb +29 -0
  143. data/rdoc-8.0.0/lib/rdoc/markup/block_quote.rb +14 -0
  144. data/rdoc-8.0.0/lib/rdoc/markup/document.rb +164 -0
  145. data/rdoc-8.0.0/lib/rdoc/markup/element.rb +21 -0
  146. data/rdoc-8.0.0/lib/rdoc/markup/formatter.rb +285 -0
  147. data/rdoc-8.0.0/lib/rdoc/markup/hard_break.rb +34 -0
  148. data/rdoc-8.0.0/lib/rdoc/markup/heading.rb +170 -0
  149. data/rdoc-8.0.0/lib/rdoc/markup/include.rb +42 -0
  150. data/rdoc-8.0.0/lib/rdoc/markup/indented_paragraph.rb +47 -0
  151. data/rdoc-8.0.0/lib/rdoc/markup/inline_parser.rb +312 -0
  152. data/rdoc-8.0.0/lib/rdoc/markup/list.rb +101 -0
  153. data/rdoc-8.0.0/lib/rdoc/markup/list_item.rb +99 -0
  154. data/rdoc-8.0.0/lib/rdoc/markup/paragraph.rb +28 -0
  155. data/rdoc-8.0.0/lib/rdoc/markup/parser.rb +585 -0
  156. data/rdoc-8.0.0/lib/rdoc/markup/pre_process.rb +317 -0
  157. data/rdoc-8.0.0/lib/rdoc/markup/raw.rb +66 -0
  158. data/rdoc-8.0.0/lib/rdoc/markup/rule.rb +20 -0
  159. data/rdoc-8.0.0/lib/rdoc/markup/table.rb +64 -0
  160. data/rdoc-8.0.0/lib/rdoc/markup/to_ansi.rb +144 -0
  161. data/rdoc-8.0.0/lib/rdoc/markup/to_bs.rb +86 -0
  162. data/rdoc-8.0.0/lib/rdoc/markup/to_html.rb +682 -0
  163. data/rdoc-8.0.0/lib/rdoc/markup/to_html_crossref.rb +261 -0
  164. data/rdoc-8.0.0/lib/rdoc/markup/to_html_snippet.rb +287 -0
  165. data/rdoc-8.0.0/lib/rdoc/markup/to_joined_paragraph.rb +41 -0
  166. data/rdoc-8.0.0/lib/rdoc/markup/to_label.rb +84 -0
  167. data/rdoc-8.0.0/lib/rdoc/markup/to_markdown.rb +215 -0
  168. data/rdoc-8.0.0/lib/rdoc/markup/to_rdoc.rb +421 -0
  169. data/rdoc-8.0.0/lib/rdoc/markup/to_table_of_contents.rb +88 -0
  170. data/rdoc-8.0.0/lib/rdoc/markup/to_test.rb +77 -0
  171. data/rdoc-8.0.0/lib/rdoc/markup/to_tt_only.rb +107 -0
  172. data/rdoc-8.0.0/lib/rdoc/markup/verbatim.rb +83 -0
  173. data/rdoc-8.0.0/lib/rdoc/markup.rb +219 -0
  174. data/rdoc-8.0.0/lib/rdoc/options.rb +1412 -0
  175. data/rdoc-8.0.0/lib/rdoc/parser/c.rb +1227 -0
  176. data/rdoc-8.0.0/lib/rdoc/parser/changelog.rb +379 -0
  177. data/rdoc-8.0.0/lib/rdoc/parser/markdown.rb +22 -0
  178. data/rdoc-8.0.0/lib/rdoc/parser/rbs.rb +275 -0
  179. data/rdoc-8.0.0/lib/rdoc/parser/rd.rb +22 -0
  180. data/rdoc-8.0.0/lib/rdoc/parser/ruby.rb +1266 -0
  181. data/rdoc-8.0.0/lib/rdoc/parser/ruby_colorizer.rb +253 -0
  182. data/rdoc-8.0.0/lib/rdoc/parser/simple.rb +44 -0
  183. data/rdoc-8.0.0/lib/rdoc/parser/text.rb +11 -0
  184. data/rdoc-8.0.0/lib/rdoc/parser.rb +298 -0
  185. data/rdoc-8.0.0/lib/rdoc/rbs_helper.rb +186 -0
  186. data/rdoc-8.0.0/lib/rdoc/rd/block_parser.rb +1706 -0
  187. data/rdoc-8.0.0/lib/rdoc/rd/block_parser.ry +643 -0
  188. data/rdoc-8.0.0/lib/rdoc/rd/inline.rb +71 -0
  189. data/rdoc-8.0.0/lib/rdoc/rd/inline_parser.rb +1854 -0
  190. data/rdoc-8.0.0/lib/rdoc/rd/inline_parser.ry +593 -0
  191. data/rdoc-8.0.0/lib/rdoc/rd.rb +99 -0
  192. data/rdoc-8.0.0/lib/rdoc/rdoc.rb +724 -0
  193. data/rdoc-8.0.0/lib/rdoc/ri/driver.rb +1572 -0
  194. data/rdoc-8.0.0/lib/rdoc/ri/formatter.rb +6 -0
  195. data/rdoc-8.0.0/lib/rdoc/ri/paths.rb +171 -0
  196. data/rdoc-8.0.0/lib/rdoc/ri/servlet.rb +452 -0
  197. data/rdoc-8.0.0/lib/rdoc/ri/store.rb +6 -0
  198. data/rdoc-8.0.0/lib/rdoc/ri/task.rb +71 -0
  199. data/rdoc-8.0.0/lib/rdoc/ri.rb +21 -0
  200. data/rdoc-8.0.0/lib/rdoc/rubygems_hook.rb +327 -0
  201. data/rdoc-8.0.0/lib/rdoc/server.rb +460 -0
  202. data/rdoc-8.0.0/lib/rdoc/stats/normal.rb +58 -0
  203. data/rdoc-8.0.0/lib/rdoc/stats/quiet.rb +59 -0
  204. data/rdoc-8.0.0/lib/rdoc/stats/verbose.rb +44 -0
  205. data/rdoc-8.0.0/lib/rdoc/stats.rb +484 -0
  206. data/rdoc-8.0.0/lib/rdoc/store.rb +1205 -0
  207. data/rdoc-8.0.0/lib/rdoc/task.rb +355 -0
  208. data/rdoc-8.0.0/lib/rdoc/text.rb +244 -0
  209. data/rdoc-8.0.0/lib/rdoc/token_stream.rb +104 -0
  210. data/rdoc-8.0.0/lib/rdoc/tom_doc.rb +257 -0
  211. data/rdoc-8.0.0/lib/rdoc/version.rb +10 -0
  212. data/rdoc-8.0.0/lib/rdoc.rb +239 -0
  213. data/rdoc-8.0.0/lib/rubygems_plugin.rb +14 -0
  214. data/rdoc-8.0.0/man/ri.1 +249 -0
  215. data/rdoc-8.0.0/rdoc-logo.svg +43 -0
  216. data/rdoc-8.0.0/rdoc.gemspec +74 -0
  217. data/super-quick-rb.gemspec +12 -0
  218. metadata +257 -0
@@ -0,0 +1,299 @@
1
+ /**
2
+ * Client-side C syntax highlighter for RDoc
3
+ */
4
+
5
+ (function() {
6
+ 'use strict';
7
+
8
+ // C control flow and storage class keywords
9
+ const C_KEYWORDS = new Set([
10
+ 'auto', 'break', 'case', 'continue', 'default', 'do', 'else', 'extern',
11
+ 'for', 'goto', 'if', 'inline', 'register', 'return', 'sizeof', 'static',
12
+ 'switch', 'while',
13
+ '_Alignas', '_Alignof', '_Generic', '_Noreturn', '_Static_assert', '_Thread_local'
14
+ ]);
15
+
16
+ // C type keywords and type qualifiers
17
+ const C_TYPE_KEYWORDS = new Set([
18
+ 'bool', 'char', 'const', 'double', 'enum', 'float', 'int', 'long',
19
+ 'restrict', 'short', 'signed', 'struct', 'typedef', 'union', 'unsigned',
20
+ 'void', 'volatile', '_Atomic', '_Bool', '_Complex', '_Imaginary'
21
+ ]);
22
+
23
+ // Library-defined types (typedef'd in headers, not language keywords)
24
+ // Includes: Ruby C API types (VALUE, ID), POSIX types (size_t, ssize_t),
25
+ // fixed-width integer types (uint32_t, int64_t), and standard I/O types (FILE)
26
+ const C_TYPES = new Set([
27
+ 'VALUE', 'ID', 'size_t', 'ssize_t', 'ptrdiff_t', 'uintptr_t', 'intptr_t',
28
+ 'uint8_t', 'uint16_t', 'uint32_t', 'uint64_t',
29
+ 'int8_t', 'int16_t', 'int32_t', 'int64_t',
30
+ 'FILE', 'DIR', 'va_list'
31
+ ]);
32
+
33
+ // Common Ruby VALUE macros and boolean literals
34
+ const RUBY_MACROS = new Set([
35
+ 'Qtrue', 'Qfalse', 'Qnil', 'Qundef', 'NULL', 'TRUE', 'FALSE', 'true', 'false'
36
+ ]);
37
+
38
+ const OPERATORS = new Set([
39
+ '==', '!=', '<=', '>=', '&&', '||', '<<', '>>', '++', '--',
40
+ '+=', '-=', '*=', '/=', '%=', '&=', '|=', '^=', '->',
41
+ '+', '-', '*', '/', '%', '<', '>', '=', '!', '&', '|', '^', '~'
42
+ ]);
43
+
44
+ // Single character that can start an operator
45
+ const OPERATOR_CHARS = new Set('+-*/%<>=!&|^~');
46
+
47
+ function isMacro(word) {
48
+ return RUBY_MACROS.has(word) || /^[A-Z][A-Z0-9_]*$/.test(word);
49
+ }
50
+
51
+ function isType(word) {
52
+ return C_TYPE_KEYWORDS.has(word) || C_TYPES.has(word) || /_t$/.test(word);
53
+ }
54
+
55
+ /**
56
+ * Escape HTML special characters
57
+ */
58
+ function escapeHtml(text) {
59
+ return text
60
+ .replace(/&/g, '&amp;')
61
+ .replace(/</g, '&lt;')
62
+ .replace(/>/g, '&gt;')
63
+ .replace(/"/g, '&quot;')
64
+ .replace(/'/g, '&#39;');
65
+ }
66
+
67
+ /**
68
+ * Check if position is at line start (only whitespace before it)
69
+ */
70
+ function isLineStart(code, pos) {
71
+ if (pos === 0) return true;
72
+ for (let i = pos - 1; i >= 0; i--) {
73
+ const ch = code[i];
74
+ if (ch === '\n') return true;
75
+ if (ch !== ' ' && ch !== '\t') return false;
76
+ }
77
+ return true;
78
+ }
79
+
80
+ /**
81
+ * Highlight C source code
82
+ */
83
+ function highlightC(code) {
84
+ const tokens = [];
85
+ let i = 0;
86
+ const len = code.length;
87
+
88
+ while (i < len) {
89
+ const char = code[i];
90
+
91
+ // Multi-line comment
92
+ if (char === '/' && code[i + 1] === '*') {
93
+ let end = code.indexOf('*/', i + 2);
94
+ end = (end === -1) ? len : end + 2;
95
+ const comment = code.substring(i, end);
96
+ tokens.push('<span class="c-comment">', escapeHtml(comment), '</span>');
97
+ i = end;
98
+ continue;
99
+ }
100
+
101
+ // Single-line comment
102
+ if (char === '/' && code[i + 1] === '/') {
103
+ const end = code.indexOf('\n', i);
104
+ const commentEnd = (end === -1) ? len : end;
105
+ const comment = code.substring(i, commentEnd);
106
+ tokens.push('<span class="c-comment">', escapeHtml(comment), '</span>');
107
+ i = commentEnd;
108
+ continue;
109
+ }
110
+
111
+ // Preprocessor directive (must be at line start)
112
+ if (char === '#' && isLineStart(code, i)) {
113
+ let end = i + 1;
114
+ while (end < len && code[end] !== '\n') {
115
+ if (code[end] === '\\' && end + 1 < len && code[end + 1] === '\n') {
116
+ end += 2; // Handle line continuation
117
+ } else {
118
+ end++;
119
+ }
120
+ }
121
+ const preprocessor = code.substring(i, end);
122
+ tokens.push('<span class="c-preprocessor">', escapeHtml(preprocessor), '</span>');
123
+ i = end;
124
+ continue;
125
+ }
126
+
127
+ // String literal
128
+ if (char === '"') {
129
+ let end = i + 1;
130
+ while (end < len && code[end] !== '"') {
131
+ if (code[end] === '\\' && end + 1 < len) {
132
+ end += 2; // Skip escaped character
133
+ } else {
134
+ end++;
135
+ }
136
+ }
137
+ if (end < len) end++; // Include closing quote
138
+ const string = code.substring(i, end);
139
+ tokens.push('<span class="c-string">', escapeHtml(string), '</span>');
140
+ i = end;
141
+ continue;
142
+ }
143
+
144
+ // Character literal
145
+ if (char === "'") {
146
+ let end = i + 1;
147
+ // Handle escape sequences like '\n', '\\', '\''
148
+ if (end < len && code[end] === '\\' && end + 1 < len) {
149
+ end += 2; // Skip backslash and escaped char
150
+ } else if (end < len) {
151
+ end++; // Single character
152
+ }
153
+ if (end < len && code[end] === "'") end++; // Closing quote
154
+ const charLit = code.substring(i, end);
155
+ tokens.push('<span class="c-value">', escapeHtml(charLit), '</span>');
156
+ i = end;
157
+ continue;
158
+ }
159
+
160
+ // Number (integer or float)
161
+ if (char >= '0' && char <= '9') {
162
+ let end = i;
163
+
164
+ // Hexadecimal
165
+ if (char === '0' && (code[i + 1] === 'x' || code[i + 1] === 'X')) {
166
+ end = i + 2;
167
+ while (end < len) {
168
+ const ch = code[end];
169
+ if ((ch >= '0' && ch <= '9') || (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F')) {
170
+ end++;
171
+ } else {
172
+ break;
173
+ }
174
+ }
175
+ }
176
+ // Octal
177
+ else if (char === '0' && code[i + 1] >= '0' && code[i + 1] <= '7') {
178
+ end = i + 1;
179
+ while (end < len && code[end] >= '0' && code[end] <= '7') end++;
180
+ }
181
+ // Decimal/Float
182
+ else {
183
+ while (end < len) {
184
+ const ch = code[end];
185
+ if ((ch >= '0' && ch <= '9') || ch === '.') {
186
+ end++;
187
+ } else {
188
+ break;
189
+ }
190
+ }
191
+ // Scientific notation
192
+ if (end < len && (code[end] === 'e' || code[end] === 'E')) {
193
+ end++;
194
+ if (end < len && (code[end] === '+' || code[end] === '-')) end++;
195
+ while (end < len && code[end] >= '0' && code[end] <= '9') end++;
196
+ }
197
+ }
198
+
199
+ // Suffix (u, l, f, etc.)
200
+ while (end < len) {
201
+ const ch = code[end];
202
+ if (ch === 'u' || ch === 'U' || ch === 'l' || ch === 'L' || ch === 'f' || ch === 'F') {
203
+ end++;
204
+ } else {
205
+ break;
206
+ }
207
+ }
208
+
209
+ const number = code.substring(i, end);
210
+ tokens.push('<span class="c-value">', escapeHtml(number), '</span>');
211
+ i = end;
212
+ continue;
213
+ }
214
+
215
+ // Identifier or keyword
216
+ if ((char >= 'a' && char <= 'z') || (char >= 'A' && char <= 'Z') || char === '_') {
217
+ let end = i + 1;
218
+ while (end < len) {
219
+ const ch = code[end];
220
+ if ((ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') ||
221
+ (ch >= '0' && ch <= '9') || ch === '_') {
222
+ end++;
223
+ } else {
224
+ break;
225
+ }
226
+ }
227
+ const word = code.substring(i, end);
228
+
229
+ if (C_KEYWORDS.has(word)) {
230
+ tokens.push('<span class="c-keyword">', escapeHtml(word), '</span>');
231
+ } else if (isType(word)) {
232
+ // Check types before macros (VALUE, ID are types, not macros)
233
+ tokens.push('<span class="c-type">', escapeHtml(word), '</span>');
234
+ } else if (isMacro(word)) {
235
+ tokens.push('<span class="c-macro">', escapeHtml(word), '</span>');
236
+ } else {
237
+ // Check if followed by '(' -> function name
238
+ let nextCharIdx = end;
239
+ while (nextCharIdx < len && (code[nextCharIdx] === ' ' || code[nextCharIdx] === '\t')) {
240
+ nextCharIdx++;
241
+ }
242
+ if (nextCharIdx < len && code[nextCharIdx] === '(') {
243
+ tokens.push('<span class="c-function">', escapeHtml(word), '</span>');
244
+ } else {
245
+ tokens.push('<span class="c-identifier">', escapeHtml(word), '</span>');
246
+ }
247
+ }
248
+ i = end;
249
+ continue;
250
+ }
251
+
252
+ // Operators
253
+ if (OPERATOR_CHARS.has(char)) {
254
+ let op = char;
255
+ // Check for two-character operators
256
+ if (i + 1 < len) {
257
+ const twoChar = char + code[i + 1];
258
+ if (OPERATORS.has(twoChar)) {
259
+ op = twoChar;
260
+ }
261
+ }
262
+ tokens.push('<span class="c-operator">', escapeHtml(op), '</span>');
263
+ i += op.length;
264
+ continue;
265
+ }
266
+
267
+ // Everything else (punctuation, whitespace)
268
+ tokens.push(escapeHtml(char));
269
+ i++;
270
+ }
271
+
272
+ return tokens.join('');
273
+ }
274
+
275
+ /**
276
+ * Initialize C syntax highlighting on page load
277
+ */
278
+ function initHighlighting() {
279
+ const codeBlocks = document.querySelectorAll('pre.c');
280
+
281
+ codeBlocks.forEach(block => {
282
+ if (block.getAttribute('data-highlighted') === 'true') {
283
+ return;
284
+ }
285
+
286
+ const code = block.textContent;
287
+ const highlighted = highlightC(code);
288
+
289
+ block.innerHTML = highlighted;
290
+ block.setAttribute('data-highlighted', 'true');
291
+ });
292
+ }
293
+
294
+ if (document.readyState === 'loading') {
295
+ document.addEventListener('DOMContentLoaded', initHighlighting);
296
+ } else {
297
+ initHighlighting();
298
+ }
299
+ })();
@@ -0,0 +1,129 @@
1
+ SearchController = function(data, input, result) {
2
+ this.data = data;
3
+ this.input = input;
4
+ this.result = result;
5
+
6
+ this.current = null;
7
+ this.view = this.result.parentNode;
8
+ this.ranker = new SearchRanker(data.index);
9
+ this.init();
10
+ }
11
+
12
+ SearchController.prototype = Object.assign({}, SearchNavigation, new function() {
13
+ var suid = 1;
14
+
15
+ this.init = function() {
16
+ var _this = this;
17
+ var observer = function(e) {
18
+ switch(e.key) {
19
+ case 'ArrowUp':
20
+ case 'ArrowDown':
21
+ return;
22
+ }
23
+ _this.search(_this.input.value);
24
+ };
25
+ this.input.addEventListener('keyup', observer);
26
+ this.input.addEventListener('click', observer); // mac's clear field
27
+
28
+ this.ranker.ready(function(results, isLast) {
29
+ _this.addResults(results, isLast);
30
+ })
31
+
32
+ this.initNavigation();
33
+ this.setNavigationActive(false);
34
+ }
35
+
36
+ this.search = function(value, selectFirstMatch) {
37
+ this.selectFirstMatch = selectFirstMatch;
38
+
39
+ value = value.trim();
40
+ if (value) {
41
+ this.setNavigationActive(true);
42
+ } else {
43
+ this.setNavigationActive(false);
44
+ }
45
+
46
+ if (value == '') {
47
+ this.lastQuery = value;
48
+ this.result.innerHTML = '';
49
+ this.result.setAttribute('aria-expanded', 'false');
50
+ this.setNavigationActive(false);
51
+ } else if (value != this.lastQuery) {
52
+ this.lastQuery = value;
53
+ this.result.setAttribute('aria-busy', 'true');
54
+ this.result.setAttribute('aria-expanded', 'true');
55
+ this.firstRun = true;
56
+ this.ranker.find(value);
57
+ }
58
+ }
59
+
60
+ this.addResults = function(results, isLast) {
61
+ var target = this.result;
62
+ if (this.firstRun && (results.length > 0 || isLast)) {
63
+ this.current = null;
64
+ this.result.innerHTML = '';
65
+ }
66
+
67
+ for (var i=0, l = results.length; i < l; i++) {
68
+ var item = this.renderItem.call(this, results[i]);
69
+ item.setAttribute('id', 'search-result-' + target.childElementCount);
70
+ target.appendChild(item);
71
+ };
72
+
73
+ if (this.firstRun && results.length > 0) {
74
+ this.firstRun = false;
75
+ this.current = target.firstChild;
76
+ this.current.classList.add('search-selected');
77
+ }
78
+ //TODO: ECMAScript
79
+ //if (jQuery.browser.msie) this.$element[0].className += '';
80
+
81
+ if (this.selectFirstMatch && this.current) {
82
+ this.selectFirstMatch = false;
83
+ this.select(this.current);
84
+ }
85
+
86
+ if (isLast) {
87
+ this.selectFirstMatch = false;
88
+ this.result.setAttribute('aria-busy', 'false');
89
+ }
90
+ }
91
+
92
+ this.move = function(isDown) {
93
+ if (!this.current) return;
94
+ var next = isDown ? this.current.nextElementSibling : this.current.previousElementSibling;
95
+ if (next) {
96
+ this.current.classList.remove('search-selected');
97
+ next.classList.add('search-selected');
98
+ this.input.setAttribute('aria-activedescendant', next.getAttribute('id'));
99
+ this.scrollInElement(next, this.result);
100
+ this.current = next;
101
+ this.input.value = next.firstChild.firstChild.text;
102
+ this.input.select();
103
+ }
104
+ return true;
105
+ }
106
+
107
+ this.hlt = function(html) {
108
+ return this.escapeHTML(html).
109
+ replace(/\u0001/g, '<em>').
110
+ replace(/\u0002/g, '</em>');
111
+ }
112
+
113
+ this.escapeHTML = function(html) {
114
+ return html.replace(/[&<>"`']/g, function(c) {
115
+ return '&#' + c.charCodeAt(0) + ';';
116
+ });
117
+ }
118
+
119
+ this.hide = function() {
120
+ this.result.setAttribute('aria-expanded', 'false');
121
+ this.setNavigationActive(false);
122
+ }
123
+
124
+ this.show = function() {
125
+ this.result.setAttribute('aria-expanded', 'true');
126
+ this.setNavigationActive(true);
127
+ }
128
+ });
129
+
@@ -0,0 +1,105 @@
1
+ /*
2
+ * SearchNavigation allows movement using the arrow keys through the search results.
3
+ *
4
+ * When using this library you will need to set scrollIntoView to the
5
+ * appropriate function for your layout. Use scrollInWindow if the container
6
+ * is not scrollable and scrollInElement if the container is a separate
7
+ * scrolling region.
8
+ */
9
+ SearchNavigation = new function() {
10
+ this.initNavigation = function() {
11
+ var _this = this;
12
+
13
+ document.addEventListener('keydown', function(e) {
14
+ _this.onkeydown(e);
15
+ });
16
+
17
+ this.navigationActive = true;
18
+ }
19
+
20
+ this.setNavigationActive = function(state) {
21
+ this.navigationActive = state;
22
+ }
23
+
24
+ this.onkeydown = function(e) {
25
+ if (!this.navigationActive) return;
26
+ switch(e.key) {
27
+ case 'ArrowLeft':
28
+ if (this.moveLeft()) e.preventDefault();
29
+ break;
30
+ case 'ArrowUp':
31
+ if (e.key == 'ArrowUp' || e.ctrlKey) {
32
+ if (this.moveUp()) e.preventDefault();
33
+ }
34
+ break;
35
+ case 'ArrowRight':
36
+ if (this.moveRight()) e.preventDefault();
37
+ break;
38
+ case 'ArrowDown':
39
+ if (e.key == 'ArrowDown' || e.ctrlKey) {
40
+ if (this.moveDown()) e.preventDefault();
41
+ }
42
+ break;
43
+ case 'Enter':
44
+ if (this.current) e.preventDefault();
45
+ this.select(this.current);
46
+ break;
47
+ }
48
+ if (e.ctrlKey && e.shiftKey) this.select(this.current);
49
+ }
50
+
51
+ this.moveRight = function() {
52
+ }
53
+
54
+ this.moveLeft = function() {
55
+ }
56
+
57
+ this.move = function(isDown) {
58
+ }
59
+
60
+ this.moveUp = function() {
61
+ return this.move(false);
62
+ }
63
+
64
+ this.moveDown = function() {
65
+ return this.move(true);
66
+ }
67
+
68
+ /*
69
+ * Scrolls to the given element in the scrollable element view.
70
+ */
71
+ this.scrollInElement = function(element, view) {
72
+ var offset, viewHeight, viewScroll, height;
73
+ offset = element.offsetTop;
74
+ height = element.offsetHeight;
75
+ viewHeight = view.offsetHeight;
76
+ viewScroll = view.scrollTop;
77
+
78
+ if (offset - viewScroll + height > viewHeight) {
79
+ view.scrollTop = offset - viewHeight + height;
80
+ }
81
+ if (offset < viewScroll) {
82
+ view.scrollTop = offset;
83
+ }
84
+ }
85
+
86
+ /*
87
+ * Scrolls to the given element in the window. The second argument is
88
+ * ignored
89
+ */
90
+ this.scrollInWindow = function(element, ignored) {
91
+ var offset, viewHeight, viewScroll, height;
92
+ offset = element.offsetTop;
93
+ height = element.offsetHeight;
94
+ viewHeight = window.innerHeight;
95
+ viewScroll = window.scrollY;
96
+
97
+ if (offset - viewScroll + height > viewHeight) {
98
+ window.scrollTo(window.scrollX, offset - viewHeight + height);
99
+ }
100
+ if (offset < viewScroll) {
101
+ window.scrollTo(window.scrollX, offset);
102
+ }
103
+ }
104
+ }
105
+