rouge 3.7.0 → 3.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/lib/rouge/demos/apex +9 -0
  4. data/lib/rouge/demos/armasm +12 -0
  5. data/lib/rouge/demos/batchfile +3 -0
  6. data/lib/rouge/demos/bbcbasic +6 -0
  7. data/lib/rouge/demos/clean +6 -0
  8. data/lib/rouge/demos/cmhg +8 -0
  9. data/lib/rouge/demos/csvs +8 -0
  10. data/lib/rouge/demos/cython +6 -0
  11. data/lib/rouge/demos/eex +1 -0
  12. data/lib/rouge/demos/epp +4 -0
  13. data/lib/rouge/demos/haxe +5 -0
  14. data/lib/rouge/demos/hql +5 -0
  15. data/lib/rouge/demos/jsl +3 -0
  16. data/lib/rouge/demos/liquid +0 -1
  17. data/lib/rouge/demos/lustre +6 -0
  18. data/lib/rouge/demos/lutin +18 -0
  19. data/lib/rouge/demos/msgtrans +4 -0
  20. data/lib/rouge/demos/plist +1 -132
  21. data/lib/rouge/demos/robot_framework +27 -0
  22. data/lib/rouge/demos/sparql +6 -0
  23. data/lib/rouge/demos/terraform +0 -15
  24. data/lib/rouge/formatters/html_line_table.rb +3 -1
  25. data/lib/rouge/formatters/tex.rb +11 -12
  26. data/lib/rouge/guessers/disambiguation.rb +13 -0
  27. data/lib/rouge/lexers/apex.rb +126 -0
  28. data/lib/rouge/lexers/armasm.rb +145 -0
  29. data/lib/rouge/lexers/batchfile.rb +164 -0
  30. data/lib/rouge/lexers/bbcbasic.rb +112 -0
  31. data/lib/rouge/lexers/clean.rb +156 -0
  32. data/lib/rouge/lexers/cmhg.rb +34 -0
  33. data/lib/rouge/lexers/common_lisp.rb +1 -1
  34. data/lib/rouge/lexers/console.rb +1 -1
  35. data/lib/rouge/lexers/coq.rb +12 -9
  36. data/lib/rouge/lexers/cpp.rb +4 -1
  37. data/lib/rouge/lexers/csvs.rb +44 -0
  38. data/lib/rouge/lexers/cython.rb +151 -0
  39. data/lib/rouge/lexers/eex.rb +51 -0
  40. data/lib/rouge/lexers/elixir.rb +20 -9
  41. data/lib/rouge/lexers/epp.rb +51 -0
  42. data/lib/rouge/lexers/haxe.rb +246 -0
  43. data/lib/rouge/lexers/hql.rb +139 -0
  44. data/lib/rouge/lexers/http.rb +5 -5
  45. data/lib/rouge/lexers/javascript.rb +1 -1
  46. data/lib/rouge/lexers/jsl.rb +55 -0
  47. data/lib/rouge/lexers/json.rb +1 -1
  48. data/lib/rouge/lexers/julia.rb +1 -1
  49. data/lib/rouge/lexers/kotlin.rb +21 -28
  50. data/lib/rouge/lexers/liquid.rb +82 -108
  51. data/lib/rouge/lexers/lustre.rb +79 -0
  52. data/lib/rouge/lexers/lutin.rb +33 -0
  53. data/lib/rouge/lexers/make.rb +39 -12
  54. data/lib/rouge/lexers/matlab.rb +4 -2
  55. data/lib/rouge/lexers/matlab/builtins.yml +3515 -0
  56. data/lib/rouge/lexers/msgtrans.rb +26 -0
  57. data/lib/rouge/lexers/perl.rb +1 -1
  58. data/lib/rouge/lexers/plain_text.rb +1 -1
  59. data/lib/rouge/lexers/puppet.rb +2 -2
  60. data/lib/rouge/lexers/q.rb +1 -1
  61. data/lib/rouge/lexers/r.rb +2 -3
  62. data/lib/rouge/lexers/robot_framework.rb +249 -0
  63. data/lib/rouge/lexers/sed.rb +1 -1
  64. data/lib/rouge/lexers/shell.rb +5 -3
  65. data/lib/rouge/lexers/sparql.rb +129 -0
  66. data/lib/rouge/lexers/sql.rb +26 -6
  67. data/lib/rouge/lexers/swift.rb +1 -1
  68. data/lib/rouge/lexers/terraform.rb +8 -0
  69. data/lib/rouge/tex_theme_renderer.rb +2 -1
  70. data/lib/rouge/themes/magritte.rb +2 -2
  71. data/lib/rouge/version.rb +1 -1
  72. data/rouge.gemspec +4 -2
  73. metadata +44 -6
  74. data/lib/rouge/lexers/matlab/builtins.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 71832bb306e80d00d6416e2e0c7787810cee88f614afbf5e31264512fe7914e5
