fixed some parser bugs
authorjsurfer <jsurfer>
Fri, 24 Sep 2004 19:47:10 +0000 (19:47 +0000)
committerjsurfer <jsurfer>
Fri, 24 Sep 2004 19:47:10 +0000 (19:47 +0000)
net.sourceforge.phpeclipse/plugin.xml
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/core/compiler/ITerminalSymbols.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Parser.java
net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/parser/Scanner.java

index 3846250..5e67157 100644 (file)
       </fileTypes>
       <fileTypes
             type="text"
-            extension="php5">
+            extension="php5"> 
       </fileTypes>
       <fileTypes
             type="text"
             type="text"
             extension="phtml">
       </fileTypes>
-  <!--    <fileTypes
+      <fileTypes
             type="text"
             extension="html">
       </fileTypes>
       </fileTypes>
       <fileTypes
             type="text"
-            extension="xml">
+            extension="xhtml">
       </fileTypes> 
-      <fileTypes
+  <!--    <fileTypes
             type="text"
             extension="tpl">
       </fileTypes> -->
             symbolicFontName="net.sourceforge.phpdt.ui.editors.textfont"
             id="net.sourceforge.phpeclipse.PHPUnitEditor">
       </editor>
- <!--     <editor
+      <editor
             name="%phpEditorName"
             default="true"
             icon="icons/obj16/htmledit.gif"
       <editor
             name="%phpEditorName"
             default="true"
-            icon="icons/obj16/xmledit.gif"
-            extensions="xml"
+            icon="icons/obj16/htmledit.gif"
+            extensions="xhtml"
             contributorClass="net.sourceforge.phpeclipse.phpeditor.CompilationUnitEditorActionContributor"
             class="net.sourceforge.phpeclipse.phpeditor.PHPUnitEditor"
             symbolicFontName="net.sourceforge.phpdt.ui.editors.textfont"
             id="net.sourceforge.phpeclipse.PHPUnitEditor">
       </editor>
-      <editor
+  <!--    <editor
             name="%phpEditorName"
             default="true"
             icon="icons/obj16/htmledit.gif"
                id="net.sourceforge.phpeclipse.actions.showAction">
          </action>
       </objectContribution>
-            <objectContribution
+      <objectContribution
             objectClass="org.eclipse.core.resources.IFile"
             nameFilter="*.xml"
             id="net.sourceforge.phpeclipse.actions.popupShowAction">
          name="%javaDocumentSetupParticipant"
          point="org.eclipse.core.filebuffers.documentSetup"> 
       <participant
-            extensions="php,php3,php4,php5,module,inc,phtml"
+            extensions="php,php3,php4,php5,module,inc,phtml,html,htm,xhtml"
             class="net.sourceforge.phpeclipse.phpeditor.JavaDocumentSetupParticipant">
       </participant>
    <!--   <participant
             id="net.sourceforge.phpeclipse.phpeditor.PHPDocumentProvider">
       </provider>
    </extension>
-<!--  <extension
+  <extension
          point="org.eclipse.ui.editors.documentProviders">
       <provider
             extensions="%htmlFileExtension"
    <extension
          point="org.eclipse.ui.editors.documentProviders">
       <provider
-            extensions="%xmlFileExtension"
+            extensions="xhtml"
             class="net.sourceforge.phpeclipse.phpeditor.PHPDocumentProvider"
             id="net.sourceforge.phpeclipse.phpeditor.PHPDocumentProvider">
       </provider>
    </extension>
-   <extension
+ <!--  <extension
          point="org.eclipse.ui.editors.documentProviders">
       <provider
             extensions="%tplFileExtension"
index fd7fb91..0a1bc76 100644 (file)
@@ -109,7 +109,7 @@ public interface ITerminalSymbols {
   
   final static int TokenNameSTRING = 193;
   
-  final static int TokenNameCURLY_OPEN = 194;
+  final static int TokenNameLBRACE_DOLLAR = 194;
   
   // start SQL token - the SQL tokens are only used in the
   // PHPCompletionprocessor:
index aec5e9f..1bc55b9 100644 (file)
@@ -2943,16 +2943,9 @@ public class Parser //extends PHPParserSuperclass
           break;
         case TokenNameVariable :
         case TokenNameDOLLAR_LBRACE :
-        case TokenNameCURLY_OPEN :
+        case TokenNameLBRACE_DOLLAR :
           encaps_var();
           break;
-        //        case TokenNameDOLLAR :
-        //          getNextToken();
-        //          if (token == TokenNameLBRACE) {
-        //            token = TokenNameDOLLAR_LBRACE;
-        //            encaps_var();
-        //          }
-        //          break;
         default :
           char encapsedChar = ((Character) scanner.encapsedStringStack.peek()).charValue();
           if (encapsedChar == '$') {
@@ -3053,7 +3046,9 @@ public class Parser //extends PHPParserSuperclass
         break;
       case TokenNameDOLLAR_LBRACE :
         getNextToken();
-        if (token == TokenNameIdentifier) {
+        if (token == TokenNameDOLLAR_LBRACE) {
+          encaps_var();
+        } else if (token == TokenNameIdentifier) {
           getNextToken();
           if (token == TokenNameLBRACKET) {
             getNextToken();
@@ -3067,23 +3062,19 @@ public class Parser //extends PHPParserSuperclass
             getNextToken();
             //            }
           }
-          if (token != TokenNameRBRACE) {
-            throwSyntaxError("'}' expected after '${'.");
-          }
-          //          scanner.encapsedStringStack.pop();
-          getNextToken();
         } else {
           expr();
-          if (token != TokenNameRBRACE) {
-            throwSyntaxError("'}' expected.");
-          }
-          //          scanner.encapsedStringStack.pop();
-          getNextToken();
         }
+        if (token != TokenNameRBRACE) {
+          throwSyntaxError("'}' expected.");
+        }
+        getNextToken();
         break;
-      case TokenNameCURLY_OPEN :
+      case TokenNameLBRACE_DOLLAR :
         getNextToken();
-        if (token == TokenNameIdentifier || token > TokenNameKEYWORD) {
+        if (token == TokenNameLBRACE_DOLLAR) {
+          encaps_var();
+        } else if (token == TokenNameIdentifier || token > TokenNameKEYWORD) {
           getNextToken();
           if (token == TokenNameLBRACKET) {
             getNextToken();
index e313f23..0997cb7 100644 (file)
@@ -1191,7 +1191,7 @@ public class Scanner implements IScanner, ITerminalSymbols {
               case '{' :
                 if (encapsedChar == '$') {
                   if (getNextChar('$'))
-                    return TokenNameCURLY_OPEN;
+                    return TokenNameLBRACE_DOLLAR;
                 }
                 return TokenNameLBRACE;
               case '}' :
@@ -3860,6 +3860,8 @@ public class Scanner implements IScanner, ITerminalSymbols {
         return "$";
       case TokenNameDOLLAR_LBRACE :
         return "${";
+      case TokenNameLBRACE_DOLLAR :
+        return "{$";
       case TokenNameEOF :
         return "EOF"; //$NON-NLS-1$
       case TokenNameWHITESPACE :