rouge 4.4.0 → 4.5.1

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
  SHA256:
3
- metadata.gz: 0edd954634b90e384ace60c0f23cc8eb60b53eb25600105b2e235e74edf38008
4
- data.tar.gz: 8b3c50c71ca796236f2326a60ff0d84e5b2076fe6314a48c5393d1419e448c9d
3
+ metadata.gz: 4c49b8e02cddb54e0f39aecaad73d5b52d4fb5ff4161b32a80344f5df1a61afa
4
+ data.tar.gz: e9c17a30cd177dab2413546b32c83fbe4b436a0c055d8aa7dbaa48e7b877f579
5
5
  SHA512:
6
- metadata.gz: 671d9550dc89a8aef885d3efe1fd31f1cabeabaff551574f6cf9aac15fae73b03f2483ae3436c267685175500dc728d5dc8326e183d6bca0fa79b4fdf8eb712f
7
- data.tar.gz: 4ee512eb60833a549e3ce3e3234857f4c547b143eb563dce090db626769f99a2386a8dbb06ca4e0fcc54fa8c4d3931fb8c2e904200b408d6b8ad3699da4f841c
6
+ metadata.gz: e0ff902fc5912f3dc69b9526cc5eea412ac417d88ea73fcd65f864280195e8fc8b0d74f5810d661ff3233e8efeecc96ff9fb02235407d78c43d268b1f3907e03
7
+ data.tar.gz: 1a74aa3d80aff64dc748125728b7016fb03886c6be323d76f24ecd1658b04154df5e49d04eeb7d6feafab0ccd416690e402cf1d931e2f621cfa8637d3b9f9c5f
@@ -0,0 +1,103 @@
1
+ *-----------------------
2
+ * This file was sourced from https://github.com/openmainframeproject/cobol-programming-course
3
+ * Credits:
4
+ * The course materials were made available through a joint collaboration between IBM, its clients, and
5
+ * American River College and proposed as a new project by IBM.
6
+ *-----------------------
7
+ * Copyright Contributors to the COBOL Programming Course
8
+ * SPDX-License-Identifier: CC-BY-4.0
9
+ *-----------------------
10
+ IDENTIFICATION DIVISION.
11
+ *-----------------------
12
+ PROGRAM-ID. CBL0001
13
+ AUTHOR. Otto B. Fun.
14
+ *--------------------
15
+ ENVIRONMENT DIVISION.
16
+ *--------------------
17
+ INPUT-OUTPUT SECTION.
18
+ FILE-CONTROL.
19
+ SELECT PRINT-LINE ASSIGN TO PRTLINE.
20
+ SELECT ACCT-REC ASSIGN TO ACCTREC.
21
+ *SELECT clause creates an internal file name
22
+ *ASSIGN clause creates a name for an external data source,
23
+ *which is associated with the JCL DDNAME used by the z/OS
24
+ *e.g. ACCTREC is linked in JCL file CBL0001J to &SYSUID..DATA
25
+ *where &SYSUID. stands for Your z/OS user id
26
+ *e.g. if Your user id is Z54321,
27
+ *the data set used for ACCTREC is Z54321.DATA
28
+ *-------------
29
+ DATA DIVISION.
30
+ *-------------
31
+ FILE SECTION.
32
+ FD PRINT-LINE RECORDING MODE F.
33
+ 01 PRINT-REC.
34
+ 05 ACCT-NO-O PIC X(8).
35
+ 05 ACCT-LIMIT-O PIC $$,$$$,$$9.99.
36
+ 05 ACCT-BALANCE-O PIC $$,$$$,$$9.99.
37
+ * PIC $$,$$$,$$9.99 -- Alternative for PIC on chapter 7.2.3,
38
+ * using $ to allow values of different amounts of digits
39
+ * and .99 instead of v99 to allow period display on output
40
+ 05 LAST-NAME-O PIC X(20).
41
+ 05 FIRST-NAME-O PIC X(15).
42
+ 05 COMMENTS-O PIC X(50).
43
+ * since the level 05 is higher than level 01,
44
+ * all variables belong to PRINT-REC (see chapter 7.3.3)
45
+ *
46
+ FD ACCT-REC RECORDING MODE F.
47
+ 01 ACCT-FIELDS.
48
+ 05 ACCT-NO PIC X(8).
49
+ 05 ACCT-LIMIT PIC S9(7)V99 COMP-3.
50
+ 05 ACCT-BALANCE PIC S9(7)V99 COMP-3.
51
+ * PIC S9(7)v99 -- seven-digit plus a sign digit value
52
+ * COMP-3 -- packed BCD (binary coded decimal) representation
53
+ 05 LAST-NAME PIC X(20).
54
+ 05 FIRST-NAME PIC X(15).
55
+ 05 CLIENT-ADDR.
56
+ 10 STREET-ADDR PIC X(25).
57
+ 10 CITY-COUNTY PIC X(20).
58
+ 10 USA-STATE PIC X(15).
59
+ 05 RESERVED PIC X(7).
60
+ 05 COMMENTS PIC X(50).
61
+ *
62
+ WORKING-STORAGE SECTION.
63
+ 01 FLAGS.
64
+ 05 LASTREC PIC X VALUE SPACE.
65
+ *------------------
66
+ PROCEDURE DIVISION.
67
+ *------------------
68
+ OPEN-FILES.
69
+ OPEN INPUT ACCT-REC.
70
+ OPEN OUTPUT PRINT-LINE.
71
+ *
72
+ READ-NEXT-RECORD.
73
+ PERFORM READ-RECORD
74
+ * The previous statement is needed before entering the loop.
75
+ * Both the loop condition LASTREC = 'Y'
76
+ * and the call to WRITE-RECORD depend on READ-RECORD having
77
+ * been executed before.
78
+ * The loop starts at the next line with PERFORM UNTIL
79
+ PERFORM UNTIL LASTREC = 'Y'
80
+ PERFORM WRITE-RECORD
81
+ PERFORM READ-RECORD
82
+ END-PERFORM
83
+ .
84
+ *
85
+ CLOSE-STOP.
86
+ CLOSE ACCT-REC.
87
+ CLOSE PRINT-LINE.
88
+ GOBACK.
89
+ *
90
+ READ-RECORD.
91
+ READ ACCT-REC
92
+ AT END MOVE 'Y' TO LASTREC
93
+ END-READ.
94
+ *
95
+ WRITE-RECORD.
96
+ MOVE ACCT-NO TO ACCT-NO-O.
97
+ MOVE ACCT-LIMIT TO ACCT-LIMIT-O.
98
+ MOVE ACCT-BALANCE TO ACCT-BALANCE-O.
99
+ MOVE LAST-NAME TO LAST-NAME-O.
100
+ MOVE FIRST-NAME TO FIRST-NAME-O.
101
+ MOVE COMMENTS TO COMMENTS-O.
102
+ WRITE PRINT-REC.
103
+ *
@@ -0,0 +1,12 @@
1
+ {
2
+ // comments
3
+ unquoted: 'and you can quote me on that',
4
+ singleQuotes: 'I can use "double quotes" here',
5
+ lineBreaks: "Look, Mom! \
6
+ No \\n's!",
7
+ hexadecimal: 0xdecaf,
8
+ leadingDecimalPoint: .8675309, andTrailing: 8675309.,
9
+ positiveSign: +1,
10
+ trailingComma: 'in objects', andIn: ['arrays',],
11
+ "backwardsCompatible": "with JSON",
12
+ }
@@ -66,6 +66,12 @@ module Rouge
66
66
  end