4
- data.tar.gz: f7228f6567515239ade1d9de8c37e437ece59ba54bb81566d008df7db25545f7
3
+ metadata.gz: 6194cfb5ce21bf2ed70d2204150a338095ad016b480801c970995c3ecf9cebde
4
+ data.tar.gz: 6999fdfdc81eeb5aaa808934d27288af6f40280146b13c03ba6d404f1ed73320
5
5
  SHA512:
6
- metadata.gz: f5441fc76804158ae89d9c05c11f430247c4966fccc4d12e5f6690d1081f9da6221a05b92d696022fa0b2b0655760f4cd6e86e27080556be41e995e47c15901f
7
- data.tar.gz: 16a2988f811ff0eb93133ce6f812f7217d29d6f34ec7838211197ebf8db48bd8a84e7f8bf4d330d6be885f49d49a5b9ad94697144b2746aab5ca5d4f20bb5aba
6
+ metadata.gz: f85788d5d1c66521b7b554717d8d1d6b48c7455d01e2e32f13a48d0af26d358b9f1eb66ae0de614b9983d568383f28946add9061aea7ac31e1172d7c09c13f1a
7
+ data.tar.gz: 790a1f59fc106f19b8ce33ef5df8d3f7255fadcd667cce2dabb38dff424f52df1193c5ac135093ecf3fced1f1f11b924c3c8f158454075dbaf2ae6b02b8f5d5b
data/Gemfile CHANGED
@@ -22,12 +22,12 @@ end
22
22
 
23
23
  # Needed for a Rake task
24
24
  gem 'git'
25
+ gem 'yard'
25
26
 
26
27
  group :development do
27
28
  gem 'pry'
28
29
 
29
30
  # docs
30
- gem 'yard'
31
31
  gem 'github-markup'
32
32
 
33
33
  # for visual tests
