From 051111520be7868dce866759518f67864dc7ec8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Mon, 30 Oct 2023 00:33:37 +0100 Subject: [PATCH] Fix 'css' highlighting. [GB.HIGHLIGHT] * BUG: Fix 'css' highlighting. --- comp/src/gb.highlight/.src/CState.class | 2 +- comp/src/gb.highlight/.src/Main.module | 3 ++- .../gb.highlight/.src/TextHighlighter.class | 2 +- comp/src/gb.highlight/highlight/css.block | 18 ++++++++++-------- comp/src/gb.highlight/highlight/css.highlight | 2 +- 5 files changed, 15 insertions(+), 12 deletions(-) diff --git a/comp/src/gb.highlight/.src/CState.class b/comp/src/gb.highlight/.src/CState.class index aca8d0a49..5ba4afddf 100644 --- a/comp/src/gb.highlight/.src/CState.class +++ b/comp/src/gb.highlight/.src/CState.class @@ -144,7 +144,7 @@ Static Public Sub Print(Optional sCode As String) $sLastCode = sCode Do - If sCode Begins "Static " Or If sCode Begins "Private " Or If sCode Begins "Public " Then + If sCode Begins "Static " Or If sCode Begins "Private " Or If sCode Begins "Public " Or If sCode Begins "Fast " Then sCode = Mid$(sCode, InStr(sCode, " ") + 1) Else Break diff --git a/comp/src/gb.highlight/.src/Main.module b/comp/src/gb.highlight/.src/Main.module index a9c83cf72..15b02da4c 100644 --- a/comp/src/gb.highlight/.src/Main.module +++ b/comp/src/gb.highlight/.src/Main.module @@ -21,6 +21,7 @@ Public Sub Main() 'File.Save("~/test.html", TextHighlighter["webpage"].ToHTML(File.Load(Application.Path &/ ".hidden/test/Webpage1.webpage"))) 'File.Save("~/test.html", TextHighlighter["sh"].ToHTML(File.Load("~/gambas/git/master/acinclude.m4"))) - Print TextHighlighter["javascript"].ToANSI(File.Load("~/asap/omogen/master/src/kernel/guygle.cgi/javascript/selectr.js")) + 'Print TextHighlighter["javascript"].ToANSI(File.Load("~/asap/omogen/master/src/kernel/guygle.cgi/javascript/selectr.js")) + Print TextHighlighter["css"].ToANSI(File.Load("~/asap/omogen/master/src/kernel/guygle.cgi/style/style-modern.css")) End diff --git a/comp/src/gb.highlight/.src/TextHighlighter.class b/comp/src/gb.highlight/.src/TextHighlighter.class index 272be8614..a2790a104 100644 --- a/comp/src/gb.highlight/.src/TextHighlighter.class +++ b/comp/src/gb.highlight/.src/TextHighlighter.class @@ -233,7 +233,7 @@ Static Private Sub CreateCustomHighlighter(sHighlight As String, sPath As String iLine = 0 CState.Print() - CState.Print("Private Sub Compile(aState as Byte[])") + CState.Print("Private Sub Compile(aState As Byte[])") CState.Print() CState.Print("Dim sWord, sSymbol As String") CState.Print("Dim I As Integer") diff --git a/comp/src/gb.highlight/highlight/css.block b/comp/src/gb.highlight/highlight/css.block index 4389230a1..73a98c9a1 100644 --- a/comp/src/gb.highlight/highlight/css.block +++ b/comp/src/gb.highlight/highlight/css.block @@ -5,23 +5,25 @@ block{Operator}: block.comment{Comment}: from /* to */ identifier{Normal}: - match \$(IDENT)\ + match /$(IDENT)/ property{Operator}: from : to ; + color{Constant}: + match /#[0-9A-Fa-f]{6}/ + match /#[0-9A-Fa-f]{3}/ + number: + match /$(NUMBER)/ + unit{Function}: + match /$(IDENT)/ important: match "!important" identifier{Keyword}: - match \$(IDENT)\ + match /$(IDENT)/ symbol % - number: - match \$(NUMBER)\ string: from " to " from ' to ' string.escape{Escape}: - match \$(ESCAPE)\ - color{Constant}: - match \#[0-9A-Fa-f]{6}\ - match \#[0-9A-Fa-f]{3}\ + match /$(ESCAPE)/ operator: symbol ( ) , diff --git a/comp/src/gb.highlight/highlight/css.highlight b/comp/src/gb.highlight/highlight/css.highlight index 87243bff9..a9c03ac73 100644 --- a/comp/src/gb.highlight/highlight/css.highlight +++ b/comp/src/gb.highlight/highlight/css.highlight @@ -32,4 +32,4 @@ type{Keyword}: from ' to ' operator: symbol > , + -@include css.block \ No newline at end of file +@include css.block