@@ -30,7 +30,7 @@ class CodeRay::Scanners::Lua < CodeRay::Scanners::Scanner
30
30
31
31
SCANNER = /
32
32
(?<space>\s *) # eat leading whitespace, just to make iteration of fluff easier
33
- (?<fluff>[ \d \D ]*? ) # eat content up until something we want
33
+ (?<fluff>(?m:.*?) ) # eat content up until something we want
34
34
(?:
35
35
\b (?<keyword>#{ KEYWORDS . join ( '|' ) } )\b
36
36
|
@@ -44,34 +44,34 @@ class CodeRay::Scanners::Lua < CodeRay::Scanners::Scanner
44
44
(?<s2q2>')
45
45
|
46
46
(?<s3q1>\[ (?<stringequals>=*)\[ )
47
- (?<s3>[ \d \D ] *?) # Not using multiline mode due to single-line comments
47
+ (?<s3>(?m:. *?))
48
48
(?<s3q2>\] \k <stringequals>\] )
49
49
)
50
50
|
51
51
\b (?<number>
52
52
-? # Allows -2 to be properly highlighted, but makes 10-5 show -5 as a single number
53
- (?:
54
- 0[xX]
53
+ (?i :
54
+ 0x
55
55
(?:
56
- [\d a-fA-F ]+\. ?[\d a-fA-F ]* # 0xA and 0xA. and 0xA.1
56
+ [\d a-f ]+\. ?[\d a-f ]* # 0xA and 0xA. and 0xA.1
57
57
|
58
- \. [\d a-fA-F]+ # 0x.A
58
+ \. [\d a-f]+ # 0x.A
59
59
)
60
- (?:[pP][ -+]?\d +)? # 0xA.1p-3
60
+ (?:p[ -+]?\d +)? # 0xA.1p-3
61
61
|
62
62
(?:
63
- \d +\. ?\d * # 3 and 3. and 3.14
63
+ \d +\. ?\d * # 3 and 3. and 3.14
64
64
|
65
- \. \d + # .3
65
+ \. \d + # .3
66
66
)
67
- (?:[eE][ -+]?\d +)? # 3.1e-7
67
+ (?:e[ -+]?\d +)? # 3.1e-7
68
68
)
69
69
)\b
70
70
|
71
71
(?:
72
- (?<blockcommentstart >--\[ (?<commentequals >=*)\[ )
73
- (?<blockcommentmain>[ \d \D ] *?) # Not using multiline mode due to single-line comments
74
- (?<blockcommentclose >\] \k <commentequals >\] )
72
+ (?<blockstart >--\[ (?<blockequals >=*)\[ )
73
+ (?<blockmain>(?m:. *?))
74
+ (?<blockclose >\] \k <blockequals >\] )
75
75
)
76
76
|
77
77
(?<comment>
@@ -99,19 +99,19 @@ class CodeRay::Scanners::Lua < CodeRay::Scanners::Scanner
99
99
)
100
100
|
101
101
(?<gotolabel>
102
- :: [a-zA-Z_ ]\w *::
102
+ (?i::: [a-z_ ]\w *::)
103
103
)
104
104
)
105
105
/x
106
106
107
107
CAPTURE_KINDS = {
108
108
reserved : :reserved ,
109
109
comment : :comment ,
110
- blockcommentstart : {
110
+ blockstart : {
111
111
_group : :comment ,
112
- blockcommentstart : :delimiter ,
113
- blockcommentmain : :content ,
114
- blockcommentclose : :delimiter
112
+ blockstart : :delimiter ,
113
+ blockmain : :content ,
114
+ blockclose : :delimiter
115
115
} ,
116
116
keyword : :keyword ,
117
117
number : :float ,
0 commit comments