@@ -0,0 +1,9 @@
1
+ public class with sharing Trigger {
2
+ @Deprecated
3
+ public void resolveSum(int x, int y) {
4
+ System.debug('x is ' + x);
5
+ System.debug('y is ' + y);
6
+
7
+ System.debug('x + y = ' + (x+y));
8
+ }
9
+ }
@@ -0,0 +1,12 @@
1
+ GET common.s
2
+
3
+ RetVal * 0x123 :SHL: 4
4
+
5
+ AREA |Area$$Name|, CODE, READONLY
6
+
7
+ MyFunction ROUT ; This is a comment
8
+ ASSERT RetVal <> 0
9
+ 1 MOVW r0, #RetVal
10
+ BX lr
11
+
12
+ END
@@ -0,0 +1,3 @@
1
+ @echo off
2
+ setlocal enableextensions enabledelayedexpansion
3
+ for /f "tokens=*" %%a in ("hello !username! hi") do echo %%~a
@@ -0,0 +1,6 @@
1
+ REM > DefaultFilename
2
+ REM Ordinary comment
3
+ FOR n=1 TO 10
4
+ PRINTTAB(n)"Hello there ";FNnumber(n)DIV3+1
5
+ NEXT:END
6
+ DEFFNnumber(x%)=ABS(x%-4)
@@ -0,0 +1,6 @@
1
+ delete :: !a !.(Set a) -> Set a | < a
2
+ delete x Tip = Tip
3
+ delete x (Bin _ y l r)
4
+ | x < y = balanceR y (delete x l) r
5
+ | x > y = balanceL y l (delete x r)
6
+ | otherwise = glue l r
@@ -0,0 +1,8 @@
1
+ ; Header comments
2
+
3
+ #include "definitions.h"
4
+
5
+ command-keyword-table: command_handler
6
+ foo(min-args:0, max-args:0,; comment
7
+ international:,
8
+ invalid-syntax: "syntaxtoken" help-text: "helptoken")
@@ -0,0 +1,8 @@
1
+ version 1.1
2
+ @totalColumns 5
3
+ @separator ','
4
+ Transaction_Date: xDate
5
+ Transaction_ID: notEmpty
6
+ Originator_Name: notEmpty
7
+ Originator_Address: any("yes","no")
8
+ Originator_Country: notEmpty
@@ -0,0 +1,6 @@
1
+ cdef extern from 'foo.h':
2
+ int foo_int
3
+ struct foo_struct:
4
+ pass
5
+
6
+ ctypedef int word
@@ -0,0 +1 @@
1
+ <title><%= @title %></title>
@@ -0,0 +1,4 @@
1
+ <%- |
2
+ Optional[String] $title,
3
+ | -%>
4
+ <title><%= $title %></title>
@@ -0,0 +1,5 @@
1
+ // hello world!
2
+ public static function hello(arg : String) {
3
+ return 'Hello $arg';
4
+ }
5
+
@@ -0,0 +1,5 @@
1
+ SELECT e.first_name, e.last_name, d.department_name
2
+ FROM employees e
3
+ JOIN departments d ON e.department_id = d.department_id;
4
+
5
+ update `table` set name='abc', date=${date}, test_interpolation="${var1}.${var2}" where xyz is null;
@@ -0,0 +1,3 @@
1
+ // Create Distribution of Big Class
2
+ dt = open( "$sample_data\big class.jmp" );
3
+ dt << Distribution( Column( :age ), Histograms Only( 1 ) );
@@ -5,7 +5,6 @@
5
5
  Only {{ product.price | format_as_money }}
6
6
 
7
7
  <p>{{ product.description | prettyprint | truncate: 200 }}</p>
8
-
9
8
  </li>
10
9
  {% endfor %}
11
10
  </ul>
@@ -0,0 +1,6 @@
1
+ node count(init: int; reset, event: bool) returns (c: int);
2
+ let
3
+ c = init -> if reset then init
4
+ else if event then pre(c)+1
5
+ else pre(c);
6
+ tel;
@@ -0,0 +1,18 @@
1
+ node gen_x_v1() returns (x:real) = loop 0.0<x and x<42.0
2
+
3
+ node gen_x_v2() returns (x:real) =
4
+ loop { 0.0<x and x<42.0 fby loop [20] x = pre x }
5
+
6
+ node gen_x_v3() returns (target:real; x:real=0.0) =
7
+ run target := gen_x_v2() in
8
+ loop { x = (pre x + target) / 2.0 }
9
+
10
+ let inertia=0.6
11
+
12
+ node gen_x_v4() returns (target:real; x:real=0.0) =
13
+ run target := gen_x_v2() in
14
+ exist px,ppx : real = 0.0 in
15
+ loop {
16
+ px = pre x and ppx = pre px and
17
+ x = (px+target) / 2.0+inertia*(px-ppx)
18
+ }
@@ -0,0 +1,4 @@
1
+ # Example MessageTrans file
2
+ Token
3
+ Token0x??:Replacement localised %0 text
4
+ Color/Colour:Colour
@@ -5,138 +5,7 @@
5
5
  };
6
6
  objectVersion = 46;
