This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 122207 - syntax conformance
Summary: syntax conformance
Status: VERIFIED FIXED
Alias: None
Product: php
Classification: Unclassified
Component: Editor (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Denis Anisimov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-17 14:17 UTC by _ alexlamsl
Modified: 2007-11-22 01:55 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ alexlamsl 2007-11-17 14:17:38 UTC
The following are accepted when tested in PHP 5.2.4, but will be reported as errors inside the IDE editor.

array(1, 2, 3,);

switch(i) {
case ' ';
case '.';
//...
}




Product Version: NetBeans IDE Dev (Build 200711160000)
Java: 1.6.0_10-ea; Java HotSpot(TM) Client VM 1.6.0_10-ea-b07
System: Windows Vista version 6.0 running on x86; Cp1252; en_GB (nb)
Comment 1 Denis Anisimov 2007-11-19 11:53:02 UTC
Partial fix for first problem ( "array" function ) :

    RCS file: /cvs/scripting/php/srcmodel/test/unit/src/org/netbeans/modules/php/model/ArrayTest.java,v
    done
    Checking in php/srcmodel/test/unit/src/org/netbeans/modules/php/model/ArrayTest.java;
    /cvs/scripting/php/srcmodel/test/unit/src/org/netbeans/modules/php/model/ArrayTest.java,v  <--  ArrayTest.java
    initial revision: 1.1
    done
    Checking in php/editing/src/org/netbeans/modules/languages/php/resources/purePHP5.nbs;
    /cvs/scripting/php/editing/src/org/netbeans/modules/languages/php/resources/purePHP5.nbs,v  <--  purePHP5.nbs
    new revision: 1.58; previous revision: 1.57
    done
    Checking in php/srcmodel/test/unit/src/org/netbeans/modules/php/model/resources/ResourceMarker.java;
    /cvs/scripting/php/srcmodel/test/unit/src/org/netbeans/modules/php/model/resources/ResourceMarker.java,v  <-- 
ResourceMarker.java
    new revision: 1.11; previous revision: 1.10
    done
    RCS file: /cvs/scripting/php/srcmodel/test/unit/src/org/netbeans/modules/php/model/resources/array.php,v
    done
    Checking in php/srcmodel/test/unit/src/org/netbeans/modules/php/model/resources/array.php;
    /cvs/scripting/php/srcmodel/test/unit/src/org/netbeans/modules/php/model/resources/array.php,v  <--  array.php
    initial revision: 1.1
    done

The was previous fixes for "array" function but either they was incorrect or "languages" module implementation 
was changed and they don't work currently. The problem in "nbs" file that doesn't provide good possibility to 
write correct grammar construction for "array". I choose approach with not exact grammar construction.
Current grammar construction recognizes "array" usage as correct when it is incorrect . This behavior will be 
fixed later when manual error detection will be written. 
Comment 2 Denis Anisimov 2007-11-19 11:56:26 UTC
Switch construction is actually corner case:
such construction are not described in PHP manual and this is like "hack" possibility 
that is not disabled in PHP language.
Each "case" should be paired token ":" by language description.
And I don't see any indication about correctness of represented construction.
But it is really recognized by parser. So we need somehow to remove errors.
Comment 3 Denis Anisimov 2007-11-19 12:08:13 UTC
Fix for switch :

    Checking in php/editing/src/org/netbeans/modules/languages/php/resources/purePHP5.nbs;
    /cvs/scripting/php/editing/src/org/netbeans/modules/languages/php/resources/purePHP5.nbs,v  <--  purePHP5.nbs
    new revision: 1.59; previous revision: 1.58
    done
Comment 4 Denis Anisimov 2007-11-19 12:09:33 UTC
Fixed.
Comment 5 _ alexlamsl 2007-11-22 01:51:16 UTC
Verified - Thanks.

Product Version: NetBeans IDE Dev (Build 200711191200)
Java: 1.6.0_10-ea; Java HotSpot(TM) Client VM 1.6.0_10-ea-b07
System: Windows Vista version 6.0 running on x86; Cp1252; en_GB (nb)
Comment 6 _ alexlamsl 2007-11-22 01:55:11 UTC
By the way, the fix for array initialisation syntax might have caused #122565