rouge 3.5.1 → 3.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rouge.rb +1 -0
  3. data/lib/rouge/cli.rb +19 -11
  4. data/lib/rouge/demos/openedge +4 -0
  5. data/lib/rouge/demos/powershell +12 -48
  6. data/lib/rouge/demos/xojo +2 -1
  7. data/lib/rouge/demos/xpath +2 -0
  8. data/lib/rouge/demos/xquery +22 -0
  9. data/lib/rouge/formatters/html.rb +18 -2
  10. data/lib/rouge/formatters/html_line_table.rb +51 -0
  11. data/lib/rouge/guessers/modeline.rb +1 -1
  12. data/lib/rouge/lexers/apache.rb +1 -1
  13. data/lib/rouge/lexers/bpf.rb +12 -12
  14. data/lib/rouge/lexers/ceylon.rb +5 -5
  15. data/lib/rouge/lexers/docker.rb +2 -2
  16. data/lib/rouge/lexers/elixir.rb +5 -2
  17. data/lib/rouge/lexers/elm.rb +1 -1
  18. data/lib/rouge/lexers/fsharp.rb +4 -4
  19. data/lib/rouge/lexers/glsl.rb +1 -1
  20. data/lib/rouge/lexers/http.rb +1 -1
  21. data/lib/rouge/lexers/idlang.rb +1 -1
  22. data/lib/rouge/lexers/json.rb +1 -1
  23. data/lib/rouge/lexers/jsp.rb +3 -3
  24. data/lib/rouge/lexers/liquid.rb +23 -0
  25. data/lib/rouge/lexers/magik.rb +2 -1
  26. data/lib/rouge/lexers/make.rb +5 -4
  27. data/lib/rouge/lexers/mosel.rb +43 -43
  28. data/lib/rouge/lexers/nim.rb +2 -1
  29. data/lib/rouge/lexers/nix.rb +1 -1
  30. data/lib/rouge/lexers/openedge.rb +429 -0
  31. data/lib/rouge/lexers/perl.rb +12 -14
  32. data/lib/rouge/lexers/powershell.rb +181 -635
  33. data/lib/rouge/lexers/ruby.rb +2 -2
  34. data/lib/rouge/lexers/scala.rb +1 -1
  35. data/lib/rouge/lexers/shell.rb +1 -1
  36. data/lib/rouge/lexers/swift.rb +4 -4
  37. data/lib/rouge/lexers/tex.rb +1 -1
  38. data/lib/rouge/lexers/toml.rb +1 -1
  39. data/lib/rouge/lexers/vala.rb +1 -1
  40. data/lib/rouge/lexers/vhdl.rb +1 -1
  41. data/lib/rouge/lexers/wollok.rb +1 -1
  42. data/lib/rouge/lexers/xml.rb +1 -1
  43. data/lib/rouge/lexers/xojo.rb +4 -4
  44. data/lib/rouge/lexers/xpath.rb +332 -0
  45. data/lib/rouge/lexers/xquery.rb +145 -0
  46. data/lib/rouge/lexers/yaml.rb +5 -3
  47. data/lib/rouge/regex_lexer.rb +14 -13
  48. data/lib/rouge/tex_theme_renderer.rb +2 -2
  49. data/lib/rouge/themes/monokai_sublime.rb +2 -1
  50. data/lib/rouge/themes/pastie.rb +1 -1
  51. data/lib/rouge/util.rb +2 -2
  52. data/lib/rouge/version.rb +1 -1
  53. metadata +10 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e43af1a1e5d2fd440ddbf1af42fd151b777d8cd66ccbe9cb20f194979d51bb71
4
- data.tar.gz: b36cab6b9546c3c99a8fe8bc7827b7f337d036a42c64f830db2755fcbb06adf2
3
+ metadata.gz: '0978a751e99189848662ab1f4d6b3763ff4ffc6bafa51d53f74a5f7d085492f5'
4
+ data.tar.gz: 06b154a4db8264d688c8a279c04ca6d82f8f188ae184b75a4b75df8726af3b28
5
5
  SHA512:
6
- metadata.gz: 977f2c375741b0e95e545c5ce28e9fb25411036475a1fc9e102b758ae334de47511742bce87c6f53ab51f459da5dd27bf3dfba7fe14fffdbf37888283b0cc5aa
7
- data.tar.gz: 0e8d5b32d0fd8a1d25ea4238ac89c7e85be5b628b6938e0e66e509e03c42fd95d159d50c9199c14534e8bb57d89198e41065f7adc8a59ec365cea4e80dd5e04e
6
+ metadata.gz: 1296057ef9206c038ba0da5a2c06e7e9658c95ece00bc98e8b5e22d53865930fd132ea5c3bbb9eaf6d1590c38b4680e9a83e5a7101e6a4ad5aab1be4910f01d2
7
+ data.tar.gz: 34acb9f469772310659845294d8fd3adfe989102cc6533a9632e64f41f1f20ad42f2e3951a0377ce8380b83b3a886178829c70868df987eb7f16f02b5f131272
@@ -69,6 +69,7 @@ load_relative 'rouge/formatters/html_table'
69
69
  load_relative 'rouge/formatters/html_pygments'
70
70
  load_relative 'rouge/formatters/html_legacy'
71
71
  load_relative 'rouge/formatters/html_linewise'
72
+ load_relative 'rouge/formatters/html_line_table'
72
73
  load_relative 'rouge/formatters/html_inline'
73
74
  load_relative 'rouge/formatters/terminal256'
74
75
  load_relative 'rouge/formatters/tex'
@@ -38,7 +38,7 @@ module Rouge
38
38
  def self.doc
39
39
  return enum_for(:doc) unless block_given?
40
40
 
41
- yield %|usage: rougify [command] [args...]|
41
+ yield %|usage: rougify {global options} [command] [args...]|
42
42
  yield %||
43
43
  yield %|where <command> is one of:|
44
44
  yield %| highlight #{Highlight.desc}|
@@ -48,6 +48,9 @@ module Rouge
48
48
  yield %| guess #{Guess.desc}|
49
49
  yield %| version #{Version.desc}|
50
50
  yield %||
51
+ yield %|global options:|
52
+ yield %[ --require|-r <fname> require <fname> after loading rouge]
53
+ yield %||
51
54
  yield %|See `rougify help <command>` for more info.|
52
55
  end
53
56
 
@@ -62,18 +65,22 @@ module Rouge
62
65
  def self.parse(argv=ARGV)
63
66
  argv = normalize_syntax(argv)
64
67
 
65
- mode = argv.shift
68
+ while (head = argv.shift)
69
+ case head
70
+ when '-h', '--help', 'help', '-help'
71
+ return Help.parse(argv)
72
+ when '--require', '-r'
73
+ require argv.shift
74
+ else
75
+ break
76
+ end
77
+ end
66
78
 
67
- klass = class_from_arg(mode)
79
+ klass = class_from_arg(head)
68
80
  return klass.parse(argv) if klass
69
81
 
70
- case mode
71
- when '-h', '--help', 'help', '-help', nil
72
- Help.parse(argv)
73
- else
74
- argv.unshift(mode) if mode
75
- Highlight.parse(argv)
76
- end
82
+ argv.unshift(head) if head
83
+ Highlight.parse(argv)
77
84
  end
78
85
 
79
86
  def initialize(options={})
@@ -91,7 +98,7 @@ module Rouge
91
98
  case arg
92
99
  when 'version', '--version', '-v'
93
100
  Version
94
- when 'help'
101
+ when 'help', nil
95
102
  Help
96
103
  when 'highlight', 'hi'
97
104
  Highlight
@@ -297,6 +304,7 @@ module Rouge
297
304
  when 'html' then Formatters::HTML.new
298
305
  when 'html-pygments' then Formatters::HTMLPygments.new(Formatters::HTML.new, opts[:css_class])
299
306
  when 'html-inline' then Formatters::HTMLInline.new(theme)
307
+ when 'html-line-table' then Formatters::HTMLLineTable.new(Formatters::HTML.new)
300
308
  when 'html-table' then Formatters::HTMLTable.new(Formatters::HTML.new)
301
309
  when 'null', 'raw', 'tokens' then Formatters::Null.new
302
310
  when 'tex' then Formatters::Tex.new