7
7
  objects = {
8
-
9
- /* Begin PBXGroup section */
10
- 1D67B9537FE4C81097096F85 /* Frameworks */ = {
11
- isa = PBXGroup;
12
- children = (
13
- );
14
- name = Frameworks;
15
- sourceTree = "<group>";
16
- };
17
- 74946460D3EE9E1FA4792785 = {
18
- isa = PBXGroup;
19
- children = (
20
- E3060171E73473A889949AB5 /* Products */,
21
- 1D67B9537FE4C81097096F85 /* Frameworks */,
22
- );
23
- sourceTree = "<group>";
24
- };
25
- E3060171E73473A889949AB5 /* Products */ = {
26
- isa = PBXGroup;
27
- children = (
28
- );
29
- name = Products;
30
- sourceTree = "<group>";
31
- };
32
- /* End PBXGroup section */
33
-
34
- /* Begin PBXProject section */
35
- B3A67937542EC2041CBF1CA2 /* Project object */ = {
36
- isa = PBXProject;
37
- attributes = {
38
- LastSwiftUpdateCheck = 0730;
39
- LastUpgradeCheck = 0700;
40
- };
41
- buildConfigurationList = 442CE273DD7DF2DFDC620C8B /* Build configuration list for PBXProject "foo" */;
42
- compatibilityVersion = "Xcode 3.2";
43
- developmentRegion = English;
44
- hasScannedForEncodings = 0;
45
- knownRegions = (
46
- en,
47
- );
48
- mainGroup = 74946460D3EE9E1FA4792785;
49
- productRefGroup = E3060171E73473A889949AB5 /* Products */;
50
- projectDirPath = "";
51
- projectRoot = "";
52
- targets = (
53
- );
54
- };
55
- /* End PBXProject section */
56
-
57
- /* Begin XCBuildConfiguration section */
58
- 09AC0D63F19B6944E1045E60 /* Release */ = {
59
- isa = XCBuildConfiguration;
60
- buildSettings = {
61
- ALWAYS_SEARCH_USER_PATHS = NO;
62
- CLANG_ANALYZER_NONNULL = YES;
63
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
64
- CLANG_CXX_LIBRARY = "libc++";
65
- CLANG_ENABLE_MODULES = YES;
66
- CLANG_ENABLE_OBJC_ARC = YES;
67
- CLANG_WARN_BOOL_CONVERSION = YES;
68
- CLANG_WARN_CONSTANT_CONVERSION = YES;
69
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
70
- CLANG_WARN_EMPTY_BODY = YES;
71
- CLANG_WARN_ENUM_CONVERSION = YES;
72
- CLANG_WARN_INT_CONVERSION = YES;
73
- CLANG_WARN_OBJC_ROOT_CLASS = YES;
74
- CLANG_WARN_UNREACHABLE_CODE = YES;
75
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
76
- COPY_PHASE_STRIP = YES;
77
- ENABLE_NS_ASSERTIONS = NO;
78
- GCC_C_LANGUAGE_STANDARD = gnu99;
79
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
80
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
81
- GCC_WARN_UNDECLARED_SELECTOR = YES;
82
- GCC_WARN_UNINITIALIZED_AUTOS = YES;
83
- GCC_WARN_UNUSED_FUNCTION = YES;
84
- GCC_WARN_UNUSED_VARIABLE = YES;
85
- VALIDATE_PRODUCT = YES;
86
- };
87
- name = Release;
88
- };
89
- 4D494CA5F82DCCAB3194BA09 /* Debug */ = {
90
- isa = XCBuildConfiguration;
91
- buildSettings = {
92
- ALWAYS_SEARCH_USER_PATHS = NO;
93
- CLANG_ANALYZER_NONNULL = YES;
94
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
95
- CLANG_CXX_LIBRARY = "libc++";
96
- CLANG_ENABLE_MODULES = YES;
97
- CLANG_ENABLE_OBJC_ARC = YES;
98
- CLANG_WARN_BOOL_CONVERSION = YES;
99
- CLANG_WARN_CONSTANT_CONVERSION = YES;
100
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES;
101
- CLANG_WARN_EMPTY_BODY = YES;
102
- CLANG_WARN_ENUM_CONVERSION = YES;
103
- CLANG_WARN_INT_CONVERSION = YES;
104
- CLANG_WARN_OBJC_ROOT_CLASS = YES;
105
- CLANG_WARN_UNREACHABLE_CODE = YES;
106
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
107
- COPY_PHASE_STRIP = NO;
108
- ENABLE_TESTABILITY = YES;
109
- GCC_C_LANGUAGE_STANDARD = gnu99;
110
- GCC_DYNAMIC_NO_PIC = NO;
111
- GCC_OPTIMIZATION_LEVEL = 0;
112
- GCC_PREPROCESSOR_DEFINITIONS = (
113
- "DEBUG=1",
114
- "$(inherited)",
115
- );
116
- GCC_SYMBOLS_PRIVATE_EXTERN = NO;
117
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
118
- GCC_WARN_ABOUT_RETURN_TYPE = YES;
119
- GCC_WARN_UNDECLARED_SELECTOR = YES;
120
- GCC_WARN_UNINITIALIZED_AUTOS = YES;
121
- GCC_WARN_UNUSED_FUNCTION = YES;
122
- GCC_WARN_UNUSED_VARIABLE = YES;
123
- ONLY_ACTIVE_ARCH = YES;
124
- };
125
- name = Debug;
126
- };
127
- /* End XCBuildConfiguration section */
128
-
129
- /* Begin XCConfigurationList section */
130
- 442CE273DD7DF2DFDC620C8B /* Build configuration list for PBXProject "foo" */ = {
131
- isa = XCConfigurationList;
132
- buildConfigurations = (
133
- 4D494CA5F82DCCAB3194BA09 /* Debug */,
134
- 09AC0D63F19B6944E1045E60 /* Release */,
135
- );
136
- defaultConfigurationIsVisible = 0;
137
- defaultConfigurationName = Release;
138
- };
139
- /* End XCConfigurationList section */
8
+ /* ... */
140
9
  };
