pygments.rb 0.2.9 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Pygments
2
- VERSION = '0.2.9'
2
+ VERSION = '0.2.10'
3
3
  end
@@ -29,8 +29,8 @@ class Dasm16Lexer(RegexLexer):
29
29
 
30
30
  INSTRUCTIONS = [
31
31
  'SET', 'ADD', 'SUB', 'MUL', 'DIV', 'MOD', 'SHL',
32
- 'SHR', 'AND', 'BOR', 'XOR', 'IFE', 'IFN', 'IFG'
33
- 'IFB', 'JSR'
32
+ 'SHR', 'AND', 'BOR', 'XOR', 'IFE', 'IFN', 'IFG', 'IFB',
33
+ 'JSR'
34
34
  ]
35
35
 
36
36
  REGISTERS = [
@@ -42,6 +42,7 @@ class Dasm16Lexer(RegexLexer):
42
42
  ]
43
43
 
44
44
  # Regexes yo
45
+ string = r'"(\\"|[^"])*"'
45
46
  char = r'[a-zA-Z$._0-9@]'
46
47
  identifier = r'(?:[a-zA-Z$_]' + char + '*|\.' + char + '+)'
47
48
  number = r'(?:0[xX][a-zA-Z0-9]+|\d+)'
@@ -49,7 +50,7 @@ class Dasm16Lexer(RegexLexer):
49
50
 
50
51
  def guess_identifier(lexer, match):
51
52
  ident = match.group(0)
52
- klass = Name.Variable if ident in lexer.REGISTERS else Name.Label
53
+ klass = Name.Variable if ident.lower() in lexer.REGISTERS else Name.Label
53
54
  yield match.start(), klass, ident
54
55
 
55
56
  tokens = {
@@ -57,6 +58,7 @@ class Dasm16Lexer(RegexLexer):
57
58
  include('whitespace'),
58
59
  (':' + identifier, Name.Label),
59
60
  (instruction, Name.Function, 'instruction-args'),
61
+ (r'(DAT|dat)', Name.Function, 'data-args'),
60
62
  (r'[\r\n]+', Text)
61
63
  ],
62
64
 
@@ -72,15 +74,26 @@ class Dasm16Lexer(RegexLexer):
72
74
  include('whitespace')
73
75
  ],
74
76
 
77
+ 'instruction-line' : [
78
+ (r'[\r\n]+', Text, '#pop'),
79
+ (r';.*?$', Comment, '#pop'),
80
+ include('whitespace')
81
+ ],
82
+
75
83
  'instruction-args': [
76
84
  (r',', Punctuation),
77
85
  (r'\[', Punctuation, 'deref'),
78
86
  include('arg'),
87
+ include('instruction-line')
88
+ ],
79
89
 
80
- (r'[\r\n]+', Text, '#pop'),
81
- (r';.*?$', Comment, '#pop'),
82
- include('whitespace')
90
+ 'data-args' : [
91
+ (r',', Punctuation),
92
+ (number, Number.Integer),
93
+ (string, String),
94
+ include('instruction-line')
83
95
  ],
96
+
84
97
  'whitespace': [
85
98
  (r'\n', Text),
86
99
  (r'\s+', Text),
@@ -29,8 +29,8 @@ class Dasm16Lexer(RegexLexer):
29
29
 
30
30
  INSTRUCTIONS = [
31
31
  'SET', 'ADD', 'SUB', 'MUL', 'DIV', 'MOD', 'SHL',
32
- 'SHR', 'AND', 'BOR', 'XOR', 'IFE', 'IFN', 'IFG'
33
- 'IFB', 'JSR'
32
+ 'SHR', 'AND', 'BOR', 'XOR', 'IFE', 'IFN', 'IFG', 'IFB',
33
+ 'JSR'
34
34
  ]
35
35
 
36
36
  REGISTERS = [
@@ -42,6 +42,7 @@ class Dasm16Lexer(RegexLexer):
42
42
  ]
43
43
 
44
44
  # Regexes yo
45
+ string = r'"(\\"|[^"])*"'
45
46
  char = r'[a-zA-Z$._0-9@]'
46
47
  identifier = r'(?:[a-zA-Z$_]' + char + '*|\.' + char + '+)'
47
48
  number = r'(?:0[xX][a-zA-Z0-9]+|\d+)'
@@ -49,7 +50,7 @@ class Dasm16Lexer(RegexLexer):
49
50
 
50
51
  def guess_identifier(lexer, match):
51
52
  ident = match.group(0)
52
- klass = Name.Variable if ident in lexer.REGISTERS else Name.Label
53
+ klass = Name.Variable if ident.lower() in lexer.REGISTERS else Name.Label
53
54
  yield match.start(), klass, ident
54
55
 
55
56
  tokens = {
@@ -57,6 +58,7 @@ class Dasm16Lexer(RegexLexer):
57
58
  include('whitespace'),
58
59
  (':' + identifier, Name.Label),
59
60
  (instruction, Name.Function, 'instruction-args'),
61
+ (r'(DAT|dat)', Name.Function, 'data-args'),
60
62
  (r'[\r\n]+', Text)
61
63
  ],
62
64
 
@@ -72,15 +74,26 @@ class Dasm16Lexer(RegexLexer):
72
74
  include('whitespace')
73
75
  ],
74
76
 
77
+ 'instruction-line' : [
78
+ (r'[\r\n]+', Text, '#pop'),
79
+ (r';.*?$', Comment, '#pop'),
80
+ include('whitespace')
81
+ ],
82
+
75
83
  'instruction-args': [
76
84
  (r',', Punctuation),
77
85
  (r'\[', Punctuation, 'deref'),
78
86
  include('arg'),
87
+ include('instruction-line')
88
+ ],
79
89
 
80
- (r'[\r\n]+', Text, '#pop'),
81
- (r';.*?$', Comment, '#pop'),
82
- include('whitespace')
90
+ 'data-args' : [
91
+ (r',', Punctuation),
92
+ (number, Number.Integer),
93
+ (string, String),
94
+ include('instruction-line')
83
95
  ],
96
+
84
97
  'whitespace': [
85
98
  (r'\n', Text),
86
99
  (r'\s+', Text),
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pygments.rb
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
4
+ hash: 3
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 9
10
- version: 0.2.9
9
+ - 10
10
+ version: 0.2.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Aman Gupta
@@ -15,7 +15,8 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-04-09 00:00:00 Z
18
+ date: 2012-04-09 00:00:00 -07:00
19
+ default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
21
22
  name: rubypython
@@ -412,6 +413,7 @@ files:
412
413
  - vendor/pygments-main/tests/test_token.py
413
414
  - vendor/pygments-main/tests/test_using_api.py
414
415
  - vendor/pygments-main/tests/test_util.py
416
+ has_rdoc: true
415
417
  homepage: http://github.com/tmm1/pygments.rb
416
418
  licenses: []
417
419
 
@@ -441,7 +443,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
441
443
  requirements: []
442
444
 
443
445
  rubyforge_project:
444
- rubygems_version: 1.8.15
446
+ rubygems_version: 1.6.2
445
447
  signing_key:
446
448
  specification_version: 3
447
449
  summary: pygments wrapper for ruby