Changeset View
Changeset View
Standalone View
Standalone View
parser/php.g
Context not available. | |||||
138 | OperationSr, | 138 | OperationSr, | ||
---|---|---|---|---|---|
139 | OperationSpaceship, | 139 | OperationSpaceship, | ||
140 | }; | 140 | }; | ||
141 | | ||||
142 | enum UseImportType { | ||||
143 | NamespaceOrClassImport, | ||||
144 | ConstantImport, | ||||
145 | FunctionImport | ||||
146 | }; | ||||
147 | | ||||
141 | :] | 148 | :] | ||
142 | 149 | | |||
143 | ------------------------------------------------------------ | 150 | ------------------------------------------------------------ | ||
Context not available. | |||||
182 | DefaultState = 1 | 189 | DefaultState = 1 | ||
183 | }; | 190 | }; | ||
184 | 191 | | |||
192 | enum ParserUseImportType { | ||||
193 | NamespaceOrClassImport, | ||||
194 | ConstantImport, | ||||
195 | FunctionImport | ||||
196 | }; | ||||
197 | ParserUseImportType m_useImportType; | ||||
198 | ParserUseImportType m_useCompoundImportType; | ||||
185 | :] | 199 | :] | ||
186 | 200 | | |||
187 | %parserclass (private declaration) | 201 | %parserclass (private declaration) | ||
Context not available. | |||||
728 | | gotoTarget=STRING COLON | 742 | | gotoTarget=STRING COLON | ||
729 | -> statement ;; | 743 | -> statement ;; | ||
730 | 744 | | |||
731 | ( useFunction=FUNCTION | useConst=CONST | 0 ) #useNamespace=useNamespace @ COMMA SEMICOLON | 745 | ( useFunction=FUNCTION [: m_useImportType = FunctionImport; :] | ||
746 | | useConst=CONST [: m_useImportType = ConstantImport; :] | ||||
747 | | 0 [: m_useImportType = NamespaceOrClassImport; :] | ||||
748 | ) #useNamespace=useNamespaceOrUseGroupedNamespace @ COMMA SEMICOLON | ||||
732 | -> useStatement ;; | 749 | -> useStatement ;; | ||
733 | 750 | | |||
734 | identifier=namespacedIdentifier (AS aliasIdentifier=identifier | 0) | 751 | [: (*yynode)->useImportType = (UseImportType)(int)m_useImportType; :] | ||
735 | -> useNamespace ;; | 752 | identifier=namespacedIdentifierBeforeGroupedNamespace | ||
753 | (AS aliasIdentifier=identifier | compoundNamespace=compoundNamespace | 0) | ||||
754 | -> useNamespaceOrUseGroupedNamespace [ | ||||
755 | member variable useImportType: UseImportType; | ||||
756 | ] ;; | ||||
757 | | ||||
758 | LBRACE | ||||
759 | #compoundNamespaceStatement=compoundNamespaceStatement | ||||
760 | -- break because "use Foo\{bar1,}" is allowed (solves FIRST/FOLLOW conflict) | ||||
761 | @ (COMMA [: if (yytoken == Token_RBRACE) { break; } :] ) | ||||
762 | RBRACE | ||||
763 | -> compoundNamespace ;; | ||||
764 | | ||||
765 | ( useFunction=FUNCTION [: m_useCompoundImportType = FunctionImport; :] | ||||
766 | | useConst=CONST [: m_useCompoundImportType = ConstantImport; :] | ||||
767 | | 0 [: m_useCompoundImportType = NamespaceOrClassImport; :] | ||||
768 | ) | ||||
769 | [: | ||||
770 | if (m_useImportType != NamespaceOrClassImport && m_useCompoundImportType != NamespaceOrClassImport) | ||||
771 | { | ||||
772 | reportProblem(Error, QStringLiteral("Can't use mixed import."), -2); | ||||
773 | } | ||||
774 | :] | ||||
775 | #useNamespace=innerUseNamespace | ||||
776 | -> compoundNamespaceStatement ;; | ||||
777 | | ||||
778 | [: | ||||
779 | if (m_useCompoundImportType != NamespaceOrClassImport) { | ||||
780 | (*yynode)->useImportType = (UseImportType)(int)m_useCompoundImportType; | ||||
781 | } else { | ||||
782 | (*yynode)->useImportType = (UseImportType)(int)m_useImportType; | ||||
783 | } | ||||
784 | :] | ||||
785 | #namespaceName=identifier+ @ BACKSLASH | ||||
786 | (AS aliasIdentifier=identifier | 0) | ||||
787 | -> innerUseNamespace [ | ||||
788 | member variable useImportType: UseImportType; | ||||
789 | ] ;; | ||||
736 | 790 | | |||
737 | identifier=identifier ASSIGN scalar=expr | 791 | identifier=identifier ASSIGN scalar=expr | ||
738 | -> constantDeclaration ;; | 792 | -> constantDeclaration ;; | ||
Context not available. | |||||
939 | #namespaceName=identifier+ @ BACKSLASH | 993 | #namespaceName=identifier+ @ BACKSLASH | ||
940 | -> namespacedIdentifier ;; | 994 | -> namespacedIdentifier ;; | ||
941 | 995 | | |||
996 | (isGlobal=BACKSLASH | 0) | ||||
997 | #namespaceName=identifier+ @ ( BACKSLASH [: if (yytoken == Token_LBRACE) { break; } :] ) | ||||
998 | -> namespacedIdentifierBeforeGroupedNamespace ;; | ||||
999 | | ||||
942 | string=STRING | 1000 | string=STRING | ||
943 | -> identifier ;; | 1001 | -> identifier ;; | ||
944 | 1002 | | |||
Context not available. |