@@ -0,0 +1,4 @@
1
+ FORM
2
+ "Hello World!" VIEW-AS TEXT AT COL 20 ROW 2
3
+ btnOK AT COL 20 ROW 4
4
+ WITH FRAME f SIZE 50 BY 5 NO-BOX THREE-D.
@@ -1,49 +1,13 @@
1
- Function Get-IPv4Scopes
2
- <#
3
- .SYNOPSIS
4
- Read IPv4Scopes from an array of servers
5
- .PARAMETER Servers
6
- Specifies an array of servers
7
- .EXAMPLE
8
- Get-IPv4Scopes
9
-
10
- Will prompt for all inputs
11
- #>
1
+ function Verb-Noun
12
2
  {
13
- [CmdletBinding()]
14
- Param(
15
- # 1
16
- [parameter(
17
- Mandatory=$true,
18
- Position=0,
19
- ValueFromPipelineByPropertyName=$true,
20
- HelpMessage="Server List"
21
- )]
22
- [string[]]$Servers,
23
- #2
24
- [parameter(Mandatory=$false,ValueFromPipeline=$false)]
25
- [bool]$Unique=$false
26
- ) #EndParam
27
-
28
- Begin {}
29
-
30
- Process {
31
- $arrayJobs=@()
32
- foreach ($server in $Servers) {
33
- $arrayJobs+=Invoke-Command -ComputerName $server -scriptblock {Get-DhcpServerv4Scope} -AsJob
34
- }
35
- $complete=$false
36
- while (-not $complete) {
37
- $arrayJobsInProgress= $arrayJobs | Where-Object { $_.State -match 'running' }
38
- if (-not $arrayJobsInProgress) { $complete=$true }
39
- }
40
- $Scopes=$arrayJobs|Receive-Job
41
- $UniqueScopes=$Scopes|Sort-Object -Property ScopeId -Unique
42
- }
43
-
44
- End {
45
- if ($Unique) { return $UniqueScopes }
46
- else { return $Scopes }
47
- }
48
-
49
- } #end function
3
+ <#
4
+ .SYNOPSIS
5
+ Tells you what it does
6
+
7
+ .DESCRIPTION
8
+ Tells you what it does with more detail.
9
+ #>
10
+ param ([string]$Name, [string]$Extension = "txt", [string]$foo="bar")
11
+ $name = $name + "." + $extension
12
+ $name
13
+ }
@@ -1,7 +1,8 @@
1
1
  Dim f As FolderItem
2
2
  f = GetOpenFolderItem(FileTypes1.jpeg) // defined in the File Type Set editor
3
+ rem - we should check for nil!
3
4
  If not f.Exists Then
4
- Beep
5
+ Beep 'Just for fun
5
6
  MsgBox("The file " + f.NativePath + "doesn't ""exist.""")
6
7
  Else // document exists
7
8
  ImageWell1.image=Picture.Open(f)