141
10
  rootObject = B3A67937542EC2041CBF1CA2 /* Project object */;
142
11
  }
@@ -0,0 +1,27 @@
1
+ *** Settings ***
2
+ Document Example taken from http://robotframework.org/
3
+ Suite Setup Open Browser To Login Page
4
+ Suite Teardown Close Browser
5
+ Test Setup Go To Login Page
6
+ Test Template Login With Invalid Credentials Should Fail
7
+ Resource resource.txt
8
+
9
+ *** Test Cases *** User Name Password
10
+ Invalid Username invalid ${VALID PASSWORD}
11
+ Invalid Password ${VALID USER} invalid
12
+ Invalid Username And Password invalid whatever
13
+ Empty Username ${EMPTY} ${VALID PASSWORD}
14
+ Empty Password ${VALID USER} ${EMPTY}
15
+ Empty Username And Password ${EMPTY} ${EMPTY}
16
+
17
+ *** Keywords ***
18
+ Login With Invalid Credentials Should Fail
19
+ [Arguments] ${username} ${password}
20
+ Input Username ${username}
21
+ Input Password ${password}
22
+ Submit Credentials
23
+ Login Should Have Failed
24
+
25
+ Login Should Have Failed
26
+ Location Should Be ${ERROR URL}
27
+ Title Should Be Error Page
@@ -0,0 +1,6 @@
1
+ SELECT ?item ?itemLabel
2
+ WHERE
3
+ {
4
+ ?item wdt:P31 wd:Q146.
5
+ SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
6
+ }
@@ -1,10 +1,3 @@
1
- # From: https://github.com/terraform-providers/terraform-provider-aws/blob/master/examples/count/main.tf
2
-
3
- # Specify the provider and access details
4
- provider "aws" {
5
- region = "${var.aws_region}"
6
- }
7
-
8
1
  resource "aws_elb" "web" {
9
2
  name = "terraform-example-elb"
10
3
 
@@ -21,11 +14,3 @@ resource "aws_elb" "web" {
21
14
  # The instances are registered automatically
22
15
  instances = ["${aws_instance.web.*.id}"]
23
16
  }
24
-
25
- resource "aws_instance" "web" {
26
- instance_type = "m1.small"
27
- ami = "${lookup(var.aws_amis, var.aws_region)}"
28
-
29
- # This will create 4 instances
30
- count = 4
31
- }
@@ -37,7 +37,9 @@ module Rouge
37
37
  token_lines(tokens) do |line_tokens|
38
38
  lineno += 1
39
39
  buffer << %(<tr id="#{sprintf @line_id, lineno}" class="#@line_class">)
40
- buffer << %(<td class="#@gutter_class gl">)
40
+ buffer << %(<td class="#@gutter_class gl" )
41
+ buffer << %(style="-moz-user-select: none;-ms-user-select: none;)
42
+ buffer << %(-webkit-user-select: none;user-select: none;">)
41
43
  buffer << %(<pre>#{lineno}</pre></td>)
42
44
  buffer << %(<td class="#@code_class"><pre>)
43
45
  @formatter.stream(line_tokens) { |formatted| buffer << formatted }
@@ -22,6 +22,9 @@ module Rouge
22
22
  '^' => '{\textasciicircum}',
23
23
  '|' => '{\textbar}',
24
24
  '\\' => '{\textbackslash}',
25
+ '`' => '{\textasciigrave}',
26
+ "'" => "'{}",
27
+ '"' => '"{}',
25
28
  "\t" => '{\tab}',
26
29
  }
27
30
 
@@ -59,24 +62,20 @@ module Rouge
59
62
  end
60
63
 
61
64
  def render_line(line, &b)
62
- head, *rest = line
63
- return unless head
64
-
65
- tag_first(*head, &b)
66
- rest.each do |(tok, val)|
67
- yield tag(tok, val)
65
+ line.each do |(tok, val)|
66
+ hphantom_tag(tok, val, &b)
68
67
  end
69
68
  end
70
69
 
71
- # special handling for the first token
72
- # of a line. we replace all initial spaces
73
- # with \hphantom{xxxx}, which renders an
74
- # empty space equal to the size of the x's.
75
- def tag_first(tok, val)
70
+ # Special handling for leading spaces, since they may be gobbled
71
+ # by a previous command. We replace all initial spaces with
72
+ # \hphantom{xxxx}, which renders an empty space equal to the size
73
+ # of the x's.
74
+ def hphantom_tag(tok, val)
76
75
  leading = nil
77
76
  val.sub!(/^[ ]+/) { leading = $&.size; '' }
78
77
  yield "\\hphantom{#{'x' * leading}}" if leading
79
- yield tag(tok, val)
78
+ yield tag(tok, val) unless val.empty?
80
79
  end
81
80
 
82
81
  def tag(tok, val)
@@ -75,6 +75,8 @@ module Rouge
75
75
  disambiguate '*.h' do
76
76
  next ObjectiveC if matches?(/@(end|implementation|protocol|property)\b/)
77
77
  next ObjectiveC if contains?('@"')
78
+ next Cpp if matches?(/^\s*(?:catch|class|constexpr|namespace|private|
79
+ protected|public|template|throw|try|using)\b/x)
78
80
 
79
81
  C
80
82
  end
@@ -118,6 +120,17 @@ module Rouge
118
120
 
119
121
  next Python
120
122
  end
123
+
124
+ disambiguate 'Messages' do
125
+ next MsgTrans if matches?(/^[^\s:]+:[^\s:]+/)
126
+
127
+ next PlainText
128
+ end
129
+
130
+ disambiguate '*.cls' do
131
+ next TeX if matches?(/\A\s*(?:\\|%)/)
132
+ next Apex
133
+ end
121
134
  end
122
135
  end
123
136
  end