rouge 2.0.6 → 2.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2f1f405b49dcc56dd2d919c21abea6d7585897d5
4
- data.tar.gz: ce71ccd69a02ce176750e6aa420e1f161e5b2b0c
3
+ metadata.gz: c642d8b27b75da850a03e347206247e0396cb3cf
4
+ data.tar.gz: 94198b0ec1e78e10120292d2a909879f440fc6ec
5
5
  SHA512:
6
- metadata.gz: e7e99a7b930bdb47b7cee04576f298a6a0381e41820fb70562d0376706f1da978dfd5c3416e0b4f3068fc71bfce2a376bcf48d0d9eed78a7b28ac7ce3b7c15e6
7
- data.tar.gz: efe32d1995ea498fb419e86e5ccd8f117b047c06050de26ee2086417cbbe9ef3de92f60c9ca571d533fa510e3073791a4ebbe8fa6966974219ab90dfb4fa88f7
6
+ metadata.gz: 1d36907f61fb6045cd4c0437870f98871c855ab29d1ba4a3ebc30f5f9bb33bf270e0081ff31d7e69c7bdb0536a5bdcc959c15c8dc88249a21eac45795eebe3ce
7
+ data.tar.gz: ed6572d2000df7e7ccf125634e4cfa4fd2d7487015a1c082b6b787784e710622004eb59b39b22750ef3fba8dcab1d230551344832828446676b153f315ac7c30
data/bin/rougify CHANGED
@@ -4,6 +4,7 @@ require 'pathname'
4
4
  ROOT_DIR = Pathname.new(__FILE__).dirname.parent
5
5
  load ROOT_DIR.join('lib/rouge.rb')
6
6
  load ROOT_DIR.join('lib/rouge/cli.rb')
7
+ Signal.trap('SIGPIPE', 'SYSTEM_DEFAULT')
7
8
 
8
9
  begin
9
10
  Rouge::CLI.parse(ARGV).run
@@ -0,0 +1,6 @@
1
+ lo_obj ?= lo_obj->do_nothing( 'Char' && ` String` ).
2
+
3
+ SELECT SINGLE * FROM mara INTO ls_mara WHERE matkl EQ '1324'.
4
+ LOOP AT lt_mara ASSIGNING <mara>.
5
+ CHECK <mara>-mtart EQ '0001'.
6
+ ENDLOOP.
data/lib/rouge/demos/coq CHANGED
@@ -8,4 +8,6 @@ Section with_T.
8
8
  | nil => 0
9
9
  | _ :: ls => S (length ls)
10
10
  end.