@@ -0,0 +1,2 @@
1
+ (: Authors named Bob Joe who didn't graduate from Harvard :)
2
+ //author[first-name = "Joe" and last-name = "Bob"][degree/@from != "Harvard"]
@@ -0,0 +1,22 @@
1
+ declare namespace html = "http://www.w3.org/1999/xhtml";
2
+
3
+ declare function local:test-function($catalog as document-node()) {
4
+ <html>
5
+ <head>
6
+ <title>XQuery example for the Rouge highlighter</title>
7
+ <link href="style.css"/>
8
+ </head>
9
+ <body>
10
+ <h1>List</h1>
11
+ <ul>
12
+ {for $product in $catalog/items/product[@sell-by > current-date()] return
13
+ <li>
14
+ <ul>
15
+ <li>{data($product/name)}</li>
16
+ <li>{$product/price * (1 + $product/tax)}$</li>
17
+ </ul>
18
+ </li>}
19
+ </ul>
20
+ </body>
21
+ </html>
22
+ };
@@ -15,7 +15,7 @@ module Rouge
15
15
  def span(tok, val)
16
16
  return val if escape?(tok)
17
17
 
18
- safe_span(tok, val.gsub(/[&<>]/, TABLE_FOR_ESCAPE_HTML))
18
+ safe_span(tok, escape_special_html_chars(val))
19
19
  end
20
20
 
21
21
  def safe_span(tok, safe_val)
@@ -29,12 +29,28 @@ module Rouge
29
29
  end
30
30
  end
31
31
 
32
-
33
32
  TABLE_FOR_ESCAPE_HTML = {
34
33
  '&' => '&amp;',
35
34
  '<' => '&lt;',
36
35
  '>' => '&gt;',
37
36
  }
37
+
38
+ private
39
+ # A performance-oriented helper method to escape `&`, `<` and `>` for the rendered
40
+ # HTML from this formatter.
41
+ #
42
+ # `String#gsub` will always return a new string instance irrespective of whether
43
+ # a substitution occurs. This method however invokes `String#gsub` only if
44
+ # a substitution is imminent.
45
+ #
46
+ # Returns either the given `value` argument string as is or a new string with the
47
+ # special characters replaced with their escaped counterparts.
48
+ def escape_special_html_chars(value)
49
+ escape_regex = /[&<>]/
50
+ return value unless value =~ escape_regex
51
+
52
+ value.gsub(escape_regex, TABLE_FOR_ESCAPE_HTML)
53
+ end
38
54
  end
39
55
  end
40
56
  end
@@ -0,0 +1,51 @@
1
+ # -*- coding: utf-8 -*- #
2
+ # frozen_string_literal: true
3
+
4
+ module Rouge
5
+ module Formatters
6
+ class HTMLLineTable < Formatter
7
+ tag 'html_line_table'
8
+
9
+ # @param [Rouge::Formatters::Formatter] formatter An instance of a
10
+ # `Rouge::Formatters::HTML` or `Rouge::Formatters::HTMLInline`
11
+ # @param [Hash] opts options for HTMLLineTable instance.
12
+ # @option opts [Integer] :start_line line number to start from. Defaults to `1`.
13
+ # @option opts [String] :table_class Class name for the table.
14
+ # Defaults to `"rouge-line-table"`.
15
+ # @option opts [String] :line_id a `sprintf` template for generating an `id`
16
+ # attribute for each table row corresponding to current line number.
17
+ # Defaults to `"line-%i"`.
18
+ # @option opts [String] :line_class Class name for each table row.
19
+ # Defaults to `"lineno"`.
20
+ # @option opts [String] :gutter_class Class name for rendered line-number cell.
21
+ # Defaults to `"rouge-gutter"`.
22
+ # @option opts [String] :code_class Class name for rendered code cell.
23
+ # Defaults to `"rouge-code"`.
24
+ def initialize(formatter, opts={})
25
+ @formatter = formatter
26
+ @start_line = opts.fetch :start_line, 1
27
+ @table_class = opts.fetch :table_class, 'rouge-line-table'
28
+ @gutter_class = opts.fetch :gutter_class, 'rouge-gutter'
29
+ @code_class = opts.fetch :code_class, 'rouge-code'
30
+ @line_class = opts.fetch :line_class, 'lineno'
31
+ @line_id = opts.fetch :line_id, 'line-%i'
32
+ end
33
+
34
+ def stream(tokens, &b)
35
+ lineno = @start_line - 1
36
+ buffer = [%(<table class="#@table_class"><tbody>)]
37
+ token_lines(tokens) do |line_tokens|
38
+ lineno += 1
39
+ buffer << %(<tr id="#{sprintf @line_id, lineno}" class="#@line_class">)
40
+ buffer << %(<td class="#@gutter_class gl">)
41
+ buffer << %(<pre>#{lineno}</pre></td>)
42
+ buffer << %(<td class="#@code_class"><pre>)
43
+ @formatter.stream(line_tokens) { |formatted| buffer << formatted }
44
+ buffer << "\n</pre></td></tr>"
45
+ end
46
+ buffer << %(</tbody></table>)
47
+ yield buffer.join
48
+ end
49
+ end
50
+ end
51
+ end
@@ -37,7 +37,7 @@ module Rouge
37
37
 
38
38
  matches = MODELINES.map { |re| re.match(search_space) }.compact
39
39
  return lexers unless matches.any?
40
-
40
+
41
41
  match_set = Set.new(matches.map { |m| m[1] })
42
42
  lexers.select { |l| match_set.include?(l.tag) || l.aliases.any? { |a| match_set.include?(a) } }
43
43
  end
@@ -50,7 +50,7 @@ module Rouge
50
50
 
51
51
  state :section do
52
52
  # Match section arguments
53
- rule %r/([^>]+)?(>(?:\r\n?|\n)?)/ do |m|
53
+ rule %r/([^>]+)?(>(?:\r\n?|\n)?)/ do
54
54
  groups Literal::String::Regex, Punctuation
55
55
  pop!
56
56
  end
@@ -18,25 +18,25 @@ module Rouge
18
18
 
19
19
  state :root do
20
20
  # Calls to helpers
21
- rule %r/(call)(\s+)(\d+)/i do |m|
21
+ rule %r/(call)(\s+)(\d+)/i do
22
22
  groups Keyword, Text::Whitespace, Literal::Number::Integer
23
23
  end
24
24
 
25
25
  # Unconditional jumps
26
- rule %r/(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do |m|
26
+ rule %r/(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
27
27
  groups Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
28
28
  end
29
29
 
30
30
  # Conditional jumps
31
- rule %r/(if)(\s+)(r\d+)(\s*)([s!=<>]+)(\s*)(0x\h+|[-]?\d+)(\s*)(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do |m|
31
+ rule %r/(if)(\s+)(r\d+)(\s*)([s!=<>]+)(\s*)(0x\h+|[-]?\d+)(\s*)(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
32
32
  groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Literal::Number, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
33
33
  end
34
- rule %r/(if)(\s+)(r\d+)(\s*)([s!=<>]+)(\s*)(r\d+)(\s*)(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do |m|
34
+ rule %r/(if)(\s+)(r\d+)(\s*)([s!=<>]+)(\s*)(r\d+)(\s*)(goto)(\s*)(\+\d+)?(\s*)(<?\w+>?)/i do
35
35
  groups Keyword, Text::Whitespace, Name, Text::Whitespace, Operator, Text::Whitespace, Name, Text::Whitespace, Keyword, Text::Whitespace, Literal::Number::Integer, Text::Whitespace, Name::Label
36
36
  end
37
37
 
38
38
  # Dereferences
39
- rule %r/(\*)(\s*)(\()(#{TYPE_KEYWORDS})(\s*)(\*)(\))/i do |m|
39
+ rule %r/(\*)(\s*)(\()(#{TYPE_KEYWORDS})(\s*)(\*)(\))/i do
40
40
  groups Operator, Text::Whitespace, Punctuation, Keyword::Type, Text::Whitespace, Operator, Punctuation
41
41
  push :address
42
42
  end
@@ -45,7 +45,7 @@ module Rouge
45
45
  rule %r/[+-\/\*&|><^s]{0,3}=/i, Operator
46
46
 
47
47
  # Registers
48
- rule %r/([+-]?)(r\d+)/i do |m|
48
+ rule %r/([+-]?)(r\d+)/i do
49
49
  groups Punctuation, Name
50
50
  end
51
51
 
@@ -56,15 +56,15 @@ module Rouge
56
56
  rule %r/#{MISC_KEYWORDS}/i, Keyword
57
57
 
58
58
  # Literals and global objects (maps) refered by name
59
- rule %r/(0x\h+|[-]?\d+)(\s*)(ll)?/i do |m|
59
+ rule %r/(0x\h+|[-]?\d+)(\s*)(ll)?/i do
60
60
  groups Literal::Number, Text::Whitespace, Keyword::Type
61
61
  end
62
- rule %r/(\w+)(\s*)(ll)/i do |m|
62
+ rule %r/(\w+)(\s*)(ll)/i do
63
63
  groups Name, Text::Whitespace, Keyword::Type
64
64
  end
65
65
 
66
66
  # Labels
67
- rule %r/(\w+)(\s*)(:)/i do |m|
67
+ rule %r/(\w+)(\s*)(:)/i do
68
68
  groups Name::Label, Text::Whitespace, Punctuation
69
69
  end
70
70
 
@@ -73,17 +73,17 @@ module Rouge
73
73
 
74
74
  state :address do
75
75
  # Address is offset from register
76
- rule %r/(\()(r\d+)(\s*)([+-])(\s*)(\d+)(\))/i do |m|
76
+ rule %r/(\()(r\d+)(\s*)([+-])(\s*)(\d+)(\))/i do
77
77
  groups Punctuation, Name, Text::Whitespace, Operator, Text::Whitespace, Literal::Number::Integer, Punctuation
78
78
  pop!
79
79
  end
80
80
 
81
81
  # Address is array subscript
82
- rule %r/(\w+)(\[)(\d+)(\])/i do |m|
82
+ rule %r/(\w+)(\[)(\d+)(\])/i do
83
83
  groups Name, Punctuation, Literal::Number::Integer, Punctuation
84
84
  pop!
85
85
  end
86
- rule %r/(\w+)(\[)(r\d+)(\])/i do |m|
86
+ rule %r/(\w+)(\[)(r\d+)(\])/i do
87
87
  groups Name, Punctuation, Name, Punctuation
88
88
  pop!
89
89
  end
@@ -31,14 +31,14 @@ module Rouge
31
31
  rule %r((abstracts|extends|satisfies|super|given|of|out|assign)\b), Keyword::Declaration
32
32
 
33
33
  rule %r((function|value|void|new)\b), Keyword::Type
34
-
34
+
35
35
  rule %r((assembly|module|package)(\s+)) do
36
36
  groups Keyword::Namespace, Text
37
37
  push :import
38
38
  end
39
-
39
+
40
40
  rule %r((true|false|null)\b), Keyword::Constant
41
-
41
+
42
42
  rule %r((class|interface|object|alias)(\s+)) do
43
43
  groups Keyword::Declaration, Text
44
44
  push :class
@@ -48,7 +48,7 @@ module Rouge
48
48
  groups Keyword::Namespace, Text
49
49
  push :import
50
50
  end
51
-
51
+
52
52
  rule %r("(\\\\|\\"|[^"])*"), Literal::String
53
53
  rule %r('\\.'|'[^\\]'|'\\\{#[0-9a-fA-F]{4}\}'), Literal::String::Char
54
54
  rule %r(".*``.*``.*"', String::Interpol
@@ -84,7 +84,7 @@ module Rouge
84
84
  rule %r([a-z][\w.]*), Name::Namespace, :pop!
85
85
  rule %r("(\\\\|\\"|[^"])*"), Literal::String, :pop!
86
86
  end
87
-
87
+
88
88
  state :comment do
89
89
  rule %r([^*/]), Comment.Multiline
90
90
  rule %r(/\*), Comment::Multiline, :push!
@@ -20,11 +20,11 @@ module Rouge
20
20
  state :root do
21
21
  rule %r/\s+/, Text
22
22
 
23
- rule %r/^(ONBUILD)(\s+)(#{KEYWORDS})(.*)/io do |m|
23
+ rule %r/^(ONBUILD)(\s+)(#{KEYWORDS})(.*)/io do
24
24
  groups Keyword, Text::Whitespace, Keyword, Str
25
25
  end
26
26
 
27
- rule %r/^(#{KEYWORDS})\b(.*)/io do |m|
27
+ rule %r/^(#{KEYWORDS})\b(.*)/io do
28
28
  groups Keyword, Str
29
29
  end
30
30
 
@@ -38,8 +38,11 @@ module Rouge
38
38
  rule %r/[a-zA-Z_!]\w*[!\?]?/, Name
39
39
  rule %r{::|[%(){};,/\|:\\\[\]]}, Punctuation
40
40
  rule %r/@[a-zA-Z_]\w*|&\d/, Name::Variable
41
- rule %r{\b(0[xX][0-9A-Fa-f]+|\d(_?\d)*(\.(?![^\d\s])
42
- (_?\d)*)?([eE][-+]?\d(_?\d)*)?|0[bB][01]+)\b}x, Num
41
+ rule %r{\b\d(_?\d)*(\.(?![^\d\s])(_?\d)+)([eE][-+]?\d(_?\d)*)?\b}, Num::Float
42
+ rule %r{\b0x[0-9A-Fa-f](_?[0-9A-Fa-f])*\b}, Num::Hex
43
+ rule %r{\b0o[0-7](_?[0-7])*\b}, Num::Oct
44
+ rule %r{\b0b[01](_?[01])*\b}, Num::Bin
45
+ rule %r{\b\d(_?\d)*\b}, Num::Integer
43
46
 
44
47
  mixin :strings
45
48
  mixin :sigil_strings