diff -Nru ruby-rouge-3.19.0/CHANGELOG.md ruby-rouge-3.21.0/CHANGELOG.md --- ruby-rouge-3.19.0/CHANGELOG.md 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/CHANGELOG.md 2020-07-14 19:56:23.000000000 +0000 @@ -4,6 +4,83 @@ Rouge follows [Semantic Versioning 2.0.0](https://semver.org/spec/v2.0.0.html). +## version 3.21.0: 2020-07-15 + +[Comparison with the previous version](https://github.com/rouge-ruby/rouge/compare/v3.20.0...v3.21.0) + +- General + - Improve support for Unicode identifiers in various lexers ([#1537](https://github.com/rouge-ruby/rouge/pull/1537/) by Benjamin Galliot) + - Fix YARD error when parsing LiveScript lexer ([#1541](https://github.com/rouge-ruby/rouge/pull/1541/) by Michael Camilleri) +- Batchfile Lexer + - Allow @ before REM in Batchfile lexer ([#1545](https://github.com/rouge-ruby/rouge/pull/1545/) by Konrad Borowski) +- BrightScript Lexer (**NEW**) + - Add BrightScript lexer ([#1544](https://github.com/rouge-ruby/rouge/pull/1544/) by domRowan) +- C++ Lexer + - Support template parameter packs in C++ lexer ([#1555](https://github.com/rouge-ruby/rouge/pull/1555/) by Michael Camilleri) +- Docker Lexer + - Remove docker_ file glob from Docker lexer ([#1550](https://github.com/rouge-ruby/rouge/pull/1550/) by Michael Camilleri) +- Janet Lexer (**NEW**) + - Add Janet lexer ([#1558](https://github.com/rouge-ruby/rouge/pull/1558/) by sogaiu) +- Jinja Lexer + - Fix nesting of raw and verbatim tags in Jinja/Twig lexers ([#1552](https://github.com/rouge-ruby/rouge/pull/1552/) by Michael Camilleri) +- Perl Lexer + - Support fat comma in Perl lexer ([#1553](https://github.com/rouge-ruby/rouge/pull/1553/) by Michael Camilleri) + - Fix character escaping in Perl lexer ([#1549](https://github.com/rouge-ruby/rouge/pull/1549/) by Michael Camilleri) +- PowerShell Lexer + - Support ? in PowerShell lexer ([#1559](https://github.com/rouge-ruby/rouge/pull/1559/) by Michael Camilleri) + - Support using grave character to escape characters in PowerShell lexer ([#1551](https://github.com/rouge-ruby/rouge/pull/1551/) by Michael Camilleri) +- Rego Lexer + - Fix identifier matching in Rego lexer ([#1556](https://github.com/rouge-ruby/rouge/pull/1556/) by Michael Camilleri) +- Sass Lexer + - Fix & selector matching in Sass/SCSS lexer ([#1554](https://github.com/rouge-ruby/rouge/pull/1554/) by Michael Camilleri) +- SCSS Lexer + - Fix & selector matching in Sass/SCSS lexer ([#1554](https://github.com/rouge-ruby/rouge/pull/1554/) by Michael Camilleri) +- SSH Config Lexer + - Add SSH config lexer ([#1543](https://github.com/rouge-ruby/rouge/pull/1543/) by Chris Buckley) +- Twig Lexer + - Fix nesting of raw and verbatim tags in Jinja/Twig lexers ([#1552](https://github.com/rouge-ruby/rouge/pull/1552/) by Michael Camilleri) + +## version 3.20.0: 2020-06-10 + +[Comparison with the previous version](https://github.com/rouge-ruby/rouge/compare/v3.19.0...v3.20.0) + +- Augeas Lexer (**NEW**) + - Add Augeas lexer ([#1521](https://github.com/rouge-ruby/rouge/pull/1521/) by Raphaël Pinson) +- BibTeX Lexer (**NEW**) + - Add BibTeX lexer ([#1360](https://github.com/rouge-ruby/rouge/pull/1360/) by alexlihengwang) +- C++ Lexer + - Support scope resolution operator in C++ lexer ([#1523](https://github.com/rouge-ruby/rouge/pull/1523/) by Michael Camilleri) +- Diff Lexer + - Fix erroneous detection in Diff lexer ([#1532](https://github.com/rouge-ruby/rouge/pull/1532/) by Catalin) +- Haskell Lexer + - Improve support for single quotes in Haskell lexer ([#1524](https://github.com/rouge-ruby/rouge/pull/1524/) by Michael Camilleri) +- HLSL Lexer (**NEW**) + - Add HLSL lexer ([#1520](https://github.com/rouge-ruby/rouge/pull/1520/) by Mitch McClellan) +- HTML Lexer + - Add `*.cshtml` file glob to HTML lexer ([#1522](https://github.com/rouge-ruby/rouge/pull/1522/) by Michael Camilleri) +- JavaScript Lexer + - Fix erroneous brace matching rule in JavaScript lexer ([#1526](https://github.com/rouge-ruby/rouge/pull/1526/) by Michael Camilleri) +- JSX Lexer + - Simplify JSX and TSX lexers ([#1492](https://github.com/rouge-ruby/rouge/pull/1492/) by Michael Camilleri) +- LiveScript Lexer (**NEW**) + - Add LiveScript lexer ([#650](https://github.com/rouge-ruby/rouge/pull/650/) by FuriousBoar) +- OpenType Feature File Lexer + - Add new keywords to and fix bugs in OpenType feature file lexer ([#1519](https://github.com/rouge-ruby/rouge/pull/1519/) by Zachary Quinn Scheuren) +- PowerShell Lexer + - Fix incorrect predicate usage in PowerShell lexer ([#1536](https://github.com/rouge-ruby/rouge/pull/1536/) by Michael Camilleri) +- TSX Lexer + - Permit use of trailing comma in generics in TSX lexer ([#1528](https://github.com/rouge-ruby/rouge/pull/1528/) by Michael Camilleri) + - Simplify JSX and TSX lexers ([#1492](https://github.com/rouge-ruby/rouge/pull/1492/) by Michael Camilleri) + - Change the way common methods are mixed in to TypeScript-based lexers ([#1527](https://github.com/rouge-ruby/rouge/pull/1527/) by Michael Camilleri) +- TypeScript Lexer + - Support nullish coalescing operator in TypeScript lexer ([#1529](https://github.com/rouge-ruby/rouge/pull/1529/) by Michael Camilleri) + - Move rules from TypeScript lexer to TypeScript common module ([#1530](https://github.com/rouge-ruby/rouge/pull/1530/) by Michael Camilleri) + - Change the way common methods are mixed in to TypeScript-based lexers ([#1527](https://github.com/rouge-ruby/rouge/pull/1527/) by Michael Camilleri) +- Velocity Lexer (**NEW**) + - Add Velocity lexer ([#1518](https://github.com/rouge-ruby/rouge/pull/1518/) by Michael Camilleri) +- Zig Lexer (**NEW**) + - Add Zig lexer ([#1533](https://github.com/rouge-ruby/rouge/pull/1533/) by Timmy Jose) + ## version 3.19.0: 2020-05-13 [Comparison with the previous version](https://github.com/rouge-ruby/rouge/compare/v3.18.0...v3.19.0) diff -Nru ruby-rouge-3.19.0/debian/changelog ruby-rouge-3.21.0/debian/changelog --- ruby-rouge-3.19.0/debian/changelog 2020-05-23 09:25:29.000000000 +0000 +++ ruby-rouge-3.21.0/debian/changelog 2020-07-22 10:17:01.000000000 +0000 @@ -1,9 +1,22 @@ +ruby-rouge (3.21.0-1) unstable; urgency=medium + + * Team upload + + [ Debian Janitor ] + * Trim trailing whitespace. + + [ Cédric Boutillier ] + * New upstream version 3.21.0 + * Refresh packaging + + -- Cédric Boutillier Wed, 22 Jul 2020 12:17:01 +0200 + ruby-rouge (3.19.0-1) unstable; urgency=medium * Team upload * New upstream version 3.19.0 * Refresh patches - + -- Pirate Praveen Sat, 23 May 2020 14:55:29 +0530 ruby-rouge (3.18.0-1) unstable; urgency=medium diff -Nru ruby-rouge-3.19.0/debian/control ruby-rouge-3.21.0/debian/control --- ruby-rouge-3.19.0/debian/control 2020-05-23 09:25:29.000000000 +0000 +++ ruby-rouge-3.21.0/debian/control 2020-07-22 10:17:01.000000000 +0000 @@ -1,11 +1,11 @@ Source: ruby-rouge Section: ruby Priority: optional -Maintainer: Debian Ruby Extras Maintainers +Maintainer: Debian Ruby Team Uploaders: Youhei SASAKI , Daniel Leidert -Build-Depends: debhelper-compat (= 12), - gem2deb, +Build-Depends: debhelper-compat (= 13), + gem2deb (>= 1), ruby-bundler, ruby-minitest-power-assert, ruby-sinatra @@ -20,8 +20,7 @@ Package: ruby-rouge Architecture: all XB-Ruby-Versions: ${ruby:Versions} -Depends: ruby, - ${misc:Depends}, +Depends: ${misc:Depends}, ${ruby:Depends}, ${shlibs:Depends} Description: pure-Ruby syntax highlighter compatible with pygments diff -Nru ruby-rouge-3.19.0/debian/ruby-rouge.docs ruby-rouge-3.21.0/debian/ruby-rouge.docs --- ruby-rouge-3.19.0/debian/ruby-rouge.docs 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/debian/ruby-rouge.docs 2020-07-22 10:17:01.000000000 +0000 @@ -0,0 +1 @@ +README.md diff -Nru ruby-rouge-3.19.0/debian/rules ruby-rouge-3.21.0/debian/rules --- ruby-rouge-3.19.0/debian/rules 2020-05-23 09:25:29.000000000 +0000 +++ ruby-rouge-3.21.0/debian/rules 2020-07-22 10:17:01.000000000 +0000 @@ -1,17 +1,5 @@ #!/usr/bin/make -f -#export DH_VERBOSE=1 -# -# Uncomment to ignore all test failures (but the tests will run anyway) -#export DH_RUBY_IGNORE_TESTS=all -# -# Uncomment to ignore some test failures (but the tests will run anyway). -# Valid values: -#export DH_RUBY_IGNORE_TESTS=ruby2.1 ruby2.2 -# -# If you need to specify the .gemspec (eg there is more than one) -#export DH_RUBY_GEMSPEC=gem.gemspec -# -# Uncomment to check dependencies during build: + export GEM2DEB_TEST_RUNNER = --check-dependencies %: diff -Nru ruby-rouge-3.19.0/lib/rouge/demos/augeas ruby-rouge-3.21.0/lib/rouge/demos/augeas --- ruby-rouge-3.19.0/lib/rouge/demos/augeas 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/demos/augeas 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,16 @@ +(* + This is a comment +*) +module Foo = +autoload xfm + +let a = b | c . d + +let lns = a* + +let filter = incl "/path/to/file" + . incl "/path/to/other_file" + . Util.stdexcl + +(* xmf is the transform *) +let xmf = transform lns filter diff -Nru ruby-rouge-3.19.0/lib/rouge/demos/bibtex ruby-rouge-3.21.0/lib/rouge/demos/bibtex --- ruby-rouge-3.19.0/lib/rouge/demos/bibtex 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/demos/bibtex 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,12 @@ +@article{Witten:1988hf, + author = "Witten, Edward", + title = "{Quantum Field Theory and the Jones Polynomial}", + journal = "Commun. Math. Phys.", + volume = "121", + year = "1989", + pages = "351-399", + doi = "10.1007/BF01217730", + note = "[,233(1988)]", + reportNumber = "IASSNS-HEP-88-33", + SLACcitation = "%%CITATION = CMPHA,121,351;%%" +} diff -Nru ruby-rouge-3.19.0/lib/rouge/demos/brightscript ruby-rouge-3.21.0/lib/rouge/demos/brightscript --- ruby-rouge-3.19.0/lib/rouge/demos/brightscript 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/demos/brightscript 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,6 @@ +function main(args as dynamic) as void + screen = CreateObject("roSGScreen") + 'Create a scene and load /components/helloworld.xml' + scene = screen.CreateScene("HelloWorld") + screen.show() +end function \ No newline at end of file diff -Nru ruby-rouge-3.19.0/lib/rouge/demos/hlsl ruby-rouge-3.21.0/lib/rouge/demos/hlsl --- ruby-rouge-3.19.0/lib/rouge/demos/hlsl 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/demos/hlsl 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,20 @@ +struct PSInput +{ + float4 position : SV_POSITION; + float4 color : COLOR; +}; + +// Vertex shader +PSInput VSMain(float4 position : POSITION, float4 color : COLOR) +{ + PSInput result; + result.position = position; + result.color = color; + return result; +} + +// Pixel shader +float4 PSMain(PSInput input) : SV_TARGET +{ + return input.color; +} diff -Nru ruby-rouge-3.19.0/lib/rouge/demos/janet ruby-rouge-3.21.0/lib/rouge/demos/janet --- ruby-rouge-3.19.0/lib/rouge/demos/janet 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/demos/janet 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,3 @@ +(defn a-fun + "A function" + (do-something)) diff -Nru ruby-rouge-3.19.0/lib/rouge/demos/livescript ruby-rouge-3.21.0/lib/rouge/demos/livescript --- ruby-rouge-3.19.0/lib/rouge/demos/livescript 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/demos/livescript 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,15 @@ +mitch = + age: 21 + height: 180cm + pets: [\dog, \goldfish] + +phile = {} +phile{height, pets} = mitch +phile.height #=> 180 +phile.pets #=> ['dog', 'goldfish'] + +a = [2 7 1 8] + ..push 3 + ..shift! + ..sort! +a #=> [1,3,7,8] diff -Nru ruby-rouge-3.19.0/lib/rouge/demos/ssh ruby-rouge-3.21.0/lib/rouge/demos/ssh --- ruby-rouge-3.19.0/lib/rouge/demos/ssh 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/demos/ssh 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,4 @@ +Host example + Hostname example.com + User user + Port 1234 diff -Nru ruby-rouge-3.19.0/lib/rouge/demos/velocity ruby-rouge-3.21.0/lib/rouge/demos/velocity --- ruby-rouge-3.19.0/lib/rouge/demos/velocity 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/demos/velocity 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,9 @@ +#* + There is multi-line comment. + see this text because the Velocity Templating Engine will ignore it. +*# +

List

+## This is a single line comment. +#if( $allProducts ) +

not found.

+#end diff -Nru ruby-rouge-3.19.0/lib/rouge/demos/zig ruby-rouge-3.21.0/lib/rouge/demos/zig --- ruby-rouge-3.19.0/lib/rouge/demos/zig 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/demos/zig 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,6 @@ +const std = @import("std"); +const warn = std.debug.warn; + +fn add_floats(x: f16, y: f16) f16 { + return x + y; +} diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/augeas.rb ruby-rouge-3.21.0/lib/rouge/lexers/augeas.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/augeas.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/augeas.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,93 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +module Rouge + module Lexers + class Augeas < RegexLexer + title "Augeas" + desc "The Augeas programming language (augeas.net)" + + tag 'augeas' + aliases 'aug' + filenames '*.aug' + mimetypes 'text/x-augeas' + + def self.reserved + @reserved ||= Set.new %w( + _ let del store value counter seq key label autoload incl excl + transform test get put in after set clear insa insb print_string + print_regexp print_endline print_tree lens_ctype lens_atype + lens_ktype lens_vtype lens_format_atype regexp_match + ) + end + + state :basic do + rule %r/\s+/m, Text + rule %r/\(\*/, Comment::Multiline, :comment + end + + state :comment do + rule %r/\*\)/, Comment::Multiline, :pop! + rule %r/\(\*/, Comment::Multiline, :comment + rule %r/[^*)]+/, Comment::Multiline + rule %r/[*)]/, Comment::Multiline + end + + state :root do + mixin :basic + + rule %r/(:)(\w\w*)/ do + groups Punctuation, Keyword::Type + end + + rule %r/\w[\w']*/ do |m| + name = m[0] + if name == "module" + token Keyword::Reserved + push :module + elsif self.class.reserved.include? name + token Keyword::Reserved + elsif name =~ /\A[A-Z]/ + token Keyword::Namespace + else + token Name + end + end + + rule %r/"/, Str, :string + rule %r/\//, Str, :regexp + + rule %r([-*+.=?\|]+), Operator + rule %r/[\[\](){}:;]/, Punctuation + end + + state :module do + rule %r/\s+/, Text + rule %r/[A-Z][a-zA-Z0-9_.]*/, Name::Namespace, :pop! + end + + state :regexp do + rule %r/\//, Str::Regex, :pop! + rule %r/[^\\\/]+/, Str::Regex + rule %r/\\[\\\/]/, Str::Regex + rule %r/\\/, Str::Regex + end + + state :string do + rule %r/"/, Str, :pop! + rule %r/\\/, Str::Escape, :escape + rule %r/[^\\"]+/, Str + end + + state :escape do + rule %r/[abfnrtv"'&\\]/, Str::Escape, :pop! + rule %r/\^[\]\[A-Z@\^_]/, Str::Escape, :pop! + rule %r/o[0-7]+/i, Str::Escape, :pop! + rule %r/x[\da-f]+/i, Str::Escape, :pop! + rule %r/\d+/, Str::Escape, :pop! + rule %r/\s+/, Str::Escape, :pop! + rule %r/./, Str, :pop! + end + end + end +end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/batchfile.rb ruby-rouge-3.21.0/lib/rouge/lexers/batchfile.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/batchfile.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/batchfile.rb 2020-07-14 19:56:23.000000000 +0000 @@ -78,7 +78,7 @@ state :basic do # Comments - rule %r/\brem\b.*$/i, Comment + rule %r/@?\brem\b.*$/i, Comment # Empty Labels rule %r/^::.*$/, Comment diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/bibtex.rb ruby-rouge-3.21.0/lib/rouge/lexers/bibtex.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/bibtex.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/bibtex.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,115 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +# Regular expressions based on https://github.com/SaswatPadhi/prismjs-bibtex +# and https://github.com/alecthomas/chroma/blob/master/lexers/b/bibtex.go + +module Rouge + module Lexers + class BibTeX < RegexLexer + title 'BibTeX' + desc "BibTeX" + tag 'bibtex' + aliases 'bib' + filenames '*.bib' + + valid_punctuation = Regexp.quote("@!$&.\\:;<>?[]^`|~*/+-") + valid_name = /[a-z_#{valid_punctuation}][\w#{valid_punctuation}]*/io + + state :root do + mixin :whitespace + + rule %r/@(#{valid_name})/o do |m| + match = m[1].downcase + + if match == "comment" + token Comment + elsif match == "preamble" + token Name::Class + push :closing_brace + push :value + push :opening_brace + elsif match == "string" + token Name::Class + push :closing_brace + push :field + push :opening_brace + else + token Name::Class + push :closing_brace + push :command_body + push :opening_brace + end + end + + rule %r/.+/, Comment + end + + state :opening_brace do + mixin :whitespace + rule %r/[{(]/, Punctuation, :pop! + end + + state :closing_brace do + mixin :whitespace + rule %r/[})]/, Punctuation, :pop! + end + + state :command_body do + mixin :whitespace + rule %r/[^\s\,\}]+/ do + token Name::Label + pop! + push :fields + end + end + + state :fields do + mixin :whitespace + rule %r/,/, Punctuation, :field + rule(//) { pop! } + end + + state :field do + mixin :whitespace + rule valid_name do + token Name::Attribute + push :value + push :equal_sign + end + rule(//) { pop! } + end + + state :equal_sign do + mixin :whitespace + rule %r/=/, Punctuation, :pop! + end + + state :value do + mixin :whitespace + rule valid_name, Name::Variable + rule %r/"/, Literal::String, :quoted_string + rule %r/\{/, Literal::String, :braced_string + rule %r/\d+/, Literal::Number + rule %r/#/, Punctuation + rule(//) { pop! } + end + + state :quoted_string do + rule %r/\{/, Literal::String, :braced_string + rule %r/"/, Literal::String, :pop! + rule %r/[^\{\"]+/, Literal::String + end + + state :braced_string do + rule %r/\{/, Literal::String, :braced_string + rule %r/\}/, Literal::String, :pop! + rule %r/[^\{\}]+/, Literal::String + end + + state :whitespace do + rule %r/\s+/, Text + end + end + end +end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/brightscript.rb ruby-rouge-3.21.0/lib/rouge/lexers/brightscript.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/brightscript.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/brightscript.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,147 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +module Rouge + module Lexers + class Brightscript < RegexLexer + title "BrightScript" + desc "BrightScript Programming Language (https://developer.roku.com/en-ca/docs/references/brightscript/language/brightscript-language-reference.md)" + tag 'brightscript' + aliases 'bs', 'brs' + filenames '*.brs' + + # https://developer.roku.com/en-ca/docs/references/brightscript/language/global-utility-functions.md + # https://developer.roku.com/en-ca/docs/references/brightscript/language/global-string-functions.md + # https://developer.roku.com/en-ca/docs/references/brightscript/language/global-math-functions.md + def self.name_builtin + @name_builtin ||= Set.new %w( + ABS ASC ATN CDBL CHR CINT CONTROL COPYFILE COS CREATEDIRECTORY CSNG + DELETEDIRECTORY DELETEFILE EXP FINDMEMBERFUNCTION FINDNODE FIX + FORMATDRIVEFORMATJSON GETINTERFACE INSTR INT LCASE LEFT LEN LISTDIR + LOG MATCHFILES MID MOVEFILE OBSERVEFIELD PARSEJSON PARSEXML + READASCIIFILE REBOOTSYSTEM RIGHT RND RUNGARBAGECOLLECTOR SGN SIN + SLEEP SQR STR STRI STRING STRINGI STRTOI SUBSTITUTE TANTEXTTOP TEXT + TRUCASE UPTIME VALVISIBLE VISIBLE WAIT + ) + end + + # https://developer.roku.com/en-ca/docs/references/brightscript/language/reserved-words.md + def self.keyword_reserved + @keyword_reserved ||= Set.new %w( + BOX CREATEOBJECT DIM EACH ELSE ELSEIF END ENDFUNCTION ENDIF ENDSUB + ENDWHILE EVAL EXIT EXITWHILE FALSE FOR FUNCTION GETGLOBALAA + GETLASTRUNCOMPILEERROR GETLASTRUNRUNTIMEERROR GOTO IF IN INVALID LET + LINE_NUM M NEXT OBJFUN POS PRINT REM RETURN RUN STEP STOP SUB TAB TO + TRUE TYPE WHILE + ) + end + + # These keywords are present in BrightScript, but not supported in standard .brs files + def self.keyword_reserved_unsupported + @keyword_reserved_unsupported ||= Set.new %w( + CLASS CONST IMPORT LIBRARY NAMESPACE PRIVATE PROTECTED PUBLIC + ) + end + + # https://developer.roku.com/en-ca/docs/references/brightscript/language/expressions-variables-types.md + def self.keyword_type + @keyword_type ||= Set.new %w( + BOOLEAN DIM DOUBLE DYNAMIC FLOAT FUNCTION INTEGER INTERFACE INVALID + LONGINTEGER OBJECT STRING VOID + ) + end + + # https://developer.roku.com/en-ca/docs/references/brightscript/language/expressions-variables-types.md#operators + def self.operator_word + @operator_word ||= Set.new %w( + AND AS MOD NOT OR THEN + ) + end + + # Scene graph components configured as builtins. See BrightScript component documentation e.g. + # https://developer.roku.com/en-ca/docs/references/brightscript/components/roappinfo.md + def self.builtins + @builtins ||= Set.new %w( + roAppendFile roAppInfo roAppManager roArray roAssociativeArray + roAudioGuide roAudioMetadata roAudioPlayer roAudioPlayerEvent + roAudioResourceroBitmap roBoolean roBoolean roBrightPackage roBrSub + roButton roByteArray roCaptionRenderer roCaptionRendererEvent + roCecInterface roCECStatusEvent roChannelStore roChannelStoreEvent + roClockWidget roCodeRegistrationScreen + roCodeRegistrationScreenEventroCompositor roControlDown roControlPort + roControlPort roControlUp roCreateFile roDatagramReceiver + roDatagramSender roDataGramSocket roDateTime roDeviceInfo + roDeviceInfoEvent roDoubleroEVPCipher roEVPDigest roFileSystem + roFileSystemEvent roFloat roFont roFontMetrics roFontRegistry + roFunction roGlobal roGpio roGridScreen roGridScreenEvent + roHdmiHotPlugEventroHdmiStatus roHdmiStatusEvent roHMAC roHttpAgent + roImageCanvas roImageCanvasEvent roImageMetadata roImagePlayer + roImageWidgetroInput roInputEvent roInt roInt roInvalid roInvalid + roIRRemote roKeyboard roKeyboardPress roKeyboardScreen + roKeyboardScreenEventroList roListScreen roListScreenEvent + roLocalization roLongInteger roMessageDialog roMessageDialogEvent + roMessagePort roMicrophone roMicrophoneEvent roNetworkConfiguration + roOneLineDialog roOneLineDialogEventroParagraphScreen + roParagraphScreenEvent roPath roPinEntryDialog roPinEntryDialogEvent + roPinentryScreen roPosterScreen roPosterScreenEventroProgramGuide + roQuadravoxButton roReadFile roRectangleroRegexroRegion roRegistry + roRegistrySection roResourceManager roRSA roRssArticle roRssParser + roScreen roSearchHistory roSearchScreen roSearchScreenEvent + roSerialPort roSGNode roSGNodeEvent roSGScreenroSGScreenEvent + roSlideShowroSlideShowEvent roSNS5 roSocketAddress roSocketEvent + roSpringboardScreen roSpringboardScreenEventroSprite roStorageInfo + roStreamSocket roStringroSystemLogroSystemLogEvent roSystemTime + roTextFieldroTextScreen roTextScreenEvent roTextToSpeech + roTextToSpeechEvent roTextureManager roTextureRequest + roTextureRequestEventroTextWidget roTimer roTimespan roTouchScreen + roTunerroTunerEvent roUniversalControlEvent roUrlEvent roUrlTransfer + roVideoEvent roVideoInput roVideoMode roVideoPlayer roVideoPlayerEvent + roVideoScreen roVideoScreenEventroWriteFile roXMLElement roXMLList + ) + end + + id = /[$a-z_][a-z0-9_]*/io + + state :root do + rule %r/\s+/m, Text::Whitespace + + # https://developer.roku.com/en-ca/docs/references/brightscript/language/expressions-variables-types.md#comments + rule %r/\'.*/, Comment::Single + rule %r/REM.*/i, Comment::Single + + # https://developer.roku.com/en-ca/docs/references/brightscript/language/expressions-variables-types.md#operators + rule %r([~!%^&*+=\|?:<>/-]), Operator + + rule %r/\d*\.\d+(e-?\d+)?/i, Num::Float + rule %r/\d+[lu]*/i, Num::Integer + + rule %r/".*?"/, Str::Double + + rule %r/#{id}(?=\s*[(])/, Name::Function + + rule %r/[()\[\],.;{}]/, Punctuation + + rule id do |m| + caseSensitiveChunk = m[0] + caseInsensitiveChunk = m[0].upcase + + if self.class.builtins.include?(caseSensitiveChunk) + token Keyword::Reserved + elsif self.class.keyword_reserved.include?(caseInsensitiveChunk) + token Keyword::Reserved + elsif self.class.keyword_reserved_unsupported.include?(caseInsensitiveChunk) + token Keyword::Reserved + elsif self.class.keyword_type.include?(caseInsensitiveChunk) + token Keyword::Type + elsif self.class.name_builtin.include?(caseInsensitiveChunk) + token Name::Builtin + elsif self.class.operator_word.include?(caseInsensitiveChunk) + token Operator::Word + else + token Name + end + end + end + end + end +end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/cpp.rb ruby-rouge-3.21.0/lib/rouge/lexers/cpp.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/cpp.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/cpp.rb 2020-07-14 19:56:23.000000000 +0000 @@ -68,21 +68,28 @@ rule %r/#{dq}[lu]*/i, Num::Integer rule %r/\bnullptr\b/, Name::Builtin rule %r/(?:u8|u|U|L)?R"([a-zA-Z0-9_{}\[\]#<>%:;.?*\+\-\/\^&|~!=,"']{,16})\(.*?\)\1"/m, Str + rule %r/::/, Operator end state :classname do rule id, Name::Class, :pop! # template specification - rule %r/\s*(?=>)/m, Text, :pop! - rule %r/[.]{3}/, Operator mixin :whitespace + rule %r/[.]{3}/, Operator + rule %r/,/, Punctuation, :pop! + rule(//) { pop! } end state :template do - rule %r/>/, Punctuation, :pop! + rule %r/[>;]/, Punctuation, :pop! rule %r/typename\b/, Keyword, :classname - mixin :root + mixin :statements + end + + state :case do + rule %r/:(?!:)/, Punctuation, :pop! + mixin :statements end end end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/css.rb ruby-rouge-3.21.0/lib/rouge/lexers/css.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/css.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/css.rb 2020-07-14 19:56:23.000000000 +0000 @@ -11,7 +11,9 @@ filenames '*.css' mimetypes 'text/css' - identifier = /[a-zA-Z0-9_-]+/ + # Documentation: https://www.w3.org/TR/CSS21/syndata.html#characters + + identifier = /[\p{L}_-][\p{Word}\p{Cf}-]*/ number = /-?(?:[0-9]+(\.[0-9]+)?|\.[0-9]+)/ def self.attributes diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/diff.rb ruby-rouge-3.21.0/lib/rouge/lexers/diff.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/diff.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/diff.rb 2020-07-14 19:56:23.000000000 +0000 @@ -14,7 +14,7 @@ def self.detect?(text) return true if text.start_with?('Index: ') return true if text =~ %r(\Adiff[^\n]*?\ba/[^\n]*\bb/) - return true if text =~ /(---|[+][+][+]).*?\n(---|[+][+][+])/ + return true if text =~ /---.*?\n[+][+][+]/ || text =~ /[+][+][+].*?\n---/ end state :root do diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/docker.rb ruby-rouge-3.21.0/lib/rouge/lexers/docker.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/docker.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/docker.rb 2020-07-14 19:56:23.000000000 +0000 @@ -8,7 +8,7 @@ desc "Dockerfile syntax" tag 'docker' aliases 'dockerfile' - filenames 'Dockerfile', '*.Dockerfile', '*.docker', 'Dockerfile_*' + filenames 'Dockerfile', '*.Dockerfile', '*.docker' mimetypes 'text/x-dockerfile-config' KEYWORDS = %w( diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/haskell.rb ruby-rouge-3.21.0/lib/rouge/lexers/haskell.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/haskell.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/haskell.rb 2020-07-14 19:56:23.000000000 +0000 @@ -17,8 +17,8 @@ end reserved = %w( - _ case class data default deriving do else if in - infix[lr]? instance let newtype of then type where + _ case class data default deriving do else if in infix infixl infixr + instance let newtype of then type where ) ascii = %w( @@ -54,14 +54,31 @@ state :root do mixin :basic - rule %r/\bimport\b/, Keyword::Reserved, :import - rule %r/\bmodule\b/, Keyword::Reserved, :module - rule %r/\b(?:#{reserved.join('|')})\b/, Keyword::Reserved - # not sure why, but ^ doesn't work here - # rule %r/^[_a-z][\w']*/, Name::Function - rule %r/[_a-z][\w']*/, Name - rule %r/[A-Z][\w']*/, Keyword::Type - rule %r/'[A-Z]\w+'?/, Keyword::Type # promoted data constructor + rule %r/'(?=(?:.|\\\S+)')/, Str::Char, :character + rule %r/"/, Str, :string + + rule %r/\d+e[+-]?\d+/i, Num::Float + rule %r/\d+\.\d+(e[+-]?\d+)?/i, Num::Float + rule %r/0o[0-7]+/i, Num::Oct + rule %r/0x[\da-f]+/i, Num::Hex + rule %r/\d+/, Num::Integer + + rule %r/[\w']+/ do |m| + match = m[0] + if match == "import" + token Keyword::Reserved + push :import + elsif match == "module" + token Keyword::Reserved + push :module + elsif reserved.include?(match) + token Keyword::Reserved + elsif match =~ /\A'?[A-Z]/ + token Keyword::Type + else + token Name + end + end # lambda operator rule %r(\\(?![:!#\$\%&*+.\\/<=>?@^\|~-]+)), Name::Function @@ -72,15 +89,6 @@ # other operators rule %r([:!#\$\%&*+.\\/<=>?@^\|~-]+), Operator - rule %r/\d+e[+-]?\d+/i, Num::Float - rule %r/\d+\.\d+(e[+-]?\d+)?/i, Num::Float - rule %r/0o[0-7]+/i, Num::Oct - rule %r/0x[\da-f]+/i, Num::Hex - rule %r/\d+/, Num::Integer - - rule %r/'/, Str::Char, :character - rule %r/"/, Str, :string - rule %r/\[\s*\]/, Keyword::Type rule %r/\(\s*\)/, Name::Builtin diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/hlsl.rb ruby-rouge-3.21.0/lib/rouge/lexers/hlsl.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/hlsl.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/hlsl.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,166 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +module Rouge + module Lexers + load_lexer 'c.rb' + + class HLSL < C + title "HLSL" + desc "HLSL, the High Level Shading Language for DirectX (docs.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl)" + tag 'hlsl' + filenames '*.hlsl', '*.hlsli' + mimetypes 'text/x-hlsl' + + def self.keywords + @keywords ||= Set.new %w( + asm asm_fragment break case cbuffer centroid class column_major + compile compile_fragment const continue default discard do else export + extern for fxgroup globallycoherent groupshared if in inline inout + interface line lineadj linear namespace nointerpolation noperspective + NULL out packoffset pass pixelfragment point precise return register + row_major sample sampler shared stateblock stateblock_state static + struct switch tbuffer technique technique10 technique11 texture + typedef triangle uniform vertexfragment volatile while + ) + end + + def self.keywords_type + @keywords_type ||= Set.new %w( + dword matrix snorm string unorm unsigned void vector BlendState Buffer + ByteAddressBuffer ComputeShader DepthStencilState DepthStencilView + DomainShader GeometryShader HullShader InputPatch LineStream + OutputPatch PixelShader PointStream RasterizerState RenderTargetView + RasterizerOrderedBuffer RasterizerOrderedByteAddressBuffer + RasterizerOrderedStructuredBuffer RasterizerOrderedTexture1D + RasterizerOrderedTexture1DArray RasterizerOrderedTexture2D + RasterizerOrderedTexture2DArray RasterizerOrderedTexture3D RWBuffer + RWByteAddressBuffer RWStructuredBuffer RWTexture1D RWTexture1DArray + RWTexture2D RWTexture2DArray RWTexture3D SamplerState + SamplerComparisonState StructuredBuffer Texture1D Texture1DArray + Texture2D Texture2DArray Texture2DMS Texture2DMSArray Texture3D + TextureCube TextureCubeArray TriangleStream VertexShader + + bool1 bool2 bool3 bool4 BOOL1 BOOL2 BOOL3 BOOL4 + int1 int2 int3 int4 + half1 half2 half3 half4 + float1 float2 float3 float4 + double1 double2 double3 double4 + + bool1x1 bool1x2 bool1x3 bool1x4 bool2x1 bool2x2 bool2x3 bool2x4 + bool3x1 bool3x2 bool3x3 bool3x4 bool4x1 bool4x2 bool4x3 bool4x4 + BOOL1x1 BOOL1x2 BOOL1x3 BOOL1x4 BOOL2x1 BOOL2x2 BOOL2x3 BOOL2x4 + BOOL3x1 BOOL3x2 BOOL3x3 BOOL3x4 BOOL4x1 BOOL4x2 BOOL4x3 BOOL4x4 + half1x1 half1x2 half1x3 half1x4 half2x1 half2x2 half2x3 half2x4 + half3x1 half3x2 half3x3 half3x4 half4x1 half4x2 half4x3 half4x4 + int1x1 int1x2 int1x3 int1x4 int2x1 int2x2 int2x3 int2x4 + int3x1 int3x2 int3x3 int3x4 int4x1 int4x2 int4x3 int4x4 + float1x1 float1x2 float1x3 float1x4 float2x1 float2x2 float2x3 float2x4 + float3x1 float3x2 float3x3 float3x4 float4x1 float4x2 float4x3 float4x4 + double1x1 double1x2 double1x3 double1x4 double2x1 double2x2 double2x3 double2x4 + double3x1 double3x2 double3x3 double3x4 double4x1 double4x2 double4x3 double4x4 + ) + end + + def self.reserved + @reserved ||= Set.new %w( + auto catch char const_cast delete dynamic_cast enum explicit friend + goto long mutable new operator private protected public + reinterpret_cast short signed sizeof static_cast template this throw + try typename union unsigned using virtual + ) + end + + def self.builtins + @builtins ||= Set.new %w( + abort abs acos all AllMemoryBarrier AllMemoryBarrierWithGroupSync any + AppendStructuredBuffer asdouble asfloat asin asint asuint asuint atan + atan2 ceil CheckAccessFullyMapped clamp clip CompileShader + ConsumeStructuredBuffer cos cosh countbits cross D3DCOLORtoUBYTE4 ddx + ddx_coarse ddx_fine ddy ddy_coarse ddy_fine degrees determinant + DeviceMemoryBarrier DeviceMemoryBarrierWithGroupSync distance dot dst + errorf EvaluateAttributeAtCentroid EvaluateAttributeAtSample + EvaluateAttributeSnapped exp exp2 f16tof32 f32tof16 faceforward + firstbithigh firstbitlow floor fma fmod frac frexp fwidth + GetRenderTargetSampleCount GetRenderTargetSamplePosition + GlobalOrderedCountIncrement GroupMemoryBarrier + GroupMemoryBarrierWithGroupSync InterlockedAdd InterlockedAnd + InterlockedCompareExchange InterlockedCompareStore InterlockedExchange + InterlockedMax InterlockedMin InterlockedOr InterlockedXor isfinite + isinf isnan ldexp length lerp lit log log10 log2 mad max min modf + msad4 mul noise normalize pow printf Process2DQuadTessFactorsAvg + Process2DQuadTessFactorsMax Process2DQuadTessFactorsMin + ProcessIsolineTessFactors ProcessQuadTessFactorsAvg + ProcessQuadTessFactorsMax ProcessQuadTessFactorsMin + ProcessTriTessFactorsAvg ProcessTriTessFactorsMax + ProcessTriTessFactorsMin QuadReadLaneAt QuadSwapX QuadSwapY radians + rcp reflect refract reversebits round rsqrt saturate sign sin sincos + sinh smoothstep sqrt step tan tanh tex1D tex1D tex1Dbias tex1Dgrad + tex1Dlod tex1Dproj tex2D tex2D tex2Dbias tex2Dgrad tex2Dlod tex2Dproj + tex3D tex3D tex3Dbias tex3Dgrad tex3Dlod tex3Dproj texCUBE texCUBE + texCUBEbias texCUBEgrad texCUBElod texCUBEproj transpose trunc + WaveAllBitAnd WaveAllMax WaveAllMin WaveAllBitOr WaveAllBitXor + WaveAllEqual WaveAllProduct WaveAllSum WaveAllTrue WaveAnyTrue + WaveBallot WaveGetLaneCount WaveGetLaneIndex WaveGetOrderedIndex + WaveIsHelperLane WaveOnce WavePrefixProduct WavePrefixSum + WaveReadFirstLane WaveReadLaneAt + + SV_CLIPDISTANCE SV_CLIPDISTANCE0 SV_CLIPDISTANCE1 SV_CULLDISTANCE + SV_CULLDISTANCE0 SV_CULLDISTANCE1 SV_COVERAGE SV_DEPTH + SV_DEPTHGREATEREQUAL SV_DEPTHLESSEQUAL SV_DISPATCHTHREADID + SV_DOMAINLOCATION SV_GROUPID SV_GROUPINDEX SV_GROUPTHREADID + SV_GSINSTANCEID SV_INNERCOVERAGE SV_INSIDETESSFACTOR SV_INSTANCEID + SV_ISFRONTFACE SV_OUTPUTCONTROLPOINTID SV_POSITION SV_PRIMITIVEID + SV_RENDERTARGETARRAYINDEX SV_SAMPLEINDEX SV_STENCILREF SV_TESSFACTOR + SV_VERTEXID SV_VIEWPORTARRAYINDEX + + allow_uav_condition branch call domain earlydepthstencil fastopt + flatten forcecase instance loop maxtessfactor numthreads + outputcontrolpoints outputtopology partitioning patchconstantfunc + unroll + + BINORMAL BINORMAL0 BINORMAL1 BINORMAL2 BINORMAL3 BINORMAL4 + BLENDINDICES0 BLENDINDICES1 BLENDINDICES2 BLENDINDICES3 BLENDINDICES4 + BLENDWEIGHT0 BLENDWEIGHT1 BLENDWEIGHT2 BLENDWEIGHT3 BLENDWEIGHT4 COLOR + COLOR0 COLOR1 COLOR2 COLOR3 COLOR4 NORMAL NORMAL0 NORMAL1 NORMAL2 + NORMAL3 NORMAL4 POSITION POSITION0 POSITION1 POSITION2 POSITION3 + POSITION4 POSITIONT PSIZE0 PSIZE1 PSIZE2 PSIZE3 PSIZE4 TANGENT + TANGENT0 TANGENT1 TANGENT2 TANGENT3 TANGENT4 TESSFACTOR0 TESSFACTOR1 + TESSFACTOR2 TESSFACTOR3 TESSFACTOR4 TEXCOORD0 TEXCOORD1 TEXCOORD2 + TEXCOORD3 TEXCOORD4 + + FOG PSIZE + + VFACE VPOS + + DEPTH0 DEPTH1 DEPTH2 DEPTH3 DEPTH4 + ) + end + + ws = %r((?:\s|//.*?\n|/[*].*?[*]/)+) + id = /[a-zA-Z_][a-zA-Z0-9_]*/ + + state :root do + mixin :expr_whitespace + rule %r( + ([\w*\s]+?[\s*]) # return arguments + (#{id}) # function name + (\s*\([^;]*?\)(?:\s*:\s+#{id})?) # signature + (#{ws}?)({|;) # open brace or semicolon + )mx do |m| + # This is copied from the C lexer + recurse m[1] + token Name::Function, m[2] + recurse m[3] + recurse m[4] + token Punctuation, m[5] + if m[5] == ?{ + push :function + end + end + rule %r/\{/, Punctuation, :function + mixin :statements + end + end + end +end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/html.rb ruby-rouge-3.21.0/lib/rouge/lexers/html.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/html.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/html.rb 2020-07-14 19:56:23.000000000 +0000 @@ -7,7 +7,7 @@ title "HTML" desc "HTML, the markup language of the web" tag 'html' - filenames '*.htm', '*.html', '*.xhtml' + filenames '*.htm', '*.html', '*.xhtml', '*.cshtml' mimetypes 'text/html', 'application/xhtml+xml' def self.detect?(text) @@ -47,13 +47,13 @@ rule %r(), Name::Tag # closing tags + rule %r(<\s*[\p{L}:_-][\p{Word}\p{Cf}:.·-]*), Name::Tag, :tag # opening tags + rule %r(<\s*/\s*[\p{L}:_-][\p{Word}\p{Cf}:.·-]*\s*>), Name::Tag # closing tags end state :tag_end do mixin :tag_end_end - rule %r/[a-zA-Z0-9:-]+/ do + rule %r/[\p{L}:_-][\p{Word}\p{Cf}:.·-]*/ do token Name::Tag goto :tag_end_end end @@ -67,7 +67,7 @@ state :tag_start do rule %r/\s+/, Text - rule %r/[a-zA-Z0-9:-]+/ do + rule %r/[\p{L}:_-][\p{Word}\p{Cf}:.·-]*/ do token Name::Tag goto :tag end @@ -83,8 +83,8 @@ state :tag do rule %r/\s+/m, Text - rule %r/[a-zA-Z0-9_:\[\]()*.-]+\s*=\s*/m, Name::Attribute, :attr - rule %r/[a-zA-Z0-9_:#*-]+/, Name::Attribute + rule %r/[\p{L}:_\[\]()*.-][\p{Word}\p{Cf}:.·\[\]()*-]*\s*=\s*/m, Name::Attribute, :attr + rule %r/[\p{L}:_*#-][\p{Word}\p{Cf}:.·*#-]*/, Name::Attribute rule %r(/?\s*>)m, Name::Tag, :pop! end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/janet.rb ruby-rouge-3.21.0/lib/rouge/lexers/janet.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/janet.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/janet.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,217 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +module Rouge + module Lexers + class Janet < RegexLexer + title "Janet" + desc "The Janet programming language (janet-lang.org)" + + tag 'janet' + aliases 'jdn' + + filenames '*.janet', '*.jdn' + + mimetypes 'text/x-janet', 'application/x-janet' + + def self.specials + @specials ||= Set.new %w( + break def do fn if quote quasiquote splice set unquote var while + ) + end + + def self.bundled + @bundled ||= Set.new %w( + % %= * *= + ++ += - -- -= -> ->> -?> -?>> / /= < <= = > >= + abstract? accumulate accumulate2 all all-bindings + all-dynamics and apply array array/concat array/ensure + array/fill array/insert array/new array/new-filled + array/peek array/pop array/push array/remove array/slice + array? as-> as?-> asm assert bad-compile bad-parse band + blshift bnot boolean? bor brshift brushift buffer buffer/bit + buffer/bit-clear buffer/bit-set buffer/bit-toggle + buffer/blit buffer/clear buffer/fill buffer/format + buffer/new buffer/new-filled buffer/popn buffer/push-byte + buffer/push-string buffer/push-word buffer/slice buffer? + bxor bytes? case cfunction? chr cli-main comment comp + compare compare= compare< compare<= compare> compare>= + compile complement comptime cond coro count debug + debug/arg-stack debug/break debug/fbreak debug/lineage + debug/stack debug/stacktrace debug/step debug/unbreak + debug/unfbreak debugger-env dec deep-not= deep= default + default-peg-grammar def- defer defmacro defmacro- defn defn- + defglobal describe dictionary? disasm distinct doc doc* + doc-format dofile drop drop-until drop-while dyn each eachk + eachp eachy edefer eflush empty? env-lookup eprin eprinf + eprint eprintf error errorf eval eval-string even? every? + extreme false? fiber/can-resume? fiber/current fiber/getenv + fiber/maxstack fiber/new fiber/root fiber/setenv + fiber/setmaxstack fiber/status fiber? file/close file/flush + file/open file/popen file/read file/seek file/temp + file/write filter find find-index first flatten flatten-into + flush for forv freeze frequencies function? gccollect + gcinterval gcsetinterval generate gensym get get-in getline + hash idempotent? identity import import* if-let if-not + if-with in inc indexed? int/s64 int/u64 int? interleave + interpose invert janet/build janet/config-bits janet/version + juxt juxt* keep keys keyword keyword? kvs label last length + let load-image load-image-dict loop macex macex1 make-env + make-image make-image-dict map mapcat marshal math/-inf + math/abs math/acos math/acosh math/asin math/asinh math/atan + math/atan2 math/atanh math/cbrt math/ceil math/cos math/cosh + math/e math/erf math/erfc math/exp math/exp2 math/expm1 + math/floor math/gamma math/hypot math/inf math/log + math/log10 math/log1p math/log2 math/next math/pi math/pow + math/random math/rng math/rng-buffer math/rng-int + math/rng-uniform math/round math/seedrandom math/sin + math/sinh math/sqrt math/tan math/tanh math/trunc match max + mean merge merge-into min mod module/add-paths module/cache + module/expand-path module/find module/loaders module/loading + module/paths nan? nat? native neg? net/chunk net/close + net/connect net/read net/server net/write next nil? not not= + number? odd? one? or os/arch os/cd os/chmod os/clock + os/cryptorand os/cwd os/date os/dir os/environ os/execute + os/exit os/getenv os/link os/lstat os/mkdir os/mktime + os/perm-int os/perm-string os/readlink os/realpath os/rename + os/rm os/rmdir os/setenv os/shell os/sleep os/stat + os/symlink os/time os/touch os/umask os/which pairs parse + parser/byte parser/clone parser/consume parser/eof + parser/error parser/flush parser/has-more parser/insert + parser/new parser/produce parser/state parser/status + parser/where partial partition peg/compile peg/match pos? + postwalk pp prewalk prin prinf print printf product prompt + propagate protect put put-in quit range reduce reduce2 + repeat repl require resume return reverse reversed root-env + run-context scan-number seq setdyn shortfn signal slice + slurp some sort sort-by sorted sorted-by spit stderr stdin + stdout string string/ascii-lower string/ascii-upper + string/bytes string/check-set string/find string/find-all + string/format string/from-bytes string/has-prefix? + string/has-suffix? string/join string/repeat string/replace + string/replace-all string/reverse string/slice string/split + string/trim string/triml string/trimr string? struct struct? + sum symbol symbol? table table/clone table/getproto + table/new table/rawget table/setproto table/to-struct table? + take take-until take-while tarray/buffer tarray/copy-bytes + tarray/length tarray/new tarray/properties tarray/slice + tarray/swap-bytes thread/close thread/current thread/new + thread/receive thread/send trace tracev true? truthy? try + tuple tuple/brackets tuple/setmap tuple/slice + tuple/sourcemap tuple/type tuple? type unless unmarshal + untrace update update-in use values var- varfn varglobal + walk walk-ind walk-dict when when-let when-with with + with-dyns with-syms with-vars yield zero? zipcoll + ) + end + + def name_token(name) + if self.class.specials.include? name + Keyword + elsif self.class.bundled.include? name + Keyword::Reserved + else + Name::Function + end + end + + punctuation = %r/[_!@$%^&*+=~<>.?\/-]/o + symbol = %r/([[:alpha:]]|#{punctuation})([[:word:]]|#{punctuation}|:)*/o + + state :root do + rule %r/#.*?$/, Comment::Single + rule %r/\s+/m, Text::Whitespace + + rule %r/(true|false|nil)\b/, Name::Constant + rule %r/(['~])(#{symbol})/ do + groups Operator, Str::Symbol + end + rule %r/:([[:word:]]|#{punctuation}|:)*/, Keyword::Constant + + # radix-specified numbers + rule %r/[+-]?\d{1,2}r[\w.]+(&[+-]?\w+)?/, Num::Float + + # hex numbers + rule %r/[+-]?0x\h[\h_]*(\.\h[\h_]*)?/, Num::Hex + rule %r/[+-]?0x\.\h[\h_]*/, Num::Hex + + # decimal numbers (Janet treats all decimals as floats) + rule %r/[+-]?\d[\d_]*(\.\d[\d_]*)?([e][+-]?\d+)?/i, Num::Float + rule %r/[+-]?\.\d[\d_]*([e][+-]?\d+)?/i, Num::Float + + rule %r/@?"/, Str::Double, :string + rule %r/@?(`+).*?\1/m, Str::Heredoc + + rule %r/\(/, Punctuation, :function + + rule %r/(')([\(\[])/ do + groups Operator, Punctuation + push :quote + end + + rule %r/(~)([\(\[])/ do + groups Operator, Punctuation + push :quasiquote + end + + rule %r/[\#~,';\|]/, Operator + + rule %r/@?[({\[]/, Punctuation, :push + rule %r/[)}\]]/, Punctuation, :pop! + + rule symbol, Name + end + + state :string do + rule %r/"/, Str::Double, :pop! + rule %r/\\(u\h{4}|U\h{6})/, Str::Escape + rule %r/\\./, Str::Escape + rule %r/[^"\\]+/, Str::Double + end + + state :function do + rule symbol do |m| + case m[0] + when "quote" + token Keyword + goto :quote + when "quasiquote" + token Keyword + goto :quasiquote + else + token name_token(m[0]) + goto :root + end + end + + mixin :root + end + + state :quote do + rule %r/[\(\[]/, Punctuation, :push + rule symbol, Str::Symbol + mixin :root + end + + state :quasiquote do + rule %r/(,)(\()/ do + groups Operator, Punctuation + push :function + end + rule %r/(\()(\s*)(unquote)(\s+)(\()/ do + groups Punctuation, Text, Keyword, Text, Punctuation + push :root + push :function + end + + rule %r/(,)(#{symbol})/ do + groups Operator, Name + end + rule %r/(\()(\s*)(unquote)(\s+)(#{symbol})/ do + groups Punctuation, Text, Keyword, Text, Name + end + + mixin :quote + end + end + end +end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/javascript.rb ruby-rouge-3.21.0/lib/rouge/lexers/javascript.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/javascript.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/javascript.rb 2020-07-14 19:56:23.000000000 +0000 @@ -19,6 +19,8 @@ mimetypes 'application/javascript', 'application/x-javascript', 'text/javascript', 'text/x-javascript' + # Pseudo-documentation: https://stackoverflow.com/questions/1661197/what-characters-are-valid-for-javascript-variable-names + def self.detect?(text) return 1 if text.shebang?('node') return 1 if text.shebang?('jsc') @@ -138,7 +140,7 @@ end def self.id_regex - /[$a-z_][a-z0-9_]*/io + /[\p{L}\p{Nl}$_][\p{Word}]*/io end id = self.id_regex @@ -225,8 +227,6 @@ groups Name::Label, Text, Punctuation end - rule %r/[{}]/, Punctuation - mixin :expr_start end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/jinja.rb ruby-rouge-3.21.0/lib/rouge/lexers/jinja.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/jinja.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/jinja.rb 2020-07-14 19:56:23.000000000 +0000 @@ -40,6 +40,17 @@ rule %r/{#/, Comment, :comment rule %r/##.*/, Comment + # Raw and verbatim + rule %r/({%-?)(\s*)(raw|verbatim)(\s*)(-?%})/ do |m| + groups Comment::Preproc, Text, Keyword, Text, Comment::Preproc + case m[3] + when "raw" + push :raw + when "verbatim" + push :verbatim + end + end + # Statements rule %r/\{\%/ do token Comment::Preproc @@ -114,11 +125,6 @@ end state :statement do - rule %r/(raw|verbatim)(\s+)(\%\})/ do - groups Keyword, Text, Comment::Preproc - goto :raw - end - rule %r/(\w+\.?)/ do |m| if self.class.keywords.include?(m[0]) groups Keyword @@ -142,12 +148,21 @@ end state :raw do - rule %r{(\{\%)(\s+)(endverbatim|endraw)(\s+)(\%\})} do + rule %r/({%-?)(\s*)(endraw)(\s*)(-?%})/ do groups Comment::Preproc, Text, Keyword, Text, Comment::Preproc pop! end + rule %r/[^{]+/, Text + rule %r/{/, Text + end - rule %r/(.+?)/m, Text + state :verbatim do + rule %r/({%-?)(\s*)(endverbatim)(\s*)(-?%})/ do + groups Comment::Preproc, Text, Keyword, Text, Comment::Preproc + pop! + end + rule %r/[^{]+/, Text + rule %r/{/, Text end end end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/jsx.rb ruby-rouge-3.21.0/lib/rouge/lexers/jsx.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/jsx.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/jsx.rb 2020-07-14 19:56:23.000000000 +0000 @@ -6,97 +6,85 @@ class JSX < Javascript title 'JSX' - desc 'React JSX (https://facebook.github.io/react/)' + desc 'An XML-like syntax extension to JavaScript (facebook.github.io/jsx/)' tag 'jsx' aliases 'jsx', 'react' filenames '*.jsx' mimetypes 'text/x-jsx', 'application/x-jsx' - id = Javascript.id_regex + start { @html = HTML.new(options); push :expr_start } - def start_embed! - @embed ||= JSX.new(options) - @embed.reset! - @embed.push(:expr_start) - push :jsx_embed_root - end - - def tag_token(name) - name[0] =~ /\p{Lower}/ ? Name::Tag : Name::Class + prepend :expr_start do + mixin :tag end - start { @html = HTML.new(options) } - - state :jsx_tags do - rule %r/{]+/ do + rule %r/[^<{]+/ do delegate @html end - - mixin :jsx_tags - end - - prepend :expr_start do - mixin :jsx_tags end - state :jsx_tag do + state :element do mixin :comments_and_whitespace - rule %r/#{id}/ do |m| - token tag_token(m[0]) + rule %r/\/>/ do + token Punctuation + pop! 2 end - - rule %r/[.]/, Punctuation - end - - state :jsx_end_tag do - mixin :jsx_tag rule %r/>/, Punctuation, :pop! - end - - state :jsx_element do - rule %r/#{id}=/, Name::Attribute, :jsx_attribute - mixin :jsx_tag - rule %r/>/ do token Punctuation; goto :jsx_internal end - rule %r(/>), Punctuation, :pop! - end - - state :jsx_attribute do - rule %r/"(\\[\\"]|[^"])*"/, Str::Double, :pop! - rule %r/'(\\[\\']|[^'])*'/, Str::Single, :pop! rule %r/{/ do token Str::Interpol - pop! - start_embed! + push :interpol + push :expr_start end + rule %r/\w+/, Name::Attribute + rule %r/=/, Punctuation + rule %r/(["']).*?(\1)/, Str end - state :jsx_embed_root do - rule %r/[.][.][.]/, Punctuation + state :element_name do + rule %r/[A-Z]\w*/, Name::Class + rule %r/\w+/, Name::Tag + rule %r/\./, Punctuation + rule(//) { pop! } + end + + state :interpol do rule %r/}/, Str::Interpol, :pop! - mixin :jsx_embed + rule %r/{/ do + token Punctuation + push :interpol_inner + push :statement + end + mixin :root end - state :jsx_embed do - rule %r/{/ do delegate @embed; push :jsx_embed end - rule %r/}/ do delegate @embed; pop! end - rule %r/[^{}]+/ do - delegate @embed + state :interpol_inner do + rule %r/}/ do + token Punctuation + goto :statement end + mixin :root end end end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/julia.rb ruby-rouge-3.21.0/lib/rouge/lexers/julia.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/julia.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/julia.rb 2020-07-14 19:56:23.000000000 +0000 @@ -11,6 +11,8 @@ filenames '*.jl' mimetypes 'text/x-julia', 'application/x-julia' + # Documentation: https://docs.julialang.org/en/v1/manual/variables/#Allowed-Variable-Names-1 + def self.detect?(text) return true if text.shebang? 'julia' end @@ -252,13 +254,13 @@ state :funcname do - rule %r/[a-zA-Z_]\w*/, Name::Function, :pop! + rule %r/[\p{L}\p{Nl}\p{S}_][\p{Word}\p{S}\p{Po}!]*/, Name::Function, :pop! rule %r/\([^\s\w{]{1,2}\)/, Operator, :pop! rule %r/[^\s\w{]{1,2}/, Operator, :pop! end state :typename do - rule %r/[a-zA-Z_]\w*/, Name::Class, :pop! + rule %r/[\p{L}\p{Nl}\p{S}_][\p{Word}\p{S}\p{Po}!]*/, Name::Class, :pop! end state :stringescape do diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/livescript.rb ruby-rouge-3.21.0/lib/rouge/lexers/livescript.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/livescript.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/livescript.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,310 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +module Rouge + module Lexers + class Livescript < RegexLexer + tag 'livescript' + aliases 'ls' + filenames '*.ls' + mimetypes 'text/livescript' + + title 'LiveScript' + desc 'LiveScript, a language which compiles to JavaScript (livescript.net)' + + def self.detect?(text) + return text.shebang? 'lsc' + end + + def self.declarations + @declarations ||= Set.new %w(const let var function class extends implements) + end + + def self.keywords + @keywords ||= Set.new %w( + loop until for in of while break return continue switch case + fallthrough default otherwise when then if unless else throw try + catch finally new delete typeof instanceof super by from to til + with require do debugger import export yield + ) + end + + def self.constants + @constants ||= Javascript.constants + %w(yes no on off void) + end + + def self.builtins + @builtins ||= Javascript.builtins + %w(this it that arguments) + end + + def self.loop_control_keywords + @loop_control_keywords ||= Set.new %w(break continue) + end + + id = /[$a-z_]((-(?=[a-z]))?[a-z0-9_])*/i + int_number = /\d[\d_]*/ + int = /#{int_number}(e[+-]?#{int_number})?[$\w]*/ # the last class matches units + + state :root do + rule(%r(^(?=\s|/))) { push :slash_starts_regex } + mixin :comments + mixin :whitespace + + # list of words + rule %r/(<\[)(.*?)(\]>)/m do + groups Punctuation, Str, Punctuation + end + + # function declarations + rule %r/!\s*function\b/, Keyword::Declaration + rule %r/!?[-~]>|<[-~]!?/, Keyword::Declaration + + # switch arrow + rule %r/(=>)/, Keyword + + # prototype attributes + rule %r/(::)(#{id})/ do + groups Punctuation, Name::Attribute + push :id + end + rule %r/(::)(#{int})/ do + groups Punctuation, Num::Integer + push :id + end + + # instance attributes + rule %r/(@)(#{id})/ do + groups Name::Variable::Instance, Name::Attribute + push :id + end + rule %r/([.])(#{id})/ do + groups Punctuation, Name::Attribute + push :id + end + rule %r/([.])(\d+)/ do + groups Punctuation, Num::Integer + push :id + end + rule %r/#{id}(?=\s*:[^:=])/, Name::Attribute + + # operators + rule %r( + [+][+]|--|&&|\b(and|x?or|is(nt)?|not)\b(?!-[a-zA-Z]|_)|[|][|]| + [.]([|&^]|<<|>>>?)[.]|\\(?=\n)|[.:]=|<<<| + (<<|>>|==?|!=?|[-<>+*%^/~?])=? + )x, Operator, :slash_starts_regex + + # arguments shorthand + rule %r/(&)(#{id})?/ do + groups Name::Builtin, Name::Attribute + end + + # switch case + rule %r/[|]|\bcase(?=\s)/, Keyword, :switch_underscore + + rule %r/@/, Name::Variable::Instance + rule %r/[.]{3}/, Punctuation + rule %r/:/, Punctuation + + # keywords + rule %r/#{id}/ do |m| + if self.class.loop_control_keywords.include? m[0] + token Keyword + push :loop_control + next + elsif self.class.keywords.include? m[0] + token Keyword + elsif self.class.constants.include? m[0] + token Name::Constant + elsif self.class.builtins.include? m[0] + token Name::Builtin + elsif self.class.declarations.include? m[0] + token Keyword::Declaration + elsif /^[A-Z]/.match(m[0]) && /[^-][a-z]/.match(m[0]) + token Name::Class + else + token Name::Variable + end + push :id + end + + # punctuation and brackets + rule %r/\](?=[!?.]|#{id})/, Punctuation, :id + rule %r/[{(\[;,]/, Punctuation, :slash_starts_regex + rule %r/[})\].]/, Punctuation + + # literals + rule %r/#{int_number}[.]#{int}/, Num::Float + rule %r/0x[0-9A-Fa-f]+/, Num::Hex + rule %r/#{int}/, Num::Integer + + # strings + rule %r/"""/ do + token Str + push do + rule %r/"""/, Str, :pop! + rule %r/"/, Str + mixin :double_strings + end + end + + rule %r/'''/ do + token Str + push do + rule %r/'''/, Str, :pop! + rule %r/'/, Str + mixin :single_strings + end + end + + rule %r/"/ do + token Str + push do + rule %r/"/, Str, :pop! + mixin :double_strings + end + end + + rule %r/'/ do + token Str + push do + rule %r/'/, Str, :pop! + mixin :single_strings + end + end + + # words + rule %r/\\\S[^\s,;\])}]*/, Str + end + + state :code_escape do + rule %r(\\( + c[A-Z]| + x[0-9a-fA-F]{2}| + u[0-9a-fA-F]{4}| + u\{[0-9a-fA-F]{4}\} + ))x, Str::Escape + end + + state :interpolated_expression do + rule %r/}/, Str::Interpol, :pop! + mixin :root + end + + state :interpolation do + # with curly braces + rule %r/[#][{]/, Str::Interpol, :interpolated_expression + # without curly braces + rule %r/(#)(#{id})/ do |m| + groups Str::Interpol, (self.class.builtins.include? m[2]) ? Name::Builtin : Name::Variable + end + end + + state :whitespace do + # white space and loop labels + rule %r/(\s+?)(?:^([^\S\n]*)(:#{id}))?/m do + groups Text, Text, Name::Label + end + end + + state :whitespace_single_line do + rule %r([^\S\n]+), Text + end + + state :slash_starts_regex do + mixin :comments + mixin :whitespace + mixin :multiline_regex_begin + + rule %r( + /(\\.|[^\[/\\\n]|\[(\\.|[^\]\\\n])*\])+/ # a regex + ([gimy]+\b|\B) + )x, Str::Regex, :pop! + + rule(//) { pop! } + end + + state :multiline_regex_begin do + rule %r(//) do + token Str::Regex + goto :multiline_regex + end + end + + state :multiline_regex_end do + rule %r(//([gimy]+\b|\B)), Str::Regex, :pop! + end + + state :multiline_regex do + mixin :multiline_regex_end + mixin :regex_comment + mixin :interpolation + mixin :code_escape + rule %r/\\\D/, Str::Escape + rule %r/\\\d+/, Name::Variable + rule %r/./m, Str::Regex + end + + state :regex_comment do + rule %r/^#(\s+.*)?$/, Comment::Single + rule %r/(\s+)(#)(\s+.*)?$/ do + groups Text, Comment::Single, Comment::Single + end + end + + state :comments do + rule %r(/\*.*?\*/)m, Comment::Multiline + rule %r/#.*$/, Comment::Single + end + + state :switch_underscore do + mixin :whitespace_single_line + rule %r/_(?=\s*=>|\s+then\b)/, Keyword + rule(//) { pop! } + end + + state :loop_control do + mixin :whitespace_single_line + rule %r/#{id}(?=[);\n])/, Name::Label + rule(//) { pop! } + end + + state :id do + rule %r/[!?]|[.](?!=)/, Punctuation + rule %r/[{]/ do + # destructuring + token Punctuation + push do + rule %r/[,;]/, Punctuation + rule %r/#{id}/, Name::Attribute + rule %r/#{int}/, Num::Integer + mixin :whitespace + rule %r/[}]/, Punctuation, :pop! + end + end + rule %r/#{id}/, Name::Attribute + rule %r/#{int}/, Num::Integer + rule(//) { goto :slash_starts_regex } + end + + state :strings do + # all strings are multi-line + rule %r/[^#\\'"]+/m, Str + mixin :code_escape + rule %r/\\./, Str::Escape + rule %r/#/, Str + end + + state :double_strings do + rule %r/'/, Str + mixin :interpolation + mixin :strings + end + + state :single_strings do + rule %r/"/, Str + mixin :strings + end + end + end +end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/opentype_feature_file.rb ruby-rouge-3.21.0/lib/rouge/lexers/opentype_feature_file.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/opentype_feature_file.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/opentype_feature_file.rb 2020-07-14 19:56:23.000000000 +0000 @@ -12,24 +12,30 @@ def self.keywords @keywords ||= %w( - Ascender Attach CapHeight CaretOffset CodePageRange Descender FontRevision FSType - GlyphClassDef HorizAxis.BaseScriptList HorizAxis.BaseTagList HorizAxis.MinMax - IgnoreBaseGlyphs IgnoreLigatures IgnoreMarks LigatureCaretByDev LigatureCaretByIndex - LigatureCaretByPos LineGap MarkAttachClass MarkAttachmentType NULL Panose RightToLeft - TypoAscender TypoDescender TypoLineGap UnicodeRange UseMarkFilteringSet Vendor - VertAdvanceY VertAxis.BaseScriptList VertAxis.BaseTagList VertAxis.MinMax VertOriginY - VertTypoAscender VertTypoDescender VertTypoLineGap WeightClass WidthClass XHeight - - anchorDef anchor anonymous anon by contour cursive device enumerate enum - exclude_dflt featureNames feature from ignore include_dflt include languagesystem - language lookupflag lookup markClass mark nameid name parameters position pos required - reversesub rsub script sizemenuname substitute subtable sub table useExtension + Ascender Attach AxisValue CapHeight CaretOffset CodePageRange + DesignAxis Descender ElidedFallbackName ElidedFallbackNameID + ElidableAxisValueName FeatUILabelNameID FeatUITooltipTextNameID + FontRevision FSType GlyphClassDef HorizAxis.BaseScriptList + HorizAxis.BaseTagList HorizAxis.MinMax IgnoreBaseGlyphs + IgnoreLigatures IgnoreMarks LigatureCaretByDev LigatureCaretByIndex + LigatureCaretByPos LineGap MarkAttachClass MarkAttachmentType NULL + OlderSiblingFontAttribute Panose ParamUILabelNameID RightToLeft + SampleTextNameID TypoAscender TypoDescender TypoLineGap UnicodeRange + UseMarkFilteringSet Vendor VertAdvanceY VertAxis.BaseScriptList + VertAxis.BaseTagList VertAxis.MinMax VertOriginY VertTypoAscender + VertTypoDescender VertTypoLineGap WeightClass WidthClass XHeight + + anchorDef anchor anonymous anon by contour cursive device enumerate + enum exclude_dflt featureNames feature flag from ignore include_dflt + include languagesystem language location lookupflag lookup markClass + mark nameid name parameters position pos required reversesub rsub + script sizemenuname substitute subtable sub table useExtension valueRecordDef winAscent winDescent ) end - identifier = %r/[a-z_][a-z0-9\/_]*/i + identifier = %r/[a-z_][a-z0-9\/_.-]*/i state :root do rule %r/\s+/m, Text::Whitespace @@ -41,17 +47,18 @@ push :featurename end # } ; - rule %r/(\})((?:\s)*)/ do + rule %r/(\})((?:\s))/ do groups Punctuation, Text push :featurename end # solve include( ../path) - rule %r/(include)/i, Keyword, :includepath + rule %r/include\b/i, Keyword, :includepath rule %r/[\-\[\]\/(){},.:;=%*<>']/, Punctuation rule %r/`.*?/, Str::Backtick - rule %r/\"/, Str, :dqs + rule %r/\"/, Str, :strings + rule %r/\\[^.*\s]+/i, Str::Escape # classes, start with @ rule %r/@#{identifier}/, Name::Class @@ -66,6 +73,7 @@ end rule identifier, Name + rule %r/(?:0x|\\)[0-9A-Fa-f]+/, Num::Hex rule %r/-?\d+/, Num::Integer end @@ -77,37 +85,14 @@ rule %r/\s+/, Text::Whitespace rule %r/\)/, Punctuation, :pop! rule %r/\(/, Punctuation - rule %r/[a-z0-9\/_.]*/i, Str + rule %r/[^\s()]+/, Str end state :strings do - rule %r/(\([a-z0-9_]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?/i, Str - end - - state :strings_double do - rule %r/[^\\"%\n]+/, Str - mixin :strings - end - - state :escape do - rule %r(\\ - ( [\\abfnrtv"'] - | \n - | N{[a-zA-z][a-zA-Z ]+[a-zA-Z]} - | u[a-fA-F0-9]{4} - | U[a-fA-F0-9]{8} - | x[a-fA-F0-9]{2} - | [0-7]{1,3} - ) - )x, Str::Escape - end - - state :dqs do rule %r/"/, Str, :pop! - mixin :escape - mixin :strings_double + rule %r/[^"%\n]+/, Str + rule %r/(\([a-z0-9_]+\))?[-#0 +]*([0-9]+|[*])?(\.([0-9]+|[*]))?/i, Str end - end end end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/perl.rb ruby-rouge-3.21.0/lib/rouge/lexers/perl.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/perl.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/perl.rb 2020-07-14 19:56:23.000000000 +0000 @@ -65,7 +65,7 @@ end state :root do - rule %r/#.*?$/, Comment::Single + rule %r/#.*/, Comment::Single rule %r/^=[a-zA-Z0-9]+\s+.*?\n=cut/m, Comment::Multiline rule %r/(?:#{keywords.join('|')})\b/, Keyword @@ -99,6 +99,9 @@ re_tok, :balanced_regex rule %r/\s+/, Text + + rule(/(?=[a-z_]\w*(\s*#.*\n)*\s*=>)/i) { push :fat_comma } + rule %r/(?:#{builtins.join('|')})\b/, Name::Builtin rule %r/((__(DIE|WARN)__)|(DATA|STD(IN|OUT|ERR)))\b/, Name::Builtin::Pseudo @@ -142,6 +145,13 @@ rule %r/.*?\n/, Str::Interpol end + state :fat_comma do + rule %r/#.*/, Comment::Single + rule %r/\w+/, Str + rule %r/\s+/, Text + rule %r/=>/, Operator, :pop! + end + state :name_common do rule %r/\w+::/, Name::Namespace rule %r/[\w:]+/, Name::Variable, :pop! @@ -178,16 +188,24 @@ end state :sq do - rule %r/\\[']/, Str::Escape + rule %r/\\[\\']/, Str::Escape rule %r/[^\\']+/, Str::Single rule %r/'/, Punctuation, :pop! + rule %r/\\/, Str::Single end state :dq do mixin :string_intp - rule %r/\\[\\tnr"]/, Str::Escape + rule %r/\\[\\tnrabefluLUE"$@]/, Str::Escape + rule %r/\\0\d{2}/, Str::Escape + rule %r/\\o\{\d+\}/, Str::Escape + rule %r/\\x\h{2}/, Str::Escape + rule %r/\\x\{\h+\}/, Str::Escape + rule %r/\\c./, Str::Escape + rule %r/\\N\{[^\}]+\}/, Str::Escape rule %r/[^\\"]+?/, Str::Double rule %r/"/, Punctuation, :pop! + rule %r/\\/, Str::Escape end state :bq do diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/powershell.rb ruby-rouge-3.21.0/lib/rouge/lexers/powershell.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/powershell.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/powershell.rb 2020-07-14 19:56:23.000000000 +0000 @@ -165,6 +165,7 @@ end state :parameters do + rule %r/`./m, Str::Escape rule %r/\s*?\n/, Text::Whitespace, :pop! rule %r/[;(){}\]]/, Punctuation, :pop! rule %r/[|=]/, Operator, :pop! @@ -201,7 +202,7 @@ rule %r/(?:#{KEYWORDS})\b(?![-.])/i, Keyword::Reserved rule %r/-{1,2}\w+/, Name::Tag - + rule %r/(\.)?([-\w]+)(\[)/ do |m| groups Operator, Name::Function, Punctuation push :bracket @@ -209,14 +210,15 @@ rule %r/([\/\\~\w][-.:\/\\~\w]*)(\n)?/ do |m| groups Name::Function, Text::Whitespace - push :parameters unless m[2] + push :parameters end rule %r/(\.)?([-\w]+)(?:(\()|(\n))?/ do |m| groups Operator, Name::Function, Punctuation, Text::Whitespace - push :parameters unless m[3] + push :parameters unless m[3].nil? end + rule %r/\?/, Name::Function, :parameters rule %r/[-+*\/%=!.&|]/, Operator rule %r/@\{/, Punctuation, :hasht rule %r/@\(/, Punctuation, :array diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/rego.rb ruby-rouge-3.21.0/lib/rouge/lexers/rego.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/rego.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/rego.rb 2020-07-14 19:56:23.000000000 +0000 @@ -9,36 +9,51 @@ tag 'rego' filenames '*.rego' + def self.constants + @constants ||= Set.new %w( + true false null + ) + end + + def self.operators + @operators ||= Set.new %w( + as default else import not package some with + ) + end + state :basic do rule %r/\s+/, Text rule %r/#.*/, Comment::Single - + rule %r/[\[\](){}|.,;!]/, Punctuation - + rule %r/"[^"]*"/, Str::Double - + rule %r/-?\d+\.\d+([eE][+-]?\d+)?/, Num::Float rule %r/-?\d+([eE][+-]?\d+)?/, Num rule %r/\\u[0-9a-fA-F]{4}/, Num::Hex rule %r/\\["\/bfnrt]/, Str::Escape end - - state :atoms do - rule %r/(true|false|null)/, Keyword::Constant - rule %r/[[:word:]]*/, Str::Symbol - end - + state :operators do rule %r/(=|!=|>=|<=|>|<|\+|-|\*|%|\/|\||&|:=)/, Operator - rule %r/(default|not|package|import|as|with|else|some)/, Operator rule %r/[\/:?@^~]+/, Operator end - + state :root do mixin :basic mixin :operators - mixin :atoms + + rule %r/[[:word:]]+/ do |m| + if self.class.constants.include? m[0] + token Keyword::Constant + elsif self.class.operators.include? m[0] + token Operator::Word + else + token Name + end + end end end end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/sass/common.rb ruby-rouge-3.21.0/lib/rouge/lexers/sass/common.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/sass/common.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/sass/common.rb 2020-07-14 19:56:23.000000000 +0000 @@ -29,6 +29,7 @@ end rule %r/@#{id}/, Keyword, :selector + rule %r/&/, Keyword, :selector # $variable: assignment rule %r/([$]#{id})([ \t]*)(:)/ do diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/ssh.rb ruby-rouge-3.21.0/lib/rouge/lexers/ssh.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/ssh.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/ssh.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +module Rouge + module Lexers + class SSH < RegexLexer + tag 'ssh' + + title "SSH Config File" + desc 'A lexer for SSH configuration files' + filenames 'ssh_config' + + state :root do + rule %r/[a-z0-9]+/i, Keyword, :statement + mixin :base + end + + state :statement do + rule %r/\n/, Text, :pop! + rule %r/(?:yes|no|confirm|ask|always|auto|none|force)\b/, Name::Constant + + rule %r/\d+/, Num + rule %r/[^#\s;{}$\\]+/, Text + mixin :base + end + + state :base do + rule %r/\s+/, Text + rule %r/#.*/, Comment::Single + end + end + end +end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/tsx.rb ruby-rouge-3.21.0/lib/rouge/lexers/tsx.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/tsx.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/tsx.rb 2020-07-14 19:56:23.000000000 +0000 @@ -7,13 +7,20 @@ load_lexer 'typescript/common.rb' class TSX < JSX - include TypescriptCommon + extend TypescriptCommon - title 'TypeScript' - desc 'tsx' + title 'TSX' + desc 'TypeScript-compatible JSX (www.typescriptlang.org/docs/handbook/jsx.html)' tag 'tsx' filenames '*.tsx' + + prepend :element_name do + rule %r/(\w+)(,)/ do + groups Name::Other, Punctuation + pop! 3 + end + end end end end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/twig.rb ruby-rouge-3.21.0/lib/rouge/lexers/twig.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/twig.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/twig.rb 2020-07-14 19:56:23.000000000 +0000 @@ -17,10 +17,10 @@ def self.keywords @@keywords ||= %w(as do extends flush from import include use else starts - ends with without autoescape endautoescape block endblock - embed endembed filter endfilter for endfor if endif - macro endmacro sandbox endsandbox set endset - spaceless endspaceless verbatim endverbatim) + ends with without autoescape endautoescape block + endblock embed endembed filter endfilter for endfor + if endif macro endmacro sandbox endsandbox set endset + spaceless endspaceless) end def self.tests diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/typescript/common.rb ruby-rouge-3.21.0/lib/rouge/lexers/typescript/common.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/typescript/common.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/typescript/common.rb 2020-07-14 19:56:23.000000000 +0000 @@ -4,31 +4,45 @@ module Rouge module Lexers module TypescriptCommon - def self.keywords + def keywords @keywords ||= super + Set.new(%w( is namespace static private protected public implements readonly )) end - def self.declarations + def declarations @declarations ||= super + Set.new(%w( type abstract )) end - def self.reserved + def reserved @reserved ||= super + Set.new(%w( string any void number namespace module declare default interface keyof )) end - def self.builtins + def builtins @builtins ||= super + %w( Pick Partial Readonly Record ) end + + def self.extended(base) + base.prepend :root do + rule %r/[?][.]/, base::Punctuation + rule %r/[?]{2}/, base::Operator + end + + base.prepend :statement do + rule %r/(#{Javascript.id_regex})(\??)(\s*)(:)/ do + groups base::Name::Label, base::Punctuation, base::Text, base::Punctuation + push :expr_start + end + end + end end end end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/typescript.rb ruby-rouge-3.21.0/lib/rouge/lexers/typescript.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/typescript.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/typescript.rb 2020-07-14 19:56:23.000000000 +0000 @@ -7,7 +7,7 @@ load_lexer 'typescript/common.rb' class Typescript < Javascript - include TypescriptCommon + extend TypescriptCommon title "TypeScript" desc "TypeScript, a superset of JavaScript" @@ -18,17 +18,6 @@ filenames '*.ts', '*.d.ts' mimetypes 'text/typescript' - - prepend :root do - rule %r/[?][.]/, Punctuation - end - - prepend :statement do - rule %r/(#{Javascript.id_regex})(\??)(\s*)(:)/ do - groups Name::Label, Punctuation, Text, Punctuation - push :expr_start - end - end end end end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/velocity.rb ruby-rouge-3.21.0/lib/rouge/lexers/velocity.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/velocity.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/velocity.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- # + +module Rouge + module Lexers + class Velocity < TemplateLexer + title 'Velocity' + desc 'Velocity is a Java-based template engine (velocity.apache.org)' + tag 'velocity' + filenames '*.vm', '*.velocity', '*.fhtml' + mimetypes 'text/html+velocity' + + id = /[a-z_]\w*/i + + state :root do + rule %r/[^{#$]+/ do + delegate parent + end + + rule %r/(#)(\*.*?\*)(#)/m, Comment::Multiline + rule %r/(##)(.*?$)/, Comment::Single + + rule %r/(#\{?)(#{id})(\}?)(\s?\()/m do + groups Punctuation, Name::Function, Punctuation, Punctuation + push :directive_params + end + + rule %r/(#\{?)(#{id})(\}|\b)/m do + groups Punctuation, Name::Function, Punctuation + end + + rule %r/\$\{?/, Punctuation, :variable + end + + state :variable do + rule %r/#{id}/, Name::Variable + rule %r/\(/, Punctuation, :func_params + rule %r/(\.)(#{id})/ do + groups Punctuation, Name::Variable + end + rule %r/\}/, Punctuation, :pop! + rule(//) { pop! } + end + + state :directive_params do + rule %r/(&&|\|\||==?|!=?|[-<>+*%&|^\/])|\b(eq|ne|gt|lt|ge|le|not|in)\b/, Operator + rule %r/\[/, Operator, :range_operator + rule %r/\b#{id}\b/, Name::Function + mixin :func_params + end + + state :range_operator do + rule %r/[.]{2}/, Operator + mixin :func_params + rule %r/\]/, Operator, :pop! + end + + state :func_params do + rule %r/\$\{?/, Punctuation, :variable + rule %r/\s+/, Text + rule %r/,/, Punctuation + rule %r/"(\\\\|\\"|[^"])*"/, Str::Double + rule %r/'(\\\\|\\'|[^'])*'/, Str::Single + rule %r/0[xX][0-9a-fA-F]+[Ll]?/, Num::Hex + rule %r/\b[0-9]+\b/, Num::Integer + rule %r/(true|false|null)\b/, Keyword::Constant + rule %r/[(\[]/, Punctuation, :push! + rule %r/[)\]}]/, Punctuation, :pop! + end + end + end +end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/xml.rb ruby-rouge-3.21.0/lib/rouge/lexers/xml.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/xml.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/xml.rb 2020-07-14 19:56:23.000000000 +0000 @@ -12,6 +12,8 @@ mimetypes 'text/xml', 'application/xml', 'image/svg+xml', 'application/rss+xml', 'application/atom+xml' + # Documentation: https://www.w3.org/TR/xml11/#charsets and https://www.w3.org/TR/xml11/#sec-suggested-names + def self.detect?(text) return false if text.doctype?(/html/) return true if text =~ /\A<\?xml\b/ @@ -27,10 +29,10 @@ rule %r/]*>/, Comment::Preproc # open tags - rule %r(<\s*[\w:.-]+)m, Name::Tag, :tag + rule %r(<\s*[\p{L}:_][\p{Word}\p{Cf}:.·-]*)m, Name::Tag, :tag # self-closing tags - rule %r(<\s*/\s*[\w:.-]+\s*>)m, Name::Tag + rule %r(<\s*/\s*[\p{L}:_][\p{Word}\p{Cf}:.·-]*\s*>)m, Name::Tag end state :comment do @@ -41,7 +43,7 @@ state :tag do rule %r/\s+/m, Text - rule %r/[\w.:-]+\s*=/m, Name::Attribute, :attr + rule %r/[\p{L}:_][\p{Word}\p{Cf}:.·-]*\s*=/m, Name::Attribute, :attr rule %r(/?\s*>), Name::Tag, :pop! end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/yaml.rb ruby-rouge-3.21.0/lib/rouge/lexers/yaml.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/yaml.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/yaml.rb 2020-07-14 19:56:23.000000000 +0000 @@ -11,6 +11,8 @@ aliases 'yml' filenames '*.yaml', '*.yml' + # Documentation: https://yaml.org/spec/1.2/spec.html + def self.detect?(text) # look for the %YAML directive return true if text =~ /\A\s*%YAML/m @@ -165,15 +167,15 @@ )x, Keyword::Type # an anchor - rule %r/&[\w-]+/, Name::Label + rule %r/&[\p{L}\p{Nl}\p{Nd}_-]+/, Name::Label # an alias - rule %r/\*[\w-]+/, Name::Variable + rule %r/\*[\p{L}\p{Nl}\p{Nd}_-]+/, Name::Variable end state :block_nodes do # implicit key - rule %r/((?:\w[\w -]*)?)(:)(?=\s|$)/ do |m| + rule %r/((?:[\p{L}\p{Nl}\p{Nd}_][\p{L}\p{Nl}\p{Nd}\p{Blank}_-]*)?)(:)(?=\s|$)/ do |m| groups Name::Attribute, Punctuation::Indicator set_indent m[0], :implicit => true end diff -Nru ruby-rouge-3.19.0/lib/rouge/lexers/zig.rb ruby-rouge-3.21.0/lib/rouge/lexers/zig.rb --- ruby-rouge-3.19.0/lib/rouge/lexers/zig.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/lexers/zig.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,139 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +module Rouge + module Lexers + class Zig < RegexLexer + tag 'zig' + aliases 'zir' + filenames '*.zig' + mimetypes 'text/x-zig' + + title 'Zig' + desc 'The Zig programming language (ziglang.org)' + + def self.keywords + @keywords ||= %w( + align linksection threadlocal struct enum union error break return + anyframe fn c_longlong c_ulonglong c_longdouble c_void comptime_float + c_short c_ushort c_int c_uint c_long c_ulong continue asm defer + errdefer const var extern packed export pub if else switch and or + orelse while for bool unreachable try catch async suspend nosuspend + await resume undefined usingnamespace test void noreturn type + anyerror usize noalias inline noinline comptime callconv volatile + allowzero + ) + end + + def self.builtins + @builtins ||= %w( + @addWithOverflow @as @atomicLoad @atomicStore @bitCast @breakpoint + @alignCast @alignOf @cDefine @cImport @cInclude @bitOffsetOf + @atomicRmw @bytesToSlice @byteOffsetOf @OpaqueType @panic @ptrCast + @bitReverse @Vector @sin @cUndef @canImplicitCast @clz @cmpxchgWeak + @cmpxchgStrong @compileError @compileLog @ctz @popCount @divExact + @divFloor @cos @divTrunc @embedFile @export @tagName @TagType + @errorName @call @errorReturnTrace @fence @fieldParentPtr @field + @unionInit @errorToInt @intToEnum @enumToInt @setAlignStack @frame + @Frame @exp @exp2 @log @log2 @log10 @fabs @floor @ceil @trunc @round + @floatCast @intToFloat @floatToInt @boolToInt @errSetCast @intToError + @frameAddress @import @newStackCall @asyncCall @intToPtr @intCast + @frameSize @memcpy @memset @mod @mulWithOverflow @splat @ptrToInt + @rem @returnAddress @setCold @Type @shuffle @setGlobalLinkage + @setGlobalSection @shlExact @This @hasDecl @hasField + @setRuntimeSafety @setEvalBranchQuota @setFloatMode @shlWithOverflow + @shrExact @sizeOf @bitSizeOf @sqrt @byteSwap @subWithOverflow + @sliceToBytes comptime_int @truncate @typeInfo @typeName @TypeOf + ) + end + + id = /[a-z_]\w*/i + escapes = /\\ ([nrt'"\\0] | x\h{2} | u\h{4} | U\h{8})/x + + state :bol do + mixin :whitespace + rule %r/#\s[^\n]*/, Comment::Special + rule(//) { pop! } + end + + state :attribute do + mixin :whitespace + mixin :literals + rule %r/[(,)=:]/, Name::Decorator + rule %r/\]/, Name::Decorator, :pop! + rule id, Name::Decorator + end + + state :whitespace do + rule %r/\s+/, Text + rule %r(//[^\n]*), Comment + end + + state :root do + rule %r/\n/, Text, :bol + + mixin :whitespace + + rule %r/\b(?:(i|u)[0-9]+)\b/, Keyword::Type + rule %r/\b(?:f(16|32|64|128))\b/, Keyword::Type + rule %r/\b(?:(isize|usize))\b/, Keyword::Type + + mixin :literals + + rule %r/'#{id}/, Name::Variable + rule %r/([.]?)(\s*)(@?#{id})(\s*)([(]?)/ do |m| + name = m[3] + t = if self.class.keywords.include? name + Keyword + elsif self.class.builtins.include? name + Name::Builtin + elsif !m[1].empty? && !m[5].empty? + Name::Function + elsif !m[1].empty? + Name::Property + else + Name + end + + groups Punctuation, Text, t, Text, Punctuation + end + + rule %r/[()\[\]{}|,:;]/, Punctuation + rule %r/[*\/!@~&+%^<>=\?-]|\.{1,3}/, Operator + end + + state :literals do + rule %r/\b(?:true|false|null)\b/, Keyword::Constant + rule %r( + ' (?: #{escapes} | [^\\] ) ' + )x, Str::Char + + rule %r/"/, Str, :string + rule %r/r(#*)".*?"\1/m, Str + + dot = /[.][0-9_]+/ + exp = /e[-+]?[0-9_]+/ + + rule %r( + [0-9]+ + (#{dot} #{exp}? + |#{dot}? #{exp} + ) + )x, Num::Float + + rule %r( + ( 0b[10_]+ + | 0x[0-9a-fA-F_]+ + | [0-9_]+ + ) + )x, Num::Integer + end + + state :string do + rule %r/"/, Str, :pop! + rule escapes, Str::Escape + rule %r/[^"\\]+/m, Str + end + end + end +end diff -Nru ruby-rouge-3.19.0/lib/rouge/version.rb ruby-rouge-3.21.0/lib/rouge/version.rb --- ruby-rouge-3.19.0/lib/rouge/version.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/lib/rouge/version.rb 2020-07-14 19:56:23.000000000 +0000 @@ -3,6 +3,6 @@ module Rouge def self.version - "3.19.0" + "3.21.0" end end diff -Nru ruby-rouge-3.19.0/spec/lexers/augeas_spec.rb ruby-rouge-3.21.0/spec/lexers/augeas_spec.rb --- ruby-rouge-3.19.0/spec/lexers/augeas_spec.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/lexers/augeas_spec.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +describe Rouge::Lexers::Augeas do + let(:subject) { Rouge::Lexers::Augeas.new } + + describe 'guessing' do + include Support::Guessing + + it 'guesses by filename' do + assert_guess :filename => 'foo.aug' + end + + it 'guess by mimetype' do + assert_guess :mimetype => 'text/x-augeas' + end + end +end + diff -Nru ruby-rouge-3.19.0/spec/lexers/bibtex_spec.rb ruby-rouge-3.21.0/spec/lexers/bibtex_spec.rb --- ruby-rouge-3.19.0/spec/lexers/bibtex_spec.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/lexers/bibtex_spec.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,15 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +describe Rouge::Lexers::BibTeX do + let(:subject) { Rouge::Lexers::BibTeX.new } + + describe 'guessing' do + include Support::Guessing + + it 'guesses by filename' do + assert_guess :filename => 'foo.bib' + end + end +end + diff -Nru ruby-rouge-3.19.0/spec/lexers/brightscript_spec.rb ruby-rouge-3.21.0/spec/lexers/brightscript_spec.rb --- ruby-rouge-3.19.0/spec/lexers/brightscript_spec.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/lexers/brightscript_spec.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,14 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +describe Rouge::Lexers::Brightscript do + let(:subject) { Rouge::Lexers::Brightscript.new } + + describe 'guessing' do + include Support::Guessing + + it 'guesses by filename' do + assert_guess :filename => 'foo.brs' + end + end +end diff -Nru ruby-rouge-3.19.0/spec/lexers/diff_spec.rb ruby-rouge-3.21.0/spec/lexers/diff_spec.rb --- ruby-rouge-3.19.0/spec/lexers/diff_spec.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/lexers/diff_spec.rb 2020-07-14 19:56:23.000000000 +0000 @@ -46,5 +46,17 @@ load load_dir.join('rouge/lexers/text.rb') source end + + it 'does not detect invalid diff-like sources' do + deny_guess :source => <<-source +---4 +---2 + source + + deny_guess :source => <<-source ++++4 ++++2 + source + end end end diff -Nru ruby-rouge-3.19.0/spec/lexers/docker_spec.rb ruby-rouge-3.21.0/spec/lexers/docker_spec.rb --- ruby-rouge-3.19.0/spec/lexers/docker_spec.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/lexers/docker_spec.rb 2020-07-14 19:56:23.000000000 +0000 @@ -11,7 +11,6 @@ assert_guess :filename => 'Dockerfile' assert_guess :filename => 'docker.docker' assert_guess :filename => 'some.Dockerfile' - assert_guess :filename => 'Dockerfile_some_extension' end it 'guesses by mimetype' do diff -Nru ruby-rouge-3.19.0/spec/lexers/hlsl_spec.rb ruby-rouge-3.21.0/spec/lexers/hlsl_spec.rb --- ruby-rouge-3.19.0/spec/lexers/hlsl_spec.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/lexers/hlsl_spec.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +describe Rouge::Lexers::HLSL do + let(:subject) { Rouge::Lexers::HLSL.new } + + describe 'guessing' do + include Support::Guessing + + it 'guesses by filename' do + assert_guess :filename => 'foo.hlsl' + assert_guess :filename => 'foo.hlsli' + end + + it 'guesses by mimetype' do + assert_guess :mimetype => 'text/x-hlsl' + end + end +end diff -Nru ruby-rouge-3.19.0/spec/lexers/html_spec.rb ruby-rouge-3.21.0/spec/lexers/html_spec.rb --- ruby-rouge-3.19.0/spec/lexers/html_spec.rb 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/lexers/html_spec.rb 2020-07-14 19:56:23.000000000 +0000 @@ -65,6 +65,7 @@ assert_guess :filename => 'foo.html' assert_guess :filename => 'foo.htm' assert_guess :filename => 'foo.xhtml' + assert_guess :filename => 'foo.cshtml' end it 'guesses by mimetype' do diff -Nru ruby-rouge-3.19.0/spec/lexers/janet_spec.rb ruby-rouge-3.21.0/spec/lexers/janet_spec.rb --- ruby-rouge-3.19.0/spec/lexers/janet_spec.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/lexers/janet_spec.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +describe Rouge::Lexers::Janet do + let(:subject) { Rouge::Lexers::Janet.new } + + describe 'guessing' do + include Support::Guessing + + it 'guesses by filename' do + assert_guess :filename => 'foo.janet' + assert_guess :filename => 'foo.jdn' + end + + it 'guesses by mimetype' do + assert_guess :mimetype => 'text/x-janet' + assert_guess :mimetype => 'application/x-janet' + end + end +end diff -Nru ruby-rouge-3.19.0/spec/lexers/livescript_spec.rb ruby-rouge-3.21.0/spec/lexers/livescript_spec.rb --- ruby-rouge-3.19.0/spec/lexers/livescript_spec.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/lexers/livescript_spec.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +describe Rouge::Lexers::Livescript do + let(:subject) { Rouge::Lexers::Livescript.new } + + describe 'guessing' do + include Support::Guessing + + it 'guesses by filename' do + assert_guess :filename => 'foo.ls' + end + + it 'guesses by mimetype' do + assert_guess :mimetype => 'text/livescript' + end + + it 'guesses by source' do + assert_guess :source => '#!/usr/bin/env lsc' + end + end +end diff -Nru ruby-rouge-3.19.0/spec/lexers/ssh_spec.rb ruby-rouge-3.21.0/spec/lexers/ssh_spec.rb --- ruby-rouge-3.19.0/spec/lexers/ssh_spec.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/lexers/ssh_spec.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +describe Rouge::Lexers::SSH do + let(:subject) { Rouge::Lexers::SSH.new } + + describe 'lexing' do + include Support::Lexing + + it 'lexes a specification' do + example = 'Host example + Hostname www.example.com + Port 1234 + Tunnel no' + + assert_tokens_equal example, ["Keyword", "Host"], + ["Text", " example\n "], + ["Keyword", "Hostname"], + ["Text", " www.example.com\n "], + ["Keyword", "Port"], + ["Text", " "], + ["Literal.Number", "1234"], + ["Text", "\n "], + ["Keyword", "Tunnel"], + ["Text", " "], + ["Name.Constant", "no"] + end + end + + describe 'guessing' do + include Support::Guessing + + it 'guesses by filename' do + assert_guess :filename => '/etc/ssh_config' + end + end +end diff -Nru ruby-rouge-3.19.0/spec/lexers/velocity_spec.rb ruby-rouge-3.21.0/spec/lexers/velocity_spec.rb --- ruby-rouge-3.19.0/spec/lexers/velocity_spec.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/lexers/velocity_spec.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- # + +describe Rouge::Lexers::Velocity do + let(:subject) { Rouge::Lexers::Velocity.new } + + describe 'guessing' do + include Support::Guessing + + it 'guesses by filename' do + assert_guess :filename => 'foo.velocity' + assert_guess :filename => 'foo.vm' + assert_guess :filename => 'foo.fhtml' + end + + it 'guesses by mimetype' do + assert_guess :mimetype => 'text/html+velocity' + end + end +end diff -Nru ruby-rouge-3.19.0/spec/lexers/zig_spec.rb ruby-rouge-3.21.0/spec/lexers/zig_spec.rb --- ruby-rouge-3.19.0/spec/lexers/zig_spec.rb 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/lexers/zig_spec.rb 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- # +# frozen_string_literal: true + +describe Rouge::Lexers::Zig do + let(:subject) { Rouge::Lexers::Zig.new } + + describe 'guessing' do + include Support::Guessing + + it 'guesses by filename' do + assert_guess :filename => 'foo.zig' + end + + it 'guesses by mimetype' do + assert_guess :mimetype => 'text/x-zig' + end + end + + describe 'lexing' do + include Support::Lexing; + + it 'classifies identifiers' do + assert_tokens_equal 'var x: i32 = 100;', + ['Keyword', 'var'], + ['Text', ' '], + ['Name', 'x'], + ['Punctuation', ':'], + ['Text', ' '], + ['Keyword.Type', 'i32'], + ['Text', ' '], + ['Operator', '='], + ['Text', ' '], + ['Literal.Number.Integer', '100'], + ['Punctuation', ';'] + + assert_tokens_equal 'var x: f32 = 1.01;', + ['Keyword', 'var'], + ['Text', ' '], + ['Name', 'x'], + ['Punctuation', ':'], + ['Text', ' '], + ['Keyword.Type', 'f32'], + ['Text', ' '], + ['Operator', '='], + ['Text', ' '], + ['Literal.Number.Float', '1.01'], + ['Punctuation', ';'] + end + + it 'recognizes exponents in integers and reals' do + assert_tokens_equal '1e6', ['Literal.Number.Float', '1e6'] + assert_tokens_equal '123_456', ['Literal.Number.Integer', '123_456'] + assert_tokens_equal '3.14159_26', ['Literal.Number.Float', '3.14159_26'] + assert_tokens_equal '3.141_592e-20', ['Literal.Number.Float', '3.141_592e-20'] + end + end +end diff -Nru ruby-rouge-3.19.0/spec/visual/samples/augeas ruby-rouge-3.21.0/spec/visual/samples/augeas --- ruby-rouge-3.19.0/spec/visual/samples/augeas 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/augeas 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,32 @@ +(* +Multiline +Comment +*) + +module Example = + autoload xfm + +let eol = Util.eol +let sep_spc = Sep.space +let sep_cont = Sep.cl_or_space + +let sep_cont_opt_build (sep:string) = + del (Rx.cl_or_opt_space . sep . Rx.cl_or_opt_space) (" " . sep . " ") + +let negate_or_value (key:lens) (value:lens) = + [ del_negate . (negate_node . key | key . value) ] + +let del_negate = del /(!!)*/ "" + +let sto_to_com_cmnd = del_negate . negate_node? . ( + let alias = Rx.word - /(NO)?(PASSWD|EXEC|SETENV)/ + in let non_alias = /[\/a-z]([^,:#()\n\\]|\\\\[=:,\\])*[^,=:#() \t\n\\]|[^,=:#() \t\n\\]/ + in store (alias | non_alias)) + +let filter = (incl "/etc/sudoers") + . (incl "/usr/local/etc/sudoers") + . (incl "/etc/sudoers.d/*") + . (incl "/usr/local/etc/sudoers.d/*") + . (incl "/opt/csw/etc/sudoers") + . (incl "/etc/opt/csw/sudoers") + . Util.stdexcl diff -Nru ruby-rouge-3.19.0/spec/visual/samples/batchfile ruby-rouge-3.21.0/spec/visual/samples/batchfile --- ruby-rouge-3.19.0/spec/visual/samples/batchfile 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/batchfile 2020-07-14 19:56:23.000000000 +0000 @@ -11,6 +11,7 @@ set /p "=qwerty." < nul echo %~dp0 rem all okay +@rem "sample" :: this is an empty label attrib.exe +r file.txt 2>nul for /f "tokens=1" %%a in ('echo hello %username% hi ^'') do echo %%~a diff -Nru ruby-rouge-3.19.0/spec/visual/samples/bibtex ruby-rouge-3.21.0/spec/visual/samples/bibtex --- ruby-rouge-3.19.0/spec/visual/samples/bibtex 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/bibtex 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,68 @@ +%%% Bibtex comment + +@inproceedings{DBLP:conf/pldi/PadhiSM16, + author = {Saswat Padhi and + Rahul Sharma and + Todd D. Millstein}, + title = {Data-driven precondition inference with learned features}, + booktitle = {Proceedings of the 37th {ACM} {SIGPLAN} Conference on Programming + Language Design and Implementation, {PLDI} 2016, Santa Barbara, CA, + USA, June 13-17, 2016}, + pages = {42--56}, + year = {2016}, + crossref = {DBLP:conf/pldi/2016}, + url = {https://doi.org/10.1145/2908080.2908099}, + doi = {10.1145/2908080.2908099}, + timestamp = {Tue, 06 Nov 2018 16:59:30 +0100}, + biburl = {https://dblp.org/rec/bib/conf/pldi/PadhiSM16}, + bibsource = {dblp computer science bibliography, https://dblp.org} +} + +@article{article, + author = {Peter Adams}, + title = {The title of the work}, + journal = {The name of the journal}, + year = 1993, + number = 2, + pages = {201-213}, + month = 7, + note = {An optional note}, + volume = 4 +} + +@MISC{WEBSITE:1, + HOWPUBLISHED = "\url{http://example.com}", + AUTHOR = "Intel", + TITLE = "Example Website", + MONTH = "Dec", + YEAR = "1988", + NOTE = "Accessed on 2012-11-11" +} + +@STRING(PRL="Phys. Rev. Lett.") +@STRING(RMP="Rev. Mod. Phys.") + +@ARTICLE{klitzing:nobel, + AUTHOR="Klaus von Klitzing", + TITLE="The Quantised Hall Effect", + JOURNAL=RMP, + VOLUME=58, + PAGES=519, + YEAR=1986 +} + +@preamble{ "\newcommand{\mytext}{Last accessed:}" } + +@ARTICLE{knuth:1974, + author = {Knuth, Donald E.}, + title = {{C}omputer {P}rogramming as an {A}rt}, + journal = {Communications of the ACM}, + year = {1974}, + volume = {17}, + pages = {667--673}, + number = {12}, + month = {December }, + address = {New York, NY, USA}, + publisher = {ACM Press}, + note = {\mytext{} 09/20/12} +} diff -Nru ruby-rouge-3.19.0/spec/visual/samples/brightscript ruby-rouge-3.21.0/spec/visual/samples/brightscript --- ruby-rouge-3.19.0/spec/visual/samples/brightscript 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/brightscript 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,34 @@ +REM main function +function main(args as dynamic) as void + print "main function" + + screen = CreateObject("roSGScreen") + m.port = CreateObject("roMessagePort") + screen.setMessagePort(m.port) + + state = createInitialState(screen) + + scene = screen.CreateScene("HelloWorld") + screen.show() + + ' event loop + while(true) + msg = wait(0, m.port) + msgType = type(msg) + if msgType = "roSGScreenEvent" + if msg.isScreenClosed() then return + end if + end while +end function + +function createInitialState(screen as object) as object + initialState = createObject("roSGNode","ContentNode") + initialStateFields = { + currentScreen: { + screenType: screenType().HOME_SCREEN, + } + } + + initialState.addFields(initialStateFields) + return createStore(initialState, screen) +end function \ No newline at end of file diff -Nru ruby-rouge-3.19.0/spec/visual/samples/cpp ruby-rouge-3.21.0/spec/visual/samples/cpp --- ruby-rouge-3.19.0/spec/visual/samples/cpp 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/cpp 2020-07-14 19:56:23.000000000 +0000 @@ -60,7 +60,7 @@ // strongly typed enums enum class Day { - Mon, Tue, Wed, Thur, Fri, Sat, Sun + Mon, Tue, Wed, Thur, Fri, Sat, Sun }; Day today = Day::Mon; @@ -81,11 +81,11 @@ // templates namespace N { - template - class Y // template definition - { - void mf() { } - }; + template + class Y // template definition + { + void mf() { } + }; } template class N::Y; template void N::Y::mf(); @@ -93,26 +93,29 @@ template concept C1 = sizeof(T) != sizeof(int); template struct S1 { }; template using Ptr = T*; +template +template struct Tuple { }; +template void f(Ts...) {} // variadic template template void forward_args(F f, Args... args) { - f(std::forward(args)...); + f(std::forward(args)...); } // namespace namespace printing { - inline namespace latest { - using std::cout; - void print() { - cout << "Latest print\n"; - } - } - namespace old { - void print() { - ::printf("Old print\n"); - } - } + inline namespace latest { + using std::cout; + void print() { + cout << "Latest print\n"; + } + } + namespace old { + void print() { + ::printf("Old print\n"); + } + } } printing::print(); printing::latest::print(); @@ -125,47 +128,47 @@ [[deprecated("useless")]] void doNothing() {} namespace std { - class thread { - public: - // types: - class id; - typedef void *native_handle_type; - - // construct/copy/destroy: - thread() noexcept; - template explicit thread(F&& f, Args&&... args); - ~thread(); - thread(const thread&) = delete; - thread(thread&&) noexcept; - thread& operator=(const thread&) = delete; - thread& operator=(thread&&) noexcept; - - // members: - void swap(thread&) noexcept; - bool joinable() const noexcept; - void join(); - void detach(); - id get_id() const noexcept; - native_handle_type native_handle(); - - // static members: - static unsigned hardware_concurrency() noexcept; - }; + class thread { + public: + // types: + class id; + typedef void *native_handle_type; + + // construct/copy/destroy: + thread() noexcept; + template explicit thread(F&& f, Args&&... args); + ~thread(); + thread(const thread&) = delete; + thread(thread&&) noexcept; + thread& operator=(const thread&) = delete; + thread& operator=(thread&&) noexcept; + + // members: + void swap(thread&) noexcept; + bool joinable() const noexcept; + void join(); + void detach(); + id get_id() const noexcept; + native_handle_type native_handle(); + + // static members: + static unsigned hardware_concurrency() noexcept; + }; } // try-block try { - throw std::runtime_error("Runtime error!"); + throw std::runtime_error("Runtime error!"); } catch (std::exception& e) { - std::cerr << e.what() << std::endl; + std::cerr << e.what() << std::endl; } constexpr int factorial(int n) { - return n > 0 ? n * factorial(n - 1) : 1; + return n > 0 ? n * factorial(n - 1) : 1; } /* foo */ #if 0 - this is commented + this is commented #endif /* it shouldn't hang */ /* trying to lex this */ @@ -190,22 +193,22 @@ class Base { public: - Base () = default; - virtual ~Base () = default; + Base () = default; + virtual ~Base () = default; - virtual void foo () = 0; + virtual void foo () = 0; }; class Derived final : public Base { public: - Derived () = default; - virtual ~Derived () = default; + Derived () = default; + virtual ~Derived () = default; - virtual void foo () override - { - auto a = 1 + 2; - } + virtual void foo () override + { + auto a = 1 + 2; + } }; #define foo bar @@ -213,31 +216,36 @@ class Highlighter : public QSyntaxHighlighter { - class InnerClass {} + class InnerClass {} - Q_OBJECT + Q_OBJECT public: - Highlighter(QTextDocument *parent = 0); + Highlighter(QTextDocument *parent = 0); protected: - void highlightBlock(const QString &text); + void highlightBlock(const QString &text); private: - struct HighlightingRule - { - QRegExp pattern; - QTextCharFormat format; - }; - QVector highlightingRules; - - QRegExp commentStartExpression; - QRegExp commentEndExpression; - - QTextCharFormat keywordFormat; - QTextCharFormat classFormat; - QTextCharFormat singleLineCommentFormat; - QTextCharFormat multiLineCommentFormat; - QTextCharFormat quotationFormat; - QTextCharFormat functionFormat; + struct HighlightingRule + { + QRegExp pattern; + QTextCharFormat format; + }; + QVector highlightingRules; + + QRegExp commentStartExpression; + QRegExp commentEndExpression; + + QTextCharFormat keywordFormat; + QTextCharFormat classFormat; + QTextCharFormat singleLineCommentFormat; + QTextCharFormat multiLineCommentFormat; + QTextCharFormat quotationFormat; + QTextCharFormat functionFormat; }; + +switch (foo) { + case Foo::kBar: + break; +} diff -Nru ruby-rouge-3.19.0/spec/visual/samples/css ruby-rouge-3.21.0/spec/visual/samples/css --- ruby-rouge-3.19.0/spec/visual/samples/css 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/css 2020-07-14 19:56:23.000000000 +0000 @@ -69,6 +69,11 @@ font-size: 29px ! important; } -a[target="_blank"] { +a[target="_blank"] { background-color: yellow; } + +/* Unicode example */ +œuvre 书名[语言="français"] { + color: blue; +} diff -Nru ruby-rouge-3.19.0/spec/visual/samples/haskell ruby-rouge-3.21.0/spec/visual/samples/haskell --- ruby-rouge-3.19.0/spec/visual/samples/haskell 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/haskell 2020-07-14 19:56:23.000000000 +0000 @@ -399,3 +399,5 @@ are part of the quotation |] + +[ H.label [ H.for' hName, H.class' "col-sm-2 col-form-label" ] [ text msg ] diff -Nru ruby-rouge-3.19.0/spec/visual/samples/hlsl ruby-rouge-3.21.0/spec/visual/samples/hlsl --- ruby-rouge-3.19.0/spec/visual/samples/hlsl 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/hlsl 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,38 @@ +// Data for each pixel +struct PSInput +{ + float4 position : SV_POSITION; + float4 color : COLOR; + float2 uv : TEXCOORD; +}; + +// Creates a gradient between four colors +float4 FourColorGradient(float4 color1, float4 color2, float4 color3, float4 color4, float2 uv) +{ + return lerp(lerp(color1, color2, uv.y), lerp(color3, color4, uv.y), uv.x); +} + +// Vertex shader +PSInput VSMain(float4 position : POSITION, float4 color : COLOR, float4 uv : TEXCOORD) +{ + PSInput result; + + result.position = position; + result.color = color; + result.uv = uv.xy; + + return result; +} + +/* +* Pixel Shader, entry point into this shader +*/ +float4 PSMain(PSInput input) : SV_TARGET +{ + const float4 _Color1 = float4(1,.5,.5,1); + const float4 _Color2 = float4(0.5,1,0,1); + const float4 _Color3 = float4(0,1,1,1); + const float4 _Color4 = float4(1,0,1,1); + float4 gradient = FourColorGradient(_Color1, _Color2, _Color3, _Color4, input.uv); + return input.color * gradient; +} diff -Nru ruby-rouge-3.19.0/spec/visual/samples/html ruby-rouge-3.21.0/spec/visual/samples/html --- ruby-rouge-3.19.0/spec/visual/samples/html 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/html 2020-07-14 19:56:23.000000000 +0000 @@ -54,3 +54,8 @@ + + +<œuvre> + <书名 语言="français">Les Misérables + diff -Nru ruby-rouge-3.19.0/spec/visual/samples/janet ruby-rouge-3.21.0/spec/visual/samples/janet --- ruby-rouge-3.19.0/spec/visual/samples/janet 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/janet 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,139 @@ +# Constants +nil +true +false + +# Symbols +symbol +kebab-case-symbol +snake_case_symbol +my-module/my-fuction +***** +!%$^*__--__._+++===~-crazy-symbol +*global-var* +你好 +symbols:with:colons +_ + +# Keywords +:keyword +:range +:0x0x0x0 +:a-keyword +:: +: + +# Numbers +0 ++0.0 +-10_000 +16r1234abcd +0x23.23 +1e10 +1.6e-4 +7r343_111_266.6&+10 + +# Strings +"This is a string." +"This\nis\na\nstring." +"\u004a" +"\U01F5DD" +"This +is +a +string." +`` +This +is +a +string +`` +` +This is +a string. +` + +# Buffers +@"" +@"Buffer." +@``Another buffer`` +@` +Yet another buffer +` + +# Tuples +(do 1 2 3) +[do 1 2 3] + +# Arrays +@(:one :two :three) +@[:one :two :three] + +# Structs +{} +{:key1 "value1" :key2 :value2 :key3 3} +{(1 2 3) (4 5 6)} +{@[] @[]} +{1 2 3 4 5 6} + +# Tables +@{} +@{:key1 "value1" :key2 :value2 :key3 3} +@{(1 2 3) (4 5 6)} +@{@[] @[]} +@{1 2 3 4 5 6} + +# Special forms +(def anumber (+ 1 2 3 4 5)) +(var a 1) +(fn identity [x] x) + +# Function definitions +(defn triangle-area + "Calculates the area of a triangle." + [base height] + (print "calculating area of a triangle...") + (* base height 0.5)) + +(defn ignore-extra + [x &] + (+ x 1)) + +# Function calls +(print (triangle-area 5 10)) +(nil? nil) +(not= 1 1) +(put @{:a 1} :b 2) +(type @{:a 1}) +(type {:a 1}) +(in [:a :b :c] 1) +(type [:a :b]) +(type '(:a :b)) +(tuple/type '[]) +(tuple/type '()) +(first [1 2 3]) +(drop [1 2 3]) +(+ 1 2 3) +(apply + [1 2 3]) +(+ ;[2 3 5 7 11]) +(|(+ 1 1 2 3 5 $) 8) + +# Quotes +(quote 1) +(quote hi) +(quote quote) +'(1 2 3) +'(print 1 2 3) +'x +'(print "hello world") +(quote (print "hello world")) +(def name 'myfunction) +(def args '[x y z]) +(defn body '[(print x) (print y) (print z)]) + +# Quasiquotes +~x +~(def ,name (fn ,name ,args ,body)) +~(+ 1 ,(inc 1)) +(quasiquote (+ 1 (unquote (inc 1)))) +(quasiquote (+ 1 (unquote (inc (inc 1))))) diff -Nru ruby-rouge-3.19.0/spec/visual/samples/javascript ruby-rouge-3.21.0/spec/visual/samples/javascript --- ruby-rouge-3.19.0/spec/visual/samples/javascript 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/javascript 2020-07-14 19:56:23.000000000 +0000 @@ -273,3 +273,10 @@ let x = /abc/u; let x = /abc/y; + +// Unicode example +class Œuvre { + résumer(语言 = "français") { + 书名 = "Les Misérables"; + } +} diff -Nru ruby-rouge-3.19.0/spec/visual/samples/jsx ruby-rouge-3.21.0/spec/visual/samples/jsx --- ruby-rouge-3.19.0/spec/visual/samples/jsx 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/jsx 2020-07-14 19:56:23.000000000 +0000 @@ -1,8 +1,10 @@ +
+ Hello React! +
+ var myDivElement =
; ReactDOM.render(myDivElement, document.getElementById('example')); - - var MyComponent = React.createClass({/*...*/}); var myElement = ; ReactDOM.render(myElement, document.getElementById('example')); @@ -50,15 +52,6 @@ ); -var App = ( -
- - - - -
-); - var thing = "; }()}/> class LikeButton extends React.Component { diff -Nru ruby-rouge-3.19.0/spec/visual/samples/julia ruby-rouge-3.21.0/spec/visual/samples/julia --- ruby-rouge-3.19.0/spec/visual/samples/julia 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/julia 2020-07-14 19:56:23.000000000 +0000 @@ -292,3 +292,14 @@ # the author. # # "Learn Julia in Y Minutes" is licensed under http://creativecommons.org/licenses/by-sa/3.0/legalcode + +# Unicode example +mutable struct Œuvre end +⇵ = uppercase + +function résumer_œuvre(书名::Œuvre="Les Misérables") + 语言 = "français" + for ϕ ∈ 1:1 + ⇵(语言) # "FRANÇAIS" + end +end diff -Nru ruby-rouge-3.19.0/spec/visual/samples/livescript ruby-rouge-3.21.0/spec/visual/samples/livescript --- ruby-rouge-3.19.0/spec/visual/samples/livescript 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/livescript 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,304 @@ +mitch = + age: 21 + height: 180cm + pets: [\dog, \goldfish] + +phile = {} +phile{height, pets} = mitch +phile.height #=> 180 +phile.pets #=> ['dog', 'goldfish'] + +a = [2 7 1 8] + ..push 3 + ..shift! + ..sort! +a #=> [1,3,7,8] + +# Numbers +const PI = 3.14 +2~1000 +16~ff +10e-15 +5_000m == 5km * 1e3m +0xAAff + +# Some operators +n = n++ - ++n - n-- + --n + +14 .&. 9 #=> 8 +14 .|. 9 #=> 15 +14 .^. 9 #=> 7 +~9 #=> -10 +9 .<<. 2 #=> 36 +-9 .>>. 2 #=> -3 +-9 .>>>. 2 #=> 1073741821 + +2 < 4 +9 > 7 +8 <= 8 +7 >= 8 + +4 >? 8 #=> 8 +9 - 5 4 + +on and off +on && off + +yes or no +yes || no + +not false +!false + +false xor true +false xor false +1 xor 0 +1 xor 1 + +(f and g or h) 3 4 + +3 in list +\id of id: 23, name: \rogers + +# Pipes +[1 2 3] |> reverse +reverse <| [1 2 3] +4 +|> (+ 1) +|> even + +# Function calls +add-two-times-two = (+ 2) >> (* 2) + +r = +...[4 5 6] +t = typeof! ...[\b 5 {}] +c = ~...[4, 5] +++...player<[strength hp]> +i = new ...[some, classes] +c = ^^...[copy, these, {}] +delete ...list[1, 2, 3] +do ...[a, b, c] + +# arguments shorthand & +-> &1 + &2 || &a + &b || & + +# Imports +obj = {one: 1, two: 2} +obj <<< three: 3 +{go: true} <<<< window +import obj +obj2 = ^^obj +obj3 = obj with three: 3 + +export func = -> + +require! <[ fs path ]> +require! jQuery: $ +require! { + fs: filesystem + 'prelude-ls': {map, id} + path: {join, resolve}:p +} + +{ property : 1 } + +# These shouldn't be highlighted as constants, since this is +# totally legit in livescript +{ true: 1, false: 0 } +foo.true = foo.false = @undefined = @null +{ if: 0, try: 1, in: 2 } +{ and: 0, or: 1, xor: 2, not: 3, is: 4, isnt: 5 } +foo.instanceof = foo.typeof = @finally = @super + +# These should +{ 1: true, 0: false } +1 instanceof Number +typeof \foo + +# These refer to builtins +window.foo = bar(Array) + +# These are properties +foo.window = bar.Array + +# A more complicated comment with some `code` inside +# ['TAG', 'value', line] ++ [column] +# +# [Jison](http://github.com/zaach/jison) generated [parser](../lib/parser.js). +# { 1: true, 0: false } +# 1 instanceof Number +# typeof \foo + +/* +A more complicated comment with some `code` inside +['TAG', 'value', line] ++ [column] + +[Jison](http://github.com/zaach/jison) generated [parser](../lib/parser.js). +{ 1: true, 0: false } +1 instanceof Number +typeof \foo +*/ + +# Some interpolated values +a-function = ({x = 1, y = 3} = {}) -> "#{\#}#x#{\,}#{y}" + +function detab str, len + if len then str.replace detab[len]||=//\n[^\n\S]{1,#len}//g '\n' else str + +# Erases all newlines and indentations. +unlines = (.replace /\n[^\n\S]*/g '') + +# Multiline regex + +symbol = // + [-/^]= | [%+:*]{1,2}= | \|>= # compound assign +| \.(?:[&\|\^] | << | >>>?)\.=? # bitwise and shifts +| \.{1,3} # dot / cascade / splat/placeholder/yada*3 +| \^\^ # clone +| \*?<(?:--?|~~?)!? # backcall +| !?(?:--?|~~?)>\*? # function, bound function +| ([-+&|:])\1 # crement / logic / `prototype` +| %% # mod +| & # arguments +| \([^\n\S]*\) # call +| [!=]==? # strict equality, deep equals +| !?\~= # fuzzy equality +| @@? # this / constructor +| <\[(?:[\s\S]*?\]>)? # words +| <<<]== | <<= | >>= # deep {less,greater}-than-(or-equal-to) +| << | >> # compose +| [<>]\??=? # {less,greater}-than-(or-equal-to) / min/max +| \|> # pipe +| \| # case +| => # then +| \*\* | \^ # pow +| ` # backticks +| [^\s#]? +//g + +# With some hex numbers and unicode +// + ( (?!\s)[$\xAA-\uFFDC] ) +//ig + +# Some single line regexes +/[^\n\S]*(?:#.*)?/gimy +multident = /(?:\s*#.*)*(?:\n([^\n\S]*))*/g +simplestr = /'[^\\']*(?:\\[\s\S][^\\']*)*'|/g + +# list of words +<[ , : -> else { assign } ]> ++ <[ + do [ generator ] = ... | ! enum ( interface ) + package private protected public static +]> + +js-keywords = <[ + true false null this void super return throw break continue + if else for while switch case default try catch finally + function class extends implements new do delete typeof in instanceof + let with var const import export debugger yield +]> + +exports <<< + + lex: ( + code + options + ) -> (^^exports).tokenize code||'' options||{} + + rewrite: (it || @tokens) -> + first-pass it + it.shift! if it.0?.0 is 'NEWLINE' + it + + tokenize: (code, o) -> + @inter or code.=replace /[\r\u2028\u2029\uFEFF]/g '' + code = '\n' + code + while c = code.char-at i + if @variable-x + then throw new Error 'Error' + +function ok token, i + switch tag = token.0 + | \, => break + | \NEWLINE => return true if inline + | \DEDENT => return true + | \POST_IF \FOR \WHILE => return inline + | _ => return false + t1 = tokens[i+1]?.0 + t1 is not (if tag is \, then \NEWLINE else \COMMENT) and + \: is not tokens[if t1 is \( then 1 + index-of-pair tokens, i+1 else i+2]?.0 + +!function go token, i then tokens.splice i, 0 ['}' '' token.2, token.3] + +switch id +case <[ true false on off yes no null void arguments debugger ]> + tag = 'LITERAL' +case <[ new do typeof delete ]> + tag = 'UNARY' +case 'yield' + tag = 'YIELD' +case 'return' 'throw' + tag = 'HURL' +case 'break' 'continue' + tag = 'JUMP' +case 'this' 'eval' 'super' + return @token 'LITERAL' id, true .length +case 'in' 'of' + if @fget 'for' + @fset 'for' false + if id is 'in' + @fset 'by' true + id = '' + if last.0 is 'ID' and @tokens[*-2].0 in <[ , ] } ]> + id = @tokens.pop!1 + @tokens.pop! if @tokens[*-1].0 is ',' + break + fallthrough +case 'and' 'or' 'xor' 'is' 'isnt' + @unline! + tag = if id in <[ is isnt ]> then 'COMPARE' else 'LOGIC' + tag = 'BIOP' if last.0 is '(' + @token tag, switch id + | 'is' => '===' + | 'isnt' => '!==' + | 'or' => '||' + | 'and' => '&&' + | 'xor' => 'xor' + @last.alias = true + return id.length +case otherwise 0 + +if rnum is /[0-9]/ + @carp "invalid number base #radix (with number #rnum), + base must be from 2 to 36" + +@validate /^(?:[gimy]{1,4}|[?$]?)/.exec(rest).0 + +do-line = (code, index) -> + [input, tabs] = (MULTIDENT <<< last-index: index).exec code + {length} = @count-lines input + {last} = this + last <<< {+eol, +spaced} + return length if index + length >= code.length + if tabs and (@emender ||= //[^#{ tabs.char-at! }]//).exec tabs + @carp "contaminated indent #{ escape that }" + if 0 > delta = tabs.length - @dent + @dedent -delta + @newline! + else + [tag, val] = last + if tag is 'ASSIGN' and val + '' not in <[ = := += ]> + or val is '++' and @tokens[*-2].spaced + or tag in <[ +- PIPE BACKPIPE COMPOSE DOT LOGIC MATH COMPARE RELATION + SHIFT IN OF TO BY FROM EXTENDS IMPLEMENTS ]> + return length + if delta then @indent delta else @newline! + @fset 'for' false + @fset 'by' false + length + +try Function "'use strict'; var #id" catch + @carp "invalid variable interpolation '#id'" diff -Nru ruby-rouge-3.19.0/spec/visual/samples/opentype_feature_file ruby-rouge-3.21.0/spec/visual/samples/opentype_feature_file --- ruby-rouge-3.19.0/spec/visual/samples/opentype_feature_file 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/opentype_feature_file 2020-07-14 19:56:23.000000000 +0000 @@ -7,7 +7,7 @@ table name { - nameid 0 "Copyright Enschede"; + nameid 0 "\00A9 2020 Enschede"; nameid 9 "Jan van Krimpen"; } name; @@ -15,6 +15,7 @@ include (../../family.fea); include ( ../../family.fea ) ; +include (../../locl-IPPH-APPH.fea); # imports IPA lookups (which differ between upright and italic) languagesystem DFLT dflt; languagesystem latn dflt; @@ -57,6 +58,7 @@ # Script and language coverage languagesystem DFLT dflt; languagesystem latn dflt; +language DEU include_dflt; # Ligature formation feature liga { @@ -88,6 +90,24 @@ substitute [ a e i o u] c' lookup CNTXT_LIGS t' s' lookup CNTXT_SUB; } test; +lookup ADD_ADVANCE_WIDTH { + pos ka-gran' lookup REPHA_SPACE lookup ANUSVARA_SPACE lookup ADD70 repha-gran anusvara-gran; + pos ka-gran' lookup REPHA_SPACE lookup ADD70 repha-gran; + pos ka-gran' lookup ANUSVARA_SPACE lookup ADD70 anusvara-gran; +} ADD_ADVANCE_WIDTH; + +lookup REMOVE_CAKRA { + sub ka ka.pas_cakra.ns by ka; +} REMOVE_CAKRA; + +lookup REORDER_CAKRA { + sub ka by ka.pas_cakra ka; +} REORDER_CAKRA; + +lookup REORDER_CHAIN { + sub ka' lookup REMOVE_CAKRA lookup REORDER_CAKRA ka.pas_cakra.ns' ; +} REORDER_CHAIN; + table OS/2 { FSType 4; Panose 2 15 0 0 2 2 8 2 9 4; @@ -113,4 +133,93 @@ WeightClass 800; WidthClass 3; Vendor "ADBE"; -} OS/2; \ No newline at end of file +} OS/2; + +feature vpal { + position \1401 <0 26 0 -87>; + position \1414 <0 50 0 -140>; +} vpal; + +table vmtx { + VertOriginY \736 867; + VertOriginY \754 868; + VertOriginY \755 875; +} vmtx; + +feature cv18 { # Character Variant 18 — dotted zero + + cvParameters { + FeatUILabelNameID { + name 3 1 0x0409 "Dotted zero [ 0 ]"; # English US + name 3 1 0x0809 "Dotted zero [ 0 ]"; # English GB + name 1 0 0 "Dotted zero [ 0 ]"; # Mac English + name 3 1 0x0408 "\039C\03B7\03B4\03AD\03BD \03BC\03B5 \03BA\03B5\03BD\03C4\03C1\03B9\03BA\03AE \03C4\03B5\03BB\03B5\03AF\03B1 [ 0 ]"; # Greek: "Μηδέν με κεντρική τελεία [ 0 ]" + name 3 1 0x0419 "\041D\043E\043B\044C \0441 \043F\0443\043D\043A\0442\0438\0440\043E\043C [ 0 ]"; # Russian: "Ноль с пунктиром [ 0 ]" + }; + }; + + lookup ZERO { + sub zero by zero.0; + sub zero.pnum by zero.0p; + } ZERO; + +} cv18; + +table STAT { + + ElidedFallbackName { name "Regular"; }; + + DesignAxis wght 0 { name "Weight"; }; + DesignAxis opsz 1 { name "Optical"; }; + + AxisValue { + location wght 200 200 - 250; + name "ExtraLight"; + }; + + AxisValue { + location wght 300 250 - 350; + name "Light"; + }; + + AxisValue { + location wght 400 350 - 450; + name "Regular"; + flag ElidableAxisValueName; + }; + + AxisValue { + location wght 600 550 - 650; + name "Semibold"; + }; + + AxisValue { + location wght 700 650 - 750; + name "Bold"; + }; + + AxisValue { + location wght 900 800 - 900; + name "Black"; + }; + + AxisValue { + location + opsz 6 0 - 8; + name "Caption"; + }; + + AxisValue { + location + opsz 10 8 - 24; + name "Text"; + flag ElidableAxisValueName; + }; + + AxisValue { + location + opsz 60 24 - 100; + name "Display"; + }; + +} STAT; diff -Nru ruby-rouge-3.19.0/spec/visual/samples/perl ruby-rouge-3.21.0/spec/visual/samples/perl --- ruby-rouge-3.19.0/spec/visual/samples/perl 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/perl 2020-07-14 19:56:23.000000000 +0000 @@ -60,7 +60,15 @@ # quoted strings +my $a = 'foo'; +my $a = 'foo\'s bar'; +my $a = 'foo\bar'; +my $a = 'foo\\bar'; my $a = "foo"; +my $a = "foo \" bar"; +my $a = "foo\bar"; +my $a = "foo \057 \x7f \x{263a} \cC \N{GREEK SMALL LETTER SIGMA} bar"; +my $a = "invalid escape \w"; print "a: "; print $a, " - "; @@ -152,6 +160,16 @@ sub __END__but_not_really { 1 } +# fat commas +use constant EMPTY_SPACE => ' '; +my %h = ( FOO => 23 ); +$text = format_text({FOO => 23, BAR => 30}); +foo( + sub # comment + # second comment + => 1 +) + __DATA__ This is just some end text; everything after DATA can be accessed diff -Nru ruby-rouge-3.19.0/spec/visual/samples/powershell ruby-rouge-3.21.0/spec/visual/samples/powershell --- ruby-rouge-3.19.0/spec/visual/samples/powershell 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/powershell 2020-07-14 19:56:23.000000000 +0000 @@ -95,7 +95,7 @@ } ########################### -# Control structures +# Control structures ########################### if ($var1 -eq $var2) @@ -114,15 +114,15 @@ } ########################### -# Classes +# Classes ########################### class Child : Parent, Relatives { [int] hidden $var = 8 - + Child ([string]$a, [string]$b, [int]$capacity) { $this.var = $a - } + } [string]toString() { return "A string" @@ -188,8 +188,17 @@ } #end function +Write-Output "Updating: $($file.FullName)" +# $content = Get-Content $file.FullName + # Without Error $gitUserName = "$($userAdObject.Properties['sn']), $($userAdObject.Properties['givenName'])" -# With Error +# Grave escaping $gitExeString = "$gitExeFolder\git.exe" &("$gitExeString") config --add --global user.name `"$gitUserName`" +Get-ChildItem -Include *.txt ` + -Recurse +Write-Output `$hello + +# Where-Object alias +Get-process | ? {$_.workingset -gt 25000*1024} diff -Nru ruby-rouge-3.19.0/spec/visual/samples/rego ruby-rouge-3.21.0/spec/visual/samples/rego --- ruby-rouge-3.19.0/spec/visual/samples/rego 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/rego 2020-07-14 19:56:23.000000000 +0000 @@ -28,3 +28,10 @@ input.path = ["finance", "salary", username] subordinates[input.user][_] == username } + +not obj.foo.bar.bar + +some_rule[msg] { + msg := "hey" +} + diff -Nru ruby-rouge-3.19.0/spec/visual/samples/sass ruby-rouge-3.21.0/spec/visual/samples/sass --- ruby-rouge-3.19.0/spec/visual/samples/sass 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/sass 2020-07-14 19:56:23.000000000 +0000 @@ -157,7 +157,7 @@ :padding 2px :border none -#menu +#menu :clear both :text-align right :height 20px @@ -167,7 +167,7 @@ ul :margin 0 5px 0 0 :padding 0 - li + li :list-style-type none :margin 0 5px :padding 5px 5px 0 5px @@ -212,9 +212,9 @@ :width 200px .box :margin-top 10px - p + p :margin 0 1em auto 1em - .box.participants + .box.participants img :float left :margin 0 1em auto 1em @@ -254,12 +254,12 @@ :margin-top 0 #content.contests - .container.information - .column.right + .container.information + .column.right .box :margin 1em 0 .box.videos - .thumbnail img + .thumbnail img :width 200px :height 150px :margin-bottom 5px @@ -268,7 +268,7 @@ :text-decoration none a:hover :text-decoration underline - .box.votes + .box.votes a :display block :width 200px @@ -285,7 +285,7 @@ :text-indent -9999px :border-top 5px solid #a20013 -#content.contests +#content.contests .container.video .box.videos h2 @@ -296,13 +296,13 @@ :border-top 5px solid #a20013 table :width 100 - td + td :padding 1em :width 25 :vertical-align top p :margin 0 0 5px 0 - a:link, a:visited + a:link, a:visited :color #93d700 :text-decoration none a:hover @@ -315,13 +315,13 @@ :margin 0 10px 0 0 :border 1px solid #6e000d -#content - .container.comments +#content + .container.comments .column :margin-top 15px .column.left :width 600px - .box + .box ol :margin 0 :padding 0 @@ -377,16 +377,16 @@ :float right -.clear +.clear :clear both -.centered +.centered :text-align center img :border none -button.short +button.short :width 60px :height 22px :padding 0 0 2px 0 @@ -397,4 +397,12 @@ table :border-collapse collapse +body + &.open > button::after + color: red + +body + &::after + color: red + // Comment at EOF (#797) diff -Nru ruby-rouge-3.19.0/spec/visual/samples/scss ruby-rouge-3.21.0/spec/visual/samples/scss --- ruby-rouge-3.19.0/spec/visual/samples/scss 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/scss 2020-07-14 19:56:23.000000000 +0000 @@ -66,13 +66,13 @@ } ul { - @include horizontal-list; + @include horizontal-list; padding: 0 0 0 25px; li { @include incr(18px); padding: 0 20px 0 0; text-transform: uppercase; - a { + a { color: #febf0f; text-decoration: none; width: 100px; @@ -86,7 +86,7 @@ @include replace-text("header-timeline-text.jpg"); } } - } + } } #paging { @@ -99,8 +99,8 @@ color: #908f8b; padding-right: 20px; text-transform: uppercase; - a { - color: #f07b07; + a { + color: #f07b07; text-decoration: none; } } @@ -109,18 +109,18 @@ @include horizontal-list; li { padding: 3px 4px; - a { + a { color: #4c4c4c; @include replace-text("thread-paging-inactive-bullet.jpg"); width: 10px; height: 10px; display: block; } - &.active a { + &.active a { color: #f17d06; background-image: image_@import "compass"; } - } + } } } @@ -152,7 +152,7 @@ @for $i from 0 through 30 { &.position#{$i} { - left: ($i * -910px); + left: ($i * -910px); } } } @@ -163,7 +163,7 @@ width: 100%; } - #thread { + #thread { padding: 0; width: 5000px; position: absolute; @@ -278,15 +278,27 @@ } ul { - @include horizontal-list; + @include horizontal-list; li { padding: 0 30px 0 0; - a { + a { text-decoration: none; - color: #ef7a06; + color: #ef7a06; } - } + } + } +} + +body { + &.open > button::after { + color: red; + } +} + +body { + &::after { + color: red; } } diff -Nru ruby-rouge-3.19.0/spec/visual/samples/ssh ruby-rouge-3.21.0/spec/visual/samples/ssh --- ruby-rouge-3.19.0/spec/visual/samples/ssh 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/ssh 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,15 @@ +# This is the ssh client system-wide configuration file. See +# ssh_config(5) for more information. This file provides defaults for +# users, and the values can be changed in per-user configuration files +# or on the command line. + +Host * + Port 22 # default port + Tunnel no + GSSAPIAuthentication yes + GSSAPIDelegateCredentials no + +Host example + Hostname www.example.com + User user + Port 1234 diff -Nru ruby-rouge-3.19.0/spec/visual/samples/tsx ruby-rouge-3.21.0/spec/visual/samples/tsx --- ruby-rouge-3.19.0/spec/visual/samples/tsx 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/tsx 2020-07-14 19:56:23.000000000 +0000 @@ -81,3 +81,30 @@ , document.getElementById('example') ); + +const withAuthRedirect = (route: string, redirectIfAuthed: boolean) => ( + Page: NextComponentType +) => { + return class extends React.Component

