zabel-xyz / plsql-language

plsql-language for vscode
MIT License
78 stars 29 forks source link

Conditional compilation support was broken in 1.6.2 #58

Closed Gepar closed 5 years ago

Gepar commented 5 years ago

In current version (1.6.2) parser stops parsing file when meets some conditional compilation directives. Not in all cases, but very often. In previous version parser just ignore them. You can see it in outline.

Example in package body: capture

`create or replace package body is_there_anybody_out_there as

procedure test0 is begin null; end;

/* YOU SHALL NOT PASS */
procedure test1 is
begin
    while false loop
        begin
            $IF true $THEN
                null;
            $END
        exception when others then
            null;
        end;
    end loop;
end;

procedure test2 is begin null; end;
procedure test3 is begin null; end;

end;```

Example in package header: capture2



    procedure test0;

    --it's not the procedure  you're looking for
    $IF true $THEN
    procedure test1;
    $END

    procedure test2;
    procedure test3;

end;```
Gepar commented 5 years ago

Maybe the best way for now it's just to ignore them. But i can't rewrite regexp to do this: RegExpParser.regComment = (?:\\/\\*[\\s\\S]*?\\*\\/)|(?:--.*);

zabel-xyz commented 5 years ago

Conditional compilation has never been supported.

In spec, it has never work, because regexp consider only definition ending with character ; regSpecSymbols =(?:(${RegExpParser.REG_WORD}+)\s+(${RegExpParser.REG_WORD}+)\s(?:\s;|.[^;]*;)) In body, it was ignored before

I'll modify the regExp parser to support it...

zabel-xyz commented 5 years ago

Fix in version 1.6.3 I added some tests, see xyz_myPackage.sql