@@ -14,7 +14,7 @@ internal class AbsoluteCodeLine
14
14
private const char BracketPlaceholder = '\x2 ';
15
15
private static readonly Regex StringReplaceRegex = new Regex ( StringPlaceholder . ToString ( CultureInfo . InvariantCulture ) ) ;
16
16
private static readonly Regex BracketReplaceRegex = new Regex ( BracketPlaceholder . ToString ( CultureInfo . InvariantCulture ) ) ;
17
- private static readonly Regex LineNumberRegex = new Regex ( @"^(?<number>\d+)\s+(?<code>.*)" , RegexOptions . ExplicitCapture ) ;
17
+ private static readonly Regex LineNumberRegex = new Regex ( @"^(?<number>(-? \d+)|(&H[0-9A-F]{1,8}) )\s+(?<code>.*)" , RegexOptions . ExplicitCapture ) ;
18
18
private static readonly Regex EndOfLineCommentRegex = new Regex ( @"^(?!(Rem\s)|('))(?<code>[^']*)(\s(?<comment>'.*))$" , RegexOptions . ExplicitCapture ) ;
19
19
private static readonly Regex ProcedureStartRegex = new Regex ( @"^(Public\s|Private\s|Friend\s)?(Static\s)?(Sub|Function|Property\s(Let|Get|Set))\s" ) ;
20
20
private static readonly Regex ProcedureStartIgnoreRegex = new Regex ( @"^[LR]?Set\s|^Let\s|^(Public|Private)\sDeclare\s(Function|Sub)" ) ;
@@ -29,7 +29,7 @@ internal class AbsoluteCodeLine
29
29
private static readonly Regex SingleLineElseIfRegex = new Regex ( @"^ElseIf\s.*\sThen\s.*" ) ;
30
30
31
31
private readonly IIndenterSettings _settings ;
32
- private uint _lineNumber ;
32
+ private int _lineNumber ;
33
33
private bool _numbered ;
34
34
private string _code ;
35
35
private readonly bool _stupidLineEnding ;
@@ -129,9 +129,14 @@ private void ExtractLineNumber()
129
129
var match = LineNumberRegex . Match ( _code ) ;
130
130
if ( match . Success )
131
131
{
132
- _numbered = true ;
133
- _lineNumber = Convert . ToUInt32 ( match . Groups [ "number" ] . Value ) ;
134
132
_code = match . Groups [ "code" ] . Value ;
133
+ _numbered = true ;
134
+ var number = match . Groups [ "number" ] . Value ;
135
+ if ( ! int . TryParse ( number , out _lineNumber ) )
136
+ {
137
+ int . TryParse ( number . Replace ( "&H" , string . Empty ) , NumberStyles . HexNumber ,
138
+ CultureInfo . InvariantCulture , out _lineNumber ) ;
139
+ }
135
140
}
136
141
}
137
142
_code = _code . Trim ( ) ;
0 commit comments