67
67
  end
68
68
 
69
+ disambiguate '*.cfg' do
70
+ next CiscoIos if matches?(/\A\s*(version|banner|interface)\b/)
71
+
72
+ INI
73
+ end
74
+
69
75
  disambiguate '*.pl' do
70
76
  next Perl if contains?('my $')
71
77
  next Prolog if contains?(':-')
@@ -0,0 +1,137 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ module Rouge
5
+ module Lexers
6
+ class COBOL < RegexLexer
7
+ title 'COBOL'
8
+ desc 'COBOL (Common Business-Oriented Language) programming language'
9
+ tag 'cobol'
10
+ filenames '*.cob', '*.cbl'
11
+ mimetypes 'text/x-cobol'
12
+
13
+ identifier = /\p{Alpha}[\p{Alnum}-]*/
14
+
15
+ def self.divisions
16
+ @divisions ||= %w(
17
+ IDENTIFICATION ENVIRONMENT DATA PROCEDURE DIVISION
18
+ )
19
+ end
20
+
21
+ def self.sections
22
+ @sections ||= %w(
23
+ CONFIGURATION INPUT-OUTPUT FILE WORKING-STORAGE LOCAL-STORAGE LINKAGE SECTION
24
+ )
25
+ end
26
+
27
+ # List of COBOL keywords
28
+ # sourced from https://www.ibm.com/docs/en/cobol-zos/6.4?topic=appendixes-reserved-words
29
+ def self.keywords
30
+ @keywords ||= Set.new(%w(
31
+ ACCEPT ACCESS ACTIVE-CLASS ADD ADDRESS ADVANCING AFTER ALIGNED ALL ALLOCATE ALPHABET ALPHABETIC ALPHABETIC-LOWER
32
+ ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED ALSO ALTER ALTERNATE AND ANYCASE ANY APPLY ARE AREA AREAS
33
+ ASCENDING ASSIGN AT AUTHOR B-AND B-NOT B-OR B-XOR BASED BASIS BEFORE BEGINNING BINARY BINARY-CHAR BINARY-DOUBLE
34
+ BINARY-LONG BINARY-SHORT BIT BLANK BLOCK BOOLEAN BOTTOM BY BYTE-LENGTH CALL CANCEL CBL CD CF CH CHARACTER
35
+ CHARACTERS CLASS CLASS-ID CLOCK-UNITS CLOSE COBOL CODE CODE-SET COL COLLATING COLS COLUMN COLUMNS COM-REG COMMA
36
+ COMMON COMMUNICATION COMP-1 COMP-2 COMP-3 COMP-4 COMP-5 COMP COMPUTATIONAL-1 COMPUTATIONAL-2
37
+ COMPUTATIONAL-3 COMPUTATIONAL-4 COMPUTATIONAL-5 COMPUTATIONAL COMPUTE CONDITION CONSTANT CONTAINS CONTENT
38
+ CONTINUE CONTROL CONTROLS CONVERTING COPY CORR CORRESPONDING COUNT CRT CURRENCY CURSOR DATA-POINTER DATE
39
+ DATE-COMPILED DATE-WRITTEN DAY DAY-OF-WEEK DBCS DE DEBUG-CONTENTS DEBUG-ITEM DEBUG-LINE DEBUG-NAME DEBUG-SUB-1
40
+ DEBUG-SUB-2 DEBUG-SUB-3 DEBUGGING DECIMAL-POINT DECLARATIVES DEFAULT DELETE DELIMITED DELIMITER DEPENDING
41
+ DESCENDING DESTINATION DETAIL DISABLE DISPLAY-1 DISPLAY DIVIDE DOWN DUPLICATES DYNAMIC EC EGCS EGI
42
+ EJECT ELSE EMI ENABLE END-ACCEPT END-ADD END-CALL END-COMPUTE END-DELETE END-DISPLAY END-DIVIDE END-EVALUATE
43
+ END-EXEC END-IF END-INVOKE END-JSON END-MULTIPLY END-OF-PAGE END-PERFORM END-READ END-RECEIVE END-RETURN
44
+ END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT END-UNSTRING END-WRITE END-XML ENDING END ENTER ENTRY
45
+ EO EOP EQUAL ERROR ESI EVALUATE EVERY EXCEPTION EXCEPTION-OBJECT EXEC EXECUTE EXIT EXTEND EXTERNAL
46
+ FACTORY FALSE FD FILE-CONTROL FILLER FINAL FIRST FLOAT-EXTENDED FLOAT-LONG FLOAT-SHORT FOOTING FOR FORMAT
47
+ FREE FROM FUNCTION FUNCTION-ID FUNCTION-POINTER GENERATE GET GIVING GLOBAL GO GOBACK GREATER GROUP GROUP-USAGE
48
+ HEADING HIGH-VALUE HIGH-VALUES I-O-CONTROL I-O ID IF IN INDEX INDEXED INDICATE INHERITS INITIAL
49
+ INITIALIZE INITIATE INPUT INSERT INSPECT INSTALLATION INTERFACE INTERFACE-ID INTO INVALID INVOKE
50
+ IS JAVA JNIENVPTR JSON JSON-CODE JSON-STATUS JUST JUSTIFIED KANJI KEY LABEL LAST LEADING LEFT LENGTH LESS LIMIT
51
+ LIMITS LINAGE-COUNTER LINAGE LINE-COUNTER LINES LINE LOCALE LOCK LOW-VALUE LOW-VALUES
52
+ MEMORY MERGE MESSAGE METHOD METHOD-ID MINUS MODE MODULES MORE-LABELS MOVE MULTIPLE MULTIPLY NATIONAL
53
+ NATIONAL-EDITED NATIVE NEGATIVE NESTED NEXT NO NOT NULL NULLS NUMBER NUMERIC NUMERIC-EDITED OBJECT
54
+ OBJECT-COMPUTER OBJECT-REFERENCE OCCURS OF OFF OMITTED ON OPEN OPTIONAL OPTIONS OR ORDER ORGANIZATION
55
+ OTHER OUTPUT OVERFLOW OVERRIDE PACKED-DECIMAL PADDING PAGE PAGE-COUNTER PASSWORD PERFORM PF PH PIC PICTURE
56
+ PLUS POINTER- POINTER-31 POINTER-32 POINTER-64 POINTER POSITION POSITIVE PRESENT PRINTING
57
+ PROCEDURE-POINTER PROCEDURES PROCEED PROCESSING PROGRAM-ID PROGRAM-POINTER PROGRAM PROPERTY PROTOTYPE
58
+ PURGE QUEUE QUOTE QUOTES RAISE RAISING RANDOM RD READ READY RECEIVE RECORD RECORDING RECORDS RECURSIVE REDEFINES
59
+ REEL REFERENCE REFERENCES RELATIVE RELEASE RELOAD REMAINDER REMOVAL RENAMES REPLACE REPLACING REPORT REPORTING
60
+ REPORTS REPOSITORY RERUN RESERVE RESET RESUME RETRY RETURN RETURN-CODE RETURNING REVERSED REWIND REWRITE RF RH
61
+ RIGHT ROUNDED RUN SAME SCREEN SD SEARCH SECTION SECURITY SEGMENT SEGMENT-LIMIT SELECT SELF SEND SENTENCE
62
+ SEPARATE SEQUENCE SEQUENTIAL SERVICE SET SHARING SHIFT-IN SHIFT-OUT SIGN SIZE SKIP1 SKIP2 SKIP3
63
+ SORT-CONTROL SORT-CORE-SIZE SORT-FILE-SIZE SORT-MERGE SORT-MESSAGE SORT-MODE-SIZE SORT-RETURN SORT
64
+ SOURCE-COMPUTER SOURCES SOURCE SPACE SPACES SPECIAL-NAMES SQL SQLIMS STANDARD-1 STANDARD-2 STANDARD START STATUS STOP
65
+ STRING SUB-QUEUE-1 SUB-QUEUE-2 SUB-QUEUE-3 SUBTRACT SUM SUPER SUPPRESS SYMBOLIC SYNC SYNCHRONIZED SYSTEM-DEFAULT
66
+ TABLE TALLY TALLYING TAPE TERMINAL TERMINATE TEST TEXT THAN THEN THROUGH THRU TIME TIMES TITLE TO TOP TRACE
67
+ TRAILING TRUE TYPE TYPEDEF UNIT UNIVERSAL UNLOCK UNSTRING UNTIL UP UPON USAGE USE USER-DEFAULT USING UTF-8
68
+ VAL-STATUS VALID VALIDATE VALIDATE-STATUS VALUE VALUES VARYING VOLATILE WHEN WHEN-COMPILED WITH WORDS
69
+ WRITE WRITE-ONLY XML-CODE XML-EVENT XML-INFORMATION XML-NAMESPACE XML-NAMESPACE-PREFIX
70
+ XML-NNAMESPACE XML-NNAMESPACE-PREFIX XML-NTEXT XML-SCHEMA XML-TEXT XML ZERO ZEROES ZEROS
71
+ ))
72
+ end
73
+
74
+ state :root do
75
+ # First detect the comments
76
+ rule %r/^( \*).*|^(^Debug \*).*/, Comment::Special
77
+
78
+ # Strings
79
+ rule %r/"/, Str::Double, :string_double
80
+ rule %r/'/, Str::Single, :string_single
81
+
82
+ # Keywords and divisions
83
+ rule %r/(?<![\w-])#{identifier}(?![\w-])/i do |m|
84
+ if self.class.divisions.include?(m[0].upcase)
85
+ token Keyword::Declaration
86
+ elsif self.class.sections.include?(m[0].upcase)
87
+ token Keyword::Namespace
88
+ elsif self.class.keywords.include?(m[0].upcase)
89
+ token Keyword
90
+ else
91
+ token Name
92
+ end
93
+ end
94
+
95
+ # Numbers
96
+ rule %r/[-+]?\b\d+(\.\d+)?\b/, Num
97
+
98
+ # Punctuation
99
+ rule %r/[.,;:()]/, Punctuation
100
+
101
+ # Comments
102
+ rule %r/\*>.*/, Comment::Single
103
+
104
+ # Operators
105
+ rule %r/[+\-*\/><=]/, Operator
106
+
107
+ # Whitespace remaining
108
+ rule %r/\s/, Text::Whitespace
109
+
110
+ # Anything else remaining
111
+ rule %r/.+/, Text
112
+ end
113
+
114
+ # TODO double check string escaping in COBOL
115
+ # TODO Fix that a string opened by " can't be closed by '
116
+ # TODO Fix that strings can't be multi-line
117
+
118
+ # Handle strings where " opens a string and must be closed by "
119
+ state :string_double do
120
+ # Ensure strings can't span multiple lines
121
+ rule %r/[^"\\\n]+/, Str
122
+ rule %r/\\./, Str::Escape
123
+ rule %r/"/, Str::Double, :pop!
124
+ rule %r/\n/, Error # Flag an error if a string goes to the next line
125
+ end
126
+
127
+ # Handle strings where ' opens a string and must be closed by '
128
+ state :string_single do
129
+ # Ensure strings can't span multiple lines
130
+ rule %r/[^'\\\n]+/, Str
131
+ rule %r/\\./, Str::Escape
132
+ rule %r/'/, Str::Single, :pop!
133
+ rule %r/\n/, Error # Flag an error if a string goes to the next line
134
+ end
135
+ end
136
+ end
137
+ end
@@ -7,11 +7,13 @@ module Rouge
7
7
  title "Groovy"
8
8
  desc 'The Groovy programming language (http://www.groovy-lang.org/)'
9
9
  tag 'groovy'
10
- filenames '*.groovy', 'Jenkinsfile', '*.Jenkinsfile'
10
+ aliases 'nextflow', 'nf'
11
+ filenames '*.groovy', 'Jenkinsfile', '*.Jenkinsfile', '*.nf'
11
12
  mimetypes 'text/x-groovy'
12
13
 
13
14
  def self.detect?(text)
14
15
  return true if text.shebang?(/groovy/)
16
+ return true if text.shebang?(/nextflow/)
15
17
  end
16
18
 
17
19
  def self.keywords
@@ -8,9 +8,8 @@ module Rouge
8
8
  desc 'the INI configuration format'
9
9
  tag 'ini'
10
10
 
11
- # TODO add more here
12
- filenames '*.ini', '*.INI', '*.gitconfig'
13
- mimetypes 'text/x-ini'
11
+ filenames '*.ini', '*.INI', '*.gitconfig', '*.cfg', '.editorconfig', '*.inf'
12
+ mimetypes 'text/x-ini', 'text/inf'
14
13
 
15
14
  identifier = /[\w\-.]+/
16
15
 
@@ -190,8 +190,8 @@ module Rouge
190
190
 
191
191
  rule %r/function(?=(\(.*\)))/, Keyword::Declaration # For anonymous functions
192
192
 
193
- rule %r/(#{id})[ \t]*(?=(\(.*\)))/m do |m|
194
- if self.class.keywords.include? m[1]
193
+ rule %r/(#?#{id})[ \t]*(?=(\(.*\)))/m do |m|
194
+ if self.class.keywords.include?(m[1])
195
195
  # "if" in "if (...)" or "switch" in "switch (...)" are recognized as keywords.
196
196
  token Keyword
197
197
  else
@@ -201,7 +201,7 @@ module Rouge
201
201
 
202
202
  rule %r/[{}]/, Punctuation, :statement
203
203
 
204
- rule id do |m|
204
+ rule %r/#?#{id}/ do |m|
205
205
  if self.class.keywords.include? m[0]
206
206
  token Keyword
207
207
  push :expr_start
@@ -0,0 +1,74 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ module Rouge
5
+ module Lexers
6
+ load_lexer 'json.rb'
7
+
8
+ class JSON5 < JSON
9
+ title 'JSON 5'
10
+ tag 'json5'
11
+ filenames '*.json5'
12
+ mimetypes 'application/json5', 'application/x-json5'
13
+
14
+ desc 'JSON 5 extension for JSON (json5.org)'
15
+
16
+ append :whitespace do
17
+ rule %r://.*$:, Comment
18
+
19
+ # comments are non-nesting, so a single regex will do
20
+ rule %r:/[*].*?[*]/:m, Comment
21
+ end
22
+
23
+ prepend :name do
24
+ rule Javascript.id_regex, Name::Label
25
+ rule %r/".*?"/, Name::Label
26
+ end
27
+
28
+ # comments can appear between keys and :, so we have to
29
+ # manage our states a little more carefully
30
+ append :object do
31
+ rule %r/:/ do
32
+ token Punctuation
33
+ goto :object_value
34
+ end
35
+ end
36
+
37
+ state :object_value do
38
+ mixin :value
39
+ rule %r/,/ do
40
+ token Punctuation
41
+ goto :object
42
+ end
43
+
44
+ rule %r/}/, Punctuation, :pop!
45
+ end
46
+
47
+ append :value do
48
+ rule %r/'/, Str::Single, :sstring
49
+ end
50
+
51
+ state :sstring do
52
+ rule %r/[^\\']+/, Str::Single
53
+ rule %r/\\./m, Str::Escape
54
+ rule %r/'/, Str::Single, :pop!
55
+ end
56
+
57
+ # can escape newlines
58
+ append :string do
59
+ rule %r/\\./m, Str::Escape
60
+ end
61
+
62
+ # override: numbers are very different in json5
63
+ state :constants do
64
+ rule %r/\b(?:true|false|null)\b/, Keyword::Constant
65
+ rule %r/[+-]?\b(?:Infinity|NaN)\b/, Keyword::Constant
66
+ rule %r/[+-]?0x\h+/i, Num::Hex
67
+
68
+ rule %r/[+-.]?[0-9]+[.]?[0-9]?([eE][-]?[0-9]+)?/i, Num::Float
69
+ rule %r/[+-]?\d+e[+-]?\d+/, Num::Integer
70
+ rule %r/[+-]?(?:0|[1-9]\d*)(?:e[+-]?\d+)?/i, Num::Integer
71
+ end
72
+ end
73
+ end
74
+ end
@@ -11,7 +11,7 @@ module Rouge
11
11
  filenames '*.rb', '*.ruby', '*.rbw', '*.rake', '*.gemspec', '*.podspec',
12
12
  'Rakefile', 'Guardfile', 'Gemfile', 'Capfile', 'Podfile',
13
13
  'Vagrantfile', '*.ru', '*.prawn', 'Berksfile', '*.arb',
14
- 'Dangerfile', 'Fastfile', 'Deliverfile', 'Appfile'
14
+ 'Dangerfile', 'Fastfile', 'Deliverfile', 'Appfile', '*.thor', 'Thorfile'
15
15
 
16
16
  mimetypes 'text/x-ruby', 'application/x-ruby'
17
17
 
@@ -39,8 +39,9 @@ module Rouge
39
39
 
40
40
  state :strings do
41
41
  rule %r/\\./, Str::Escape
42
+ rule %r/(\$[\$]+|%[%]+)(\{)/, Str
42
43
  rule %r/\$\{/ do
43
- token Keyword
44
+ token Punctuation
44
45
  push :interpolation
45
46
  end
46
47
  end
@@ -66,7 +67,7 @@ module Rouge
66
67
 
67
68
  state :interpolation do
68
69
  rule %r/\}/ do
69
- token Keyword
70
+ token Punctuation
70
71
  pop!
71
72
  end
72
73
 
@@ -166,6 +166,19 @@ module Rouge
166
166
  puts " yielding: #{tok.qualname}, #{stream[0].inspect}" if @debug
167
167
  @output_stream.call(tok, stream[0])
168
168
  end
169
+ when Array
170
+ proc do |stream|
171
+ puts " yielding: #{tok.qualname}, #{stream[0].inspect}" if @debug
172
+ @output_stream.call(tok, stream[0])
173
+ for i_next_state in next_state do
174
+ next @stack.pop if i_next_state == :pop!
175
+ next @stack.push(@stack.last) if i_next_state == :push
176
+
177
+ state = @states[i_next_state] || self.class.get_state(i_next_state)
178
+ puts " pushing :#{state.name}" if @debug
179
+ @stack.push(state)
180
+ end
181
+ end
169
182
  else
170
183
  raise "invalid next state: #{next_state.inspect}"
171
184
  end
data/lib/rouge/version.rb CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  module Rouge
5
5
  def self.version
6
- "4.4.0"
6
+ "4.5.1"
7
7
  end
8
8
  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: 4.4.0
4
+ version: 4.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeanine Adkisson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-09-17 00:00:00.000000000 Z
11
+ date: 2024-11-11 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:
@@ -49,6 +49,7 @@ files:
49
49
  - lib/rouge/demos/clojure
50
50
  - lib/rouge/demos/cmake
51
51
  - lib/rouge/demos/cmhg
52
+ - lib/rouge/demos/cobol
52
53
  - lib/rouge/demos/codeowners
53
54
  - lib/rouge/demos/coffeescript
54
55
  - lib/rouge/demos/common_lisp
@@ -125,6 +126,7 @@ files:
125
126
  - lib/rouge/demos/jsl
126
127
  - lib/rouge/demos/json
127
128
  - lib/rouge/demos/json-doc
129
+ - lib/rouge/demos/json5
128
130
  - lib/rouge/demos/jsonnet
129
131
  - lib/rouge/demos/jsp
130
132
  - lib/rouge/demos/jsx
@@ -295,6 +297,7 @@ files:
295
297
  - lib/rouge/lexers/clojure.rb
296
298
  - lib/rouge/lexers/cmake.rb
297
299
  - lib/rouge/lexers/cmhg.rb
300
+ - lib/rouge/lexers/cobol.rb
298
301
  - lib/rouge/lexers/codeowners.rb
299
302
  - lib/rouge/lexers/coffeescript.rb
300
303
  - lib/rouge/lexers/common_lisp.rb
@@ -371,6 +374,7 @@ files:
371
374
  - lib/rouge/lexers/jinja.rb
372
375
  - lib/rouge/lexers/jsl.rb
373
376
  - lib/rouge/lexers/json.rb
377
+ - lib/rouge/lexers/json5.rb
374
378
  - lib/rouge/lexers/json_doc.rb
375
379
  - lib/rouge/lexers/jsonnet.rb
376
380
  - lib/rouge/lexers/jsp.rb
@@ -553,7 +557,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
553
557
  - !ruby/object:Gem::Version
554
558
  version: '0'
555
559
  requirements: []
556
- rubygems_version: 3.5.3
560
+ rubygems_version: 3.5.19
557
561
  signing_key:
558
562
  specification_version: 4
559
563
  summary: A pure-ruby colorizer based on pygments