Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix highlight of hex numbers in Pascal lexer #1840

Merged
merged 1 commit into from
Jun 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/rouge/lexers/pascal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class Pascal < RegexLexer
mixin :whitespace

rule %r{((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?}, Num
rule %r/\$[0-9A-Fa-f]+/, Num::Hex
rule %r{[~!@#\$%\^&\*\(\)\+`\-={}\[\]:;<>\?,\.\/\|\\]}, Punctuation
rule %r{'([^']|'')*'}, Str
rule %r/(true|false|nil)\b/i, Name::Builtin
Expand Down
15 changes: 15 additions & 0 deletions spec/visual/samples/pascal
Original file line number Diff line number Diff line change
Expand Up @@ -487,3 +487,18 @@ PROGRAM a1 (input,output);
ReadString(Command)
END
END.

-- Hex numbers
function UnicodeToISO_8859_9(Unicode: cardinal): integer;
begin
case Unicode of
0..255: Result:=Unicode;
$011E: Result:= $D0;
$0130: Result:= $DD;
$015E: Result:= $DE;
$011F: Result:= $F0;
$0131: Result:= $FD;
$015F: Result:= $FE;
else Result:=-1;
end;
end;