[Gambas-user] New highlighting component (episode 2)

Benoît Minisini benoit.minisini at gambas-basic.org
Sat Oct 28 23:20:11 CEST 2023


Le 28/10/2023 à 22:54, Bruce Steers a écrit :
> 
> here is my sh definition file....
> https://gitlab.com/gambas/gambas/-/merge_requests/313/diffs 
> <https://gitlab.com/gambas/gambas/-/merge_requests/313/diffs>
> 
> ---------------------------------------
> comment:
> from #
> number:
> match /[+-]?[0-9]+(\.[0-9]+)?([Ee][+-]?[0-9]+)?/
> match /0x[0-9a-fA-F]+/
> string:
> from " to "
> from ' to '
> escape:
> match /\\[fnrtv0'"\\]/
> match /\\c[A-Za-z]/
> match /\\x[0-9a-fA-F]{2}/
> match /\\u[0-9a-fA-F]{4}/
> match /\\u{[0-9a-fA-F]+}/
> keyword:
> word function do else test for to in fi if elif then return exit while 
> until done break continue select case esac
> operator:
> symbol { } $ # [ ] -gt -lt -ge -ne -le -eq <<< . + << = >> == - ~ += ( , 
> != * -= &= ;; ) < % & ]; @ ! ; > | ? ^ : <= / `
> function:
> keyword echo read cd which rm cp mv rmdir cat grep awk tr sed sleep 
> clear sudo su source eval export time date pwd set unset chown chmod 
> exec alias unalias bg bind builtin caller command compgen complete 
> compopt declare dirs disown enable fc fg getopts hash help history jobs 
> kill let local logout mapfile popd printf pushd readarray readonly shift 
> shopt suspend test times trap type typeset ulimit umask wait
> ----------------------------------------------
> i simply copied the numerical and string patterns from other files.
> 
> problems...
> the hash # for comments gets registered at ANY # char even one in a 
> statement.
> i wanted to set it to "# " (with a space) but do not know how.

What is the exact syntax for "#" comments? Is it at the start of the 
line only? Or anywhere until the end of the line? I don't think a space 
after is required to be a comment.

> I have no idea what i am doing with pcre

You can read the quick pcre syntax reference on the wiki to get an idea.

> 
> This needs people with pcre regex knowledge to examine and refine as 
> frankly i am out of my depth.
> 

Good job anyway. It's a start. :-)

Can you repost your file, as the indentation has been lost in the mail 
servers swamp?

-- 
Benoît Minisini.



More information about the User mailing list