rouge 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rouge/demos/idlang +8 -0
- data/lib/rouge/formatters/html.rb +0 -3
- data/lib/rouge/lexers/csharp.rb +1 -1
- data/lib/rouge/lexers/idlang.rb +316 -0
- data/lib/rouge/lexers/java.rb +11 -3
- data/lib/rouge/lexers/javascript.rb +23 -0
- data/lib/rouge/lexers/liquid.rb +1 -1
- data/lib/rouge/lexers/shell.rb +8 -2
- data/lib/rouge/lexers/twig.rb +2 -0
- data/lib/rouge/theme.rb +8 -0
- data/lib/rouge/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58d67e05c1ce7c2db44d5ce537e17a233f77148b
|
4
|
+
data.tar.gz: 879be7fc4c49e621e7c88107138bf44a2d43f8b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54fbeee82ad363f158c292fbf3140befa2a8a5164f73d167ecdf3e1f012956e958137ec77f5d4bb539e707e6e4db0111d513d2a6042b991a43f32e9755885ae0
|
7
|
+
data.tar.gz: df96e836f4254a16ad9acbe5a3612dff4ec0c309365b546334eb87179f7cff604f536e664c8e3b31ecab7cb969c56004f8473b0722ffab325105bb0e11c324e3
|
data/lib/rouge/lexers/csharp.rb
CHANGED
@@ -0,0 +1,316 @@
|
|
1
|
+
# -*- coding: utf-8 -*- #
|
2
|
+
# vim: set ts=2 sw=2 et:
|
3
|
+
|
4
|
+
module Rouge
|
5
|
+
module Lexers
|
6
|
+
class IDLang < RegexLexer
|
7
|
+
title "IDL"
|
8
|
+
desc "Interactive Data Language"
|
9
|
+
|
10
|
+
tag 'idlang'
|
11
|
+
filenames '*.idl'
|
12
|
+
|
13
|
+
def self.analyze_text(text)
|
14
|
+
# Does there exist a statement that starts with 'pro' or
|
15
|
+
# 'function'?
|
16
|
+
return 0.4 if text =~ /^\s+(pro|function)\z/
|
17
|
+
end
|
18
|
+
|
19
|
+
name = /[_A-Z]\w*/i
|
20
|
+
kind_param = /(\d+|#{name})/
|
21
|
+
exponent = /[dDeE][+-]\d+/
|
22
|
+
|
23
|
+
def self.exec_unit
|
24
|
+
@exec_unit ||= Set.new %w(
|
25
|
+
PRO FUNCTION
|
26
|
+
)
|
27
|
+
end
|
28
|
+
|
29
|
+
def self.keywords
|
30
|
+
@keywords ||= Set.new %w(
|
31
|
+
STRUCT INHERITS
|
32
|
+
RETURN CONTINUE BEGIN END BREAK GOTO
|
33
|
+
)
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.standalone_statements
|
37
|
+
# Must not have a comma afterwards
|
38
|
+
@standalone_statements ||= Set.new %w(
|
39
|
+
COMMON FORWARD_FUNCTION
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.decorators
|
44
|
+
# Must not have a comma afterwards
|
45
|
+
@decorators ||= Set.new %w(
|
46
|
+
COMPILE_OPT
|
47
|
+
)
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.operators
|
51
|
+
@operators ||= Set.new %w(
|
52
|
+
AND= EQ= GE= GT= LE= LT= MOD= NE= OR= XOR= NOT=
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.conditionals
|
57
|
+
@conditionals ||= Set.new %w(
|
58
|
+
OF DO ENDIF ENDELSE ENDFOR ENDFOREACH ENDWHILE ENDREP ENDCASE ENDSWITCH
|
59
|
+
IF THEN ELSE FOR FOREACH WHILE REPEAT UNTIL CASE SWITCH
|
60
|
+
AND EQ GE GT LE LT MOD NE OR XOR NOT
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def self.routines
|
65
|
+
@routines ||= Set.new %w(
|
66
|
+
A_CORRELATE ABS ACOS ADAPT_HIST_EQUAL ALOG ALOG10
|
67
|
+
AMOEBA ANNOTATE ARG_PRESENT ARRAY_EQUAL
|
68
|
+
ARRAY_INDICES ARROW ASCII_TEMPLATE ASIN ASSOC ATAN
|
69
|
+
AXIS BAR_PLOT BESELI BESELJ BESELK BESELY BETA
|
70
|
+
BILINEAR BIN_DATE BINARY_TEMPLATE BINDGEN BINOMIAL
|
71
|
+
BLAS_AXPY BLK_CON BOX_CURSOR BREAK BREAKPOINT
|
72
|
+
BROYDEN BYTARR BYTE BYTEORDER BYTSCL C_CORRELATE
|
73
|
+
CALDAT CALENDAR CALL_EXTERNAL CALL_FUNCTION
|
74
|
+
CALL_METHOD CALL_PROCEDURE CATCH CD CEIL CHEBYSHEV
|
75
|
+
CHECK_MATH CHISQR_CVF CHISQR_PDF CHOLDC CHOLSOL
|
76
|
+
CINDGEN CIR_3PNT CLOSE CLUST_WTS CLUSTER
|
77
|
+
COLOR_CONVERT COLOR_QUAN COLORMAP_APPLICABLE COMFIT
|
78
|
+
COMPLEX COMPLEXARR COMPLEXROUND
|
79
|
+
COMPUTE_MESH_NORMALS COND CONGRID CONJ
|
80
|
+
CONSTRAINED_MIN CONTOUR CONVERT_COORD CONVOL
|
81
|
+
COORD2TO3 CORRELATE COS COSH CRAMER CREATE_STRUCT
|
82
|
+
CREATE_VIEW CROSSP CRVLENGTH CT_LUMINANCE CTI_TEST
|
83
|
+
CURSOR CURVEFIT CV_COORD CVTTOBM CW_ANIMATE
|
84
|
+
CW_ANIMATE_GETP CW_ANIMATE_LOAD CW_ANIMATE_RUN
|
85
|
+
CW_ARCBALL CW_BGROUP CW_CLR_INDEX CW_COLORSEL
|
86
|
+
CW_DEFROI CW_FIELD CW_FILESEL CW_FORM CW_FSLIDER
|
87
|
+
CW_LIGHT_EDITOR CW_LIGHT_EDITOR_GET
|
88
|
+
CW_LIGHT_EDITOR_SET CW_ORIENT CW_PALETTE_EDITOR
|
89
|
+
CW_PALETTE_EDITOR_GET CW_PALETTE_EDITOR_SET
|
90
|
+
CW_PDMENU CW_RGBSLIDER CW_TMPL CW_ZOOM DBLARR
|
91
|
+
DCINDGEN DCOMPLEX DCOMPLEXARR DEFINE_KEY DEFROI
|
92
|
+
DEFSYSV DELETE_SYMBOL DELLOG DELVAR DERIV DERIVSIG
|
93
|
+
DETERM DEVICE DFPMIN DIALOG_MESSAGE
|
94
|
+
DIALOG_PICKFILE DIALOG_PRINTERSETUP
|
95
|
+
DIALOG_PRINTJOB DIALOG_READ_IMAGE
|
96
|
+
DIALOG_WRITE_IMAGE DICTIONARY DIGITAL_FILTER DILATE DINDGEN
|
97
|
+
DISSOLVE DIST DLM_LOAD DLM_REGISTER
|
98
|
+
DO_APPLE_SCRIPT DOC_LIBRARY DOUBLE DRAW_ROI EFONT
|
99
|
+
EIGENQL EIGENVEC ELMHES EMPTY ENABLE_SYSRTN EOF
|
100
|
+
ERASE ERODE ERRORF ERRPLOT EXECUTE EXIT EXP EXPAND
|
101
|
+
EXPAND_PATH EXPINT EXTRAC EXTRACT_SLICE F_CVF
|
102
|
+
F_PDF FACTORIAL FFT FILE_CHMOD FILE_DELETE
|
103
|
+
FILE_EXPAND_PATH FILE_MKDIR FILE_TEST FILE_WHICH
|
104
|
+
FILE_SEARCH PATH_SEP FILE_DIRNAME FILE_BASENAME
|
105
|
+
FILE_INFO FILE_MOVE FILE_COPY FILE_LINK FILE_POLL_INPUT
|
106
|
+
FILEPATH FINDFILE FINDGEN FINITE FIX FLICK FLOAT
|
107
|
+
FLOOR FLOW3 FLTARR FLUSH FORMAT_AXIS_VALUES
|
108
|
+
FORWARD_FUNCTION FREE_LUN FSTAT FULSTR FUNCT
|
109
|
+
FV_TEST FX_ROOT FZ_ROOTS GAMMA GAMMA_CT
|
110
|
+
GAUSS_CVF GAUSS_PDF GAUSS2DFIT GAUSSFIT GAUSSINT
|
111
|
+
GET_DRIVE_LIST GET_KBRD GET_LUN GET_SCREEN_SIZE
|
112
|
+
GET_SYMBOL GETENV GOTO GREG2JUL GRID_TPS GRID3 GS_ITER
|
113
|
+
H_EQ_CT H_EQ_INT HANNING HASH HEAP_GC HELP HILBERT
|
114
|
+
HIST_2D HIST_EQUAL HISTOGRAM HLS HOUGH HQR HSV
|
115
|
+
IBETA IDENTITY IDL_CONTAINER IDLANROI
|
116
|
+
IDLANROIGROUP IDLFFDICOM IDLFFDXF IDLFFLANGUAGECAT
|
117
|
+
IDLFFSHAPE IDLGRAXIS IDLGRBUFFER IDLGRCLIPBOARD
|
118
|
+
IDLGRCOLORBAR IDLGRCONTOUR IDLGRFONT IDLGRIMAGE
|
119
|
+
IDLGRLEGEND IDLGRLIGHT IDLGRMODEL IDLGRMPEG
|
120
|
+
IDLGRPALETTE IDLGRPATTERN IDLGRPLOT IDLGRPOLYGON
|
121
|
+
IDLGRPOLYLINE IDLGRPRINTER IDLGRROI IDLGRROIGROUP
|
122
|
+
IDLGRSCENE IDLGRSURFACE IDLGRSYMBOL
|
123
|
+
IDLGRTESSELLATOR IDLGRTEXT IDLGRVIEW
|
124
|
+
IDLGRVIEWGROUP IDLGRVOLUME IDLGRVRML IDLGRWINDOW
|
125
|
+
IGAMMA IMAGE_CONT IMAGE_STATISTICS IMAGINARY
|
126
|
+
INDGEN INT_2D INT_3D INT_TABULATED INTARR INTERPOL
|
127
|
+
INTERPOLATE INVERT IOCTL ISA ISHFT ISOCONTOUR
|
128
|
+
ISOSURFACE JOURNAL JUL2GREG JULDAY KEYWORD_SET KRIG2D
|
129
|
+
KURTOSIS KW_TEST L64INDGEN LABEL_DATE LABEL_REGION
|
130
|
+
LADFIT LAGUERRE LEEFILT LEGENDRE LINBCG LINDGEN
|
131
|
+
LINFIT LINKIMAGE LIST LIVE_CONTOUR LIVE_CONTROL
|
132
|
+
LIVE_DESTROY LIVE_EXPORT LIVE_IMAGE LIVE_INFO
|
133
|
+
LIVE_LINE LIVE_LOAD LIVE_OPLOT LIVE_PLOT
|
134
|
+
LIVE_PRINT LIVE_RECT LIVE_STYLE LIVE_SURFACE
|
135
|
+
LIVE_TEXT LJLCT LL_ARC_DISTANCE LMFIT LMGR LNGAMMA
|
136
|
+
LNP_TEST LOADCT LOCALE_GET LON64ARR LONARR LONG
|
137
|
+
LONG64 LSODE LU_COMPLEX LUDC LUMPROVE LUSOL
|
138
|
+
M_CORRELATE MACHAR MAKE_ARRAY MAKE_DLL MAP_2POINTS
|
139
|
+
MAP_CONTINENTS MAP_GRID MAP_IMAGE MAP_PATCH
|
140
|
+
MAP_PROJ_INFO MAP_SET MAX MATRIX_MULTIPLY MD_TEST MEAN
|
141
|
+
MEANABSDEV MEDIAN MEMORY MESH_CLIP MESH_DECIMATE
|
142
|
+
MESH_ISSOLID MESH_MERGE MESH_NUMTRIANGLES MESH_OBJ
|
143
|
+
MESH_SMOOTH MESH_SURFACEAREA MESH_VALIDATE
|
144
|
+
MESH_VOLUME MESSAGE MIN MIN_CURVE_SURF MK_HTML_HELP
|
145
|
+
MODIFYCT MOMENT MORPH_CLOSE MORPH_DISTANCE
|
146
|
+
MORPH_GRADIENT MORPH_HITORMISS MORPH_OPEN
|
147
|
+
MORPH_THIN MORPH_TOPHAT MPEG_CLOSE MPEG_OPEN
|
148
|
+
MPEG_PUT MPEG_SAVE MSG_CAT_CLOSE MSG_CAT_COMPILE
|
149
|
+
MSG_CAT_OPEN MULTI N_ELEMENTS N_PARAMS N_TAGS
|
150
|
+
NEWTON NORM OBJ_CLASS OBJ_DESTROY OBJ_ISA OBJ_NEW
|
151
|
+
OBJ_VALID OBJARR ON_ERROR ON_IOERROR ONLINE_HELP
|
152
|
+
OPEN OPENR OPENW OPENU OPLOT OPLOTERR ORDEREDHASH P_CORRELATE
|
153
|
+
PARTICLE_TRACE PCOMP PLOT PLOT_3DBOX PLOT_FIELD
|
154
|
+
PLOTERR PLOTS PNT_LINE POINT_LUN POLAR_CONTOUR
|
155
|
+
POLAR_SURFACE POLY POLY_2D POLY_AREA POLY_FIT
|
156
|
+
POLYFILL POLYFILLV POLYSHADE POLYWARP POPD POWELL
|
157
|
+
PRIMES PRINT PRINTF PRINTD PRODUCT PROFILE PROFILER
|
158
|
+
PROFILES PROJECT_VOL PS_SHOW_FONTS PSAFM PSEUDO
|
159
|
+
PTR_FREE PTR_NEW PTR_VALID PTRARR PUSHD QROMB
|
160
|
+
QROMO QSIMP QUERY_CSV R_CORRELATE R_TEST RADON RANDOMN
|
161
|
+
RANDOMU RANKS RDPIX READ READF READ_ASCII
|
162
|
+
READ_BINARY READ_BMP READ_CSV READ_DICOM READ_IMAGE
|
163
|
+
READ_INTERFILE READ_JPEG READ_PICT READ_PNG
|
164
|
+
READ_PPM READ_SPR READ_SRF READ_SYLK READ_TIFF
|
165
|
+
READ_WAV READ_WAVE READ_X11_BITMAP READ_XWD READS
|
166
|
+
READU REBIN RECALL_COMMANDS RECON3 REDUCE_COLORS
|
167
|
+
REFORM REGRESS REPLICATE REPLICATE_INPLACE
|
168
|
+
RESOLVE_ALL RESOLVE_ROUTINE RESTORE RETALL
|
169
|
+
REVERSE REWIND RK4 ROBERTS ROT ROTATE ROUND
|
170
|
+
ROUTINE_INFO RS_TEST S_TEST SAVE SAVGOL SCALE3
|
171
|
+
SCALE3D SCOPE_LEVEL SCOPE_TRACEBACK SCOPE_VARFETCH
|
172
|
+
SCOPE_VARNAME SEARCH2D SEARCH3D SET_PLOT SET_SHADING
|
173
|
+
SET_SYMBOL SETENV SETLOG SETUP_KEYS SFIT
|
174
|
+
SHADE_SURF SHADE_SURF_IRR SHADE_VOLUME SHIFT SHOW3
|
175
|
+
SHOWFONT SIGNUM SIN SINDGEN SINH SIZE SKEWNESS SKIPF
|
176
|
+
SLICER3 SLIDE_IMAGE SMOOTH SOBEL SOCKET SORT SPAWN
|
177
|
+
SPH_4PNT SPH_SCAT SPHER_HARM SPL_INIT SPL_INTERP
|
178
|
+
SPLINE SPLINE_P SPRSAB SPRSAX SPRSIN SPRSTP SQRT
|
179
|
+
STANDARDIZE STDDEV STOP STRARR STRCMP STRCOMPRESS
|
180
|
+
STREAMLINE STREGEX STRETCH STRING STRJOIN STRLEN
|
181
|
+
STRLOWCASE STRMATCH STRMESSAGE STRMID STRPOS
|
182
|
+
STRPUT STRSPLIT STRTRIM STRUCT_ASSIGN STRUCT_HIDE
|
183
|
+
STRUPCASE SURFACE SURFR SVDC SVDFIT SVSOL
|
184
|
+
SWAP_ENDIAN SWITCH SYSTIME T_CVF T_PDF T3D
|
185
|
+
TAG_NAMES TAN TANH TAPRD TAPWRT TEK_COLOR
|
186
|
+
TEMPORARY TETRA_CLIP TETRA_SURFACE TETRA_VOLUME
|
187
|
+
THIN THREED TIME_TEST2 TIMEGEN TM_TEST TOTAL TRACE
|
188
|
+
TRANSPOSE TRI_SURF TRIANGULATE TRIGRID TRIQL
|
189
|
+
TRIRED TRISOL TRNLOG TS_COEF TS_DIFF TS_FCAST
|
190
|
+
TS_SMOOTH TV TVCRS TVLCT TVRD TVSCL TYPENAME UINDGEN UINT
|
191
|
+
UINTARR UL64INDGEN ULINDGEN ULON64ARR ULONARR
|
192
|
+
ULONG ULONG64 UNIQ USERSYM VALUE_LOCATE VARIANCE
|
193
|
+
VAX_FLOAT VECTOR_FIELD VEL VELOVECT VERT_T3D VOIGT
|
194
|
+
VORONOI VOXEL_PROJ WAIT WARP_TRI WATERSHED WDELETE
|
195
|
+
WEOF WF_DRAW WHERE WIDGET_BASE WIDGET_BUTTON
|
196
|
+
WIDGET_CONTROL WIDGET_DRAW WIDGET_DROPLIST
|
197
|
+
WIDGET_EVENT WIDGET_INFO WIDGET_LABEL WIDGET_LIST
|
198
|
+
WIDGET_SLIDER WIDGET_TABLE WIDGET_TEXT WINDOW
|
199
|
+
WRITE_BMP WRITE_CSV WRITE_IMAGE WRITE_JPEG WRITE_NRIF
|
200
|
+
WRITE_PICT WRITE_PNG WRITE_PPM WRITE_SPR WRITE_SRF
|
201
|
+
WRITE_SYLK WRITE_TIFF WRITE_WAV WRITE_WAVE WRITEU
|
202
|
+
WSET WSHOW WTN WV_APPLET WV_CW_WAVELET WV_CWT
|
203
|
+
WV_DENOISE WV_DWT WV_FN_COIFLET WV_FN_DAUBECHIES
|
204
|
+
WV_FN_GAUSSIAN WV_FN_HAAR WV_FN_MORLET WV_FN_PAUL
|
205
|
+
WV_FN_SYMLET WV_IMPORT_DATA WV_IMPORT_WAVELET
|
206
|
+
WV_PLOT3D_WPS WV_PLOT_MULTIRES WV_PWT
|
207
|
+
WV_TOOL_DENOISE XBM_EDIT XDISPLAYFILE XDXF XFONT
|
208
|
+
XINTERANIMATE XLOADCT XMANAGER XMNG_TMPL XMTOOL
|
209
|
+
XOBJVIEW XPALETTE XPCOLOR XPLOT3D XREGISTERED XROI
|
210
|
+
XSQ_TEST XSURFACE XVAREDIT XVOLUME XVOLUME_ROTATE
|
211
|
+
XVOLUME_WRITE_IMAGE XYOUTS ZOOM ZOOM_24
|
212
|
+
)
|
213
|
+
end
|
214
|
+
|
215
|
+
state :root do
|
216
|
+
rule /[\s\n]+/, Text::Whitespace
|
217
|
+
# Normal comments
|
218
|
+
rule /;.*$/, Comment::Single
|
219
|
+
rule /\,\s*\,/, Error
|
220
|
+
rule /\!#{name}/, Name::Variable::Global
|
221
|
+
|
222
|
+
rule /[(),:\&\$]/, Punctuation
|
223
|
+
|
224
|
+
## Format statements are quite a strange beast.
|
225
|
+
## Better process them in their own state.
|
226
|
+
#rule /\b(FORMAT)(\s*)(\()/mi do |m|
|
227
|
+
# token Keyword, m[1]
|
228
|
+
# token Text::Whitespace, m[2]
|
229
|
+
# token Punctuation, m[3]
|
230
|
+
# push :format_spec
|
231
|
+
#end
|
232
|
+
|
233
|
+
rule %r(
|
234
|
+
[+-]? # sign
|
235
|
+
(
|
236
|
+
(\d+[.]\d*|[.]\d+)(#{exponent})?
|
237
|
+
| \d+#{exponent} # exponent is mandatory
|
238
|
+
)
|
239
|
+
(_#{kind_param})? # kind parameter
|
240
|
+
)xi, Num::Float
|
241
|
+
|
242
|
+
rule /\d+(B|S|U|US|LL|L|ULL|UL)?/i, Num::Integer
|
243
|
+
rule /"[0-7]+(B|O|U|ULL|UL|LL|L)?/i, Num::Oct
|
244
|
+
rule /'[0-9A-F]+'X(B|S|US|ULL|UL|U|LL|L)?/i, Num::Hex
|
245
|
+
rule /(#{kind_param}_)?'/, Str::Single, :string_single
|
246
|
+
rule /(#{kind_param}_)?"/, Str::Double, :string_double
|
247
|
+
|
248
|
+
rule %r{\#\#|\#|\&\&|\|\||/=|<=|>=|->|\@|\?|[-+*/<=~^{}]}, Operator
|
249
|
+
# Structures and the like
|
250
|
+
rule /(#{name})(\.)([^\s,]*)/i do |m|
|
251
|
+
groups Name, Operator, Name
|
252
|
+
#delegate IDLang, m[3]
|
253
|
+
end
|
254
|
+
|
255
|
+
rule /(function|pro)((?:\s|\$\s)+)/i do
|
256
|
+
groups Keyword, Text::Whitespace
|
257
|
+
push :funcname
|
258
|
+
end
|
259
|
+
|
260
|
+
rule /#{name}/m do |m|
|
261
|
+
match = m[0].upcase
|
262
|
+
if self.class.keywords.include? match
|
263
|
+
token Keyword
|
264
|
+
elsif self.class.conditionals.include? match
|
265
|
+
token Keyword
|
266
|
+
elsif self.class.decorators.include? match
|
267
|
+
token Name::Decorator
|
268
|
+
elsif self.class.standalone_statements.include? match
|
269
|
+
token Keyword::Reserved
|
270
|
+
elsif self.class.operators.include? match
|
271
|
+
token Operator::Word
|
272
|
+
elsif self.class.routines.include? match
|
273
|
+
token Name::Builtin
|
274
|
+
else
|
275
|
+
token Name
|
276
|
+
end
|
277
|
+
end
|
278
|
+
|
279
|
+
end
|
280
|
+
|
281
|
+
state :funcname do
|
282
|
+
rule /#{name}/, Name::Function
|
283
|
+
|
284
|
+
rule /\s+/, Text::Whitespace
|
285
|
+
rule /(:+|\$)/, Operator
|
286
|
+
rule /;.*/, Comment::Single
|
287
|
+
|
288
|
+
# Be done with this state if we hit EOL or comma
|
289
|
+
rule /$/, Text::Whitespace, :pop!
|
290
|
+
rule /,/, Operator, :pop!
|
291
|
+
end
|
292
|
+
|
293
|
+
state :string_single do
|
294
|
+
rule /[^']+/, Str::Single
|
295
|
+
rule /''/, Str::Escape
|
296
|
+
rule /'/, Str::Single, :pop!
|
297
|
+
end
|
298
|
+
|
299
|
+
state :string_double do
|
300
|
+
rule /[^"]+/, Str::Double
|
301
|
+
rule /"/, Str::Double, :pop!
|
302
|
+
end
|
303
|
+
|
304
|
+
state :format_spec do
|
305
|
+
rule /'/, Str::Single, :string_single
|
306
|
+
rule /"/, Str::Double, :string_double
|
307
|
+
rule /\(/, Punctuation, :format_spec
|
308
|
+
rule /\)/, Punctuation, :pop!
|
309
|
+
rule /,/, Punctuation
|
310
|
+
rule /[\s\n]+/, Text::Whitespace
|
311
|
+
# Edit descriptors could be seen as a kind of "format literal".
|
312
|
+
rule /[^\s'"(),]+/, Literal
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
data/lib/rouge/lexers/java.rb
CHANGED
@@ -56,12 +56,20 @@ module Rouge
|
|
56
56
|
rule /(\.)(#{id})/ do
|
57
57
|
groups Operator, Name::Attribute
|
58
58
|
end
|
59
|
+
|
59
60
|
rule /#{id}:/, Name::Label
|
60
61
|
rule /\$?#{id}/, Name
|
61
62
|
rule /[~^*!%&\[\](){}<>\|+=:;,.\/?-]/, Operator
|
62
|
-
|
63
|
-
|
64
|
-
|
63
|
+
|
64
|
+
digit = /[0-9]_+[0-9]|[0-9]/
|
65
|
+
bin_digit = /[01]_+[01]|[01]/
|
66
|
+
oct_digit = /[0-7]_+[0-7]|[0-7]/
|
67
|
+
hex_digit = /[0-9a-f]_+[0-9a-f]|[0-9a-f]/i
|
68
|
+
rule /#{digit}+\.#{digit}+([eE]#{digit}+)?[fd]?/, Num::Float
|
69
|
+
rule /0b#{bin_digit}+/i, Num::Bin
|
70
|
+
rule /0x#{hex_digit}+/i, Num::Hex
|
71
|
+
rule /0#{oct_digit}+/, Num::Oct
|
72
|
+
rule /#{digit}+L?/, Num::Integer
|
65
73
|
rule /\n/, Text
|
66
74
|
end
|
67
75
|
|
@@ -139,6 +139,11 @@ module Rouge
|
|
139
139
|
rule /;/, Punctuation, :statement
|
140
140
|
rule /[)\].]/, Punctuation
|
141
141
|
|
142
|
+
rule /`/ do
|
143
|
+
token Str::Double
|
144
|
+
push :template_string
|
145
|
+
end
|
146
|
+
|
142
147
|
rule /[?]/ do
|
143
148
|
token Punctuation
|
144
149
|
push :ternary
|
@@ -170,10 +175,16 @@ module Rouge
|
|
170
175
|
rule /[0-9]+/, Num::Integer
|
171
176
|
rule /"(\\\\|\\"|[^"])*"/, Str::Double
|
172
177
|
rule /'(\\\\|\\'|[^'])*'/, Str::Single
|
178
|
+
rule /:/, Punctuation
|
173
179
|
end
|
174
180
|
|
175
181
|
# braced parts that aren't object literals
|
176
182
|
state :statement do
|
183
|
+
rule /case\b/ do
|
184
|
+
token Keyword
|
185
|
+
goto :expr_start
|
186
|
+
end
|
187
|
+
|
177
188
|
rule /(#{id})(\s*)(:)/ do
|
178
189
|
groups Name::Label, Text, Punctuation
|
179
190
|
end
|
@@ -215,6 +226,18 @@ module Rouge
|
|
215
226
|
|
216
227
|
mixin :root
|
217
228
|
end
|
229
|
+
|
230
|
+
# template strings
|
231
|
+
state :template_string do
|
232
|
+
rule /\${/, Punctuation, :template_string_expr
|
233
|
+
rule /`/, Str::Double, :pop!
|
234
|
+
rule /(\\\\|\\[\$`]|[^\$`]|\$[^{])*/, Str::Double
|
235
|
+
end
|
236
|
+
|
237
|
+
state :template_string_expr do
|
238
|
+
rule /}/, Punctuation, :pop!
|
239
|
+
mixin :root
|
240
|
+
end
|
218
241
|
end
|
219
242
|
|
220
243
|
class JSON < RegexLexer
|
data/lib/rouge/lexers/liquid.rb
CHANGED
data/lib/rouge/lexers/shell.rb
CHANGED
@@ -47,7 +47,6 @@ module Rouge
|
|
47
47
|
|
48
48
|
rule /[\[\]{}()=]/, Operator
|
49
49
|
rule /&&|\|\|/, Operator
|
50
|
-
# rule /\|\|/, Operator
|
51
50
|
|
52
51
|
rule /<<</, Operator # here-string
|
53
52
|
rule /<<-?\s*(\'?)\\?(\w+)\1/ do |m|
|
@@ -70,6 +69,12 @@ module Rouge
|
|
70
69
|
rule /[^"`\\$]+/, Str::Double
|
71
70
|
end
|
72
71
|
|
72
|
+
state :ansi_string do
|
73
|
+
rule /\\./, Str::Escape
|
74
|
+
rule /[^\\']+/, Str::Single
|
75
|
+
mixin :single_quotes
|
76
|
+
end
|
77
|
+
|
73
78
|
state :single_quotes do
|
74
79
|
rule /'/, Str::Single, :pop!
|
75
80
|
rule /[^']+/, Str::Single
|
@@ -79,13 +84,14 @@ module Rouge
|
|
79
84
|
rule /\s+/, Text
|
80
85
|
rule /\\./, Str::Escape
|
81
86
|
rule /\$?"/, Str::Double, :double_quotes
|
87
|
+
rule /\$'/, Str::Single, :ansi_string
|
82
88
|
|
83
89
|
# single quotes are much easier than double quotes - we can
|
84
90
|
# literally just scan until the next single quote.
|
85
91
|
# POSIX: Enclosing characters in single-quotes ( '' )
|
86
92
|
# shall preserve the literal value of each character within the
|
87
93
|
# single-quotes. A single-quote cannot occur within single-quotes.
|
88
|
-
rule
|
94
|
+
rule /'/, Str::Single, :single_quotes
|
89
95
|
|
90
96
|
rule /\*/, Keyword
|
91
97
|
|
data/lib/rouge/lexers/twig.rb
CHANGED
data/lib/rouge/theme.rb
CHANGED
@@ -74,6 +74,14 @@ module Rouge
|
|
74
74
|
new(opts).render(&b)
|
75
75
|
end
|
76
76
|
|
77
|
+
def get_own_style(token)
|
78
|
+
self.class.get_own_style(token)
|
79
|
+
end
|
80
|
+
|
81
|
+
def get_style(token)
|
82
|
+
self.class.get_style(token)
|
83
|
+
end
|
84
|
+
|
77
85
|
class << self
|
78
86
|
def style(*tokens)
|
79
87
|
style = tokens.last.is_a?(Hash) ? tokens.pop : {}
|
data/lib/rouge/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rouge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeanine Adkisson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Rouge aims to a be a simple, easy-to-extend drop-in replacement for pygments.
|
14
14
|
email:
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/rouge/demos/haskell
|
60
60
|
- lib/rouge/demos/html
|
61
61
|
- lib/rouge/demos/http
|
62
|
+
- lib/rouge/demos/idlang
|
62
63
|
- lib/rouge/demos/ini
|
63
64
|
- lib/rouge/demos/io
|
64
65
|
- lib/rouge/demos/java
|
@@ -178,6 +179,7 @@ files:
|
|
178
179
|
- lib/rouge/lexers/haskell.rb
|
179
180
|
- lib/rouge/lexers/html.rb
|
180
181
|
- lib/rouge/lexers/http.rb
|
182
|
+
- lib/rouge/lexers/idlang.rb
|
181
183
|
- lib/rouge/lexers/ini.rb
|
182
184
|
- lib/rouge/lexers/io.rb
|
183
185
|
- lib/rouge/lexers/java.rb
|