[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gambas-bugtracker] Bug #3134: add limit on function lines to sh highlight


http://gambaswiki.org/bugtracker/edit?object=BUG.3134&from=L21haW4-

Bruce STEERS reported a new bug.

Summary
-------

add limit on function lines to sh highlight

Type             : Request
Priority         : Low
Gambas version   : Master
Product          : GUI components


Description
-----------

Hi Benoit, I have tried to add limit to sh highlight for function lines but even though i have made progress i am pretty clueless as to if i am doing it right.

Basically a function in bash either starts with the word function (this part i have managed to get working)
or is just a word ending in () followed by encasing { brackets } 

so..
function myFunction() {
}

or
myFunction() {
}
or
myFunction()
  {
  }


my sh.highlight file is like this...
@include _number.regexp

  match /\\./
shebang{Shebang=Preprocessor}:
  from /^#!/
number:
  match /$(NUMBER)/
  match /$(NUMBER_HEXA)/
string.simple{String}:
  from ' to '
  escape:
    match /\\./
string.double{String}:
  from " to "
  escape:
    match /\\[$`'"\\]/
  expansion{Expansion=Datatype}:
    match /\$[A-Za-z0-9_]+/
  command{Expansion}:
    from ` to ` with sh
string.ansi{String}:
  from $' to '
  escape:
    match /\\[abeEfnrtv\\'"?]/
    match /\\[0-7]{3}/
    match /\\x[0-9a-fA-F]{2}/
    match /\\u[0-9a-fA-F]{4}/
    match /\\u[0-9a-fA-F]{8}/
    match /\\c[a-zA-Z]/
expansion{Expansion}:
  match /\$[A-Za-z0-9_]+/
  limit
  keyword function
command{Expansion}:
  from ` to ` with sh
keyword:
  keyword 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
  symbol { } $ [ ] <<< . + << = >> == - ~ += ( , != * -= &= ) < % & @ ! ; > | ? ^ : <= /
function{Command=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
symbol:
  match /[A-Za-z_][A-Za-z_0-9]*/
comment:
  from /^#/
  from /\s*#\s/
expansion.brace{Expansion}:
  from ${ to } with sh

adding to expansion(Expansion) was the only state i could get it to work in.

But like i say i really do not understand what i am doing and and making it work by luck and wondered if you might use your expertise to apply what is probably a fairly simple feature if you know what you are doing.

Many thanks
Bruce


System information
------------------

n/a



----[ Gambas bugtracker-list is hosted by https://www.hostsharing.net ]----