From 596f957ed701d22f32f6e03ad2c31f78ba9c2127 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 22 Feb 2013 12:25:08 +0000 Subject: maximus: Adds syntax highlighting for hexadecimal numbers --- examples/apps/ide/src/frm_main.pas | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'examples') diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index 0b221f6c..6c1ffb8c 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -167,7 +167,8 @@ const cString1 = '''.*'''; cDecimal = '\b(([0-9]+)|([0-9]+\.[0-9]+([Ee][-]?[0-9]+)?))\b'; - cHexidecimal = '\b\$[0-9a-fA-F]*\b'; + cHexadecimal = '\$[0-9a-fA-F]+'; + {@VFD_NEWFORM_IMPL} @@ -762,6 +763,23 @@ begin until not FRegex.ExecNext; end; + { syntax highlighting for: cHexadecimal } + ACanvas.TextColor := clMagenta; + FRegex.Expression := cHexadecimal; + if FRegex.Exec(ALineText) then + begin + repeat + lMatchPos := FRegex.MatchPos[0]; + lOffset := FRegex.MatchLen[0]; + s := FRegex.Match[0]; + j := Length(s); + r.SetRect(ATextRect.Left + (edt.FontWidth * (lMatchPos-1)), ATextRect.Top, + (edt.FontWidth *j), ATextRect.Height); + ACanvas.FillRectangle(r); + ACanvas.DrawText(r, s); + until not FRegex.ExecNext; + end; + { syntax highlighting for: comments2 } ACanvas.TextColor := clDarkCyan; FRegex.Expression := cComments2; -- cgit v1.2.3-70-g09d2