public boolean visit(Scalar s) throws Exception { Map<String, String> parameters = createInitialParameters(s); parameters.put("type", s.getType()); parameters.put("value", s.getValue()); xmlWriter.startTag("Scalar", parameters); return true; }
public boolean visit(Include include) throws Exception { // special case for include statements; we need to cache this // information in order to access it quickly: if (include.getExpr() instanceof Scalar) { Scalar filePath = (Scalar) include.getExpr(); fRequestor.acceptMethodReference( "include", 0, //$NON-NLS-1$ filePath.sourceStart(), filePath.sourceEnd()); } return true; }
public boolean visit(Statement e) throws Exception { if (typeDeclaration.sourceStart() < e.sourceStart() && typeDeclaration.sourceEnd() > e.sourceEnd()) { if (e instanceof PHPFieldDeclaration) { PHPFieldDeclaration phpFieldDecl = (PHPFieldDeclaration) e; if (phpFieldDecl.getDeclarationStart() == offset && phpFieldDecl.sourceEnd() - phpFieldDecl.getDeclarationStart() == length) { result = ((PHPFieldDeclaration) e).getVariableValue(); if (result instanceof Scalar) { Scalar scalar = (Scalar) result; if (scalar.getScalarType() == Scalar.TYPE_STRING && scalar.getValue().toLowerCase().equals(NULL)) { result = null; } } context = contextStack.peek(); } } } return visitGeneral(e); }
public boolean visit(Include include) throws Exception { // special case for include statements; we need to cache this // information in order to access it quickly: if (include.getExpr() instanceof Scalar) { Scalar filePath = (Scalar) include.getExpr(); modifyReference( include, new ReferenceInfo( IModelElement.METHOD, filePath.sourceStart(), filePath.sourceEnd() - filePath.sourceStart(), "include", Integer //$NON-NLS-1$ .toString(1), null)); String fullPath = ASTUtils.stripQuotes(((Scalar) filePath).getValue()); int idx = Math.max(fullPath.lastIndexOf('/'), fullPath.lastIndexOf('\\')); String lastSegment = fullPath; if (idx != -1) { lastSegment = lastSegment.substring(idx + 1); } modifyDeclaration( include, new DeclarationInfo( IModelElement.IMPORT_DECLARATION, 0, include.sourceStart(), include.sourceEnd() - include.sourceStart(), filePath.sourceStart(), filePath.sourceEnd() - filePath.sourceStart(), lastSegment, fullPath, null, null, null)); } return visitGeneral(include); }