{ + static async getInitialProps(ctx: NextPageContext) { + const shouldContinue = await redirectBasedOnLogin( + ctx, + route, + redirectIfAuthed + ); + if (!shouldContinue) { + return {}; + } + if (Page.getInitialProps) { + return Page.getInitialProps(ctx); + } + } + + render() { + return ; + } + }; +}; + +export const withLoginRedirect = withAuthRedirect('/login', false); +export const withDashboardRedirect = withAuthRedirect('/dashboard', true); diff -Nru ruby-rouge-3.19.0/spec/visual/samples/typescript ruby-rouge-3.21.0/spec/visual/samples/typescript --- ruby-rouge-3.19.0/spec/visual/samples/typescript 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/typescript 2020-07-14 19:56:23.000000000 +0000 @@ -203,3 +203,7 @@ const x = `Hello world ${a.b}`; const y = `Hello world ${a?.b}`; const z = `Hello world`; + +// Nullish coalescing in template strings +const content = `Value is ${value ?? 'not set'}`; +const description = "Highlighting is not broken now"; diff -Nru ruby-rouge-3.19.0/spec/visual/samples/velocity ruby-rouge-3.21.0/spec/visual/samples/velocity --- ruby-rouge-3.19.0/spec/visual/samples/velocity 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/velocity 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,28 @@ + +#* + There is multi-line comment. + see this text because the Velocity Templating Engine will ignore it. +*# +