11
- End with_T.
11
+ End with_T.
12
+
13
+ Definition a_string := "hello \" world".
@@ -0,0 +1,11 @@
1
+ <template>
2
+ <div id="app">
3
+ {{ message }}
4
+ </div>
5
+ </template>
6
+
7
+ <script lang=coffee>
8
+ app = new Vue
9
+ el: '#app'
10
+ data: { message: 'Hello Vue!' }
11
+ </script>
@@ -0,0 +1,238 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # ABAP elements taken from http://help.sap.com/abapdocu_750/en/index.htm?file=abapdo.htm
3
+
4
+ module Rouge
5
+ module Lexers
6
+ class ABAP < RegexLexer
7
+ title "ABAP"
8
+ desc "SAP - Advanced Business Application Programming"
9
+ tag 'abap'
10
+ filenames '*.abap'
11
+ mimetypes 'text/x-abap'
12
+
13
+ def self.keywords
14
+ @keywords = Set.new %w(
15
+ *-INPUT ?TO ABAP-SOURCE ABBREVIATED ABS ABSTRACT ACCEPT ACCEPTING
16
+ ACCORDING ACCP ACTIVATION ACTUAL ADD ADD-CORRESPONDING ADJACENT
17
+ AFTER ALIAS ALIASES ALIGN ALL ALLOCATE ALPHA ANALYSIS ANALYZER AND
18
+ ANY APPEND APPENDAGE APPENDING APPLICATION ARCHIVE AREA ARITHMETIC
19
+ AS ASCENDING ASPECT ASSERT ASSIGN ASSIGNED ASSIGNING ASSOCIATION
20
+ ASYNCHRONOUS AT ATTRIBUTES AUTHORITY AUTHORITY-CHECK AVG BACK
21
+ BACKGROUND BACKUP BACKWARD BADI BASE BEFORE BEGIN BETWEEN BIG BINARY
22
+ BINTOHEX BIT BIT-AND BIT-NOT BIT-OR BIT-XOR BLACK BLANK BLANKS BLOB
23
+ BLOCK BLOCKS BLUE BOUND BOUNDARIES BOUNDS BOXED BREAK-POINT BT
24
+ BUFFER BY BYPASSING BYTE BYTE-CA BYTE-CN BYTE-CO BYTE-CS BYTE-NA
25
+ BYTE-NS BYTE-ORDER CA CALL CALLING CASE CAST CASTING CATCH CEIL
26
+ CENTER CENTERED CHAIN CHAIN-INPUT CHAIN-REQUEST CHANGE CHANGING
27
+ CHANNELS CHAR CHAR-TO-HEX CHARACTER CHECK CHECKBOX CIRCULAR CLASS
28
+ CLASS-CODING CLASS-DATA CLASS-EVENTS CLASS-METHODS CLASS-POOL
29
+ CLEANUP CLEAR CLIENT CLNT CLOB CLOCK CLOSE CN CO COALESCE CODE
30
+ CODING COLLECT COLOR COLUMN COLUMNS COL_BACKGROUND COL_GROUP
31
+ COL_HEADING COL_KEY COL_NEGATIVE COL_NORMAL COL_POSITIVE COL_TOTAL
32
+ COMMENT COMMENTS COMMIT COMMON COMMUNICATION COMPARING COMPONENT
33
+ COMPONENTS COMPRESSION COMPUTE CONCAT CONCATENATE CONCAT_WITH_SPACE
34
+ COND CONDENSE CONDITION CONNECT CONNECTION CONSTANTS CONTEXT
35
+ CONTEXTS CONTINUE CONTROL CONTROLS CONV CONVERSION CONVERT COPIES
36
+ COPY CORRESPONDING COUNT COUNTRY COVER CP CPI CREATE CREATING
37
+ CRITICAL CS CUKY CURR CURRENCY CURRENCY_CONVERSION CURRENT CURSOR
38
+ CURSOR-SELECTION CUSTOMER CUSTOMER-FUNCTION CX_DYNAMIC_CHECK
39
+ CX_NO_CHECK CX_ROOT CX_SQL_EXCEPTION CX_STATIC_CHECK DANGEROUS DATA
40
+ DATABASE DATAINFO DATASET DATE DATS DATS_ADD_DAYS DATS_ADD_MONTHS
41
+ DATS_DAYS_BETWEEN DATS_IS_VALID DAYLIGHT DD/MM/YY DD/MM/YYYY DDMMYY
42
+ DEALLOCATE DEC DECIMALS DECIMAL_SHIFT DECLARATIONS DEEP DEFAULT
43
+ DEFERRED DEFINE DEFINING DEFINITION DELETE DELETING DEMAND
44
+ DEPARTMENT DESCENDING DESCRIBE DESTINATION DETAIL DF16_DEC DF16_RAW
45
+ DF16_SCL DF34_DEC DF34_RAW DF34_SCL DIALOG DIRECTORY DISCONNECT
46
+ DISPLAY DISPLAY-MODE DISTANCE DISTINCT DIV DIVIDE
47
+ DIVIDE-CORRESPONDING DIVISION DO DUMMY DUPLICATE DUPLICATES DURATION
48
+ DURING DYNAMIC DYNPRO E EDIT EDITOR-CALL ELSE ELSEIF EMPTY ENABLED
49
+ ENABLING ENCODING END END-ENHANCEMENT-SECTION END-LINES
50
+ END-OF-DEFINITION END-OF-FILE END-OF-PAGE END-OF-SELECTION
51
+ END-TEST-INJECTION END-TEST-SEAM ENDAT ENDCASE ENDCATCH ENDCHAIN
52
+ ENDCLASS ENDDO ENDENHANCEMENT ENDEXEC ENDFORM ENDFUNCTION ENDIAN
53
+ ENDIF ENDING ENDINTERFACE ENDLOOP ENDMETHOD ENDMODULE ENDON
54
+ ENDPROVIDE ENDSELECT ENDTRY ENDWHILE ENDWITH ENGINEERING ENHANCEMENT
55
+ ENHANCEMENT-POINT ENHANCEMENT-SECTION ENHANCEMENTS ENTRIES ENTRY
56
+ ENVIRONMENT EQ EQUIV ERRORMESSAGE ERRORS ESCAPE ESCAPING EVENT
57
+ EVENTS EXACT EXCEPT EXCEPTION EXCEPTION-TABLE EXCEPTIONS EXCLUDE
58
+ EXCLUDING EXEC EXECUTE EXISTS EXIT EXIT-COMMAND EXPAND EXPANDING
59
+ EXPIRATION EXPLICIT EXPONENT EXPORT EXPORTING EXTEND EXTENDED
60
+ EXTENSION EXTRACT FAIL FETCH FIELD FIELD-GROUPS FIELD-SYMBOL
61
+ FIELD-SYMBOLS FIELDS FILE FILTER FILTER-TABLE FILTERS FINAL FIND
62
+ FIRST FIRST-LINE FIXED-POINT FKEQ FKGE FLOOR FLTP FLUSH FONT FOR
63
+ FORM FORMAT FORWARD FOUND FRAME FRAMES FREE FRIENDS FROM FUNCTION
64
+ FUNCTION-POOL FUNCTIONALITY FURTHER GAPS GE GENERATE GET
65
+ GET_PRINT_PARAMETERS GIVING GKEQ GKGE GLOBAL GRANT GREEN GROUP
66
+ GROUPS GT HANDLE HANDLER HARMLESS HASHED HAVING HDB HEAD-LINES
67
+ HEADER HEADERS HEADING HELP-ID HELP-REQUEST HEXTOBIN HIDE HIGH HINT
68
+ HOLD HOTSPOT I ICON ID IDENTIFICATION IDENTIFIER IDS IF
69
+ IF_ABAP_CLOSE_RESOURCE IF_ABAP_CODEPAGE IF_ABAP_DB_BLOB_HANDLE
70
+ IF_ABAP_DB_CLOB_HANDLE IF_ABAP_DB_LOB_HANDLE IF_ABAP_DB_READER
71
+ IF_ABAP_DB_WRITER IF_ABAP_READER IF_ABAP_WRITER IF_MESSAGE
72
+ IF_OS_CA_INSTANCE IF_OS_CA_PERSISTENCY IF_OS_FACTORY IF_OS_QUERY
73
+ IF_OS_QUERY_MANAGER IF_OS_QUERY_OPTIONS IF_OS_STATE
74
+ IF_OS_TRANSACTION IF_OS_TRANSACTION_MANAGER IF_SERIALIZABLE_OBJECT
75
+ IF_SHM_BUILD_INSTANCE IF_SYSTEM_UUID IF_T100_DYN_MSG IF_T100_MESSAGE
76
+ IGNORE IGNORING IMMEDIATELY IMPLEMENTATION IMPLEMENTATIONS
77
+ IMPLEMENTED IMPLICIT IMPORT IMPORTING IN INACTIVE INCL INCLUDE
78
+ INCLUDES INCLUDING INCREMENT INDEX INDEX-LINE INFOTYPES INHERITING
79
+ INIT INITIAL INITIALIZATION INNER INOUT INPUT INSERT INSTANCE
80
+ INSTANCES INSTR INT1 INT2 INT4 INT8 INTENSIFIED INTERFACE
81
+ INTERFACE-POOL INTERFACES INTERNAL INTERVALS INTO INVERSE
82
+ INVERTED-DATE IS ISO ITNO JOB JOIN KEEP KEEPING KERNEL KEY KEYS
83
+ KEYWORDS KIND LANG LANGUAGE LAST LATE LAYOUT LCHR LDB_PROCESS LE
84
+ LEADING LEAVE LEFT LEFT-JUSTIFIED LEFTPLUS LEFTSPACE LEGACY LENGTH
85
+ LET LEVEL LEVELS LIKE LINE LINE-COUNT LINE-SELECTION LINE-SIZE
86
+ LINEFEED LINES LIST LIST-PROCESSING LISTBOX LITTLE LLANG LOAD
87
+ LOAD-OF-PROGRAM LOB LOCAL LOCALE LOCATOR LOG-POINT LOGFILE LOGICAL
88
+ LONG LOOP LOW LOWER LPAD LPI LRAW LT LTRIM M MAIL MAIN MAJOR-ID
89
+ MAPPING MARGIN MARK MASK MATCH MATCHCODE MAX MAXIMUM MEDIUM MEMBERS
90
+ MEMORY MESH MESSAGE MESSAGE-ID MESSAGES MESSAGING METHOD METHODS MIN
91
+ MINIMUM MINOR-ID MM/DD/YY MM/DD/YYYY MMDDYY MOD MODE MODIF MODIFIER
92
+ MODIFY MODULE MOVE MOVE-CORRESPONDING MULTIPLY
93
+ MULTIPLY-CORRESPONDING NA NAME NAMETAB NATIVE NB NE NESTED NESTING
94
+ NEW NEW-LINE NEW-PAGE NEW-SECTION NEXT NO NO-DISPLAY NO-EXTENSION
95
+ NO-GAP NO-GAPS NO-GROUPING NO-HEADING NO-SCROLLING NO-SIGN NO-TITLE
96
+ NO-TOPOFPAGE NO-ZERO NODE NODES NON-UNICODE NON-UNIQUE NOT NP NS
97
+ NULL NUMBER NUMC O OBJECT OBJECTS OBLIGATORY OCCURRENCE OCCURRENCES
98
+ OCCURS OF OFF OFFSET ON ONLY OPEN OPTION OPTIONAL OPTIONS OR ORDER
99
+ OTHER OTHERS OUT OUTER OUTPUT OUTPUT-LENGTH OVERFLOW OVERLAY PACK
100
+ PACKAGE PAD PADDING PAGE PAGES PARAMETER PARAMETER-TABLE PARAMETERS
101
+ PART PARTIALLY PATTERN PERCENTAGE PERFORM PERFORMING PERSON PF
102
+ PF-STATUS PINK PLACES POOL POSITION POS_HIGH POS_LOW PRAGMAS PREC
103
+ PRECOMPILED PREFERRED PRESERVING PRIMARY PRINT PRINT-CONTROL
104
+ PRIORITY PRIVATE PROCEDURE PROCESS PROGRAM PROPERTY PROTECTED
105
+ PROVIDE PUBLIC PUSH PUSHBUTTON PUT QUAN QUEUE-ONLY QUICKINFO
106
+ RADIOBUTTON RAISE RAISING RANGE RANGES RAW RAWSTRING READ READ-ONLY
107
+ READER RECEIVE RECEIVED RECEIVER RECEIVING RED REDEFINITION REDUCE
108
+ REDUCED REF REFERENCE REFRESH REGEX REJECT REMOTE RENAMING REPLACE
109
+ REPLACEMENT REPLACING REPORT REQUEST REQUESTED RESERVE RESET
110
+ RESOLUTION RESPECTING RESPONSIBLE RESULT RESULTS RESUMABLE RESUME
111
+ RETRY RETURN RETURNCODE RETURNING RETURNS RIGHT RIGHT-JUSTIFIED
112
+ RIGHTPLUS RIGHTSPACE RISK RMC_COMMUNICATION_FAILURE
113
+ RMC_INVALID_STATUS RMC_SYSTEM_FAILURE ROLE ROLLBACK ROUND ROWS RPAD
114
+ RTRIM RUN SAP SAP-SPOOL SAVING SCALE_PRESERVING
115
+ SCALE_PRESERVING_SCIENTIFIC SCAN SCIENTIFIC
116
+ SCIENTIFIC_WITH_LEADING_ZERO SCREEN SCROLL SCROLL-BOUNDARY SCROLLING
117
+ SEARCH SECONDARY SECONDS SECTION SELECT SELECT-OPTIONS SELECTION
118
+ SELECTION-SCREEN SELECTION-SET SELECTION-SETS SELECTION-TABLE
119
+ SELECTIONS SEND SEPARATE SEPARATED SET SHARED SHIFT SHORT
120
+ SHORTDUMP-ID SIGN SIGN_AS_POSTFIX SIMPLE SINGLE SIZE SKIP SKIPPING
121
+ SMART SOME SORT SORTABLE SORTED SOURCE SPACE SPECIFIED SPLIT SPOOL
122
+ SPOTS SQL SQLSCRIPT SSTRING STABLE STAMP STANDARD START-OF-SELECTION
123
+ STARTING STATE STATEMENT STATEMENTS STATIC STATICS STATUSINFO
124
+ STEP-LOOP STOP STRING STRUCTURE STRUCTURES STYLE SUBKEY SUBMATCHES
125
+ SUBMIT SUBROUTINE SUBSCREEN SUBSTRING SUBTRACT
126
+ SUBTRACT-CORRESPONDING SUFFIX SUM SUMMARY SUMMING SUPPLIED SUPPLY
127
+ SUPPRESS SWITCH SWITCHSTATES SYMBOL SYNCPOINTS SYNTAX SYNTAX-CHECK
128
+ SYNTAX-TRACE SYST SYSTEM-CALL SYSTEM-EXCEPTIONS SYSTEM-EXIT TAB
129
+ TABBED TABLE TABLES TABLEVIEW TABSTRIP TARGET TASK TASKS TEST
130
+ TEST-INJECTION TEST-SEAM TESTING TEXT TEXTPOOL THEN THROW TIME TIMES
131
+ TIMESTAMP TIMEZONE TIMS TIMS_IS_VALID TITLE TITLE-LINES TITLEBAR TO
132
+ TOKENIZATION TOKENS TOP-LINES TOP-OF-PAGE TRACE-FILE TRACE-TABLE
133
+ TRAILING TRANSACTION TRANSFER TRANSFORMATION TRANSLATE TRANSPORTING
134
+ TRMAC TRUNCATE TRUNCATION TRY TSTMP_ADD_SECONDS
135
+ TSTMP_CURRENT_UTCTIMESTAMP TSTMP_IS_VALID TSTMP_SECONDS_BETWEEN TYPE
136
+ TYPE-POOL TYPE-POOLS TYPES ULINE UNASSIGN UNDER UNICODE UNION UNIQUE
137
+ UNIT UNIT_CONVERSION UNIX UNPACK UNTIL UNWIND UP UPDATE UPPER USER
138
+ USER-COMMAND USING UTF-8 VALID VALUE VALUE-REQUEST VALUES VARC VARY
139
+ VARYING VERIFICATION-MESSAGE VERSION VIA VIEW VISIBLE WAIT WARNING
140
+ WHEN WHENEVER WHERE WHILE WIDTH WINDOW WINDOWS WITH WITH-HEADING
141
+ WITH-TITLE WITHOUT WORD WORK WRITE WRITER XML XSD YELLOW YES YYMMDD
142
+ Z ZERO ZONE
143
+ )
144
+ end
145
+
146
+ def self.builtins
147
+ @keywords = Set.new %w(
148
+ acos apply asin assign atan attribute bit-set boolc boolx call
149
+ call-method cast ceil cfunc charlen char_off class_constructor clear
150
+ cluster cmax cmin cnt communication_failure concat_lines_of cond
151
+ cond-var condense constructor contains contains_any_not_of
152
+ contains_any_of copy cos cosh count count_any_not_of count_any_of
153
+ create cursor data dbmaxlen dbtab deserialize destructor distance
154
+ empty error_message escape exp extensible find find_any_not_of
155
+ find_any_of find_end floor frac from_mixed group hashed header idx
156
+ include index insert ipow itab key lax lines line_exists line_index
157
+ log log10 loop loop_key match matches me mesh_path namespace nmax
158
+ nmin node numeric numofchar object parameter primary_key read ref
159
+ repeat replace rescale resource_failure reverse root round segment
160
+ sender serialize shift_left shift_right sign simple sin sinh skip
161
+ sorted space sqrt standard strlen substring substring_after
162
+ substring_before substring_from substring_to sum switch switch-var
163
+ system_failure table table_line tan tanh template text to_lower
164
+ to_mixed to_upper transform translate trunc type value variable write
165
+ xsdbool xsequence xstrlen
166
+ )
167
+ end
168
+
169
+ def self.types
170
+ @types = Set.new %w(
171
+ b c d decfloat16 decfloat34 f i int8 n p s t x
172
+ clike csequence decfloat string xstring
173
+ )
174
+ end
175
+
176
+ def self.new_keywords
177
+ @types = Set.new %w(
178
+ DATA FIELD-SYMBOL
179
+ )
180
+ end
181
+
182
+ state :root do
183
+ rule /\s+/m, Text
184
+
185
+ rule /".*/, Comment::Single
186
+ rule %r(^\*.*), Comment::Multiline
187
+ rule /\d+/, Num::Integer
188
+ rule /('|`)/, Str::Single, :single_string
189
+ rule /[\[\]\(\)\{\}\[\]\.,:\|]/, Punctuation
190
+
191
+ # builtins / new ABAP 7.40 keywords (@DATA(), ...)
192
+ rule /(->|=>)?([A-Za-z][A-Za-z0-9_\-]*)(\()/ do |m|
193
+ if m[1] != ''
194
+ token Operator, m[1]
195
+ end
196
+
197
+ if (self.class.new_keywords.include? m[2].upcase) && m[1].nil?
198
+ token Keyword, m[2]
199
+ elsif (self.class.builtins.include? m[2].downcase) && m[1].nil?
200
+ token Name::Builtin, m[2]
201
+ else
202
+ token Name, m[2]
203
+ end
204
+ token Punctuation, m[3]
205
+ end
206
+
207
+ # keywords, types and normal text
208
+ rule /\w[\w\d]*/ do |m|
209
+ if self.class.keywords.include? m[0].upcase
210
+ token Keyword
211
+ elsif self.class.types.include? m[0].downcase
212
+ token Keyword::Type
213
+ else
214
+ token Name
215
+ end
216
+ end
217
+
218
+ # operators
219
+ rule %r((->|->>|=>)), Operator
220
+ rule %r([-\*\+%/~=&\?<>!#@\^]+), Operator
221
+
222
+ end
223
+
224
+ state :operators do
225
+ rule %r((->|->>|=>)), Operator
226
+ rule %r([-\*\+%/~=&\?<>!#@\^]+), Operator
227
+ end
228
+
229
+ state :single_string do
230
+ rule /\\./, Str::Escape
231
+ rule /(''|``)/, Str::Escape
232
+ rule /['`]/, Str::Single, :pop!
233
+ rule /[^\\'`]+/, Str::Single
234
+ end
235
+
236
+ end
237
+ end
238
+ end
@@ -9,7 +9,7 @@ module Rouge
9
9
  tag 'clojure'
10
10
  aliases 'clj', 'cljs'
11
11
 
12
- filenames '*.clj', '*.cljs', '*.cljc'
12
+ filenames '*.clj', '*.cljs', '*.cljc', 'build.boot'
13
13
 
14
14
  mimetypes 'text/x-clojure', 'application/x-clojure'
15
15
 
@@ -73,7 +73,7 @@ module Rouge
73
73
  end
74
74
 
75
75
  state :root do
76
- rule /;.*?\n/, Comment::Single
76
+ rule /;.*?$/, Comment::Single
77
77
  rule /\s+/m, Text::Whitespace
78
78
 
79
79
  rule /-?\d+\.\d+/, Num::Float
@@ -150,6 +150,10 @@ module Rouge
150
150
  rule /"/, Str::Double, :pop!
151
151
  end
152
152
 
153
+ state :escape_sequence do
154
+ rule /\\[\\"'ntbr]/, Str::Escape
155
+ end
156
+
153
157
  state :continue_id do
154
158
  # the stream starts with an id (stored in @name) and continues here
155
159
  rule dot_id do |m|
@@ -15,15 +15,16 @@ module Rouge
15
15
  '*.c++', '*.h++',
16
16
  '*.cc', '*.hh',
17
17
  '*.cxx', '*.hxx',
18
- '*.pde', '*.ino'
18
+ '*.pde', '*.ino',
19
+ '*.tpp'
19
20
  mimetypes 'text/x-c++hdr', 'text/x-c++src'
20
21
 
21
22
  def self.keywords
22
23
  @keywords ||= super + Set.new(%w(
23
- asm catch const_cast delete dynamic_cast explicit export
24
+ asm auto catch const_cast delete dynamic_cast explicit export
24
25
  friend mutable namespace new operator private protected public
25
- reinterpret_cast restrict static_cast template this throw
26
- throws typeid typename using virtual
26
+ reinterpret_cast restrict size_of static_cast template this throw
27
+ throws typeid typename using virtual final override
27
28
 
28
29
  alignas alignof constexpr decltype noexcept static_assert
29
30
  thread_local try
@@ -45,6 +45,11 @@ module Rouge
45
45
  @html ||= HTML.new(options)
46
46
  end
47
47
 
48
+ def ruby!(state)
49
+ ruby.reset!
50
+ push state
51
+ end
52
+
48
53
  def filters
49
54
  @filters ||= {
50
55
  'javascript' => Javascript.new(options),
@@ -104,7 +109,7 @@ module Rouge
104
109
  rule /-/ do
105
110
  token Punctuation
106
111
  reset_stack
107
- push :ruby_line
112
+ ruby! :ruby_line
108
113
  end
109
114
 
110
115
  # filters
@@ -131,8 +136,9 @@ module Rouge
131
136
 
132
137
  state :tag do
133
138
  mixin :css
134
- rule(/\{#{comma_dot}*?\}/) { delegate ruby }
139
+ rule(/[{]/) { token Punctuation; ruby! :ruby_tag }
135
140
  rule(/\[#{dot}*?\]/) { delegate ruby }
141
+
136
142
  rule /\(/, Punctuation, :html_attributes
137
143
  rule /\s*\n/, Text, :pop!
138
144
 
@@ -153,7 +159,7 @@ module Rouge
153
159
  rule /[&!]?[=!]/ do
154
160
  token Punctuation
155
161
  reset_stack
156
- push :ruby_line
162
+ ruby! :ruby_line
157
163
  end
158
164
 
159
165
  rule(//) { push :plain }
@@ -166,6 +172,10 @@ module Rouge
166
172
  rule(/.*?(?=(,$| \|)?[ \t]*$)/) { delegate ruby }
167
173
  end
168
174
 
175
+ state :ruby_tag do
176
+ mixin :ruby_inner
177
+ end
178
+
169
179
  state :html_attributes do
170
180
  rule /\s+/, Text
171
181
  rule /#{identifier}\s*=/, Name::Attribute, :html_attribute_value
@@ -85,7 +85,7 @@ module Rouge
85
85
 
86
86
  state :style_content do
87
87
  rule %r(<\s*/\s*style\s*>)m, Name::Tag, :pop!
88
- rule %r(.*(?=<\s*/\s*style\s*>))m do
88
+ rule %r(.*?(?=<\s*/\s*style\s*>))m do
89
89
  delegate CSS
90
90
  end
91
91
  end
@@ -160,6 +160,11 @@ module Rouge
160
160
  push :expr_start
161
161
  end
162
162
 
163
+ rule /(\@)(\w+)?/ do
164
+ groups Punctuation, Name::Decorator
165
+ push :expr_start
166
+ end
167
+
163
168
  rule /[{}]/, Punctuation, :statement
164
169
 
165
170
  rule id do |m|
@@ -241,7 +246,7 @@ module Rouge
241
246
  state :template_string do
242
247
  rule /\${/, Punctuation, :template_string_expr
243
248
  rule /`/, Str::Double, :pop!
244
- rule /(\\\\|\\[\$`]|[^\$`]|\$[^{])*/, Str::Double
249
+ rule /(\\\\|\\[\$`]|[^\$`]|\$(?!{))*/, Str::Double
245
250
  end
246
251
 
247
252
  state :template_string_expr do
@@ -249,45 +254,5 @@ module Rouge
249
254
  mixin :root
250
255
  end
251
256
  end
252
-
253
- class JSON < RegexLexer
254
- desc "JavaScript Object Notation (json.org)"
255
- tag 'json'
256
- filenames '*.json'
257
- mimetypes 'application/json', 'application/vnd.api+json',
258
- 'application/hal+json'
259
-
260
- # TODO: is this too much of a performance hit? JSON is quite simple,
261
- # so I'd think this wouldn't be too bad, but for large documents this
262
- # could mean doing two full lexes.
263
- def self.analyze_text(text)
264
- return 0.8 if text =~ /\A\s*{/m && text.lexes_cleanly?(self)
265
- end
266
-
267
- state :root do
268
- rule /\s+/m, Text::Whitespace
269
- rule /"/, Str::Double, :string
270
- rule /(?:true|false|null)\b/, Keyword::Constant
271
- rule /[{},:\[\]]/, Punctuation
272
- rule /-?(?:0|[1-9]\d*)\.\d+(?:e[+-]\d+)?/i, Num::Float
273
- rule /-?(?:0|[1-9]\d*)(?:e[+-]\d+)?/i, Num::Integer
274
- end
275
-
276
- state :string do
277
- rule /[^\\"]+/, Str::Double
278
- rule /\\./, Str::Escape
279
- rule /"/, Str::Double, :pop!
280
- end
281
- end
282
-
283
- class JSONDOC < JSON
284
- desc "JavaScript Object Notation with extenstions for documentation"
285
- tag 'json-doc'
286
-
287
- prepend :root do
288
- rule %r(//.*?$), Comment::Single
289
- rule /(\.\.\.)/, Comment::Single
290
- end
291
- end
292
257
  end
293
258
  end
@@ -0,0 +1,28 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ class JSON < RegexLexer
6
+ desc "JavaScript Object Notation (json.org)"
7
+ tag 'json'
8
+ filenames '*.json'
9
+ mimetypes 'application/json', 'application/vnd.api+json',
10
+ 'application/hal+json'
11
+
12
+ state :root do
13
+ rule /\s+/m, Text::Whitespace
14
+ rule /"/, Str::Double, :string
15
+ rule /(?:true|false|null)\b/, Keyword::Constant
16
+ rule /[{},:\[\]]/, Punctuation
17
+ rule /-?(?:0|[1-9]\d*)\.\d+(?:e[+-]\d+)?/i, Num::Float
18
+ rule /-?(?:0|[1-9]\d*)(?:e[+-]\d+)?/i, Num::Integer
19
+ end
20
+
21
+ state :string do
22
+ rule /[^\\"]+/, Str::Double
23
+ rule /\\./, Str::Escape
24
+ rule /"/, Str::Double, :pop!
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,17 @@
1
+ # -*- coding: utf-8 -*- #
2
+
3
+ module Rouge
4
+ module Lexers
5
+ load_lexer 'json.rb'
6
+
7
+ class JSONDOC < JSON
8
+ desc "JavaScript Object Notation with extenstions for documentation"
9
+ tag 'json-doc'
10
+
11
+ prepend :root do
12
+ rule %r(//.*?$), Comment::Single
13
+ rule /(\.\.\.)/, Comment::Single
14
+ end
15
+ end
16
+ end
17
+ end
@@ -66,7 +66,7 @@ module Rouge
66
66
 
67
67
  state :root do
68
68
  rule /#.*?$/, Comment::Single
69
- rule /^=[a-zA-Z0-9]+\s+.*?\n=cut/, Comment::Multiline
69
+ rule /^=[a-zA-Z0-9]+\s+.*?\n=cut/m, Comment::Multiline
70
70
  rule /(?:#{keywords.join('|')})\b/, Keyword
71
71
 
72
72
  rule /(format)(\s+)([a-zA-Z0-9_]+)(\s*)(=)(\s*\n)/ do
@@ -82,6 +82,7 @@ module Rouge
82
82
  Text,
83
83
  Keyword::Namespace
84
84
  end
85
+
85
86
  rule /(import)(\s+)(#{dotted_identifier})/ do
86
87
  groups Keyword::Namespace, Text, Name::Namespace
87
88
  end
@@ -155,24 +156,6 @@ module Rouge
155
156
  mixin :raise
156
157
  end
157
158
 
158
- state :import do
159
- # non-line-terminating whitespace
160
- rule /(?:[ \t]|\\\n)+/, Text
161
-
162
- rule /as\b/, Keyword::Namespace
163
- rule /,/, Operator
164
- rule dotted_identifier, Name::Namespace
165
- rule(//) { pop! } # anything else -> go back
166
- end
167
-
168
- state :fromimport do
169
- # non-line-terminating whitespace
170
- rule /(?:[ \t]|\\\n)+/, Text
171
-
172
- rule /import\b/, Keyword::Namespace, :pop!
173
- rule dotted_identifier, Name::Namespace
174
- end
175
-
176
159
  state :strings do
177
160
  rule /%(\([a-z0-9_]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?/i, Str::Interpol
178
161
  end
@@ -79,7 +79,7 @@ module Rouge
79
79
 
80
80
  state :strings do
81
81
  mixin :symbols
82
- rule /\b[a-z_]\w*?:\s+/, Str::Symbol, :expr_start
82
+ rule /\b[a-z_]\w*?[?!]?:\s+/, Str::Symbol, :expr_start
83
83
  rule /'(\\\\|\\'|[^'])*'/, Str::Single
84
84
  rule /"/, Str::Double, :simple_string
85
85
  rule /(?<!\.)`/, Str::Backtick, :simple_backtick
@@ -86,7 +86,7 @@ module Rouge
86
86
  rule %r([=-]>), Keyword
87
87
  rule %r(<->), Keyword
88
88
  rule /[()\[\]{}|,:;]/, Punctuation
89
- rule /[*!@~&+%^<>=-]/, Operator
89
+ rule /[*!@~&+%^<>=-\?]/, Operator
90
90
 
91
91
  rule /([.]\s*)?#{id}(?=\s*[(])/m, Name::Function
92
92
  rule /[.]\s*#{id}/, Name::Property
@@ -8,14 +8,11 @@ module Rouge
8
8
  tag 'tex'
9
9
  aliases 'TeX', 'LaTeX', 'latex'
10
10
 
11
- filenames '*.tex', '*.aux', '*.toc'
11
+ filenames '*.tex', '*.aux', '*.toc', '*.sty', '*.cls'
12
12
  mimetypes 'text/x-tex', 'text/x-latex'
13
13
 
14
14
  def self.analyze_text(text)
15
- return 1 if text =~ /\A\s*\\documentclass/
16
- return 1 if text =~ /\A\s*\\input/
17
- return 1 if text =~ /\A\s*\\documentstyle/
18
- return 1 if text =~ /\A\s*\\relax/
15
+ return 1 if text =~ /\A\s*\\(documentclass|input|documentstyle|relax|ProvidesPackage|ProvidesClass)/
19
16
  end
20
17
 
21
18
  command = /\\([a-z]+|\s+|.)/i
@@ -63,8 +63,8 @@ module Rouge
63
63
 
64
64
  rule /\s+/, Text::Whitespace
65
65
 
66
- rule /[^:;<>#@"\(\).\[\]\{\} ]+:/, Name::Namespace
67
- rule /[^:;<>#@"\(\).\[\]\{\} ]+/, Name
66
+ rule /[^:;<>#\@"\(\).\[\]\{\} ]+:/, Name::Namespace
67
+ rule /[^:;<>#\@"\(\).\[\]\{\} ]+/, Name
68
68
 
69
69
  end
70
70
  end
@@ -10,9 +10,9 @@ module Rouge
10
10
 
11
11
  tag 'typescript'
12
12
  aliases 'ts'
13
-
13
+
14
14
  filenames '*.ts', '*.d.ts'
15
-
15
+
16
16
  mimetypes 'text/typescript'
17
17
 
18
18
  def self.keywords
@@ -22,7 +22,7 @@ module Rouge
22
22
  super async await extends implements readonly
23
23
  ))
24
24
  end
25
-
25
+
26
26
  def self.declarations
27
27
  @declarations ||= super + Set.new(%w(
28
28
  const type constructor abstract
@@ -32,10 +32,10 @@ module Rouge
32
32
  def self.reserved
33
33
  @reserved ||= super + Set.new(%w(
34
34
  string any number namespace module
35
- declare default interface
35
+ declare default interface
36
36
  ))
37
37
  end
38
-
38
+
39
39
  def self.builtins
40
40
  @builtins ||= super + %w(
41
41
  Promise Set Map WeakSet WeakMap Symbol
@@ -0,0 +1,124 @@
1
+ module Rouge
2
+ module Lexers
3
+ load_lexer 'html.rb'
4
+
5
+ class Vue < HTML
6
+ desc 'Vue.js single-file components'
7
+ tag 'vue'
8
+ aliases 'vuejs'
9
+ filenames '*.vue'
10
+
11
+ mimetypes 'text/x-vue', 'application/x-vue'
12
+
13
+ def initialize(*)
14
+ super
15
+ @js = Javascript.new(options)
16
+ end
17
+
18
+ def self.analyze_text(text)
19
+ return 0
20
+ end
21
+
22
+ def lookup_lang(lang)
23
+ case lang
24
+ when 'html' then HTML
25
+ when 'css' then CSS
26
+ when 'javascript' then Javascript
27
+ when 'sass' then Sass
28
+ when 'scss' then Scss
29
+ when 'coffee' then CoffeeScript
30
+ # TODO: add more when the lexers are done
31
+ else
32
+ PlainText
33
+ end
34
+ end
35
+
36
+ start { @js.reset! }
37
+
38
+ prepend :root do
39
+ rule /(<)(\s*)(template)/ do
40
+ groups Name::Tag, Text, Keyword
41
+ @lang = HTML
42
+ push :template
43
+ push :lang_tag
44
+ end
45
+
46
+ rule /(<)(\s*)(style)/ do
47
+ groups Name::Tag, Text, Keyword
48
+ @lang = CSS
49
+ push :style
50
+ push :lang_tag
51
+ end
52
+
53
+ rule /(<)(\s*)(script)/ do
54
+ groups Name::Tag, Text, Keyword
55
+ @lang = Javascript
56
+ push :script
57
+ push :lang_tag
58
+ end
59
+ end
60
+
61
+ state :style do
62
+ rule /(<\s*\/\s*)(style)(\s*>)/ do
63
+ groups Name::Tag, Keyword, Name::Tag
64
+ pop!
65
+ end
66
+
67
+ mixin :style_content
68
+ mixin :embed
69
+ end
70
+
71
+ state :script do
72
+ rule /(<\s*\/\s*)(script)(\s*>)/ do
73
+ groups Name::Tag, Keyword, Name::Tag
74
+ pop!
75
+ end
76
+
77
+ mixin :script_content
78
+ mixin :embed
79
+ end
80
+
81
+ state :lang_tag do
82
+ rule /(lang\s*=)(\s*)("(?:\\.|[^\\])*?"|'(\\.|[^\\])*?'|[^\s>]+)/ do |m|
83
+ groups Name::Attribute, Text, Str
84
+ @lang = lookup_lang(m[2])
85
+ end
86
+
87
+ mixin :tag
88
+ end
89
+
90
+ state :template do
91
+ rule %r((<\s*/\s*)(template)(\s*>)) do
92
+ groups Name::Tag, Keyword, Name::Tag
93
+ pop!
94
+ end
95
+
96
+ rule /{{/ do
97
+ token Str::Interpol
98
+ push :template_interpol
99
+ @js.reset!
100
+ end
101
+
102
+ mixin :embed
103
+ end
104
+
105
+ state :template_interpol do
106
+ rule /}}/, Str::Interpol, :pop!
107
+ rule /}/, Error
108
+ mixin :template_interpol_inner
109
+ end
110
+
111
+ state :template_interpol_inner do
112
+ rule(/{/) { delegate @js; push }
113
+ rule(/}/) { delegate @js; pop! }
114
+ rule(/[^{}]+/) { delegate @js }
115
+ end
116
+
117
+ state :embed do
118
+ rule(/[^{<]+/) { delegate @lang }
119
+ rule(/[<{][^<{]*/) { delegate @lang }
120
+ end
121
+ end
122
+ end
123
+ end
124
+
@@ -6,7 +6,7 @@ module Rouge
6
6
  title "XML"
7
7
  desc %q(<desc for="this-lexer">XML</desc>)
8
8
  tag 'xml'
9
- filenames *%w(*.xml *.xsl *.rss *.xslt *.xsd *.wsdl)
9
+ filenames *%w(*.xml *.xsl *.rss *.xslt *.xsd *.wsdl *.svg)
10
10
  mimetypes *%w(
11
11
  text/xml
12
12
  application/xml
data/lib/rouge/version.rb CHANGED
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Rouge
4
4
  def self.version
5
- "2.0.6"
5
+ "2.0.7"
6
6
  end
7
7
  end
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.6
4
+ version: 2.0.7
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-09-07 00:00:00.000000000 Z
11
+ date: 2016-11-18 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:
@@ -23,6 +23,7 @@ files:
23
23
  - bin/rougify
24
24
  - lib/rouge.rb
25
25
  - lib/rouge/cli.rb
26
+ - lib/rouge/demos/abap
26
27
  - lib/rouge/demos/actionscript
27
28
  - lib/rouge/demos/apache
28
29
  - lib/rouge/demos/apiblueprint
@@ -132,6 +133,7 @@ files:
132
133
  - lib/rouge/demos/verilog
133
134
  - lib/rouge/demos/vhdl
134
135
  - lib/rouge/demos/viml
136
+ - lib/rouge/demos/vue
135
137
  - lib/rouge/demos/xml
136
138
  - lib/rouge/demos/yaml
137
139
  - lib/rouge/formatter.rb
@@ -150,6 +152,7 @@ files:
150
152
  - lib/rouge/guessers/modeline.rb
151
153
  - lib/rouge/guessers/source.rb
152
154
  - lib/rouge/lexer.rb
155
+ - lib/rouge/lexers/abap.rb
153
156
  - lib/rouge/lexers/actionscript.rb
154
157
  - lib/rouge/lexers/apache.rb
155
158
  - lib/rouge/lexers/apache/keywords.yml
@@ -197,6 +200,8 @@ files:
197
200
  - lib/rouge/lexers/java.rb
198
201
  - lib/rouge/lexers/javascript.rb
199
202
  - lib/rouge/lexers/jinja.rb
203
+ - lib/rouge/lexers/json.rb
204
+ - lib/rouge/lexers/json_doc.rb
200
205
  - lib/rouge/lexers/jsonnet.rb
201
206
  - lib/rouge/lexers/jsx.rb
202
207
  - lib/rouge/lexers/julia.rb
@@ -264,6 +269,7 @@ files:
264
269
  - lib/rouge/lexers/vhdl.rb
265
270
  - lib/rouge/lexers/viml.rb
266
271
  - lib/rouge/lexers/viml/keywords.rb
272
+ - lib/rouge/lexers/vue.rb
267
273
  - lib/rouge/lexers/xml.rb
268
274
  - lib/rouge/lexers/yaml.rb
269
275
  - lib/rouge/plugins/redcarpet.rb