Function list for my SQL files is empty and PHP functions listed twice

Function list for my SQL files is empty and PHP functions listed twice

3
NewbieNewbie
3

    Oct 15, 2009#1

    I had all this working in UEStudio a couple of years ago but a bizarre crash and UEStudio upgrade to 09.20.0.1003 apparently wiped out my Wordfile.txt changes (and of course it was one of the files I didn't back up).

    This CREATE VIEW displays correctly with the correct syntax highlighting. But the function (in fact none of the CREATE VIEW functions) doesn't show up in the Function list. This is pretty annoying because my .sql View files contain up to 50 named views.

    Code: Select all

    CREATE VIEW view_active_demographic AS
        SELECT
            demographic_detail.*,
            ref_state.abbreviation AS state
        FROM
            demographic_detail
            LEFT JOIN ref_state USING(ref_state_id)
        WHERE
            demographic_detail.entity_status = ENTITY_ACTIVE();
    The same thing is happening to my PLPGSQL functions. Or, rather, not happening. They're not showing up in the Function list. Here's a typical PLPGSQL function:

    Code: Select all

    CREATE OR REPLACE FUNCTION insert_viewlog (
        v_note      VARCHAR) RETURNS VOID AS $$
    DECLARE
    BEGIN
        INSERT INTO viewlog (
            v_user,
            v_text,
            v_time)
        VALUES (
            session_user ,
            v_note,
            NOW());
    END;
    $$ LANGUAGE plpgsql;
    Any idea why these aren't populating the the Function List?


    I have sort of the opposite problem with PHP. PHP functions are populating the Function List twice -- once with the arguments and once without. But I know what the problem is there. The function parser doesn't like this bracketing style:

    Code: Select all

    function transport_get_private_trips_by_date($trms, $timestamp)
    {
        if (!is_object($trms) || !is_numeric($timestamp)) {
            return array(false, __FUNCTION__ . ': bad arguments');
        }
       ....
    }
    If I format the function like this, the function name displays only once:

    Code: Select all

    function transport_get_private_trips_by_date($trms, $timestamp) {
        if (!is_object($trms) || !is_numeric($timestamp)) {
            return array(false, __FUNCTION__ . ': bad arguments');
        }
       ....
    }

    6,682583
    Grand MasterGrand Master
    6,682583

      Oct 16, 2009#2

      I guess for syntax highlighting files with extension SQL UEStudio uses mysql.uew in directory %appdata%\IDMComp\UEStudio\wordfiles. This wordfile contains only 1 UltraEdit regular expression string to find functions:

      /Function String = "%[ ^t]++create table[ ^t]+`++^([a-z_0-9]+^)`++"
      • % ... start search at beginning of a line.
      • [ ^t]++ ... 0 or more occurrences of spaces or tabs CAN follow.
      • create table ... then this not case sensitive string MUST follow.
      • [ ^t]+ ... the next character MUST be a space or tab character and both characters CAN exist also multiple times.
      • `++ ... the next character CAN be a left single quotation mark. I don't know anything about SQL, but most languages use straight single quotes. Are in SQL really left single quotation marks used?
      • ^(...^) ... show the string part matching the expression inside the round brackets in the function list.
      • [a-z_0-9]+ ... a string MUST follow with at least 1 character which consists of only 0-9, A-Z, a-z and an underscore.
      • `++ ... the next character CAN be again a left single quotation mark. This is of course a completely useless expression here at end of the expression.
      Your functions are not found because the lines do not start with create table.

      You could use an OR expression to find tables and views:

      /Function String = "%[ ^t]++create[ ^t]+^{table^}^{view^}[ ^t]+`++^([a-z_0-9]+^)"

      or make it more general and find all type of CREATE followed by 1 string consisting only of letters with following expression:

      /Function String = "%[ ^t]++create[ ^t]+[a-z]+[ ^t]+`++^([a-z_0-9]+^)"

      But both regular expressions do not find your PLPGSQL function example. For this type of functions I suggest an additional function string inserted below the first function string.

      /Function String 1 = "%*function[ ^t]+^([a-z_0-9]+^)[ ^t]++("


      To your second question with the PHP functions listed twice in the function list. Wordfile php.uew contains 4 regular expressions:

      /Function String = "%[^t ]++function[^t ]+^([a-z0-9_&]+^)"
      /Function String 1 = "%[^t ]++function[^t ]+^([~{]+^)"
      /Function String 2 = "%[^t ]++^{public^}^{private^}[^t ]++function[^t ]+^([a-z0-9_&]+^)"
      /Function String 3 = "%[^t ]++protected[^t ]++function[^t ]+^([a-z0-9_&]+^)"


      The first one finds functions and tags only the function name on the same line for the function list. The second one is more general and works only with UES 9.00 (or even later, not tested) and UE v15.00 (or even later, also not tested) and later versions because it tags everything to next opening brace. The expression [~{]+ can match strings also over multiple lines. Previous versions of UE and UES did not support displaying a found multi-line string in the function list. It looks like IDM has added here something because this works now and it looks like UE and UES replace now every line ending and preceding spaces in the found string by a single space to create a single line string for the function list.

      So if you want in the function list just the function name, delete the line starting with /Function String 1 = and renumber the following 2 lines. If you want the functions with arguments in the function list, delete the first function string line, remove SPACE ONE from the next line and renumber the other 2 function strings.

      And finally I strongly recommend to copy the (modified) wordfiles you really use into a not write-protected directory like %appdata%\IDMComp\UEStudio\MyWordfiles and specify this directory in the syntax highlighting configuration dialog. Why? You don't have to think about wordfile updates with or without backup and possible manual restore when after an update/upgrade UEStudio asks you if one of the currently 13 standard wordfiles in the standard wordfiles directory should be updated. With your wordfiles in a separate directory you can always choose "yes, update with no backup" because the wordfiles in your separate directory are never updated. However, it is advisable to backup your wordfiles on a different storage medium in case of a hard disk or file system failure.
      Best regards from an UC/UE/UES for Windows user from Austria