wbzyl-rack-codehighlighter 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/LICENSE +0 -0
- data/README.markdown +301 -0
- data/Rakefile +39 -0
- data/TODO +22 -0
- data/VERSION.yml +4 -0
- data/examples/app.rb +21 -0
- data/examples/config.ru +13 -0
- data/examples/public/javascripts/lang-css.js +2 -0
- data/examples/public/javascripts/lang-hs.js +2 -0
- data/examples/public/javascripts/lang-lisp.js +3 -0
- data/examples/public/javascripts/lang-lua.js +2 -0
- data/examples/public/javascripts/lang-ml.js +2 -0
- data/examples/public/javascripts/lang-proto.js +1 -0
- data/examples/public/javascripts/lang-sql.js +2 -0
- data/examples/public/javascripts/lang-vb.js +2 -0
- data/examples/public/javascripts/lang-wiki.js +1 -0
- data/examples/public/javascripts/prettify.js +31 -0
- data/examples/public/stylesheets/application.css +29 -0
- data/examples/public/stylesheets/coderay.css +126 -0
- data/examples/public/stylesheets/prettify.css +44 -0
- data/examples/public/stylesheets/syntax.css +79 -0
- data/examples/public/stylesheets/uv.css +1022 -0
- data/examples/public/stylesheets/uv/amy.css +147 -0
- data/examples/public/stylesheets/uv/blackboard.css +88 -0
- data/examples/public/stylesheets/uv/cobalt.css +149 -0
- data/examples/public/stylesheets/uv/dawn.css +121 -0
- data/examples/public/stylesheets/uv/espresso_libre.css +109 -0
- data/examples/public/stylesheets/uv/sunburst.css +180 -0
- data/examples/public/stylesheets/uv/twilight.css +137 -0
- data/examples/public/stylesheets/uv/zenburnesque.css +91 -0
- data/examples/views/index.rdiscount +75 -0
- data/examples/views/layout.rdiscount +36 -0
- metadata +95 -0
data/.gitignore
ADDED
data/LICENSE
ADDED
File without changes
|
data/README.markdown
ADDED
@@ -0,0 +1,301 @@
|
|
1
|
+
# Rack Middleware for Code Highlighting
|
2
|
+
|
3
|
+
The *Codehighlighter* gem provides a thin interface over a bunch
|
4
|
+
of exisitng code highlighters to make their usage as generic possible.
|
5
|
+
|
6
|
+
To install it, run:
|
7
|
+
|
8
|
+
sudo gem install wbzyl-codehighlighter-middleware -s http://gems.github.com
|
9
|
+
|
10
|
+
Markup your code with:
|
11
|
+
|
12
|
+
<pre><code>:::ruby
|
13
|
+
...
|
14
|
+
</code></pre>
|
15
|
+
|
16
|
+
Example (incomplete html, needs a layout file with link to css):
|
17
|
+
|
18
|
+
# file simple.rb
|
19
|
+
|
20
|
+
require 'rubygems'
|
21
|
+
require 'sinatra'
|
22
|
+
require 'coderay' # use the Coderay highlighter
|
23
|
+
|
24
|
+
gem 'wbzyl-sinatra-rdiscount'
|
25
|
+
require 'wbzyl-codehighlighter-middleware'
|
26
|
+
|
27
|
+
use Rack::Codehighlighter, :coderay
|
28
|
+
|
29
|
+
get "/" do
|
30
|
+
erb :hello
|
31
|
+
end
|
32
|
+
|
33
|
+
__END__
|
34
|
+
|
35
|
+
@@ hello
|
36
|
+
### Fibonacci numbers in Ruby
|
37
|
+
|
38
|
+
<pre><code>:::ruby
|
39
|
+
def fib(n)
|
40
|
+
if n < 2
|
41
|
+
1
|
42
|
+
else
|
43
|
+
fib(n-2) + fib(n-1)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
</code></pre>
|
47
|
+
|
48
|
+
## An example
|
49
|
+
|
50
|
+
The Codehighlighter follows the same syntax as regular Markdown
|
51
|
+
code blocks, with one exception. It needs to know what
|
52
|
+
language to use for the code block.
|
53
|
+
|
54
|
+
If the first line begins with three colons, the text following
|
55
|
+
the colons identifies the language (ruby in the example).
|
56
|
+
The first line is removed from the code block before processing.
|
57
|
+
|
58
|
+
Run the above example with:
|
59
|
+
|
60
|
+
ruby simple.rb
|
61
|
+
|
62
|
+
The directory *examples* contains ready to run, simple Sinatra app. Try
|
63
|
+
|
64
|
+
rackup -p 4567 config.ru
|
65
|
+
|
66
|
+
or better yet (requires the *thin* gem to be installed):
|
67
|
+
|
68
|
+
thin --rackup config.ru -p 4567 start
|
69
|
+
|
70
|
+
|
71
|
+
Finally, visit the following url:
|
72
|
+
|
73
|
+
http://localhost:4567
|
74
|
+
|
75
|
+
and contemplate the sheer beauty of the rendered code.
|
76
|
+
|
77
|
+
|
78
|
+
## Supported Highlighters
|
79
|
+
|
80
|
+
These currently include: *Syntax* (fast), *Coderay* (very fast),
|
81
|
+
*Ultraviolet* (slow).
|
82
|
+
|
83
|
+
### Syntax
|
84
|
+
|
85
|
+
Supported languages:
|
86
|
+
|
87
|
+
* xml
|
88
|
+
* ruby
|
89
|
+
|
90
|
+
I added support for these languages:
|
91
|
+
|
92
|
+
* ansic
|
93
|
+
* javascript
|
94
|
+
* css21
|
95
|
+
* sqlite
|
96
|
+
|
97
|
+
|
98
|
+
### [Coderay](http://coderay.rubychan.de/)
|
99
|
+
|
100
|
+
Supported languages:
|
101
|
+
|
102
|
+
* C
|
103
|
+
* CSS
|
104
|
+
* Delphi
|
105
|
+
* diff
|
106
|
+
* HTML
|
107
|
+
* RHTML (Rails)
|
108
|
+
* Nitro-XHTML
|
109
|
+
* Java
|
110
|
+
* JavaScript
|
111
|
+
* JSON
|
112
|
+
* Ruby
|
113
|
+
* YAML
|
114
|
+
|
115
|
+
### [Google Code Prettify](http://code.google.com/p/google-code-prettify/), pure Javascript
|
116
|
+
|
117
|
+
Supported languages:
|
118
|
+
|
119
|
+
* css, lisp, hs, lua, sql, vb, wiki,
|
120
|
+
* bsh, c, cc, cpp, cs, csh, cyc, cv, htm, html,
|
121
|
+
* java, js, m, mxml, perl, pl, pm, py, rb, sh,
|
122
|
+
* xhtml, xml, xsl
|
123
|
+
|
124
|
+
|
125
|
+
### Ultraviolet
|
126
|
+
|
127
|
+
The *ultraviolet* gem needs oniguruma regexp library.
|
128
|
+
|
129
|
+
On Fedora install the library with:
|
130
|
+
|
131
|
+
sudo yum install oniguruma
|
132
|
+
|
133
|
+
For installation instruction from sources, see
|
134
|
+
[Carbonica](http://carboni.ca/projects/harsh/)
|
135
|
+
|
136
|
+
Now, install the gem:
|
137
|
+
|
138
|
+
sudo gem install ultraviolet
|
139
|
+
|
140
|
+
[Ultraviolet themes gallery](: http://ultraviolet.rubyforge.org/themes.xhtml)
|
141
|
+
|
142
|
+
Ultraviolet supports almost any language:
|
143
|
+
|
144
|
+
* actionscript
|
145
|
+
* active4d
|
146
|
+
* active4d\_html
|
147
|
+
* active4d\_ini
|
148
|
+
* active4d\_library
|
149
|
+
* ada
|
150
|
+
* antlr
|
151
|
+
* apache
|
152
|
+
* applescript
|
153
|
+
* asp
|
154
|
+
* asp\_vb.net
|
155
|
+
* bibtex
|
156
|
+
* blog\_html
|
157
|
+
* blog\_markdown
|
158
|
+
* blog\_text
|
159
|
+
* blog\_textile
|
160
|
+
* build
|
161
|
+
* bulletin\_board
|
162
|
+
* c
|
163
|
+
* c++
|
164
|
+
* cake
|
165
|
+
* camlp4
|
166
|
+
* cm
|
167
|
+
* coldfusion
|
168
|
+
* context\_free
|
169
|
+
* cs
|
170
|
+
* css
|
171
|
+
* css\_experimental
|
172
|
+
* csv
|
173
|
+
* d
|
174
|
+
* diff
|
175
|
+
* dokuwiki
|
176
|
+
* dot
|
177
|
+
* doxygen
|
178
|
+
* dylan
|
179
|
+
* eiffel
|
180
|
+
* erlang
|
181
|
+
* f-script
|
182
|
+
* fortran
|
183
|
+
* fxscript
|
184
|
+
* greasemonkey
|
185
|
+
* gri
|
186
|
+
* groovy
|
187
|
+
* gtd
|
188
|
+
* gtdalt
|
189
|
+
* haml
|
190
|
+
* haskell
|
191
|
+
* html
|
192
|
+
* html-asp
|
193
|
+
* html\_django
|
194
|
+
* html\_for\_asp.net
|
195
|
+
* html\_mason
|
196
|
+
* html\_rails
|
197
|
+
* html\_tcl
|
198
|
+
* icalendar
|
199
|
+
* inform
|
200
|
+
* ini
|
201
|
+
* installer\_distribution\_script
|
202
|
+
* io
|
203
|
+
* java
|
204
|
+
* javaproperties
|
205
|
+
* javascript
|
206
|
+
* javascript\_+\_prototype
|
207
|
+
* javascript\_+\_prototype\_bracketed
|
208
|
+
* jquery\_javascript
|
209
|
+
* json
|
210
|
+
* languagedefinition
|
211
|
+
* latex
|
212
|
+
* latex\_beamer
|
213
|
+
* latex\_log
|
214
|
+
* latex\_memoir
|
215
|
+
* lexflex
|
216
|
+
* lighttpd
|
217
|
+
* lilypond
|
218
|
+
* lisp
|
219
|
+
* literate\_haskell
|
220
|
+
* logo
|
221
|
+
* logtalk
|
222
|
+
* lua
|
223
|
+
* m
|
224
|
+
* macports\_portfile
|
225
|
+
* mail
|
226
|
+
* makefile
|
227
|
+
* man
|
228
|
+
* markdown
|
229
|
+
* mediawiki
|
230
|
+
* mel
|
231
|
+
* mips
|
232
|
+
* mod\_perl
|
233
|
+
* modula-3
|
234
|
+
* moinmoin
|
235
|
+
* mootools
|
236
|
+
* movable\_type
|
237
|
+
* multimarkdown
|
238
|
+
* objective-c
|
239
|
+
* objective-c++
|
240
|
+
* ocaml
|
241
|
+
* ocamllex
|
242
|
+
* ocamlyacc
|
243
|
+
* opengl
|
244
|
+
* pascal
|
245
|
+
* perl
|
246
|
+
* php
|
247
|
+
* plain\_text
|
248
|
+
* pmwiki
|
249
|
+
* postscript
|
250
|
+
* processing
|
251
|
+
* prolog
|
252
|
+
* property\_list
|
253
|
+
* python
|
254
|
+
* python\_django
|
255
|
+
* qmake\_project
|
256
|
+
* qt\_c++
|
257
|
+
* quake3\_config
|
258
|
+
* r
|
259
|
+
* r\_console
|
260
|
+
* ragel
|
261
|
+
* rd\_r\_documentation
|
262
|
+
* regexp
|
263
|
+
* regular\_expressions\_oniguruma
|
264
|
+
* regular\_expressions\_python
|
265
|
+
* release\_notes
|
266
|
+
* remind
|
267
|
+
* restructuredtext
|
268
|
+
* rez
|
269
|
+
* ruby
|
270
|
+
* ruby\_experimental
|
271
|
+
* ruby\_on\_rails
|
272
|
+
* s5
|
273
|
+
* scheme
|
274
|
+
* scilab
|
275
|
+
* setext
|
276
|
+
* shell-unix-generic
|
277
|
+
* slate
|
278
|
+
* smarty
|
279
|
+
* sql
|
280
|
+
* sql\_rails
|
281
|
+
* ssh-config
|
282
|
+
* standard\_ml
|
283
|
+
* strings\_file
|
284
|
+
* subversion\_commit\_message
|
285
|
+
* sweave
|
286
|
+
* swig
|
287
|
+
* tcl
|
288
|
+
* template\_toolkit
|
289
|
+
* tex
|
290
|
+
* tex\_math
|
291
|
+
* textile
|
292
|
+
* tsv
|
293
|
+
* twiki
|
294
|
+
* txt2tags
|
295
|
+
* vectorscript
|
296
|
+
* xhtml\_1.0
|
297
|
+
* xml
|
298
|
+
* xml\_strict
|
299
|
+
* xsl
|
300
|
+
* yaml
|
301
|
+
* yui\_javascript
|
data/Rakefile
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "rake/gempackagetask"
|
3
|
+
require "rake/clean"
|
4
|
+
#require "spec/rake/spectask"
|
5
|
+
|
6
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '/lib')
|
7
|
+
|
8
|
+
begin
|
9
|
+
require 'jeweler'
|
10
|
+
Jeweler::Tasks.new do |s|
|
11
|
+
s.name = "rack-codehighlighter"
|
12
|
+
s.summary = "Rack Middleware for Code Highlighting."
|
13
|
+
s.email = "matwb@univ.gda.pl"
|
14
|
+
s.homepage = "http://github.com/wbzyl/rack-codehighlighter"
|
15
|
+
s.authors = ["Wlodek Bzyl"]
|
16
|
+
s.description = s.summary
|
17
|
+
|
18
|
+
# s.add_dependency 'coderay', '>=0.8.312'
|
19
|
+
s.add_dependency 'hpricot', '>=0.8.1'
|
20
|
+
end
|
21
|
+
rescue LoadError
|
22
|
+
puts "Jeweler not available."
|
23
|
+
puts "Install it with:"
|
24
|
+
puts " sudo gem install technicalpickles-jeweler -s http://gems.github.com"
|
25
|
+
end
|
26
|
+
|
27
|
+
#Rake::TestTask.new(:test) do |t|
|
28
|
+
# t.libs << 'lib' << 'test'
|
29
|
+
# t.pattern = 'test/**/*_test.rb'
|
30
|
+
# t.verbose = false
|
31
|
+
#end
|
32
|
+
|
33
|
+
desc 'Install the package as a gem.'
|
34
|
+
task :install => [:clean, :build] do
|
35
|
+
gem = Dir['pkg/*.gem'].last
|
36
|
+
sh "sudo gem install --no-rdoc --no-ri --local #{gem}"
|
37
|
+
end
|
38
|
+
|
39
|
+
task :default => :test
|
data/TODO
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
[1.05.2009, done]
|
3
|
+
Add support for code-prettify:
|
4
|
+
|
5
|
+
* [source code](http://code.google.com/p/google-code-prettify/)
|
6
|
+
[example](http://google-code-prettify.googlecode.com/svn/trunk/README.html)
|
7
|
+
|
8
|
+
|
9
|
+
* see http://tomayko.com/writings/javascript-prettification
|
10
|
+
(support for jQuery, new pallette)
|
11
|
+
|
12
|
+
* example:
|
13
|
+
<pre class="prettyprint lang-html">
|
14
|
+
The lang-* class specifies the language file extensions.
|
15
|
+
File extensions supported by default include
|
16
|
+
"bsh", "c", "cc", "cpp", "cs", "csh", "cyc", "cv", "htm", "html",
|
17
|
+
"java", "js", "m", "mxml", "perl", "pl", "pm", "py", "rb", "sh",
|
18
|
+
"xhtml", "xml", "xsl".
|
19
|
+
</pre>
|
20
|
+
|
21
|
+
[1.05.2009]
|
22
|
+
Add support for unobtrustive Code Highlighter By Dan Webb 11/2005
|
data/VERSION.yml
ADDED
data/examples/app.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
|
3
|
+
path = File.join(File.expand_path(File.dirname(__FILE__)), "..", "lib")
|
4
|
+
$:.unshift(path) unless $:.include?(path)
|
5
|
+
|
6
|
+
require 'rubygems'
|
7
|
+
require 'sinatra'
|
8
|
+
require 'rdiscount'
|
9
|
+
|
10
|
+
gem 'wbzyl-sinatra-rdiscount'
|
11
|
+
require 'sinatra/rdiscount'
|
12
|
+
|
13
|
+
require 'codehighlighter-middleware'
|
14
|
+
|
15
|
+
require 'coderay' # Coderay
|
16
|
+
require 'syntax/convertors/html' # Syntax
|
17
|
+
require 'uv' # Ultraviolet
|
18
|
+
|
19
|
+
get "/" do
|
20
|
+
rdiscount :index
|
21
|
+
end
|
data/examples/config.ru
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# run with: thin --rackup config.ru -p 4567 start
|
2
|
+
|
3
|
+
#use Rack::Static, :urls => ["/stylesheets"], :root => "public"
|
4
|
+
|
5
|
+
require 'app'
|
6
|
+
|
7
|
+
use Rack::Lint
|
8
|
+
|
9
|
+
#use Rack::Codehighlighter, :coderay, :logging => true
|
10
|
+
#use Rack::Codehighlighter, :syntax, :logging => true
|
11
|
+
use Rack::Codehighlighter, :ultraviolet, :theme => 'dawn', :logging => true
|
12
|
+
#use Rack::Codehighlighter, :prettify, :logging => true
|
13
|
+
run Sinatra::Application
|
@@ -0,0 +1,2 @@
|
|
1
|
+
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[ \t\r\n\f]+/,null," \t\r\n\u000c"]],[["str",/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],["str",/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["str",/^\([^\)\"\']*\)/,/\burl/i],["kwd",/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["kwd",/^-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*(?=\s*:)/i],["com",/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],["com",/^(?:<!--|--\>)/],
|
2
|
+
["lit",/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],["lit",/^#(?:[0-9a-f]{3}){1,2}/i],["pln",/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],["pun",/^[^\s\w\'\"]+/]]),["css"]);
|
@@ -0,0 +1,2 @@
|
|
1
|
+
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\x0B\x0C\r ]+/,null,"\t\n\u000b\u000c\r "],["str",/^\"(?:[^\"\\\n\x0C\r]|\\[\s\S])*(?:\"|$)/,null,'"'],["str",/^\'(?:[^\'\\\n\x0C\r]|\\[^&])\'?/,null,"'"],["lit",/^(?:0o[0-7]+|0x[\da-f]+|\d+(?:\.\d+)?(?:e[+\-]?\d+)?)/i,null,"0123456789"]],[["com",/^(?:(?:--+(?:[^\r\n\x0C_:\"\'\(\),;\[\]`\{\}][^\r\n\x0C_]*)?(?=[\x0C\r\n]|$))|(?:\{-(?:[^-]|-+[^-\}])*-\}))/],["kwd",/^(?:case|class|data|default|deriving|do|else|if|import|in|infix|infixl|infixr|instance|let|module|newtype|of|then|type|where|_)(?=[^a-zA-Z0-9\']|$)/,
|
2
|
+
null],["pln",/^(?:[A-Z][\w\']*\.)*[a-zA-Z][\w\']*/],["pun",/^[^\t\n\x0B\x0C\r a-zA-Z0-9\'\"]+/]]),["hs"]);
|
@@ -0,0 +1,3 @@
|
|
1
|
+
(function(){var a=null;
|
2
|
+
PR.registerLangHandler(PR.createSimpleLexer([["opn",/^\(/,a,"("],["clo",/^\)/,a,")"],["com",/^;[^\r\n]*/,a,";"],["pln",/^[\t\n\r \xA0]+/,a,"\t\n\r \u00a0"],["str",/^\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)/,a,'"']],[["kwd",/^(?:block|c[ad]+r|catch|cons|defun|do|eq|eql|equal|equalp|eval-when|flet|format|go|if|labels|lambda|let|load-time-value|locally|macrolet|multiple-value-call|nil|progn|progv|quote|require|return-from|setq|symbol-macrolet|t|tagbody|the|throw|unwind)\b/,a],["lit",/^[+\-]?(?:\d+\/\d+|(?:\.\d+|\d+(?:\.\d*)?)(?:[eEdD][+\-]?\d+)?)/],["lit",
|
3
|
+
/^\'(?:-*(?:\w|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?)?/],["pln",/^-*(?:[a-z_]|\\[\x21-\x7e])(?:[\w-]*|\\[\x21-\x7e])[=!?]?/i],["pun",/^[^\w\t\n\r \xA0()\"\\\';]+/]]),["cl","el","lisp","scm"])})()
|
@@ -0,0 +1,2 @@
|
|
1
|
+
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/,null,"\"'"]],[["com",/^--(?:\[(=*)\[[\s\S]*?(?:\]\1\]|$)|[^\r\n]*)/],["str",/^\[(=*)\[[\s\S]*?(?:\]\1\]|$)/],["kwd",/^(?:and|break|do|else|elseif|end|false|for|function|if|in|local|nil|not|or|repeat|return|then|true|until|while)\b/,null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^[a-z_]\w*/i],
|
2
|
+
["pun",/^[^\w\t\n\r \xA0]+/]]),["lua"]);
|
@@ -0,0 +1,2 @@
|
|
1
|
+
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["com",/^#(?:if[\t\n\r \xA0]+(?:[a-z_$][\w\']*|``[^\r\n\t`]*(?:``|$))|else|endif|light)/i,null,"#"],["str",/^(?:\"(?:[^\"\\]|\\[\s\S])*(?:\"|$)|\'(?:[^\'\\]|\\[\s\S])*(?:\'|$))/,null,"\"'"]],[["com",/^(?:\/\/[^\r\n]*|\(\*[\s\S]*?\*\))/],["kwd",/^(?:abstract|and|as|assert|begin|class|default|delegate|do|done|downcast|downto|elif|else|end|exception|extern|false|finally|for|fun|function|if|in|inherit|inline|interface|internal|lazy|let|match|member|module|mutable|namespace|new|null|of|open|or|override|private|public|rec|return|static|struct|then|to|true|try|type|upcast|use|val|void|when|while|with|yield|asr|land|lor|lsl|lsr|lxor|mod|sig|atomic|break|checked|component|const|constraint|constructor|continue|eager|event|external|fixed|functor|global|include|method|mixin|object|parallel|process|protected|pure|sealed|trait|virtual|volatile)\b/],
|
2
|
+
["lit",/^[+\-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^(?:[a-z_]\w*[!?#]?|``[^\r\n\t`]*(?:``|$))/i],["pun",/^[^\t\n\r \xA0\"\'\w]+/]]),["fs","ml"]);
|
@@ -0,0 +1 @@
|
|
1
|
+
PR.registerLangHandler(PR.sourceDecorator({keywords:"bool bytes default double enum extend extensions false fixed32 fixed64 float group import int32 int64 max message option optional package repeated required returns rpc service sfixed32 sfixed64 sint32 sint64 string syntax to true uint32 uint64",cStyleComments:true}),["proto"]);
|
@@ -0,0 +1,2 @@
|
|
1
|
+
PR.registerLangHandler(PR.createSimpleLexer([["pln",/^[\t\n\r \xA0]+/,null,"\t\n\r \u00a0"],["str",/^(?:"(?:[^\"\\]|\\.)*"|'(?:[^\'\\]|\\.)*')/,null,"\"'"]],[["com",/^(?:--[^\r\n]*|\/\*[\s\S]*?(?:\*\/|$))/],["kwd",/^(?:ADD|ALL|ALTER|AND|ANY|AS|ASC|AUTHORIZATION|BACKUP|BEGIN|BETWEEN|BREAK|BROWSE|BULK|BY|CASCADE|CASE|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COMMIT|COMPUTE|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT|CURRENT_DATE|CURRENT_TIME|CURRENT_TIMESTAMP|CURRENT_USER|CURSOR|DATABASE|DBCC|DEALLOCATE|DECLARE|DEFAULT|DELETE|DENY|DESC|DISK|DISTINCT|DISTRIBUTED|DOUBLE|DROP|DUMMY|DUMP|ELSE|END|ERRLVL|ESCAPE|EXCEPT|EXEC|EXECUTE|EXISTS|EXIT|FETCH|FILE|FILLFACTOR|FOR|FOREIGN|FREETEXT|FREETEXTTABLE|FROM|FULL|FUNCTION|GOTO|GRANT|GROUP|HAVING|HOLDLOCK|IDENTITY|IDENTITYCOL|IDENTITY_INSERT|IF|IN|INDEX|INNER|INSERT|INTERSECT|INTO|IS|JOIN|KEY|KILL|LEFT|LIKE|LINENO|LOAD|NATIONAL|NOCHECK|NONCLUSTERED|NOT|NULL|NULLIF|OF|OFF|OFFSETS|ON|OPEN|OPENDATASOURCE|OPENQUERY|OPENROWSET|OPENXML|OPTION|OR|ORDER|OUTER|OVER|PERCENT|PLAN|PRECISION|PRIMARY|PRINT|PROC|PROCEDURE|PUBLIC|RAISERROR|READ|READTEXT|RECONFIGURE|REFERENCES|REPLICATION|RESTORE|RESTRICT|RETURN|REVOKE|RIGHT|ROLLBACK|ROWCOUNT|ROWGUIDCOL|RULE|SAVE|SCHEMA|SELECT|SESSION_USER|SET|SETUSER|SHUTDOWN|SOME|STATISTICS|SYSTEM_USER|TABLE|TEXTSIZE|THEN|TO|TOP|TRAN|TRANSACTION|TRIGGER|TRUNCATE|TSEQUAL|UNION|UNIQUE|UPDATE|UPDATETEXT|USE|USER|VALUES|VARYING|VIEW|WAITFOR|WHEN|WHERE|WHILE|WITH|WRITETEXT)(?=[^\w-]|$)/i,
|
2
|
+
null],["lit",/^[+-]?(?:0x[\da-f]+|(?:(?:\.\d+|\d+(?:\.\d*)?)(?:e[+\-]?\d+)?))/i],["pln",/^[a-z_][\w-]*/i],["pun",/^[^\w\t\n\r \xA0]+/]]),["sql"]);
|