List

+## This is a single line comment. +#if( $allProducts ) +

not found.

+#else + + + + #foreach( $product in $allProducts ) + + + + #end + +
$product.Title
+#end +#set( $monkey.Say = ["Not", $my, "fault", 10, false, null] ) ## ArrayList +${mudSlinger} +${customer.Address} +${purchase.getTotal(true)} +$title.set( "Homage to Catalonia" ) + + diff -Nru ruby-rouge-3.19.0/spec/visual/samples/xml ruby-rouge-3.21.0/spec/visual/samples/xml --- ruby-rouge-3.19.0/spec/visual/samples/xml 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/xml 2020-07-14 19:56:23.000000000 +0000 @@ -26,3 +26,7 @@ + +<œuvre> + <书名 语言="français">Les Misérables + diff -Nru ruby-rouge-3.19.0/spec/visual/samples/yaml ruby-rouge-3.21.0/spec/visual/samples/yaml --- ruby-rouge-3.19.0/spec/visual/samples/yaml 2020-05-12 17:43:32.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/yaml 2020-07-14 19:56:23.000000000 +0000 @@ -347,3 +347,9 @@ code: |- foo = bar +# Unicode example +œuvre: + 书名: Les Misérables + 语言: français + référence: &réf_01 + alias: *λ-01 diff -Nru ruby-rouge-3.19.0/spec/visual/samples/zig ruby-rouge-3.21.0/spec/visual/samples/zig --- ruby-rouge-3.19.0/spec/visual/samples/zig 1970-01-01 00:00:00.000000000 +0000 +++ ruby-rouge-3.21.0/spec/visual/samples/zig 2020-07-14 19:56:23.000000000 +0000 @@ -0,0 +1,141 @@ +// builtin demo + +const std = @import("std"); +const warn = std.debug.warn; + +fn add_integers(x: i78, y: i78) i78 { + var res: i78 = undefined; + + if (@addWithOverflow(i78, x, y, &res)) { + warn("overflow detected!\n", .{}); + return 0; + } + + return res; +} + +test "add_integers" { + warn("{}\n", .{add_integers(123, 171781717)}); + warn("{}\n", .{add_integers(97239729372893729998991, 99900091788888881781717)}); +} + +// demo of real numbers + +const std = @import("std"); +const warn = std.debug.warn; + +fn add_floats(x: f128, y: f128) f128 { + return x + y; +} + +test "add_floats" { + const x = 1.23; + const y = -.0019; + warn("{} + {} = {}\n", .{x, y, add_floats(x, y)}); +} + + +// unions and enums demo - a simple arithmetic expression evaluator + +const std = @import("std"); +const warn = std.debug.warn; + +/// this expresses the variants that an arithmetic expression can take +const Expr = union(enum) { + Val: i32, + Add: Payload, + Div: Payload, + Sub: Payload, + Mul: Payload, +}; + +const Payload = struct { + left: *const Expr, + right: *const Expr, +}; + +fn show_helper(expr: *const Payload, expr_name: []const u8, stdout: *const @TypeOf(std.io.getStdOut().outStream())) anyerror!void { + try stdout.print("{}", .{expr_name}); + try show(expr.left, stdout); + try stdout.print(", ", .{}); + try show(expr.right, stdout); + try stdout.print(")", .{}); +} + +fn show(e: *const Expr, stdout: *const @TypeOf(std.io.getStdOut().outStream())) anyerror!void { + switch (e.*) { + Expr.Val => |n| try stdout.print("Val {}", .{n}), + Expr.Add => |a| try show_helper(&a, "Add (", stdout), + Expr.Sub => |s| try show_helper(&s, "Sub (", stdout), + Expr.Mul => |m| try show_helper(&m, "Mul (", stdout), + Expr.Div => |d| try show_helper(&d, "Div (", stdout), + else => unreachable, + } +} + +fn eval(e: *const Expr) i32 { + return switch (e.*) { + Expr.Val => |v| v, + Expr.Add => |a| eval(a.left) + eval(a.right), + Expr.Sub => |s| eval(s.left) - eval(s.right), + Expr.Mul => |m| eval(m.left) * eval(m.right), + Expr.Div => |d| return if (eval(d.right) == 0) eval(d.left) else @divTrunc(eval(d.left), eval(d.right)), + else => unreachable, + }; +} + +pub fn main() !void { + const stdout = std.io.getStdOut().outStream(); + + const e1 = Expr{ .Val = 100 }; + try show(&e1, &stdout); + try stdout.print(" = {}\n", .{eval(&e1)}); + + const e2 = Expr{ .Div = .{ .left = &Expr{ .Val = 10 }, .right = &Expr{ .Val = 2 } } }; + try show(&e2, &stdout); + try stdout.print(" = {}\n", .{eval(&e2)}); + + const e3 = Expr{ + .Div = .{ + .left = &Expr{ + .Mul = .{ + .left = &Expr{ .Val = 5 }, + .right = &Expr{ .Val = 4 }, + }, + }, + .right = &Expr{ .Val = 2 }, + }, + }; + try show(&e3, &stdout); + try stdout.print(" = {}\n", .{eval(&e3)}); + + const e4 = Expr{ + .Add = .{ + .left = &Expr{ + .Mul = .{ + .left = &Expr{ .Val = 5 }, + .right = &Expr{ .Val = 4 }, + }, + }, + .right = &Expr{ + .Sub = .{ + .left = &Expr{ .Val = 100 }, + .right = &Expr{ + .Div = .{ + .left = &Expr{ .Val = 12 }, + .right = &Expr{ .Val = 4 }, + }, + }, + }, + }, + }, + }; + + try show(&e4, &stdout); + try stdout.print(" = {}\n", .{eval(&e4)}); + + const e5 = Expr{ .Div = .{ .left = &Expr{ .Val = 100 }, .right = &Expr{ .Val = 0 } } }; + try show(&e5, &stdout); + try stdout.print(" = {}\n", .{eval(&e5)}); +} +