code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
4
991
language
stringclasses
9 values
license
stringclasses
15 values
size
int32
3
1.05M
/** * Copyright (c) 2010-present Abixen Systems. All rights reserved. * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ package com.abixen.platform.service.businessintelligence.multivisualisation.service; import com.abixen.platform.service.businessintelligence.multivisualisation.model.enumtype.DataValueType; import com.abixen.platform.service.businessintelligence.multivisualisation.util.*; public interface DomainBuilderService { DatabaseDataSourceBuilder newDatabaseDataSourceBuilderInstance(); FileDataSourceBuilder newFileDataSourceBuilderInstance(); DataFileBuilder newDataFileBuilderInstance(); DataSetBuilder newDataSetBuilderInstance(); DataSetSeriesBuilder newDataSetSeriesBuilderInstance(); DataSetSeriesColumnBuilder newDataSetSeriesColumnBuilderInstance(); DataSourceColumnBuilder newDataSourceColumnBuilderInstance(); DataSourceValueBuilder newDataSourceValueBuilderInstance(DataValueType dataValueType); }
cloudowski/abixen-platform
abixen-platform-business-intelligence-service/src/main/java/com/abixen/platform/service/businessintelligence/multivisualisation/service/DomainBuilderService.java
Java
lgpl-2.1
1,441
<?php /* * $Id$ * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * This software consists of voluntary contributions made by many individuals * and is licensed under the LGPL. For more information, see * <http://www.phpdoctrine.org>. */ /** * Doctrine_Ticket_DC187_TestCase * * @package Doctrine * @author Konsta Vesterinen <kvesteri@cc.hut.fi> * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @category Object Relational Mapping * @link www.phpdoctrine.org * @since 1.0 * @version $Revision$ */ class Doctrine_Ticket_DC187_TestCase extends Doctrine_UnitTestCase { public function prepareTables() { $this->tables[] = 'Ticket_DC187_User'; parent::prepareTables(); } public function testTest() { Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_ALL); $user = new Ticket_DC187_User(); $user->username = 'jwage'; $user->email = 'jonwage@gmail.com'; $user->password = 'changeme'; $user->save(); $user->delete(); try { $user = new Ticket_DC187_User(); $user->username = 'jwage'; $user->email = 'jonwage@gmail.com'; $user->password = 'changeme'; $user->save(); $this->pass(); } catch (Exception $e) { $this->fail($e->getMessage()); } try { $user = new Ticket_DC187_User(); $user->username = 'jwage'; $user->email = 'jonwage@gmail.com'; $user->password = 'changeme'; $user->save(); $this->fail(); } catch (Exception $e) { $this->pass(); } Doctrine_Manager::getInstance()->setAttribute(Doctrine_Core::ATTR_VALIDATE, Doctrine_Core::VALIDATE_NONE); } } class Ticket_DC187_User extends Doctrine_Record { public function setTableDefinition() { $this->hasColumn('username', 'string', 255); $this->hasColumn('email', 'string', 255); $this->hasColumn('password', 'string', 255); $this->unique( array('username', 'email'), array('where' => "deleted_at IS NULL"), false ); } public function setUp() { $this->actAs('SoftDelete'); } }
ascorbic/doctrine-tracker
tests/Ticket/DC187TestCase.php
PHP
lgpl-2.1
3,118
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) import spack.util.url import spack.package class XorgPackage(spack.package.PackageBase): """Mixin that takes care of setting url and mirrors for x.org packages.""" #: Path of the package in a x.org mirror xorg_mirror_path = None #: List of x.org mirrors used by Spack # Note: x.org mirrors are a bit tricky, since many are out-of-sync or off. # A good package to test with is `util-macros`, which had a "recent" # release. base_mirrors = [ 'https://www.x.org/archive/individual/', 'https://mirrors.ircam.fr/pub/x.org/individual/', 'https://mirror.transip.net/xorg/individual/', 'ftp://ftp.freedesktop.org/pub/xorg/individual/', 'http://xorg.mirrors.pair.com/individual/' ] @property def urls(self): self._ensure_xorg_mirror_path_is_set_or_raise() return [ spack.util.url.join(m, self.xorg_mirror_path, resolve_href=True) for m in self.base_mirrors ] def _ensure_xorg_mirror_path_is_set_or_raise(self): if self.xorg_mirror_path is None: cls_name = type(self).__name__ msg = ('{0} must define a `xorg_mirror_path` attribute' ' [none defined]') raise AttributeError(msg.format(cls_name))
iulian787/spack
lib/spack/spack/build_systems/xorg.py
Python
lgpl-2.1
1,541
/* * Binomial.java * * Copyright (C) 2002-2006 Alexei Drummond and Andrew Rambaut * * This file is part of BEAST. * See the NOTICE file distributed with this work for additional * information regarding copyright ownership and licensing. * * BEAST is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * BEAST is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with BEAST; if not, write to the * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ package beast.math; /** * Binomial coefficients * * @author Andrew Rambaut * @author Alexei Drummond * @author Korbinian Strimmer * @version $Id: Binomial.java,v 1.11 2005/05/24 20:26:00 rambaut Exp $ */ public class Binomial { // // Public stuff // public static double logChoose(final int n, final int k) { return GammaFunction.lnGamma(n + 1.0) - GammaFunction.lnGamma(k + 1.0) - GammaFunction.lnGamma(n - k + 1.0); } /** * @param n total elements * @param k chosen elements * @return Binomial coefficient n choose k */ public static double choose(double n, double k) { n = Math.floor(n + 0.5); k = Math.floor(k + 0.5); final double lchoose = GammaFunction.lnGamma(n + 1.0) - GammaFunction.lnGamma(k + 1.0) - GammaFunction.lnGamma(n - k + 1.0); return Math.floor(Math.exp(lchoose) + 0.5); } /** * @param n # elements * @return n choose 2 (number of distinct ways to choose a pair from n elements) */ public static double choose2(final int n) { // not sure how much overhead there is with try-catch blocks // i.e. would an if statement be better? try { return choose2LUT[n]; } catch (ArrayIndexOutOfBoundsException e) { if (n < 0) { return 0; } while (maxN < n) { maxN += 1000; } initialize(); return choose2LUT[n]; } } private static void initialize() { choose2LUT = new double[maxN + 1]; choose2LUT[0] = 0; choose2LUT[1] = 0; choose2LUT[2] = 1; for (int i = 3; i <= maxN; i++) { choose2LUT[i] = (i * (i - 1)) * 0.5; } } private static int maxN = 5000; private static double[] choose2LUT; static { // initialize(); } }
CompEvol/beast2
src/beast/math/Binomial.java
Java
lgpl-2.1
2,920
<?php namespace wcf\data\devtools\missing\language\item; use wcf\data\DatabaseObject; use wcf\data\language\Language; use wcf\system\language\LanguageFactory; use wcf\system\WCF; use wcf\util\JSON; /** * Represents a missing language item log entry. * * @author Matthias Schmidt * @copyright 2001-2020 WoltLab GmbH * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php> * @package WoltLabSuite\Core\Devtools\Missing\Language\Item * @since 5.3 * * @property-read int $itemID unique id of the missing language item log entry * @property-read int $languageID id of the language the missing language item was requested for * @property-read string $languageItem name of the missing language item * @property-read int $lastTime timestamp of the last time the missing language item was requested * @property-read string $stackTrace stack trace of how the missing language item was requested for the last time */ class DevtoolsMissingLanguageItem extends DatabaseObject { /** * Returns the language the missing language item was requested for or `null` if the language * does not exist anymore. * * @return null|Language */ public function getLanguage() { if ($this->languageID === null) { return null; } return LanguageFactory::getInstance()->getLanguage($this->languageID); } /** * Returns the formatted stack trace of how the missing language item was requested for the * last time. * * @return string */ public function getStackTrace() { $stackTrace = JSON::decode($this->stackTrace); foreach ($stackTrace as &$stackEntry) { foreach ($stackEntry['args'] as &$stackEntryArg) { if (\gettype($stackEntryArg) === 'string') { $stackEntryArg = \str_replace(["\n", "\t"], ['\n', '\t'], $stackEntryArg); } } unset($stackEntryArg); } unset($stackEntry); return WCF::getTPL()->fetch('__devtoolsMissingLanguageItemStackTrace', 'wcf', [ 'stackTrace' => $stackTrace, ]); } }
SoftCreatR/WCF
wcfsetup/install/files/lib/data/devtools/missing/language/item/DevtoolsMissingLanguageItem.class.php
PHP
lgpl-2.1
2,209
package ch.unibas.cs.hpwc.patus.grammar.stencil2; import cetus.hir.BinaryExpression; import cetus.hir.BinaryOperator; import cetus.hir.DepthFirstIterator; import cetus.hir.Expression; import cetus.hir.IDExpression; import cetus.hir.IntegerLiteral; import cetus.hir.NameID; import ch.unibas.cs.hpwc.patus.representation.Stencil; import ch.unibas.cs.hpwc.patus.representation.StencilBundle; import ch.unibas.cs.hpwc.patus.representation.StencilNode; import ch.unibas.cs.hpwc.patus.symbolic.Symbolic; import ch.unibas.cs.hpwc.patus.util.CodeGeneratorUtil; import ch.unibas.cs.hpwc.patus.util.StringUtil; public class StencilSpecificationAnalyzer { /** * * @param bundle */ public static void normalizeStencilNodesForBoundariesAndIntial (StencilBundle bundle) { for (Stencil stencil : bundle) { for (StencilNode node : stencil.getAllNodes ()) { Expression[] rgIdx = node.getIndex ().getSpaceIndexEx (); Expression[] rgIdxNew = new Expression[rgIdx.length]; for (int i = 0; i < rgIdx.length; i++) { String strDimId = StencilSpecificationAnalyzer.getContainedDimensionIdentifier (rgIdx[i], i); if (strDimId != null) { // if an entry I contains the corresponding dimension identifier id, compute I-id // we expect this to be an integer value rgIdxNew[i] = Symbolic.simplify (new BinaryExpression (rgIdx[i].clone (), BinaryOperator.SUBTRACT, new NameID (strDimId))); if (!(rgIdxNew[i] instanceof IntegerLiteral)) { throw new RuntimeException (StringUtil.concat ("Illegal coordinate ", rgIdx[i].toString (), " in grid reference ", node.toString ()," in definition ", stencil.toString () )); } } else { // if the entry doesn't contain a dimension identifier, set the corresponding spatial index coordinate // to 0 (=> do something when the point becomes the center point), and add a constraint setting the // corresponding subdomain index (dimension identifier) to the expression of the index entry rgIdxNew[i] = new IntegerLiteral (0); node.addConstraint (new BinaryExpression (new NameID (CodeGeneratorUtil.getDimensionName (i)), BinaryOperator.COMPARE_EQ, rgIdx[i])); } } node.getIndex ().setSpaceIndex (rgIdxNew); } } } /** * Check that all the stencil nodes in the stencils of the bundle are legal, * i.e., that the spatial index has the form [x+dx, y+dy, ...]. Note that * the dimension identifiers (x, y, ...) have been subtracted already, so * the spatial index should be an array of integer numbers. * * @param bundle * The bundle to check */ public static void checkStencilNodesLegality (StencilBundle bundle) { for (Stencil stencil : bundle) for (StencilNode node : stencil) for (Expression exprIdx : node.getIndex ().getSpaceIndexEx ()) if (!(exprIdx instanceof IntegerLiteral)) throw new RuntimeException (StringUtil.concat ("Illegal grid reference", exprIdx.toString ())); // TODO: handle in parser } /** * Determines whether the expression <code>expr</code> contains a dimension * identifier corresponding to dimension <code>nDim</code>. * * @param expr * The expression to examine * @param nDim * The dimension whose identifier to detect * @return <code>true</code> iff <code>expr</code> contains a dimension * identifier corresponding to the dimension <code>nDim</code> */ public static String getContainedDimensionIdentifier (Expression expr, int nDim) { String strId = CodeGeneratorUtil.getDimensionName (nDim); String strIdAlt = CodeGeneratorUtil.getAltDimensionName (nDim); for (DepthFirstIterator it = new DepthFirstIterator (Symbolic.simplify (expr)); it.hasNext (); ) { Object o = it.next (); if (o instanceof IDExpression) { if (((IDExpression) o).getName ().equals (strId)) return strId; if (((IDExpression) o).getName ().equals (strIdAlt)) return strIdAlt; } } return null; } }
matthias-christen/patus
src/ch/unibas/cs/hpwc/patus/grammar/stencil2/StencilSpecificationAnalyzer.java
Java
lgpl-2.1
4,059
/****************************************************************************** * SOFA, Simulation Open-Framework Architecture, development version * * (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH * * * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 2.1 of the License, or (at * * your option) any later version. * * * * This program is distributed in the hope that it will be useful, but WITHOUT * * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * * for more details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this program. If not, see <http://www.gnu.org/licenses/>. * ******************************************************************************* * Authors: The SOFA Team and external contributors (see Authors.txt) * * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ #define SOFA_COMPONENT_FORCEFIELD_SURFACEPRESSUREFORCEFIELD_CPP #include <SofaBoundaryCondition/SurfacePressureForceField.inl> #include <sofa/core/ObjectFactory.h> #include <sofa/defaulttype/Vec3Types.h> namespace sofa { namespace component { namespace forcefield { using namespace sofa::defaulttype; SOFA_DECL_CLASS(SurfacePressureForceField) int SurfacePressureForceFieldClass = core::RegisterObject("SurfacePressure") #ifndef SOFA_FLOAT .add< SurfacePressureForceField<Vec3dTypes> >() .add< SurfacePressureForceField<Rigid3Types> >() #endif #ifndef SOFA_DOUBLE .add< SurfacePressureForceField<Vec3fTypes> >() .add< SurfacePressureForceField<Rigid3fTypes> >() #endif ; #ifndef SOFA_FLOAT template class SOFA_BOUNDARY_CONDITION_API SurfacePressureForceField<Vec3dTypes>; template class SOFA_BOUNDARY_CONDITION_API SurfacePressureForceField<Rigid3dTypes>; #endif #ifndef SOFA_DOUBLE template class SOFA_BOUNDARY_CONDITION_API SurfacePressureForceField<Vec3fTypes>; template class SOFA_BOUNDARY_CONDITION_API SurfacePressureForceField<Rigid3fTypes>; #endif } // namespace forcefield } // namespace component } // namespace sofa
FabienPean/sofa
modules/SofaBoundaryCondition/SurfacePressureForceField.cpp
C++
lgpl-2.1
2,847
/* * ALMA - Atacama Large Millimiter Array (c) European Southern Observatory, 2010 * * This library is free software; you can redistribute it and/or modify it under * the terms of the GNU Lesser General Public License as published by the Free * Software Foundation; either version 2.1 of the License, or (at your option) * any later version. * * This library is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public License * along with this library; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ package alma.acs.alarmsystemprofiler.document.flood; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Collection; import java.util.Date; import java.util.Vector; import org.eclipse.jface.viewers.TableViewer; import cern.laser.client.data.Alarm; import alma.acs.alarmsystemprofiler.document.DocumentBase; import alma.acs.alarmsystemprofiler.engine.AlarmCategoryListener; import alma.acs.alarmsystemprofiler.save.TableData; /** * Count the number of floods and generate the statistics * * @author acaproni */ public class FloodContainer extends DocumentBase implements AlarmCategoryListener { public enum FloodItem { NUM_OF_FLOODS("Num. of floods",false,false), ACTUALLY_IN_FLOOD("Actually in flood", false,true), TOT_ALARMS("Tot. alarms in floods",false,false), HIGHEST_ALARMS("Highest num. of alarms in flood",false,false), AVG_ALARMS("Avg. alarms per flood",false,false), MEASURED_TIME("Monitoring time",true,false), FLOOD_TIME("Time of Alarm service in flood",true,false); /** * The name show in the first column */ public String description; /** * <code>true</code> if number represents a time value */ private final boolean isTime; /** * <code>true</code> if number represents a boolean value (0 means <code>false</code>, * all other values mean <code>true</code>) */ private final boolean isBoolean; /** * The value */ private Number value; /** * The formatter of the times */ private static final SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss.S"); /** * Constructor * * @param name The description of the value */ private FloodItem(String name, boolean isTm, boolean isBool) { this.description=name; this.isTime=isTm; this.isBoolean=isBool; value=Integer.valueOf(0); } public void setNumber(Number newValue) { value=newValue; } /** * Getter */ public Number getValue() { return value; } @Override public String toString() { if (isBoolean) { int val = value.intValue(); if (val==0) { return "No"; } else { return "Yes"; } } if (isTime) { Date date = new Date(value.longValue()); Calendar cal = Calendar.getInstance(); cal.setTime(date); int day = cal.get(Calendar.DAY_OF_MONTH)-1; synchronized (timeFormat) { if (day>0) { return ""+day+" days, "+timeFormat.format(date); } else { return timeFormat.format(date); } } } if ((value instanceof Float) || (value instanceof Double)) { double d = value.doubleValue(); return String.format("%.2f", d); } return value.toString(); } }; /** * The singleton */ private static FloodContainer singleton=null; public static FloodContainer getInstance() { if (singleton==null) { singleton = new FloodContainer(); } return singleton; } /** * Constructor */ private FloodContainer() { super("Alarm floods statistics", new String[] { "Entry", "Value" }); actualFlood=new AlarmFlood(this); } /** * The floods registered since the system started */ private final Vector<AlarmFlood> floods = new Vector<AlarmFlood>(); /** * The start time of this container in mesec */ private final long startTime=System.currentTimeMillis(); /** * The actual counter of alarm floods */ private AlarmFlood actualFlood; /** * * @return The number of alarms registered in all the floods */ public synchronized int getTotAlarmsInFloods() { int ret=0; for (AlarmFlood af: floods) { ret+=af.getAlarmsInFlood(); } ret+=actualFlood.getAlarmsInFlood(); return ret; } /** * * @return The total time the alarm system was in flood in msec */ public synchronized long getTotTimeInFloods() { long ret=0; for (AlarmFlood af: floods) { ret+=af.lengthOfFlood(); } if (actualFlood.getStartTimeOfFlood()>0) { ret+=actualFlood.lengthOfFlood(); } return ret; } /** * * @return The average number of alarms registered in all the floods */ public synchronized float getAvgAlarmsInFloods() { if (floods.size()==0) { return 0; } float ret=0; for (AlarmFlood af: floods) { ret+=af.getAlarmsInFlood(); } return ret/(float)floods.size(); } /** * * @return The highest number of alarms registered between all the floods */ public synchronized int getHighestAlarmsCountInFloods() { int ret=0; for (AlarmFlood af: floods) { if (ret<af.getAlarmsInFlood()) { ret=af.getAlarmsInFlood(); } } return ret; } /** * @return The total number of floods */ public synchronized int getNumOfFloods() { return floods.size(); } /** * @return The values of the flood to be shown in the table */ @Override public synchronized Collection<FloodItem> getNumbers() { FloodItem.AVG_ALARMS.setNumber(Float.valueOf(getAvgAlarmsInFloods())); FloodItem.FLOOD_TIME.setNumber(Long.valueOf(getTotTimeInFloods())); FloodItem.HIGHEST_ALARMS.setNumber(Integer.valueOf(getHighestAlarmsCountInFloods())); FloodItem.MEASURED_TIME.setNumber(Long.valueOf(System.currentTimeMillis()-startTime)); FloodItem.NUM_OF_FLOODS.setNumber(Integer.valueOf(getNumOfFloods())); FloodItem.TOT_ALARMS.setNumber(Integer.valueOf(getTotAlarmsInFloods())); FloodItem.ACTUALLY_IN_FLOOD.setNumber(Integer.valueOf(actualFlood.isFloodStarted()?1:0)); Vector<FloodContainer.FloodItem> ret= new Vector<FloodContainer.FloodItem>(FloodItem.values().length); for (FloodItem fi: FloodItem.values()) { ret.add(fi); } return ret; } @Override public synchronized void shutdownContainer() { super.shutdownContainer(); actualFlood.stop(); } @Override public void setTableViewer(TableViewer table) { super.setTableViewer(table); } public synchronized void doneFlood() { floods.add(actualFlood); actualFlood=new AlarmFlood(this); System.out.println("Refreshing table"); System.out.println("doneFlood done"); } @Override public synchronized void onAlarm(Alarm alarm) { actualFlood.onAlarm(alarm); } @Override public void setTableContent(TableData tData) { Collection<FloodItem> vals=getNumbers(); for (FloodItem val: vals) { String[] row = new String[2]; row[0]=val.description; row[1]=val.toString(); tData.addRowData(row); } } }
ACS-Community/ACS
LGPL/CommonSoftware/acsGUIs/AlarmSystemProfiler/src/alma/acs/alarmsystemprofiler/document/flood/FloodContainer.java
Java
lgpl-2.1
7,180
/* * Copyright 2011 Stephen Liu * For license terms, see the file COPYING along with this library. */ #include <vector> #include <unistd.h> #include <errno.h> #include <signal.h> #include <stdlib.h> #include <unistd.h> #include <assert.h> #include "spnkprefork.hpp" #include "spnklog.hpp" #include "spnkstr.hpp" #include "spnksocket.hpp" typedef struct tagSP_NKPreforkManagerImpl { SP_NKPreforkManager::Handler_t mHandler; void * mArgs; int mMaxProcs; int mCheckInterval; std::vector< pid_t > mPidList; } SP_NKPreforkManagerImpl_t; SP_NKPreforkManager :: SP_NKPreforkManager( Handler_t handler, void * args, int maxProcs, int checkInterval ) { mImpl = new SP_NKPreforkManagerImpl_t; mImpl->mHandler = handler; mImpl->mArgs = args; mImpl->mMaxProcs = maxProcs; mImpl->mCheckInterval = checkInterval; if( mImpl->mCheckInterval <= 0 ) checkInterval = 1; } SP_NKPreforkManager :: ~SP_NKPreforkManager() { delete mImpl; mImpl = NULL; } int SP_NKPreforkManager :: run() { pid_t pid = fork(); if( 0 == pid ) { runForever(); return 0; } else if( pid > 0 ) { SP_NKLog::log( LOG_DEBUG, "fork proc master %d", pid ); } else { SP_NKLog::log( LOG_ERR, "fork fail, errno %d, %s", errno, strerror( errno ) ); } return pid > 0 ? 0 : -1; } void SP_NKPreforkManager :: termHandler( int sig ) { kill( 0, SIGTERM ); exit( 0 ); } void SP_NKPreforkManager :: runForever() { signal( SIGCHLD, SIG_IGN ); signal( SIGTERM, termHandler ); for( int i = 0; i < mImpl->mMaxProcs; i++ ) { pid_t pid = fork(); if( 0 == pid ) { mImpl->mHandler( i, mImpl->mArgs ); exit( 0 ); } else if( pid > 0 ) { SP_NKLog::log( LOG_DEBUG, "fork proc#%d %d", i, pid ); mImpl->mPidList.push_back( pid ); } else { SP_NKLog::log( LOG_ERR, "fork fail, errno %d, %s", errno, strerror( errno ) ); exit( -1 ); } } for( ; ; ) { sleep( mImpl->mCheckInterval ); for( int i = 0; i < (int)mImpl->mPidList.size(); i++ ) { pid_t pid = mImpl->mPidList[i]; if( 0 != kill( pid, 0 ) ) { SP_NKLog::log( LOG_ERR, "proc#%d %d is not exists", i, pid ); pid = fork(); if( 0 == pid ) { mImpl->mHandler( i, mImpl->mArgs ); exit( 0 ); } else if( pid > 0 ) { SP_NKLog::log( LOG_DEBUG, "fork proc#%d %d to replace %d", i, pid, mImpl->mPidList[i] ); mImpl->mPidList[i] = pid; } else { SP_NKLog::log( LOG_ERR, "fork fail, errno %d, %s", errno, strerror( errno ) ); // leave pid for next check } } } } } void SP_NKPreforkManager :: shutdown() { kill( 0, SIGTERM ); } //=========================================================================== typedef struct tagSP_NKPreforkServerImpl { char mBindIP[ 64 ]; int mPort; SP_NKPreforkServer::OnRequest_t mOnRequest; void * mProcArgs; int mMaxProcs; int mCheckInterval; int mListenFD; int mMaxRequestsPerChild; SP_NKPreforkServer::BeforeChildRun_t mBeforeChildRun; SP_NKPreforkServer::AfterChildRun_t mAfterChildRun; } SP_NKPreforkServerImpl_t; SP_NKPreforkServer :: SP_NKPreforkServer( const char * bindIP, int port, OnRequest_t onRequest, void * procArgs ) { mImpl = (SP_NKPreforkServerImpl_t*)calloc( sizeof( SP_NKPreforkServerImpl_t ), 1 ); SP_NKStr::strlcpy( mImpl->mBindIP, bindIP, sizeof( mImpl->mBindIP ) ); mImpl->mPort = port; mImpl->mOnRequest = onRequest; mImpl->mProcArgs = procArgs; mImpl->mMaxProcs = 8; mImpl->mCheckInterval = 1; mImpl->mMaxRequestsPerChild = 10000; mImpl->mListenFD = -1; } SP_NKPreforkServer :: ~SP_NKPreforkServer() { if( mImpl->mListenFD >= 0 ) close( mImpl->mListenFD ); free( mImpl ); mImpl = NULL; } void SP_NKPreforkServer :: setBeforeChildRun( BeforeChildRun_t beforeChildRun ) { mImpl->mBeforeChildRun = beforeChildRun; } void SP_NKPreforkServer :: setAfterChildRun( AfterChildRun_t afterChildRun ) { mImpl->mAfterChildRun = afterChildRun; } void SP_NKPreforkServer :: setPreforkArgs( int maxProcs, int checkInterval, int maxRequestsPerChild ) { mImpl->mMaxProcs = maxProcs; mImpl->mCheckInterval = checkInterval; mImpl->mMaxRequestsPerChild = maxRequestsPerChild; } int SP_NKPreforkServer :: run() { pid_t pid = fork(); if( 0 == pid ) { runForever(); return 0; } else if( pid > 0 ) { SP_NKLog::log( LOG_DEBUG, "fork proc master %d", pid ); } else { SP_NKLog::log( LOG_ERR, "fork fail, errno %d, %s", errno, strerror( errno ) ); } return pid > 0 ? 0 : -1; } void SP_NKPreforkServer :: runForever() { #ifdef SIGPIPE /* Don't die with SIGPIPE on remote read shutdown. That's dumb. */ signal( SIGPIPE, SIG_IGN ); #endif int ret = 0; int listenFD = -1; ret = SP_NKSocket::tcpListen( mImpl->mBindIP, mImpl->mPort, &listenFD, 1 ); if( 0 == ret ) { mImpl->mListenFD = listenFD; SP_NKPreforkManager manager( serverHandler, mImpl, mImpl->mMaxProcs, mImpl->mCheckInterval ); manager.runForever(); } else { SP_NKLog::log( LOG_ERR, "list fail, errno %d, %s", errno, strerror( errno ) ); } } void SP_NKPreforkServer :: serverHandler( int index, void * args ) { SP_NKPreforkServerImpl_t * impl = (SP_NKPreforkServerImpl_t*)args; if( NULL != impl->mBeforeChildRun ) { impl->mBeforeChildRun( impl->mProcArgs ); } int factor = impl->mMaxRequestsPerChild / 10; factor = factor <= 0 ? 1 : factor; int maxRequestsPerChild = impl->mMaxRequestsPerChild + factor * index; for( int i= 0; i < maxRequestsPerChild; i++ ) { struct sockaddr_in addr; socklen_t socklen = sizeof( addr ); int fd = accept( impl->mListenFD, (struct sockaddr*)&addr, &socklen ); if( fd >= 0 ) { impl->mOnRequest( fd, impl->mProcArgs ); close( fd ); } else { SP_NKLog::log( LOG_ERR, "accept fail, errno %d, %s", errno, strerror( errno ) ); } } if( NULL != impl->mAfterChildRun ) { impl->mAfterChildRun( impl->mProcArgs ); } } void SP_NKPreforkServer :: shutdown() { kill( 0, SIGTERM ); } //=========================================================================== int SP_NKPreforkServer :: initDaemon( const char * workdir ) { pid_t pid; if ( (pid = fork()) < 0) return (-1); else if (pid) _exit(0); /* parent terminates */ /* child 1 continues... */ if (setsid() < 0) /* become session leader */ return (-1); assert( signal( SIGHUP, SIG_IGN ) != SIG_ERR ); assert( signal( SIGPIPE, SIG_IGN ) != SIG_ERR ); assert( signal( SIGALRM, SIG_IGN ) != SIG_ERR ); assert( signal( SIGCHLD, SIG_IGN ) != SIG_ERR ); if ( (pid = fork()) < 0) return (-1); else if (pid) _exit(0); /* child 1 terminates */ /* child 2 continues... */ if( NULL != workdir ) chdir( workdir ); /* change working directory */ /* close off file descriptors */ for (int i = 0; i < 64; i++) close(i); /* redirect stdin, stdout, and stderr to /dev/null */ open("/dev/null", O_RDONLY); open("/dev/null", O_RDWR); open("/dev/null", O_RDWR); return (0); /* success */ }
spsoft/spnetkit
spnetkit/spnkprefork.cpp
C++
lgpl-2.1
6,852
package org.exist.source; import java.io.*; import java.util.Map; import org.exist.security.PermissionDeniedException; import org.exist.security.Subject; import org.exist.storage.DBBroker; /** * A simple source object wrapping a single query string, but associating it with a specific * map (e.g., of namespace bindings). This prevents two textually equal queries with different * maps from getting aliased in the query pool. * * @author <a href="mailto:piotr@ideanest.com">Piotr Kaminski</a> */ public class StringSourceWithMapKey extends AbstractSource { private final Map<String, String> map; /** * Create a new source for the given content and namespace map (string to string). * The map will be taken over and modified by the source, so make a copy first if * you're passing a shared one. * * @param content the content of the query * @param map the map of prefixes to namespace URIs */ public StringSourceWithMapKey(String content, Map<String, String> map) { this.map = map; this.map.put("<query>", content); } @Override public String path() { return type(); } @Override public String type() { return "StringWithMapKey"; } public Object getKey() {return map;} public int isValid(DBBroker broker) {return Source.VALID;} public int isValid(Source other) {return Source.VALID;} public Reader getReader() throws IOException {return new StringReader(map.get("<query>"));} public InputStream getInputStream() throws IOException { // not implemented return null; } public String getContent() throws IOException {return map.get("<query>");} @Override public void validate(Subject subject, int perm) throws PermissionDeniedException { // TODO protected? } }
jensopetersen/exist
src/org/exist/source/StringSourceWithMapKey.java
Java
lgpl-2.1
1,741
/**************************************************************************** ** ** Copyright (C) 2015 The Qt Company Ltd. ** Contact: http://www.qt.io/licensing ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms and ** conditions see http://www.qt.io/terms-conditions. For further information ** use the contact form at http://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, The Qt Company gives you certain additional ** rights. These rights are described in The Qt Company LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ****************************************************************************/ #include "modelmanagertesthelper.h" #include "cpptoolstestcase.h" #include "cppworkingcopy.h" #include <QtTest> #include <cassert> Q_DECLARE_METATYPE(QSet<QString>) using namespace CppTools::Internal; TestProject::TestProject(const QString &name, QObject *parent) : m_name (name) { setParent(parent); setId(Core::Id::fromString(name)); qRegisterMetaType<QSet<QString> >(); } TestProject::~TestProject() { } ModelManagerTestHelper::ModelManagerTestHelper(QObject *parent) : QObject(parent) { CppModelManager *mm = CppModelManager::instance(); connect(this, &ModelManagerTestHelper::aboutToRemoveProject, mm, &CppModelManager::onAboutToRemoveProject); connect(this, &ModelManagerTestHelper::projectAdded, mm, &CppModelManager::onProjectAdded); connect(mm, &CppModelManager::sourceFilesRefreshed, this, &ModelManagerTestHelper::sourceFilesRefreshed); connect(mm, &CppModelManager::gcFinished, this, &ModelManagerTestHelper::gcFinished); cleanup(); QVERIFY(Tests::VerifyCleanCppModelManager::isClean()); } ModelManagerTestHelper::~ModelManagerTestHelper() { cleanup(); QVERIFY(Tests::VerifyCleanCppModelManager::isClean()); } void ModelManagerTestHelper::cleanup() { CppModelManager *mm = CppModelManager::instance(); QList<ProjectInfo> pies = mm->projectInfos(); foreach (const ProjectInfo &pie, pies) emit aboutToRemoveProject(pie.project().data()); if (!pies.isEmpty()) waitForFinishedGc(); } ModelManagerTestHelper::Project *ModelManagerTestHelper::createProject(const QString &name) { TestProject *tp = new TestProject(name, this); emit projectAdded(tp); return tp; } void ModelManagerTestHelper::resetRefreshedSourceFiles() { m_lastRefreshedSourceFiles.clear(); m_refreshHappened = false; } QSet<QString> ModelManagerTestHelper::waitForRefreshedSourceFiles() { while (!m_refreshHappened) QCoreApplication::processEvents(); return m_lastRefreshedSourceFiles; } void ModelManagerTestHelper::waitForFinishedGc() { m_gcFinished = false; while (!m_gcFinished) QCoreApplication::processEvents(); } void ModelManagerTestHelper::sourceFilesRefreshed(const QSet<QString> &files) { m_lastRefreshedSourceFiles = files; m_refreshHappened = true; } void ModelManagerTestHelper::gcFinished() { m_gcFinished = true; }
danimo/qt-creator
src/plugins/cpptools/modelmanagertesthelper.cpp
C++
lgpl-2.1
3,946
/***************************************************************************** * * This file is part of Mapnik (c++ mapping toolkit) * * Copyright (C) 2015 Artem Pavlenko * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * *****************************************************************************/ #ifndef MAPNIK_TOPOJSON_UTILS_HPP #define MAPNIK_TOPOJSON_UTILS_HPP // mapnik #include <mapnik/box2d.hpp> #include <mapnik/json/topology.hpp> namespace mapnik { namespace topojson { struct bounding_box_visitor { bounding_box_visitor(topology const& topo) : topo_(topo), num_arcs_(topo_.arcs.size()) {} box2d<double> operator() (mapnik::topojson::point const& pt) const { double x = pt.coord.x; double y = pt.coord.y; if (topo_.tr) { x = x * (*topo_.tr).scale_x + (*topo_.tr).translate_x; y = y * (*topo_.tr).scale_y + (*topo_.tr).translate_y; } return box2d<double>(x, y, x, y); } box2d<double> operator() (mapnik::topojson::multi_point const& multi_pt) const { box2d<double> bbox; if (num_arcs_ > 0) { bool first = true; for (auto const& pt : multi_pt.points) { double x = pt.x; double y = pt.y; if (topo_.tr) { x = x * (*topo_.tr).scale_x + (*topo_.tr).translate_x; y = y * (*topo_.tr).scale_y + (*topo_.tr).translate_y; // TODO : delta encoded ? } if (first) { first = false; bbox.init(x,y,x,y); } else { bbox.expand_to_include(x,y); } } } return bbox; } box2d<double> operator() (mapnik::topojson::linestring const& line) const { box2d<double> bbox; if (num_arcs_ > 0) { index_type index = line.ring; index_type arc_index = index < 0 ? std::abs(index) - 1 : index; if (arc_index >= 0 && arc_index < static_cast<int>(num_arcs_)) { bool first = true; double px = 0, py = 0; auto const& arcs = topo_.arcs[arc_index]; for (auto pt : arcs.coordinates) { double x = pt.x; double y = pt.y; if (topo_.tr) { x = (px += x) * (*topo_.tr).scale_x + (*topo_.tr).translate_x; y = (py += y) * (*topo_.tr).scale_y + (*topo_.tr).translate_y; } if (first) { first = false; bbox.init(x, y, x, y); } else { bbox.expand_to_include(x, y); } } } } return bbox; } box2d<double> operator() (mapnik::topojson::multi_linestring const& multi_line) const { box2d<double> bbox; if (num_arcs_ > 0) { bool first = true; for (auto index : multi_line.rings) { index_type arc_index = index < 0 ? std::abs(index) - 1 : index; if (arc_index >= 0 && arc_index < static_cast<int>(num_arcs_)) { double px = 0, py = 0; auto const& arcs = topo_.arcs[arc_index]; for (auto pt : arcs.coordinates) { double x = pt.x; double y = pt.y; if (topo_.tr) { x = (px += x) * (*topo_.tr).scale_x + (*topo_.tr).translate_x; y = (py += y) * (*topo_.tr).scale_y + (*topo_.tr).translate_y; } if (first) { first = false; bbox.init(x, y, x, y); } else { bbox.expand_to_include(x, y); } } } } } return bbox; } box2d<double> operator() (mapnik::topojson::polygon const& poly) const { box2d<double> bbox; if (num_arcs_ > 0) { bool first = true; for (auto const& ring : poly.rings) { for (auto index : ring) { index_type arc_index = index < 0 ? std::abs(index) - 1 : index; if (arc_index >= 0 && arc_index < static_cast<int>(num_arcs_)) { double px = 0, py = 0; auto const& arcs = topo_.arcs[arc_index]; for (auto const& pt : arcs.coordinates) { double x = pt.x; double y = pt.y; if (topo_.tr) { x = (px += x) * (*topo_.tr).scale_x + (*topo_.tr).translate_x; y = (py += y) * (*topo_.tr).scale_y + (*topo_.tr).translate_y; } if (first) { first = false; bbox.init( x, y, x, y); } else { bbox.expand_to_include(x, y); } } } } } } return bbox; } box2d<double> operator() (mapnik::topojson::multi_polygon const& multi_poly) const { box2d<double> bbox; if (num_arcs_ > 0) { bool first = true; for (auto const& poly : multi_poly.polygons) { for (auto const& ring : poly) { for (auto index : ring) { index_type arc_index = index < 0 ? std::abs(index) - 1 : index; if (arc_index >= 0 && arc_index < static_cast<int>(num_arcs_)) { double px = 0, py = 0; auto const& arcs = topo_.arcs[arc_index]; for (auto const& pt : arcs.coordinates) { double x = pt.x; double y = pt.y; if (topo_.tr) { x = (px += x) * (*topo_.tr).scale_x + (*topo_.tr).translate_x; y = (py += y) * (*topo_.tr).scale_y + (*topo_.tr).translate_y; } if (first) { first = false; bbox.init( x, y, x, y); } else { bbox.expand_to_include(x, y); } } } } } } } return bbox; } private: topology const& topo_; std::size_t num_arcs_; }; }} #endif //MAPNIK_TOPOJSON_UTILS_HPP
stefanklug/mapnik
include/mapnik/json/topojson_utils.hpp
C++
lgpl-2.1
8,585
package railo.runtime.listener; import railo.commons.lang.types.RefBoolean; import railo.commons.lang.types.RefBooleanImpl; import railo.runtime.PageContext; import railo.runtime.PageSource; import railo.runtime.exp.PageException; public final class MixedAppListener extends ModernAppListener { @Override public void onRequest(PageContext pc, PageSource requestedPage, RequestListener rl) throws PageException { RefBoolean isCFC=new RefBooleanImpl(false); PageSource appPS=//pc.isCFCRequest()?null: AppListenerUtil.getApplicationPageSource(pc, requestedPage, mode, isCFC); if(isCFC.toBooleanValue())_onRequest(pc, requestedPage,appPS,rl); else ClassicAppListener._onRequest(pc, requestedPage,appPS,rl); } @Override public final String getType() { return "mixed"; } }
JordanReiter/railo
railo-java/railo-core/src/railo/runtime/listener/MixedAppListener.java
Java
lgpl-2.1
797
v.setCursorPosition(0,19); v.type('/'); v.type('/'); v.type('/'); v.type('/'); v.type("ok");
hlamer/kate
tests/data/indent/cppstyle/comment11/input.js
JavaScript
lgpl-2.1
93
/* This file is part of KAddressBook. Copyright (c) 2002 Mike Pilone <mpilone@slac.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. As a special exception, permission is given to link this program with any edition of Qt, and distribute the resulting executable, without including the source code for Qt in the source distribution. */ #include "viewconfigurefilterpage.h" #include <QtGui/QBoxLayout> #include <QtGui/QButtonGroup> #include <QtGui/QHBoxLayout> #include <QtGui/QLabel> #include <QtGui/QRadioButton> #include <QtGui/QVBoxLayout> #include <kconfig.h> #include <kcombobox.h> #include <kdialog.h> #include <klocale.h> #include "filter.h" ViewConfigureFilterPage::ViewConfigureFilterPage( QWidget *parent, const char *name ) : QWidget( parent ) { setObjectName( name ); QBoxLayout *topLayout = new QVBoxLayout( this ); topLayout->setSpacing( KDialog::spacingHint() ); topLayout->setMargin( 0 ); mFilterGroup = new QButtonGroup(); connect( mFilterGroup, SIGNAL( buttonClicked( int ) ), SLOT( buttonClicked( int ) ) ); QLabel *label = new QLabel( i18n( "The default filter will be activated whenever" " this view is displayed. This feature allows you to configure views that only" " interact with certain types of information based on the filter. Once the view" " is activated, the filter can be changed at anytime." ), this ); label->setAlignment( Qt::AlignLeft | Qt::AlignTop ); label->setWordWrap( true ); topLayout->addWidget( label ); QWidget *spacer = new QWidget( this ); spacer->setMinimumHeight( 5 ); topLayout->addWidget( spacer ); QRadioButton *button = new QRadioButton( i18n( "No default filter" ), this ); mFilterGroup->addButton( button,0 ); topLayout->addWidget( button ); button = new QRadioButton( i18n( "Use last active filter" ), this ); mFilterGroup->addButton( button,1 ); topLayout->addWidget( button ); QBoxLayout *comboLayout = new QHBoxLayout(); topLayout->addLayout( comboLayout ); button = new QRadioButton( i18n( "Use filter:" ), this ); mFilterGroup->addButton( button,2 ); comboLayout->addWidget( button ); mFilterCombo = new KComboBox( this ); comboLayout->addWidget( mFilterCombo ); topLayout->addStretch( 100 ); } ViewConfigureFilterPage::~ViewConfigureFilterPage() { } void ViewConfigureFilterPage::restoreSettings( const KConfigGroup &config ) { mFilterCombo->clear(); // Load the filter combo const Filter::List list = Filter::restore( config.config(), "Filter" ); Filter::List::ConstIterator it; for ( it = list.begin(); it != list.end(); ++it ) mFilterCombo->addItem( (*it).name() ); int id = config.readEntry( "DefaultFilterType", 1 ); mFilterGroup->button ( id )->setChecked(true); buttonClicked( id ); if ( id == 2 ) // has default filter mFilterCombo->setItemText( mFilterCombo->currentIndex(), config.readEntry( "DefaultFilterName" ) ); } void ViewConfigureFilterPage::saveSettings( KConfigGroup &config ) { config.writeEntry( "DefaultFilterName", mFilterCombo->currentText() ); config.writeEntry( "DefaultFilterType", mFilterGroup->id( mFilterGroup->checkedButton() ) ); } void ViewConfigureFilterPage::buttonClicked( int id ) { mFilterCombo->setEnabled( id == 2 ); } #include "viewconfigurefilterpage.moc"
lefou/kdepim-noakonadi
kaddressbook/viewconfigurefilterpage.cpp
C++
lgpl-2.1
4,025
/* A Bison parser, made by GNU Bison 2.4.1. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.4.1" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Push parsers. */ #define YYPUSH 0 /* Pull parsers. */ #define YYPULL 1 /* Using locations. */ #define YYLSP_NEEDED 1 /* Substitute the variable and function names. */ #define yyparse jscyyparse #define yylex jscyylex #define yyerror jscyyerror #define yylval jscyylval #define yychar jscyychar #define yydebug jscyydebug #define yynerrs jscyynerrs #define yylloc jscyylloc /* Copy the first part of user declarations. */ /* Line 189 of yacc.c */ #line 3 "../../JavaScriptCore/parser/Grammar.y" /* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2007 Eric Seidel <eric@webkit.org> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * */ #include "config.h" #include <string.h> #include <stdlib.h> #include "JSValue.h" #include "JSObject.h" #include "Nodes.h" #include "Lexer.h" #include "JSString.h" #include "JSGlobalData.h" #include "CommonIdentifiers.h" #include "NodeInfo.h" #include "Parser.h" #include <wtf/MathExtras.h> #define YYMAXDEPTH 10000 #define YYENABLE_NLS 0 /* default values for bison */ #define YYDEBUG 0 // Set to 1 to debug a parse error. #define jscyydebug 0 // Set to 1 to debug a parse error. #if !PLATFORM(DARWIN) // avoid triggering warnings in older bison #define YYERROR_VERBOSE #endif int jscyylex(void* lvalp, void* llocp, void* globalPtr); int jscyyerror(const char*); static inline bool allowAutomaticSemicolon(JSC::Lexer&, int); #define GLOBAL_DATA static_cast<JSGlobalData*>(globalPtr) #define LEXER (GLOBAL_DATA->lexer) #define AUTO_SEMICOLON do { if (!allowAutomaticSemicolon(*LEXER, yychar)) YYABORT; } while (0) #define SET_EXCEPTION_LOCATION(node, start, divot, end) node->setExceptionSourceCode((divot), (divot) - (start), (end) - (divot)) #define DBG(l, s, e) (l)->setLoc((s).first_line, (e).last_line) using namespace JSC; using namespace std; static ExpressionNode* makeAssignNode(void*, ExpressionNode* loc, Operator, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end); static ExpressionNode* makePrefixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end); static ExpressionNode* makePostfixNode(void*, ExpressionNode* expr, Operator, int start, int divot, int end); static PropertyNode* makeGetterOrSetterPropertyNode(void*, const Identifier &getOrSet, const Identifier& name, ParameterNode*, FunctionBodyNode*, const SourceCode&); static ExpressionNodeInfo makeFunctionCallNode(void*, ExpressionNodeInfo func, ArgumentsNodeInfo, int start, int divot, int end); static ExpressionNode* makeTypeOfNode(void*, ExpressionNode*); static ExpressionNode* makeDeleteNode(void*, ExpressionNode*, int start, int divot, int end); static ExpressionNode* makeNegateNode(void*, ExpressionNode*); static NumberNode* makeNumberNode(void*, double); static ExpressionNode* makeBitwiseNotNode(void*, ExpressionNode*); static ExpressionNode* makeMultNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments); static ExpressionNode* makeDivNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments); static ExpressionNode* makeAddNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments); static ExpressionNode* makeSubNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments); static ExpressionNode* makeLeftShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments); static ExpressionNode* makeRightShiftNode(void*, ExpressionNode*, ExpressionNode*, bool rightHasAssignments); static StatementNode* makeVarStatementNode(void*, ExpressionNode*); static ExpressionNode* combineVarInitializers(void*, ExpressionNode* list, AssignResolveNode* init); #if COMPILER(MSVC) #pragma warning(disable: 4065) #pragma warning(disable: 4244) #pragma warning(disable: 4702) // At least some of the time, the declarations of malloc and free that bison // generates are causing warnings. A way to avoid this is to explicitly define // the macros so that bison doesn't try to declare malloc and free. #define YYMALLOC malloc #define YYFREE free #endif #define YYPARSE_PARAM globalPtr #define YYLEX_PARAM globalPtr template <typename T> NodeDeclarationInfo<T> createNodeDeclarationInfo(T node, ParserRefCountedData<DeclarationStacks::VarStack>* varDecls, ParserRefCountedData<DeclarationStacks::FunctionStack>* funcDecls, CodeFeatures info, int numConstants) { ASSERT((info & ~AllFeatures) == 0); NodeDeclarationInfo<T> result = {node, varDecls, funcDecls, info, numConstants}; return result; } template <typename T> NodeInfo<T> createNodeInfo(T node, CodeFeatures info, int numConstants) { ASSERT((info & ~AllFeatures) == 0); NodeInfo<T> result = {node, info, numConstants}; return result; } template <typename T> T mergeDeclarationLists(T decls1, T decls2) { // decls1 or both are null if (!decls1) return decls2; // only decls1 is non-null if (!decls2) return decls1; // Both are non-null decls1->data.append(decls2->data); // We manually release the declaration lists to avoid accumulating many many // unused heap allocated vectors decls2->ref(); decls2->deref(); return decls1; } static void appendToVarDeclarationList(void* globalPtr, ParserRefCountedData<DeclarationStacks::VarStack>*& varDecls, const Identifier& ident, unsigned attrs) { if (!varDecls) varDecls = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA); varDecls->data.append(make_pair(ident, attrs)); } static inline void appendToVarDeclarationList(void* globalPtr, ParserRefCountedData<DeclarationStacks::VarStack>*& varDecls, ConstDeclNode* decl) { unsigned attrs = DeclarationStacks::IsConstant; if (decl->m_init) attrs |= DeclarationStacks::HasInitializer; appendToVarDeclarationList(globalPtr, varDecls, decl->m_ident, attrs); } /* Line 189 of yacc.c */ #line 236 "Grammar.tab.c" /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 0 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { NULLTOKEN = 258, TRUETOKEN = 259, FALSETOKEN = 260, BREAK = 261, CASE = 262, DEFAULT = 263, FOR = 264, NEW = 265, VAR = 266, CONSTTOKEN = 267, CONTINUE = 268, FUNCTION = 269, RETURN = 270, VOIDTOKEN = 271, DELETETOKEN = 272, IF = 273, THISTOKEN = 274, DO = 275, WHILE = 276, INTOKEN = 277, INSTANCEOF = 278, TYPEOF = 279, SWITCH = 280, WITH = 281, RESERVED = 282, THROW = 283, TRY = 284, CATCH = 285, FINALLY = 286, DEBUGGER = 287, IF_WITHOUT_ELSE = 288, ELSE = 289, EQEQ = 290, NE = 291, STREQ = 292, STRNEQ = 293, LE = 294, GE = 295, OR = 296, AND = 297, PLUSPLUS = 298, MINUSMINUS = 299, LSHIFT = 300, RSHIFT = 301, URSHIFT = 302, PLUSEQUAL = 303, MINUSEQUAL = 304, MULTEQUAL = 305, DIVEQUAL = 306, LSHIFTEQUAL = 307, RSHIFTEQUAL = 308, URSHIFTEQUAL = 309, ANDEQUAL = 310, MODEQUAL = 311, XOREQUAL = 312, OREQUAL = 313, OPENBRACE = 314, CLOSEBRACE = 315, NUMBER = 316, IDENT = 317, STRING = 318, AUTOPLUSPLUS = 319, AUTOMINUSMINUS = 320 }; #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { /* Line 214 of yacc.c */ #line 157 "../../JavaScriptCore/parser/Grammar.y" int intValue; double doubleValue; Identifier* ident; // expression subtrees ExpressionNodeInfo expressionNode; FuncDeclNodeInfo funcDeclNode; PropertyNodeInfo propertyNode; ArgumentsNodeInfo argumentsNode; ConstDeclNodeInfo constDeclNode; CaseBlockNodeInfo caseBlockNode; CaseClauseNodeInfo caseClauseNode; FuncExprNodeInfo funcExprNode; // statement nodes StatementNodeInfo statementNode; FunctionBodyNode* functionBodyNode; ProgramNode* programNode; SourceElementsInfo sourceElements; PropertyListInfo propertyList; ArgumentListInfo argumentList; VarDeclListInfo varDeclList; ConstDeclListInfo constDeclList; ClauseListInfo clauseList; ElementListInfo elementList; ParameterListInfo parameterList; Operator op; /* Line 214 of yacc.c */ #line 371 "Grammar.tab.c" } YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 #endif #if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED typedef struct YYLTYPE { int first_line; int first_column; int last_line; int last_column; } YYLTYPE; # define yyltype YYLTYPE /* obsolescent; will be withdrawn */ # define YYLTYPE_IS_DECLARED 1 # define YYLTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 264 of yacc.c */ #line 396 "Grammar.tab.c" #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include <libintl.h> /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int yyi) #else static int YYID (yyi) int yyi; #endif { return yyi; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include <alloca.h> /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include <malloc.h> /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \ && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss_alloc; YYSTYPE yyvs_alloc; YYLTYPE yyls_alloc; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 206 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 2349 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 88 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 194 /* YYNRULES -- Number of rules. */ #define YYNRULES 597 /* YYNRULES -- Number of states. */ #define YYNSTATES 1082 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 320 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 77, 2, 2, 2, 79, 82, 2, 68, 69, 78, 74, 70, 75, 73, 66, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 67, 87, 80, 86, 81, 85, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 71, 2, 72, 83, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 84, 2, 76, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 5, 7, 9, 11, 13, 15, 17, 21, 25, 29, 37, 46, 48, 52, 54, 57, 61, 66, 68, 70, 72, 74, 78, 82, 86, 92, 95, 100, 101, 103, 105, 108, 110, 112, 117, 121, 125, 127, 132, 136, 140, 142, 145, 147, 150, 153, 156, 161, 165, 168, 171, 176, 180, 183, 187, 189, 193, 195, 197, 199, 201, 203, 206, 209, 211, 214, 217, 220, 223, 226, 229, 232, 235, 238, 241, 244, 247, 250, 252, 254, 256, 258, 260, 264, 268, 272, 274, 278, 282, 286, 288, 292, 296, 298, 302, 306, 308, 312, 316, 320, 322, 326, 330, 334, 336, 340, 344, 348, 352, 356, 360, 362, 366, 370, 374, 378, 382, 384, 388, 392, 396, 400, 404, 408, 410, 414, 418, 422, 426, 428, 432, 436, 440, 444, 446, 450, 454, 458, 462, 464, 468, 470, 474, 476, 480, 482, 486, 488, 492, 494, 498, 500, 504, 506, 510, 512, 516, 518, 522, 524, 528, 530, 534, 536, 540, 542, 546, 548, 552, 554, 560, 562, 568, 570, 576, 578, 582, 584, 588, 590, 594, 596, 598, 600, 602, 604, 606, 608, 610, 612, 614, 616, 618, 620, 624, 626, 630, 632, 636, 638, 640, 642, 644, 646, 648, 650, 652, 654, 656, 658, 660, 662, 664, 666, 668, 670, 673, 677, 681, 685, 687, 690, 694, 699, 701, 704, 708, 713, 717, 721, 723, 727, 729, 732, 735, 738, 740, 743, 746, 752, 760, 768, 776, 782, 792, 803, 811, 820, 830, 831, 833, 834, 836, 839, 842, 846, 850, 853, 856, 860, 864, 867, 870, 874, 878, 884, 890, 894, 900, 901, 903, 905, 908, 912, 917, 920, 924, 928, 932, 936, 941, 949, 959, 962, 965, 973, 982, 989, 997, 1005, 1014, 1016, 1020, 1021, 1023, 1024, 1026, 1028, 1031, 1033, 1035, 1037, 1039, 1041, 1043, 1045, 1049, 1053, 1057, 1065, 1074, 1076, 1080, 1082, 1085, 1089, 1094, 1096, 1098, 1100, 1102, 1106, 1110, 1114, 1120, 1123, 1128, 1129, 1131, 1133, 1136, 1138, 1140, 1145, 1149, 1153, 1155, 1160, 1164, 1168, 1170, 1173, 1175, 1178, 1181, 1184, 1189, 1193, 1196, 1199, 1204, 1208, 1211, 1215, 1217, 1221, 1223, 1225, 1227, 1229, 1231, 1234, 1237, 1239, 1242, 1245, 1248, 1251, 1254, 1257, 1260, 1263, 1266, 1269, 1272, 1275, 1278, 1280, 1282, 1284, 1286, 1288, 1292, 1296, 1300, 1302, 1306, 1310, 1314, 1316, 1320, 1324, 1326, 1330, 1334, 1336, 1340, 1344, 1348, 1350, 1354, 1358, 1362, 1364, 1368, 1372, 1376, 1380, 1384, 1388, 1390, 1394, 1398, 1402, 1406, 1410, 1412, 1416, 1420, 1424, 1428, 1432, 1436, 1438, 1442, 1446, 1450, 1454, 1456, 1460, 1464, 1468, 1472, 1474, 1478, 1482, 1486, 1490, 1492, 1496, 1498, 1502, 1504, 1508, 1510, 1514, 1516, 1520, 1522, 1526, 1528, 1532, 1534, 1538, 1540, 1544, 1546, 1550, 1552, 1556, 1558, 1562, 1564, 1568, 1570, 1574, 1576, 1580, 1582, 1588, 1590, 1596, 1598, 1604, 1606, 1610, 1612, 1616, 1618, 1622, 1624, 1626, 1628, 1630, 1632, 1634, 1636, 1638, 1640, 1642, 1644, 1646, 1648, 1652, 1654, 1658, 1660, 1664, 1666, 1668, 1670, 1672, 1674, 1676, 1678, 1680, 1682, 1684, 1686, 1688, 1690, 1692, 1694, 1696, 1698, 1701, 1705, 1709, 1713, 1715, 1718, 1722, 1727, 1729, 1732, 1736, 1741, 1745, 1749, 1751, 1755, 1757, 1760, 1763, 1766, 1768, 1771, 1774, 1780, 1788, 1796, 1804, 1810, 1820, 1831, 1839, 1848, 1858, 1859, 1861, 1862, 1864, 1867, 1870, 1874, 1878, 1881, 1884, 1888, 1892, 1895, 1898, 1902, 1906, 1912, 1918, 1922, 1928, 1929, 1931, 1933, 1936, 1940, 1945, 1948, 1952, 1956, 1960, 1964, 1969, 1977, 1987, 1990, 1993, 2001, 2010, 2017, 2025, 2033, 2042, 2044, 2048, 2049, 2051, 2053 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { 184, 0, -1, 3, -1, 4, -1, 5, -1, 61, -1, 63, -1, 66, -1, 51, -1, 62, 67, 143, -1, 63, 67, 143, -1, 61, 67, 143, -1, 62, 62, 68, 69, 59, 183, 60, -1, 62, 62, 68, 182, 69, 59, 183, 60, -1, 90, -1, 91, 70, 90, -1, 93, -1, 59, 60, -1, 59, 91, 60, -1, 59, 91, 70, 60, -1, 19, -1, 89, -1, 94, -1, 62, -1, 68, 147, 69, -1, 71, 96, 72, -1, 71, 95, 72, -1, 71, 95, 70, 96, 72, -1, 96, 143, -1, 95, 70, 96, 143, -1, -1, 97, -1, 70, -1, 97, 70, -1, 92, -1, 181, -1, 98, 71, 147, 72, -1, 98, 73, 62, -1, 10, 98, 104, -1, 93, -1, 99, 71, 147, 72, -1, 99, 73, 62, -1, 10, 98, 104, -1, 98, -1, 10, 100, -1, 99, -1, 10, 100, -1, 98, 104, -1, 102, 104, -1, 102, 71, 147, 72, -1, 102, 73, 62, -1, 99, 104, -1, 103, 104, -1, 103, 71, 147, 72, -1, 103, 73, 62, -1, 68, 69, -1, 68, 105, 69, -1, 143, -1, 105, 70, 143, -1, 100, -1, 102, -1, 101, -1, 103, -1, 106, -1, 106, 43, -1, 106, 44, -1, 107, -1, 107, 43, -1, 107, 44, -1, 17, 111, -1, 16, 111, -1, 24, 111, -1, 43, 111, -1, 64, 111, -1, 44, 111, -1, 65, 111, -1, 74, 111, -1, 75, 111, -1, 76, 111, -1, 77, 111, -1, 108, -1, 110, -1, 109, -1, 110, -1, 111, -1, 113, 78, 111, -1, 113, 66, 111, -1, 113, 79, 111, -1, 112, -1, 114, 78, 111, -1, 114, 66, 111, -1, 114, 79, 111, -1, 113, -1, 115, 74, 113, -1, 115, 75, 113, -1, 114, -1, 116, 74, 113, -1, 116, 75, 113, -1, 115, -1, 117, 45, 115, -1, 117, 46, 115, -1, 117, 47, 115, -1, 116, -1, 118, 45, 115, -1, 118, 46, 115, -1, 118, 47, 115, -1, 117, -1, 119, 80, 117, -1, 119, 81, 117, -1, 119, 39, 117, -1, 119, 40, 117, -1, 119, 23, 117, -1, 119, 22, 117, -1, 117, -1, 120, 80, 117, -1, 120, 81, 117, -1, 120, 39, 117, -1, 120, 40, 117, -1, 120, 23, 117, -1, 118, -1, 121, 80, 117, -1, 121, 81, 117, -1, 121, 39, 117, -1, 121, 40, 117, -1, 121, 23, 117, -1, 121, 22, 117, -1, 119, -1, 122, 35, 119, -1, 122, 36, 119, -1, 122, 37, 119, -1, 122, 38, 119, -1, 120, -1, 123, 35, 120, -1, 123, 36, 120, -1, 123, 37, 120, -1, 123, 38, 120, -1, 121, -1, 124, 35, 119, -1, 124, 36, 119, -1, 124, 37, 119, -1, 124, 38, 119, -1, 122, -1, 125, 82, 122, -1, 123, -1, 126, 82, 123, -1, 124, -1, 127, 82, 122, -1, 125, -1, 128, 83, 125, -1, 126, -1, 129, 83, 126, -1, 127, -1, 130, 83, 125, -1, 128, -1, 131, 84, 128, -1, 129, -1, 132, 84, 129, -1, 130, -1, 133, 84, 128, -1, 131, -1, 134, 42, 131, -1, 132, -1, 135, 42, 132, -1, 133, -1, 136, 42, 131, -1, 134, -1, 137, 41, 134, -1, 135, -1, 138, 41, 135, -1, 136, -1, 139, 41, 134, -1, 137, -1, 137, 85, 143, 67, 143, -1, 138, -1, 138, 85, 144, 67, 144, -1, 139, -1, 139, 85, 143, 67, 143, -1, 140, -1, 106, 146, 143, -1, 141, -1, 106, 146, 144, -1, 142, -1, 107, 146, 143, -1, 86, -1, 48, -1, 49, -1, 50, -1, 51, -1, 52, -1, 53, -1, 54, -1, 55, -1, 57, -1, 58, -1, 56, -1, 143, -1, 147, 70, 143, -1, 144, -1, 148, 70, 144, -1, 145, -1, 149, 70, 143, -1, 151, -1, 152, -1, 155, -1, 180, -1, 160, -1, 161, -1, 162, -1, 163, -1, 166, -1, 167, -1, 168, -1, 169, -1, 170, -1, 176, -1, 177, -1, 178, -1, 179, -1, 59, 60, -1, 59, 185, 60, -1, 11, 153, 87, -1, 11, 153, 1, -1, 62, -1, 62, 158, -1, 153, 70, 62, -1, 153, 70, 62, 158, -1, 62, -1, 62, 159, -1, 154, 70, 62, -1, 154, 70, 62, 159, -1, 12, 156, 87, -1, 12, 156, 1, -1, 157, -1, 156, 70, 157, -1, 62, -1, 62, 158, -1, 86, 143, -1, 86, 144, -1, 87, -1, 149, 87, -1, 149, 1, -1, 18, 68, 147, 69, 150, -1, 18, 68, 147, 69, 150, 34, 150, -1, 20, 150, 21, 68, 147, 69, 87, -1, 20, 150, 21, 68, 147, 69, 1, -1, 21, 68, 147, 69, 150, -1, 9, 68, 165, 87, 164, 87, 164, 69, 150, -1, 9, 68, 11, 154, 87, 164, 87, 164, 69, 150, -1, 9, 68, 106, 22, 147, 69, 150, -1, 9, 68, 11, 62, 22, 147, 69, 150, -1, 9, 68, 11, 62, 159, 22, 147, 69, 150, -1, -1, 147, -1, -1, 148, -1, 13, 87, -1, 13, 1, -1, 13, 62, 87, -1, 13, 62, 1, -1, 6, 87, -1, 6, 1, -1, 6, 62, 87, -1, 6, 62, 1, -1, 15, 87, -1, 15, 1, -1, 15, 147, 87, -1, 15, 147, 1, -1, 26, 68, 147, 69, 150, -1, 25, 68, 147, 69, 171, -1, 59, 172, 60, -1, 59, 172, 175, 172, 60, -1, -1, 173, -1, 174, -1, 173, 174, -1, 7, 147, 67, -1, 7, 147, 67, 185, -1, 8, 67, -1, 8, 67, 185, -1, 62, 67, 150, -1, 28, 147, 87, -1, 28, 147, 1, -1, 29, 151, 31, 151, -1, 29, 151, 30, 68, 62, 69, 151, -1, 29, 151, 30, 68, 62, 69, 151, 31, 151, -1, 32, 87, -1, 32, 1, -1, 14, 62, 68, 69, 59, 183, 60, -1, 14, 62, 68, 182, 69, 59, 183, 60, -1, 14, 68, 69, 59, 183, 60, -1, 14, 68, 182, 69, 59, 183, 60, -1, 14, 62, 68, 69, 59, 183, 60, -1, 14, 62, 68, 182, 69, 59, 183, 60, -1, 62, -1, 182, 70, 62, -1, -1, 281, -1, -1, 185, -1, 150, -1, 185, 150, -1, 3, -1, 4, -1, 5, -1, 61, -1, 63, -1, 66, -1, 51, -1, 62, 67, 240, -1, 63, 67, 240, -1, 61, 67, 240, -1, 62, 62, 68, 69, 59, 280, 60, -1, 62, 62, 68, 279, 69, 59, 280, 60, -1, 187, -1, 188, 70, 187, -1, 190, -1, 59, 60, -1, 59, 188, 60, -1, 59, 188, 70, 60, -1, 19, -1, 186, -1, 191, -1, 62, -1, 68, 244, 69, -1, 71, 193, 72, -1, 71, 192, 72, -1, 71, 192, 70, 193, 72, -1, 193, 240, -1, 192, 70, 193, 240, -1, -1, 194, -1, 70, -1, 194, 70, -1, 189, -1, 278, -1, 195, 71, 244, 72, -1, 195, 73, 62, -1, 10, 195, 201, -1, 190, -1, 196, 71, 244, 72, -1, 196, 73, 62, -1, 10, 195, 201, -1, 195, -1, 10, 197, -1, 196, -1, 10, 197, -1, 195, 201, -1, 199, 201, -1, 199, 71, 244, 72, -1, 199, 73, 62, -1, 196, 201, -1, 200, 201, -1, 200, 71, 244, 72, -1, 200, 73, 62, -1, 68, 69, -1, 68, 202, 69, -1, 240, -1, 202, 70, 240, -1, 197, -1, 199, -1, 198, -1, 200, -1, 203, -1, 203, 43, -1, 203, 44, -1, 204, -1, 204, 43, -1, 204, 44, -1, 17, 208, -1, 16, 208, -1, 24, 208, -1, 43, 208, -1, 64, 208, -1, 44, 208, -1, 65, 208, -1, 74, 208, -1, 75, 208, -1, 76, 208, -1, 77, 208, -1, 205, -1, 207, -1, 206, -1, 207, -1, 208, -1, 210, 78, 208, -1, 210, 66, 208, -1, 210, 79, 208, -1, 209, -1, 211, 78, 208, -1, 211, 66, 208, -1, 211, 79, 208, -1, 210, -1, 212, 74, 210, -1, 212, 75, 210, -1, 211, -1, 213, 74, 210, -1, 213, 75, 210, -1, 212, -1, 214, 45, 212, -1, 214, 46, 212, -1, 214, 47, 212, -1, 213, -1, 215, 45, 212, -1, 215, 46, 212, -1, 215, 47, 212, -1, 214, -1, 216, 80, 214, -1, 216, 81, 214, -1, 216, 39, 214, -1, 216, 40, 214, -1, 216, 23, 214, -1, 216, 22, 214, -1, 214, -1, 217, 80, 214, -1, 217, 81, 214, -1, 217, 39, 214, -1, 217, 40, 214, -1, 217, 23, 214, -1, 215, -1, 218, 80, 214, -1, 218, 81, 214, -1, 218, 39, 214, -1, 218, 40, 214, -1, 218, 23, 214, -1, 218, 22, 214, -1, 216, -1, 219, 35, 216, -1, 219, 36, 216, -1, 219, 37, 216, -1, 219, 38, 216, -1, 217, -1, 220, 35, 217, -1, 220, 36, 217, -1, 220, 37, 217, -1, 220, 38, 217, -1, 218, -1, 221, 35, 216, -1, 221, 36, 216, -1, 221, 37, 216, -1, 221, 38, 216, -1, 219, -1, 222, 82, 219, -1, 220, -1, 223, 82, 220, -1, 221, -1, 224, 82, 219, -1, 222, -1, 225, 83, 222, -1, 223, -1, 226, 83, 223, -1, 224, -1, 227, 83, 222, -1, 225, -1, 228, 84, 225, -1, 226, -1, 229, 84, 226, -1, 227, -1, 230, 84, 225, -1, 228, -1, 231, 42, 228, -1, 229, -1, 232, 42, 229, -1, 230, -1, 233, 42, 228, -1, 231, -1, 234, 41, 231, -1, 232, -1, 235, 41, 232, -1, 233, -1, 236, 41, 231, -1, 234, -1, 234, 85, 240, 67, 240, -1, 235, -1, 235, 85, 241, 67, 241, -1, 236, -1, 236, 85, 240, 67, 240, -1, 237, -1, 203, 243, 240, -1, 238, -1, 203, 243, 241, -1, 239, -1, 204, 243, 240, -1, 86, -1, 48, -1, 49, -1, 50, -1, 51, -1, 52, -1, 53, -1, 54, -1, 55, -1, 57, -1, 58, -1, 56, -1, 240, -1, 244, 70, 240, -1, 241, -1, 245, 70, 241, -1, 242, -1, 246, 70, 240, -1, 248, -1, 249, -1, 252, -1, 277, -1, 257, -1, 258, -1, 259, -1, 260, -1, 263, -1, 264, -1, 265, -1, 266, -1, 267, -1, 273, -1, 274, -1, 275, -1, 276, -1, 59, 60, -1, 59, 281, 60, -1, 11, 250, 87, -1, 11, 250, 1, -1, 62, -1, 62, 255, -1, 250, 70, 62, -1, 250, 70, 62, 255, -1, 62, -1, 62, 256, -1, 251, 70, 62, -1, 251, 70, 62, 256, -1, 12, 253, 87, -1, 12, 253, 1, -1, 254, -1, 253, 70, 254, -1, 62, -1, 62, 255, -1, 86, 240, -1, 86, 241, -1, 87, -1, 246, 87, -1, 246, 1, -1, 18, 68, 244, 69, 247, -1, 18, 68, 244, 69, 247, 34, 247, -1, 20, 247, 21, 68, 244, 69, 87, -1, 20, 247, 21, 68, 244, 69, 1, -1, 21, 68, 244, 69, 247, -1, 9, 68, 262, 87, 261, 87, 261, 69, 247, -1, 9, 68, 11, 251, 87, 261, 87, 261, 69, 247, -1, 9, 68, 203, 22, 244, 69, 247, -1, 9, 68, 11, 62, 22, 244, 69, 247, -1, 9, 68, 11, 62, 256, 22, 244, 69, 247, -1, -1, 244, -1, -1, 245, -1, 13, 87, -1, 13, 1, -1, 13, 62, 87, -1, 13, 62, 1, -1, 6, 87, -1, 6, 1, -1, 6, 62, 87, -1, 6, 62, 1, -1, 15, 87, -1, 15, 1, -1, 15, 244, 87, -1, 15, 244, 1, -1, 26, 68, 244, 69, 247, -1, 25, 68, 244, 69, 268, -1, 59, 269, 60, -1, 59, 269, 272, 269, 60, -1, -1, 270, -1, 271, -1, 270, 271, -1, 7, 244, 67, -1, 7, 244, 67, 281, -1, 8, 67, -1, 8, 67, 281, -1, 62, 67, 247, -1, 28, 244, 87, -1, 28, 244, 1, -1, 29, 248, 31, 248, -1, 29, 248, 30, 68, 62, 69, 248, -1, 29, 248, 30, 68, 62, 69, 248, 31, 248, -1, 32, 87, -1, 32, 1, -1, 14, 62, 68, 69, 59, 280, 60, -1, 14, 62, 68, 279, 69, 59, 280, 60, -1, 14, 68, 69, 59, 280, 60, -1, 14, 68, 279, 69, 59, 280, 60, -1, 14, 62, 68, 69, 59, 280, 60, -1, 14, 62, 68, 279, 69, 59, 280, 60, -1, 62, -1, 279, 70, 62, -1, -1, 281, -1, 247, -1, 281, 247, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 290, 290, 291, 292, 293, 294, 295, 304, 316, 317, 318, 319, 320, 332, 336, 343, 344, 345, 347, 351, 352, 353, 354, 355, 359, 360, 361, 365, 369, 377, 378, 382, 383, 387, 388, 389, 393, 397, 404, 405, 409, 413, 420, 421, 428, 429, 436, 437, 438, 442, 448, 449, 450, 454, 461, 462, 466, 470, 477, 478, 482, 483, 487, 488, 489, 493, 494, 495, 499, 500, 501, 502, 503, 504, 505, 506, 507, 508, 509, 512, 513, 517, 518, 522, 523, 524, 525, 529, 530, 532, 534, 539, 540, 541, 545, 546, 548, 553, 554, 555, 556, 560, 561, 562, 563, 567, 568, 569, 570, 571, 572, 575, 581, 582, 583, 584, 585, 586, 593, 594, 595, 596, 597, 598, 602, 609, 610, 611, 612, 613, 617, 618, 620, 622, 624, 629, 630, 632, 633, 635, 640, 641, 645, 646, 651, 652, 656, 657, 661, 662, 667, 668, 673, 674, 678, 679, 684, 685, 690, 691, 695, 696, 701, 702, 707, 708, 712, 713, 718, 719, 723, 724, 729, 730, 735, 736, 741, 742, 749, 750, 757, 758, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 780, 781, 785, 786, 790, 791, 795, 796, 797, 798, 799, 800, 801, 802, 803, 804, 805, 806, 807, 808, 809, 810, 811, 815, 817, 822, 824, 830, 837, 846, 854, 867, 874, 883, 891, 904, 906, 912, 920, 932, 933, 937, 941, 945, 949, 951, 956, 959, 968, 970, 972, 974, 980, 987, 996, 1002, 1013, 1014, 1018, 1019, 1023, 1027, 1031, 1035, 1042, 1045, 1048, 1051, 1057, 1060, 1063, 1066, 1072, 1078, 1084, 1085, 1094, 1095, 1099, 1105, 1115, 1116, 1120, 1121, 1125, 1131, 1135, 1142, 1148, 1154, 1164, 1166, 1171, 1172, 1183, 1184, 1191, 1192, 1202, 1205, 1211, 1212, 1216, 1217, 1222, 1229, 1240, 1241, 1242, 1243, 1244, 1245, 1246, 1250, 1251, 1252, 1253, 1254, 1258, 1259, 1263, 1264, 1265, 1267, 1271, 1272, 1273, 1274, 1275, 1279, 1280, 1281, 1285, 1286, 1289, 1291, 1295, 1296, 1300, 1301, 1302, 1303, 1304, 1308, 1309, 1310, 1311, 1315, 1316, 1320, 1321, 1325, 1326, 1327, 1328, 1332, 1333, 1334, 1335, 1339, 1340, 1344, 1345, 1349, 1350, 1354, 1355, 1359, 1360, 1361, 1365, 1366, 1367, 1371, 1372, 1373, 1374, 1375, 1376, 1377, 1378, 1379, 1380, 1381, 1384, 1385, 1389, 1390, 1394, 1395, 1396, 1397, 1401, 1402, 1403, 1404, 1408, 1409, 1410, 1414, 1415, 1416, 1420, 1421, 1422, 1423, 1427, 1428, 1429, 1430, 1434, 1435, 1436, 1437, 1438, 1439, 1440, 1444, 1445, 1446, 1447, 1448, 1449, 1453, 1454, 1455, 1456, 1457, 1458, 1459, 1463, 1464, 1465, 1466, 1467, 1471, 1472, 1473, 1474, 1475, 1479, 1480, 1481, 1482, 1483, 1487, 1488, 1492, 1493, 1497, 1498, 1502, 1503, 1507, 1508, 1512, 1513, 1517, 1518, 1522, 1523, 1527, 1528, 1532, 1533, 1537, 1538, 1542, 1543, 1547, 1548, 1552, 1553, 1557, 1558, 1562, 1563, 1567, 1568, 1572, 1573, 1577, 1578, 1582, 1583, 1587, 1588, 1592, 1593, 1594, 1595, 1596, 1597, 1598, 1599, 1600, 1601, 1602, 1603, 1607, 1608, 1612, 1613, 1617, 1618, 1622, 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, 1642, 1643, 1647, 1648, 1652, 1653, 1654, 1655, 1659, 1660, 1661, 1662, 1666, 1667, 1671, 1672, 1676, 1677, 1681, 1685, 1689, 1693, 1694, 1698, 1699, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1713, 1715, 1718, 1720, 1724, 1725, 1726, 1727, 1731, 1732, 1733, 1734, 1738, 1739, 1740, 1741, 1745, 1749, 1753, 1754, 1757, 1759, 1763, 1764, 1768, 1769, 1773, 1774, 1778, 1782, 1783, 1787, 1788, 1789, 1793, 1794, 1798, 1799, 1803, 1804, 1805, 1806, 1810, 1811, 1814, 1816, 1820, 1821 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "NULLTOKEN", "TRUETOKEN", "FALSETOKEN", "BREAK", "CASE", "DEFAULT", "FOR", "NEW", "VAR", "CONSTTOKEN", "CONTINUE", "FUNCTION", "RETURN", "VOIDTOKEN", "DELETETOKEN", "IF", "THISTOKEN", "DO", "WHILE", "INTOKEN", "INSTANCEOF", "TYPEOF", "SWITCH", "WITH", "RESERVED", "THROW", "TRY", "CATCH", "FINALLY", "DEBUGGER", "IF_WITHOUT_ELSE", "ELSE", "EQEQ", "NE", "STREQ", "STRNEQ", "LE", "GE", "OR", "AND", "PLUSPLUS", "MINUSMINUS", "LSHIFT", "RSHIFT", "URSHIFT", "PLUSEQUAL", "MINUSEQUAL", "MULTEQUAL", "DIVEQUAL", "LSHIFTEQUAL", "RSHIFTEQUAL", "URSHIFTEQUAL", "ANDEQUAL", "MODEQUAL", "XOREQUAL", "OREQUAL", "OPENBRACE", "CLOSEBRACE", "NUMBER", "IDENT", "STRING", "AUTOPLUSPLUS", "AUTOMINUSMINUS", "'/'", "':'", "'('", "')'", "','", "'['", "']'", "'.'", "'+'", "'-'", "'~'", "'!'", "'*'", "'%'", "'<'", "'>'", "'&'", "'^'", "'|'", "'?'", "'='", "';'", "$accept", "Literal", "Property", "PropertyList", "PrimaryExpr", "PrimaryExprNoBrace", "ArrayLiteral", "ElementList", "ElisionOpt", "Elision", "MemberExpr", "MemberExprNoBF", "NewExpr", "NewExprNoBF", "CallExpr", "CallExprNoBF", "Arguments", "ArgumentList", "LeftHandSideExpr", "LeftHandSideExprNoBF", "PostfixExpr", "PostfixExprNoBF", "UnaryExprCommon", "UnaryExpr", "UnaryExprNoBF", "MultiplicativeExpr", "MultiplicativeExprNoBF", "AdditiveExpr", "AdditiveExprNoBF", "ShiftExpr", "ShiftExprNoBF", "RelationalExpr", "RelationalExprNoIn", "RelationalExprNoBF", "EqualityExpr", "EqualityExprNoIn", "EqualityExprNoBF", "BitwiseANDExpr", "BitwiseANDExprNoIn", "BitwiseANDExprNoBF", "BitwiseXORExpr", "BitwiseXORExprNoIn", "BitwiseXORExprNoBF", "BitwiseORExpr", "BitwiseORExprNoIn", "BitwiseORExprNoBF", "LogicalANDExpr", "LogicalANDExprNoIn", "LogicalANDExprNoBF", "LogicalORExpr", "LogicalORExprNoIn", "LogicalORExprNoBF", "ConditionalExpr", "ConditionalExprNoIn", "ConditionalExprNoBF", "AssignmentExpr", "AssignmentExprNoIn", "AssignmentExprNoBF", "AssignmentOperator", "Expr", "ExprNoIn", "ExprNoBF", "Statement", "Block", "VariableStatement", "VariableDeclarationList", "VariableDeclarationListNoIn", "ConstStatement", "ConstDeclarationList", "ConstDeclaration", "Initializer", "InitializerNoIn", "EmptyStatement", "ExprStatement", "IfStatement", "IterationStatement", "ExprOpt", "ExprNoInOpt", "ContinueStatement", "BreakStatement", "ReturnStatement", "WithStatement", "SwitchStatement", "CaseBlock", "CaseClausesOpt", "CaseClauses", "CaseClause", "DefaultClause", "LabelledStatement", "ThrowStatement", "TryStatement", "DebuggerStatement", "FunctionDeclaration", "FunctionExpr", "FormalParameterList", "FunctionBody", "Program", "SourceElements", "Literal_NoNode", "Property_NoNode", "PropertyList_NoNode", "PrimaryExpr_NoNode", "PrimaryExprNoBrace_NoNode", "ArrayLiteral_NoNode", "ElementList_NoNode", "ElisionOpt_NoNode", "Elision_NoNode", "MemberExpr_NoNode", "MemberExprNoBF_NoNode", "NewExpr_NoNode", "NewExprNoBF_NoNode", "CallExpr_NoNode", "CallExprNoBF_NoNode", "Arguments_NoNode", "ArgumentList_NoNode", "LeftHandSideExpr_NoNode", "LeftHandSideExprNoBF_NoNode", "PostfixExpr_NoNode", "PostfixExprNoBF_NoNode", "UnaryExprCommon_NoNode", "UnaryExpr_NoNode", "UnaryExprNoBF_NoNode", "MultiplicativeExpr_NoNode", "MultiplicativeExprNoBF_NoNode", "AdditiveExpr_NoNode", "AdditiveExprNoBF_NoNode", "ShiftExpr_NoNode", "ShiftExprNoBF_NoNode", "RelationalExpr_NoNode", "RelationalExprNoIn_NoNode", "RelationalExprNoBF_NoNode", "EqualityExpr_NoNode", "EqualityExprNoIn_NoNode", "EqualityExprNoBF_NoNode", "BitwiseANDExpr_NoNode", "BitwiseANDExprNoIn_NoNode", "BitwiseANDExprNoBF_NoNode", "BitwiseXORExpr_NoNode", "BitwiseXORExprNoIn_NoNode", "BitwiseXORExprNoBF_NoNode", "BitwiseORExpr_NoNode", "BitwiseORExprNoIn_NoNode", "BitwiseORExprNoBF_NoNode", "LogicalANDExpr_NoNode", "LogicalANDExprNoIn_NoNode", "LogicalANDExprNoBF_NoNode", "LogicalORExpr_NoNode", "LogicalORExprNoIn_NoNode", "LogicalORExprNoBF_NoNode", "ConditionalExpr_NoNode", "ConditionalExprNoIn_NoNode", "ConditionalExprNoBF_NoNode", "AssignmentExpr_NoNode", "AssignmentExprNoIn_NoNode", "AssignmentExprNoBF_NoNode", "AssignmentOperator_NoNode", "Expr_NoNode", "ExprNoIn_NoNode", "ExprNoBF_NoNode", "Statement_NoNode", "Block_NoNode", "VariableStatement_NoNode", "VariableDeclarationList_NoNode", "VariableDeclarationListNoIn_NoNode", "ConstStatement_NoNode", "ConstDeclarationList_NoNode", "ConstDeclaration_NoNode", "Initializer_NoNode", "InitializerNoIn_NoNode", "EmptyStatement_NoNode", "ExprStatement_NoNode", "IfStatement_NoNode", "IterationStatement_NoNode", "ExprOpt_NoNode", "ExprNoInOpt_NoNode", "ContinueStatement_NoNode", "BreakStatement_NoNode", "ReturnStatement_NoNode", "WithStatement_NoNode", "SwitchStatement_NoNode", "CaseBlock_NoNode", "CaseClausesOpt_NoNode", "CaseClauses_NoNode", "CaseClause_NoNode", "DefaultClause_NoNode", "LabelledStatement_NoNode", "ThrowStatement_NoNode", "TryStatement_NoNode", "DebuggerStatement_NoNode", "FunctionDeclaration_NoNode", "FunctionExpr_NoNode", "FormalParameterList_NoNode", "FunctionBody_NoNode", "SourceElements_NoNode", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 47, 58, 40, 41, 44, 91, 93, 46, 43, 45, 126, 33, 42, 37, 60, 62, 38, 94, 124, 63, 61, 59 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { 0, 88, 89, 89, 89, 89, 89, 89, 89, 90, 90, 90, 90, 90, 91, 91, 92, 92, 92, 92, 93, 93, 93, 93, 93, 94, 94, 94, 95, 95, 96, 96, 97, 97, 98, 98, 98, 98, 98, 99, 99, 99, 99, 100, 100, 101, 101, 102, 102, 102, 102, 103, 103, 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 108, 109, 109, 109, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 110, 111, 111, 112, 112, 113, 113, 113, 113, 114, 114, 114, 114, 115, 115, 115, 116, 116, 116, 117, 117, 117, 117, 118, 118, 118, 118, 119, 119, 119, 119, 119, 119, 119, 120, 120, 120, 120, 120, 120, 121, 121, 121, 121, 121, 121, 121, 122, 122, 122, 122, 122, 123, 123, 123, 123, 123, 124, 124, 124, 124, 124, 125, 125, 126, 126, 127, 127, 128, 128, 129, 129, 130, 130, 131, 131, 132, 132, 133, 133, 134, 134, 135, 135, 136, 136, 137, 137, 138, 138, 139, 139, 140, 140, 141, 141, 142, 142, 143, 143, 144, 144, 145, 145, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 147, 147, 148, 148, 149, 149, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150, 151, 151, 152, 152, 153, 153, 153, 153, 154, 154, 154, 154, 155, 155, 156, 156, 157, 157, 158, 159, 160, 161, 161, 162, 162, 163, 163, 163, 163, 163, 163, 163, 163, 164, 164, 165, 165, 166, 166, 166, 166, 167, 167, 167, 167, 168, 168, 168, 168, 169, 170, 171, 171, 172, 172, 173, 173, 174, 174, 175, 175, 176, 177, 177, 178, 178, 178, 179, 179, 180, 180, 181, 181, 181, 181, 182, 182, 183, 183, 184, 184, 185, 185, 186, 186, 186, 186, 186, 186, 186, 187, 187, 187, 187, 187, 188, 188, 189, 189, 189, 189, 190, 190, 190, 190, 190, 191, 191, 191, 192, 192, 193, 193, 194, 194, 195, 195, 195, 195, 195, 196, 196, 196, 196, 197, 197, 198, 198, 199, 199, 199, 199, 200, 200, 200, 200, 201, 201, 202, 202, 203, 203, 204, 204, 205, 205, 205, 206, 206, 206, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 207, 208, 208, 209, 209, 210, 210, 210, 210, 211, 211, 211, 211, 212, 212, 212, 213, 213, 213, 214, 214, 214, 214, 215, 215, 215, 215, 216, 216, 216, 216, 216, 216, 216, 217, 217, 217, 217, 217, 217, 218, 218, 218, 218, 218, 218, 218, 219, 219, 219, 219, 219, 220, 220, 220, 220, 220, 221, 221, 221, 221, 221, 222, 222, 223, 223, 224, 224, 225, 225, 226, 226, 227, 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 243, 244, 244, 245, 245, 246, 246, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 247, 248, 248, 249, 249, 250, 250, 250, 250, 251, 251, 251, 251, 252, 252, 253, 253, 254, 254, 255, 256, 257, 258, 258, 259, 259, 260, 260, 260, 260, 260, 260, 260, 260, 261, 261, 262, 262, 263, 263, 263, 263, 264, 264, 264, 264, 265, 265, 265, 265, 266, 267, 268, 268, 269, 269, 270, 270, 271, 271, 272, 272, 273, 274, 274, 275, 275, 275, 276, 276, 277, 277, 278, 278, 278, 278, 279, 279, 280, 280, 281, 281 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 7, 8, 1, 3, 1, 2, 3, 4, 1, 1, 1, 1, 3, 3, 3, 5, 2, 4, 0, 1, 1, 2, 1, 1, 4, 3, 3, 1, 4, 3, 3, 1, 2, 1, 2, 2, 2, 4, 3, 2, 2, 4, 3, 2, 3, 1, 3, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 3, 3, 3, 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 5, 1, 5, 1, 5, 1, 3, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 1, 2, 3, 4, 1, 2, 3, 4, 3, 3, 1, 3, 1, 2, 2, 2, 1, 2, 2, 5, 7, 7, 7, 5, 9, 10, 7, 8, 9, 0, 1, 0, 1, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 5, 5, 3, 5, 0, 1, 1, 2, 3, 4, 2, 3, 3, 3, 3, 4, 7, 9, 2, 2, 7, 8, 6, 7, 7, 8, 1, 3, 0, 1, 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 3, 3, 3, 7, 8, 1, 3, 1, 2, 3, 4, 1, 1, 1, 1, 3, 3, 3, 5, 2, 4, 0, 1, 1, 2, 1, 1, 4, 3, 3, 1, 4, 3, 3, 1, 2, 1, 2, 2, 2, 4, 3, 2, 2, 4, 3, 2, 3, 1, 3, 1, 1, 1, 1, 1, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1, 3, 3, 3, 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, 1, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 5, 1, 5, 1, 5, 1, 3, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, 3, 1, 2, 3, 4, 1, 2, 3, 4, 3, 3, 1, 3, 1, 2, 2, 2, 1, 2, 2, 5, 7, 7, 7, 5, 9, 10, 7, 8, 9, 0, 1, 0, 1, 2, 2, 3, 3, 2, 2, 3, 3, 2, 2, 3, 3, 5, 5, 3, 5, 0, 1, 1, 2, 3, 4, 2, 3, 3, 3, 3, 4, 7, 9, 2, 2, 7, 8, 6, 7, 7, 8, 1, 3, 0, 1, 1, 2 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint16 yydefact[] = { 297, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 5, 23, 6, 0, 0, 7, 0, 30, 0, 0, 0, 0, 238, 21, 39, 22, 45, 61, 62, 66, 82, 83, 88, 95, 102, 119, 136, 145, 151, 157, 163, 169, 175, 181, 199, 0, 299, 201, 202, 203, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 204, 0, 298, 260, 0, 259, 253, 0, 0, 0, 23, 34, 16, 43, 46, 35, 222, 0, 234, 0, 232, 256, 0, 255, 0, 264, 263, 43, 59, 60, 63, 80, 81, 84, 92, 98, 106, 126, 141, 147, 153, 159, 165, 171, 177, 195, 0, 63, 70, 69, 0, 0, 0, 71, 0, 0, 0, 0, 286, 285, 72, 74, 218, 0, 0, 73, 75, 0, 32, 0, 0, 31, 76, 77, 78, 79, 0, 0, 0, 51, 0, 0, 52, 67, 68, 184, 185, 186, 187, 188, 189, 190, 191, 194, 192, 193, 183, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 240, 0, 239, 1, 300, 262, 261, 0, 63, 113, 131, 143, 149, 155, 161, 167, 173, 179, 197, 254, 0, 43, 44, 0, 0, 17, 0, 0, 0, 14, 0, 0, 0, 42, 0, 223, 221, 0, 220, 235, 231, 0, 230, 258, 257, 0, 47, 0, 0, 48, 64, 65, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 266, 0, 265, 0, 0, 0, 0, 0, 281, 280, 0, 0, 219, 279, 24, 30, 26, 25, 28, 33, 55, 0, 57, 0, 41, 0, 54, 182, 90, 89, 91, 96, 97, 103, 104, 105, 125, 124, 122, 123, 120, 121, 137, 138, 139, 140, 146, 152, 158, 164, 170, 0, 200, 226, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 251, 38, 0, 293, 0, 0, 0, 0, 0, 0, 18, 0, 0, 37, 236, 224, 233, 0, 0, 0, 50, 178, 86, 85, 87, 93, 94, 99, 100, 101, 112, 111, 109, 110, 107, 108, 127, 128, 129, 130, 142, 148, 154, 160, 166, 0, 196, 0, 0, 0, 0, 0, 0, 282, 0, 56, 0, 40, 53, 0, 0, 0, 227, 0, 251, 0, 63, 180, 118, 116, 117, 114, 115, 132, 133, 134, 135, 144, 150, 156, 162, 168, 0, 198, 252, 0, 0, 0, 295, 0, 0, 11, 0, 9, 10, 19, 15, 36, 225, 295, 0, 49, 0, 241, 0, 245, 271, 268, 267, 0, 27, 29, 58, 176, 0, 237, 0, 228, 0, 0, 0, 251, 295, 0, 301, 302, 303, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 319, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 307, 0, 304, 322, 305, 0, 0, 306, 0, 329, 0, 0, 0, 0, 537, 0, 320, 338, 321, 344, 360, 361, 365, 381, 382, 387, 394, 401, 418, 435, 444, 450, 456, 462, 468, 474, 480, 498, 0, 596, 500, 501, 502, 504, 505, 506, 507, 508, 509, 510, 511, 512, 513, 514, 515, 516, 503, 296, 295, 294, 0, 0, 0, 295, 172, 0, 0, 0, 0, 272, 273, 0, 0, 0, 229, 251, 248, 174, 0, 0, 295, 559, 0, 558, 552, 0, 0, 0, 322, 333, 315, 342, 345, 334, 521, 0, 533, 0, 531, 555, 0, 554, 0, 563, 562, 342, 358, 359, 362, 379, 380, 383, 391, 397, 405, 425, 440, 446, 452, 458, 464, 470, 476, 494, 0, 362, 369, 368, 0, 0, 0, 370, 0, 0, 0, 0, 585, 584, 371, 373, 517, 0, 0, 372, 374, 0, 331, 0, 0, 330, 375, 376, 377, 378, 289, 0, 0, 0, 350, 0, 0, 351, 366, 367, 483, 484, 485, 486, 487, 488, 489, 490, 493, 491, 492, 482, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 539, 0, 538, 597, 0, 295, 0, 287, 0, 242, 244, 243, 0, 0, 269, 271, 274, 283, 249, 0, 0, 0, 291, 0, 561, 560, 0, 362, 412, 430, 442, 448, 454, 460, 466, 472, 478, 496, 553, 0, 342, 343, 0, 0, 316, 0, 0, 0, 313, 0, 0, 0, 341, 0, 522, 520, 0, 519, 534, 530, 0, 529, 557, 556, 0, 346, 0, 0, 347, 363, 364, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 565, 0, 564, 0, 0, 0, 0, 0, 580, 579, 0, 0, 518, 578, 323, 329, 325, 324, 327, 332, 354, 0, 356, 0, 340, 0, 353, 481, 389, 388, 390, 395, 396, 402, 403, 404, 424, 423, 421, 422, 419, 420, 436, 437, 438, 439, 445, 451, 457, 463, 469, 0, 499, 290, 0, 295, 288, 275, 277, 0, 0, 250, 0, 246, 292, 525, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 550, 337, 0, 592, 0, 0, 0, 0, 0, 0, 317, 0, 0, 336, 535, 523, 532, 0, 0, 0, 349, 477, 385, 384, 386, 392, 393, 398, 399, 400, 411, 410, 408, 409, 406, 407, 426, 427, 428, 429, 441, 447, 453, 459, 465, 0, 495, 0, 0, 0, 0, 0, 0, 581, 0, 355, 0, 339, 352, 0, 12, 0, 276, 278, 270, 284, 247, 0, 0, 526, 0, 550, 0, 362, 479, 417, 415, 416, 413, 414, 431, 432, 433, 434, 443, 449, 455, 461, 467, 0, 497, 551, 0, 0, 0, 594, 0, 0, 310, 0, 308, 309, 318, 314, 335, 524, 594, 0, 348, 0, 540, 0, 544, 570, 567, 566, 0, 326, 328, 357, 475, 13, 0, 536, 0, 527, 0, 0, 0, 550, 594, 0, 0, 595, 594, 593, 0, 0, 0, 594, 471, 0, 0, 0, 0, 571, 572, 0, 0, 0, 528, 550, 547, 473, 0, 0, 594, 588, 0, 594, 0, 586, 0, 541, 543, 542, 0, 0, 568, 570, 573, 582, 548, 0, 0, 0, 590, 0, 589, 0, 594, 587, 574, 576, 0, 0, 549, 0, 545, 591, 311, 0, 575, 577, 569, 583, 546, 312 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 41, 232, 233, 92, 93, 43, 150, 151, 152, 108, 44, 109, 45, 110, 46, 160, 301, 128, 47, 112, 48, 113, 114, 50, 115, 51, 116, 52, 117, 53, 118, 213, 54, 119, 214, 55, 120, 215, 56, 121, 216, 57, 122, 217, 58, 123, 218, 59, 124, 219, 60, 125, 220, 61, 126, 221, 62, 336, 437, 222, 63, 64, 65, 66, 98, 334, 67, 100, 101, 238, 415, 68, 69, 70, 71, 438, 223, 72, 73, 74, 75, 76, 460, 570, 571, 572, 718, 77, 78, 79, 80, 81, 96, 358, 517, 82, 83, 518, 751, 752, 591, 592, 520, 649, 650, 651, 607, 521, 608, 522, 609, 523, 660, 820, 627, 524, 611, 525, 612, 613, 527, 614, 528, 615, 529, 616, 530, 617, 732, 531, 618, 733, 532, 619, 734, 533, 620, 735, 534, 621, 736, 535, 622, 737, 536, 623, 738, 537, 624, 739, 538, 625, 740, 539, 867, 975, 741, 540, 541, 542, 543, 597, 865, 544, 599, 600, 757, 953, 545, 546, 547, 548, 976, 742, 549, 550, 551, 552, 553, 998, 1028, 1029, 1030, 1053, 554, 555, 556, 557, 558, 595, 889, 1016, 559 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -941 static const yytype_int16 yypact[] = { 1516, -941, -941, -941, 44, -2, 839, 26, 178, 73, 192, 954, 2114, 2114, 189, -941, 1516, 207, 2114, 245, 275, 2114, 226, 47, 2114, 2114, -941, 1200, -941, 280, -941, 2114, 2114, -941, 2114, 20, 2114, 2114, 2114, 2114, -941, -941, -941, -941, 350, -941, 361, 2201, -941, -941, -941, 6, -21, 437, 446, 264, 269, 315, 306, 364, 9, -941, -941, 69, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, 417, 1516, -941, 88, -941, 1670, 839, 25, 435, -941, -941, -941, 390, -941, -941, 338, 96, 338, 151, -941, -941, 90, -941, 365, -941, -941, 390, -941, 394, 2224, -941, -941, -941, 215, 255, 483, 509, 504, 374, 377, 380, 424, 14, -941, -941, 163, 445, -941, -941, 2114, 452, 2114, -941, 2114, 2114, 164, 486, -941, -941, -941, -941, -941, 1279, 1516, -941, -941, 495, -941, 311, 1706, 400, -941, -941, -941, -941, 1781, 2114, 418, -941, 2114, 432, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, -941, 2114, -941, -941, -941, -941, -941, 442, 737, 483, 355, 583, 428, 440, 453, 491, 17, -941, -941, 481, 469, 390, -941, 505, 187, -941, 513, -5, 521, -941, 177, 2114, 539, -941, 2114, -941, -941, 545, -941, -941, -941, 178, -941, -941, -941, 236, -941, 2114, 547, -941, -941, -941, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, -941, 2114, -941, 499, 548, 559, 582, 617, -941, -941, 556, 226, -941, -941, -941, 20, -941, -941, -941, -941, -941, 628, -941, 314, -941, 329, -941, -941, -941, -941, -941, 215, 215, 255, 255, 255, 483, 483, 483, 483, 483, 483, 509, 509, 509, 509, 504, 374, 377, 380, 424, 546, -941, 29, -11, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, 2114, -941, 256, -941, 567, 632, 2114, 563, 2114, 2114, -941, 586, 358, -941, -941, 338, -941, 574, 635, 436, -941, -941, -941, -941, -941, 215, 215, 255, 255, 255, 483, 483, 483, 483, 483, 483, 509, 509, 509, 509, 504, 374, 377, 380, 424, 571, -941, 1516, 2114, 1516, 584, 1516, 591, -941, 1817, -941, 2114, -941, -941, 2114, 2114, 2114, 656, 598, 2114, 648, 2224, -941, 483, 483, 483, 483, 483, 355, 355, 355, 355, 583, 428, 440, 453, 491, 639, -941, 614, 608, 649, 662, 1595, 651, 650, -941, 283, -941, -941, -941, -941, -941, -941, 1595, 660, -941, 2114, 681, 670, -941, 716, -941, -941, 657, -941, -941, -941, -941, 680, -941, 2114, 647, 654, 1516, 2114, 2114, 1595, 677, -941, -941, -941, 141, 688, 1122, 707, 712, 179, 717, 1087, 2150, 2150, 728, -941, 1595, 730, 2150, 732, 743, 2150, 754, 91, 2150, 2150, -941, 1358, -941, 755, -941, 2150, 2150, -941, 2150, 714, 2150, 2150, 2150, 2150, -941, 756, -941, -941, -941, 403, -941, 434, 2240, -941, -941, -941, 257, 581, 498, 619, 630, 747, 769, 753, 828, 23, -941, -941, 185, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, 1595, 1595, -941, 819, 685, 821, 1595, -941, 1516, 171, 2114, 219, 716, -941, 226, 1516, 692, -941, 2114, -941, -941, 810, 822, 1595, -941, 183, -941, 1892, 1122, 305, 609, -941, -941, -941, 441, -941, -941, 797, 195, 797, 203, -941, -941, 197, -941, 816, -941, -941, 441, -941, 447, 2263, -941, -941, -941, 262, 698, 515, 640, 638, 812, 802, 811, 845, 28, -941, -941, 208, 739, -941, -941, 2150, 868, 2150, -941, 2150, 2150, 216, 777, -941, -941, -941, -941, -941, 1437, 1595, -941, -941, 740, -941, 449, 1928, 827, -941, -941, -941, -941, -941, 2003, 2150, 837, -941, 2150, 841, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, -941, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, -941, 2150, -941, -941, 844, 1595, 847, -941, 848, -941, -941, -941, 8, 842, -941, 716, -941, 880, -941, 1516, 849, 1516, -941, 859, -941, -941, 860, 2185, 515, 357, 655, 843, 838, 840, 884, 150, -941, -941, 857, 846, 441, -941, 861, 299, -941, 863, 181, 870, -941, 284, 2150, 866, -941, 2150, -941, -941, 873, -941, -941, -941, 712, -941, -941, -941, 301, -941, 2150, 876, -941, -941, -941, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, -941, 2150, -941, 749, 871, 751, 757, 766, -941, -941, 872, 754, -941, -941, -941, 714, -941, -941, -941, -941, -941, 778, -941, 464, -941, 511, -941, -941, -941, -941, -941, 262, 262, 698, 698, 698, 515, 515, 515, 515, 515, 515, 640, 640, 640, 640, 638, 812, 802, 811, 845, 878, -941, -941, 891, 1595, -941, 1516, 1516, 894, 226, -941, 1516, -941, -941, 39, -7, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, 2150, -941, 307, -941, 897, 781, 2150, 892, 2150, 2150, -941, 683, 522, -941, -941, 797, -941, 902, 785, 525, -941, -941, -941, -941, -941, 262, 262, 698, 698, 698, 515, 515, 515, 515, 515, 515, 640, 640, 640, 640, 638, 812, 802, 811, 845, 895, -941, 1595, 2150, 1595, 904, 1595, 907, -941, 2039, -941, 2150, -941, -941, 2150, -941, 906, 1516, 1516, -941, -941, -941, 2150, 2150, 950, 912, 2150, 793, 2263, -941, 515, 515, 515, 515, 515, 357, 357, 357, 357, 655, 843, 838, 840, 884, 908, -941, 909, 889, 918, 796, 1595, 921, 919, -941, 313, -941, -941, -941, -941, -941, -941, 1595, 923, -941, 2150, 949, 798, -941, 977, -941, -941, 916, -941, -941, -941, -941, -941, 803, -941, 2150, 900, 901, 1595, 2150, 2150, 1595, 928, 935, 1595, 1595, -941, 937, 805, 939, 1595, -941, 1595, 217, 2150, 237, 977, -941, 754, 1595, 807, -941, 2150, -941, -941, 931, 941, 1595, -941, 942, 1595, 944, -941, 946, -941, -941, -941, 37, 940, -941, 977, -941, 973, -941, 1595, 943, 1595, -941, 948, -941, 951, 1595, -941, 1595, 1595, 961, 754, -941, 1595, -941, -941, -941, 963, 1595, 1595, -941, -941, -941, -941 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -941, -941, 645, -941, -941, 0, -941, -941, 715, -941, 22, -941, 186, -941, -941, -941, -29, -941, 479, -941, -941, -941, 3, 169, -941, 105, -941, 230, -941, 725, -941, 138, 423, -941, -174, 668, -941, 31, 679, -941, 40, 676, -941, 42, 678, -941, 68, 682, -941, -941, -941, -941, -941, -941, -941, -35, -305, -941, 172, 18, -941, -941, -15, -20, -941, -941, -941, -941, -941, 791, -91, 566, -941, -941, -941, -941, -407, -941, -941, -941, -941, -941, -941, -941, 319, -941, 471, -941, -941, -941, -941, -941, -941, -941, -235, -441, -941, -23, -941, 148, -941, -941, -432, -941, -941, 231, -941, -450, -941, -449, -941, -941, -941, -511, -941, 167, -941, -941, -941, -329, 263, -941, -661, -941, -460, -941, -428, -941, -480, -70, -941, -679, 170, -941, -673, 166, -941, -663, 173, -941, -660, 174, -941, -657, 165, -941, -941, -941, -941, -941, -941, -941, -601, -841, -941, -302, -473, -941, -941, -454, -493, -941, -941, -941, -941, -941, 290, -592, 46, -941, -941, -941, -941, -940, -941, -941, -941, -941, -941, -941, -941, 5, -941, 49, -941, -941, -941, -941, -941, -941, -941, -760, -652, -468 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint16 yytable[] = { 42, 132, 138, 49, 144, 637, 761, 902, 242, 519, 471, 564, 663, 371, 626, 1010, 42, 163, 845, 49, 519, 830, 831, 326, 636, 846, 958, 42, 94, 127, 49, 420, 593, 594, 581, 643, 847, 647, 631, 137, 848, 973, 974, 519, 849, 84, 435, 436, 139, 817, 201, 413, 148, 182, 183, 278, 821, 360, 350, 416, 519, 951, 361, 954, 701, 236, 87, 580, 207, 797, 203, 519, 179, 1038, 102, 856, 417, 826, 281, 249, 955, 252, 755, 42, 180, 181, 49, 226, 97, 208, 149, 246, 638, 227, 202, 1058, 768, 239, 771, 279, 393, 850, 351, 851, 1066, 706, 85, 800, 702, 468, 224, 1007, 526, 798, 924, 414, 298, 909, 910, 707, 440, 925, 302, 526, 711, 952, 978, 519, 519, 207, 293, 86, 926, 519, 140, 103, 927, 743, 744, 204, 928, 726, 583, 307, 42, 42, 526, 49, 49, 283, 519, 285, 243, 286, 287, 898, 205, 802, 731, 804, 104, 805, 806, 526, 280, 288, 240, 331, 579, 332, 723, 1037, 713, 905, 526, 209, 303, 247, 639, 305, 601, 129, 130, 241, 727, 822, 703, 134, 824, 706, 812, 881, 95, 141, 142, 354, 758, 929, 765, 930, 146, 147, 367, 584, 762, 153, 154, 155, 156, 799, 563, 519, 519, 841, 842, 843, 844, 807, 1048, 178, 374, 244, 678, 1021, 832, 833, 834, 716, 585, 327, 526, 526, 885, 281, 281, 882, 526, 363, 245, 328, 99, 602, 329, 891, 398, 1051, 399, 364, 892, 356, 282, 289, 365, 526, 105, 704, 357, 131, 714, 835, 836, 837, 838, 839, 840, 759, 603, 853, 372, 330, 728, 406, 705, 763, 225, 133, 519, 451, 800, 717, 896, 256, 760, 255, 766, 27, 800, 311, 312, 982, 764, 984, 985, 257, 258, 801, 903, 1052, 356, 193, 194, 195, 196, 808, 1049, 370, 394, 989, 774, 920, 921, 922, 923, 135, 526, 526, 395, 937, 356, 396, 911, 912, 913, 679, 444, 439, 446, 447, 775, 259, 260, 322, 323, 324, 325, 680, 681, 1002, 1022, 1003, 776, 777, 1004, 136, 894, 356, 397, 145, 308, 309, 310, 197, 562, 418, 895, 914, 915, 916, 917, 918, 919, 887, 1039, 887, 378, 379, 1042, 745, 888, 887, 901, 1046, 464, 746, 465, 887, 977, 466, 337, 526, 868, 295, 1020, 296, 281, 456, 410, 458, 1061, 461, 199, 1063, 1024, 956, 338, 339, 869, 870, 198, 281, 42, 411, 42, 49, 42, 49, 200, 49, 389, 390, 391, 392, 1075, 945, 313, 314, 315, 206, 157, 457, 566, 158, 519, 159, 237, 375, 376, 377, 281, 157, 450, 467, 161, 248, 162, 340, 341, 871, 872, 731, 959, 960, 961, 962, 963, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 731, 274, 578, 157, 995, 275, 234, 157, 235, 276, 250, 277, 251, 187, 188, 299, 657, 42, 284, 658, 49, 659, 994, 1006, 996, 304, 999, 184, 185, 186, 189, 190, 575, 253, 254, 111, 380, 381, 382, 306, 228, 229, 230, 231, 519, 111, 519, 657, 519, 333, 661, 281, 662, 454, 657, 346, 1017, 753, 111, 754, 657, 290, 291, 769, 814, 770, 815, 1017, 347, 731, 526, 191, 192, 261, 262, 263, 264, 265, 349, 800, 1033, 941, 348, 1055, 270, 271, 272, 273, 684, 685, 686, 1017, 519, 266, 267, 1017, 352, 712, 720, 1050, 1017, 353, 1036, 519, 721, 780, 781, 782, 706, 294, 281, 211, 42, 400, 281, 49, 1047, 1017, 355, 42, 1017, 1079, 49, 1056, 519, 359, 800, 519, 942, 731, 519, 519, 715, 362, 268, 269, 519, 800, 519, 988, 800, 1017, 992, 1076, 1077, 519, 366, 526, 1070, 526, 1072, 526, 368, 519, 373, 111, 519, 111, 412, 111, 111, 401, 1080, 342, 343, 344, 345, 706, 706, 405, 519, 441, 519, 402, 281, 111, 445, 519, 452, 519, 519, 111, 111, 455, 519, 111, 687, 688, 459, 519, 519, 448, 229, 230, 231, 526, 403, 281, 462, 610, 682, 683, 111, 689, 690, 470, 526, 783, 784, 610, 693, 694, 695, 696, 747, 748, 749, 750, 789, 790, 791, 792, 610, 469, 785, 786, 111, 526, 111, 281, 526, 404, 281, 526, 526, 873, 874, 875, 876, 526, 474, 526, 408, 409, 691, 692, 442, 443, 526, 453, 443, 473, 860, 475, 862, 560, 526, 561, 111, 526, 567, 111, 472, 281, 565, 787, 788, 42, 569, 42, 49, 573, 49, 526, 111, 526, 476, 443, 414, 111, 526, 582, 526, 526, 568, 281, 577, 526, 986, 748, 749, 750, 526, 526, 574, 281, 628, 629, 730, 709, 443, 586, 633, 111, 335, 111, 722, 281, 640, 641, 426, 427, 428, 429, 596, 645, 646, 778, 779, 598, 652, 653, 654, 655, 604, 253, 254, 772, 773, 648, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 630, 610, 632, 610, 634, 610, 610, 964, 965, 966, 967, 809, 810, 813, 800, 635, 212, 503, 111, 419, 656, 610, 931, 800, 933, 800, 644, 177, 610, 610, 934, 800, 610, 697, 419, 419, 111, 946, 947, 935, 800, 699, 111, 949, 111, 111, 1, 2, 3, 610, 950, 939, 940, 88, 980, 981, 698, 89, 991, 981, 42, 42, 15, 49, 49, 42, 1011, 800, 49, 1015, 981, 1026, 800, 610, 700, 610, 1032, 800, 1044, 981, 1057, 800, 708, 724, 111, 710, 725, 756, 767, 794, 111, 796, 111, 803, 26, 111, 111, 419, 793, 795, 111, 818, 90, 823, 28, 91, 30, 825, 852, 33, 854, 34, 855, 857, 35, 859, 316, 317, 318, 319, 320, 321, 861, 863, 610, 878, 864, 610, 879, 877, 880, 883, 897, 886, 890, 207, 207, 884, 111, 899, 610, 893, 904, 932, 936, 610, 827, 828, 829, 943, 42, 42, 111, 49, 49, 944, 419, 111, 948, 106, 979, 1, 2, 3, 983, 990, 993, 997, 88, 610, 1005, 610, 89, 1000, 12, 13, 1008, 15, 1009, 1012, 1013, 1014, 18, 800, 1018, 1019, 1023, 1025, 1027, 1031, 952, 1040, 1035, 383, 384, 385, 386, 387, 388, 1041, 1043, 24, 25, 1045, 1059, 1060, 1062, 1064, 1069, 26, 1065, 1067, 1073, 449, 407, 1074, 1071, 90, 430, 28, 91, 30, 31, 32, 33, 1078, 34, 1081, 432, 35, 431, 433, 36, 37, 38, 39, 434, 610, 957, 369, 576, 858, 906, 907, 908, 107, 719, 987, 969, 938, 972, 968, 111, 957, 957, 610, 970, 900, 971, 1034, 111, 610, 1068, 610, 610, 212, 421, 422, 423, 424, 425, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 212, 1054, 0, 0, 0, 0, 0, 0, 0, 0, 0, 605, 0, 477, 478, 479, 0, 0, 0, 0, 587, 0, 610, 0, 588, 0, 488, 489, 610, 491, 610, 0, 0, 610, 494, 0, 0, 0, 0, 0, 0, 610, 957, 0, 0, 610, 0, 0, 477, 478, 479, 0, 0, 500, 501, 587, 0, 0, 0, 588, 0, 502, 212, 0, 491, 0, 0, 0, 0, 589, 0, 504, 590, 506, 507, 508, 509, 0, 510, 0, 0, 511, 0, 610, 512, 513, 514, 515, 0, 0, 0, 0, 0, 0, 0, 0, 502, 606, 610, 0, 0, 0, 957, 610, 589, 0, 504, 590, 506, 0, 0, 509, 0, 510, 0, 0, 511, 610, 0, 0, 0, 212, 0, 0, 0, 610, 1, 2, 3, 4, 0, 0, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 18, 19, 20, 0, 21, 22, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 25, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 27, 143, 28, 29, 30, 31, 32, 33, 0, 34, 0, 0, 35, 0, 0, 36, 37, 38, 39, 0, 0, 0, 0, 1, 2, 3, 4, 0, 40, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 18, 19, 20, 0, 21, 22, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 25, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 27, 292, 28, 29, 30, 31, 32, 33, 0, 34, 0, 0, 35, 0, 0, 36, 37, 38, 39, 0, 0, 0, 0, 477, 478, 479, 480, 0, 40, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 0, 0, 494, 495, 496, 0, 497, 498, 0, 0, 499, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 501, 0, 0, 0, 0, 0, 0, 502, 0, 0, 0, 0, 0, 0, 0, 503, 642, 504, 505, 506, 507, 508, 509, 0, 510, 0, 0, 511, 0, 0, 512, 513, 514, 515, 0, 0, 0, 0, 477, 478, 479, 480, 0, 516, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 0, 0, 494, 495, 496, 0, 497, 498, 0, 0, 499, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 501, 0, 0, 0, 0, 0, 0, 502, 0, 0, 0, 0, 0, 0, 0, 503, 811, 504, 505, 506, 507, 508, 509, 0, 510, 0, 0, 511, 0, 0, 512, 513, 514, 515, 0, 0, 0, 0, 1, 2, 3, 4, 0, 516, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0, 0, 18, 19, 20, 0, 21, 22, 0, 0, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 25, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 27, 0, 28, 29, 30, 31, 32, 33, 0, 34, 0, 0, 35, 0, 0, 36, 37, 38, 39, 0, 0, 0, 0, 477, 478, 479, 480, 0, 40, 481, 482, 483, 484, 485, 486, 487, 488, 489, 490, 491, 492, 493, 0, 0, 494, 495, 496, 0, 497, 498, 0, 0, 499, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 501, 0, 0, 0, 0, 0, 0, 502, 0, 0, 0, 0, 0, 0, 0, 503, 0, 504, 505, 506, 507, 508, 509, 0, 510, 0, 0, 511, 0, 0, 512, 513, 514, 515, 1, 2, 3, 0, 0, 0, 0, 88, 210, 516, 0, 89, 0, 12, 13, 0, 15, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 0, 24, 25, 0, 88, 0, 0, 0, 89, 26, 12, 13, 0, 15, 0, 0, 0, 90, 18, 28, 91, 30, 31, 32, 33, 0, 34, 0, 0, 35, 0, 0, 36, 37, 38, 39, 0, 24, 25, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 90, 0, 28, 91, 30, 31, 32, 33, 0, 34, 0, 0, 35, 297, 0, 36, 37, 38, 39, 1, 2, 3, 0, 0, 0, 0, 88, 0, 0, 0, 89, 0, 12, 13, 0, 15, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 0, 24, 25, 0, 88, 0, 0, 0, 89, 26, 12, 13, 0, 15, 0, 0, 0, 90, 18, 28, 91, 30, 31, 32, 33, 0, 34, 300, 0, 35, 0, 0, 36, 37, 38, 39, 0, 24, 25, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 90, 0, 28, 91, 30, 31, 32, 33, 0, 34, 0, 0, 35, 463, 0, 36, 37, 38, 39, 477, 478, 479, 0, 0, 0, 0, 587, 729, 0, 0, 588, 0, 488, 489, 0, 491, 0, 0, 0, 0, 494, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 477, 478, 479, 0, 500, 501, 0, 587, 0, 0, 0, 588, 502, 488, 489, 0, 491, 0, 0, 0, 589, 494, 504, 590, 506, 507, 508, 509, 0, 510, 0, 0, 511, 0, 0, 512, 513, 514, 515, 0, 500, 501, 0, 0, 0, 0, 0, 0, 502, 0, 0, 0, 0, 0, 0, 0, 589, 0, 504, 590, 506, 507, 508, 509, 0, 510, 0, 0, 511, 816, 0, 512, 513, 514, 515, 477, 478, 479, 0, 0, 0, 0, 587, 0, 0, 0, 588, 0, 488, 489, 0, 491, 0, 0, 0, 0, 494, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 477, 478, 479, 0, 500, 501, 0, 587, 0, 0, 0, 588, 502, 488, 489, 0, 491, 0, 0, 0, 589, 494, 504, 590, 506, 507, 508, 509, 0, 510, 819, 0, 511, 0, 0, 512, 513, 514, 515, 0, 500, 501, 0, 0, 0, 0, 0, 0, 502, 0, 0, 0, 0, 0, 0, 0, 589, 0, 504, 590, 506, 507, 508, 509, 0, 510, 0, 0, 511, 1001, 0, 512, 513, 514, 515, 1, 2, 3, 0, 0, 0, 0, 88, 0, 0, 0, 89, 0, 12, 13, 0, 15, 0, 0, 0, 0, 18, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 477, 478, 479, 0, 24, 25, 0, 587, 0, 0, 0, 588, 26, 488, 489, 0, 491, 0, 0, 0, 90, 494, 28, 91, 30, 31, 32, 33, 0, 34, 0, 0, 35, 0, 0, 36, 37, 38, 39, 0, 500, 501, 0, 0, 0, 0, 0, 0, 502, 0, 0, 0, 0, 0, 866, 0, 589, 0, 504, 590, 506, 507, 508, 509, 0, 510, 0, 0, 511, 0, 0, 512, 513, 514, 515, 772, 773, 0, 0, 0, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 164, 165, 0, 0, 0, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 0, 0, 0, 0, 0, 0, 0, 253, 254, 0, 0, 677, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 664, 665, 0, 0, 177, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 0, 0, 0, 0, 0, 0, 0, 772, 773, 0, 0, 177, 666, 667, 668, 669, 670, 671, 672, 673, 674, 675, 676, 0, 0, 0, 0, 677, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 677 }; static const yytype_int16 yycheck[] = { 0, 16, 22, 0, 27, 498, 598, 767, 99, 441, 417, 452, 523, 248, 487, 955, 16, 46, 697, 16, 452, 682, 683, 197, 497, 698, 867, 27, 6, 11, 27, 336, 482, 482, 475, 503, 699, 510, 492, 21, 700, 882, 883, 475, 701, 1, 351, 352, 1, 650, 41, 22, 34, 74, 75, 41, 657, 62, 41, 70, 492, 22, 67, 70, 41, 94, 68, 474, 83, 41, 1, 503, 66, 1013, 1, 67, 87, 678, 70, 108, 87, 110, 593, 83, 78, 79, 83, 62, 62, 1, 70, 1, 1, 68, 85, 1035, 607, 1, 609, 85, 274, 702, 85, 704, 67, 559, 62, 70, 85, 414, 88, 952, 441, 85, 793, 86, 151, 778, 779, 560, 355, 794, 157, 452, 565, 86, 886, 559, 560, 144, 145, 87, 795, 565, 87, 62, 796, 587, 587, 70, 797, 582, 1, 178, 144, 145, 475, 144, 145, 131, 582, 133, 1, 135, 136, 756, 87, 630, 586, 632, 87, 634, 635, 492, 1, 1, 70, 202, 473, 204, 577, 1012, 1, 774, 503, 87, 158, 87, 87, 161, 1, 12, 13, 87, 1, 658, 1, 18, 661, 643, 644, 41, 6, 24, 25, 224, 1, 798, 1, 800, 31, 32, 237, 62, 1, 36, 37, 38, 39, 1, 445, 643, 644, 693, 694, 695, 696, 1, 1, 47, 255, 70, 524, 983, 684, 685, 686, 8, 87, 198, 559, 560, 743, 70, 70, 85, 565, 60, 87, 199, 62, 62, 200, 62, 279, 8, 281, 70, 67, 62, 87, 87, 234, 582, 62, 70, 69, 68, 87, 687, 688, 689, 690, 691, 692, 70, 87, 708, 250, 201, 87, 291, 87, 70, 88, 68, 708, 368, 70, 60, 753, 66, 87, 111, 87, 59, 70, 182, 183, 890, 87, 892, 893, 78, 79, 87, 769, 60, 62, 35, 36, 37, 38, 87, 87, 69, 275, 899, 610, 789, 790, 791, 792, 68, 643, 644, 276, 810, 62, 277, 780, 781, 782, 66, 359, 69, 361, 362, 66, 74, 75, 193, 194, 195, 196, 78, 79, 938, 990, 940, 78, 79, 943, 68, 60, 62, 278, 67, 179, 180, 181, 82, 69, 335, 70, 783, 784, 785, 786, 787, 788, 62, 1014, 62, 259, 260, 1018, 62, 69, 62, 69, 1023, 407, 68, 409, 62, 69, 412, 23, 708, 23, 70, 69, 72, 70, 400, 72, 402, 1040, 404, 84, 1043, 993, 866, 39, 40, 39, 40, 83, 70, 400, 72, 402, 400, 404, 402, 42, 404, 270, 271, 272, 273, 1064, 854, 184, 185, 186, 0, 68, 401, 455, 71, 854, 73, 86, 256, 257, 258, 70, 68, 72, 413, 71, 68, 73, 80, 81, 80, 81, 867, 868, 869, 870, 871, 872, 873, 874, 875, 876, 877, 878, 879, 880, 881, 882, 883, 82, 472, 68, 932, 83, 71, 68, 73, 84, 71, 42, 73, 22, 23, 70, 68, 472, 21, 71, 472, 73, 931, 951, 933, 62, 935, 45, 46, 47, 39, 40, 469, 43, 44, 11, 261, 262, 263, 62, 60, 61, 62, 63, 931, 21, 933, 68, 935, 62, 71, 70, 73, 72, 68, 82, 979, 71, 34, 73, 68, 30, 31, 71, 70, 73, 72, 990, 83, 952, 854, 80, 81, 45, 46, 47, 22, 23, 42, 70, 1008, 72, 84, 1031, 35, 36, 37, 38, 45, 46, 47, 1014, 979, 39, 40, 1018, 70, 567, 573, 1027, 1023, 87, 1011, 990, 574, 45, 46, 47, 1017, 69, 70, 87, 567, 69, 70, 567, 1025, 1040, 68, 574, 1043, 1069, 574, 1032, 1011, 67, 70, 1014, 72, 1012, 1017, 1018, 569, 67, 80, 81, 1023, 70, 1025, 72, 70, 1064, 72, 1066, 1067, 1032, 62, 931, 1057, 933, 1059, 935, 62, 1040, 62, 131, 1043, 133, 67, 135, 136, 68, 1071, 35, 36, 37, 38, 1076, 1077, 68, 1057, 59, 1059, 69, 70, 151, 68, 1064, 59, 1066, 1067, 157, 158, 67, 1071, 161, 22, 23, 59, 1076, 1077, 60, 61, 62, 63, 979, 69, 70, 62, 487, 74, 75, 178, 39, 40, 62, 990, 22, 23, 497, 35, 36, 37, 38, 60, 61, 62, 63, 35, 36, 37, 38, 510, 22, 39, 40, 202, 1011, 204, 70, 1014, 69, 70, 1017, 1018, 35, 36, 37, 38, 1023, 87, 1025, 69, 70, 80, 81, 69, 70, 1032, 69, 70, 67, 722, 59, 724, 59, 1040, 62, 234, 1043, 34, 237, 69, 70, 59, 80, 81, 722, 7, 724, 722, 69, 724, 1057, 250, 1059, 69, 70, 86, 255, 1064, 59, 1066, 1067, 69, 70, 87, 1071, 60, 61, 62, 63, 1076, 1077, 69, 70, 488, 489, 586, 69, 70, 68, 494, 279, 22, 281, 69, 70, 500, 501, 342, 343, 344, 345, 62, 507, 508, 74, 75, 62, 512, 513, 514, 515, 62, 43, 44, 43, 44, 70, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 68, 630, 68, 632, 68, 634, 635, 873, 874, 875, 876, 30, 31, 69, 70, 68, 87, 59, 335, 336, 60, 650, 69, 70, 69, 70, 67, 86, 657, 658, 69, 70, 661, 82, 351, 352, 353, 856, 857, 69, 70, 84, 359, 859, 361, 362, 3, 4, 5, 678, 861, 69, 70, 10, 69, 70, 83, 14, 69, 70, 856, 857, 19, 856, 857, 861, 69, 70, 861, 69, 70, 69, 70, 702, 42, 704, 69, 70, 69, 70, 69, 70, 59, 69, 401, 60, 60, 86, 68, 83, 407, 42, 409, 21, 51, 412, 413, 414, 82, 84, 417, 70, 59, 62, 61, 62, 63, 62, 60, 66, 59, 68, 60, 67, 71, 31, 187, 188, 189, 190, 191, 192, 69, 60, 753, 83, 62, 756, 84, 82, 42, 70, 62, 68, 67, 946, 947, 87, 455, 62, 769, 67, 62, 68, 68, 774, 679, 680, 681, 67, 946, 947, 469, 946, 947, 60, 473, 474, 60, 1, 59, 3, 4, 5, 68, 59, 67, 59, 10, 798, 60, 800, 14, 62, 16, 17, 22, 19, 62, 67, 87, 59, 24, 70, 59, 62, 59, 34, 7, 69, 86, 59, 87, 264, 265, 266, 267, 268, 269, 60, 59, 43, 44, 60, 69, 60, 60, 59, 31, 51, 60, 67, 60, 364, 295, 60, 69, 59, 346, 61, 62, 63, 64, 65, 66, 60, 68, 60, 348, 71, 347, 349, 74, 75, 76, 77, 350, 866, 867, 244, 470, 718, 775, 776, 777, 87, 571, 895, 878, 814, 881, 877, 569, 882, 883, 884, 879, 763, 880, 1009, 577, 890, 1053, 892, 893, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 1029, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 3, 4, 5, -1, -1, -1, -1, 10, -1, 932, -1, 14, -1, 16, 17, 938, 19, 940, -1, -1, 943, 24, -1, -1, -1, -1, -1, -1, 951, 952, -1, -1, 955, -1, -1, 3, 4, 5, -1, -1, 43, 44, 10, -1, -1, -1, 14, -1, 51, 414, -1, 19, -1, -1, -1, -1, 59, -1, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, -1, 993, 74, 75, 76, 77, -1, -1, -1, -1, -1, -1, -1, -1, 51, 87, 1008, -1, -1, -1, 1012, 1013, 59, -1, 61, 62, 63, -1, -1, 66, -1, 68, -1, -1, 71, 1027, -1, -1, -1, 473, -1, -1, -1, 1035, 3, 4, 5, 6, -1, -1, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, 24, 25, 26, -1, 28, 29, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, 44, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, -1, -1, 74, 75, 76, 77, -1, -1, -1, -1, 3, 4, 5, 6, -1, 87, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, 24, 25, 26, -1, 28, 29, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, 44, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, -1, -1, 74, 75, 76, 77, -1, -1, -1, -1, 3, 4, 5, 6, -1, 87, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, 24, 25, 26, -1, 28, 29, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, 44, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, -1, -1, 74, 75, 76, 77, -1, -1, -1, -1, 3, 4, 5, 6, -1, 87, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, 24, 25, 26, -1, 28, 29, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, 44, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, 59, 60, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, -1, -1, 74, 75, 76, 77, -1, -1, -1, -1, 3, 4, 5, 6, -1, 87, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, 24, 25, 26, -1, 28, 29, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, 44, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, 59, -1, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, -1, -1, 74, 75, 76, 77, -1, -1, -1, -1, 3, 4, 5, 6, -1, 87, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, -1, 24, 25, 26, -1, 28, 29, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, 44, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, 59, -1, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, -1, -1, 74, 75, 76, 77, 3, 4, 5, -1, -1, -1, -1, 10, 11, 87, -1, 14, -1, 16, 17, -1, 19, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, 43, 44, -1, 10, -1, -1, -1, 14, 51, 16, 17, -1, 19, -1, -1, -1, 59, 24, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, -1, -1, 74, 75, 76, 77, -1, 43, 44, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, 59, -1, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, 72, -1, 74, 75, 76, 77, 3, 4, 5, -1, -1, -1, -1, 10, -1, -1, -1, 14, -1, 16, 17, -1, 19, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, 43, 44, -1, 10, -1, -1, -1, 14, 51, 16, 17, -1, 19, -1, -1, -1, 59, 24, 61, 62, 63, 64, 65, 66, -1, 68, 69, -1, 71, -1, -1, 74, 75, 76, 77, -1, 43, 44, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, 59, -1, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, 72, -1, 74, 75, 76, 77, 3, 4, 5, -1, -1, -1, -1, 10, 11, -1, -1, 14, -1, 16, 17, -1, 19, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, 43, 44, -1, 10, -1, -1, -1, 14, 51, 16, 17, -1, 19, -1, -1, -1, 59, 24, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, -1, -1, 74, 75, 76, 77, -1, 43, 44, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, 59, -1, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, 72, -1, 74, 75, 76, 77, 3, 4, 5, -1, -1, -1, -1, 10, -1, -1, -1, 14, -1, 16, 17, -1, 19, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, 43, 44, -1, 10, -1, -1, -1, 14, 51, 16, 17, -1, 19, -1, -1, -1, 59, 24, 61, 62, 63, 64, 65, 66, -1, 68, 69, -1, 71, -1, -1, 74, 75, 76, 77, -1, 43, 44, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, 59, -1, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, 72, -1, 74, 75, 76, 77, 3, 4, 5, -1, -1, -1, -1, 10, -1, -1, -1, 14, -1, 16, 17, -1, 19, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 4, 5, -1, 43, 44, -1, 10, -1, -1, -1, 14, 51, 16, 17, -1, 19, -1, -1, -1, 59, 24, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, -1, -1, 74, 75, 76, 77, -1, 43, 44, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, -1, 22, -1, 59, -1, 61, 62, 63, 64, 65, 66, -1, 68, -1, -1, 71, -1, -1, 74, 75, 76, 77, 43, 44, -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 43, 44, -1, -1, -1, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, -1, -1, -1, -1, -1, 43, 44, -1, -1, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 43, 44, -1, -1, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, -1, -1, -1, -1, -1, 43, 44, -1, -1, 86, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, -1, -1, -1, -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 86 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { 0, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 25, 26, 28, 29, 32, 43, 44, 51, 59, 61, 62, 63, 64, 65, 66, 68, 71, 74, 75, 76, 77, 87, 89, 93, 94, 99, 101, 103, 107, 109, 110, 112, 114, 116, 118, 121, 124, 127, 130, 133, 136, 139, 142, 145, 149, 150, 151, 152, 155, 160, 161, 162, 163, 166, 167, 168, 169, 170, 176, 177, 178, 179, 180, 184, 185, 1, 62, 87, 68, 10, 14, 59, 62, 92, 93, 98, 100, 181, 62, 153, 62, 156, 157, 1, 62, 87, 62, 1, 87, 98, 100, 102, 106, 108, 110, 111, 113, 115, 117, 119, 122, 125, 128, 131, 134, 137, 140, 143, 147, 106, 111, 111, 68, 150, 68, 111, 68, 68, 147, 151, 1, 87, 111, 111, 60, 185, 67, 111, 111, 147, 70, 95, 96, 97, 111, 111, 111, 111, 68, 71, 73, 104, 71, 73, 104, 43, 44, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 86, 146, 66, 78, 79, 74, 75, 45, 46, 47, 22, 23, 39, 40, 80, 81, 35, 36, 37, 38, 82, 83, 84, 42, 41, 85, 1, 70, 87, 0, 150, 1, 87, 11, 106, 117, 120, 123, 126, 129, 132, 135, 138, 141, 144, 148, 165, 98, 100, 62, 68, 60, 61, 62, 63, 90, 91, 71, 73, 104, 86, 158, 1, 70, 87, 158, 1, 70, 87, 1, 87, 68, 104, 71, 73, 104, 43, 44, 146, 66, 78, 79, 74, 75, 45, 46, 47, 22, 23, 39, 40, 80, 81, 35, 36, 37, 38, 82, 83, 84, 42, 41, 85, 1, 70, 87, 147, 21, 147, 147, 147, 1, 87, 30, 31, 60, 150, 69, 70, 72, 72, 143, 70, 69, 105, 143, 147, 62, 147, 62, 143, 111, 111, 111, 113, 113, 115, 115, 115, 117, 117, 117, 117, 117, 117, 119, 119, 119, 119, 122, 125, 128, 131, 134, 143, 143, 62, 154, 22, 146, 23, 39, 40, 80, 81, 35, 36, 37, 38, 82, 83, 84, 42, 41, 85, 70, 87, 104, 68, 62, 69, 182, 67, 62, 67, 67, 60, 70, 147, 62, 143, 62, 157, 69, 182, 147, 62, 143, 111, 111, 111, 113, 113, 115, 115, 115, 117, 117, 117, 117, 117, 117, 119, 119, 119, 119, 122, 125, 128, 131, 134, 143, 143, 69, 68, 69, 69, 69, 68, 151, 96, 69, 70, 72, 72, 67, 22, 86, 159, 70, 87, 147, 106, 144, 117, 117, 117, 117, 117, 120, 120, 120, 120, 123, 126, 129, 132, 135, 144, 144, 147, 164, 69, 182, 59, 69, 70, 143, 68, 143, 143, 60, 90, 72, 158, 59, 69, 72, 67, 150, 147, 150, 59, 171, 150, 62, 72, 143, 143, 143, 147, 144, 22, 62, 164, 69, 67, 87, 59, 69, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 25, 26, 28, 29, 32, 43, 44, 51, 59, 61, 62, 63, 64, 65, 66, 68, 71, 74, 75, 76, 77, 87, 183, 186, 190, 191, 196, 198, 200, 204, 206, 207, 209, 211, 213, 215, 218, 221, 224, 227, 230, 233, 236, 239, 242, 246, 247, 248, 249, 252, 257, 258, 259, 260, 263, 264, 265, 266, 267, 273, 274, 275, 276, 277, 281, 59, 62, 69, 182, 183, 59, 143, 34, 69, 7, 172, 173, 174, 69, 69, 147, 159, 87, 150, 144, 164, 183, 59, 1, 62, 87, 68, 10, 14, 59, 62, 189, 190, 195, 197, 278, 62, 250, 62, 253, 254, 1, 62, 87, 62, 1, 87, 195, 197, 199, 203, 205, 207, 208, 210, 212, 214, 216, 219, 222, 225, 228, 231, 234, 237, 240, 244, 203, 208, 208, 68, 247, 68, 208, 68, 68, 244, 248, 1, 87, 208, 208, 60, 281, 67, 208, 208, 244, 70, 192, 193, 194, 208, 208, 208, 208, 60, 68, 71, 73, 201, 71, 73, 201, 43, 44, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 86, 243, 66, 78, 79, 74, 75, 45, 46, 47, 22, 23, 39, 40, 80, 81, 35, 36, 37, 38, 82, 83, 84, 42, 41, 85, 1, 70, 87, 247, 183, 59, 69, 60, 183, 150, 1, 87, 147, 8, 60, 175, 174, 151, 150, 69, 164, 69, 60, 183, 1, 87, 11, 203, 214, 217, 220, 223, 226, 229, 232, 235, 238, 241, 245, 262, 195, 197, 62, 68, 60, 61, 62, 63, 187, 188, 71, 73, 201, 86, 255, 1, 70, 87, 255, 1, 70, 87, 1, 87, 68, 201, 71, 73, 201, 43, 44, 243, 66, 78, 79, 74, 75, 45, 46, 47, 22, 23, 39, 40, 80, 81, 35, 36, 37, 38, 82, 83, 84, 42, 41, 85, 1, 70, 87, 244, 21, 244, 244, 244, 1, 87, 30, 31, 60, 247, 69, 70, 72, 72, 240, 70, 69, 202, 240, 244, 62, 244, 62, 240, 208, 208, 208, 210, 210, 212, 212, 212, 214, 214, 214, 214, 214, 214, 216, 216, 216, 216, 219, 222, 225, 228, 231, 240, 240, 60, 183, 59, 60, 67, 67, 172, 31, 150, 69, 150, 60, 62, 251, 22, 243, 23, 39, 40, 80, 81, 35, 36, 37, 38, 82, 83, 84, 42, 41, 85, 70, 87, 201, 68, 62, 69, 279, 67, 62, 67, 67, 60, 70, 244, 62, 240, 62, 254, 69, 279, 244, 62, 240, 208, 208, 208, 210, 210, 212, 212, 212, 214, 214, 214, 214, 214, 214, 216, 216, 216, 216, 219, 222, 225, 228, 231, 240, 240, 69, 68, 69, 69, 69, 68, 248, 193, 69, 70, 72, 72, 67, 60, 183, 185, 185, 60, 151, 150, 22, 86, 256, 70, 87, 244, 203, 241, 214, 214, 214, 214, 214, 217, 217, 217, 217, 220, 223, 226, 229, 232, 241, 241, 244, 261, 69, 279, 59, 69, 70, 240, 68, 240, 240, 60, 187, 72, 255, 59, 69, 72, 67, 247, 244, 247, 59, 268, 247, 62, 72, 240, 240, 240, 60, 244, 241, 22, 62, 261, 69, 67, 87, 59, 69, 280, 281, 59, 62, 69, 279, 280, 59, 240, 34, 69, 7, 269, 270, 271, 69, 69, 244, 256, 87, 247, 241, 261, 280, 59, 60, 280, 59, 69, 60, 280, 247, 1, 87, 244, 8, 60, 272, 271, 248, 247, 69, 261, 69, 60, 280, 60, 280, 59, 60, 67, 67, 269, 31, 247, 69, 247, 60, 60, 280, 281, 281, 60, 248, 247, 60 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) #else # define YYLEX yylex (&yylval, &yylloc) #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value, Location); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; YYLTYPE const * const yylocationp; #endif { if (!yyvaluep) return; YYUSE (yylocationp); # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep, yylocationp) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; YYLTYPE const * const yylocationp; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); YY_LOCATION_PRINT (yyoutput, *yylocationp); YYFPRINTF (yyoutput, ": "); yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) #else static void yy_stack_print (yybottom, yytop) yytype_int16 *yybottom; yytype_int16 *yytop; #endif { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) { int yybot = *yybottom; YYFPRINTF (stderr, " %d", yybot); } YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule) #else static void yy_reduce_print (yyvsp, yylsp, yyrule) YYSTYPE *yyvsp; YYLTYPE *yylsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { YYFPRINTF (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) , &(yylsp[(yyi + 1) - (yynrhs)]) ); YYFPRINTF (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, yylsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp) #else static void yydestruct (yymsg, yytype, yyvaluep, yylocationp) const char *yymsg; int yytype; YYSTYPE *yyvaluep; YYLTYPE *yylocationp; #endif { YYUSE (yyvaluep); YYUSE (yylocationp); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /*-------------------------. | yyparse or yypush_parse. | `-------------------------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { /* The lookahead symbol. */ int yychar; /* The semantic value of the lookahead symbol. */ YYSTYPE yylval; /* Location data for the lookahead symbol. */ YYLTYPE yylloc; /* Number of syntax errors so far. */ int yynerrs; int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: `yyss': related to states. `yyvs': related to semantic values. `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls; YYLTYPE *yylsp; /* The locations where the error started and ended. */ YYLTYPE yyerror_range[2]; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; YYLTYPE yyloc; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yytoken = 0; yyss = yyssa; yyvs = yyvsa; yyls = yylsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; yylsp = yyls; #if YYLTYPE_IS_TRIVIAL /* Initialize the default location before parsing starts. */ yylloc.first_line = yylloc.last_line = 1; yylloc.first_column = yylloc.last_column = 1; #endif goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; YYLTYPE *yyls1 = yyls; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); yyls = yyls1; yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); YYSTACK_RELOCATE (yyls_alloc, yyls); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; yylsp = yyls + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; *++yylsp = yylloc; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; /* Default location. */ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: /* Line 1455 of yacc.c */ #line 290 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new NullNode(GLOBAL_DATA), 0, 1); ;} break; case 3: /* Line 1455 of yacc.c */ #line 291 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new BooleanNode(GLOBAL_DATA, true), 0, 1); ;} break; case 4: /* Line 1455 of yacc.c */ #line 292 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new BooleanNode(GLOBAL_DATA, false), 0, 1); ;} break; case 5: /* Line 1455 of yacc.c */ #line 293 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeNumberNode(GLOBAL_DATA, (yyvsp[(1) - (1)].doubleValue)), 0, 1); ;} break; case 6: /* Line 1455 of yacc.c */ #line 294 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new StringNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)), 0, 1); ;} break; case 7: /* Line 1455 of yacc.c */ #line 295 "../../JavaScriptCore/parser/Grammar.y" { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; RegExpNode* node = new RegExpNode(GLOBAL_DATA, l.pattern(), l.flags()); int size = l.pattern().size() + 2; // + 2 for the two /'s SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (1)]).first_column, (yylsp[(1) - (1)]).first_column + size, (yylsp[(1) - (1)]).first_column + size); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, 0, 0); ;} break; case 8: /* Line 1455 of yacc.c */ #line 304 "../../JavaScriptCore/parser/Grammar.y" { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; RegExpNode* node = new RegExpNode(GLOBAL_DATA, "=" + l.pattern(), l.flags()); int size = l.pattern().size() + 2; // + 2 for the two /'s SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (1)]).first_column, (yylsp[(1) - (1)]).first_column + size, (yylsp[(1) - (1)]).first_column + size); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, 0, 0); ;} break; case 9: /* Line 1455 of yacc.c */ #line 316 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo<PropertyNode*>(new PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 10: /* Line 1455 of yacc.c */ #line 317 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo<PropertyNode*>(new PropertyNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 11: /* Line 1455 of yacc.c */ #line 318 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo<PropertyNode*>(new PropertyNode(GLOBAL_DATA, Identifier(GLOBAL_DATA, UString::from((yyvsp[(1) - (3)].doubleValue))), (yyvsp[(3) - (3)].expressionNode).m_node, PropertyNode::Constant), (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 12: /* Line 1455 of yacc.c */ #line 319 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (7)].ident), *(yyvsp[(2) - (7)].ident), 0, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); if (!(yyval.propertyNode).m_node) YYABORT; ;} break; case 13: /* Line 1455 of yacc.c */ #line 321 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyNode) = createNodeInfo<PropertyNode*>(makeGetterOrSetterPropertyNode(globalPtr, *(yyvsp[(1) - (8)].ident), *(yyvsp[(2) - (8)].ident), (yyvsp[(4) - (8)].parameterList).m_node.head, (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line)), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); if ((yyvsp[(4) - (8)].parameterList).m_features & ArgumentsFeature) (yyvsp[(7) - (8)].functionBodyNode)->setUsesArguments(); DBG((yyvsp[(7) - (8)].functionBodyNode), (yylsp[(6) - (8)]), (yylsp[(8) - (8)])); if (!(yyval.propertyNode).m_node) YYABORT; ;} break; case 14: /* Line 1455 of yacc.c */ #line 332 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyList).m_node.head = new PropertyListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].propertyNode).m_node); (yyval.propertyList).m_node.tail = (yyval.propertyList).m_node.head; (yyval.propertyList).m_features = (yyvsp[(1) - (1)].propertyNode).m_features; (yyval.propertyList).m_numConstants = (yyvsp[(1) - (1)].propertyNode).m_numConstants; ;} break; case 15: /* Line 1455 of yacc.c */ #line 336 "../../JavaScriptCore/parser/Grammar.y" { (yyval.propertyList).m_node.head = (yyvsp[(1) - (3)].propertyList).m_node.head; (yyval.propertyList).m_node.tail = new PropertyListNode(GLOBAL_DATA, (yyvsp[(3) - (3)].propertyNode).m_node, (yyvsp[(1) - (3)].propertyList).m_node.tail); (yyval.propertyList).m_features = (yyvsp[(1) - (3)].propertyList).m_features | (yyvsp[(3) - (3)].propertyNode).m_features; (yyval.propertyList).m_numConstants = (yyvsp[(1) - (3)].propertyList).m_numConstants + (yyvsp[(3) - (3)].propertyNode).m_numConstants; ;} break; case 17: /* Line 1455 of yacc.c */ #line 344 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ObjectLiteralNode(GLOBAL_DATA), 0, 0); ;} break; case 18: /* Line 1455 of yacc.c */ #line 345 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (3)].propertyList).m_node.head), (yyvsp[(2) - (3)].propertyList).m_features, (yyvsp[(2) - (3)].propertyList).m_numConstants); ;} break; case 19: /* Line 1455 of yacc.c */ #line 347 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ObjectLiteralNode(GLOBAL_DATA, (yyvsp[(2) - (4)].propertyList).m_node.head), (yyvsp[(2) - (4)].propertyList).m_features, (yyvsp[(2) - (4)].propertyList).m_numConstants); ;} break; case 20: /* Line 1455 of yacc.c */ #line 351 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ThisNode(GLOBAL_DATA), ThisFeature, 0); ;} break; case 23: /* Line 1455 of yacc.c */ #line 354 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), (yylsp[(1) - (1)]).first_column), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;} break; case 24: /* Line 1455 of yacc.c */ #line 355 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (3)].expressionNode); ;} break; case 25: /* Line 1455 of yacc.c */ #line 359 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].intValue)), 0, (yyvsp[(2) - (3)].intValue) ? 1 : 0); ;} break; case 26: /* Line 1455 of yacc.c */ #line 360 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ArrayNode(GLOBAL_DATA, (yyvsp[(2) - (3)].elementList).m_node.head), (yyvsp[(2) - (3)].elementList).m_features, (yyvsp[(2) - (3)].elementList).m_numConstants); ;} break; case 27: /* Line 1455 of yacc.c */ #line 361 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ArrayNode(GLOBAL_DATA, (yyvsp[(4) - (5)].intValue), (yyvsp[(2) - (5)].elementList).m_node.head), (yyvsp[(2) - (5)].elementList).m_features, (yyvsp[(4) - (5)].intValue) ? (yyvsp[(2) - (5)].elementList).m_numConstants + 1 : (yyvsp[(2) - (5)].elementList).m_numConstants); ;} break; case 28: /* Line 1455 of yacc.c */ #line 365 "../../JavaScriptCore/parser/Grammar.y" { (yyval.elementList).m_node.head = new ElementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].intValue), (yyvsp[(2) - (2)].expressionNode).m_node); (yyval.elementList).m_node.tail = (yyval.elementList).m_node.head; (yyval.elementList).m_features = (yyvsp[(2) - (2)].expressionNode).m_features; (yyval.elementList).m_numConstants = (yyvsp[(2) - (2)].expressionNode).m_numConstants; ;} break; case 29: /* Line 1455 of yacc.c */ #line 370 "../../JavaScriptCore/parser/Grammar.y" { (yyval.elementList).m_node.head = (yyvsp[(1) - (4)].elementList).m_node.head; (yyval.elementList).m_node.tail = new ElementNode(GLOBAL_DATA, (yyvsp[(1) - (4)].elementList).m_node.tail, (yyvsp[(3) - (4)].intValue), (yyvsp[(4) - (4)].expressionNode).m_node); (yyval.elementList).m_features = (yyvsp[(1) - (4)].elementList).m_features | (yyvsp[(4) - (4)].expressionNode).m_features; (yyval.elementList).m_numConstants = (yyvsp[(1) - (4)].elementList).m_numConstants + (yyvsp[(4) - (4)].expressionNode).m_numConstants; ;} break; case 30: /* Line 1455 of yacc.c */ #line 377 "../../JavaScriptCore/parser/Grammar.y" { (yyval.intValue) = 0; ;} break; case 32: /* Line 1455 of yacc.c */ #line 382 "../../JavaScriptCore/parser/Grammar.y" { (yyval.intValue) = 1; ;} break; case 33: /* Line 1455 of yacc.c */ #line 383 "../../JavaScriptCore/parser/Grammar.y" { (yyval.intValue) = (yyvsp[(1) - (2)].intValue) + 1; ;} break; case 35: /* Line 1455 of yacc.c */ #line 388 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>((yyvsp[(1) - (1)].funcExprNode).m_node, (yyvsp[(1) - (1)].funcExprNode).m_features, (yyvsp[(1) - (1)].funcExprNode).m_numConstants); ;} break; case 36: /* Line 1455 of yacc.c */ #line 389 "../../JavaScriptCore/parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (4)].expressionNode).m_features | (yyvsp[(3) - (4)].expressionNode).m_features, (yyvsp[(1) - (4)].expressionNode).m_numConstants + (yyvsp[(3) - (4)].expressionNode).m_numConstants); ;} break; case 37: /* Line 1455 of yacc.c */ #line 393 "../../JavaScriptCore/parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants); ;} break; case 38: /* Line 1455 of yacc.c */ #line 397 "../../JavaScriptCore/parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(2) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].argumentsNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].argumentsNode).m_numConstants); ;} break; case 40: /* Line 1455 of yacc.c */ #line 405 "../../JavaScriptCore/parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (4)].expressionNode).m_features | (yyvsp[(3) - (4)].expressionNode).m_features, (yyvsp[(1) - (4)].expressionNode).m_numConstants + (yyvsp[(3) - (4)].expressionNode).m_numConstants); ;} break; case 41: /* Line 1455 of yacc.c */ #line 409 "../../JavaScriptCore/parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants); ;} break; case 42: /* Line 1455 of yacc.c */ #line 413 "../../JavaScriptCore/parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].argumentsNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(2) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].argumentsNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].argumentsNode).m_numConstants); ;} break; case 44: /* Line 1455 of yacc.c */ #line 421 "../../JavaScriptCore/parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 46: /* Line 1455 of yacc.c */ #line 429 "../../JavaScriptCore/parser/Grammar.y" { NewExprNode* node = new NewExprNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 47: /* Line 1455 of yacc.c */ #line 436 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 48: /* Line 1455 of yacc.c */ #line 437 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 49: /* Line 1455 of yacc.c */ #line 438 "../../JavaScriptCore/parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (4)].expressionNode).m_features | (yyvsp[(3) - (4)].expressionNode).m_features, (yyvsp[(1) - (4)].expressionNode).m_numConstants + (yyvsp[(3) - (4)].expressionNode).m_numConstants); ;} break; case 50: /* Line 1455 of yacc.c */ #line 442 "../../JavaScriptCore/parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants); ;} break; case 51: /* Line 1455 of yacc.c */ #line 448 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 52: /* Line 1455 of yacc.c */ #line 449 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = makeFunctionCallNode(globalPtr, (yyvsp[(1) - (2)].expressionNode), (yyvsp[(2) - (2)].argumentsNode), (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column); ;} break; case 53: /* Line 1455 of yacc.c */ #line 450 "../../JavaScriptCore/parser/Grammar.y" { BracketAccessorNode* node = new BracketAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_node, (yyvsp[(3) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (4)]).first_column, (yylsp[(1) - (4)]).last_column, (yylsp[(4) - (4)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (4)].expressionNode).m_features | (yyvsp[(3) - (4)].expressionNode).m_features, (yyvsp[(1) - (4)].expressionNode).m_numConstants + (yyvsp[(3) - (4)].expressionNode).m_numConstants); ;} break; case 54: /* Line 1455 of yacc.c */ #line 454 "../../JavaScriptCore/parser/Grammar.y" { DotAccessorNode* node = new DotAccessorNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, *(yyvsp[(3) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(1) - (3)]).last_column, (yylsp[(3) - (3)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants); ;} break; case 55: /* Line 1455 of yacc.c */ #line 461 "../../JavaScriptCore/parser/Grammar.y" { (yyval.argumentsNode) = createNodeInfo<ArgumentsNode*>(new ArgumentsNode(GLOBAL_DATA), 0, 0); ;} break; case 56: /* Line 1455 of yacc.c */ #line 462 "../../JavaScriptCore/parser/Grammar.y" { (yyval.argumentsNode) = createNodeInfo<ArgumentsNode*>(new ArgumentsNode(GLOBAL_DATA, (yyvsp[(2) - (3)].argumentList).m_node.head), (yyvsp[(2) - (3)].argumentList).m_features, (yyvsp[(2) - (3)].argumentList).m_numConstants); ;} break; case 57: /* Line 1455 of yacc.c */ #line 466 "../../JavaScriptCore/parser/Grammar.y" { (yyval.argumentList).m_node.head = new ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].expressionNode).m_node); (yyval.argumentList).m_node.tail = (yyval.argumentList).m_node.head; (yyval.argumentList).m_features = (yyvsp[(1) - (1)].expressionNode).m_features; (yyval.argumentList).m_numConstants = (yyvsp[(1) - (1)].expressionNode).m_numConstants; ;} break; case 58: /* Line 1455 of yacc.c */ #line 470 "../../JavaScriptCore/parser/Grammar.y" { (yyval.argumentList).m_node.head = (yyvsp[(1) - (3)].argumentList).m_node.head; (yyval.argumentList).m_node.tail = new ArgumentListNode(GLOBAL_DATA, (yyvsp[(1) - (3)].argumentList).m_node.tail, (yyvsp[(3) - (3)].expressionNode).m_node); (yyval.argumentList).m_features = (yyvsp[(1) - (3)].argumentList).m_features | (yyvsp[(3) - (3)].expressionNode).m_features; (yyval.argumentList).m_numConstants = (yyvsp[(1) - (3)].argumentList).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants; ;} break; case 64: /* Line 1455 of yacc.c */ #line 488 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 65: /* Line 1455 of yacc.c */ #line 489 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 67: /* Line 1455 of yacc.c */ #line 494 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 68: /* Line 1455 of yacc.c */ #line 495 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePostfixNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(1) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (2)].expressionNode).m_numConstants); ;} break; case 69: /* Line 1455 of yacc.c */ #line 499 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeDeleteNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).last_column, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 70: /* Line 1455 of yacc.c */ #line 500 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new VoidNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants + 1); ;} break; case 71: /* Line 1455 of yacc.c */ #line 501 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeTypeOfNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 72: /* Line 1455 of yacc.c */ #line 502 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 73: /* Line 1455 of yacc.c */ #line 503 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpPlusPlus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 74: /* Line 1455 of yacc.c */ #line 504 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 75: /* Line 1455 of yacc.c */ #line 505 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makePrefixNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node, OpMinusMinus, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column), (yyvsp[(2) - (2)].expressionNode).m_features | AssignFeature, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 76: /* Line 1455 of yacc.c */ #line 506 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new UnaryPlusNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 77: /* Line 1455 of yacc.c */ #line 507 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeNegateNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 78: /* Line 1455 of yacc.c */ #line 508 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeBitwiseNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 79: /* Line 1455 of yacc.c */ #line 509 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LogicalNotNode(GLOBAL_DATA, (yyvsp[(2) - (2)].expressionNode).m_node), (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 85: /* Line 1455 of yacc.c */ #line 523 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 86: /* Line 1455 of yacc.c */ #line 524 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 87: /* Line 1455 of yacc.c */ #line 525 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 89: /* Line 1455 of yacc.c */ #line 531 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeMultNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 90: /* Line 1455 of yacc.c */ #line 533 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeDivNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 91: /* Line 1455 of yacc.c */ #line 535 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ModNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 93: /* Line 1455 of yacc.c */ #line 540 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 94: /* Line 1455 of yacc.c */ #line 541 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 96: /* Line 1455 of yacc.c */ #line 547 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAddNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 97: /* Line 1455 of yacc.c */ #line 549 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeSubNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 99: /* Line 1455 of yacc.c */ #line 554 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 100: /* Line 1455 of yacc.c */ #line 555 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 101: /* Line 1455 of yacc.c */ #line 556 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 103: /* Line 1455 of yacc.c */ #line 561 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeLeftShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 104: /* Line 1455 of yacc.c */ #line 562 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 105: /* Line 1455 of yacc.c */ #line 563 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new UnsignedRightShiftNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 107: /* Line 1455 of yacc.c */ #line 568 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 108: /* Line 1455 of yacc.c */ #line 569 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 109: /* Line 1455 of yacc.c */ #line 570 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 110: /* Line 1455 of yacc.c */ #line 571 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 111: /* Line 1455 of yacc.c */ #line 572 "../../JavaScriptCore/parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 112: /* Line 1455 of yacc.c */ #line 575 "../../JavaScriptCore/parser/Grammar.y" { InNode* node = new InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 114: /* Line 1455 of yacc.c */ #line 582 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 115: /* Line 1455 of yacc.c */ #line 583 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 116: /* Line 1455 of yacc.c */ #line 584 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 117: /* Line 1455 of yacc.c */ #line 585 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 118: /* Line 1455 of yacc.c */ #line 587 "../../JavaScriptCore/parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 120: /* Line 1455 of yacc.c */ #line 594 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LessNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 121: /* Line 1455 of yacc.c */ #line 595 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new GreaterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 122: /* Line 1455 of yacc.c */ #line 596 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LessEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 123: /* Line 1455 of yacc.c */ #line 597 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new GreaterEqNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 124: /* Line 1455 of yacc.c */ #line 599 "../../JavaScriptCore/parser/Grammar.y" { InstanceOfNode* node = new InstanceOfNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 125: /* Line 1455 of yacc.c */ #line 603 "../../JavaScriptCore/parser/Grammar.y" { InNode* node = new InNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(3) - (3)]).first_column, (yylsp[(3) - (3)]).last_column); (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(node, (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 127: /* Line 1455 of yacc.c */ #line 610 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 128: /* Line 1455 of yacc.c */ #line 611 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 129: /* Line 1455 of yacc.c */ #line 612 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 130: /* Line 1455 of yacc.c */ #line 613 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 132: /* Line 1455 of yacc.c */ #line 619 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 133: /* Line 1455 of yacc.c */ #line 621 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 134: /* Line 1455 of yacc.c */ #line 623 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 135: /* Line 1455 of yacc.c */ #line 625 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 137: /* Line 1455 of yacc.c */ #line 631 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new EqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 138: /* Line 1455 of yacc.c */ #line 632 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new NotEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 139: /* Line 1455 of yacc.c */ #line 634 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new StrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 140: /* Line 1455 of yacc.c */ #line 636 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new NotStrictEqualNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 142: /* Line 1455 of yacc.c */ #line 641 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 144: /* Line 1455 of yacc.c */ #line 647 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 146: /* Line 1455 of yacc.c */ #line 652 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new BitAndNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 148: /* Line 1455 of yacc.c */ #line 657 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 150: /* Line 1455 of yacc.c */ #line 663 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 152: /* Line 1455 of yacc.c */ #line 669 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new BitXOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 154: /* Line 1455 of yacc.c */ #line 674 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 156: /* Line 1455 of yacc.c */ #line 680 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 158: /* Line 1455 of yacc.c */ #line 686 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new BitOrNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 160: /* Line 1455 of yacc.c */ #line 691 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 162: /* Line 1455 of yacc.c */ #line 697 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 164: /* Line 1455 of yacc.c */ #line 703 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalAnd), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 166: /* Line 1455 of yacc.c */ #line 708 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 168: /* Line 1455 of yacc.c */ #line 714 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 170: /* Line 1455 of yacc.c */ #line 719 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new LogicalOpNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node, OpLogicalOr), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 172: /* Line 1455 of yacc.c */ #line 725 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 174: /* Line 1455 of yacc.c */ #line 731 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 176: /* Line 1455 of yacc.c */ #line 737 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new ConditionalNode(GLOBAL_DATA, (yyvsp[(1) - (5)].expressionNode).m_node, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].expressionNode).m_node), (yyvsp[(1) - (5)].expressionNode).m_features | (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].expressionNode).m_features, (yyvsp[(1) - (5)].expressionNode).m_numConstants + (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].expressionNode).m_numConstants); ;} break; case 178: /* Line 1455 of yacc.c */ #line 743 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 180: /* Line 1455 of yacc.c */ #line 751 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 182: /* Line 1455 of yacc.c */ #line 759 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(makeAssignNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(2) - (3)].op), (yyvsp[(3) - (3)].expressionNode).m_node, (yyvsp[(1) - (3)].expressionNode).m_features & AssignFeature, (yyvsp[(3) - (3)].expressionNode).m_features & AssignFeature, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).first_column + 1, (yylsp[(3) - (3)]).last_column), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features | AssignFeature, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 183: /* Line 1455 of yacc.c */ #line 765 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpEqual; ;} break; case 184: /* Line 1455 of yacc.c */ #line 766 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpPlusEq; ;} break; case 185: /* Line 1455 of yacc.c */ #line 767 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpMinusEq; ;} break; case 186: /* Line 1455 of yacc.c */ #line 768 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpMultEq; ;} break; case 187: /* Line 1455 of yacc.c */ #line 769 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpDivEq; ;} break; case 188: /* Line 1455 of yacc.c */ #line 770 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpLShift; ;} break; case 189: /* Line 1455 of yacc.c */ #line 771 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpRShift; ;} break; case 190: /* Line 1455 of yacc.c */ #line 772 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpURShift; ;} break; case 191: /* Line 1455 of yacc.c */ #line 773 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpAndEq; ;} break; case 192: /* Line 1455 of yacc.c */ #line 774 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpXOrEq; ;} break; case 193: /* Line 1455 of yacc.c */ #line 775 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpOrEq; ;} break; case 194: /* Line 1455 of yacc.c */ #line 776 "../../JavaScriptCore/parser/Grammar.y" { (yyval.op) = OpModEq; ;} break; case 196: /* Line 1455 of yacc.c */ #line 781 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 198: /* Line 1455 of yacc.c */ #line 786 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 200: /* Line 1455 of yacc.c */ #line 791 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(new CommaNode(GLOBAL_DATA, (yyvsp[(1) - (3)].expressionNode).m_node, (yyvsp[(3) - (3)].expressionNode).m_node), (yyvsp[(1) - (3)].expressionNode).m_features | (yyvsp[(3) - (3)].expressionNode).m_features, (yyvsp[(1) - (3)].expressionNode).m_numConstants + (yyvsp[(3) - (3)].expressionNode).m_numConstants); ;} break; case 218: /* Line 1455 of yacc.c */ #line 815 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new BlockNode(GLOBAL_DATA, 0), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 219: /* Line 1455 of yacc.c */ #line 817 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new BlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].sourceElements).m_node), (yyvsp[(2) - (3)].sourceElements).m_varDeclarations, (yyvsp[(2) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (3)].sourceElements).m_features, (yyvsp[(2) - (3)].sourceElements).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 220: /* Line 1455 of yacc.c */ #line 822 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 221: /* Line 1455 of yacc.c */ #line 824 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(makeVarStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].varDeclList).m_node), (yyvsp[(2) - (3)].varDeclList).m_varDeclarations, (yyvsp[(2) - (3)].varDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].varDeclList).m_features, (yyvsp[(2) - (3)].varDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;} break; case 222: /* Line 1455 of yacc.c */ #line 830 "../../JavaScriptCore/parser/Grammar.y" { (yyval.varDeclList).m_node = 0; (yyval.varDeclList).m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA); appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(1) - (1)].ident), 0); (yyval.varDeclList).m_funcDeclarations = 0; (yyval.varDeclList).m_features = (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0; (yyval.varDeclList).m_numConstants = 0; ;} break; case 223: /* Line 1455 of yacc.c */ #line 837 "../../JavaScriptCore/parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column); (yyval.varDeclList).m_node = node; (yyval.varDeclList).m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA); appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(1) - (2)].ident), DeclarationStacks::HasInitializer); (yyval.varDeclList).m_funcDeclarations = 0; (yyval.varDeclList).m_features = ((*(yyvsp[(1) - (2)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(2) - (2)].expressionNode).m_features; (yyval.varDeclList).m_numConstants = (yyvsp[(2) - (2)].expressionNode).m_numConstants; ;} break; case 224: /* Line 1455 of yacc.c */ #line 847 "../../JavaScriptCore/parser/Grammar.y" { (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node; (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations; appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(3) - (3)].ident), 0); (yyval.varDeclList).m_funcDeclarations = 0; (yyval.varDeclList).m_features = (yyvsp[(1) - (3)].varDeclList).m_features | ((*(yyvsp[(3) - (3)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0); (yyval.varDeclList).m_numConstants = (yyvsp[(1) - (3)].varDeclList).m_numConstants; ;} break; case 225: /* Line 1455 of yacc.c */ #line 855 "../../JavaScriptCore/parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column); (yyval.varDeclList).m_node = combineVarInitializers(GLOBAL_DATA, (yyvsp[(1) - (4)].varDeclList).m_node, node); (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (4)].varDeclList).m_varDeclarations; appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(3) - (4)].ident), DeclarationStacks::HasInitializer); (yyval.varDeclList).m_funcDeclarations = 0; (yyval.varDeclList).m_features = (yyvsp[(1) - (4)].varDeclList).m_features | ((*(yyvsp[(3) - (4)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(4) - (4)].expressionNode).m_features; (yyval.varDeclList).m_numConstants = (yyvsp[(1) - (4)].varDeclList).m_numConstants + (yyvsp[(4) - (4)].expressionNode).m_numConstants; ;} break; case 226: /* Line 1455 of yacc.c */ #line 867 "../../JavaScriptCore/parser/Grammar.y" { (yyval.varDeclList).m_node = 0; (yyval.varDeclList).m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA); appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(1) - (1)].ident), 0); (yyval.varDeclList).m_funcDeclarations = 0; (yyval.varDeclList).m_features = (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0; (yyval.varDeclList).m_numConstants = 0; ;} break; case 227: /* Line 1455 of yacc.c */ #line 874 "../../JavaScriptCore/parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node, (yyvsp[(2) - (2)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(2) - (2)]).first_column + 1, (yylsp[(2) - (2)]).last_column); (yyval.varDeclList).m_node = node; (yyval.varDeclList).m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA); appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(1) - (2)].ident), DeclarationStacks::HasInitializer); (yyval.varDeclList).m_funcDeclarations = 0; (yyval.varDeclList).m_features = ((*(yyvsp[(1) - (2)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(2) - (2)].expressionNode).m_features; (yyval.varDeclList).m_numConstants = (yyvsp[(2) - (2)].expressionNode).m_numConstants; ;} break; case 228: /* Line 1455 of yacc.c */ #line 884 "../../JavaScriptCore/parser/Grammar.y" { (yyval.varDeclList).m_node = (yyvsp[(1) - (3)].varDeclList).m_node; (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (3)].varDeclList).m_varDeclarations; appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(3) - (3)].ident), 0); (yyval.varDeclList).m_funcDeclarations = 0; (yyval.varDeclList).m_features = (yyvsp[(1) - (3)].varDeclList).m_features | ((*(yyvsp[(3) - (3)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0); (yyval.varDeclList).m_numConstants = (yyvsp[(1) - (3)].varDeclList).m_numConstants; ;} break; case 229: /* Line 1455 of yacc.c */ #line 892 "../../JavaScriptCore/parser/Grammar.y" { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, *(yyvsp[(3) - (4)].ident), (yyvsp[(4) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].expressionNode).m_features & AssignFeature); SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (4)]).first_column, (yylsp[(4) - (4)]).first_column + 1, (yylsp[(4) - (4)]).last_column); (yyval.varDeclList).m_node = combineVarInitializers(GLOBAL_DATA, (yyvsp[(1) - (4)].varDeclList).m_node, node); (yyval.varDeclList).m_varDeclarations = (yyvsp[(1) - (4)].varDeclList).m_varDeclarations; appendToVarDeclarationList(GLOBAL_DATA, (yyval.varDeclList).m_varDeclarations, *(yyvsp[(3) - (4)].ident), DeclarationStacks::HasInitializer); (yyval.varDeclList).m_funcDeclarations = 0; (yyval.varDeclList).m_features = (yyvsp[(1) - (4)].varDeclList).m_features | ((*(yyvsp[(3) - (4)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(4) - (4)].expressionNode).m_features; (yyval.varDeclList).m_numConstants = (yyvsp[(1) - (4)].varDeclList).m_numConstants + (yyvsp[(4) - (4)].expressionNode).m_numConstants; ;} break; case 230: /* Line 1455 of yacc.c */ #line 904 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 231: /* Line 1455 of yacc.c */ #line 907 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new ConstStatementNode(GLOBAL_DATA, (yyvsp[(2) - (3)].constDeclList).m_node.head), (yyvsp[(2) - (3)].constDeclList).m_varDeclarations, (yyvsp[(2) - (3)].constDeclList).m_funcDeclarations, (yyvsp[(2) - (3)].constDeclList).m_features, (yyvsp[(2) - (3)].constDeclList).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;} break; case 232: /* Line 1455 of yacc.c */ #line 912 "../../JavaScriptCore/parser/Grammar.y" { (yyval.constDeclList).m_node.head = (yyvsp[(1) - (1)].constDeclNode).m_node; (yyval.constDeclList).m_node.tail = (yyval.constDeclList).m_node.head; (yyval.constDeclList).m_varDeclarations = new ParserRefCountedData<DeclarationStacks::VarStack>(GLOBAL_DATA); appendToVarDeclarationList(GLOBAL_DATA, (yyval.constDeclList).m_varDeclarations, (yyvsp[(1) - (1)].constDeclNode).m_node); (yyval.constDeclList).m_funcDeclarations = 0; (yyval.constDeclList).m_features = (yyvsp[(1) - (1)].constDeclNode).m_features; (yyval.constDeclList).m_numConstants = (yyvsp[(1) - (1)].constDeclNode).m_numConstants; ;} break; case 233: /* Line 1455 of yacc.c */ #line 921 "../../JavaScriptCore/parser/Grammar.y" { (yyval.constDeclList).m_node.head = (yyvsp[(1) - (3)].constDeclList).m_node.head; (yyvsp[(1) - (3)].constDeclList).m_node.tail->m_next = (yyvsp[(3) - (3)].constDeclNode).m_node; (yyval.constDeclList).m_node.tail = (yyvsp[(3) - (3)].constDeclNode).m_node; (yyval.constDeclList).m_varDeclarations = (yyvsp[(1) - (3)].constDeclList).m_varDeclarations; appendToVarDeclarationList(GLOBAL_DATA, (yyval.constDeclList).m_varDeclarations, (yyvsp[(3) - (3)].constDeclNode).m_node); (yyval.constDeclList).m_funcDeclarations = 0; (yyval.constDeclList).m_features = (yyvsp[(1) - (3)].constDeclList).m_features | (yyvsp[(3) - (3)].constDeclNode).m_features; (yyval.constDeclList).m_numConstants = (yyvsp[(1) - (3)].constDeclList).m_numConstants + (yyvsp[(3) - (3)].constDeclNode).m_numConstants; ;} break; case 234: /* Line 1455 of yacc.c */ #line 932 "../../JavaScriptCore/parser/Grammar.y" { (yyval.constDeclNode) = createNodeInfo<ConstDeclNode*>(new ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident), 0), (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0, 0); ;} break; case 235: /* Line 1455 of yacc.c */ #line 933 "../../JavaScriptCore/parser/Grammar.y" { (yyval.constDeclNode) = createNodeInfo<ConstDeclNode*>(new ConstDeclNode(GLOBAL_DATA, *(yyvsp[(1) - (2)].ident), (yyvsp[(2) - (2)].expressionNode).m_node), ((*(yyvsp[(1) - (2)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(2) - (2)].expressionNode).m_features, (yyvsp[(2) - (2)].expressionNode).m_numConstants); ;} break; case 236: /* Line 1455 of yacc.c */ #line 937 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;} break; case 237: /* Line 1455 of yacc.c */ #line 941 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = (yyvsp[(2) - (2)].expressionNode); ;} break; case 238: /* Line 1455 of yacc.c */ #line 945 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new EmptyStatementNode(GLOBAL_DATA), 0, 0, 0, 0); ;} break; case 239: /* Line 1455 of yacc.c */ #line 949 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 240: /* Line 1455 of yacc.c */ #line 951 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new ExprStatementNode(GLOBAL_DATA, (yyvsp[(1) - (2)].expressionNode).m_node), 0, 0, (yyvsp[(1) - (2)].expressionNode).m_features, (yyvsp[(1) - (2)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 241: /* Line 1455 of yacc.c */ #line 957 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new IfNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;} break; case 242: /* Line 1455 of yacc.c */ #line 960 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new IfElseNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].statementNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node), mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations), mergeDeclarationLists((yyvsp[(5) - (7)].statementNode).m_funcDeclarations, (yyvsp[(7) - (7)].statementNode).m_funcDeclarations), (yyvsp[(3) - (7)].expressionNode).m_features | (yyvsp[(5) - (7)].statementNode).m_features | (yyvsp[(7) - (7)].statementNode).m_features, (yyvsp[(3) - (7)].expressionNode).m_numConstants + (yyvsp[(5) - (7)].statementNode).m_numConstants + (yyvsp[(7) - (7)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(4) - (7)])); ;} break; case 243: /* Line 1455 of yacc.c */ #line 968 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;} break; case 244: /* Line 1455 of yacc.c */ #line 970 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new DoWhileNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node), (yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(3) - (7)])); ;} break; case 245: /* Line 1455 of yacc.c */ #line 972 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new WhileNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;} break; case 246: /* Line 1455 of yacc.c */ #line 975 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new ForNode(GLOBAL_DATA, (yyvsp[(3) - (9)].expressionNode).m_node, (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, false), (yyvsp[(9) - (9)].statementNode).m_varDeclarations, (yyvsp[(9) - (9)].statementNode).m_funcDeclarations, (yyvsp[(3) - (9)].expressionNode).m_features | (yyvsp[(5) - (9)].expressionNode).m_features | (yyvsp[(7) - (9)].expressionNode).m_features | (yyvsp[(9) - (9)].statementNode).m_features, (yyvsp[(3) - (9)].expressionNode).m_numConstants + (yyvsp[(5) - (9)].expressionNode).m_numConstants + (yyvsp[(7) - (9)].expressionNode).m_numConstants + (yyvsp[(9) - (9)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (9)]), (yylsp[(8) - (9)])); ;} break; case 247: /* Line 1455 of yacc.c */ #line 981 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new ForNode(GLOBAL_DATA, (yyvsp[(4) - (10)].varDeclList).m_node, (yyvsp[(6) - (10)].expressionNode).m_node, (yyvsp[(8) - (10)].expressionNode).m_node, (yyvsp[(10) - (10)].statementNode).m_node, true), mergeDeclarationLists((yyvsp[(4) - (10)].varDeclList).m_varDeclarations, (yyvsp[(10) - (10)].statementNode).m_varDeclarations), mergeDeclarationLists((yyvsp[(4) - (10)].varDeclList).m_funcDeclarations, (yyvsp[(10) - (10)].statementNode).m_funcDeclarations), (yyvsp[(4) - (10)].varDeclList).m_features | (yyvsp[(6) - (10)].expressionNode).m_features | (yyvsp[(8) - (10)].expressionNode).m_features | (yyvsp[(10) - (10)].statementNode).m_features, (yyvsp[(4) - (10)].varDeclList).m_numConstants + (yyvsp[(6) - (10)].expressionNode).m_numConstants + (yyvsp[(8) - (10)].expressionNode).m_numConstants + (yyvsp[(10) - (10)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (10)]), (yylsp[(9) - (10)])); ;} break; case 248: /* Line 1455 of yacc.c */ #line 988 "../../JavaScriptCore/parser/Grammar.y" { ForInNode* node = new ForInNode(GLOBAL_DATA, (yyvsp[(3) - (7)].expressionNode).m_node, (yyvsp[(5) - (7)].expressionNode).m_node, (yyvsp[(7) - (7)].statementNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(3) - (7)]).first_column, (yylsp[(3) - (7)]).last_column, (yylsp[(5) - (7)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, (yyvsp[(7) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_funcDeclarations, (yyvsp[(3) - (7)].expressionNode).m_features | (yyvsp[(5) - (7)].expressionNode).m_features | (yyvsp[(7) - (7)].statementNode).m_features, (yyvsp[(3) - (7)].expressionNode).m_numConstants + (yyvsp[(5) - (7)].expressionNode).m_numConstants + (yyvsp[(7) - (7)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(6) - (7)])); ;} break; case 249: /* Line 1455 of yacc.c */ #line 997 "../../JavaScriptCore/parser/Grammar.y" { ForInNode *forIn = new ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (8)].ident), 0, (yyvsp[(6) - (8)].expressionNode).m_node, (yyvsp[(8) - (8)].statementNode).m_node, (yylsp[(5) - (8)]).first_column, (yylsp[(5) - (8)]).first_column - (yylsp[(4) - (8)]).first_column, (yylsp[(6) - (8)]).last_column - (yylsp[(5) - (8)]).first_column); SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (8)]).first_column, (yylsp[(5) - (8)]).first_column + 1, (yylsp[(6) - (8)]).last_column); appendToVarDeclarationList(GLOBAL_DATA, (yyvsp[(8) - (8)].statementNode).m_varDeclarations, *(yyvsp[(4) - (8)].ident), DeclarationStacks::HasInitializer); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(forIn, (yyvsp[(8) - (8)].statementNode).m_varDeclarations, (yyvsp[(8) - (8)].statementNode).m_funcDeclarations, ((*(yyvsp[(4) - (8)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(6) - (8)].expressionNode).m_features | (yyvsp[(8) - (8)].statementNode).m_features, (yyvsp[(6) - (8)].expressionNode).m_numConstants + (yyvsp[(8) - (8)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (8)]), (yylsp[(7) - (8)])); ;} break; case 250: /* Line 1455 of yacc.c */ #line 1003 "../../JavaScriptCore/parser/Grammar.y" { ForInNode *forIn = new ForInNode(GLOBAL_DATA, *(yyvsp[(4) - (9)].ident), (yyvsp[(5) - (9)].expressionNode).m_node, (yyvsp[(7) - (9)].expressionNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node, (yylsp[(5) - (9)]).first_column, (yylsp[(5) - (9)]).first_column - (yylsp[(4) - (9)]).first_column, (yylsp[(5) - (9)]).last_column - (yylsp[(5) - (9)]).first_column); SET_EXCEPTION_LOCATION(forIn, (yylsp[(4) - (9)]).first_column, (yylsp[(6) - (9)]).first_column + 1, (yylsp[(7) - (9)]).last_column); appendToVarDeclarationList(GLOBAL_DATA, (yyvsp[(9) - (9)].statementNode).m_varDeclarations, *(yyvsp[(4) - (9)].ident), DeclarationStacks::HasInitializer); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(forIn, (yyvsp[(9) - (9)].statementNode).m_varDeclarations, (yyvsp[(9) - (9)].statementNode).m_funcDeclarations, ((*(yyvsp[(4) - (9)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(5) - (9)].expressionNode).m_features | (yyvsp[(7) - (9)].expressionNode).m_features | (yyvsp[(9) - (9)].statementNode).m_features, (yyvsp[(5) - (9)].expressionNode).m_numConstants + (yyvsp[(7) - (9)].expressionNode).m_numConstants + (yyvsp[(9) - (9)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (9)]), (yylsp[(8) - (9)])); ;} break; case 251: /* Line 1455 of yacc.c */ #line 1013 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(0, 0, 0); ;} break; case 253: /* Line 1455 of yacc.c */ #line 1018 "../../JavaScriptCore/parser/Grammar.y" { (yyval.expressionNode) = createNodeInfo<ExpressionNode*>(0, 0, 0); ;} break; case 255: /* Line 1455 of yacc.c */ #line 1023 "../../JavaScriptCore/parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 256: /* Line 1455 of yacc.c */ #line 1027 "../../JavaScriptCore/parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 257: /* Line 1455 of yacc.c */ #line 1031 "../../JavaScriptCore/parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 258: /* Line 1455 of yacc.c */ #line 1035 "../../JavaScriptCore/parser/Grammar.y" { ContinueNode* node = new ContinueNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;} break; case 259: /* Line 1455 of yacc.c */ #line 1042 "../../JavaScriptCore/parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 260: /* Line 1455 of yacc.c */ #line 1045 "../../JavaScriptCore/parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new BreakNode(GLOBAL_DATA), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 261: /* Line 1455 of yacc.c */ #line 1048 "../../JavaScriptCore/parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 262: /* Line 1455 of yacc.c */ #line 1051 "../../JavaScriptCore/parser/Grammar.y" { BreakNode* node = new BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new BreakNode(GLOBAL_DATA, *(yyvsp[(2) - (3)].ident)), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;} break; case 263: /* Line 1455 of yacc.c */ #line 1057 "../../JavaScriptCore/parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 264: /* Line 1455 of yacc.c */ #line 1060 "../../JavaScriptCore/parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, 0); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (2)]).first_column, (yylsp[(1) - (2)]).last_column, (yylsp[(1) - (2)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 265: /* Line 1455 of yacc.c */ #line 1063 "../../JavaScriptCore/parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(3) - (3)])); ;} break; case 266: /* Line 1455 of yacc.c */ #line 1066 "../../JavaScriptCore/parser/Grammar.y" { ReturnNode* node = new ReturnNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;} break; case 267: /* Line 1455 of yacc.c */ #line 1072 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new WithNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].statementNode).m_node, (yylsp[(3) - (5)]).last_column, (yylsp[(3) - (5)]).last_column - (yylsp[(3) - (5)]).first_column), (yyvsp[(5) - (5)].statementNode).m_varDeclarations, (yyvsp[(5) - (5)].statementNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].statementNode).m_features | WithFeature, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;} break; case 268: /* Line 1455 of yacc.c */ #line 1078 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new SwitchNode(GLOBAL_DATA, (yyvsp[(3) - (5)].expressionNode).m_node, (yyvsp[(5) - (5)].caseBlockNode).m_node), (yyvsp[(5) - (5)].caseBlockNode).m_varDeclarations, (yyvsp[(5) - (5)].caseBlockNode).m_funcDeclarations, (yyvsp[(3) - (5)].expressionNode).m_features | (yyvsp[(5) - (5)].caseBlockNode).m_features, (yyvsp[(3) - (5)].expressionNode).m_numConstants + (yyvsp[(5) - (5)].caseBlockNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (5)]), (yylsp[(4) - (5)])); ;} break; case 269: /* Line 1455 of yacc.c */ #line 1084 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseBlockNode) = createNodeDeclarationInfo<CaseBlockNode*>(new CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (3)].clauseList).m_node.head, 0, 0), (yyvsp[(2) - (3)].clauseList).m_varDeclarations, (yyvsp[(2) - (3)].clauseList).m_funcDeclarations, (yyvsp[(2) - (3)].clauseList).m_features, (yyvsp[(2) - (3)].clauseList).m_numConstants); ;} break; case 270: /* Line 1455 of yacc.c */ #line 1086 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseBlockNode) = createNodeDeclarationInfo<CaseBlockNode*>(new CaseBlockNode(GLOBAL_DATA, (yyvsp[(2) - (5)].clauseList).m_node.head, (yyvsp[(3) - (5)].caseClauseNode).m_node, (yyvsp[(4) - (5)].clauseList).m_node.head), mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (5)].clauseList).m_varDeclarations, (yyvsp[(3) - (5)].caseClauseNode).m_varDeclarations), (yyvsp[(4) - (5)].clauseList).m_varDeclarations), mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (5)].clauseList).m_funcDeclarations, (yyvsp[(3) - (5)].caseClauseNode).m_funcDeclarations), (yyvsp[(4) - (5)].clauseList).m_funcDeclarations), (yyvsp[(2) - (5)].clauseList).m_features | (yyvsp[(3) - (5)].caseClauseNode).m_features | (yyvsp[(4) - (5)].clauseList).m_features, (yyvsp[(2) - (5)].clauseList).m_numConstants + (yyvsp[(3) - (5)].caseClauseNode).m_numConstants + (yyvsp[(4) - (5)].clauseList).m_numConstants); ;} break; case 271: /* Line 1455 of yacc.c */ #line 1094 "../../JavaScriptCore/parser/Grammar.y" { (yyval.clauseList).m_node.head = 0; (yyval.clauseList).m_node.tail = 0; (yyval.clauseList).m_varDeclarations = 0; (yyval.clauseList).m_funcDeclarations = 0; (yyval.clauseList).m_features = 0; (yyval.clauseList).m_numConstants = 0; ;} break; case 273: /* Line 1455 of yacc.c */ #line 1099 "../../JavaScriptCore/parser/Grammar.y" { (yyval.clauseList).m_node.head = new ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (1)].caseClauseNode).m_node); (yyval.clauseList).m_node.tail = (yyval.clauseList).m_node.head; (yyval.clauseList).m_varDeclarations = (yyvsp[(1) - (1)].caseClauseNode).m_varDeclarations; (yyval.clauseList).m_funcDeclarations = (yyvsp[(1) - (1)].caseClauseNode).m_funcDeclarations; (yyval.clauseList).m_features = (yyvsp[(1) - (1)].caseClauseNode).m_features; (yyval.clauseList).m_numConstants = (yyvsp[(1) - (1)].caseClauseNode).m_numConstants; ;} break; case 274: /* Line 1455 of yacc.c */ #line 1105 "../../JavaScriptCore/parser/Grammar.y" { (yyval.clauseList).m_node.head = (yyvsp[(1) - (2)].clauseList).m_node.head; (yyval.clauseList).m_node.tail = new ClauseListNode(GLOBAL_DATA, (yyvsp[(1) - (2)].clauseList).m_node.tail, (yyvsp[(2) - (2)].caseClauseNode).m_node); (yyval.clauseList).m_varDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].clauseList).m_varDeclarations, (yyvsp[(2) - (2)].caseClauseNode).m_varDeclarations); (yyval.clauseList).m_funcDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].clauseList).m_funcDeclarations, (yyvsp[(2) - (2)].caseClauseNode).m_funcDeclarations); (yyval.clauseList).m_features = (yyvsp[(1) - (2)].clauseList).m_features | (yyvsp[(2) - (2)].caseClauseNode).m_features; (yyval.clauseList).m_numConstants = (yyvsp[(1) - (2)].clauseList).m_numConstants + (yyvsp[(2) - (2)].caseClauseNode).m_numConstants; ;} break; case 275: /* Line 1455 of yacc.c */ #line 1115 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node), 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); ;} break; case 276: /* Line 1455 of yacc.c */ #line 1116 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new CaseClauseNode(GLOBAL_DATA, (yyvsp[(2) - (4)].expressionNode).m_node, (yyvsp[(4) - (4)].sourceElements).m_node), (yyvsp[(4) - (4)].sourceElements).m_varDeclarations, (yyvsp[(4) - (4)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (4)].expressionNode).m_features | (yyvsp[(4) - (4)].sourceElements).m_features, (yyvsp[(2) - (4)].expressionNode).m_numConstants + (yyvsp[(4) - (4)].sourceElements).m_numConstants); ;} break; case 277: /* Line 1455 of yacc.c */ #line 1120 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new CaseClauseNode(GLOBAL_DATA, 0), 0, 0, 0, 0); ;} break; case 278: /* Line 1455 of yacc.c */ #line 1121 "../../JavaScriptCore/parser/Grammar.y" { (yyval.caseClauseNode) = createNodeDeclarationInfo<CaseClauseNode*>(new CaseClauseNode(GLOBAL_DATA, 0, (yyvsp[(3) - (3)].sourceElements).m_node), (yyvsp[(3) - (3)].sourceElements).m_varDeclarations, (yyvsp[(3) - (3)].sourceElements).m_funcDeclarations, (yyvsp[(3) - (3)].sourceElements).m_features, (yyvsp[(3) - (3)].sourceElements).m_numConstants); ;} break; case 279: /* Line 1455 of yacc.c */ #line 1125 "../../JavaScriptCore/parser/Grammar.y" { LabelNode* node = new LabelNode(GLOBAL_DATA, *(yyvsp[(1) - (3)].ident), (yyvsp[(3) - (3)].statementNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, (yyvsp[(3) - (3)].statementNode).m_varDeclarations, (yyvsp[(3) - (3)].statementNode).m_funcDeclarations, (yyvsp[(3) - (3)].statementNode).m_features, (yyvsp[(3) - (3)].statementNode).m_numConstants); ;} break; case 280: /* Line 1455 of yacc.c */ #line 1131 "../../JavaScriptCore/parser/Grammar.y" { ThrowNode* node = new ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); ;} break; case 281: /* Line 1455 of yacc.c */ #line 1135 "../../JavaScriptCore/parser/Grammar.y" { ThrowNode* node = new ThrowNode(GLOBAL_DATA, (yyvsp[(2) - (3)].expressionNode).m_node); SET_EXCEPTION_LOCATION(node, (yylsp[(1) - (3)]).first_column, (yylsp[(2) - (3)]).last_column, (yylsp[(2) - (3)]).last_column); (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(node, 0, 0, (yyvsp[(2) - (3)].expressionNode).m_features, (yyvsp[(2) - (3)].expressionNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (3)]), (yylsp[(2) - (3)])); AUTO_SEMICOLON; ;} break; case 282: /* Line 1455 of yacc.c */ #line 1142 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (4)].statementNode).m_node, GLOBAL_DATA->propertyNames->nullIdentifier, false, 0, (yyvsp[(4) - (4)].statementNode).m_node), mergeDeclarationLists((yyvsp[(2) - (4)].statementNode).m_varDeclarations, (yyvsp[(4) - (4)].statementNode).m_varDeclarations), mergeDeclarationLists((yyvsp[(2) - (4)].statementNode).m_funcDeclarations, (yyvsp[(4) - (4)].statementNode).m_funcDeclarations), (yyvsp[(2) - (4)].statementNode).m_features | (yyvsp[(4) - (4)].statementNode).m_features, (yyvsp[(2) - (4)].statementNode).m_numConstants + (yyvsp[(4) - (4)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (4)]), (yylsp[(2) - (4)])); ;} break; case 283: /* Line 1455 of yacc.c */ #line 1148 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (7)].statementNode).m_node, *(yyvsp[(5) - (7)].ident), ((yyvsp[(7) - (7)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (7)].statementNode).m_node, 0), mergeDeclarationLists((yyvsp[(2) - (7)].statementNode).m_varDeclarations, (yyvsp[(7) - (7)].statementNode).m_varDeclarations), mergeDeclarationLists((yyvsp[(2) - (7)].statementNode).m_funcDeclarations, (yyvsp[(7) - (7)].statementNode).m_funcDeclarations), (yyvsp[(2) - (7)].statementNode).m_features | (yyvsp[(7) - (7)].statementNode).m_features | CatchFeature, (yyvsp[(2) - (7)].statementNode).m_numConstants + (yyvsp[(7) - (7)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (7)]), (yylsp[(2) - (7)])); ;} break; case 284: /* Line 1455 of yacc.c */ #line 1155 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new TryNode(GLOBAL_DATA, (yyvsp[(2) - (9)].statementNode).m_node, *(yyvsp[(5) - (9)].ident), ((yyvsp[(7) - (9)].statementNode).m_features & EvalFeature) != 0, (yyvsp[(7) - (9)].statementNode).m_node, (yyvsp[(9) - (9)].statementNode).m_node), mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (9)].statementNode).m_varDeclarations, (yyvsp[(7) - (9)].statementNode).m_varDeclarations), (yyvsp[(9) - (9)].statementNode).m_varDeclarations), mergeDeclarationLists(mergeDeclarationLists((yyvsp[(2) - (9)].statementNode).m_funcDeclarations, (yyvsp[(7) - (9)].statementNode).m_funcDeclarations), (yyvsp[(9) - (9)].statementNode).m_funcDeclarations), (yyvsp[(2) - (9)].statementNode).m_features | (yyvsp[(7) - (9)].statementNode).m_features | (yyvsp[(9) - (9)].statementNode).m_features | CatchFeature, (yyvsp[(2) - (9)].statementNode).m_numConstants + (yyvsp[(7) - (9)].statementNode).m_numConstants + (yyvsp[(9) - (9)].statementNode).m_numConstants); DBG((yyval.statementNode).m_node, (yylsp[(1) - (9)]), (yylsp[(2) - (9)])); ;} break; case 285: /* Line 1455 of yacc.c */ #line 1164 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(2) - (2)])); ;} break; case 286: /* Line 1455 of yacc.c */ #line 1166 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new DebuggerStatementNode(GLOBAL_DATA), 0, 0, 0, 0); DBG((yyval.statementNode).m_node, (yylsp[(1) - (2)]), (yylsp[(1) - (2)])); AUTO_SEMICOLON; ;} break; case 287: /* Line 1455 of yacc.c */ #line 1171 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), 0, new ParserRefCountedData<DeclarationStacks::FunctionStack>(GLOBAL_DATA), ((*(yyvsp[(2) - (7)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); (yyval.statementNode).m_funcDeclarations->data.append(static_cast<FuncDeclNode*>((yyval.statementNode).m_node)); ;} break; case 288: /* Line 1455 of yacc.c */ #line 1173 "../../JavaScriptCore/parser/Grammar.y" { (yyval.statementNode) = createNodeDeclarationInfo<StatementNode*>(new FuncDeclNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), 0, new ParserRefCountedData<DeclarationStacks::FunctionStack>(GLOBAL_DATA), ((*(yyvsp[(2) - (8)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0) | (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); if ((yyvsp[(4) - (8)].parameterList).m_features & ArgumentsFeature) (yyvsp[(7) - (8)].functionBodyNode)->setUsesArguments(); DBG((yyvsp[(7) - (8)].functionBodyNode), (yylsp[(6) - (8)]), (yylsp[(8) - (8)])); (yyval.statementNode).m_funcDeclarations->data.append(static_cast<FuncDeclNode*>((yyval.statementNode).m_node)); ;} break; case 289: /* Line 1455 of yacc.c */ #line 1183 "../../JavaScriptCore/parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(5) - (6)].functionBodyNode), LEXER->sourceCode((yyvsp[(4) - (6)].intValue), (yyvsp[(6) - (6)].intValue), (yylsp[(4) - (6)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(5) - (6)].functionBodyNode), (yylsp[(4) - (6)]), (yylsp[(6) - (6)])); ;} break; case 290: /* Line 1455 of yacc.c */ #line 1185 "../../JavaScriptCore/parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line), (yyvsp[(3) - (7)].parameterList).m_node.head), (yyvsp[(3) - (7)].parameterList).m_features | ClosureFeature, 0); if ((yyvsp[(3) - (7)].parameterList).m_features & ArgumentsFeature) (yyvsp[(6) - (7)].functionBodyNode)->setUsesArguments(); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); ;} break; case 291: /* Line 1455 of yacc.c */ #line 1191 "../../JavaScriptCore/parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (7)].ident), (yyvsp[(6) - (7)].functionBodyNode), LEXER->sourceCode((yyvsp[(5) - (7)].intValue), (yyvsp[(7) - (7)].intValue), (yylsp[(5) - (7)]).first_line)), ClosureFeature, 0); DBG((yyvsp[(6) - (7)].functionBodyNode), (yylsp[(5) - (7)]), (yylsp[(7) - (7)])); ;} break; case 292: /* Line 1455 of yacc.c */ #line 1193 "../../JavaScriptCore/parser/Grammar.y" { (yyval.funcExprNode) = createNodeInfo(new FuncExprNode(GLOBAL_DATA, *(yyvsp[(2) - (8)].ident), (yyvsp[(7) - (8)].functionBodyNode), LEXER->sourceCode((yyvsp[(6) - (8)].intValue), (yyvsp[(8) - (8)].intValue), (yylsp[(6) - (8)]).first_line), (yyvsp[(4) - (8)].parameterList).m_node.head), (yyvsp[(4) - (8)].parameterList).m_features | ClosureFeature, 0); if ((yyvsp[(4) - (8)].parameterList).m_features & ArgumentsFeature) (yyvsp[(7) - (8)].functionBodyNode)->setUsesArguments(); DBG((yyvsp[(7) - (8)].functionBodyNode), (yylsp[(6) - (8)]), (yylsp[(8) - (8)])); ;} break; case 293: /* Line 1455 of yacc.c */ #line 1202 "../../JavaScriptCore/parser/Grammar.y" { (yyval.parameterList).m_node.head = new ParameterNode(GLOBAL_DATA, *(yyvsp[(1) - (1)].ident)); (yyval.parameterList).m_features = (*(yyvsp[(1) - (1)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0; (yyval.parameterList).m_node.tail = (yyval.parameterList).m_node.head; ;} break; case 294: /* Line 1455 of yacc.c */ #line 1205 "../../JavaScriptCore/parser/Grammar.y" { (yyval.parameterList).m_node.head = (yyvsp[(1) - (3)].parameterList).m_node.head; (yyval.parameterList).m_features = (yyvsp[(1) - (3)].parameterList).m_features | ((*(yyvsp[(3) - (3)].ident) == GLOBAL_DATA->propertyNames->arguments) ? ArgumentsFeature : 0); (yyval.parameterList).m_node.tail = new ParameterNode(GLOBAL_DATA, (yyvsp[(1) - (3)].parameterList).m_node.tail, *(yyvsp[(3) - (3)].ident)); ;} break; case 295: /* Line 1455 of yacc.c */ #line 1211 "../../JavaScriptCore/parser/Grammar.y" { (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;} break; case 296: /* Line 1455 of yacc.c */ #line 1212 "../../JavaScriptCore/parser/Grammar.y" { (yyval.functionBodyNode) = FunctionBodyNode::create(GLOBAL_DATA); ;} break; case 297: /* Line 1455 of yacc.c */ #line 1216 "../../JavaScriptCore/parser/Grammar.y" { GLOBAL_DATA->parser->didFinishParsing(new SourceElements(GLOBAL_DATA), 0, 0, NoFeatures, (yylsp[(0) - (0)]).last_line, 0); ;} break; case 298: /* Line 1455 of yacc.c */ #line 1217 "../../JavaScriptCore/parser/Grammar.y" { GLOBAL_DATA->parser->didFinishParsing((yyvsp[(1) - (1)].sourceElements).m_node, (yyvsp[(1) - (1)].sourceElements).m_varDeclarations, (yyvsp[(1) - (1)].sourceElements).m_funcDeclarations, (yyvsp[(1) - (1)].sourceElements).m_features, (yylsp[(1) - (1)]).last_line, (yyvsp[(1) - (1)].sourceElements).m_numConstants); ;} break; case 299: /* Line 1455 of yacc.c */ #line 1222 "../../JavaScriptCore/parser/Grammar.y" { (yyval.sourceElements).m_node = new SourceElements(GLOBAL_DATA); (yyval.sourceElements).m_node->append((yyvsp[(1) - (1)].statementNode).m_node); (yyval.sourceElements).m_varDeclarations = (yyvsp[(1) - (1)].statementNode).m_varDeclarations; (yyval.sourceElements).m_funcDeclarations = (yyvsp[(1) - (1)].statementNode).m_funcDeclarations; (yyval.sourceElements).m_features = (yyvsp[(1) - (1)].statementNode).m_features; (yyval.sourceElements).m_numConstants = (yyvsp[(1) - (1)].statementNode).m_numConstants; ;} break; case 300: /* Line 1455 of yacc.c */ #line 1229 "../../JavaScriptCore/parser/Grammar.y" { (yyval.sourceElements).m_node->append((yyvsp[(2) - (2)].statementNode).m_node); (yyval.sourceElements).m_varDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].sourceElements).m_varDeclarations, (yyvsp[(2) - (2)].statementNode).m_varDeclarations); (yyval.sourceElements).m_funcDeclarations = mergeDeclarationLists((yyvsp[(1) - (2)].sourceElements).m_funcDeclarations, (yyvsp[(2) - (2)].statementNode).m_funcDeclarations); (yyval.sourceElements).m_features = (yyvsp[(1) - (2)].sourceElements).m_features | (yyvsp[(2) - (2)].statementNode).m_features; (yyval.sourceElements).m_numConstants = (yyvsp[(1) - (2)].sourceElements).m_numConstants + (yyvsp[(2) - (2)].statementNode).m_numConstants; ;} break; case 304: /* Line 1455 of yacc.c */ #line 1243 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 305: /* Line 1455 of yacc.c */ #line 1244 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 306: /* Line 1455 of yacc.c */ #line 1245 "../../JavaScriptCore/parser/Grammar.y" { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;} break; case 307: /* Line 1455 of yacc.c */ #line 1246 "../../JavaScriptCore/parser/Grammar.y" { Lexer& l = *LEXER; if (!l.scanRegExp()) YYABORT; ;} break; case 308: /* Line 1455 of yacc.c */ #line 1250 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 309: /* Line 1455 of yacc.c */ #line 1251 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 310: /* Line 1455 of yacc.c */ #line 1252 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 311: /* Line 1455 of yacc.c */ #line 1253 "../../JavaScriptCore/parser/Grammar.y" { if (*(yyvsp[(1) - (7)].ident) != "get" && *(yyvsp[(1) - (7)].ident) != "set") YYABORT; ;} break; case 312: /* Line 1455 of yacc.c */ #line 1254 "../../JavaScriptCore/parser/Grammar.y" { if (*(yyvsp[(1) - (8)].ident) != "get" && *(yyvsp[(1) - (8)].ident) != "set") YYABORT; ;} break; case 316: /* Line 1455 of yacc.c */ #line 1264 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 317: /* Line 1455 of yacc.c */ #line 1265 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 318: /* Line 1455 of yacc.c */ #line 1267 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 322: /* Line 1455 of yacc.c */ #line 1274 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 517: /* Line 1455 of yacc.c */ #line 1642 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 518: /* Line 1455 of yacc.c */ #line 1643 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 520: /* Line 1455 of yacc.c */ #line 1648 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 521: /* Line 1455 of yacc.c */ #line 1652 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 522: /* Line 1455 of yacc.c */ #line 1653 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 525: /* Line 1455 of yacc.c */ #line 1659 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 526: /* Line 1455 of yacc.c */ #line 1660 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 530: /* Line 1455 of yacc.c */ #line 1667 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 533: /* Line 1455 of yacc.c */ #line 1676 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 534: /* Line 1455 of yacc.c */ #line 1677 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 539: /* Line 1455 of yacc.c */ #line 1694 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 555: /* Line 1455 of yacc.c */ #line 1725 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 557: /* Line 1455 of yacc.c */ #line 1727 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 559: /* Line 1455 of yacc.c */ #line 1732 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 561: /* Line 1455 of yacc.c */ #line 1734 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 563: /* Line 1455 of yacc.c */ #line 1739 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 565: /* Line 1455 of yacc.c */ #line 1741 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 568: /* Line 1455 of yacc.c */ #line 1753 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 569: /* Line 1455 of yacc.c */ #line 1754 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 578: /* Line 1455 of yacc.c */ #line 1778 "../../JavaScriptCore/parser/Grammar.y" { ;} break; case 580: /* Line 1455 of yacc.c */ #line 1783 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 585: /* Line 1455 of yacc.c */ #line 1794 "../../JavaScriptCore/parser/Grammar.y" { AUTO_SEMICOLON; ;} break; case 592: /* Line 1455 of yacc.c */ #line 1810 "../../JavaScriptCore/parser/Grammar.y" { ;} break; /* Line 1455 of yacc.c */ #line 5110 "Grammar.tab.c" default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; *++yylsp = yyloc; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } yyerror_range[0] = yylloc; if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval, &yylloc); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; yyerror_range[0] = yylsp[1-yylen]; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yyerror_range[0] = *yylsp; yydestruct ("Error: popping", yystos[yystate], yyvsp, yylsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } *++yyvsp = yylval; yyerror_range[1] = yylloc; /* Using YYLLOC is tempting, but would change the location of the lookahead. YYLOC is available though. */ YYLLOC_DEFAULT (yyloc, (yyerror_range - 1), 2); *++yylsp = yyloc; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval, &yylloc); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp, yylsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } /* Line 1675 of yacc.c */ #line 1826 "../../JavaScriptCore/parser/Grammar.y" static ExpressionNode* makeAssignNode(void* globalPtr, ExpressionNode* loc, Operator op, ExpressionNode* expr, bool locHasAssignments, bool exprHasAssignments, int start, int divot, int end) { if (!loc->isLocation()) return new AssignErrorNode(GLOBAL_DATA, loc, op, expr, divot, divot - start, end - divot); if (loc->isResolveNode()) { ResolveNode* resolve = static_cast<ResolveNode*>(loc); if (op == OpEqual) { AssignResolveNode* node = new AssignResolveNode(GLOBAL_DATA, resolve->identifier(), expr, exprHasAssignments); SET_EXCEPTION_LOCATION(node, start, divot, end); return node; } else return new ReadModifyResolveNode(GLOBAL_DATA, resolve->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot); } if (loc->isBracketAccessorNode()) { BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(loc); if (op == OpEqual) return new AssignBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), expr, locHasAssignments, exprHasAssignments, bracket->divot(), bracket->divot() - start, end - bracket->divot()); else { ReadModifyBracketNode* node = new ReadModifyBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, expr, locHasAssignments, exprHasAssignments, divot, divot - start, end - divot); node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); return node; } } ASSERT(loc->isDotAccessorNode()); DotAccessorNode* dot = static_cast<DotAccessorNode*>(loc); if (op == OpEqual) return new AssignDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), expr, exprHasAssignments, dot->divot(), dot->divot() - start, end - dot->divot()); ReadModifyDotNode* node = new ReadModifyDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, expr, exprHasAssignments, divot, divot - start, end - divot); node->setSubexpressionInfo(dot->divot(), dot->endOffset()); return node; } static ExpressionNode* makePrefixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end) { if (!expr->isLocation()) return new PrefixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot); if (expr->isResolveNode()) { ResolveNode* resolve = static_cast<ResolveNode*>(expr); return new PrefixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot); } if (expr->isBracketAccessorNode()) { BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr); PrefixBracketNode* node = new PrefixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot); node->setSubexpressionInfo(bracket->divot(), bracket->startOffset()); return node; } ASSERT(expr->isDotAccessorNode()); DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr); PrefixDotNode* node = new PrefixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot); node->setSubexpressionInfo(dot->divot(), dot->startOffset()); return node; } static ExpressionNode* makePostfixNode(void* globalPtr, ExpressionNode* expr, Operator op, int start, int divot, int end) { if (!expr->isLocation()) return new PostfixErrorNode(GLOBAL_DATA, expr, op, divot, divot - start, end - divot); if (expr->isResolveNode()) { ResolveNode* resolve = static_cast<ResolveNode*>(expr); return new PostfixResolveNode(GLOBAL_DATA, resolve->identifier(), op, divot, divot - start, end - divot); } if (expr->isBracketAccessorNode()) { BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr); PostfixBracketNode* node = new PostfixBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), op, divot, divot - start, end - divot); node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); return node; } ASSERT(expr->isDotAccessorNode()); DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr); PostfixDotNode* node = new PostfixDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), op, divot, divot - start, end - divot); node->setSubexpressionInfo(dot->divot(), dot->endOffset()); return node; } static ExpressionNodeInfo makeFunctionCallNode(void* globalPtr, ExpressionNodeInfo func, ArgumentsNodeInfo args, int start, int divot, int end) { CodeFeatures features = func.m_features | args.m_features; int numConstants = func.m_numConstants + args.m_numConstants; if (!func.m_node->isLocation()) return createNodeInfo<ExpressionNode*>(new FunctionCallValueNode(GLOBAL_DATA, func.m_node, args.m_node, divot, divot - start, end - divot), features, numConstants); if (func.m_node->isResolveNode()) { ResolveNode* resolve = static_cast<ResolveNode*>(func.m_node); const Identifier& identifier = resolve->identifier(); if (identifier == GLOBAL_DATA->propertyNames->eval) return createNodeInfo<ExpressionNode*>(new EvalFunctionCallNode(GLOBAL_DATA, args.m_node, divot, divot - start, end - divot), EvalFeature | features, numConstants); return createNodeInfo<ExpressionNode*>(new FunctionCallResolveNode(GLOBAL_DATA, identifier, args.m_node, divot, divot - start, end - divot), features, numConstants); } if (func.m_node->isBracketAccessorNode()) { BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(func.m_node); FunctionCallBracketNode* node = new FunctionCallBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), args.m_node, divot, divot - start, end - divot); node->setSubexpressionInfo(bracket->divot(), bracket->endOffset()); return createNodeInfo<ExpressionNode*>(node, features, numConstants); } ASSERT(func.m_node->isDotAccessorNode()); DotAccessorNode* dot = static_cast<DotAccessorNode*>(func.m_node); FunctionCallDotNode* node = new FunctionCallDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), args.m_node, divot, divot - start, end - divot); node->setSubexpressionInfo(dot->divot(), dot->endOffset()); return createNodeInfo<ExpressionNode*>(node, features, numConstants); } static ExpressionNode* makeTypeOfNode(void* globalPtr, ExpressionNode* expr) { if (expr->isResolveNode()) { ResolveNode* resolve = static_cast<ResolveNode*>(expr); return new TypeOfResolveNode(GLOBAL_DATA, resolve->identifier()); } return new TypeOfValueNode(GLOBAL_DATA, expr); } static ExpressionNode* makeDeleteNode(void* globalPtr, ExpressionNode* expr, int start, int divot, int end) { if (!expr->isLocation()) return new DeleteValueNode(GLOBAL_DATA, expr); if (expr->isResolveNode()) { ResolveNode* resolve = static_cast<ResolveNode*>(expr); return new DeleteResolveNode(GLOBAL_DATA, resolve->identifier(), divot, divot - start, end - divot); } if (expr->isBracketAccessorNode()) { BracketAccessorNode* bracket = static_cast<BracketAccessorNode*>(expr); return new DeleteBracketNode(GLOBAL_DATA, bracket->base(), bracket->subscript(), divot, divot - start, end - divot); } ASSERT(expr->isDotAccessorNode()); DotAccessorNode* dot = static_cast<DotAccessorNode*>(expr); return new DeleteDotNode(GLOBAL_DATA, dot->base(), dot->identifier(), divot, divot - start, end - divot); } static PropertyNode* makeGetterOrSetterPropertyNode(void* globalPtr, const Identifier& getOrSet, const Identifier& name, ParameterNode* params, FunctionBodyNode* body, const SourceCode& source) { PropertyNode::Type type; if (getOrSet == "get") type = PropertyNode::Getter; else if (getOrSet == "set") type = PropertyNode::Setter; else return 0; return new PropertyNode(GLOBAL_DATA, name, new FuncExprNode(GLOBAL_DATA, GLOBAL_DATA->propertyNames->nullIdentifier, body, source, params), type); } static ExpressionNode* makeNegateNode(void* globalPtr, ExpressionNode* n) { if (n->isNumber()) { NumberNode* number = static_cast<NumberNode*>(n); if (number->value() > 0.0) { number->setValue(-number->value()); return number; } } return new NegateNode(GLOBAL_DATA, n); } static NumberNode* makeNumberNode(void* globalPtr, double d) { return new NumberNode(GLOBAL_DATA, d); } static ExpressionNode* makeBitwiseNotNode(void* globalPtr, ExpressionNode* expr) { if (expr->isNumber()) return makeNumberNode(globalPtr, ~toInt32(static_cast<NumberNode*>(expr)->value())); return new BitwiseNotNode(GLOBAL_DATA, expr); } static ExpressionNode* makeMultNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) { expr1 = expr1->stripUnaryPlus(); expr2 = expr2->stripUnaryPlus(); if (expr1->isNumber() && expr2->isNumber()) return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() * static_cast<NumberNode*>(expr2)->value()); if (expr1->isNumber() && static_cast<NumberNode*>(expr1)->value() == 1) return new UnaryPlusNode(GLOBAL_DATA, expr2); if (expr2->isNumber() && static_cast<NumberNode*>(expr2)->value() == 1) return new UnaryPlusNode(GLOBAL_DATA, expr1); return new MultNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); } static ExpressionNode* makeDivNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) { expr1 = expr1->stripUnaryPlus(); expr2 = expr2->stripUnaryPlus(); if (expr1->isNumber() && expr2->isNumber()) return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() / static_cast<NumberNode*>(expr2)->value()); return new DivNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); } static ExpressionNode* makeAddNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) { if (expr1->isNumber() && expr2->isNumber()) return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() + static_cast<NumberNode*>(expr2)->value()); return new AddNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); } static ExpressionNode* makeSubNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) { expr1 = expr1->stripUnaryPlus(); expr2 = expr2->stripUnaryPlus(); if (expr1->isNumber() && expr2->isNumber()) return makeNumberNode(globalPtr, static_cast<NumberNode*>(expr1)->value() - static_cast<NumberNode*>(expr2)->value()); return new SubNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); } static ExpressionNode* makeLeftShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) { if (expr1->isNumber() && expr2->isNumber()) return makeNumberNode(globalPtr, toInt32(static_cast<NumberNode*>(expr1)->value()) << (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); return new LeftShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); } static ExpressionNode* makeRightShiftNode(void* globalPtr, ExpressionNode* expr1, ExpressionNode* expr2, bool rightHasAssignments) { if (expr1->isNumber() && expr2->isNumber()) return makeNumberNode(globalPtr, toInt32(static_cast<NumberNode*>(expr1)->value()) >> (toUInt32(static_cast<NumberNode*>(expr2)->value()) & 0x1f)); return new RightShiftNode(GLOBAL_DATA, expr1, expr2, rightHasAssignments); } /* called by yyparse on error */ int yyerror(const char *) { return 1; } /* may we automatically insert a semicolon ? */ static bool allowAutomaticSemicolon(Lexer& lexer, int yychar) { return yychar == CLOSEBRACE || yychar == 0 || lexer.prevTerminator(); } static ExpressionNode* combineVarInitializers(void* globalPtr, ExpressionNode* list, AssignResolveNode* init) { if (!list) return init; return new VarDeclCommaNode(GLOBAL_DATA, list, init); } // We turn variable declarations into either assignments or empty // statements (which later get stripped out), because the actual // declaration work is hoisted up to the start of the function body static StatementNode* makeVarStatementNode(void* globalPtr, ExpressionNode* expr) { if (!expr) return new EmptyStatementNode(GLOBAL_DATA); return new VarStatementNode(GLOBAL_DATA, expr); } #undef GLOBAL_DATA
RLovelett/qt
src/3rdparty/webkit/WebCore/generated/Grammar.cpp
C++
lgpl-2.1
296,109
object = {__bases__: [], __name__: 'object'} object.__mro__ = [object] type = {__bases__: [object], __mro__: [object], __name__: 'type'} object.__metaclass__ = type __ARGUMENTS_PADDING__ = {ARGUMENTS_PADDING: "YES IT IS!"} def __is__(me, other): return (me is other) __is__.is_method = True object.__is__ = __is__ def __isnot__(me, other): return not (me is other) __isnot__.is_method = True object.__isnot__ = __isnot__ def mro(me): if me is object: raw = me.__mro__ elif me.__class__: raw = me.__class__.__mro__ else: raw = me.__mro__ l = pythonium_call(tuple) l.jsobject = raw.slice() return l mro.is_method = True object.mro = mro def __hash__(me): uid = lookup(me, 'uid') if not uid: uid = object._uid object._uid += 1 me.__uid__ = uid return pythonium_call(str, '{' + uid) __hash__.is_method = True object._uid = 1 object.__hash__ = __hash__ def __rcontains__(me, other): contains = lookup(other, '__contains__') return contains(me) __rcontains__.is_method = True object.__rcontains__ = __rcontains__ def issubclass(klass, other): if klass is other: return __TRUE if not klass.__bases__: return __FALSE for base in klass.__bases__: if issubclass(base, other) is __TRUE: return __TRUE return __FALSE def pythonium_is_true(v): if v is False: return False if v is True: return True if v is None: return False if v is __NONE: return False if v is __FALSE: return False if isinstance(v, int) or isinstance(v, float): if v.jsobject == 0: return False length = lookup(v, '__len__') if length and length().jsobject == 0: return False return True def isinstance(obj, klass): if obj.__class__: return issubclass(obj.__class__, klass) return __FALSE def pythonium_obj_to_js_exception(obj): def exception(): this.exception = obj return exception def pythonium_is_exception(obj, exc): if obj is exc: return True return isinstance(obj, exc) def pythonium_call(obj): args = Array.prototype.slice.call(arguments, 1) if obj.__metaclass__: instance = {__class__: obj} init = lookup(instance, '__init__') if init: init.apply(instance, args) return instance else: return obj.apply(None, args) def pythonium_create_empty_dict(): instance = {__class__: dict} instance._keys = pythonium_call(list) instance.jsobject = JSObject() return instance def pythonium_mro(bases): """Calculate the Method Resolution Order of bases using the C3 algorithm. Suppose you intended creating a class K with the given base classes. This function returns the MRO which K would have, *excluding* K itself (since it doesn't yet exist), as if you had actually created the class. Another way of looking at this, if you pass a single class K, this will return the linearization of K (the MRO of K, *including* itself). """ # based on http://code.activestate.com/recipes/577748-calculate-the-mro-of-a-class/ seqs = [C.__mro__.slice() for C in bases] seqs.push(bases.slice()) def cdr(l): l = l.slice() l = l.splice(1) return l def contains(l, c): for i in l: if i is c: return True return False res = [] while True: non_empty = [] for seq in seqs: out = [] for item in seq: if item: out.push(item) if out.length != 0: non_empty.push(out) if non_empty.length == 0: # Nothing left to process, we're done. return res for seq in non_empty: # Find merge candidates among seq heads. candidate = seq[0] not_head = [] for s in non_empty: if contains(cdr(s), candidate): not_head.push(s) if not_head.length != 0: candidate = None else: break if not candidate: raise TypeError("Inconsistent hierarchy, no C3 MRO is possible") res.push(candidate) for seq in non_empty: # Remove candidate. if seq[0] is candidate: seq[0] = None seqs = non_empty def pythonium_create_class(name, bases, attrs): attrs.__name__ = name attrs.__metaclass__ = type attrs.__bases__ = bases mro = pythonium_mro(bases) mro.splice(0, 0, attrs) attrs.__mro__ = mro return attrs def lookup(obj, attr): obj_attr = obj[attr] if obj_attr != None: if obj_attr and {}.toString.call(obj_attr) == '[object Function]' and obj_attr.is_method and not obj_attr.bound: def method_wrapper(): args = Array.prototype.slice.call(arguments) args.splice(0, 0, obj) return obj_attr.apply(None, args) method_wrapper.bound = True return method_wrapper return obj_attr else: if obj.__class__: __mro__ = obj.__class__.__mro__ elif obj.__metaclass__: __mro__ = obj.__metaclass__.__mro__ else: # it's a function return None for base in __mro__: class_attr = base[attr] if class_attr != None: if {}.toString.call(class_attr) == '[object Function]' and class_attr.is_method and not class_attr.bound: def method_wrapper(): args = Array.prototype.slice.call(arguments) args.splice(0, 0, obj) return class_attr.apply(None, args) method_wrapper.bound = True return method_wrapper return class_attr def pythonium_object_get_attribute(obj, attr): r = lookup(obj, attr) if r != None: return r else: getattr = lookup(obj, '__getattr__') if getattr: return getattr(attr) else: console.trace('AttributeError', attr, obj) raise AttributeError pythonium_object_get_attribute.is_method = True object.__getattribute__ = pythonium_object_get_attribute def pythonium_get_attribute(obj, attr): if obj.__class__ or obj.__metaclass__: getattribute = lookup(obj, '__getattribute__') r = getattribute(attr) return r attr = obj[attr] if attr: if {}.toString.call(attr) == '[object Function]': def method_wrapper(): return attr.apply(obj, arguments) return method_wrapper else: return attr def pythonium_set_attribute(obj, attr, value): obj[attr] = value def ASSERT(condition, message): if not condition: raise message or pythonium_call(str, 'Assertion failed')
skariel/pythonium
pythonium/compliant/runtime.py
Python
lgpl-2.1
7,045
// Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // // Copyright (c) 2007, 2008 Novell, Inc. // // Authors: // Andreia Gaita (avidigal@novell.com) // using System; using System.Text; using System.Runtime.InteropServices; using System.Collections; using System.Collections.Specialized; using Mono.WebBrowser.DOM; namespace Mono.WebBrowser { public interface IWebBrowser { /// <summary> /// Initialize a browser instance. /// </summary> /// <param name="handle"> /// A <see cref="IntPtr"/> to the native window handle of the widget /// where the browser engine will draw /// </param> /// <param name="width"> /// A <see cref="System.Int32"/>. Initial width /// </param> /// <param name="height"> /// A <see cref="System.Int32"/>. Initial height /// </param> /// <returns> /// A <see cref="System.Boolean"/> /// </returns> bool Load (IntPtr handle, int width, int height); void Shutdown (); void FocusIn (FocusOption focus); void FocusOut (); void Activate (); void Deactivate (); void Resize (int width, int height); void Render (byte[] data); void Render (string html); void Render (string html, string uri, string contentType); void ExecuteScript (string script); bool Initialized { get; } IWindow Window { get; } IDocument Document { get; } bool Offline {get; set;} /// <value> /// Object exposing navigation methods like Go, Back, etc. /// </value> INavigation Navigation { get; } event NodeEventHandler KeyDown; event NodeEventHandler KeyPress; event NodeEventHandler KeyUp; event NodeEventHandler MouseClick; event NodeEventHandler MouseDoubleClick; event NodeEventHandler MouseDown; event NodeEventHandler MouseEnter; event NodeEventHandler MouseLeave; event NodeEventHandler MouseMove; event NodeEventHandler MouseUp; event EventHandler Focus; event CreateNewWindowEventHandler CreateNewWindow; event AlertEventHandler Alert; event LoadStartedEventHandler LoadStarted; event LoadCommitedEventHandler LoadCommited; event ProgressChangedEventHandler ProgressChanged; event LoadFinishedEventHandler LoadFinished; event StatusChangedEventHandler StatusChanged; event SecurityChangedEventHandler SecurityChanged; event ContextMenuEventHandler ContextMenuShown; event NavigationRequestedEventHandler NavigationRequested; } public enum ReloadOption : uint { None = 0, Proxy = 1, Full = 2 } public enum FocusOption { None = 0, FocusFirstElement = 1, FocusLastElement = 2 } [Flags] public enum DialogButtonFlags { BUTTON_POS_0 = 1, BUTTON_POS_1 = 256, BUTTON_POS_2 = 65536, BUTTON_TITLE_OK = 1, BUTTON_TITLE_CANCEL = 2, BUTTON_TITLE_YES = 3, BUTTON_TITLE_NO = 4, BUTTON_TITLE_SAVE = 5, BUTTON_TITLE_DONT_SAVE = 6, BUTTON_TITLE_REVERT = 7, BUTTON_TITLE_IS_STRING = 127, BUTTON_POS_0_DEFAULT = 0, BUTTON_POS_1_DEFAULT = 16777216, BUTTON_POS_2_DEFAULT = 33554432, BUTTON_DELAY_ENABLE = 67108864, STD_OK_CANCEL_BUTTONS = 513 } public enum DialogType { Alert = 1, AlertCheck = 2, Confirm = 3, ConfirmEx = 4, ConfirmCheck = 5, Prompt = 6, PromptUsernamePassword = 7, PromptPassword = 8, Select = 9 } public enum Platform { Unknown = 0, Winforms = 1, Gtk = 2 } public enum SecurityLevel { Insecure= 1, Mixed = 2, Secure = 3 } #region Window Events public delegate bool CreateNewWindowEventHandler (object sender, CreateNewWindowEventArgs e); public class CreateNewWindowEventArgs : EventArgs { private bool isModal; #region Public Constructors public CreateNewWindowEventArgs (bool isModal) : base () { this.isModal = isModal; } #endregion // Public Constructors #region Public Instance Properties public bool IsModal { get { return this.isModal; } } #endregion // Public Instance Properties } #endregion #region Script events public delegate void AlertEventHandler (object sender, AlertEventArgs e); public class AlertEventArgs : EventArgs { private DialogType type; private string title; private string text; private string text2; private string username; private string password; private string checkMsg; private bool checkState; private DialogButtonFlags dialogButtons; private StringCollection buttons; private StringCollection options; private object returnValue; #region Public Constructors /// <summary> /// void (STDCALL *OnAlert) (const PRUnichar * title, const PRUnichar * text); /// </summary> /// <param name="title"></param> /// <param name="text"></param> public AlertEventArgs () : base () { } #endregion // Public Constructors #region Public Instance Properties public DialogType Type { get { return this.type; } set { this.type = value; } } public string Title { get { return this.title; } set { this.title = value; } } public string Text { get { return this.text; } set { this.text = value; } } public string Text2 { get { return this.text2; } set { this.text2 = value; } } public string CheckMessage { get { return this.checkMsg; } set { this.checkMsg = value; } } public bool CheckState { get { return this.checkState; } set { this.checkState = value; } } public DialogButtonFlags DialogButtons { get { return this.dialogButtons; } set { this.dialogButtons = value; } } public StringCollection Buttons { get { return buttons; } set { buttons = value; } } public StringCollection Options { get { return options; } set { options = value; } } public string Username { get { return username; } set { username = value; } } public string Password { get { return password; } set { password = value; } } public bool BoolReturn { get { if (returnValue is bool) return (bool) returnValue; return false; } set { returnValue = value; } } public int IntReturn { get { if (returnValue is int) return (int) returnValue; return -1; } set { returnValue = value; } } public string StringReturn { get { if (returnValue is string) return (string) returnValue; return String.Empty; } set { returnValue = value; } } #endregion } #endregion #region Loading events public delegate void StatusChangedEventHandler (object sender, StatusChangedEventArgs e); public class StatusChangedEventArgs : EventArgs { private string message; public string Message { get { return message; } set { message = value; } } private int status; public int Status { get { return status; } set { status = value; } } public StatusChangedEventArgs (string message, int status) { this.message = message; this.status = status; } } public delegate void ProgressChangedEventHandler (object sender, ProgressChangedEventArgs e); public class ProgressChangedEventArgs : EventArgs { private int progress; public int Progress { get { return progress; } } private int maxProgress; public int MaxProgress { get { return maxProgress; } } public ProgressChangedEventArgs (int progress, int maxProgress) { this.progress = progress; this.maxProgress = maxProgress; } } public delegate void LoadStartedEventHandler (object sender, LoadStartedEventArgs e); public class LoadStartedEventArgs : System.ComponentModel.CancelEventArgs { private string uri; public string Uri { get {return uri;} } private string frameName; public string FrameName { get {return frameName;} } public LoadStartedEventArgs (string uri, string frameName) { this.uri = uri; this.frameName = frameName; } } public delegate void LoadCommitedEventHandler (object sender, LoadCommitedEventArgs e); public class LoadCommitedEventArgs : EventArgs { private string uri; public string Uri { get {return uri;} } public LoadCommitedEventArgs (string uri) { this.uri = uri; } } public delegate void LoadFinishedEventHandler (object sender, LoadFinishedEventArgs e); public class LoadFinishedEventArgs : EventArgs { private string uri; public string Uri { get {return uri;} } public LoadFinishedEventArgs (string uri) { this.uri = uri; } } public delegate void SecurityChangedEventHandler (object sender, SecurityChangedEventArgs e); public class SecurityChangedEventArgs : EventArgs { private SecurityLevel state; public SecurityLevel State { get { return state; } set { state = value; } } public SecurityChangedEventArgs (SecurityLevel state) { this.state = state; } } public delegate void ContextMenuEventHandler (object sender, ContextMenuEventArgs e); public class ContextMenuEventArgs : EventArgs { private int x; private int y; public int X { get { return x; } } public int Y { get { return y; } } public ContextMenuEventArgs (int x, int y) { this.x = x; this.y = y; } } public delegate void NavigationRequestedEventHandler (object sender, NavigationRequestedEventArgs e); public class NavigationRequestedEventArgs : System.ComponentModel.CancelEventArgs { private string uri; public string Uri { get {return uri;} } public NavigationRequestedEventArgs (string uri) { this.uri = uri; } } #endregion }
edwinspire/VSharp
class/Mono.WebBrowser/Mono.WebBrowser/IWebBrowser.cs
C#
lgpl-3.0
10,333
/* * @BEGIN LICENSE * * Psi4: an open-source quantum chemistry software package * * Copyright (c) 2007-2019 The Psi4 Developers. * * The copyrights for code used from other parties are included in * the corresponding files. * * This file is part of Psi4. * * Psi4 is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, version 3. * * Psi4 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License along * with Psi4; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * @END LICENSE */ #include "slater_determinant.h" namespace psi { // SlaterDeterminant::SlaterDeterminant() //{ // startup(); //} // SlaterDeterminant::SlaterDeterminant(SlaterDeterminant& det) //{ // alfa_sym = det.alfa_sym; // beta_sym = det.beta_sym; // alfa_string = det.alfa_string; // beta_string = det.beta_string; // alfa_bits = det.alfa_bits; // beta_bits = det.beta_bits; // startup(); //} SlaterDeterminant::SlaterDeterminant(int alfa_sym_, int beta_sym_, std::vector<bool> alfa_bits_, std::vector<bool> beta_bits_) : alfa_sym(alfa_sym_), beta_sym(beta_sym_), alfa_string(-1), beta_string(-1), alfa_bits(alfa_bits_), beta_bits(beta_bits_) { startup(); } SlaterDeterminant::~SlaterDeterminant() { cleanup(); } void SlaterDeterminant::startup() {} void SlaterDeterminant::cleanup() {} bool SlaterDeterminant::is_closed_shell() { return (alfa_bits == beta_bits); } std::string SlaterDeterminant::get_label() { std::string label; label = "|"; int max_i = alfa_bits.size(); for (int i = 0; i < max_i; ++i) label += get_occupation_symbol(i); label += ">"; return label; } char SlaterDeterminant::get_occupation_symbol(int i) { char symbol; if (alfa_bits[i] && beta_bits[i]) symbol = '2'; if (alfa_bits[i] && !beta_bits[i]) symbol = '+'; if (!alfa_bits[i] && beta_bits[i]) symbol = '-'; if (!alfa_bits[i] && !beta_bits[i]) symbol = '0'; return (symbol); } } // namespace psi
CDSherrill/psi4
psi4/src/psi4/libmoinfo/slater_determinant.cc
C++
lgpl-3.0
2,456
<?php class Engines_YandexTranslate extends Engines_AbstractEngine { protected $_config = array( 'segment' => null, 'source' => null, 'target' => null, ); public function __construct($engineRecord) { parent::__construct($engineRecord); if ( $this->engineRecord->type != "MT" ) { throw new Exception( "Engine {$this->engineRecord->id} is not a MT engine, found {$this->engineRecord->type} -> {$this->engineRecord->class_load}" ); } } /** * @param $lang * * @return mixed * @throws Exception */ protected function _fixLangCode( $lang ) { $l = explode( "-", strtolower( trim( $lang ) ) ); return $l[ 0 ]; } /** * @param $rawValue * * @return array */ protected function _decode( $rawValue ) { $all_args = func_get_args(); if ( is_string( $rawValue ) ) { $decoded = json_decode( $rawValue, true ); if ( $decoded[ "code" ] == 200 ) { $decoded = array( 'data' => array( 'translations' => array( array( 'translatedText' => $this->_resetSpecialStrings( $decoded[ "text" ][ 0 ] ) ) ) ) ); } else { $decoded = array( 'error' => array( 'code' => $decoded[ "code" ], 'message' => $decoded[ "message" ] ) ); } } else { $resp = json_decode( $rawValue[ "error" ][ "response" ], true ); if ( isset( $resp[ "code" ] ) && isset( $resp[ "message" ] )) { $rawValue[ "error" ][ "code" ] = $resp[ "code" ]; $rawValue[ "error" ][ "message" ] = $resp[ "message" ]; } $decoded = $rawValue; // already decoded in case of error } $mt_result = new Engines_Results_MT( $decoded ); if ( $mt_result->error->code < 0 ) { $mt_result = $mt_result->get_as_array(); $mt_result['error'] = (array)$mt_result['error']; return $mt_result; } $mt_match_res = new Engines_Results_MyMemory_Matches( $this->_preserveSpecialStrings( $all_args[ 1 ][ "text" ] ), $mt_result->translatedText, 100 - $this->getPenalty() . "%", "MT-" . $this->getName(), date( "Y-m-d" ) ); $mt_res = $mt_match_res->getMatches(); return $mt_res; } public function get( $_config ) { $_config[ 'segment' ] = $this->_preserveSpecialStrings( $_config[ 'segment' ] ); $_config[ 'source' ] = $this->_fixLangCode( $_config[ 'source' ] ); $_config[ 'target' ] = $this->_fixLangCode( $_config[ 'target' ] ); $parameters = array(); if ( $this->client_secret != '' && $this->client_secret != null ) { $parameters[ 'key' ] = $this->client_secret; } $parameters[ 'srv' ] = "matecat"; $parameters[ 'lang' ] = $_config[ 'source' ] . "-" . $_config[ 'target' ]; $parameters[ 'text' ] = $_config[ 'segment' ]; $parameters[ 'format' ] = "html"; $this->_setAdditionalCurlParams( array( CURLOPT_POST => true, CURLOPT_POSTFIELDS => http_build_query( $parameters ) ) ); $this->call( "translate_relative_url", $parameters, true ); return $this->result; } public function set( $_config ) { //if engine does not implement SET method, exit return true; } public function update( $config ) { //if engine does not implement UPDATE method, exit return true; } public function delete( $_config ) { //if engine does not implement DELETE method, exit return true; } }
riccio82/MateCat
lib/Utils/Engines/YandexTranslate.php
PHP
lgpl-3.0
4,027
<?php $lang['install']['flag'] = 'en'; //en $lang['install']['i001'] = 'KimsQ Rb Installation'; //KimsQ Rb 설치 $lang['install']['i002'] = 'Select the version'; //설치할 패키지를 선택해주세요. *** 사이트 패키지와 용어 혼동 $lang['install']['i003'] = 'Do not refresh this page. It will automatically move on to the next step after the downloading. The time of downloading depends on your network environment.';//다운로드 완료 후 자동으로 다음단계로 이동되니 새로고침 하지 마세요.네트웍 상태에 따라 다운로드에 수초가 소요될수 있습니다. $lang['install']['i004'] = 'Start Installation';//설치하기 *** 실제 설치는 모든 정보를 입력 후 이루어짐. 마지막 Next 버튼이 Install Now가 되어야 함. $lang['install']['i005'] = 'You can also install KimsQ Rb by uploading its files directly.'; //또는 패키지 파일을 업로드해 주세요. $lang['install']['i006'] = 'Browse a (zip) file'; //파일 찾기 *** zip 파일만 허용하는 경우 괄호 해제 $lang['install']['i007'] = 'KimsQ Installer'; //킴스큐 인스톨러 $lang['install']['i008'] = 'Agreement'; //사용조건 동의 $lang['install']['i009'] = 'Set Database'; //데이터베이스 $lang['install']['i010'] = 'Create Admin'; //사용자 등록 *** 사실상 일반 사용자가 아닌 관리자 계정이므로. Regist는 없는 단어. $lang['install']['i011'] = 'Create Site'; //사이트 생성 $lang['install']['i012'] = 'License Agreement'; //사용조건 동의 $lang['install']['i013'] = 'Open Source Software License'; //오픈소스 소프트웨어 라이선스 $lang['install']['i014'] = 'I agree to the license above.'; //위의 라이선스 정책에 동의 합니다. $lang['install']['i015'] = 'Database Information'; //'Database settings'; //데이터베이스 설정 *** DB를 설정하는 게 아님, 설정된 DB의 정보를 입력하는 것 $lang['install']['i016'] = 'Basic Info'; //기본정보 $lang['install']['i017'] = 'Advanced Options'; //고급옵션 $lang['install']['i018'] = 'DBMS'; //'DB kind'; //DB종류 (type) $lang['install']['i019'] = 'DB name'; //DB명 (name) $lang['install']['i020'] = 'Username'; //유저 (username) $lang['install']['i021'] = 'Password'; //암호 (password) $lang['install']['i022'] = 'Type your database information. Installation will be finished successfully only with the correct information.'; //데이터베이스(MySQL) 정보를 정확히 입력해 주십시오. 입력된 정보가 정확해야만 정상적으로 설치가 진행됩니다. *** 입력을 아무렇게나 해도 사실 next step으로는 갈 수 있음. 마지막에 설치가 안 될 뿐. 키보드로 입력하라고 할 때는 input은 어색, type이 자연스러움. $lang['install']['i023'] = 'DB Host'; //호스트 (Host) $lang['install']['i024'] = 'Change this if your DB is running on the remote server'; //데이터베이스가 다른 서버에 있다면 이 설정을 바꾸십시오. $lang['install']['i025'] = 'DB Port'; //포트 (Port) $lang['install']['i026'] = 'Change this if the port of your DB server is different'; //DB서버의 포트가 기본 포트가 아닐 경우 변경하십시오. $lang['install']['i027'] = 'Table Prefix'; //접두어 (Prefix) $lang['install']['i028'] = 'Change this if you want to install more than one KimsQ Rb on your server'; //단일 DB에 킴스큐 복수설치를 원하시면 변경해 주십시오. $lang['install']['i029'] = 'DB Engine'; //형식 (Engine) $lang['install']['i030'] = 'MyISAM is the basic engine'; //기본엔진은 MyISAM 입니다. $lang['install']['i031'] = 'These options are needed only for the specific cases. Do not change if you do not know what to do, or ask your hosting provider'; //이 선택사항은 일부 경우에만 필요합니다.무엇을 입력해야할지 모를경우 그대로 두거나 호스팅 제공자에게 문의하십시오. $lang['install']['i032'] = 'User Registration'; //사용자 등록 $lang['install']['i033'] = 'Basic Info'; //기본정보 $lang['install']['i034'] = 'Extra Info'; //추가정보 $lang['install']['i035'] = 'Name'; //이름 $lang['install']['i036'] = 'Email'; //이메일 $lang['install']['i037'] = 'ID (Username)'; //아이디 $lang['install']['i038'] = '4 to 12 lowercase letters or numbers'; //영문소문자+숫자 4~12자 이내 $lang['install']['i039'] = 'Password'; //패스워드 $lang['install']['i040'] = 'Retype'; //패스워드 확인 $lang['install']['i041'] = 'Nickname'; //닉네임 $lang['install']['i042'] = 'Sex'; //성별 $lang['install']['i043'] = 'Male'; //남성 $lang['install']['i044'] = 'Female'; //여성 *** 워드로 열어서 맞춤법 검사 정도는... $lang['install']['i045'] = 'Birthday'; //생년월일 $lang['install']['i046'] = 'Lunar'; //음력생일 $lang['install']['i047'] = 'Phone'; //연락처 $lang['install']['i048'] = 'Create an administrator account. You can add more detail in the profile page after installation.'; //입력된 정보로 신규 회원등록이 이루어지며 최고관리자 권한이 부여됩니다. 관리자 부가정보는 설치 후 프로필페이지 추가로 등록할 수 있습니다. $lang['install']['i049'] = 'Create a site'; //사이트 생성 $lang['install']['i050'] = 'Site Name'; //사이트명 $lang['install']['i051'] = 'Type the name of your first site'; //이 사이트의 명칭을 입력해 주세요. $lang['install']['i052'] = 'Site Code'; //사이트 코드 $lang['install']['i053'] = 'Site Code makes the site recognizable among multiple sites.'; //이 사이트를 구분하기 위한 코드입니다. *** 설치 후 사이트는 하나인데 others라고 하기엔 어색함. $lang['install']['i054'] = 'sitecode'; //사이트코드 $lang['install']['i055'] = 'Using Permalink'; //고유주소(Permalink) 사용 $lang['install']['i056'] = 'Check if you want to have shortened URLs. (PHP rewrite_mod necessarily loaded)'; //주소를 짧게 줄일 수 있습니다.(서버에서 rewrite_mod 허용시) $lang['install']['i057'] = 'This is the last step. After installation, you can create a navigation bar and pages, or apply a site package to build your own website at once.'; //사이트명 입력 후 다음버튼을 클릭하면 킴스큐 설치가 진행됩니다.설치가 완료된 후에는 메뉴와 페이지를 만들거나 사이트 패키지를 이용하세요. $lang['install']['i058'] = 'Previous'; //이전 $lang['install']['i059'] = 'Next'; //다음 *** 마지막 Next 버튼은 Install Now가 되어야 함. $lang['install']['i060'] = 'Install this version?'; //정말로 선택하신 버젼을 설치하시겠습니까? $lang['install']['i061'] = 'Connecting to KimsQ Rb server...'; //KimsQ Rb 다운로드중.. *** 실제 다운로드 메시지는 i062 $lang['install']['i062'] = 'Now downloading from the server...'; //서버에서 다운로드 받고 있습니다... $lang['install']['i063'] = 'We are sorry. The selected version is not available now.'; //죄송합니다. 선택하신 버젼은 아직 다운로드 받으실 수 없습니다. $lang['install']['i064'] = 'We are sorry. The selected file is not KimsQ Rb.'; //죄송합니다. 킴스큐 패키지가 아닙니다. $lang['install']['i065'] = 'You do not have proper permissions for the destination folder.\nTry again after changing the permission to 707'; //설치폴더의 쓰기권한이 없습니다.\n퍼미션을 707로 변경 후 다시 시도해 주세요. $lang['install']['i066'] = 'Uploading KimsQ Rb...'; //KimsQ Rb 업로드중.. *** 말줄임표 $lang['install']['i067'] = 'Unzipping installation file on the server...'; //서버에서 패키지 압축을 풀고 있습니다... *** 사이트 패키지와 혼동 $lang['install']['i068'] = 'DB Host is required.'; //DB호스트를 입력해 주세요. $lang['install']['i069'] = 'DB Name is required.'; //DB명을 입력해 주세요. $lang['install']['i070'] = 'DB Username is required.'; //DB사용자를 입력해 주세요. $lang['install']['i071'] = 'DB Password is required.'; //DB 패스워드를 입력해 주세요. $lang['install']['i072'] = 'DB Port number is required'; //DB 포트번호를 입력해 주세요. $lang['install']['i073'] = 'Table Prefix is required and cannot be empty'; //DB 접두어를 정확히 입력해 주세요. $lang['install']['i074'] = 'Administrator account`s name is required.'; //이름을 입력해 주세요. $lang['install']['i075'] = 'Administrator`s email address is required.'; //이메일주소를 정확히 입력해 주세요. $lang['install']['i076'] = 'Administrator`s id is required.'; //아이디를 정확히 입력해 주세요. $lang['install']['i077'] = 'Administrator`s password is required.'; //패스워드를 입력해 주세요. $lang['install']['i078'] = 'Fill the both of two blanks for Administrator`s password.'; //패스워드를 다시한번 입력해 주세요. *** 두번째 패스워드 칸이 비었을 경우, 그냥 다시 입력하라는 설명은 너무 모호함 $lang['install']['i079'] = 'The both passwords are not identical.'; //패스워드가 일치하지 않습니다. $lang['install']['i080'] = 'Installing KimsQ Rb now. Please wait a second.'; //설치중입니다. 잠시만 기다려 주세요. $lang['install']['i081'] = 'Type Site Name, please.'; //사이트명을 입력해 주세요. $lang['install']['i082'] = 'Type Site Code, please.'; //사이트 코드를 정확히 입력해 주세요. $lang['install']['i083'] = 'Start the installation with the typed information?'; //정말로 설치하시겠습니까? ?>
kieregh/rb
_install/language/english/lang.install.php
PHP
lgpl-3.0
9,586
/* * Copyright (C) 2014-2015 Vote Rewarding System * * This file is part of Vote Rewarding System. * * Vote Rewarding System is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Vote Rewarding System is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.github.unafraid.votingreward.interfaceprovider.model; /** * @author UnAfraid */ public class RewardItemHolder { private final int _id; private final long _count; public RewardItemHolder(int id, long count) { _id = id; _count = count; } /** * @return the ID of the item contained in this object */ public int getId() { return _id; } /** * @return the count of items contained in this object */ public long getCount() { return _count; } }
UnAfraid/topzone
VotingRewardInterfaceProvider/src/main/java/com/github/unafraid/votingreward/interfaceprovider/model/RewardItemHolder.java
Java
lgpl-3.0
1,261
{ 'name': 'Control access to Apps', 'version': '1.0.0', 'author': 'IT-Projects LLC, Ivan Yelizariev', 'category': 'Tools', 'website': 'https://twitter.com/yelizariev', 'price': 10.00, 'currency': 'EUR', 'depends': [ 'access_restricted' ], 'data': [ 'security/access_apps_security.xml', 'security/ir.model.access.csv', ], 'installable': True }
ufaks/addons-yelizariev
access_apps/__openerp__.py
Python
lgpl-3.0
415
<?php /** * Class shopMigrateStorelandruTransport * @title StoreLand ru * @description Перенос данных из магазинов на платформе StoreLand.ru посредством YML файла * @group YML */ class shopMigrateStorelandruTransport extends shopMigrateYmlTransport { }
Amethyst-web/vinst
wa-apps/shop/plugins/migrate/lib/transport/shopMigrateStorelandruTransport.class.php
PHP
lgpl-3.0
311
""" Classes for interacting with the tor control socket. Controllers are a wrapper around a ControlSocket, retaining many of its methods (connect, close, is_alive, etc) in addition to providing its own for interacting at a higher level. **Module Overview:** :: from_port - Provides a Controller based on a port connection. from_socket_file - Provides a Controller based on a socket file connection. Controller - General controller class intended for direct use. +- get_info - issues a GETINFO query BaseController - Base controller class asynchronous message handling. |- msg - communicates with the tor process |- is_alive - reports if our connection to tor is open or closed |- connect - connects or reconnects to tor |- close - shuts down our connection to the tor process |- get_socket - provides the socket used for control communication |- add_status_listener - notifies a callback of changes in our status |- remove_status_listener - prevents further notification of status changes +- __enter__ / __exit__ - manages socket connection """ import time import Queue import threading import stem.response import stem.socket import stem.util.log as log # state changes a control socket can have # INIT - new control connection # RESET - received a reset/sighup signal # CLOSED - control connection closed State = stem.util.enum.Enum("INIT", "RESET", "CLOSED") # Constant to indicate an undefined argument default. Usually we'd use None for # this, but users will commonly provide None as the argument so need something # else fairly unique... UNDEFINED = "<Undefined_ >" class BaseController: """ Controller for the tor process. This is a minimal base class for other controllers, providing basic process communication and event listing. Don't use this directly - subclasses like the Controller provide higher level functionality. Do not continue to directly interacte with the ControlSocket we're constructed from - use our wrapper methods instead. """ def __init__(self, control_socket): self._socket = control_socket self._msg_lock = threading.RLock() self._status_listeners = [] # tuples of the form (callback, spawn_thread) self._status_listeners_lock = threading.RLock() # queues where incoming messages are directed self._reply_queue = Queue.Queue() self._event_queue = Queue.Queue() # thread to continually pull from the control socket self._reader_thread = None # thread to pull from the _event_queue and call handle_event self._event_notice = threading.Event() self._event_thread = None # saves our socket's prior _connect() and _close() methods so they can be # called along with ours self._socket_connect = self._socket._connect self._socket_close = self._socket._close self._socket._connect = self._connect self._socket._close = self._close if self._socket.is_alive(): self._launch_threads() def msg(self, message): """ Sends a message to our control socket and provides back its reply. :param str message: message to be formatted and sent to tor :returns: :class:`stem.response.ControlMessage` with the response :raises: * :class:`stem.socket.ProtocolError` the content from the socket is malformed * :class:`stem.socket.SocketError` if a problem arises in using the socket * :class:`stem.socket.SocketClosed` if the socket is shut down """ with self._msg_lock: # If our _reply_queue isn't empty then one of a few things happened... # # - Our connection was closed and probably re-restablished. This was # in reply to pulling for an asynchronous event and getting this is # expected - ignore it. # # - Pulling for asynchronous events produced an error. If this was a # ProtocolError then it's a tor bug, and if a non-closure SocketError # then it was probably a socket glitch. Deserves an INFO level log # message. # # - This is a leftover response for a msg() call. We can't tell who an # exception was airmarked for, so we only know that this was the case # if it's a ControlMessage. This should not be possable and indicates # a stem bug. This deserves a NOTICE level log message since it # indicates that one of our callers didn't get their reply. while not self._reply_queue.empty(): try: response = self._reply_queue.get_nowait() if isinstance(response, stem.socket.SocketClosed): pass # this is fine elif isinstance(response, stem.socket.ProtocolError): log.info("Tor provided a malformed message (%s)" % response) elif isinstance(response, stem.socket.ControllerError): log.info("Socket experienced a problem (%s)" % response) elif isinstance(response, stem.response.ControlMessage): log.notice("BUG: the msg() function failed to deliver a response: %s" % response) except Queue.Empty: # the empty() method is documented to not be fully reliable so this # isn't entirely surprising break try: self._socket.send(message) response = self._reply_queue.get() # If the message we received back had an exception then re-raise it to the # caller. Otherwise return the response. if isinstance(response, stem.socket.ControllerError): raise response else: return response except stem.socket.SocketClosed, exc: # If the recv() thread caused the SocketClosed then we could still be # in the process of closing. Calling close() here so that we can # provide an assurance to the caller that when we raise a SocketClosed # exception we are shut down afterward for realz. self.close() raise exc def is_alive(self): """ Checks if our socket is currently connected. This is a passthrough for our socket's is_alive() method. :returns: bool that's True if we're shut down and False otherwise """ return self._socket.is_alive() def connect(self): """ Reconnects our control socket. This is a passthrough for our socket's connect() method. :raises: :class:`stem.socket.SocketError` if unable to make a socket """ self._socket.connect() def close(self): """ Closes our socket connection. This is a passthrough for our socket's :func:`stem.socket.ControlSocket.close` method. """ self._socket.close() def get_socket(self): """ Provides the socket used to speak with the tor process. Communicating with the socket directly isn't advised since it may confuse the controller. :returns: :class:`stem.socket.ControlSocket` we're communicating with """ return self._socket def add_status_listener(self, callback, spawn = True): """ Notifies a given function when the state of our socket changes. Functions are expected to be of the form... :: my_function(controller, state, timestamp) The state is a value from stem.socket.State, functions **must** allow for new values in this field. The timestamp is a float for the unix time when the change occured. This class only provides ``State.INIT`` and ``State.CLOSED`` notifications. Subclasses may provide others. If spawn is True then the callback is notified via a new daemon thread. If false then the notice is under our locks, within the thread where the change occured. In general this isn't advised, especially if your callback could block for a while. :param function callback: function to be notified when our state changes :param bool spawn: calls function via a new thread if True, otherwise it's part of the connect/close method call """ with self._status_listeners_lock: self._status_listeners.append((callback, spawn)) def remove_status_listener(self, callback): """ Stops listener from being notified of further events. :param function callback: function to be removed from our listeners :returns: bool that's True if we removed one or more occurances of the callback, False otherwise """ with self._status_listeners_lock: new_listeners, is_changed = [], False for listener, spawn in self._status_listeners: if listener != callback: new_listeners.append((listener, spawn)) else: is_changed = True self._status_listeners = new_listeners return is_changed def __enter__(self): return self def __exit__(self, exit_type, value, traceback): self.close() def _handle_event(self, event_message): """ Callback to be overwritten by subclasses for event listening. This is notified whenever we receive an event from the control socket. :param stem.response.ControlMessage event_message: message received from the control socket """ pass def _connect(self): self._launch_threads() self._notify_status_listeners(State.INIT, True) self._socket_connect() def _close(self): # Our is_alive() state is now false. Our reader thread should already be # awake from recv() raising a closure exception. Wake up the event thread # too so it can end. self._event_notice.set() # joins on our threads if it's safe to do so for t in (self._reader_thread, self._event_thread): if t and t.is_alive() and threading.current_thread() != t: t.join() self._notify_status_listeners(State.CLOSED, False) self._socket_close() def _notify_status_listeners(self, state, expect_alive = None): """ Informs our status listeners that a state change occured. States imply that our socket is either alive or not, which may not hold true when multiple events occure in quick succession. For instance, a sighup could cause two events (``State.RESET`` for the sighup and ``State.CLOSE`` if it causes tor to crash). However, there's no guarentee of the order in which they occure, and it would be bad if listeners got the ``State.RESET`` last, implying that we were alive. If set, the expect_alive flag will discard our event if it conflicts with our current :func:`stem.control.BaseController.is_alive` state. :param stem.socket.State state: state change that has occured :param bool expect_alive: discard event if it conflicts with our :func:`stem.control.BaseController.is_alive` state """ # Any changes to our is_alive() state happen under the send lock, so we # need to have it to ensure it doesn't change beneath us. with self._socket._get_send_lock(), self._status_listeners_lock: change_timestamp = time.time() if expect_alive != None and expect_alive != self.is_alive(): return for listener, spawn in self._status_listeners: if spawn: name = "%s notification" % state args = (self, state, change_timestamp) notice_thread = threading.Thread(target = listener, args = args, name = name) notice_thread.setDaemon(True) notice_thread.start() else: listener(self, state, change_timestamp) def _launch_threads(self): """ Initializes daemon threads. Threads can't be reused so we need to recreate them if we're restarted. """ # In theory concurrent calls could result in multple start() calls on a # single thread, which would cause an unexpeceted exception. Best be safe. with self._socket._get_send_lock(): if not self._reader_thread or not self._reader_thread.is_alive(): self._reader_thread = threading.Thread(target = self._reader_loop, name = "Tor Listener") self._reader_thread.setDaemon(True) self._reader_thread.start() if not self._event_thread or not self._event_thread.is_alive(): self._event_thread = threading.Thread(target = self._event_loop, name = "Event Notifier") self._event_thread.setDaemon(True) self._event_thread.start() def _reader_loop(self): """ Continually pulls from the control socket, directing the messages into queues based on their type. Controller messages come in two varieties... * Responses to messages we've sent (GETINFO, SETCONF, etc). * Asynchronous events, identified by a status code of 650. """ while self.is_alive(): try: control_message = self._socket.recv() if control_message.content()[-1][0] == "650": # asynchronous message, adds to the event queue and wakes up its handler self._event_queue.put(control_message) self._event_notice.set() else: # response to a msg() call self._reply_queue.put(control_message) except stem.socket.ControllerError, exc: # Assume that all exceptions belong to the reader. This isn't always # true, but the msg() call can do a better job of sorting it out. # # Be aware that the msg() method relies on this to unblock callers. self._reply_queue.put(exc) def _event_loop(self): """ Continually pulls messages from the _event_queue and sends them to our handle_event callback. This is done via its own thread so subclasses with a lengthy handle_event implementation don't block further reading from the socket. """ while True: try: event_message = self._event_queue.get_nowait() self._handle_event(event_message) except Queue.Empty: if not self.is_alive(): break self._event_notice.wait() self._event_notice.clear() class Controller(BaseController): """ Communicates with a control socket. This is built on top of the BaseController and provides a more user friendly API for library users. """ def from_port(control_addr = "127.0.0.1", control_port = 9051): """ Constructs a ControlPort based Controller. :param str control_addr: ip address of the controller :param int control_port: port number of the controller :returns: :class:`stem.control.Controller` attached to the given port :raises: :class:`stem.socket.SocketError` if we're unable to establish a connection """ control_port = stem.socket.ControlPort(control_addr, control_port) return Controller(control_port) def from_socket_file(socket_path = "/var/run/tor/control"): """ Constructs a ControlSocketFile based Controller. :param str socket_path: path where the control socket is located :returns: :class:`stem.control.Controller` attached to the given socket file :raises: :class:`stem.socket.SocketError` if we're unable to establish a connection """ control_socket = stem.socket.ControlSocketFile(socket_path) return Controller(control_socket) from_port = staticmethod(from_port) from_socket_file = staticmethod(from_socket_file) def get_info(self, param, default = UNDEFINED): """ Queries the control socket for the given GETINFO option. If provided a default then that's returned if the GETINFO option is undefined or the call fails for any reason (error response, control port closed, initiated, etc). :param str,list param: GETINFO option or options to be queried :param object default: response if the query fails :returns: Response depends upon how we were called as follows... * str with the response if our param was a str * dict with the param => response mapping if our param was a list * default if one was provided and our call failed :raises: :class:`stem.socket.ControllerError` if the call fails, and we weren't provided a default response """ # TODO: add caching? # TODO: special geoip handling? # TODO: add logging, including call runtime if isinstance(param, str): is_multiple = False param = [param] else: is_multiple = True try: response = self.msg("GETINFO %s" % " ".join(param)) stem.response.convert("GETINFO", response) # error if we got back different parameters than we requested requested_params = set(param) reply_params = set(response.entries.keys()) if requested_params != reply_params: requested_label = ", ".join(requested_params) reply_label = ", ".join(reply_params) raise stem.socket.ProtocolError("GETINFO reply doesn't match the parameters that we requested. Queried '%s' but got '%s'." % (requested_label, reply_label)) if is_multiple: return response.entries else: return response.entries[param[0]] except stem.socket.ControllerError, exc: if default == UNDEFINED: raise exc else: return default
meganchang/Stem
stem/control.py
Python
lgpl-3.0
17,273
//*************************************************** //* This file was generated by tool //* SharpKit //* At: 29/08/2012 03:59:41 p.m. //*************************************************** using SharpKit.JavaScript; namespace Ext.grid.property { #region Store /// <inheritdocs /> /// <summary> /// <p>A custom <see cref="Ext.data.Store">Ext.data.Store</see> for the <see cref="Ext.grid.property.Grid">Ext.grid.property.Grid</see>. This class handles the mapping /// between the custom data source objects supported by the grid and the <see cref="Ext.grid.property.Property">Ext.grid.property.Property</see> format /// used by the <see cref="Ext.data.Store">Ext.data.Store</see> base class.</p> /// </summary> [JsType(JsMode.Prototype, Export=false, OmitOptionalParameters=true)] public partial class Store : Ext.data.Store { /// <summary> /// Creates new property store. /// </summary> /// <param name="grid"><p>The grid this store will be bound to</p> /// </param> /// <param name="source"><p>The source data config object</p> /// </param> /// <returns> /// <span><see cref="Object">Object</see></span><div> /// </div> /// </returns> public Store(Ext.grid.Panel grid, object source){} public Store(Ext.grid.property.StoreConfig config){} public Store(){} public Store(params object[] args){} } #endregion #region StoreConfig /// <inheritdocs /> [JsType(JsMode.Json, Export=false, OmitOptionalParameters=true)] public partial class StoreConfig : Ext.data.StoreConfig { public StoreConfig(params object[] args){} } #endregion #region StoreEvents /// <inheritdocs /> [JsType(JsMode.Json, Export=false, OmitOptionalParameters=true)] public partial class StoreEvents : Ext.data.StoreEvents { public StoreEvents(params object[] args){} } #endregion }
hultqvist/SharpKit-SDK
Defs/ExtJs/Ext.grid.property.Store.cs
C#
lgpl-3.0
1,987
// // System.Net.Configuration.HttpCachePolicyElement.cs // // Authors: // Tim Coleman (tim@timcoleman.com) // Chris Toshok (toshok@ximian.com) // // Copyright (C) Tim Coleman, 2004 // (C) 2004,2005 Novell, Inc. (http://www.novell.com) // // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // #if CONFIGURATION_DEP using System; using System.Configuration; using System.Net.Cache; using System.Xml; namespace System.Net.Configuration { public sealed class HttpCachePolicyElement : ConfigurationElement { #region Fields static ConfigurationProperty maximumAgeProp; static ConfigurationProperty maximumStaleProp; static ConfigurationProperty minimumFreshProp; static ConfigurationProperty policyLevelProp; static ConfigurationPropertyCollection properties; #endregion // Fields #region Constructors static HttpCachePolicyElement () { maximumAgeProp = new ConfigurationProperty ("maximumAge", typeof (TimeSpan), TimeSpan.MaxValue); maximumStaleProp = new ConfigurationProperty ("maximumStale", typeof (TimeSpan), TimeSpan.MinValue); minimumFreshProp = new ConfigurationProperty ("minimumFresh", typeof (TimeSpan), TimeSpan.MinValue); policyLevelProp = new ConfigurationProperty ("policyLevel", typeof (HttpRequestCacheLevel), HttpRequestCacheLevel.Default, ConfigurationPropertyOptions.IsRequired); properties = new ConfigurationPropertyCollection (); properties.Add (maximumAgeProp); properties.Add (maximumStaleProp); properties.Add (minimumFreshProp); properties.Add (policyLevelProp); } public HttpCachePolicyElement () { } #endregion // Constructors #region Properties [ConfigurationProperty ("maximumAge", DefaultValue = "10675199.02:48:05.4775807")] public TimeSpan MaximumAge { get { return (TimeSpan) base [maximumAgeProp]; } set { base [maximumAgeProp] = value; } } [ConfigurationProperty ("maximumStale", DefaultValue = "-10675199.02:48:05.4775808")] public TimeSpan MaximumStale { get { return (TimeSpan) base [maximumStaleProp]; } set { base [maximumStaleProp] = value; } } [ConfigurationProperty ("minimumFresh", DefaultValue = "-10675199.02:48:05.4775808")] public TimeSpan MinimumFresh { get { return (TimeSpan) base [minimumFreshProp]; } set { base [minimumFreshProp] = value; } } [ConfigurationProperty ("policyLevel", DefaultValue = "Default", Options = ConfigurationPropertyOptions.IsRequired)] public HttpRequestCacheLevel PolicyLevel { get { return (HttpRequestCacheLevel) base [policyLevelProp]; } set { base [policyLevelProp] = value; } } protected override ConfigurationPropertyCollection Properties { get { return properties; } } #endregion // Properties #region Methods [MonoTODO] protected override void DeserializeElement (XmlReader reader, bool serializeCollectionKey) { throw new NotImplementedException (); } [MonoTODO] protected override void Reset (ConfigurationElement parentElement) { throw new NotImplementedException (); } #endregion // Methods } } #endif
edwinspire/VSharp
class/System/System.Net.Configuration/HttpCachePolicyElement.cs
C#
lgpl-3.0
4,102
/* ========================================================================= * This file is part of xml.lite-c++ * ========================================================================= * * (C) Copyright 2004 - 2014, MDA Information Systems LLC * (C) Copyright 2022, Maxar Technologies, Inc. * * xml.lite-c++ is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this program; If not, * see <http://www.gnu.org/licenses/>. * */ #include <xml/lite/ValidatorInterface.h> #include <algorithm> #include <iterator> #include <std/filesystem> #include <std/memory> #include <sys/OS.h> #include <io/StringStream.h> #include <mem/ScopedArray.h> #include <str/EncodedStringView.h> namespace fs = std::filesystem; #include <xml/lite/xml_lite_config.h> template<typename TStringStream> bool vallidate_(const xml::lite::ValidatorInterface& validator, io::InputStream& xml, TStringStream&& oss, const std::string& xmlID, std::vector<xml::lite::ValidationInfo>& errors) { xml.streamTo(oss); return validator.validate(oss.stream().str(), xmlID, errors); } bool xml::lite::ValidatorInterface::validate( io::InputStream& xml, StringEncoding encoding, const std::string& xmlID, std::vector<ValidationInfo>& errors) const { // convert to the correcrt std::basic_string<T> based on "encoding" if (encoding == StringEncoding::Utf8) { return vallidate_(*this, xml, io::U8StringStream(), xmlID, errors); } if (encoding == StringEncoding::Windows1252) { return vallidate_(*this, xml, io::W1252StringStream(), xmlID, errors); } // this really shouldn't happen return validate(xml, xmlID, errors); }
mdaus/coda-oss
modules/c++/xml.lite/source/ValidatorInterface.cpp
C++
lgpl-3.0
2,255
// System.Net.Sockets.SocketAsyncEventArgs.cs // // Authors: // Marek Habersack (mhabersack@novell.com) // // Copyright (c) 2008 Novell, Inc. (http://www.novell.com) // // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; namespace System.Net.Sockets { public class SendPacketsElement { public byte[] Buffer { get; private set; } public int Count { get; private set; } public bool EndOfPacket { get; private set; } public string FilePath { get; private set; } public int Offset { get; private set; } public SendPacketsElement (byte[] buffer) : this (buffer, 0, buffer != null ? buffer.Length : 0) { } public SendPacketsElement (byte[] buffer, int offset, int count) : this (buffer, offset, count, false) { } public SendPacketsElement (byte[] buffer, int offset, int count, bool endOfPacket) { if (buffer == null) throw new ArgumentNullException ("buffer"); int buflen = buffer.Length; if (offset < 0 || offset >= buflen) throw new ArgumentOutOfRangeException ("offset"); if (count < 0 || offset + count >= buflen) throw new ArgumentOutOfRangeException ("count"); Buffer = buffer; Offset = offset; Count = count; EndOfPacket = endOfPacket; FilePath = null; } public SendPacketsElement (string filepath) : this (filepath, 0, 0, false) { } public SendPacketsElement (string filepath, int offset, int count) : this (filepath, offset, count, false) { } // LAME SPEC: only ArgumentNullException for filepath is thrown public SendPacketsElement (string filepath, int offset, int count, bool endOfPacket) { if (filepath == null) throw new ArgumentNullException ("filepath"); Buffer = null; Offset = offset; Count = count; EndOfPacket = endOfPacket; FilePath = filepath; } } }
edwinspire/VSharp
class/System/System.Net.Sockets/SendPacketsElement.cs
C#
lgpl-3.0
2,838
// Authors: // Francis Fisher (frankie@terrorise.me.uk) // // (C) Francis Fisher 2013 // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. namespace System.Windows.Forms.DataVisualization.Charting { public class CustomizeLegendEventArgs : EventArgs { public LegendItemsCollection LegendItems { get; private set; } public string LegendName { get; private set; } } }
edwinspire/VSharp
class/System.Windows.Forms.DataVisualization/System.Windows.Forms.DataVisualization.Charting/CustomizeLegendEventArgs.cs
C#
lgpl-3.0
1,400
function main() { // Widget instantiation metadata... var widget = { id: "UploaderPlusAdmin", name: "SoftwareLoop.UploaderPlusAdmin", }; model.widgets = [widget]; } main();
sprouvez/uploader-plus
surf/src/main/amp/config/alfresco/web-extension/site-webscripts/uploader-plus/uploader-plus-admin.get.js
JavaScript
lgpl-3.0
204
# encoding: utf-8 """ Utilities for working with strings and text. """ #----------------------------------------------------------------------------- # Copyright (C) 2008-2011 The IPython Development Team # # Distributed under the terms of the BSD License. The full license is in # the file COPYING, distributed as part of this software. #----------------------------------------------------------------------------- #----------------------------------------------------------------------------- # Imports #----------------------------------------------------------------------------- import __main__ import os import re import shutil import sys import textwrap from string import Formatter from IPython.external.path import path from IPython.testing.skipdoctest import skip_doctest_py3, skip_doctest from IPython.utils import py3compat from IPython.utils.io import nlprint from IPython.utils.data import flatten #----------------------------------------------------------------------------- # Code #----------------------------------------------------------------------------- def unquote_ends(istr): """Remove a single pair of quotes from the endpoints of a string.""" if not istr: return istr if (istr[0]=="'" and istr[-1]=="'") or \ (istr[0]=='"' and istr[-1]=='"'): return istr[1:-1] else: return istr class LSString(str): """String derivative with a special access attributes. These are normal strings, but with the special attributes: .l (or .list) : value as list (split on newlines). .n (or .nlstr): original value (the string itself). .s (or .spstr): value as whitespace-separated string. .p (or .paths): list of path objects Any values which require transformations are computed only once and cached. Such strings are very useful to efficiently interact with the shell, which typically only understands whitespace-separated options for commands.""" def get_list(self): try: return self.__list except AttributeError: self.__list = self.split('\n') return self.__list l = list = property(get_list) def get_spstr(self): try: return self.__spstr except AttributeError: self.__spstr = self.replace('\n',' ') return self.__spstr s = spstr = property(get_spstr) def get_nlstr(self): return self n = nlstr = property(get_nlstr) def get_paths(self): try: return self.__paths except AttributeError: self.__paths = [path(p) for p in self.split('\n') if os.path.exists(p)] return self.__paths p = paths = property(get_paths) # FIXME: We need to reimplement type specific displayhook and then add this # back as a custom printer. This should also be moved outside utils into the # core. # def print_lsstring(arg): # """ Prettier (non-repr-like) and more informative printer for LSString """ # print "LSString (.p, .n, .l, .s available). Value:" # print arg # # # print_lsstring = result_display.when_type(LSString)(print_lsstring) class SList(list): """List derivative with a special access attributes. These are normal lists, but with the special attributes: .l (or .list) : value as list (the list itself). .n (or .nlstr): value as a string, joined on newlines. .s (or .spstr): value as a string, joined on spaces. .p (or .paths): list of path objects Any values which require transformations are computed only once and cached.""" def get_list(self): return self l = list = property(get_list) def get_spstr(self): try: return self.__spstr except AttributeError: self.__spstr = ' '.join(self) return self.__spstr s = spstr = property(get_spstr) def get_nlstr(self): try: return self.__nlstr except AttributeError: self.__nlstr = '\n'.join(self) return self.__nlstr n = nlstr = property(get_nlstr) def get_paths(self): try: return self.__paths except AttributeError: self.__paths = [path(p) for p in self if os.path.exists(p)] return self.__paths p = paths = property(get_paths) def grep(self, pattern, prune = False, field = None): """ Return all strings matching 'pattern' (a regex or callable) This is case-insensitive. If prune is true, return all items NOT matching the pattern. If field is specified, the match must occur in the specified whitespace-separated field. Examples:: a.grep( lambda x: x.startswith('C') ) a.grep('Cha.*log', prune=1) a.grep('chm', field=-1) """ def match_target(s): if field is None: return s parts = s.split() try: tgt = parts[field] return tgt except IndexError: return "" if isinstance(pattern, basestring): pred = lambda x : re.search(pattern, x, re.IGNORECASE) else: pred = pattern if not prune: return SList([el for el in self if pred(match_target(el))]) else: return SList([el for el in self if not pred(match_target(el))]) def fields(self, *fields): """ Collect whitespace-separated fields from string list Allows quick awk-like usage of string lists. Example data (in var a, created by 'a = !ls -l'):: -rwxrwxrwx 1 ville None 18 Dec 14 2006 ChangeLog drwxrwxrwx+ 6 ville None 0 Oct 24 18:05 IPython a.fields(0) is ['-rwxrwxrwx', 'drwxrwxrwx+'] a.fields(1,0) is ['1 -rwxrwxrwx', '6 drwxrwxrwx+'] (note the joining by space). a.fields(-1) is ['ChangeLog', 'IPython'] IndexErrors are ignored. Without args, fields() just split()'s the strings. """ if len(fields) == 0: return [el.split() for el in self] res = SList() for el in [f.split() for f in self]: lineparts = [] for fd in fields: try: lineparts.append(el[fd]) except IndexError: pass if lineparts: res.append(" ".join(lineparts)) return res def sort(self,field= None, nums = False): """ sort by specified fields (see fields()) Example:: a.sort(1, nums = True) Sorts a by second field, in numerical order (so that 21 > 3) """ #decorate, sort, undecorate if field is not None: dsu = [[SList([line]).fields(field), line] for line in self] else: dsu = [[line, line] for line in self] if nums: for i in range(len(dsu)): numstr = "".join([ch for ch in dsu[i][0] if ch.isdigit()]) try: n = int(numstr) except ValueError: n = 0; dsu[i][0] = n dsu.sort() return SList([t[1] for t in dsu]) # FIXME: We need to reimplement type specific displayhook and then add this # back as a custom printer. This should also be moved outside utils into the # core. # def print_slist(arg): # """ Prettier (non-repr-like) and more informative printer for SList """ # print "SList (.p, .n, .l, .s, .grep(), .fields(), sort() available):" # if hasattr(arg, 'hideonce') and arg.hideonce: # arg.hideonce = False # return # # nlprint(arg) # # print_slist = result_display.when_type(SList)(print_slist) def esc_quotes(strng): """Return the input string with single and double quotes escaped out""" return strng.replace('"','\\"').replace("'","\\'") def qw(words,flat=0,sep=None,maxsplit=-1): """Similar to Perl's qw() operator, but with some more options. qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit) words can also be a list itself, and with flat=1, the output will be recursively flattened. Examples: >>> qw('1 2') ['1', '2'] >>> qw(['a b','1 2',['m n','p q']]) [['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]] >>> qw(['a b','1 2',['m n','p q']],flat=1) ['a', 'b', '1', '2', 'm', 'n', 'p', 'q'] """ if isinstance(words, basestring): return [word.strip() for word in words.split(sep,maxsplit) if word and not word.isspace() ] if flat: return flatten(map(qw,words,[1]*len(words))) return map(qw,words) def qwflat(words,sep=None,maxsplit=-1): """Calls qw(words) in flat mode. It's just a convenient shorthand.""" return qw(words,1,sep,maxsplit) def qw_lol(indata): """qw_lol('a b') -> [['a','b']], otherwise it's just a call to qw(). We need this to make sure the modules_some keys *always* end up as a list of lists.""" if isinstance(indata, basestring): return [qw(indata)] else: return qw(indata) def grep(pat,list,case=1): """Simple minded grep-like function. grep(pat,list) returns occurrences of pat in list, None on failure. It only does simple string matching, with no support for regexps. Use the option case=0 for case-insensitive matching.""" # This is pretty crude. At least it should implement copying only references # to the original data in case it's big. Now it copies the data for output. out=[] if case: for term in list: if term.find(pat)>-1: out.append(term) else: lpat=pat.lower() for term in list: if term.lower().find(lpat)>-1: out.append(term) if len(out): return out else: return None def dgrep(pat,*opts): """Return grep() on dir()+dir(__builtins__). A very common use of grep() when working interactively.""" return grep(pat,dir(__main__)+dir(__main__.__builtins__),*opts) def idgrep(pat): """Case-insensitive dgrep()""" return dgrep(pat,0) def igrep(pat,list): """Synonym for case-insensitive grep.""" return grep(pat,list,case=0) def indent(instr,nspaces=4, ntabs=0, flatten=False): """Indent a string a given number of spaces or tabstops. indent(str,nspaces=4,ntabs=0) -> indent str by ntabs+nspaces. Parameters ---------- instr : basestring The string to be indented. nspaces : int (default: 4) The number of spaces to be indented. ntabs : int (default: 0) The number of tabs to be indented. flatten : bool (default: False) Whether to scrub existing indentation. If True, all lines will be aligned to the same indentation. If False, existing indentation will be strictly increased. Returns ------- str|unicode : string indented by ntabs and nspaces. """ if instr is None: return ind = '\t'*ntabs+' '*nspaces if flatten: pat = re.compile(r'^\s*', re.MULTILINE) else: pat = re.compile(r'^', re.MULTILINE) outstr = re.sub(pat, ind, instr) if outstr.endswith(os.linesep+ind): return outstr[:-len(ind)] else: return outstr def native_line_ends(filename,backup=1): """Convert (in-place) a file to line-ends native to the current OS. If the optional backup argument is given as false, no backup of the original file is left. """ backup_suffixes = {'posix':'~','dos':'.bak','nt':'.bak','mac':'.bak'} bak_filename = filename + backup_suffixes[os.name] original = open(filename).read() shutil.copy2(filename,bak_filename) try: new = open(filename,'wb') new.write(os.linesep.join(original.splitlines())) new.write(os.linesep) # ALWAYS put an eol at the end of the file new.close() except: os.rename(bak_filename,filename) if not backup: try: os.remove(bak_filename) except: pass def list_strings(arg): """Always return a list of strings, given a string or list of strings as input. :Examples: In [7]: list_strings('A single string') Out[7]: ['A single string'] In [8]: list_strings(['A single string in a list']) Out[8]: ['A single string in a list'] In [9]: list_strings(['A','list','of','strings']) Out[9]: ['A', 'list', 'of', 'strings'] """ if isinstance(arg,basestring): return [arg] else: return arg def marquee(txt='',width=78,mark='*'): """Return the input string centered in a 'marquee'. :Examples: In [16]: marquee('A test',40) Out[16]: '**************** A test ****************' In [17]: marquee('A test',40,'-') Out[17]: '---------------- A test ----------------' In [18]: marquee('A test',40,' ') Out[18]: ' A test ' """ if not txt: return (mark*width)[:width] nmark = (width-len(txt)-2)//len(mark)//2 if nmark < 0: nmark =0 marks = mark*nmark return '%s %s %s' % (marks,txt,marks) ini_spaces_re = re.compile(r'^(\s+)') def num_ini_spaces(strng): """Return the number of initial spaces in a string""" ini_spaces = ini_spaces_re.match(strng) if ini_spaces: return ini_spaces.end() else: return 0 def format_screen(strng): """Format a string for screen printing. This removes some latex-type format codes.""" # Paragraph continue par_re = re.compile(r'\\$',re.MULTILINE) strng = par_re.sub('',strng) return strng def dedent(text): """Equivalent of textwrap.dedent that ignores unindented first line. This means it will still dedent strings like: '''foo is a bar ''' For use in wrap_paragraphs. """ if text.startswith('\n'): # text starts with blank line, don't ignore the first line return textwrap.dedent(text) # split first line splits = text.split('\n',1) if len(splits) == 1: # only one line return textwrap.dedent(text) first, rest = splits # dedent everything but the first line rest = textwrap.dedent(rest) return '\n'.join([first, rest]) def wrap_paragraphs(text, ncols=80): """Wrap multiple paragraphs to fit a specified width. This is equivalent to textwrap.wrap, but with support for multiple paragraphs, as separated by empty lines. Returns ------- list of complete paragraphs, wrapped to fill `ncols` columns. """ paragraph_re = re.compile(r'\n(\s*\n)+', re.MULTILINE) text = dedent(text).strip() paragraphs = paragraph_re.split(text)[::2] # every other entry is space out_ps = [] indent_re = re.compile(r'\n\s+', re.MULTILINE) for p in paragraphs: # presume indentation that survives dedent is meaningful formatting, # so don't fill unless text is flush. if indent_re.search(p) is None: # wrap paragraph p = textwrap.fill(p, ncols) out_ps.append(p) return out_ps def long_substr(data): """Return the longest common substring in a list of strings. Credit: http://stackoverflow.com/questions/2892931/longest-common-substring-from-more-than-two-strings-python """ substr = '' if len(data) > 1 and len(data[0]) > 0: for i in range(len(data[0])): for j in range(len(data[0])-i+1): if j > len(substr) and all(data[0][i:i+j] in x for x in data): substr = data[0][i:i+j] elif len(data) == 1: substr = data[0] return substr def strip_email_quotes(text): """Strip leading email quotation characters ('>'). Removes any combination of leading '>' interspersed with whitespace that appears *identically* in all lines of the input text. Parameters ---------- text : str Examples -------- Simple uses:: In [2]: strip_email_quotes('> > text') Out[2]: 'text' In [3]: strip_email_quotes('> > text\\n> > more') Out[3]: 'text\\nmore' Note how only the common prefix that appears in all lines is stripped:: In [4]: strip_email_quotes('> > text\\n> > more\\n> more...') Out[4]: '> text\\n> more\\nmore...' So if any line has no quote marks ('>') , then none are stripped from any of them :: In [5]: strip_email_quotes('> > text\\n> > more\\nlast different') Out[5]: '> > text\\n> > more\\nlast different' """ lines = text.splitlines() matches = set() for line in lines: prefix = re.match(r'^(\s*>[ >]*)', line) if prefix: matches.add(prefix.group(1)) else: break else: prefix = long_substr(list(matches)) if prefix: strip = len(prefix) text = '\n'.join([ ln[strip:] for ln in lines]) return text class EvalFormatter(Formatter): """A String Formatter that allows evaluation of simple expressions. Note that this version interprets a : as specifying a format string (as per standard string formatting), so if slicing is required, you must explicitly create a slice. This is to be used in templating cases, such as the parallel batch script templates, where simple arithmetic on arguments is useful. Examples -------- In [1]: f = EvalFormatter() In [2]: f.format('{n//4}', n=8) Out [2]: '2' In [3]: f.format("{greeting[slice(2,4)]}", greeting="Hello") Out [3]: 'll' """ def get_field(self, name, args, kwargs): v = eval(name, kwargs) return v, name @skip_doctest_py3 class FullEvalFormatter(Formatter): """A String Formatter that allows evaluation of simple expressions. Any time a format key is not found in the kwargs, it will be tried as an expression in the kwargs namespace. Note that this version allows slicing using [1:2], so you cannot specify a format string. Use :class:`EvalFormatter` to permit format strings. Examples -------- In [1]: f = FullEvalFormatter() In [2]: f.format('{n//4}', n=8) Out[2]: u'2' In [3]: f.format('{list(range(5))[2:4]}') Out[3]: u'[2, 3]' In [4]: f.format('{3*2}') Out[4]: u'6' """ # copied from Formatter._vformat with minor changes to allow eval # and replace the format_spec code with slicing def _vformat(self, format_string, args, kwargs, used_args, recursion_depth): if recursion_depth < 0: raise ValueError('Max string recursion exceeded') result = [] for literal_text, field_name, format_spec, conversion in \ self.parse(format_string): # output the literal text if literal_text: result.append(literal_text) # if there's a field, output it if field_name is not None: # this is some markup, find the object and do # the formatting if format_spec: # override format spec, to allow slicing: field_name = ':'.join([field_name, format_spec]) # eval the contents of the field for the object # to be formatted obj = eval(field_name, kwargs) # do any conversion on the resulting object obj = self.convert_field(obj, conversion) # format the object and append to the result result.append(self.format_field(obj, '')) return u''.join(py3compat.cast_unicode(s) for s in result) @skip_doctest_py3 class DollarFormatter(FullEvalFormatter): """Formatter allowing Itpl style $foo replacement, for names and attribute access only. Standard {foo} replacement also works, and allows full evaluation of its arguments. Examples -------- In [1]: f = DollarFormatter() In [2]: f.format('{n//4}', n=8) Out[2]: u'2' In [3]: f.format('23 * 76 is $result', result=23*76) Out[3]: u'23 * 76 is 1748' In [4]: f.format('$a or {b}', a=1, b=2) Out[4]: u'1 or 2' """ _dollar_pattern = re.compile("(.*?)\$(\$?[\w\.]+)") def parse(self, fmt_string): for literal_txt, field_name, format_spec, conversion \ in Formatter.parse(self, fmt_string): # Find $foo patterns in the literal text. continue_from = 0 txt = "" for m in self._dollar_pattern.finditer(literal_txt): new_txt, new_field = m.group(1,2) # $$foo --> $foo if new_field.startswith("$"): txt += new_txt + new_field else: yield (txt + new_txt, new_field, "", None) txt = "" continue_from = m.end() # Re-yield the {foo} style pattern yield (txt + literal_txt[continue_from:], field_name, format_spec, conversion) #----------------------------------------------------------------------------- # Utils to columnize a list of string #----------------------------------------------------------------------------- def _chunks(l, n): """Yield successive n-sized chunks from l.""" for i in xrange(0, len(l), n): yield l[i:i+n] def _find_optimal(rlist , separator_size=2 , displaywidth=80): """Calculate optimal info to columnize a list of string""" for nrow in range(1, len(rlist)+1) : chk = map(max,_chunks(rlist, nrow)) sumlength = sum(chk) ncols = len(chk) if sumlength+separator_size*(ncols-1) <= displaywidth : break; return {'columns_numbers' : ncols, 'optimal_separator_width':(displaywidth - sumlength)/(ncols-1) if (ncols -1) else 0, 'rows_numbers' : nrow, 'columns_width' : chk } def _get_or_default(mylist, i, default=None): """return list item number, or default if don't exist""" if i >= len(mylist): return default else : return mylist[i] @skip_doctest def compute_item_matrix(items, empty=None, *args, **kwargs) : """Returns a nested list, and info to columnize items Parameters : ------------ items : list of strings to columize empty : (default None) default value to fill list if needed separator_size : int (default=2) How much caracters will be used as a separation between each columns. displaywidth : int (default=80) The width of the area onto wich the columns should enter Returns : --------- Returns a tuple of (strings_matrix, dict_info) strings_matrix : nested list of string, the outer most list contains as many list as rows, the innermost lists have each as many element as colums. If the total number of elements in `items` does not equal the product of rows*columns, the last element of some lists are filled with `None`. dict_info : some info to make columnize easier: columns_numbers : number of columns rows_numbers : number of rows columns_width : list of with of each columns optimal_separator_width : best separator width between columns Exemple : --------- In [1]: l = ['aaa','b','cc','d','eeeee','f','g','h','i','j','k','l'] ...: compute_item_matrix(l,displaywidth=12) Out[1]: ([['aaa', 'f', 'k'], ['b', 'g', 'l'], ['cc', 'h', None], ['d', 'i', None], ['eeeee', 'j', None]], {'columns_numbers': 3, 'columns_width': [5, 1, 1], 'optimal_separator_width': 2, 'rows_numbers': 5}) """ info = _find_optimal(map(len, items), *args, **kwargs) nrow, ncol = info['rows_numbers'], info['columns_numbers'] return ([[ _get_or_default(items, c*nrow+i, default=empty) for c in range(ncol) ] for i in range(nrow) ], info) def columnize(items, separator=' ', displaywidth=80): """ Transform a list of strings into a single string with columns. Parameters ---------- items : sequence of strings The strings to process. separator : str, optional [default is two spaces] The string that separates columns. displaywidth : int, optional [default is 80] Width of the display in number of characters. Returns ------- The formatted string. """ if not items : return '\n' matrix, info = compute_item_matrix(items, separator_size=len(separator), displaywidth=displaywidth) fmatrix = [filter(None, x) for x in matrix] sjoin = lambda x : separator.join([ y.ljust(w, ' ') for y, w in zip(x, info['columns_width'])]) return '\n'.join(map(sjoin, fmatrix))+'\n'
cloud9ers/gurumate
environment/lib/python2.7/site-packages/IPython/utils/text.py
Python
lgpl-3.0
25,044
using UnityEngine; using System.Collections; public class InputBehaviour : MonoBehaviour { // Cuando se llama, notifica a todos los métodos que hacen referencia al delegate (DownHandler). public delegate void DownHandler( int button ); // evento que se activa cuando aparece el DownHandler public event DownHandler onDown; // Funcion que se llama desde InputManger, activa el evento onDown de éste y otras clases public void triggerDown(int button){ if( onDown != null ) onDown(button); } }
ddacoak/Fallen-Instinct
Assets/Scripts/OtrosScripts/Input/InputBehaviour.cs
C#
unlicense
514
package org.myrobotlab.logging; import org.myrobotlab.framework.Platform; import org.slf4j.Logger; public class LoggerFactory { public static Logger getLogger(Class<?> clazz) { return getLogger(clazz.toString()); } public static Logger getLogger(String name) { Platform platform = Platform.getLocalInstance(); if (platform.isDalvik()) { String android = name.substring(name.lastIndexOf(".") + 1); if (android.length() > 23) android = android.substring(0, 23); // http://slf4j.42922.n3.nabble.com/ // Bug-173-New-slf4j-android-Android-throws-an-IllegalArgumentException-when-Log-Tag-length-exceeds-23-s-td443886.html return org.slf4j.LoggerFactory.getLogger(android); } else { return org.slf4j.LoggerFactory.getLogger(name); } } }
lanchun/myrobotlab
src/org/myrobotlab/logging/LoggerFactory.java
Java
apache-2.0
771
from __future__ import division, absolute_import from __future__ import print_function, unicode_literals import numpy as np import theano import theano.tensor as T import treeano import treeano.nodes as tn fX = theano.config.floatX # ################################## config ################################## N_TRAIN = 5000 LAG = 20 LENGTH = 50 HIDDEN_STATE_SIZE = 10 # ############################### prepare data ############################### def binary_toy_data(lag=1, length=20): inputs = np.random.randint(0, 2, length).astype(fX) outputs = np.array(lag * [0] + list(inputs), dtype=fX)[:length] return inputs, outputs # ############################## prepare model ############################## model = tn.HyperparameterNode( "model", tn.SequentialNode( "seq", [tn.InputNode("x", shape=(None, 1)), tn.recurrent.SimpleRecurrentNode( "srn", tn.TanhNode("nonlin"), batch_size=None, num_units=HIDDEN_STATE_SIZE), tn.scan.ScanNode( "scan", tn.DenseNode("fc", num_units=1)), tn.SigmoidNode("pred"), ]), inits=[treeano.inits.NormalWeightInit(0.01)], batch_axis=None, scan_axis=0 ) with_updates = tn.HyperparameterNode( "with_updates", tn.SGDNode( "adam", {"subtree": model, "cost": tn.TotalCostNode("cost", { "pred": tn.ReferenceNode("pred_ref", reference="model"), "target": tn.InputNode("y", shape=(None, 1))}, )}), learning_rate=0.1, cost_function=treeano.utils.squared_error, ) network = with_updates.network() train_fn = network.function(["x", "y"], ["cost"], include_updates=True) valid_fn = network.function(["x"], ["model"]) # ################################# training ################################# print("Starting training...") import time st = time.time() for i in range(N_TRAIN): inputs, outputs = binary_toy_data(lag=LAG, length=LENGTH) loss = train_fn(inputs.reshape(-1, 1), outputs.reshape(-1, 1))[0] if (i % (N_TRAIN // 100)) == 0: print(loss) print("total_time: %s" % (time.time() - st)) inputs, outputs = binary_toy_data(lag=LAG, length=LENGTH) pred = valid_fn(inputs.reshape(-1, 1))[0].flatten() print(np.round(pred) == outputs)
diogo149/treeano
examples/simple_rnn_comparison/with_treeano.py
Python
apache-2.0
2,330
/** * Copyright 2016 LinkedIn Corp. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */ package com.github.ambry.store; import java.io.DataInputStream; import java.io.IOException; /** * Factory to create an index key */ public interface StoreKeyFactory { /** * The store key created using the stream provided * @param stream The stream used to create the store key * @return The store key created from the stream */ StoreKey getStoreKey(DataInputStream stream) throws IOException; }
nsivabalan/ambry
ambry-api/src/main/java/com.github.ambry/store/StoreKeyFactory.java
Java
apache-2.0
929
/* * Copyright 2010-2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #include <aws/route53/model/ListTrafficPoliciesRequest.h> #include <aws/core/utils/xml/XmlSerializer.h> #include <aws/core/utils/memory/stl/AWSStringStream.h> #include <aws/core/http/URI.h> #include <aws/core/utils/memory/stl/AWSStringStream.h> #include <utility> using namespace Aws::Route53::Model; using namespace Aws::Utils::Xml; using namespace Aws::Utils; using namespace Aws::Http; ListTrafficPoliciesRequest::ListTrafficPoliciesRequest() : m_trafficPolicyIdMarkerHasBeenSet(false), m_maxItemsHasBeenSet(false) { } Aws::String ListTrafficPoliciesRequest::SerializePayload() const { return ""; } void ListTrafficPoliciesRequest::AddQueryStringParameters(URI& uri) const { Aws::StringStream ss; if(m_trafficPolicyIdMarkerHasBeenSet) { ss << m_trafficPolicyIdMarker; uri.AddQueryStringParameter("trafficpolicyid", ss.str()); ss.str(""); } if(m_maxItemsHasBeenSet) { ss << m_maxItems; uri.AddQueryStringParameter("maxitems", ss.str()); ss.str(""); } }
JoyIfBam5/aws-sdk-cpp
aws-cpp-sdk-route53/source/model/ListTrafficPoliciesRequest.cpp
C++
apache-2.0
1,614
/* Copyright 2015 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package cmd import ( "fmt" "io" "github.com/renstrom/dedent" "k8s.io/kubernetes/pkg/kubectl" cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util" "k8s.io/kubernetes/pkg/kubectl/resource" utilerrors "k8s.io/kubernetes/pkg/util/errors" "github.com/spf13/cobra" ) var ( autoscaleLong = dedent.Dedent(` Creates an autoscaler that automatically chooses and sets the number of pods that run in a kubernetes cluster. Looks up a Deployment, ReplicaSet, or ReplicationController by name and creates an autoscaler that uses the given resource as a reference. An autoscaler can automatically increase or decrease number of pods deployed within the system as needed.`) autoscaleExample = dedent.Dedent(` # Auto scale a deployment "foo", with the number of pods between 2 and 10, target CPU utilization specified so a default autoscaling policy will be used: kubectl autoscale deployment foo --min=2 --max=10 # Auto scale a replication controller "foo", with the number of pods between 1 and 5, target CPU utilization at 80%: kubectl autoscale rc foo --max=5 --cpu-percent=80`) ) func NewCmdAutoscale(f cmdutil.Factory, out io.Writer) *cobra.Command { options := &resource.FilenameOptions{} validArgs := []string{"deployment", "replicaset", "replicationcontroller"} argAliases := kubectl.ResourceAliases(validArgs) cmd := &cobra.Command{ Use: "autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU] [flags]", Short: "Auto-scale a Deployment, ReplicaSet, or ReplicationController", Long: autoscaleLong, Example: autoscaleExample, Run: func(cmd *cobra.Command, args []string) { err := RunAutoscale(f, out, cmd, args, options) cmdutil.CheckErr(err) }, ValidArgs: validArgs, ArgAliases: argAliases, } cmdutil.AddPrinterFlags(cmd) cmd.Flags().String("generator", "horizontalpodautoscaler/v1", "The name of the API generator to use. Currently there is only 1 generator.") cmd.Flags().Int("min", -1, "The lower limit for the number of pods that can be set by the autoscaler. If it's not specified or negative, the server will apply a default value.") cmd.Flags().Int("max", -1, "The upper limit for the number of pods that can be set by the autoscaler. Required.") cmd.MarkFlagRequired("max") cmd.Flags().Int("cpu-percent", -1, fmt.Sprintf("The target average CPU utilization (represented as a percent of requested CPU) over all the pods. If it's not specified or negative, a default autoscaling policy will be used.")) cmd.Flags().String("name", "", "The name for the newly created object. If not specified, the name of the input resource will be used.") cmdutil.AddDryRunFlag(cmd) usage := "identifying the resource to autoscale." cmdutil.AddFilenameOptionFlags(cmd, options, usage) cmdutil.AddApplyAnnotationFlags(cmd) cmdutil.AddRecordFlag(cmd) cmdutil.AddInclude3rdPartyFlags(cmd) return cmd } func RunAutoscale(f cmdutil.Factory, out io.Writer, cmd *cobra.Command, args []string, options *resource.FilenameOptions) error { namespace, enforceNamespace, err := f.DefaultNamespace() if err != nil { return err } // validate flags if err := validateFlags(cmd); err != nil { return err } mapper, typer := f.Object() r := resource.NewBuilder(mapper, typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)). ContinueOnError(). NamespaceParam(namespace).DefaultNamespace(). FilenameParam(enforceNamespace, options). ResourceTypeOrNameArgs(false, args...). Flatten(). Do() err = r.Err() if err != nil { return err } // Get the generator, setup and validate all required parameters generatorName := cmdutil.GetFlagString(cmd, "generator") generators := f.Generators("autoscale") generator, found := generators[generatorName] if !found { return cmdutil.UsageError(cmd, fmt.Sprintf("generator %q not found.", generatorName)) } names := generator.ParamNames() count := 0 err = r.Visit(func(info *resource.Info, err error) error { if err != nil { return err } mapping := info.ResourceMapping() if err := f.CanBeAutoscaled(mapping.GroupVersionKind.GroupKind()); err != nil { return err } name := info.Name params := kubectl.MakeParams(cmd, names) params["default-name"] = name params["scaleRef-kind"] = mapping.GroupVersionKind.Kind params["scaleRef-name"] = name params["scaleRef-apiVersion"] = mapping.GroupVersionKind.GroupVersion().String() if err = kubectl.ValidateParams(names, params); err != nil { return err } // Check for invalid flags used against the present generator. if err := kubectl.EnsureFlagsValid(cmd, generators, generatorName); err != nil { return err } // Generate new object object, err := generator.Generate(params) if err != nil { return err } resourceMapper := &resource.Mapper{ ObjectTyper: typer, RESTMapper: mapper, ClientMapper: resource.ClientMapperFunc(f.ClientForMapping), Decoder: f.Decoder(true), } hpa, err := resourceMapper.InfoForObject(object, nil) if err != nil { return err } if cmdutil.ShouldRecord(cmd, hpa) { if err := cmdutil.RecordChangeCause(hpa.Object, f.Command()); err != nil { return err } object = hpa.Object } if cmdutil.GetDryRunFlag(cmd) { return f.PrintObject(cmd, mapper, object, out) } if err := kubectl.CreateOrUpdateAnnotation(cmdutil.GetFlagBool(cmd, cmdutil.ApplyAnnotationsFlag), hpa, f.JSONEncoder()); err != nil { return err } object, err = resource.NewHelper(hpa.Client, hpa.Mapping).Create(namespace, false, object) if err != nil { return err } count++ if len(cmdutil.GetFlagString(cmd, "output")) > 0 { return f.PrintObject(cmd, mapper, object, out) } cmdutil.PrintSuccess(mapper, false, out, info.Mapping.Resource, info.Name, cmdutil.GetDryRunFlag(cmd), "autoscaled") return nil }) if err != nil { return err } if count == 0 { return fmt.Errorf("no objects passed to autoscale") } return nil } func validateFlags(cmd *cobra.Command) error { errs := []error{} max, min := cmdutil.GetFlagInt(cmd, "max"), cmdutil.GetFlagInt(cmd, "min") if max < 1 { errs = append(errs, fmt.Errorf("--max=MAXPODS is required and must be at least 1, max: %d", max)) } if max < min { errs = append(errs, fmt.Errorf("--max=MAXPODS must be larger or equal to --min=MINPODS, max: %d, min: %d", max, min)) } return utilerrors.NewAggregate(errs) }
gluke77/kubernetes
pkg/kubectl/cmd/autoscale.go
GO
apache-2.0
6,991
#!/usr/bin/env python # -*- coding: utf-8 -*- # # This file is subject to the terms and conditions defined in # file 'LICENSE.md', which is part of this source code package. # from kubernetes_py.K8sExceptions import NotFoundException from kubernetes_py.K8sObject import K8sObject from kubernetes_py.K8sPod import K8sPod from kubernetes_py.models.v1beta1.ReplicaSet import ReplicaSet class K8sReplicaSet(K8sObject): """ http://kubernetes.io/docs/api-reference/extensions/v1beta1/definitions/#_v1beta1_replicaset """ REVISION_ANNOTATION = "deployment.kubernetes.io/revision" REVISION_HISTORY_ANNOTATION = "deployment.kubernetes.io/revision-history" def __init__(self, config=None, name=None): super(K8sReplicaSet, self).__init__(config=config, obj_type="ReplicaSet", name=name) # ------------------------------------------------------------------------------------- override def get(self): self.model = ReplicaSet(self.get_model()) return self def list(self, pattern=None, reverse=True, labels=None): ls = super(K8sReplicaSet, self).list(labels=labels) rsets = list(map(lambda x: ReplicaSet(x), ls)) if pattern is not None: rsets = list(filter(lambda x: pattern in x.name, rsets)) k8s = [] for x in rsets: j = K8sReplicaSet(config=self.config, name=x.name).from_model(m=x) k8s.append(j) k8s.sort(key=lambda x: x.creation_timestamp, reverse=reverse) return k8s def delete(self, cascade=False): super(K8sReplicaSet, self).delete(cascade) if cascade: pods = K8sPod(config=self.config, name="yo").list(pattern=self.name) for pod in pods: try: pod.delete(cascade) except NotFoundException: pass return self # ------------------------------------------------------------------------------------- revision @property def revision(self): if self.REVISION_ANNOTATION in self.model.metadata.annotations: return self.model.metadata.annotations[self.REVISION_ANNOTATION] return None @revision.setter def revision(self, r=None): raise NotImplementedError("K8sReplicaSet: revision is read-only.") # ------------------------------------------------------------------------------------- revision history @property def revision_history(self): if self.REVISION_HISTORY_ANNOTATION in self.model.metadata.annotations: comma_string = self.model.metadata.annotations[self.REVISION_HISTORY_ANNOTATION] version_array = comma_string.split(",") return map(lambda x: int(x), version_array) return None @revision_history.setter def revision_history(self, r=None): raise NotImplementedError("K8sReplicaSet: revision_history is read-only.")
mnubo/kubernetes-py
kubernetes_py/K8sReplicaSet.py
Python
apache-2.0
2,940
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.activemq.artemis.utils.network; import java.io.PrintWriter; import java.io.StringWriter; import java.net.InetAddress; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.atomic.AtomicInteger; import org.apache.activemq.artemis.core.server.NetworkHealthCheck; import org.apache.activemq.artemis.utils.ExecuteUtil; import org.junit.Assert; import org.junit.Assume; import org.junit.Test; /** * This utility class will use sudo commands to start "fake" network cards on a given address. * It's used on tests that need to emmulate network outages and split brains. * * If you write a new test using this class, please make special care on undoing the config, * especially in case of failures. * * Usually the class {@link NetUtilResource} is pretty accurate on undoing this, but you also need to *test your test* well. * * You need special sudo authorizations on your system to let this class work: * * Add the following at the end of your /etc/sudoers (use the sudo visudo command)"); * # ------------------------------------------------------- "); * yourUserName ALL = NOPASSWD: /sbin/ifconfig"); * # ------------------------------------------------------- "); * */ public class NetUtil extends ExecuteUtil { public static boolean checkIP(String ip) throws Exception { InetAddress ipAddress = null; try { ipAddress = InetAddress.getByName(ip); } catch (Exception e) { e.printStackTrace(); // not supposed to happen return false; } NetworkHealthCheck healthCheck = new NetworkHealthCheck(null, 100, 100); return healthCheck.check(ipAddress); } public static AtomicInteger nextDevice = new AtomicInteger(0); // IP / device (device being only valid on linux) public static Map<String, String> networks = new ConcurrentHashMap<>(); private enum OS { MAC, LINUX, NON_SUPORTED; } static final OS osUsed; static final String user = System.getProperty("user.name"); static { OS osTmp; String propOS = System.getProperty("os.name").toUpperCase(); if (propOS.contains("MAC")) { osTmp = OS.MAC; } else if (propOS.contains("LINUX")) { osTmp = OS.LINUX; } else { osTmp = OS.NON_SUPORTED; } osUsed = osTmp; } public static void failIfNotSudo() { Assume.assumeTrue("non supported OS", osUsed != OS.NON_SUPORTED); if (!canSudo()) { StringWriter writer = new StringWriter(); PrintWriter out = new PrintWriter(writer); out.println("Add the following at the end of your /etc/sudoers (use the visudo command)"); out.println("# ------------------------------------------------------- "); out.println(user + " ALL = NOPASSWD: /sbin/ifconfig"); out.println("# ------------------------------------------------------- "); Assert.fail(writer.toString()); } } public static void cleanup() { nextDevice.set(0); Set entrySet = networks.entrySet(); Iterator iter = entrySet.iterator(); while (iter.hasNext()) { Map.Entry<String, String> entry = (Map.Entry<String, String>) iter.next(); try { netDown(entry.getKey(), entry.getValue(), true); } catch (Exception e) { e.printStackTrace(); } } } public static void netUp(String ip) throws Exception { String deviceID = "lo:" + nextDevice.incrementAndGet(); netUp(ip, deviceID); } public static void netUp(String ip, String deviceID) throws Exception { if (osUsed == OS.MAC) { if (runCommand(false, "sudo", "-n", "ifconfig", "lo0", "alias", ip) != 0) { Assert.fail("Cannot sudo ifconfig for ip " + ip); } networks.put(ip, "lo0"); } else if (osUsed == OS.LINUX) { if (runCommand(false, "sudo", "-n", "ifconfig", deviceID, ip, "netmask", "255.0.0.0") != 0) { Assert.fail("Cannot sudo ifconfig for ip " + ip); } networks.put(ip, deviceID); } else { Assert.fail("OS not supported"); } } public static void netDown(String ip) throws Exception { netDown(ip, false); } public static void netDown(String ip, boolean force) throws Exception { String device = networks.remove(ip); if (!force) { // in case the netDown is coming from a different VM (spawned tests) Assert.assertNotNull("ip " + ip + "wasn't set up before", device); } netDown(ip, device, force); } public static void netDown(String ip, String device, boolean force) throws Exception { networks.remove(ip); if (osUsed == OS.MAC) { if (runCommand(false, "sudo", "-n", "ifconfig", "lo0", "-alias", ip) != 0) { if (!force) { Assert.fail("Cannot sudo ifconfig for ip " + ip); } } } else if (osUsed == OS.LINUX) { if (runCommand(false, "sudo", "-n", "ifconfig", device, "down") != 0) { if (!force) { Assert.fail("Cannot sudo ifconfig for ip " + ip); } } } else { Assert.fail("OS not supported"); } } public static boolean canSudo() { try { return runCommand(false, "sudo", "-n", "ifconfig") == 0; } catch (Exception e) { e.printStackTrace(); return false; } } @Test public void testCanSudo() throws Exception { Assert.assertTrue(canSudo()); } }
kjniemi/activemq-artemis
artemis-commons/src/test/java/org/apache/activemq/artemis/utils/network/NetUtil.java
Java
apache-2.0
6,434
/* Copyright 2017 IBM Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package main import "fmt" func main() { fmt.Println("Hello, World") }
denilsonm/advance-toolchain
fvtr/gccgo/test.go
GO
apache-2.0
669
<?php /** * Copyright 2016 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ namespace Google\Cloud\PubSub\Tests\Snippet; use Google\Cloud\Core\Testing\Snippet\SnippetTestCase; use Google\Cloud\PubSub\BatchPublisher; use Google\Cloud\PubSub\PubSubClient; use Google\Cloud\PubSub\Topic; use Prophecy\Argument; /** * @group pubsub */ class BatchPublisherTest extends SnippetTestCase { private $batchPublisher; public function setUp() { $this->batchPublisher = $this->prophesize(BatchPublisher::class); $this->batchPublisher->publish([ 'data' => 'An important message.' ]) ->willReturn(true); } public function testClass() { $snippet = $this->snippetFromClass(BatchPublisher::class); $topic = $this->prophesize(Topic::class); $topic->batchPublisher() ->willReturn($this->batchPublisher->reveal()); $pubsub = $this->prophesize(PubSubClient::class); $pubsub->topic(Argument::type('string')) ->willReturn($topic->reveal()); $snippet->setLine(2, ''); $snippet->addLocal('pubsub', $pubsub->reveal()); $snippet->invoke(); } public function testPublish() { $snippet = $this->snippetFromMethod(BatchPublisher::class, 'publish'); $snippet->addLocal('batchPublisher', $this->batchPublisher->reveal()); $snippet->invoke(); } }
googleapis/google-cloud-php-pubsub
tests/Snippet/BatchPublisherTest.php
PHP
apache-2.0
1,948
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution; public class IllegalEnvVarException extends ExecutionException { public IllegalEnvVarException(String message) { super(message); } }
mdanielwork/intellij-community
platform/platform-api/src/com/intellij/execution/IllegalEnvVarException.java
Java
apache-2.0
314
<?php // Start of AMQPExchangeException from php-amqp v.1.4.0beta2 /** * stub class representing AMQPExchangeException from pecl-amqp * @jms-builtin */ class AMQPExchangeException extends AMQPException { } // End of AMQPExchangeException from php-amqp v.1.4.0beta2 ?>
walkeralencar/ci-php-analyzer
res/php-5.4-core-api/AMQPExchangeException.php
PHP
apache-2.0
273
<?php # Generated by the protocol buffer compiler. DO NOT EDIT! # source: google/cloud/gaming/v1/game_server_deployments.proto namespace Google\Cloud\Gaming\V1; use Google\Protobuf\Internal\GPBType; use Google\Protobuf\Internal\RepeatedField; use Google\Protobuf\Internal\GPBUtil; /** * Request message for GameServerDeploymentsService.GetGameServerDeployment. * * Generated from protobuf message <code>google.cloud.gaming.v1.GetGameServerDeploymentRequest</code> */ class GetGameServerDeploymentRequest extends \Google\Protobuf\Internal\Message { /** * Required. The name of the game server delpoyment to retrieve, in the following form: * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}`. * * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> */ private $name = ''; /** * Constructor. * * @param array $data { * Optional. Data for populating the Message object. * * @type string $name * Required. The name of the game server delpoyment to retrieve, in the following form: * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}`. * } */ public function __construct($data = NULL) { \GPBMetadata\Google\Cloud\Gaming\V1\GameServerDeployments::initOnce(); parent::__construct($data); } /** * Required. The name of the game server delpoyment to retrieve, in the following form: * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}`. * * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> * @return string */ public function getName() { return $this->name; } /** * Required. The name of the game server delpoyment to retrieve, in the following form: * `projects/{project}/locations/{location}/gameServerDeployments/{deployment}`. * * Generated from protobuf field <code>string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = {</code> * @param string $var * @return $this */ public function setName($var) { GPBUtil::checkString($var, True); $this->name = $var; return $this; } }
googleapis/google-cloud-php-game-servers
src/V1/GetGameServerDeploymentRequest.php
PHP
apache-2.0
2,444
// Copyright 2020 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package pbtesting import ( "fmt" "github.com/golang/mock/gomock" "github.com/golang/protobuf/proto" "github.com/google/go-cmp/cmp" "google.golang.org/protobuf/testing/protocmp" ) type protoMatcher struct { expected proto.Message } func (m protoMatcher) Got(got interface{}) string { message, ok := got.(proto.Message) if !ok { return fmt.Sprintf("%v", ok) } return proto.MarshalTextString(message) } func (m protoMatcher) Matches(actual interface{}) bool { return cmp.Diff(m.expected, actual, protocmp.Transform()) == "" } func (m protoMatcher) String() string { return proto.MarshalTextString(m.expected) } func ProtoEquals(expected proto.Message) gomock.Matcher { return protoMatcher{expected} }
adjackura/compute-image-tools
proto/go/pbtesting/gomock_matcher.go
GO
apache-2.0
1,340
// Copyright 2009 the Sputnik authors. All rights reserved. // This code is governed by the BSD license found in the LICENSE file. /*--- info: > The initial value of Boolean.prototype is the Boolean prototype object es5id: 15.6.3.1_A1 description: Checking Boolean.prototype property ---*/ //CHECK#1 if (typeof Boolean.prototype !== "object") { $ERROR('#1: typeof Boolean.prototype === "object"'); } //CHECK#2 if (Boolean.prototype != false) { $ERROR('#2: Boolean.prototype == false'); } delete Boolean.prototype.toString; if (Boolean.prototype.toString() !== "[object Boolean]") { $ERROR('#3: The [[Class]] property of the Boolean prototype object is set to "Boolean"'); }
m0ppers/arangodb
3rdParty/V8/V8-5.0.71.39/test/test262/data/test/built-ins/Boolean/prototype/S15.6.3.1_A1.js
JavaScript
apache-2.0
694
/* * Copyright (C) 2007 Júlio Vilmar Gesser. * * This file is part of Java 1.5 parser and Abstract Syntax Tree. * * Java 1.5 parser and Abstract Syntax Tree is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Java 1.5 parser and Abstract Syntax Tree is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with Java 1.5 parser and Abstract Syntax Tree. If not, see <http://www.gnu.org/licenses/>. */ /* * Created on 05/10/2006 */ package japa.parser.ast.expr; import japa.parser.ast.visitor.GenericVisitor; import japa.parser.ast.visitor.VoidVisitor; import java.util.List; /** * @author Julio Vilmar Gesser */ public final class ArrayInitializerExpr extends Expression { private List<Expression> values; public ArrayInitializerExpr() { } public ArrayInitializerExpr(List<Expression> values) { this.values = values; } public ArrayInitializerExpr(int beginLine, int beginColumn, int endLine, int endColumn, List<Expression> values) { super(beginLine, beginColumn, endLine, endColumn); this.values = values; } @Override public <R, A> R accept(GenericVisitor<R, A> v, A arg) { return v.visit(this, arg); } @Override public <A> void accept(VoidVisitor<A> v, A arg) { v.visit(this, arg); } public List<Expression> getValues() { return values; } public void setValues(List<Expression> values) { this.values = values; } }
irblsensitivity/irblsensitivity
techniques/BRTracer/src/japa/parser/ast/expr/ArrayInitializerExpr.java
Java
apache-2.0
1,995
package fr.free.nrw.commons.explore; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; import androidx.viewpager.widget.ViewPager; /** * ParentViewPager A custom viewPager whose scrolling can be enabled and disabled. */ public class ParentViewPager extends ViewPager { /** * Boolean variable that stores the current state of pager scroll i.e(enabled or disabled) */ private boolean canScroll = true; /** * Default constructors */ public ParentViewPager(Context context) { super(context); } public ParentViewPager(Context context, AttributeSet attrs) { super(context, attrs); } /** * Setter method for canScroll. */ public void setCanScroll(boolean canScroll) { this.canScroll = canScroll; } /** * Getter method for canScroll. */ public boolean isCanScroll() { return canScroll; } /** * Method that prevents scrolling if canScroll is set to false. */ @Override public boolean onTouchEvent(MotionEvent ev) { return canScroll && super.onTouchEvent(ev); } /** * A facilitator method that allows parent to intercept touch events before its children. thus * making it possible to prevent swiping parent on child end. */ @Override public boolean onInterceptTouchEvent(MotionEvent ev) { return canScroll && super.onInterceptTouchEvent(ev); } }
commons-app/apps-android-commons
app/src/main/java/fr/free/nrw/commons/explore/ParentViewPager.java
Java
apache-2.0
1,500
package liquibase.diff.compare.core; import liquibase.CatalogAndSchema; import liquibase.database.Database; import liquibase.diff.compare.CompareControl; import liquibase.diff.compare.DatabaseObjectComparator; import liquibase.util.StringUtil; /** * DatabaseObjectComparator for Catalog and Schema comparators with common stuff */ public abstract class CommonCatalogSchemaComparator implements DatabaseObjectComparator { protected boolean equalsSchemas(Database accordingTo, String schemaName1, String schemaName2) { if (CatalogAndSchema.CatalogAndSchemaCase.ORIGINAL_CASE.equals(accordingTo.getSchemaAndCatalogCase())){ return StringUtil.trimToEmpty(schemaName1).equals(StringUtil.trimToEmpty(schemaName2)); } else { return StringUtil.trimToEmpty(schemaName1).equalsIgnoreCase(StringUtil.trimToEmpty(schemaName2)); } } protected String getComparisonSchemaOrCatalog(Database accordingTo, CompareControl.SchemaComparison comparison) { if (accordingTo.supportsSchemas()) { return comparison.getComparisonSchema().getSchemaName(); } else if (accordingTo.supportsCatalogs()) { return comparison.getComparisonSchema().getCatalogName(); } return null; } protected String getReferenceSchemaOrCatalog(Database accordingTo, CompareControl.SchemaComparison comparison) { if (accordingTo.supportsSchemas()) { return comparison.getReferenceSchema().getSchemaName(); } else if (accordingTo.supportsCatalogs()) { return comparison.getReferenceSchema().getCatalogName(); } return null; } }
liquibase/liquibase
liquibase-core/src/main/java/liquibase/diff/compare/core/CommonCatalogSchemaComparator.java
Java
apache-2.0
1,666
/* Copyright 2016 VMware, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include "noMatch.h" #include "frontends/p4/coreLibrary.h" namespace P4 { const IR::Node* DoHandleNoMatch::postorder(IR::SelectExpression* expression) { for (auto c : expression->selectCases) { if (c->keyset->is<IR::DefaultExpression>()) return expression; } CHECK_NULL(noMatch); auto sc = new IR::SelectCase( new IR::DefaultExpression(), new IR::PathExpression(noMatch->getName())); expression->selectCases.push_back(sc); return expression; } const IR::Node* DoHandleNoMatch::preorder(IR::P4Parser* parser) { P4CoreLibrary& lib = P4CoreLibrary::instance; cstring name = nameGen->newName("noMatch"); LOG2("Inserting " << name << " state"); auto args = new IR::Vector<IR::Argument>(); args->push_back(new IR::Argument(new IR::BoolLiteral(false))); args->push_back(new IR::Argument(new IR::Member( new IR::TypeNameExpression(IR::Type_Error::error), lib.noMatch.Id()))); auto verify = new IR::MethodCallExpression( new IR::PathExpression(IR::ID(IR::ParserState::verify)), args); noMatch = new IR::ParserState(IR::ID(name), { new IR::MethodCallStatement(verify) }, new IR::PathExpression(IR::ID(IR::ParserState::reject))); parser->states.push_back(noMatch); return parser; } } // namespace P4
hanw/p4c
midend/noMatch.cpp
C++
apache-2.0
1,905
/* * JBoss, Home of Professional Open Source. * Copyright 2014 Red Hat, Inc., and individual contributors * as indicated by the @author tags. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 'use strict'; (function() { var module = angular.module('pnc.common.restclient'); /** * @ngdoc service * @name pnc.common.restclient:Build * @description * */ module.factory('Build', [ 'BuildRecordDAO', 'RunningBuildRecordDAO', '$q', function(BuildRecordDAO, RunningBuildRecordDAO, $q) { return { get: function(spec) { var deffered = $q.defer(); function overrideRejection(response) { return $q.when(response); } /* * In order to return the BuildRecord regardless of whether it is in * progress or compelted we must attempt to fetch both the * RunningBuild and the BuildRecord for the given ID in parralell * (Unless something went wrong one of these requests should succeed * and one fail). As such we have to catch the rejection for the * request that failed and return a resolved promise. We can then * check which request succeeded in the success callback and resolve * the promise returned to the user with it. */ $q.all([ BuildRecordDAO.get(spec).$promise.catch(overrideRejection), RunningBuildRecordDAO.get(spec).$promise.catch(overrideRejection) ]).then( function(results) { // Success - return whichever record we successfully pulled down. if (results[0].id) { deffered.resolve(results[0]); } else if (results[1].id) { deffered.resolve(results[1]); } else { deffered.reject(results); } }, function(results) { // Error deffered.reject(results); } ); return deffered.promise; } }; } ]); })();
emmettu/pnc
ui/app/common/restclient/services/Build.js
JavaScript
apache-2.0
2,590
''' Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ''' from unittest import TestCase from resource_management.libraries.functions import get_port_from_url from resource_management.core.exceptions import Fail class TestLibraryFunctions(TestCase): def test_get_port_from_url(self): self.assertEqual("8080",get_port_from_url("protocol://host:8080")) self.assertEqual("8080",get_port_from_url("protocol://host:8080/")) self.assertEqual("8080",get_port_from_url("host:8080")) self.assertEqual("8080",get_port_from_url("host:8080/")) self.assertEqual("8080",get_port_from_url("host:8080/dots_in_url8888:")) self.assertEqual("8080",get_port_from_url("protocol://host:8080/dots_in_url8888:")) self.assertEqual("8080",get_port_from_url("127.0.0.1:8080")) self.assertRaises(Fail, get_port_from_url, "http://host/no_port") self.assertRaises(Fail, get_port_from_url, "127.0.0.1:808080")
arenadata/ambari
ambari-agent/src/test/python/resource_management/TestLibraryFunctions.py
Python
apache-2.0
1,624
/* * Copyright (C) 2008 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.example.android.apis.graphics; import android.app.Activity; import android.opengl.GLSurfaceView; import android.os.Bundle; public class TriangleActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mGLView = new GLSurfaceView(this); mGLView.setEGLConfigChooser(false); mGLView.setRenderer(new StaticTriangleRenderer(this)); setContentView(mGLView); } @Override protected void onPause() { super.onPause(); mGLView.onPause(); } @Override protected void onResume() { super.onResume(); mGLView.onResume(); } private GLSurfaceView mGLView; }
huang-qiao/ApiDemos-ASProject
app/src/main/java/com/example/android/apis/graphics/TriangleActivity.java
Java
apache-2.0
1,361
/* * Copyright (c) 1994, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package java.util; import java.io.IOException; import java.io.ObjectInputStream; import java.io.StreamCorruptedException; import java.util.function.Consumer; import java.util.function.Predicate; import java.util.function.UnaryOperator; import jdk.internal.util.ArraysSupport; /** * The {@code Vector} class implements a growable array of * objects. Like an array, it contains components that can be * accessed using an integer index. However, the size of a * {@code Vector} can grow or shrink as needed to accommodate * adding and removing items after the {@code Vector} has been created. * * <p>Each vector tries to optimize storage management by maintaining a * {@code capacity} and a {@code capacityIncrement}. The * {@code capacity} is always at least as large as the vector * size; it is usually larger because as components are added to the * vector, the vector's storage increases in chunks the size of * {@code capacityIncrement}. An application can increase the * capacity of a vector before inserting a large number of * components; this reduces the amount of incremental reallocation. * * <p id="fail-fast"> * The iterators returned by this class's {@link #iterator() iterator} and * {@link #listIterator(int) listIterator} methods are <em>fail-fast</em>: * if the vector is structurally modified at any time after the iterator is * created, in any way except through the iterator's own * {@link ListIterator#remove() remove} or * {@link ListIterator#add(Object) add} methods, the iterator will throw a * {@link ConcurrentModificationException}. Thus, in the face of * concurrent modification, the iterator fails quickly and cleanly, rather * than risking arbitrary, non-deterministic behavior at an undetermined * time in the future. The {@link Enumeration Enumerations} returned by * the {@link #elements() elements} method are <em>not</em> fail-fast; if the * Vector is structurally modified at any time after the enumeration is * created then the results of enumerating are undefined. * * <p>Note that the fail-fast behavior of an iterator cannot be guaranteed * as it is, generally speaking, impossible to make any hard guarantees in the * presence of unsynchronized concurrent modification. Fail-fast iterators * throw {@code ConcurrentModificationException} on a best-effort basis. * Therefore, it would be wrong to write a program that depended on this * exception for its correctness: <i>the fail-fast behavior of iterators * should be used only to detect bugs.</i> * * <p>As of the Java 2 platform v1.2, this class was retrofitted to * implement the {@link List} interface, making it a member of the * <a href="{@docRoot}/java.base/java/util/package-summary.html#CollectionsFramework"> * Java Collections Framework</a>. Unlike the new collection * implementations, {@code Vector} is synchronized. If a thread-safe * implementation is not needed, it is recommended to use {@link * ArrayList} in place of {@code Vector}. * * @param <E> Type of component elements * * @author Lee Boynton * @author Jonathan Payne * @see Collection * @see LinkedList * @since 1.0 */ public class Vector<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, java.io.Serializable { /** * The array buffer into which the components of the vector are * stored. The capacity of the vector is the length of this array buffer, * and is at least large enough to contain all the vector's elements. * * <p>Any array elements following the last element in the Vector are null. * * @serial */ @SuppressWarnings("serial") // Conditionally serializable protected Object[] elementData; /** * The number of valid components in this {@code Vector} object. * Components {@code elementData[0]} through * {@code elementData[elementCount-1]} are the actual items. * * @serial */ protected int elementCount; /** * The amount by which the capacity of the vector is automatically * incremented when its size becomes greater than its capacity. If * the capacity increment is less than or equal to zero, the capacity * of the vector is doubled each time it needs to grow. * * @serial */ protected int capacityIncrement; /** use serialVersionUID from JDK 1.0.2 for interoperability */ @java.io.Serial private static final long serialVersionUID = -2767605614048989439L; /** * Constructs an empty vector with the specified initial capacity and * capacity increment. * * @param initialCapacity the initial capacity of the vector * @param capacityIncrement the amount by which the capacity is * increased when the vector overflows * @throws IllegalArgumentException if the specified initial capacity * is negative */ public Vector(int initialCapacity, int capacityIncrement) { super(); if (initialCapacity < 0) throw new IllegalArgumentException("Illegal Capacity: "+ initialCapacity); this.elementData = new Object[initialCapacity]; this.capacityIncrement = capacityIncrement; } /** * Constructs an empty vector with the specified initial capacity and * with its capacity increment equal to zero. * * @param initialCapacity the initial capacity of the vector * @throws IllegalArgumentException if the specified initial capacity * is negative */ public Vector(int initialCapacity) { this(initialCapacity, 0); } /** * Constructs an empty vector so that its internal data array * has size {@code 10} and its standard capacity increment is * zero. */ public Vector() { this(10); } /** * Constructs a vector containing the elements of the specified * collection, in the order they are returned by the collection's * iterator. * * @param c the collection whose elements are to be placed into this * vector * @throws NullPointerException if the specified collection is null * @since 1.2 */ public Vector(Collection<? extends E> c) { Object[] a = c.toArray(); elementCount = a.length; if (c.getClass() == ArrayList.class) { elementData = a; } else { elementData = Arrays.copyOf(a, elementCount, Object[].class); } } /** * Copies the components of this vector into the specified array. * The item at index {@code k} in this vector is copied into * component {@code k} of {@code anArray}. * * @param anArray the array into which the components get copied * @throws NullPointerException if the given array is null * @throws IndexOutOfBoundsException if the specified array is not * large enough to hold all the components of this vector * @throws ArrayStoreException if a component of this vector is not of * a runtime type that can be stored in the specified array * @see #toArray(Object[]) */ public synchronized void copyInto(Object[] anArray) { System.arraycopy(elementData, 0, anArray, 0, elementCount); } /** * Trims the capacity of this vector to be the vector's current * size. If the capacity of this vector is larger than its current * size, then the capacity is changed to equal the size by replacing * its internal data array, kept in the field {@code elementData}, * with a smaller one. An application can use this operation to * minimize the storage of a vector. */ public synchronized void trimToSize() { modCount++; int oldCapacity = elementData.length; if (elementCount < oldCapacity) { elementData = Arrays.copyOf(elementData, elementCount); } } /** * Increases the capacity of this vector, if necessary, to ensure * that it can hold at least the number of components specified by * the minimum capacity argument. * * <p>If the current capacity of this vector is less than * {@code minCapacity}, then its capacity is increased by replacing its * internal data array, kept in the field {@code elementData}, with a * larger one. The size of the new data array will be the old size plus * {@code capacityIncrement}, unless the value of * {@code capacityIncrement} is less than or equal to zero, in which case * the new capacity will be twice the old capacity; but if this new size * is still smaller than {@code minCapacity}, then the new capacity will * be {@code minCapacity}. * * @param minCapacity the desired minimum capacity */ public synchronized void ensureCapacity(int minCapacity) { if (minCapacity > 0) { modCount++; if (minCapacity > elementData.length) grow(minCapacity); } } /** * Increases the capacity to ensure that it can hold at least the * number of elements specified by the minimum capacity argument. * * @param minCapacity the desired minimum capacity * @throws OutOfMemoryError if minCapacity is less than zero */ private Object[] grow(int minCapacity) { int oldCapacity = elementData.length; int newCapacity = ArraysSupport.newLength(oldCapacity, minCapacity - oldCapacity, /* minimum growth */ capacityIncrement > 0 ? capacityIncrement : oldCapacity /* preferred growth */); return elementData = Arrays.copyOf(elementData, newCapacity); } private Object[] grow() { return grow(elementCount + 1); } /** * Sets the size of this vector. If the new size is greater than the * current size, new {@code null} items are added to the end of * the vector. If the new size is less than the current size, all * components at index {@code newSize} and greater are discarded. * * @param newSize the new size of this vector * @throws ArrayIndexOutOfBoundsException if the new size is negative */ public synchronized void setSize(int newSize) { modCount++; if (newSize > elementData.length) grow(newSize); final Object[] es = elementData; for (int to = elementCount, i = newSize; i < to; i++) es[i] = null; elementCount = newSize; } /** * Returns the current capacity of this vector. * * @return the current capacity (the length of its internal * data array, kept in the field {@code elementData} * of this vector) */ public synchronized int capacity() { return elementData.length; } /** * Returns the number of components in this vector. * * @return the number of components in this vector */ public synchronized int size() { return elementCount; } /** * Tests if this vector has no components. * * @return {@code true} if and only if this vector has * no components, that is, its size is zero; * {@code false} otherwise. */ public synchronized boolean isEmpty() { return elementCount == 0; } /** * Returns an enumeration of the components of this vector. The * returned {@code Enumeration} object will generate all items in * this vector. The first item generated is the item at index {@code 0}, * then the item at index {@code 1}, and so on. If the vector is * structurally modified while enumerating over the elements then the * results of enumerating are undefined. * * @return an enumeration of the components of this vector * @see Iterator */ public Enumeration<E> elements() { return new Enumeration<E>() { int count = 0; public boolean hasMoreElements() { return count < elementCount; } public E nextElement() { synchronized (Vector.this) { if (count < elementCount) { return elementData(count++); } } throw new NoSuchElementException("Vector Enumeration"); } }; } /** * Returns {@code true} if this vector contains the specified element. * More formally, returns {@code true} if and only if this vector * contains at least one element {@code e} such that * {@code Objects.equals(o, e)}. * * @param o element whose presence in this vector is to be tested * @return {@code true} if this vector contains the specified element */ public boolean contains(Object o) { return indexOf(o, 0) >= 0; } /** * Returns the index of the first occurrence of the specified element * in this vector, or -1 if this vector does not contain the element. * More formally, returns the lowest index {@code i} such that * {@code Objects.equals(o, get(i))}, * or -1 if there is no such index. * * @param o element to search for * @return the index of the first occurrence of the specified element in * this vector, or -1 if this vector does not contain the element */ public int indexOf(Object o) { return indexOf(o, 0); } /** * Returns the index of the first occurrence of the specified element in * this vector, searching forwards from {@code index}, or returns -1 if * the element is not found. * More formally, returns the lowest index {@code i} such that * {@code (i >= index && Objects.equals(o, get(i)))}, * or -1 if there is no such index. * * @param o element to search for * @param index index to start searching from * @return the index of the first occurrence of the element in * this vector at position {@code index} or later in the vector; * {@code -1} if the element is not found. * @throws IndexOutOfBoundsException if the specified index is negative * @see Object#equals(Object) */ public synchronized int indexOf(Object o, int index) { if (o == null) { for (int i = index ; i < elementCount ; i++) if (elementData[i]==null) return i; } else { for (int i = index ; i < elementCount ; i++) if (o.equals(elementData[i])) return i; } return -1; } /** * Returns the index of the last occurrence of the specified element * in this vector, or -1 if this vector does not contain the element. * More formally, returns the highest index {@code i} such that * {@code Objects.equals(o, get(i))}, * or -1 if there is no such index. * * @param o element to search for * @return the index of the last occurrence of the specified element in * this vector, or -1 if this vector does not contain the element */ public synchronized int lastIndexOf(Object o) { return lastIndexOf(o, elementCount-1); } /** * Returns the index of the last occurrence of the specified element in * this vector, searching backwards from {@code index}, or returns -1 if * the element is not found. * More formally, returns the highest index {@code i} such that * {@code (i <= index && Objects.equals(o, get(i)))}, * or -1 if there is no such index. * * @param o element to search for * @param index index to start searching backwards from * @return the index of the last occurrence of the element at position * less than or equal to {@code index} in this vector; * -1 if the element is not found. * @throws IndexOutOfBoundsException if the specified index is greater * than or equal to the current size of this vector */ public synchronized int lastIndexOf(Object o, int index) { if (index >= elementCount) throw new IndexOutOfBoundsException(index + " >= "+ elementCount); if (o == null) { for (int i = index; i >= 0; i--) if (elementData[i]==null) return i; } else { for (int i = index; i >= 0; i--) if (o.equals(elementData[i])) return i; } return -1; } /** * Returns the component at the specified index. * * <p>This method is identical in functionality to the {@link #get(int)} * method (which is part of the {@link List} interface). * * @param index an index into this vector * @return the component at the specified index * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index >= size()}) */ public synchronized E elementAt(int index) { if (index >= elementCount) { throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount); } return elementData(index); } /** * Returns the first component (the item at index {@code 0}) of * this vector. * * @return the first component of this vector * @throws NoSuchElementException if this vector has no components */ public synchronized E firstElement() { if (elementCount == 0) { throw new NoSuchElementException(); } return elementData(0); } /** * Returns the last component of the vector. * * @return the last component of the vector, i.e., the component at index * {@code size() - 1} * @throws NoSuchElementException if this vector is empty */ public synchronized E lastElement() { if (elementCount == 0) { throw new NoSuchElementException(); } return elementData(elementCount - 1); } /** * Sets the component at the specified {@code index} of this * vector to be the specified object. The previous component at that * position is discarded. * * <p>The index must be a value greater than or equal to {@code 0} * and less than the current size of the vector. * * <p>This method is identical in functionality to the * {@link #set(int, Object) set(int, E)} * method (which is part of the {@link List} interface). Note that the * {@code set} method reverses the order of the parameters, to more closely * match array usage. Note also that the {@code set} method returns the * old value that was stored at the specified position. * * @param obj what the component is to be set to * @param index the specified index * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index >= size()}) */ public synchronized void setElementAt(E obj, int index) { if (index >= elementCount) { throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount); } elementData[index] = obj; } /** * Deletes the component at the specified index. Each component in * this vector with an index greater or equal to the specified * {@code index} is shifted downward to have an index one * smaller than the value it had previously. The size of this vector * is decreased by {@code 1}. * * <p>The index must be a value greater than or equal to {@code 0} * and less than the current size of the vector. * * <p>This method is identical in functionality to the {@link #remove(int)} * method (which is part of the {@link List} interface). Note that the * {@code remove} method returns the old value that was stored at the * specified position. * * @param index the index of the object to remove * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index >= size()}) */ public synchronized void removeElementAt(int index) { if (index >= elementCount) { throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount); } else if (index < 0) { throw new ArrayIndexOutOfBoundsException(index); } int j = elementCount - index - 1; if (j > 0) { System.arraycopy(elementData, index + 1, elementData, index, j); } modCount++; elementCount--; elementData[elementCount] = null; /* to let gc do its work */ } /** * Inserts the specified object as a component in this vector at the * specified {@code index}. Each component in this vector with * an index greater or equal to the specified {@code index} is * shifted upward to have an index one greater than the value it had * previously. * * <p>The index must be a value greater than or equal to {@code 0} * and less than or equal to the current size of the vector. (If the * index is equal to the current size of the vector, the new element * is appended to the Vector.) * * <p>This method is identical in functionality to the * {@link #add(int, Object) add(int, E)} * method (which is part of the {@link List} interface). Note that the * {@code add} method reverses the order of the parameters, to more closely * match array usage. * * @param obj the component to insert * @param index where to insert the new component * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index > size()}) */ public synchronized void insertElementAt(E obj, int index) { if (index > elementCount) { throw new ArrayIndexOutOfBoundsException(index + " > " + elementCount); } modCount++; final int s = elementCount; Object[] elementData = this.elementData; if (s == elementData.length) elementData = grow(); System.arraycopy(elementData, index, elementData, index + 1, s - index); elementData[index] = obj; elementCount = s + 1; } /** * Adds the specified component to the end of this vector, * increasing its size by one. The capacity of this vector is * increased if its size becomes greater than its capacity. * * <p>This method is identical in functionality to the * {@link #add(Object) add(E)} * method (which is part of the {@link List} interface). * * @param obj the component to be added */ public synchronized void addElement(E obj) { modCount++; add(obj, elementData, elementCount); } /** * Removes the first (lowest-indexed) occurrence of the argument * from this vector. If the object is found in this vector, each * component in the vector with an index greater or equal to the * object's index is shifted downward to have an index one smaller * than the value it had previously. * * <p>This method is identical in functionality to the * {@link #remove(Object)} method (which is part of the * {@link List} interface). * * @param obj the component to be removed * @return {@code true} if the argument was a component of this * vector; {@code false} otherwise. */ public synchronized boolean removeElement(Object obj) { modCount++; int i = indexOf(obj); if (i >= 0) { removeElementAt(i); return true; } return false; } /** * Removes all components from this vector and sets its size to zero. * * <p>This method is identical in functionality to the {@link #clear} * method (which is part of the {@link List} interface). */ public synchronized void removeAllElements() { final Object[] es = elementData; for (int to = elementCount, i = elementCount = 0; i < to; i++) es[i] = null; modCount++; } /** * Returns a clone of this vector. The copy will contain a * reference to a clone of the internal data array, not a reference * to the original internal data array of this {@code Vector} object. * * @return a clone of this vector */ public synchronized Object clone() { try { @SuppressWarnings("unchecked") Vector<E> v = (Vector<E>) super.clone(); v.elementData = Arrays.copyOf(elementData, elementCount); v.modCount = 0; return v; } catch (CloneNotSupportedException e) { // this shouldn't happen, since we are Cloneable throw new InternalError(e); } } /** * Returns an array containing all of the elements in this Vector * in the correct order. * * @since 1.2 */ public synchronized Object[] toArray() { return Arrays.copyOf(elementData, elementCount); } /** * Returns an array containing all of the elements in this Vector in the * correct order; the runtime type of the returned array is that of the * specified array. If the Vector fits in the specified array, it is * returned therein. Otherwise, a new array is allocated with the runtime * type of the specified array and the size of this Vector. * * <p>If the Vector fits in the specified array with room to spare * (i.e., the array has more elements than the Vector), * the element in the array immediately following the end of the * Vector is set to null. (This is useful in determining the length * of the Vector <em>only</em> if the caller knows that the Vector * does not contain any null elements.) * * @param <T> type of array elements. The same type as {@code <E>} or a * supertype of {@code <E>}. * @param a the array into which the elements of the Vector are to * be stored, if it is big enough; otherwise, a new array of the * same runtime type is allocated for this purpose. * @return an array containing the elements of the Vector * @throws ArrayStoreException if the runtime type of a, {@code <T>}, is not * a supertype of the runtime type, {@code <E>}, of every element in this * Vector * @throws NullPointerException if the given array is null * @since 1.2 */ @SuppressWarnings("unchecked") public synchronized <T> T[] toArray(T[] a) { if (a.length < elementCount) return (T[]) Arrays.copyOf(elementData, elementCount, a.getClass()); System.arraycopy(elementData, 0, a, 0, elementCount); if (a.length > elementCount) a[elementCount] = null; return a; } // Positional Access Operations @SuppressWarnings("unchecked") E elementData(int index) { return (E) elementData[index]; } @SuppressWarnings("unchecked") static <E> E elementAt(Object[] es, int index) { return (E) es[index]; } /** * Returns the element at the specified position in this Vector. * * @param index index of the element to return * @return object at the specified index * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index >= size()}) * @since 1.2 */ public synchronized E get(int index) { if (index >= elementCount) throw new ArrayIndexOutOfBoundsException(index); return elementData(index); } /** * Replaces the element at the specified position in this Vector with the * specified element. * * @param index index of the element to replace * @param element element to be stored at the specified position * @return the element previously at the specified position * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index >= size()}) * @since 1.2 */ public synchronized E set(int index, E element) { if (index >= elementCount) throw new ArrayIndexOutOfBoundsException(index); E oldValue = elementData(index); elementData[index] = element; return oldValue; } /** * This helper method split out from add(E) to keep method * bytecode size under 35 (the -XX:MaxInlineSize default value), * which helps when add(E) is called in a C1-compiled loop. */ private void add(E e, Object[] elementData, int s) { if (s == elementData.length) elementData = grow(); elementData[s] = e; elementCount = s + 1; } /** * Appends the specified element to the end of this Vector. * * @param e element to be appended to this Vector * @return {@code true} (as specified by {@link Collection#add}) * @since 1.2 */ public synchronized boolean add(E e) { modCount++; add(e, elementData, elementCount); return true; } /** * Removes the first occurrence of the specified element in this Vector * If the Vector does not contain the element, it is unchanged. More * formally, removes the element with the lowest index i such that * {@code Objects.equals(o, get(i))} (if such * an element exists). * * @param o element to be removed from this Vector, if present * @return true if the Vector contained the specified element * @since 1.2 */ public boolean remove(Object o) { return removeElement(o); } /** * Inserts the specified element at the specified position in this Vector. * Shifts the element currently at that position (if any) and any * subsequent elements to the right (adds one to their indices). * * @param index index at which the specified element is to be inserted * @param element element to be inserted * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index > size()}) * @since 1.2 */ public void add(int index, E element) { insertElementAt(element, index); } /** * Removes the element at the specified position in this Vector. * Shifts any subsequent elements to the left (subtracts one from their * indices). Returns the element that was removed from the Vector. * * @param index the index of the element to be removed * @return element that was removed * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index >= size()}) * @since 1.2 */ public synchronized E remove(int index) { modCount++; if (index >= elementCount) throw new ArrayIndexOutOfBoundsException(index); E oldValue = elementData(index); int numMoved = elementCount - index - 1; if (numMoved > 0) System.arraycopy(elementData, index+1, elementData, index, numMoved); elementData[--elementCount] = null; // Let gc do its work return oldValue; } /** * Removes all of the elements from this Vector. The Vector will * be empty after this call returns (unless it throws an exception). * * @since 1.2 */ public void clear() { removeAllElements(); } // Bulk Operations /** * Returns true if this Vector contains all of the elements in the * specified Collection. * * @param c a collection whose elements will be tested for containment * in this Vector * @return true if this Vector contains all of the elements in the * specified collection * @throws NullPointerException if the specified collection is null */ public synchronized boolean containsAll(Collection<?> c) { return super.containsAll(c); } /** * Appends all of the elements in the specified Collection to the end of * this Vector, in the order that they are returned by the specified * Collection's Iterator. The behavior of this operation is undefined if * the specified Collection is modified while the operation is in progress. * (This implies that the behavior of this call is undefined if the * specified Collection is this Vector, and this Vector is nonempty.) * * @param c elements to be inserted into this Vector * @return {@code true} if this Vector changed as a result of the call * @throws NullPointerException if the specified collection is null * @since 1.2 */ public boolean addAll(Collection<? extends E> c) { Object[] a = c.toArray(); modCount++; int numNew = a.length; if (numNew == 0) return false; synchronized (this) { Object[] elementData = this.elementData; final int s = elementCount; if (numNew > elementData.length - s) elementData = grow(s + numNew); System.arraycopy(a, 0, elementData, s, numNew); elementCount = s + numNew; return true; } } /** * Removes from this Vector all of its elements that are contained in the * specified Collection. * * @param c a collection of elements to be removed from the Vector * @return true if this Vector changed as a result of the call * @throws ClassCastException if the types of one or more elements * in this vector are incompatible with the specified * collection * (<a href="Collection.html#optional-restrictions">optional</a>) * @throws NullPointerException if this vector contains one or more null * elements and the specified collection does not support null * elements * (<a href="Collection.html#optional-restrictions">optional</a>), * or if the specified collection is null * @since 1.2 */ public boolean removeAll(Collection<?> c) { Objects.requireNonNull(c); return bulkRemove(e -> c.contains(e)); } /** * Retains only the elements in this Vector that are contained in the * specified Collection. In other words, removes from this Vector all * of its elements that are not contained in the specified Collection. * * @param c a collection of elements to be retained in this Vector * (all other elements are removed) * @return true if this Vector changed as a result of the call * @throws ClassCastException if the types of one or more elements * in this vector are incompatible with the specified * collection * (<a href="Collection.html#optional-restrictions">optional</a>) * @throws NullPointerException if this vector contains one or more null * elements and the specified collection does not support null * elements * (<a href="Collection.html#optional-restrictions">optional</a>), * or if the specified collection is null * @since 1.2 */ public boolean retainAll(Collection<?> c) { Objects.requireNonNull(c); return bulkRemove(e -> !c.contains(e)); } /** * @throws NullPointerException {@inheritDoc} */ @Override public boolean removeIf(Predicate<? super E> filter) { Objects.requireNonNull(filter); return bulkRemove(filter); } // A tiny bit set implementation private static long[] nBits(int n) { return new long[((n - 1) >> 6) + 1]; } private static void setBit(long[] bits, int i) { bits[i >> 6] |= 1L << i; } private static boolean isClear(long[] bits, int i) { return (bits[i >> 6] & (1L << i)) == 0; } private synchronized boolean bulkRemove(Predicate<? super E> filter) { int expectedModCount = modCount; final Object[] es = elementData; final int end = elementCount; int i; // Optimize for initial run of survivors for (i = 0; i < end && !filter.test(elementAt(es, i)); i++) ; // Tolerate predicates that reentrantly access the collection for // read (but writers still get CME), so traverse once to find // elements to delete, a second pass to physically expunge. if (i < end) { final int beg = i; final long[] deathRow = nBits(end - beg); deathRow[0] = 1L; // set bit 0 for (i = beg + 1; i < end; i++) if (filter.test(elementAt(es, i))) setBit(deathRow, i - beg); if (modCount != expectedModCount) throw new ConcurrentModificationException(); modCount++; int w = beg; for (i = beg; i < end; i++) if (isClear(deathRow, i - beg)) es[w++] = es[i]; for (i = elementCount = w; i < end; i++) es[i] = null; return true; } else { if (modCount != expectedModCount) throw new ConcurrentModificationException(); return false; } } /** * Inserts all of the elements in the specified Collection into this * Vector at the specified position. Shifts the element currently at * that position (if any) and any subsequent elements to the right * (increases their indices). The new elements will appear in the Vector * in the order that they are returned by the specified Collection's * iterator. * * @param index index at which to insert the first element from the * specified collection * @param c elements to be inserted into this Vector * @return {@code true} if this Vector changed as a result of the call * @throws ArrayIndexOutOfBoundsException if the index is out of range * ({@code index < 0 || index > size()}) * @throws NullPointerException if the specified collection is null * @since 1.2 */ public synchronized boolean addAll(int index, Collection<? extends E> c) { if (index < 0 || index > elementCount) throw new ArrayIndexOutOfBoundsException(index); Object[] a = c.toArray(); modCount++; int numNew = a.length; if (numNew == 0) return false; Object[] elementData = this.elementData; final int s = elementCount; if (numNew > elementData.length - s) elementData = grow(s + numNew); int numMoved = s - index; if (numMoved > 0) System.arraycopy(elementData, index, elementData, index + numNew, numMoved); System.arraycopy(a, 0, elementData, index, numNew); elementCount = s + numNew; return true; } /** * Compares the specified Object with this Vector for equality. Returns * true if and only if the specified Object is also a List, both Lists * have the same size, and all corresponding pairs of elements in the two * Lists are <em>equal</em>. (Two elements {@code e1} and * {@code e2} are <em>equal</em> if {@code Objects.equals(e1, e2)}.) * In other words, two Lists are defined to be * equal if they contain the same elements in the same order. * * @param o the Object to be compared for equality with this Vector * @return true if the specified Object is equal to this Vector */ public synchronized boolean equals(Object o) { return super.equals(o); } /** * Returns the hash code value for this Vector. */ public synchronized int hashCode() { return super.hashCode(); } /** * Returns a string representation of this Vector, containing * the String representation of each element. */ public synchronized String toString() { return super.toString(); } /** * Returns a view of the portion of this List between fromIndex, * inclusive, and toIndex, exclusive. (If fromIndex and toIndex are * equal, the returned List is empty.) The returned List is backed by this * List, so changes in the returned List are reflected in this List, and * vice-versa. The returned List supports all of the optional List * operations supported by this List. * * <p>This method eliminates the need for explicit range operations (of * the sort that commonly exist for arrays). Any operation that expects * a List can be used as a range operation by operating on a subList view * instead of a whole List. For example, the following idiom * removes a range of elements from a List: * <pre> * list.subList(from, to).clear(); * </pre> * Similar idioms may be constructed for indexOf and lastIndexOf, * and all of the algorithms in the Collections class can be applied to * a subList. * * <p>The semantics of the List returned by this method become undefined if * the backing list (i.e., this List) is <i>structurally modified</i> in * any way other than via the returned List. (Structural modifications are * those that change the size of the List, or otherwise perturb it in such * a fashion that iterations in progress may yield incorrect results.) * * @param fromIndex low endpoint (inclusive) of the subList * @param toIndex high endpoint (exclusive) of the subList * @return a view of the specified range within this List * @throws IndexOutOfBoundsException if an endpoint index value is out of range * {@code (fromIndex < 0 || toIndex > size)} * @throws IllegalArgumentException if the endpoint indices are out of order * {@code (fromIndex > toIndex)} */ public synchronized List<E> subList(int fromIndex, int toIndex) { return Collections.synchronizedList(super.subList(fromIndex, toIndex), this); } /** * Removes from this list all of the elements whose index is between * {@code fromIndex}, inclusive, and {@code toIndex}, exclusive. * Shifts any succeeding elements to the left (reduces their index). * This call shortens the list by {@code (toIndex - fromIndex)} elements. * (If {@code toIndex==fromIndex}, this operation has no effect.) */ protected synchronized void removeRange(int fromIndex, int toIndex) { modCount++; shiftTailOverGap(elementData, fromIndex, toIndex); } /** Erases the gap from lo to hi, by sliding down following elements. */ private void shiftTailOverGap(Object[] es, int lo, int hi) { System.arraycopy(es, hi, es, lo, elementCount - hi); for (int to = elementCount, i = (elementCount -= hi - lo); i < to; i++) es[i] = null; } /** * Loads a {@code Vector} instance from a stream * (that is, deserializes it). * This method performs checks to ensure the consistency * of the fields. * * @param in the stream * @throws java.io.IOException if an I/O error occurs * @throws ClassNotFoundException if the stream contains data * of a non-existing class */ @java.io.Serial private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { ObjectInputStream.GetField gfields = in.readFields(); int count = gfields.get("elementCount", 0); Object[] data = (Object[])gfields.get("elementData", null); if (count < 0 || data == null || count > data.length) { throw new StreamCorruptedException("Inconsistent vector internals"); } elementCount = count; elementData = data.clone(); } /** * Saves the state of the {@code Vector} instance to a stream * (that is, serializes it). * This method performs synchronization to ensure the consistency * of the serialized data. * * @param s the stream * @throws java.io.IOException if an I/O error occurs */ @java.io.Serial private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { final java.io.ObjectOutputStream.PutField fields = s.putFields(); final Object[] data; synchronized (this) { fields.put("capacityIncrement", capacityIncrement); fields.put("elementCount", elementCount); data = elementData.clone(); } fields.put("elementData", data); s.writeFields(); } /** * Returns a list iterator over the elements in this list (in proper * sequence), starting at the specified position in the list. * The specified index indicates the first element that would be * returned by an initial call to {@link ListIterator#next next}. * An initial call to {@link ListIterator#previous previous} would * return the element with the specified index minus one. * * <p>The returned list iterator is <a href="#fail-fast"><i>fail-fast</i></a>. * * @throws IndexOutOfBoundsException {@inheritDoc} */ public synchronized ListIterator<E> listIterator(int index) { if (index < 0 || index > elementCount) throw new IndexOutOfBoundsException("Index: "+index); return new ListItr(index); } /** * Returns a list iterator over the elements in this list (in proper * sequence). * * <p>The returned list iterator is <a href="#fail-fast"><i>fail-fast</i></a>. * * @see #listIterator(int) */ public synchronized ListIterator<E> listIterator() { return new ListItr(0); } /** * Returns an iterator over the elements in this list in proper sequence. * * <p>The returned iterator is <a href="#fail-fast"><i>fail-fast</i></a>. * * @return an iterator over the elements in this list in proper sequence */ public synchronized Iterator<E> iterator() { return new Itr(); } /** * An optimized version of AbstractList.Itr */ private class Itr implements Iterator<E> { int cursor; // index of next element to return int lastRet = -1; // index of last element returned; -1 if no such int expectedModCount = modCount; public boolean hasNext() { // Racy but within spec, since modifications are checked // within or after synchronization in next/previous return cursor != elementCount; } public E next() { synchronized (Vector.this) { checkForComodification(); int i = cursor; if (i >= elementCount) throw new NoSuchElementException(); cursor = i + 1; return elementData(lastRet = i); } } public void remove() { if (lastRet == -1) throw new IllegalStateException(); synchronized (Vector.this) { checkForComodification(); Vector.this.remove(lastRet); expectedModCount = modCount; } cursor = lastRet; lastRet = -1; } @Override public void forEachRemaining(Consumer<? super E> action) { Objects.requireNonNull(action); synchronized (Vector.this) { final int size = elementCount; int i = cursor; if (i >= size) { return; } final Object[] es = elementData; if (i >= es.length) throw new ConcurrentModificationException(); while (i < size && modCount == expectedModCount) action.accept(elementAt(es, i++)); // update once at end of iteration to reduce heap write traffic cursor = i; lastRet = i - 1; checkForComodification(); } } final void checkForComodification() { if (modCount != expectedModCount) throw new ConcurrentModificationException(); } } /** * An optimized version of AbstractList.ListItr */ final class ListItr extends Itr implements ListIterator<E> { ListItr(int index) { super(); cursor = index; } public boolean hasPrevious() { return cursor != 0; } public int nextIndex() { return cursor; } public int previousIndex() { return cursor - 1; } public E previous() { synchronized (Vector.this) { checkForComodification(); int i = cursor - 1; if (i < 0) throw new NoSuchElementException(); cursor = i; return elementData(lastRet = i); } } public void set(E e) { if (lastRet == -1) throw new IllegalStateException(); synchronized (Vector.this) { checkForComodification(); Vector.this.set(lastRet, e); } } public void add(E e) { int i = cursor; synchronized (Vector.this) { checkForComodification(); Vector.this.add(i, e); expectedModCount = modCount; } cursor = i + 1; lastRet = -1; } } /** * @throws NullPointerException {@inheritDoc} */ @Override public synchronized void forEach(Consumer<? super E> action) { Objects.requireNonNull(action); final int expectedModCount = modCount; final Object[] es = elementData; final int size = elementCount; for (int i = 0; modCount == expectedModCount && i < size; i++) action.accept(elementAt(es, i)); if (modCount != expectedModCount) throw new ConcurrentModificationException(); } /** * @throws NullPointerException {@inheritDoc} */ @Override public synchronized void replaceAll(UnaryOperator<E> operator) { Objects.requireNonNull(operator); final int expectedModCount = modCount; final Object[] es = elementData; final int size = elementCount; for (int i = 0; modCount == expectedModCount && i < size; i++) es[i] = operator.apply(elementAt(es, i)); if (modCount != expectedModCount) throw new ConcurrentModificationException(); // TODO(8203662): remove increment of modCount from ... modCount++; } @SuppressWarnings("unchecked") @Override public synchronized void sort(Comparator<? super E> c) { final int expectedModCount = modCount; Arrays.sort((E[]) elementData, 0, elementCount, c); if (modCount != expectedModCount) throw new ConcurrentModificationException(); modCount++; } /** * Creates a <em><a href="Spliterator.html#binding">late-binding</a></em> * and <em>fail-fast</em> {@link Spliterator} over the elements in this * list. * * <p>The {@code Spliterator} reports {@link Spliterator#SIZED}, * {@link Spliterator#SUBSIZED}, and {@link Spliterator#ORDERED}. * Overriding implementations should document the reporting of additional * characteristic values. * * @return a {@code Spliterator} over the elements in this list * @since 1.8 */ @Override public Spliterator<E> spliterator() { return new VectorSpliterator(null, 0, -1, 0); } /** Similar to ArrayList Spliterator */ final class VectorSpliterator implements Spliterator<E> { private Object[] array; private int index; // current index, modified on advance/split private int fence; // -1 until used; then one past last index private int expectedModCount; // initialized when fence set /** Creates new spliterator covering the given range. */ VectorSpliterator(Object[] array, int origin, int fence, int expectedModCount) { this.array = array; this.index = origin; this.fence = fence; this.expectedModCount = expectedModCount; } private int getFence() { // initialize on first use int hi; if ((hi = fence) < 0) { synchronized (Vector.this) { array = elementData; expectedModCount = modCount; hi = fence = elementCount; } } return hi; } public Spliterator<E> trySplit() { int hi = getFence(), lo = index, mid = (lo + hi) >>> 1; return (lo >= mid) ? null : new VectorSpliterator(array, lo, index = mid, expectedModCount); } @SuppressWarnings("unchecked") public boolean tryAdvance(Consumer<? super E> action) { Objects.requireNonNull(action); int i; if (getFence() > (i = index)) { index = i + 1; action.accept((E)array[i]); if (modCount != expectedModCount) throw new ConcurrentModificationException(); return true; } return false; } @SuppressWarnings("unchecked") public void forEachRemaining(Consumer<? super E> action) { Objects.requireNonNull(action); final int hi = getFence(); final Object[] a = array; int i; for (i = index, index = hi; i < hi; i++) action.accept((E) a[i]); if (modCount != expectedModCount) throw new ConcurrentModificationException(); } public long estimateSize() { return getFence() - index; } public int characteristics() { return Spliterator.ORDERED | Spliterator.SIZED | Spliterator.SUBSIZED; } } void checkInvariants() { // assert elementCount >= 0; // assert elementCount == elementData.length || elementData[elementCount] == null; } }
mirkosertic/Bytecoder
classlib/java.base/src/main/resources/META-INF/modules/java.base/classes/java/util/Vector.java
Java
apache-2.0
56,351
''' This module sets up a scheme for validating that arbitrary Python objects are correctly typed. It is totally decoupled from Django, composable, easily wrapped, and easily extended. A validator takes two parameters--var_name and val--and returns an error if val is not the correct type. The var_name parameter is used to format error messages. Validators return None when there are no errors. Example primitive validators are check_string, check_int, and check_bool. Compound validators are created by check_list and check_dict. Note that those functions aren't directly called for validation; instead, those functions are called to return other functions that adhere to the validator contract. This is similar to how Python decorators are often parameterized. The contract for check_list and check_dict is that they get passed in other validators to apply to their items. This allows you to build up validators for arbitrarily complex validators. See ValidatorTestCase for example usage. A simple example of composition is this: check_list(check_string)('my_list', ['a', 'b', 'c']) == None To extend this concept, it's simply a matter of writing your own validator for any particular type of object. ''' from __future__ import absolute_import import six def check_string(var_name, val): if not isinstance(val, six.string_types): return '%s is not a string' % (var_name,) return None def check_int(var_name, val): if not isinstance(val, int): return '%s is not an integer' % (var_name,) return None def check_bool(var_name, val): if not isinstance(val, bool): return '%s is not a boolean' % (var_name,) return None def check_none_or(sub_validator): def f(var_name, val): if val is None: return None else: return sub_validator(var_name, val) return f def check_list(sub_validator, length=None): def f(var_name, val): if not isinstance(val, list): return '%s is not a list' % (var_name,) if length is not None and length != len(val): return '%s should have exactly %d items' % (var_name, length) if sub_validator: for i, item in enumerate(val): vname = '%s[%d]' % (var_name, i) error = sub_validator(vname, item) if error: return error return None return f def check_dict(required_keys): # required_keys is a list of tuples of # key_name/validator def f(var_name, val): if not isinstance(val, dict): return '%s is not a dict' % (var_name,) for k, sub_validator in required_keys: if k not in val: return '%s key is missing from %s' % (k, var_name) vname = '%s["%s"]' % (var_name, k) error = sub_validator(vname, val[k]) if error: return error return None return f def check_variable_type(allowed_type_funcs): """ Use this validator if an argument is of a variable type (e.g. processing properties that might be strings or booleans). `allowed_type_funcs`: the check_* validator functions for the possible data types for this variable. """ def enumerated_type_check(var_name, val): for func in allowed_type_funcs: if not func(var_name, val): return None return '%s is not an allowed_type' % (var_name,) return enumerated_type_check def equals(expected_val): def f(var_name, val): if val != expected_val: return '%s != %r (%r is wrong)' % (var_name, expected_val, val) return None return f
dwrpayne/zulip
zerver/lib/validator.py
Python
apache-2.0
3,704
/* Copyright 2011-2016 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.google.security.zynamics.binnavi.debug.connection.packets.replies; import com.google.security.zynamics.binnavi.debug.models.targetinformation.RegisterValues; /** * Represents the reply that is sent by the debug client whenever a regular breakpoint was hit in * the target process. */ public final class BreakpointHitReply extends AnyBreakpointHitReply { /** * Creates a new breakpoint hit reply object. * * @param packetId Packet ID of the reply. * @param errorCode Error code of the reply. If this error code is 0, the requested operation was * successful. * @param tid Thread ID of the thread that hit the breakpoint. * @param registerValues Values of all registers when the breakpoints was hit. In case of an * error, this argument is null. */ public BreakpointHitReply(final int packetId, final int errorCode, final long tid, final RegisterValues registerValues) { super(packetId, errorCode, tid, registerValues); } }
ispras/binnavi
src/main/java/com/google/security/zynamics/binnavi/debug/connection/packets/replies/BreakpointHitReply.java
Java
apache-2.0
1,580
// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. using Azure.Core; using Azure.Core.Pipeline; using System; using System.Threading; using System.Threading.Tasks; namespace Azure.Security.KeyVault.Keys.Cryptography { internal class RemoteCryptographyClient : ICryptographyProvider { private readonly Uri _keyId; protected RemoteCryptographyClient() { } internal RemoteCryptographyClient(Uri keyId, TokenCredential credential, CryptographyClientOptions options) { Argument.AssertNotNull(keyId, nameof(keyId)); Argument.AssertNotNull(credential, nameof(credential)); _keyId = keyId; options ??= new CryptographyClientOptions(); string apiVersion = options.GetVersionString(); HttpPipeline pipeline = HttpPipelineBuilder.Build(options, new ChallengeBasedAuthenticationPolicy(credential)); Pipeline = new KeyVaultPipeline(keyId, apiVersion, pipeline, new ClientDiagnostics(options)); } internal RemoteCryptographyClient(KeyVaultPipeline pipeline) { Pipeline = pipeline; } internal KeyVaultPipeline Pipeline { get; } public bool SupportsOperation(KeyOperation operation) => true; public virtual async Task<Response<EncryptResult>> EncryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext, CancellationToken cancellationToken = default) { var parameters = new KeyEncryptParameters() { Algorithm = algorithm.ToString(), Value = plaintext, }; using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(Encrypt)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return await Pipeline.SendRequestAsync(RequestMethod.Post, parameters, () => new EncryptResult { Algorithm = algorithm }, cancellationToken, "/encrypt").ConfigureAwait(false); } catch (Exception e) { scope.Failed(e); throw; } } public virtual Response<EncryptResult> Encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, CancellationToken cancellationToken = default) { var parameters = new KeyEncryptParameters() { Algorithm = algorithm.ToString(), Value = plaintext, }; using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(Encrypt)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return Pipeline.SendRequest(RequestMethod.Post, parameters, () => new EncryptResult { Algorithm = algorithm }, cancellationToken, "/encrypt"); } catch (Exception e) { scope.Failed(e); throw; } } public virtual async Task<Response<DecryptResult>> DecryptAsync(EncryptionAlgorithm algorithm, byte[] ciphertext, CancellationToken cancellationToken = default) { var parameters = new KeyEncryptParameters() { Algorithm = algorithm.ToString(), Value = ciphertext, }; using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(Decrypt)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return await Pipeline.SendRequestAsync(RequestMethod.Post, parameters, () => new DecryptResult { Algorithm = algorithm }, cancellationToken, "/decrypt").ConfigureAwait(false); } catch (Exception e) { scope.Failed(e); throw; } } public virtual Response<DecryptResult> Decrypt(EncryptionAlgorithm algorithm, byte[] ciphertext, CancellationToken cancellationToken = default) { var parameters = new KeyEncryptParameters() { Algorithm = algorithm.ToString(), Value = ciphertext, }; using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(Decrypt)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return Pipeline.SendRequest(RequestMethod.Post, parameters, () => new DecryptResult { Algorithm = algorithm }, cancellationToken, "/decrypt"); } catch (Exception e) { scope.Failed(e); throw; } } public virtual async Task<Response<WrapResult>> WrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, CancellationToken cancellationToken = default) { var parameters = new KeyWrapParameters() { Algorithm = algorithm.ToString(), Key = key }; using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(WrapKey)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return await Pipeline.SendRequestAsync(RequestMethod.Post, parameters, () => new WrapResult { Algorithm = algorithm }, cancellationToken, "/wrapKey").ConfigureAwait(false); } catch (Exception e) { scope.Failed(e); throw; } } public virtual Response<WrapResult> WrapKey(KeyWrapAlgorithm algorithm, byte[] key, CancellationToken cancellationToken = default) { var parameters = new KeyWrapParameters() { Algorithm = algorithm.ToString(), Key = key }; using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(WrapKey)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return Pipeline.SendRequest(RequestMethod.Post, parameters, () => new WrapResult { Algorithm = algorithm }, cancellationToken, "/wrapKey"); } catch (Exception e) { scope.Failed(e); throw; } } public virtual async Task<Response<UnwrapResult>> UnwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, CancellationToken cancellationToken = default) { var parameters = new KeyWrapParameters() { Algorithm = algorithm.ToString(), Key = encryptedKey }; using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(UnwrapKey)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return await Pipeline.SendRequestAsync(RequestMethod.Post, parameters, () => new UnwrapResult { Algorithm = algorithm }, cancellationToken, "/unwrapKey").ConfigureAwait(false); } catch (Exception e) { scope.Failed(e); throw; } } public virtual Response<UnwrapResult> UnwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, CancellationToken cancellationToken = default) { var parameters = new KeyWrapParameters() { Algorithm = algorithm.ToString(), Key = encryptedKey }; using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(UnwrapKey)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return Pipeline.SendRequest(RequestMethod.Post, parameters, () => new UnwrapResult { Algorithm = algorithm }, cancellationToken, "/unwrapKey"); } catch (Exception e) { scope.Failed(e); throw; } } public virtual async Task<Response<SignResult>> SignAsync(SignatureAlgorithm algorithm, byte[] digest, CancellationToken cancellationToken = default) { var parameters = new KeySignParameters { Algorithm = algorithm.ToString(), Digest = digest }; using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(Sign)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return await Pipeline.SendRequestAsync(RequestMethod.Post, parameters, () => new SignResult { Algorithm = algorithm }, cancellationToken, "/sign").ConfigureAwait(false); } catch (Exception e) { scope.Failed(e); throw; } } public virtual Response<SignResult> Sign(SignatureAlgorithm algorithm, byte[] digest, CancellationToken cancellationToken = default) { var parameters = new KeySignParameters { Algorithm = algorithm.ToString(), Digest = digest }; using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(Sign)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return Pipeline.SendRequest(RequestMethod.Post, parameters, () => new SignResult { Algorithm = algorithm }, cancellationToken, "/sign"); } catch (Exception e) { scope.Failed(e); throw; } } public virtual async Task<Response<VerifyResult>> VerifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, CancellationToken cancellationToken = default) { var parameters = new KeyVerifyParameters { Algorithm = algorithm.ToString(), Digest = digest, Signature = signature }; using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(Verify)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return await Pipeline.SendRequestAsync(RequestMethod.Post, parameters, () => new VerifyResult { Algorithm = algorithm, KeyId = _keyId.ToString() }, cancellationToken, "/verify").ConfigureAwait(false); } catch (Exception e) { scope.Failed(e); throw; } } public virtual Response<VerifyResult> Verify(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, CancellationToken cancellationToken = default) { var parameters = new KeyVerifyParameters { Algorithm = algorithm.ToString(), Digest = digest, Signature = signature }; using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(Verify)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return Pipeline.SendRequest(RequestMethod.Post, parameters, () => new VerifyResult { Algorithm = algorithm, KeyId = _keyId.ToString() }, cancellationToken, "/verify"); } catch (Exception e) { scope.Failed(e); throw; } } internal virtual async Task<Response<KeyVaultKey>> GetKeyAsync(CancellationToken cancellationToken = default) { using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(GetKey)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return await Pipeline.SendRequestAsync(RequestMethod.Get, () => new KeyVaultKey(), cancellationToken).ConfigureAwait(false); } catch (Exception e) { scope.Failed(e); throw; } } internal virtual Response<KeyVaultKey> GetKey(CancellationToken cancellationToken = default) { using DiagnosticScope scope = Pipeline.CreateScope($"{nameof(RemoteCryptographyClient)}.{nameof(GetKey)}"); scope.AddAttribute("key", _keyId); scope.Start(); try { return Pipeline.SendRequest(RequestMethod.Get, () => new KeyVaultKey(), cancellationToken); } catch (Exception e) { scope.Failed(e); throw; } } bool ICryptographyProvider.ShouldRemote => false; async Task<EncryptResult> ICryptographyProvider.EncryptAsync(EncryptionAlgorithm algorithm, byte[] plaintext, CancellationToken cancellationToken) { return await EncryptAsync(algorithm, plaintext, cancellationToken).ConfigureAwait(false); } EncryptResult ICryptographyProvider.Encrypt(EncryptionAlgorithm algorithm, byte[] plaintext, CancellationToken cancellationToken) { return Encrypt(algorithm, plaintext, cancellationToken); } async Task<DecryptResult> ICryptographyProvider.DecryptAsync(EncryptionAlgorithm algorithm, byte[] ciphertext, CancellationToken cancellationToken) { return await DecryptAsync(algorithm, ciphertext, cancellationToken).ConfigureAwait(false); } DecryptResult ICryptographyProvider.Decrypt(EncryptionAlgorithm algorithm, byte[] ciphertext, CancellationToken cancellationToken) { return Decrypt(algorithm, ciphertext, cancellationToken); } async Task<WrapResult> ICryptographyProvider.WrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] key, CancellationToken cancellationToken) { return await WrapKeyAsync(algorithm, key, cancellationToken).ConfigureAwait(false); } WrapResult ICryptographyProvider.WrapKey(KeyWrapAlgorithm algorithm, byte[] key, CancellationToken cancellationToken) { return WrapKey(algorithm, key, cancellationToken); } async Task<UnwrapResult> ICryptographyProvider.UnwrapKeyAsync(KeyWrapAlgorithm algorithm, byte[] encryptedKey, CancellationToken cancellationToken) { return await UnwrapKeyAsync(algorithm, encryptedKey, cancellationToken).ConfigureAwait(false); } UnwrapResult ICryptographyProvider.UnwrapKey(KeyWrapAlgorithm algorithm, byte[] encryptedKey, CancellationToken cancellationToken) { return UnwrapKey(algorithm, encryptedKey, cancellationToken); } async Task<SignResult> ICryptographyProvider.SignAsync(SignatureAlgorithm algorithm, byte[] digest, CancellationToken cancellationToken) { return await SignAsync(algorithm, digest, cancellationToken).ConfigureAwait(false); } SignResult ICryptographyProvider.Sign(SignatureAlgorithm algorithm, byte[] digest, CancellationToken cancellationToken) { return Sign(algorithm, digest, cancellationToken); } async Task<VerifyResult> ICryptographyProvider.VerifyAsync(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, CancellationToken cancellationToken) { return await VerifyAsync(algorithm, digest, signature, cancellationToken).ConfigureAwait(false); } VerifyResult ICryptographyProvider.Verify(SignatureAlgorithm algorithm, byte[] digest, byte[] signature, CancellationToken cancellationToken) { return Verify(algorithm, digest, signature, cancellationToken); } } }
stankovski/azure-sdk-for-net
sdk/keyvault/Azure.Security.KeyVault.Keys/src/Cryptography/RemoteCryptographyClient.cs
C#
apache-2.0
16,295
########################################################################## # Copyright 2016 ThoughtWorks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ########################################################################## module ApiV3 module Config class TimerRepresenter < ApiV3::BaseRepresenter alias_method :timer, :represented error_representer({"timerSpec" => "spec"}) property :timer_spec, as: :spec property :onlyOnChanges, as: :only_on_changes end end end
ollie314/gocd
server/webapp/WEB-INF/rails.new/app/presenters/api_v3/config/timer_representer.rb
Ruby
apache-2.0
1,014
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* global define, module, require, exports */ (function (root, factory) { if (typeof define === 'function' && define.amd) { define(['jquery', 'Slick', 'nf.ErrorHandler', 'nf.Common', 'nf.Client', 'nf.CanvasUtils', 'nf.ng.Bridge', 'nf.Dialog', 'nf.Shell'], function ($, Slick, nfErrorHandler, nfCommon, nfClient, nfCanvasUtils, nfNgBridge, nfDialog, nfShell) { return (nf.PolicyManagement = factory($, Slick, nfErrorHandler, nfCommon, nfClient, nfCanvasUtils, nfNgBridge, nfDialog, nfShell)); }); } else if (typeof exports === 'object' && typeof module === 'object') { module.exports = (nf.PolicyManagement = factory(require('jquery'), require('Slick'), require('nf.ErrorHandler'), require('nf.Common'), require('nf.Client'), require('nf.CanvasUtils'), require('nf.ng.Bridge'), require('nf.Dialog'), require('nf.Shell'))); } else { nf.PolicyManagement = factory(root.$, root.Slick, root.nf.ErrorHandler, root.nf.Common, root.nf.Client, root.nf.CanvasUtils, root.nf.ng.Bridge, root.nf.Dialog, root.nf.Shell); } }(this, function ($, Slick, nfErrorHandler, nfCommon, nfClient, nfCanvasUtils, nfNgBridge, nfDialog, nfShell) { 'use strict'; var config = { urls: { api: '../nifi-api', searchTenants: '../nifi-api/tenants/search-results' } }; var initialized = false; var initAddTenantToPolicyDialog = function () { $('#new-policy-user-button').on('click', function () { $('#search-users-dialog').modal('show'); $('#search-users-field').focus(); }); $('#delete-policy-button').on('click', function () { promptToDeletePolicy(); }); $('#search-users-dialog').modal({ scrollableContentStyle: 'scrollable', headerText: 'Add Users/Groups', buttons: [{ buttonText: 'Add', color: { base: '#728E9B', hover: '#004849', text: '#ffffff' }, handler: { click: function () { // add to table and update policy var policyGrid = $('#policy-table').data('gridInstance'); var policyData = policyGrid.getData(); // begin the update policyData.beginUpdate(); // add all users/groups $.each(getTenantsToAdd($('#allowed-users')), function (_, user) { // remove the user policyData.addItem(user); }); $.each(getTenantsToAdd($('#allowed-groups')), function (_, group) { // remove the user policyData.addItem(group); }); // end the update policyData.endUpdate(); // update the policy updatePolicy(); // close the dialog $('#search-users-dialog').modal('hide'); } } }, { buttonText: 'Cancel', color: { base: '#E3E8EB', hover: '#C7D2D7', text: '#004849' }, handler: { click: function () { // close the dialog $('#search-users-dialog').modal('hide'); } } }], handler: { close: function () { // reset the search fields $('#search-users-field').userSearchAutocomplete('reset').val(''); // clear the selected users/groups $('#allowed-users, #allowed-groups').empty(); } } }); // listen for removal requests $(document).on('click', 'div.remove-allowed-entity', function () { $(this).closest('li').remove(); }); // configure the user auto complete $.widget('nf.userSearchAutocomplete', $.ui.autocomplete, { reset: function () { this.term = null; }, _create: function() { this._super(); this.widget().menu('option', 'items', '> :not(.search-no-matches)' ); }, _normalize: function (searchResults) { var items = []; items.push(searchResults); return items; }, _renderMenu: function (ul, items) { // results are normalized into a single element array var searchResults = items[0]; var allowedGroups = getAllAllowedGroups(); var allowedUsers = getAllAllowedUsers(); var nfUserSearchAutocomplete = this; $.each(searchResults.userGroups, function (_, tenant) { // see if this match is not already selected if ($.inArray(tenant.id, allowedGroups) === -1) { nfUserSearchAutocomplete._renderGroup(ul, $.extend({ type: 'group' }, tenant)); } }); $.each(searchResults.users, function (_, tenant) { // see if this match is not already selected if ($.inArray(tenant.id, allowedUsers) === -1) { nfUserSearchAutocomplete._renderUser(ul, $.extend({ type: 'user' }, tenant)); } }); // ensure there were some results if (ul.children().length === 0) { ul.append('<li class="unset search-no-matches">No users matched the search terms</li>'); } }, _resizeMenu: function () { var ul = this.menu.element; ul.width($('#search-users-field').outerWidth() - 2); }, _renderUser: function (ul, match) { var userContent = $('<a></a>').text(match.component.identity); return $('<li></li>').data('ui-autocomplete-item', match).append(userContent).appendTo(ul); }, _renderGroup: function (ul, match) { var groupLabel = $('<span></span>').text(match.component.identity); var groupContent = $('<a></a>').append('<div class="fa fa-users" style="margin-right: 5px;"></div>').append(groupLabel); return $('<li></li>').data('ui-autocomplete-item', match).append(groupContent).appendTo(ul); } }); // configure the autocomplete field $('#search-users-field').userSearchAutocomplete({ minLength: 0, appendTo: '#search-users-results', position: { my: 'left top', at: 'left bottom', offset: '0 1' }, source: function (request, response) { // create the search request $.ajax({ type: 'GET', data: { q: request.term }, dataType: 'json', url: config.urls.searchTenants }).done(function (searchResponse) { response(searchResponse); }); }, select: function (event, ui) { addAllowedTenant(ui.item); // reset the search field $(this).val(''); // stop event propagation return false; } }); }; /** * Gets all allowed groups including those already in the policy and those selected while searching (not yet saved). * * @returns {Array} */ var getAllAllowedGroups = function () { var policyGrid = $('#policy-table').data('gridInstance'); var policyData = policyGrid.getData(); var userGroups = []; // consider existing groups in the policy table var items = policyData.getItems(); $.each(items, function (_, item) { if (item.type === 'group') { userGroups.push(item.id); } }); // also consider groups already selected in the search users dialog $.each(getTenantsToAdd($('#allowed-groups')), function (_, group) { userGroups.push(group.id); }); return userGroups; }; /** * Gets the user groups that will be added upon applying the changes. * * @param {jQuery} container * @returns {Array} */ var getTenantsToAdd = function (container) { var tenants = []; // also consider groups already selected in the search users dialog container.children('li').each(function (_, allowedTenant) { var tenant = $(allowedTenant).data('tenant'); if (nfCommon.isDefinedAndNotNull(tenant)) { tenants.push(tenant); } }); return tenants; }; /** * Gets all allowed users including those already in the policy and those selected while searching (not yet saved). * * @returns {Array} */ var getAllAllowedUsers = function () { var policyGrid = $('#policy-table').data('gridInstance'); var policyData = policyGrid.getData(); var users = []; // consider existing users in the policy table var items = policyData.getItems(); $.each(items, function (_, item) { if (item.type === 'user') { users.push(item.id); } }); // also consider users already selected in the search users dialog $.each(getTenantsToAdd($('#allowed-users')), function (_, user) { users.push(user.id); }); return users; }; /** * Added the specified tenant to the listing of users/groups which will be added when applied. * * @param allowedTenant user/group to add */ var addAllowedTenant = function (allowedTenant) { var allowedTenants = allowedTenant.type === 'user' ? $('#allowed-users') : $('#allowed-groups'); // append the user var tenant = $('<span></span>').addClass('allowed-entity ellipsis').text(allowedTenant.component.identity).ellipsis(); var tenantAction = $('<div></div>').addClass('remove-allowed-entity fa fa-trash'); $('<li></li>').data('tenant', allowedTenant).append(tenant).append(tenantAction).appendTo(allowedTenants); }; /** * Determines whether the specified global policy type supports read/write options. * * @param policyType global policy type * @returns {boolean} whether the policy supports read/write options */ var globalPolicySupportsReadWrite = function (policyType) { return policyType === 'controller' || policyType === 'counters' || policyType === 'policies' || policyType === 'tenants'; }; /** * Determines whether the specified global policy type only supports write. * * @param policyType global policy type * @returns {boolean} whether the policy only supports write */ var globalPolicySupportsWrite = function (policyType) { return policyType === 'proxy' || policyType === 'restricted-components'; }; /** * Initializes the policy table. */ var initPolicyTable = function () { $('#override-policy-dialog').modal({ headerText: 'Override Policy', buttons: [{ buttonText: 'Override', color: { base: '#728E9B', hover: '#004849', text: '#ffffff' }, handler: { click: function () { // create the policy, copying if appropriate createPolicy($('#copy-policy-radio-button').is(':checked')); $(this).modal('hide'); } } }, { buttonText: 'Cancel', color: { base: '#E3E8EB', hover: '#C7D2D7', text: '#004849' }, handler: { click: function () { $(this).modal('hide'); } } }], handler: { close: function () { // reset the radio button $('#copy-policy-radio-button').prop('checked', true); } } }); // create/add a policy $('#create-policy-link, #add-local-admin-link').on('click', function () { createPolicy(false); }); // override a policy $('#override-policy-link').on('click', function () { $('#override-policy-dialog').modal('show'); }); // policy type listing $('#policy-type-list').combo({ options: [ nfCommon.getPolicyTypeListing('flow'), nfCommon.getPolicyTypeListing('controller'), nfCommon.getPolicyTypeListing('provenance'), nfCommon.getPolicyTypeListing('restricted-components'), nfCommon.getPolicyTypeListing('policies'), nfCommon.getPolicyTypeListing('tenants'), nfCommon.getPolicyTypeListing('site-to-site'), nfCommon.getPolicyTypeListing('system'), nfCommon.getPolicyTypeListing('proxy'), nfCommon.getPolicyTypeListing('counters')], select: function (option) { if (initialized) { // record the policy type $('#selected-policy-type').text(option.value); // if the option is for a specific component if (globalPolicySupportsReadWrite(option.value)) { // update the policy target and let it relaod the policy $('#controller-policy-target').combo('setSelectedOption', { 'value': 'read' }).show(); } else { $('#controller-policy-target').hide(); // record the action if (globalPolicySupportsWrite(option.value)) { $('#selected-policy-action').text('write'); } else { $('#selected-policy-action').text('read'); } // reload the policy loadPolicy(); } } } }); // controller policy target $('#controller-policy-target').combo({ options: [{ text: 'view', value: 'read' }, { text: 'modify', value: 'write' }], select: function (option) { if (initialized) { // record the policy action $('#selected-policy-action').text(option.value); // reload the policy loadPolicy(); } } }); // component policy target $('#component-policy-target').combo({ options: [{ text: 'view the component', value: 'read-component', description: 'Allows users to view component configuration details' }, { text: 'modify the component', value: 'write-component', description: 'Allows users to modify component configuration details' }, { text: 'view the data', value: 'read-data', description: 'Allows users to view metadata and content for this component through provenance data and flowfile queues in outbound connections' }, { text: 'modify the data', value: 'write-data', description: 'Allows users to empty flowfile queues in outbound connections and submit replays' }, { text: 'receive data via site-to-site', value: 'write-receive-data', description: 'Allows this port to receive data from these NiFi instances', disabled: true }, { text: 'send data via site-to-site', value: 'write-send-data', description: 'Allows this port to send data to these NiFi instances', disabled: true }, { text: 'view the policies', value: 'read-policies', description: 'Allows users to view the list of users who can view/modify this component' }, { text: 'modify the policies', value: 'write-policies', description: 'Allows users to modify the list of users who can view/modify this component' }], select: function (option) { if (initialized) { var resource = $('#selected-policy-component-type').text(); if (option.value === 'read-component') { $('#selected-policy-action').text('read'); } else if (option.value === 'write-component') { $('#selected-policy-action').text('write'); } else if (option.value === 'read-data') { $('#selected-policy-action').text('read'); resource = ('data/' + resource); } else if (option.value === 'write-data') { $('#selected-policy-action').text('write'); resource = ('data/' + resource); } else if (option.value === 'read-policies') { $('#selected-policy-action').text('read'); resource = ('policies/' + resource); } else if (option.value === 'write-policies') { $('#selected-policy-action').text('write'); resource = ('policies/' + resource); } else if (option.value === 'write-receive-data') { $('#selected-policy-action').text('write'); resource = 'data-transfer/input-ports'; } else if (option.value === 'write-send-data') { $('#selected-policy-action').text('write'); resource = 'data-transfer/output-ports'; } // set the resource $('#selected-policy-type').text(resource); // reload the policy loadPolicy(); } } }); // function for formatting the user identity var identityFormatter = function (row, cell, value, columnDef, dataContext) { var markup = ''; if (dataContext.type === 'group') { markup += '<div class="fa fa-users" style="margin-right: 5px;"></div>'; } markup += dataContext.component.identity; return markup; }; // function for formatting the actions column var actionFormatter = function (row, cell, value, columnDef, dataContext) { var markup = ''; // see if the user has permissions for the current policy var currentEntity = $('#policy-table').data('policy'); var isPolicyEditable = $('#delete-policy-button').is(':disabled') === false; if (currentEntity.permissions.canWrite === true && isPolicyEditable) { markup += '<div title="Remove" class="pointer delete-user fa fa-trash"></div>'; } return markup; }; // initialize the templates table var usersColumns = [ { id: 'identity', name: 'User', sortable: true, resizable: true, formatter: identityFormatter }, { id: 'actions', name: '&nbsp;', sortable: false, resizable: false, formatter: actionFormatter, width: 100, maxWidth: 100 } ]; var usersOptions = { forceFitColumns: true, enableTextSelectionOnCells: true, enableCellNavigation: true, enableColumnReorder: false, autoEdit: false }; // initialize the dataview var policyData = new Slick.Data.DataView({ inlineFilters: false }); policyData.setItems([]); // initialize the sort sort({ columnId: 'identity', sortAsc: true }, policyData); // initialize the grid var policyGrid = new Slick.Grid('#policy-table', policyData, usersColumns, usersOptions); policyGrid.setSelectionModel(new Slick.RowSelectionModel()); policyGrid.registerPlugin(new Slick.AutoTooltips()); policyGrid.setSortColumn('identity', true); policyGrid.onSort.subscribe(function (e, args) { sort({ columnId: args.sortCol.id, sortAsc: args.sortAsc }, policyData); }); // configure a click listener policyGrid.onClick.subscribe(function (e, args) { var target = $(e.target); // get the node at this row var item = policyData.getItem(args.row); // determine the desired action if (policyGrid.getColumns()[args.cell].id === 'actions') { if (target.hasClass('delete-user')) { promptToRemoveUserFromPolicy(item); } } }); // wire up the dataview to the grid policyData.onRowCountChanged.subscribe(function (e, args) { policyGrid.updateRowCount(); policyGrid.render(); // update the total number of displayed policy users $('#displayed-policy-users').text(args.current); }); policyData.onRowsChanged.subscribe(function (e, args) { policyGrid.invalidateRows(args.rows); policyGrid.render(); }); // hold onto an instance of the grid $('#policy-table').data('gridInstance', policyGrid); // initialize the number of displayed items $('#displayed-policy-users').text('0'); }; /** * Sorts the specified data using the specified sort details. * * @param {object} sortDetails * @param {object} data */ var sort = function (sortDetails, data) { // defines a function for sorting var comparer = function (a, b) { if(a.permissions.canRead && b.permissions.canRead) { var aString = nfCommon.isDefinedAndNotNull(a.component[sortDetails.columnId]) ? a.component[sortDetails.columnId] : ''; var bString = nfCommon.isDefinedAndNotNull(b.component[sortDetails.columnId]) ? b.component[sortDetails.columnId] : ''; return aString === bString ? 0 : aString > bString ? 1 : -1; } else { if (!a.permissions.canRead && !b.permissions.canRead){ return 0; } if(a.permissions.canRead){ return 1; } else { return -1; } } }; // perform the sort data.sort(comparer, sortDetails.sortAsc); }; /** * Prompts for the removal of the specified user. * * @param item */ var promptToRemoveUserFromPolicy = function (item) { nfDialog.showYesNoDialog({ headerText: 'Update Policy', dialogContent: 'Remove \'' + nfCommon.escapeHtml(item.component.identity) + '\' from this policy?', yesHandler: function () { removeUserFromPolicy(item); } }); }; /** * Removes the specified item from the current policy. * * @param item */ var removeUserFromPolicy = function (item) { var policyGrid = $('#policy-table').data('gridInstance'); var policyData = policyGrid.getData(); // begin the update policyData.beginUpdate(); // remove the user policyData.deleteItem(item.id); // end the update policyData.endUpdate(); // save the configuration updatePolicy(); }; /** * Prompts for the deletion of the selected policy. */ var promptToDeletePolicy = function () { nfDialog.showYesNoDialog({ headerText: 'Delete Policy', dialogContent: 'By deleting this policy, the permissions for this component will revert to the inherited policy if applicable.', yesText: 'Delete', noText: 'Cancel', yesHandler: function () { deletePolicy(); } }); }; /** * Deletes the current policy. */ var deletePolicy = function () { var currentEntity = $('#policy-table').data('policy'); if (nfCommon.isDefinedAndNotNull(currentEntity)) { $.ajax({ type: 'DELETE', url: currentEntity.uri + '?' + $.param(nfClient.getRevision(currentEntity)), dataType: 'json' }).done(function () { loadPolicy(); }).fail(function (xhr, status, error) { nfErrorHandler.handleAjaxError(xhr, status, error); resetPolicy(); loadPolicy(); }); } else { nfDialog.showOkDialog({ headerText: 'Delete Policy', dialogContent: 'No policy selected' }); } }; /** * Gets the currently selected resource. */ var getSelectedResourceAndAction = function () { var componentId = $('#selected-policy-component-id').text(); var resource = $('#selected-policy-type').text(); if (componentId !== '') { resource += ('/' + componentId); } return { 'action': $('#selected-policy-action').text(), 'resource': '/' + resource }; }; /** * Populates the table with the specified users and groups. * * @param users * @param userGroups */ var populateTable = function (users, userGroups) { var policyGrid = $('#policy-table').data('gridInstance'); var policyData = policyGrid.getData(); // begin the update policyData.beginUpdate(); var policyUsers = []; // add each user $.each(users, function (_, user) { policyUsers.push($.extend({ type: 'user' }, user)); }); // add each group $.each(userGroups, function (_, group) { policyUsers.push($.extend({ type: 'group' }, group)); }); // set the rows policyData.setItems(policyUsers); // end the update policyData.endUpdate(); // re-sort and clear selection after updating policyData.reSort(); policyGrid.invalidate(); policyGrid.getSelectionModel().setSelectedRows([]); }; /** * Converts the specified resource into human readable form. * * @param resource */ var getResourceMessage = function (resource) { if (resource === '/policies') { return $('<span>Showing effective policy inherited from all policies.</span>'); } else if (resource === '/controller') { return $('<span>Showing effective policy inherited from the controller.</span>'); } else { // extract the group id var processGroupId = nfCommon.substringAfterLast(resource, '/'); var processGroupName = processGroupId; // attempt to resolve the group name var breadcrumbs = nfNgBridge.injector.get('breadcrumbsCtrl').getBreadcrumbs(); $.each(breadcrumbs, function (_, breadcrumbEntity) { if (breadcrumbEntity.id === processGroupId) { processGroupName = breadcrumbEntity.label; return false; } }); // build the mark up return $('<span>Showing effective policy inherited from Process Group </span>') .append( $('<span class="link ellipsis" style="max-width: 200px; vertical-align: top;"></span>') .text(processGroupName) .attr('title', processGroupName) .on('click', function () { // close the shell $('#shell-close-button').click(); // load the correct group and unselect everything if necessary nfCanvasUtils.getComponentByType('ProcessGroup').enterGroup(processGroupId).done(function () { nfCanvasUtils.getSelection().classed('selected', false); // inform Angular app that values have changed nfNgBridge.digest(); }); }) ).append('<span>.</span>'); } }; /** * Populates the specified policy. * * @param policyEntity */ var populatePolicy = function (policyEntity) { var policy = policyEntity.component; // get the currently selected policy var resourceAndAction = getSelectedResourceAndAction(); // reset of the policy message resetPolicyMessage(); // store the current policy version $('#policy-table').data('policy', policyEntity); // see if the policy is for this resource if (resourceAndAction.resource === policy.resource) { // allow remove when policy is not inherited $('#delete-policy-button').prop('disabled', policyEntity.permissions.canWrite === false); // allow modification if allowed $('#new-policy-user-button').prop('disabled', policyEntity.permissions.canWrite === false); } else { $('#policy-message').append(getResourceMessage(policy.resource)); // policy is inherited, we do not know if the user has permissions to modify the desired policy... show button and let server decide $('#override-policy-message').show(); // do not support policy deletion/modification $('#delete-policy-button').prop('disabled', true); $('#new-policy-user-button').prop('disabled', true); } // populate the table populateTable(policy.users, policy.userGroups); }; /** * Loads the configuration for the specified process group. */ var loadPolicy = function () { var resourceAndAction = getSelectedResourceAndAction(); var policyDeferred; if (resourceAndAction.resource.startsWith('/policies')) { $('#admin-policy-message').show(); policyDeferred = $.Deferred(function (deferred) { $.ajax({ type: 'GET', url: '../nifi-api/policies/' + resourceAndAction.action + resourceAndAction.resource, dataType: 'json' }).done(function (policyEntity) { // update the refresh timestamp $('#policy-last-refreshed').text(policyEntity.generated); // ensure appropriate actions for the loaded policy if (policyEntity.permissions.canRead === true) { var policy = policyEntity.component; // if the return policy is for the desired policy (not inherited, show it) if (resourceAndAction.resource === policy.resource) { // populate the policy details populatePolicy(policyEntity); } else { // reset the policy resetPolicy(); // show an appropriate message $('#policy-message').text('No component specific administrators.'); // we don't know if the user has permissions to the desired policy... show create button and allow the server to decide $('#add-local-admin-message').show(); } } else { // reset the policy resetPolicy(); // show an appropriate message $('#policy-message').text('No component specific administrators.'); // we don't know if the user has permissions to the desired policy... show create button and allow the server to decide $('#add-local-admin-message').show(); } deferred.resolve(); }).fail(function (xhr, status, error) { if (xhr.status === 404) { // reset the policy resetPolicy(); // show an appropriate message $('#policy-message').text('No component specific administrators.'); // we don't know if the user has permissions to the desired policy... show create button and allow the server to decide $('#add-local-admin-message').show(); deferred.resolve(); } else if (xhr.status === 403) { // reset the policy resetPolicy(); // show an appropriate message $('#policy-message').text('Not authorized to access the policy for the specified resource.'); deferred.resolve(); } else { // reset the policy resetPolicy(); deferred.reject(); nfErrorHandler.handleAjaxError(xhr, status, error); } }); }).promise(); } else { $('#admin-policy-message').hide(); policyDeferred = $.Deferred(function (deferred) { $.ajax({ type: 'GET', url: '../nifi-api/policies/' + resourceAndAction.action + resourceAndAction.resource, dataType: 'json' }).done(function (policyEntity) { // return OK so we either have access to the policy or we don't have access to an inherited policy // update the refresh timestamp $('#policy-last-refreshed').text(policyEntity.generated); // ensure appropriate actions for the loaded policy if (policyEntity.permissions.canRead === true) { // populate the policy details populatePolicy(policyEntity); } else { // reset the policy resetPolicy(); // since we cannot read, the policy may be inherited or not... we cannot tell $('#policy-message').text('Not authorized to view the policy.'); // allow option to override because we don't know if it's supported or not $('#override-policy-message').show(); } deferred.resolve(); }).fail(function (xhr, status, error) { if (xhr.status === 404) { // reset the policy resetPolicy(); // show an appropriate message $('#policy-message').text('No policy for the specified resource.'); // we don't know if the user has permissions to the desired policy... show create button and allow the server to decide $('#new-policy-message').show(); deferred.resolve(); } else if (xhr.status === 403) { // reset the policy resetPolicy(); // show an appropriate message $('#policy-message').text('Not authorized to access the policy for the specified resource.'); deferred.resolve(); } else { resetPolicy(); deferred.reject(); nfErrorHandler.handleAjaxError(xhr, status, error); } }); }).promise(); } return policyDeferred; }; /** * Creates a new policy for the current selection. * * @param copyInheritedPolicy Whether or not to copy the inherited policy */ var createPolicy = function (copyInheritedPolicy) { var resourceAndAction = getSelectedResourceAndAction(); var users = []; var userGroups = []; if (copyInheritedPolicy === true) { var policyGrid = $('#policy-table').data('gridInstance'); var policyData = policyGrid.getData(); var items = policyData.getItems(); $.each(items, function (_, item) { var itemCopy = $.extend({}, item); if (itemCopy.type === 'user') { users.push(itemCopy); } else { userGroups.push(itemCopy); } // remove the type as it was added client side to render differently and is not part of the actual schema delete itemCopy.type; }); } var entity = { 'revision': nfClient.getRevision({ 'revision': { 'version': 0 } }), 'component': { 'action': resourceAndAction.action, 'resource': resourceAndAction.resource, 'users': users, 'userGroups': userGroups } }; $.ajax({ type: 'POST', url: '../nifi-api/policies', data: JSON.stringify(entity), dataType: 'json', contentType: 'application/json' }).done(function (policyEntity) { // ensure appropriate actions for the loaded policy if (policyEntity.permissions.canRead === true) { // populate the policy details populatePolicy(policyEntity); } else { // the request succeeded but we don't have access to the policy... reset/reload the policy resetPolicy(); loadPolicy(); } }).fail(nfErrorHandler.handleAjaxError); }; /** * Updates the policy for the current selection. */ var updatePolicy = function () { var policyGrid = $('#policy-table').data('gridInstance'); var policyData = policyGrid.getData(); var users = []; var userGroups = []; var items = policyData.getItems(); $.each(items, function (_, item) { var itemCopy = $.extend({}, item); if (itemCopy.type === 'user') { users.push(itemCopy); } else { userGroups.push(itemCopy); } // remove the type as it was added client side to render differently and is not part of the actual schema delete itemCopy.type; }); var currentEntity = $('#policy-table').data('policy'); if (nfCommon.isDefinedAndNotNull(currentEntity)) { var entity = { 'revision': nfClient.getRevision(currentEntity), 'component': { 'id': currentEntity.id, 'users': users, 'userGroups': userGroups } }; $.ajax({ type: 'PUT', url: currentEntity.uri, data: JSON.stringify(entity), dataType: 'json', contentType: 'application/json' }).done(function (policyEntity) { // ensure appropriate actions for the loaded policy if (policyEntity.permissions.canRead === true) { // populate the policy details populatePolicy(policyEntity); } else { // the request succeeded but we don't have access to the policy... reset/reload the policy resetPolicy(); loadPolicy(); } }).fail(function (xhr, status, error) { nfErrorHandler.handleAjaxError(xhr, status, error); resetPolicy(); loadPolicy(); }).always(function () { nfCanvasUtils.reload({ 'transition': true }); }); } else { nfDialog.showOkDialog({ headerText: 'Update Policy', dialogContent: 'No policy selected' }); } }; /** * Shows the process group configuration. */ var showPolicy = function () { // show the configuration dialog nfShell.showContent('#policy-management').always(function () { reset(); }); // adjust the table size nfPolicyManagement.resetTableSize(); }; /** * Reset the policy message. */ var resetPolicyMessage = function () { $('#policy-message').text('').empty(); $('#new-policy-message').hide(); $('#override-policy-message').hide(); $('#add-local-admin-message').hide(); }; /** * Reset the policy. */ var resetPolicy = function () { resetPolicyMessage(); // reset button state $('#delete-policy-button').prop('disabled', true); $('#new-policy-user-button').prop('disabled', true); // reset the current policy $('#policy-table').removeData('policy'); // populate the table with no users populateTable([], []); } /** * Resets the policy management dialog. */ var reset = function () { resetPolicy(); // clear the selected policy details $('#selected-policy-type').text(''); $('#selected-policy-action').text(''); $('#selected-policy-component-id').text(''); $('#selected-policy-component-type').text(''); // clear the selected component details $('div.policy-selected-component-container').hide(); }; var nfPolicyManagement = { /** * Initializes the settings page. */ init: function () { initAddTenantToPolicyDialog(); initPolicyTable(); $('#policy-refresh-button').on('click', function () { loadPolicy(); }); // reset the policy to initialize resetPolicy(); // mark as initialized initialized = true; }, /** * Update the size of the grid based on its container's current size. */ resetTableSize: function () { var policyTable = $('#policy-table'); if (policyTable.is(':visible')) { var policyGrid = policyTable.data('gridInstance'); if (nfCommon.isDefinedAndNotNull(policyGrid)) { policyGrid.resizeCanvas(); } } }, /** * Shows the controller service policy. * * @param d */ showControllerServicePolicy: function (d) { // reset the policy message resetPolicyMessage(); // update the policy controls visibility $('#component-policy-controls').show(); $('#global-policy-controls').hide(); // update the visibility if (d.permissions.canRead === true) { $('#policy-selected-controller-service-container div.policy-selected-component-name').text(d.component.name); } else { $('#policy-selected-controller-service-container div.policy-selected-component-name').text(d.id); } $('#policy-selected-controller-service-container').show(); // populate the initial resource $('#selected-policy-component-id').text(d.id); $('#selected-policy-component-type').text('controller-services'); $('#component-policy-target') .combo('setOptionEnabled', { value: 'write-receive-data' }, false) .combo('setOptionEnabled', { value: 'write-send-data' }, false) .combo('setOptionEnabled', { value: 'read-data' }, false) .combo('setOptionEnabled', { value: 'write-data' }, false) .combo('setSelectedOption', { value: 'read-component' }); return loadPolicy().always(showPolicy); }, /** * Shows the reporting task policy. * * @param d */ showReportingTaskPolicy: function (d) { // reset the policy message resetPolicyMessage(); // update the policy controls visibility $('#component-policy-controls').show(); $('#global-policy-controls').hide(); // update the visibility if (d.permissions.canRead === true) { $('#policy-selected-reporting-task-container div.policy-selected-component-name').text(d.component.name); } else { $('#policy-selected-reporting-task-container div.policy-selected-component-name').text(d.id); } $('#policy-selected-reporting-task-container').show(); // populate the initial resource $('#selected-policy-component-id').text(d.id); $('#selected-policy-component-type').text('reporting-tasks'); $('#component-policy-target') .combo('setOptionEnabled', { value: 'write-receive-data' }, false) .combo('setOptionEnabled', { value: 'write-send-data' }, false) .combo('setOptionEnabled', { value: 'read-data' }, false) .combo('setOptionEnabled', { value: 'write-data' }, false) .combo('setSelectedOption', { value: 'read-component' }); return loadPolicy().always(showPolicy); }, /** * Shows the template policy. * * @param d */ showTemplatePolicy: function (d) { // reset the policy message resetPolicyMessage(); // update the policy controls visibility $('#component-policy-controls').show(); $('#global-policy-controls').hide(); // update the visibility if (d.permissions.canRead === true) { $('#policy-selected-template-container div.policy-selected-component-name').text(d.template.name); } else { $('#policy-selected-template-container div.policy-selected-component-name').text(d.id); } $('#policy-selected-template-container').show(); // populate the initial resource $('#selected-policy-component-id').text(d.id); $('#selected-policy-component-type').text('templates'); $('#component-policy-target') .combo('setOptionEnabled', { value: 'write-receive-data' }, false) .combo('setOptionEnabled', { value: 'write-send-data' }, false) .combo('setOptionEnabled', { value: 'read-data' }, false) .combo('setOptionEnabled', { value: 'write-data' }, false) .combo('setSelectedOption', { value: 'read-component' }); return loadPolicy().always(showPolicy); }, /** * Shows the component policy dialog. */ showComponentPolicy: function (selection) { // reset the policy message resetPolicyMessage(); // update the policy controls visibility $('#component-policy-controls').show(); $('#global-policy-controls').hide(); // update the visibility $('#policy-selected-component-container').show(); var resource; if (selection.empty()) { $('#selected-policy-component-id').text(nfCanvasUtils.getGroupId()); resource = 'process-groups'; // disable site to site option $('#component-policy-target') .combo('setOptionEnabled', { value: 'write-receive-data' }, false) .combo('setOptionEnabled', { value: 'write-send-data' }, false) .combo('setOptionEnabled', { value: 'read-data' }, true) .combo('setOptionEnabled', { value: 'write-data' }, true); } else { var d = selection.datum(); $('#selected-policy-component-id').text(d.id); if (nfCanvasUtils.isProcessor(selection)) { resource = 'processors'; } else if (nfCanvasUtils.isProcessGroup(selection)) { resource = 'process-groups'; } else if (nfCanvasUtils.isInputPort(selection)) { resource = 'input-ports'; } else if (nfCanvasUtils.isOutputPort(selection)) { resource = 'output-ports'; } else if (nfCanvasUtils.isRemoteProcessGroup(selection)) { resource = 'remote-process-groups'; } else if (nfCanvasUtils.isLabel(selection)) { resource = 'labels'; } else if (nfCanvasUtils.isFunnel(selection)) { resource = 'funnels'; } // enable site to site option $('#component-policy-target') .combo('setOptionEnabled', { value: 'write-receive-data' }, nfCanvasUtils.isInputPort(selection) && nfCanvasUtils.getParentGroupId() === null) .combo('setOptionEnabled', { value: 'write-send-data' }, nfCanvasUtils.isOutputPort(selection) && nfCanvasUtils.getParentGroupId() === null) .combo('setOptionEnabled', { value: 'read-data' }, !nfCanvasUtils.isLabel(selection)) .combo('setOptionEnabled', { value: 'write-data' }, !nfCanvasUtils.isLabel(selection)); } // populate the initial resource $('#selected-policy-component-type').text(resource); $('#component-policy-target').combo('setSelectedOption', { value: 'read-component' }); return loadPolicy().always(showPolicy); }, /** * Shows the global policies dialog. */ showGlobalPolicies: function () { // reset the policy message resetPolicyMessage(); // update the policy controls visibility $('#component-policy-controls').hide(); $('#global-policy-controls').show(); // reload the current policies var policyType = $('#policy-type-list').combo('getSelectedOption').value; $('#selected-policy-type').text(policyType); if (globalPolicySupportsReadWrite(policyType)) { $('#selected-policy-action').text($('#controller-policy-target').combo('getSelectedOption').value); } else if (globalPolicySupportsWrite(policyType)) { $('#selected-policy-action').text('write'); } else { $('#selected-policy-action').text('read'); } return loadPolicy().always(showPolicy); } }; return nfPolicyManagement; }));
tequalsme/nifi
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-policy-management.js
JavaScript
apache-2.0
55,421
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/connect/model/ListInstanceStorageConfigsRequest.h> #include <aws/core/utils/json/JsonSerializer.h> #include <aws/core/http/URI.h> #include <aws/core/utils/memory/stl/AWSStringStream.h> #include <utility> using namespace Aws::Connect::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws::Http; ListInstanceStorageConfigsRequest::ListInstanceStorageConfigsRequest() : m_instanceIdHasBeenSet(false), m_resourceType(InstanceStorageResourceType::NOT_SET), m_resourceTypeHasBeenSet(false), m_nextTokenHasBeenSet(false), m_maxResults(0), m_maxResultsHasBeenSet(false) { } Aws::String ListInstanceStorageConfigsRequest::SerializePayload() const { return {}; } void ListInstanceStorageConfigsRequest::AddQueryStringParameters(URI& uri) const { Aws::StringStream ss; if(m_resourceTypeHasBeenSet) { ss << InstanceStorageResourceTypeMapper::GetNameForInstanceStorageResourceType(m_resourceType); uri.AddQueryStringParameter("resourceType", ss.str()); ss.str(""); } if(m_nextTokenHasBeenSet) { ss << m_nextToken; uri.AddQueryStringParameter("nextToken", ss.str()); ss.str(""); } if(m_maxResultsHasBeenSet) { ss << m_maxResults; uri.AddQueryStringParameter("maxResults", ss.str()); ss.str(""); } }
aws/aws-sdk-cpp
aws-cpp-sdk-connect/source/model/ListInstanceStorageConfigsRequest.cpp
C++
apache-2.0
1,489
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to you under the Apache License, * Version 2.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.pivot.beans; /** * Thrown when an error is encountered during binding. */ public class BindException extends RuntimeException { private static final long serialVersionUID = 7245531555497832713L; public BindException() { super(); } public BindException(String message) { super(message); } public BindException(Throwable cause) { super(cause); } public BindException(String message, Throwable cause) { super(message, cause); } }
ggeorg/chillverse
src/org/apache/pivot/beans/BindException.java
Java
apache-2.0
1,323
/* * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). * You may not use this file except in compliance with the License. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ package com.amazonaws.services.lambda.model.transform; import static com.amazonaws.util.StringUtils.UTF8; import static com.amazonaws.util.StringUtils.COMMA_SEPARATOR; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.OutputStreamWriter; import java.io.StringWriter; import java.io.Writer; import java.util.Collections; import java.util.HashMap; import java.util.Map; import java.util.List; import java.util.regex.Pattern; import com.amazonaws.AmazonClientException; import com.amazonaws.Request; import com.amazonaws.DefaultRequest; import com.amazonaws.http.HttpMethodName; import com.amazonaws.services.lambda.model.*; import com.amazonaws.transform.Marshaller; import com.amazonaws.util.BinaryUtils; import com.amazonaws.util.StringUtils; import com.amazonaws.util.StringInputStream; import com.amazonaws.util.json.*; /** * Create Event Source Mapping Request Marshaller */ public class CreateEventSourceMappingRequestMarshaller implements Marshaller<Request<CreateEventSourceMappingRequest>, CreateEventSourceMappingRequest> { private static final String RESOURCE_PATH_TEMPLATE; private static final Map<String, String> STATIC_QUERY_PARAMS; private static final Map<String, String> DYNAMIC_QUERY_PARAMS; static { String path = "/2015-03-31/event-source-mappings/"; Map<String, String> staticMap = new HashMap<String, String>(); Map<String, String> dynamicMap = new HashMap<String, String>(); int index = path.indexOf("?"); if (index != -1) { String queryString = path.substring(index + 1); path = path.substring(0, index); for (String s : queryString.split("[;&]")) { index = s.indexOf("="); if (index != -1) { String name = s.substring(0, index); String value = s.substring(index + 1); if (value.startsWith("{") && value.endsWith("}")) { dynamicMap.put(value.substring(1, value.length() - 1), name); } else { staticMap.put(name, value); } } } } RESOURCE_PATH_TEMPLATE = path; STATIC_QUERY_PARAMS = Collections.unmodifiableMap(staticMap); DYNAMIC_QUERY_PARAMS = Collections.unmodifiableMap(dynamicMap); } public Request<CreateEventSourceMappingRequest> marshall(CreateEventSourceMappingRequest createEventSourceMappingRequest) { if (createEventSourceMappingRequest == null) { throw new AmazonClientException("Invalid argument passed to marshall(...)"); } Request<CreateEventSourceMappingRequest> request = new DefaultRequest<CreateEventSourceMappingRequest>(createEventSourceMappingRequest, "AWSLambda"); String target = "AWSLambda.CreateEventSourceMapping"; request.addHeader("X-Amz-Target", target); request.setHttpMethod(HttpMethodName.POST); String uriResourcePath = RESOURCE_PATH_TEMPLATE; request.setResourcePath(uriResourcePath.replaceAll("//", "/")); for (Map.Entry<String, String> entry : STATIC_QUERY_PARAMS.entrySet()) { request.addParameter(entry.getKey(), entry.getValue()); } try { StringWriter stringWriter = new StringWriter(); JSONWriter jsonWriter = new JSONWriter(stringWriter); jsonWriter.object(); if (createEventSourceMappingRequest.getEventSourceArn() != null) { jsonWriter.key("EventSourceArn").value(createEventSourceMappingRequest.getEventSourceArn()); } if (createEventSourceMappingRequest.getFunctionName() != null) { jsonWriter.key("FunctionName").value(createEventSourceMappingRequest.getFunctionName()); } if (createEventSourceMappingRequest.isEnabled() != null) { jsonWriter.key("Enabled").value(createEventSourceMappingRequest.isEnabled()); } if (createEventSourceMappingRequest.getBatchSize() != null) { jsonWriter.key("BatchSize").value(createEventSourceMappingRequest.getBatchSize()); } if (createEventSourceMappingRequest.getStartingPosition() != null) { jsonWriter.key("StartingPosition").value(createEventSourceMappingRequest.getStartingPosition()); } jsonWriter.endObject(); String snippet = stringWriter.toString(); byte[] content = snippet.getBytes(UTF8); request.setContent(new StringInputStream(snippet)); request.addHeader("Content-Length", Integer.toString(content.length)); request.addHeader("Content-Type", "application/x-amz-json-1.1"); } catch(Throwable t) { throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t); } return request; } }
mhurne/aws-sdk-java
aws-java-sdk-lambda/src/main/java/com/amazonaws/services/lambda/model/transform/CreateEventSourceMappingRequestMarshaller.java
Java
apache-2.0
5,568
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.carbondata.scan.model; import java.io.Serializable; import org.apache.carbondata.core.carbon.metadata.schema.table.column.CarbonDimension; /** * query plan dimension which will holds the information about the query plan dimension * this is done to avoid heavy object serialization */ public class QueryDimension extends QueryColumn implements Serializable { /** * serialVersionUID */ private static final long serialVersionUID = -8492704093776645651L; /** * actual dimension column */ private transient CarbonDimension dimension; public QueryDimension(String columName) { super(columName); } /** * @return the dimension */ public CarbonDimension getDimension() { return dimension; } /** * @param dimension the dimension to set */ public void setDimension(CarbonDimension dimension) { this.dimension = dimension; } }
foryou2030/incubator-carbondata
core/src/main/java/org/apache/carbondata/scan/model/QueryDimension.java
Java
apache-2.0
1,715
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/ce/model/GetReservationCoverageResult.h> #include <aws/core/utils/json/JsonSerializer.h> #include <aws/core/AmazonWebServiceResult.h> #include <aws/core/utils/StringUtils.h> #include <aws/core/utils/UnreferencedParam.h> #include <utility> using namespace Aws::CostExplorer::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; GetReservationCoverageResult::GetReservationCoverageResult() { } GetReservationCoverageResult::GetReservationCoverageResult(const Aws::AmazonWebServiceResult<JsonValue>& result) { *this = result; } GetReservationCoverageResult& GetReservationCoverageResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("CoveragesByTime")) { Array<JsonView> coveragesByTimeJsonList = jsonValue.GetArray("CoveragesByTime"); for(unsigned coveragesByTimeIndex = 0; coveragesByTimeIndex < coveragesByTimeJsonList.GetLength(); ++coveragesByTimeIndex) { m_coveragesByTime.push_back(coveragesByTimeJsonList[coveragesByTimeIndex].AsObject()); } } if(jsonValue.ValueExists("Total")) { m_total = jsonValue.GetObject("Total"); } if(jsonValue.ValueExists("NextPageToken")) { m_nextPageToken = jsonValue.GetString("NextPageToken"); } return *this; }
jt70471/aws-sdk-cpp
aws-cpp-sdk-ce/source/model/GetReservationCoverageResult.cpp
C++
apache-2.0
1,482
package com.github.toastshaman.dropwizard.auth.jwt.example; import com.github.toastshaman.dropwizard.auth.jwt.JWTAuthFilter; import com.github.toastshaman.dropwizard.auth.jwt.JsonWebTokenParser; import com.github.toastshaman.dropwizard.auth.jwt.JsonWebTokenValidator; import com.github.toastshaman.dropwizard.auth.jwt.hmac.HmacSHA512Verifier; import com.github.toastshaman.dropwizard.auth.jwt.model.JsonWebToken; import com.github.toastshaman.dropwizard.auth.jwt.parser.DefaultJsonWebTokenParser; import com.github.toastshaman.dropwizard.auth.jwt.validator.ExpiryValidator; import com.google.common.base.Optional; import io.dropwizard.Application; import io.dropwizard.auth.AuthDynamicFeature; import io.dropwizard.auth.AuthValueFactoryProvider; import io.dropwizard.auth.Authenticator; import io.dropwizard.setup.Bootstrap; import io.dropwizard.setup.Environment; import org.glassfish.jersey.server.filter.RolesAllowedDynamicFeature; import java.security.Principal; /** * A sample dropwizard application that shows how to set up the JWT Authentication provider. * <p/> * The Authentication Provider will parse the tokens supplied in the "Authorization" HTTP header in each HTTP request * given your resource is protected with the @Auth annotation. */ public class JwtAuthApplication extends Application<MyConfiguration> { @Override public void initialize(Bootstrap<MyConfiguration> configurationBootstrap) { } @Override public void run(MyConfiguration configuration, Environment environment) throws Exception { final JsonWebTokenParser tokenParser = new DefaultJsonWebTokenParser(); final HmacSHA512Verifier tokenVerifier = new HmacSHA512Verifier(configuration.getJwtTokenSecret()); environment.jersey().register(new AuthDynamicFeature( new JWTAuthFilter.Builder<>() .setTokenParser(tokenParser) .setTokenVerifier(tokenVerifier) .setRealm("realm") .setPrefix("Bearer") .setAuthenticator(new JwtAuthApplication.ExampleAuthenticator()) .buildAuthFilter())); environment.jersey().register(new AuthValueFactoryProvider.Binder<>(Principal.class)); environment.jersey().register(RolesAllowedDynamicFeature.class); environment.jersey().register(new SecuredResource(configuration.getJwtTokenSecret())); } private static class ExampleAuthenticator implements Authenticator<JsonWebToken, Principal> { @Override public Optional<Principal> authenticate(JsonWebToken token) { final JsonWebTokenValidator expiryValidator = new ExpiryValidator(); // Provide your own implementation to lookup users based on the principal attribute in the // JWT Token. E.g.: lookup users from a database etc. // This method will be called once the token's signature has been verified // In case you want to verify different parts of the token you can do that here. // E.g.: Verifying that the provided token has not expired. // All JsonWebTokenExceptions will result in a 401 Unauthorized response. expiryValidator.validate(token); if ("good-guy".equals(token.claim().subject())) { final Principal principal = new Principal() { @Override public String getName() { return "good-guy"; } }; return Optional.of(principal); } return Optional.absent(); } } public static void main(String[] args) throws Exception { new JwtAuthApplication().run(new String[]{"server"}); } }
windbender/dropwizard-auth-jwt
src/test/java/com/github/toastshaman/dropwizard/auth/jwt/example/JwtAuthApplication.java
Java
apache-2.0
3,798
package mina; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MyLog { private static final Logger log = LoggerFactory.getLogger(MyLog.class); public static void log_cmd(byte[] data){ //int cmd_type = CommandParser.getCommandType(data); //System.out.println("cmd_type:" + cmd_type); } public static void log_data(String sPrefix, byte[] data){ int iLen = data.length; log.debug(sPrefix + "length:" + iLen); StringBuilder sDebug = new StringBuilder(); String sHex; for(int i = 0; i < iLen; i++){ sHex = String.format("0x%02x", data[i]&0xff); sDebug.append(sHex); //sDebug.append(Integer.toHexString(data[i]&0xff)); sDebug.append(" "); } log.debug(sDebug.toString()); log.debug(" "); } public static void log_output(byte[] data){ //log_data("<<<<<<output<<<<<", data); } public static void log_input(byte[] data){ //log_cmd(data); //log_data(">>>>>>input>>>>>>", data); } }
sunjob/sensor
src/mina/MyLog.java
Java
apache-2.0
948
/****************************************************************************** * $Id: ogrpgeogeometry.cpp 33631 2016-03-04 06:28:09Z goatbar $ * * Project: OpenGIS Simple Features Reference Implementation * Purpose: Implements decoder of shapebin geometry for PGeo * Author: Frank Warmerdam, warmerdam@pobox.com * Paul Ramsey, pramsey at cleverelephant.ca * ****************************************************************************** * Copyright (c) 2005, Frank Warmerdam <warmerdam@pobox.com> * Copyright (c) 2011, Paul Ramsey <pramsey at cleverelephant.ca> * Copyright (c) 2011-2014, Even Rouault <even dot rouault at mines-paris dot org> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. ****************************************************************************/ #include "ogrpgeogeometry.h" #include "ogr_p.h" #include "cpl_string.h" #include <limits> CPL_CVSID("$Id: ogrpgeogeometry.cpp 33631 2016-03-04 06:28:09Z goatbar $"); #define SHPP_TRISTRIP 0 #define SHPP_TRIFAN 1 #define SHPP_OUTERRING 2 #define SHPP_INNERRING 3 #define SHPP_FIRSTRING 4 #define SHPP_RING 5 #define SHPP_TRIANGLES 6 /* Multipatch 9.0 specific */ /************************************************************************/ /* OGRCreateFromMultiPatchPart() */ /************************************************************************/ void OGRCreateFromMultiPatchPart(OGRMultiPolygon *poMP, OGRPolygon*& poLastPoly, int nPartType, int nPartPoints, double* padfX, double* padfY, double* padfZ) { nPartType &= 0xf; if( nPartType == SHPP_TRISTRIP ) { if( poLastPoly != NULL ) { poMP->addGeometryDirectly( poLastPoly ); poLastPoly = NULL; } for( int iBaseVert = 0; iBaseVert < nPartPoints-2; iBaseVert++ ) { OGRPolygon *poPoly = new OGRPolygon(); OGRLinearRing *poRing = new OGRLinearRing(); int iSrcVert = iBaseVert; poRing->setPoint( 0, padfX[iSrcVert], padfY[iSrcVert], padfZ[iSrcVert] ); poRing->setPoint( 1, padfX[iSrcVert+1], padfY[iSrcVert+1], padfZ[iSrcVert+1] ); poRing->setPoint( 2, padfX[iSrcVert+2], padfY[iSrcVert+2], padfZ[iSrcVert+2] ); poRing->setPoint( 3, padfX[iSrcVert], padfY[iSrcVert], padfZ[iSrcVert] ); poPoly->addRingDirectly( poRing ); poMP->addGeometryDirectly( poPoly ); } } else if( nPartType == SHPP_TRIFAN ) { if( poLastPoly != NULL ) { poMP->addGeometryDirectly( poLastPoly ); poLastPoly = NULL; } for( int iBaseVert = 0; iBaseVert < nPartPoints-2; iBaseVert++ ) { OGRPolygon *poPoly = new OGRPolygon(); OGRLinearRing *poRing = new OGRLinearRing(); int iSrcVert = iBaseVert; poRing->setPoint( 0, padfX[0], padfY[0], padfZ[0] ); poRing->setPoint( 1, padfX[iSrcVert+1], padfY[iSrcVert+1], padfZ[iSrcVert+1] ); poRing->setPoint( 2, padfX[iSrcVert+2], padfY[iSrcVert+2], padfZ[iSrcVert+2] ); poRing->setPoint( 3, padfX[0], padfY[0], padfZ[0] ); poPoly->addRingDirectly( poRing ); poMP->addGeometryDirectly( poPoly ); } } else if( nPartType == SHPP_OUTERRING || nPartType == SHPP_INNERRING || nPartType == SHPP_FIRSTRING || nPartType == SHPP_RING ) { if( poLastPoly != NULL && (nPartType == SHPP_OUTERRING || nPartType == SHPP_FIRSTRING) ) { poMP->addGeometryDirectly( poLastPoly ); poLastPoly = NULL; } if( poLastPoly == NULL ) poLastPoly = new OGRPolygon(); OGRLinearRing *poRing = new OGRLinearRing; poRing->setPoints( nPartPoints, padfX, padfY, padfZ ); poRing->closeRings(); poLastPoly->addRingDirectly( poRing ); } else if ( nPartType == SHPP_TRIANGLES ) { if( poLastPoly != NULL ) { poMP->addGeometryDirectly( poLastPoly ); poLastPoly = NULL; } for( int iBaseVert = 0; iBaseVert < nPartPoints-2; iBaseVert+=3 ) { OGRPolygon *poPoly = new OGRPolygon(); OGRLinearRing *poRing = new OGRLinearRing(); int iSrcVert = iBaseVert; poRing->setPoint( 0, padfX[iSrcVert], padfY[iSrcVert], padfZ[iSrcVert] ); poRing->setPoint( 1, padfX[iSrcVert+1], padfY[iSrcVert+1], padfZ[iSrcVert+1] ); poRing->setPoint( 2, padfX[iSrcVert+2], padfY[iSrcVert+2], padfZ[iSrcVert+2] ); poRing->setPoint( 3, padfX[iSrcVert], padfY[iSrcVert], padfZ[iSrcVert] ); poPoly->addRingDirectly( poRing ); poMP->addGeometryDirectly( poPoly ); } } else CPLDebug( "OGR", "Unrecognized parttype %d, ignored.", nPartType ); } /************************************************************************/ /* OGRCreateFromMultiPatch() */ /* */ /* Translate a multipatch representation to an OGR geometry */ /* Mostly copied from shape2ogr.cpp */ /************************************************************************/ static OGRGeometry* OGRCreateFromMultiPatch(int nParts, GInt32* panPartStart, GInt32* panPartType, int nPoints, double* padfX, double* padfY, double* padfZ) { OGRMultiPolygon *poMP = new OGRMultiPolygon(); int iPart; OGRPolygon *poLastPoly = NULL; for( iPart = 0; iPart < nParts; iPart++ ) { int nPartPoints, nPartStart; // Figure out details about this part's vertex list. if( panPartStart == NULL ) { nPartPoints = nPoints; nPartStart = 0; } else { if( iPart == nParts - 1 ) nPartPoints = nPoints - panPartStart[iPart]; else nPartPoints = panPartStart[iPart+1] - panPartStart[iPart]; nPartStart = panPartStart[iPart]; } OGRCreateFromMultiPatchPart(poMP, poLastPoly, panPartType[iPart], nPartPoints, padfX + nPartStart, padfY + nPartStart, padfZ + nPartStart); } if( poLastPoly != NULL ) { poMP->addGeometryDirectly( poLastPoly ); poLastPoly = NULL; } return poMP; } /************************************************************************/ /* OGRWriteToShapeBin() */ /* */ /* Translate OGR geometry to a shapefile binary representation */ /************************************************************************/ OGRErr OGRWriteToShapeBin( OGRGeometry *poGeom, GByte **ppabyShape, int *pnBytes ) { int nShpSize = 4; /* All types start with integer type number */ int nShpZSize = 0; /* Z gets tacked onto the end */ GUInt32 nPoints = 0; GUInt32 nParts = 0; /* -------------------------------------------------------------------- */ /* Null or Empty input maps to SHPT_NULL. */ /* -------------------------------------------------------------------- */ if ( ! poGeom || poGeom->IsEmpty() ) { *ppabyShape = (GByte*)VSI_MALLOC_VERBOSE(nShpSize); if( *ppabyShape == NULL ) return OGRERR_FAILURE; GUInt32 zero = SHPT_NULL; memcpy(*ppabyShape, &zero, nShpSize); *pnBytes = nShpSize; return OGRERR_NONE; } OGRwkbGeometryType nOGRType = wkbFlatten(poGeom->getGeometryType()); const bool b3d = wkbHasZ(poGeom->getGeometryType()); const bool bHasM = wkbHasM(poGeom->getGeometryType()); const int nCoordDims = poGeom->CoordinateDimension(); /* -------------------------------------------------------------------- */ /* Calculate the shape buffer size */ /* -------------------------------------------------------------------- */ if ( nOGRType == wkbPoint ) { nShpSize += 8 * nCoordDims; } else if ( nOGRType == wkbLineString ) { OGRLineString *poLine = (OGRLineString*)poGeom; nPoints = poLine->getNumPoints(); nParts = 1; nShpSize += 16 * nCoordDims; /* xy(z)(m) box */ nShpSize += 4; /* nparts */ nShpSize += 4; /* npoints */ nShpSize += 4; /* parts[1] */ nShpSize += 8 * nCoordDims * nPoints; /* points */ nShpZSize = 16 + 8 * nPoints; } else if ( nOGRType == wkbPolygon ) { poGeom->closeRings(); OGRPolygon *poPoly = (OGRPolygon*)poGeom; nParts = poPoly->getNumInteriorRings() + 1; for ( GUInt32 i = 0; i < nParts; i++ ) { OGRLinearRing *poRing; if ( i == 0 ) poRing = poPoly->getExteriorRing(); else poRing = poPoly->getInteriorRing(i-1); nPoints += poRing->getNumPoints(); } nShpSize += 16 * nCoordDims; /* xy(z)(m) box */ nShpSize += 4; /* nparts */ nShpSize += 4; /* npoints */ nShpSize += 4 * nParts; /* parts[nparts] */ nShpSize += 8 * nCoordDims * nPoints; /* points */ nShpZSize = 16 + 8 * nPoints; } else if ( nOGRType == wkbMultiPoint ) { OGRMultiPoint *poMPoint = (OGRMultiPoint*)poGeom; for ( int i = 0; i < poMPoint->getNumGeometries(); i++ ) { OGRPoint *poPoint = (OGRPoint*)(poMPoint->getGeometryRef(i)); if ( poPoint->IsEmpty() ) continue; nPoints++; } nShpSize += 16 * nCoordDims; /* xy(z)(m) box */ nShpSize += 4; /* npoints */ nShpSize += 8 * nCoordDims * nPoints; /* points */ nShpZSize = 16 + 8 * nPoints; } else if ( nOGRType == wkbMultiLineString ) { OGRMultiLineString *poMLine = (OGRMultiLineString*)poGeom; for ( int i = 0; i < poMLine->getNumGeometries(); i++ ) { OGRLineString *poLine = (OGRLineString*)(poMLine->getGeometryRef(i)); /* Skip empties */ if ( poLine->IsEmpty() ) continue; nParts++; nPoints += poLine->getNumPoints(); } nShpSize += 16 * nCoordDims; /* xy(z)(m) box */ nShpSize += 4; /* nparts */ nShpSize += 4; /* npoints */ nShpSize += 4 * nParts; /* parts[nparts] */ nShpSize += 8 * nCoordDims * nPoints ; /* points */ nShpZSize = 16 + 8 * nPoints; } else if ( nOGRType == wkbMultiPolygon ) { poGeom->closeRings(); OGRMultiPolygon *poMPoly = (OGRMultiPolygon*)poGeom; for( int j = 0; j < poMPoly->getNumGeometries(); j++ ) { OGRPolygon *poPoly = (OGRPolygon*)(poMPoly->getGeometryRef(j)); int nRings = poPoly->getNumInteriorRings() + 1; /* Skip empties */ if ( poPoly->IsEmpty() ) continue; nParts += nRings; for ( int i = 0; i < nRings; i++ ) { OGRLinearRing *poRing; if ( i == 0 ) poRing = poPoly->getExteriorRing(); else poRing = poPoly->getInteriorRing(i-1); nPoints += poRing->getNumPoints(); } } nShpSize += 16 * nCoordDims; /* xy(z)(m) box */ nShpSize += 4; /* nparts */ nShpSize += 4; /* npoints */ nShpSize += 4 * nParts; /* parts[nparts] */ nShpSize += 8 * nCoordDims * nPoints ; /* points */ nShpZSize = 16 + 8 * nPoints; } else { return OGRERR_UNSUPPORTED_OPERATION; } /* Allocate our shape buffer */ *ppabyShape = (GByte*)VSI_MALLOC_VERBOSE(nShpSize); if ( ! *ppabyShape ) return OGRERR_FAILURE; /* Fill in the output size. */ *pnBytes = nShpSize; /* Set up write pointers */ unsigned char *pabyPtr = *ppabyShape; unsigned char *pabyPtrZ = NULL; unsigned char *pabyPtrM = NULL; if( bHasM ) pabyPtrM = pabyPtr + nShpSize - nShpZSize; if ( b3d ) { if( bHasM ) pabyPtrZ = pabyPtrM - nShpZSize; else pabyPtrZ = pabyPtr + nShpSize - nShpZSize; } /* -------------------------------------------------------------------- */ /* Write in the Shape type number now */ /* -------------------------------------------------------------------- */ GUInt32 nGType = SHPT_NULL; switch(nOGRType) { case wkbPoint: { nGType = (b3d && bHasM) ? SHPT_POINTZM : (b3d) ? SHPT_POINTZ : (bHasM) ? SHPT_POINTM : SHPT_POINT; break; } case wkbMultiPoint: { nGType = (b3d && bHasM) ? SHPT_MULTIPOINTZM : (b3d) ? SHPT_MULTIPOINTZ : (bHasM) ? SHPT_MULTIPOINTM : SHPT_MULTIPOINT; break; } case wkbLineString: case wkbMultiLineString: { nGType = (b3d && bHasM) ? SHPT_ARCZM : (b3d) ? SHPT_ARCZ : (bHasM) ? SHPT_ARCM : SHPT_ARC; break; } case wkbPolygon: case wkbMultiPolygon: { nGType = (b3d && bHasM) ? SHPT_POLYGONZM : (b3d) ? SHPT_POLYGONZ : (bHasM) ? SHPT_POLYGONM : SHPT_POLYGON; break; } default: { return OGRERR_UNSUPPORTED_OPERATION; } } /* Write in the type number and advance the pointer */ nGType = CPL_LSBWORD32( nGType ); memcpy( pabyPtr, &nGType, 4 ); pabyPtr += 4; /* -------------------------------------------------------------------- */ /* POINT and POINTZ */ /* -------------------------------------------------------------------- */ if ( nOGRType == wkbPoint ) { OGRPoint *poPoint = (OGRPoint*)poGeom; double x = poPoint->getX(); double y = poPoint->getY(); /* Copy in the raw data. */ memcpy( pabyPtr, &x, 8 ); memcpy( pabyPtr+8, &y, 8 ); if( b3d ) { double z = poPoint->getZ(); memcpy( pabyPtr+8+8, &z, 8 ); } if( bHasM ) { double m = poPoint->getM(); memcpy( pabyPtr+8+((b3d) ? 16 : 8), &m, 8 ); } /* Swap if needed. Shape doubles always LSB */ if( OGR_SWAP( wkbNDR ) ) { CPL_SWAPDOUBLE( pabyPtr ); CPL_SWAPDOUBLE( pabyPtr+8 ); if( b3d ) CPL_SWAPDOUBLE( pabyPtr+8+8 ); if( bHasM ) CPL_SWAPDOUBLE( pabyPtr+8+((b3d) ? 16 : 8) ); } return OGRERR_NONE; } /* -------------------------------------------------------------------- */ /* All the non-POINT types require an envelope next */ /* -------------------------------------------------------------------- */ OGREnvelope3D envelope; poGeom->getEnvelope(&envelope); memcpy( pabyPtr, &(envelope.MinX), 8 ); memcpy( pabyPtr+8, &(envelope.MinY), 8 ); memcpy( pabyPtr+8+8, &(envelope.MaxX), 8 ); memcpy( pabyPtr+8+8+8, &(envelope.MaxY), 8 ); /* Swap box if needed. Shape doubles are always LSB */ if( OGR_SWAP( wkbNDR ) ) { for ( int i = 0; i < 4; i++ ) CPL_SWAPDOUBLE( pabyPtr + 8*i ); } pabyPtr += 32; /* Write in the Z bounds at the end of the XY buffer */ if ( b3d ) { memcpy( pabyPtrZ, &(envelope.MinZ), 8 ); memcpy( pabyPtrZ+8, &(envelope.MaxZ), 8 ); /* Swap Z bounds if necessary */ if( OGR_SWAP( wkbNDR ) ) { for ( int i = 0; i < 2; i++ ) CPL_SWAPDOUBLE( pabyPtrZ + 8*i ); } pabyPtrZ += 16; } /* Reserve space for the M bounds at the end of the XY buffer */ GByte* pabyPtrMBounds = NULL; double dfMinM = std::numeric_limits<double>::max(); double dfMaxM = -dfMinM; if ( bHasM ) { pabyPtrMBounds = pabyPtrM; pabyPtrM += 16; } /* -------------------------------------------------------------------- */ /* LINESTRING and LINESTRINGZ */ /* -------------------------------------------------------------------- */ if ( nOGRType == wkbLineString ) { const OGRLineString *poLine = (OGRLineString*)poGeom; /* Write in the nparts (1) */ GUInt32 nPartsLsb = CPL_LSBWORD32( nParts ); memcpy( pabyPtr, &nPartsLsb, 4 ); pabyPtr += 4; /* Write in the npoints */ GUInt32 nPointsLsb = CPL_LSBWORD32( nPoints ); memcpy( pabyPtr, &nPointsLsb, 4 ); pabyPtr += 4; /* Write in the part index (0) */ GUInt32 nPartIndex = 0; memcpy( pabyPtr, &nPartIndex, 4 ); pabyPtr += 4; /* Write in the point data */ poLine->getPoints((OGRRawPoint*)pabyPtr, (double*)pabyPtrZ); if( bHasM ) { for( GUInt32 k = 0; k < nPoints; k++ ) { double dfM = poLine->getM(k); memcpy( pabyPtrM + 8*k, &dfM, 8); if( dfM < dfMinM ) dfMinM = dfM; if( dfM > dfMaxM ) dfMaxM = dfM; } } /* Swap if necessary */ if( OGR_SWAP( wkbNDR ) ) { for( GUInt32 k = 0; k < nPoints; k++ ) { CPL_SWAPDOUBLE( pabyPtr + 16*k ); CPL_SWAPDOUBLE( pabyPtr + 16*k + 8 ); if( b3d ) CPL_SWAPDOUBLE( pabyPtrZ + 8*k ); if( bHasM ) CPL_SWAPDOUBLE( pabyPtrM + 8*k ); } } } /* -------------------------------------------------------------------- */ /* POLYGON and POLYGONZ */ /* -------------------------------------------------------------------- */ else if ( nOGRType == wkbPolygon ) { OGRPolygon *poPoly = (OGRPolygon*)poGeom; /* Write in the part count */ GUInt32 nPartsLsb = CPL_LSBWORD32( nParts ); memcpy( pabyPtr, &nPartsLsb, 4 ); pabyPtr += 4; /* Write in the total point count */ GUInt32 nPointsLsb = CPL_LSBWORD32( nPoints ); memcpy( pabyPtr, &nPointsLsb, 4 ); pabyPtr += 4; /* -------------------------------------------------------------------- */ /* Now we have to visit each ring and write an index number into */ /* the parts list, and the coordinates into the points list. */ /* to do it in one pass, we will use three write pointers. */ /* pabyPtr writes the part indexes */ /* pabyPoints writes the xy coordinates */ /* pabyPtrZ writes the z coordinates */ /* -------------------------------------------------------------------- */ /* Just past the partindex[nparts] array */ unsigned char* pabyPoints = pabyPtr + 4*nParts; int nPointIndexCount = 0; for( GUInt32 i = 0; i < nParts; i++ ) { /* Check our Ring and condition it */ OGRLinearRing *poRing; if ( i == 0 ) { poRing = poPoly->getExteriorRing(); /* Outer ring must be clockwise */ if ( ! poRing->isClockwise() ) poRing->reverseWindingOrder(); } else { poRing = poPoly->getInteriorRing(i-1); /* Inner rings should be anti-clockwise */ if ( poRing->isClockwise() ) poRing->reverseWindingOrder(); } int nRingNumPoints = poRing->getNumPoints(); /* Cannot write un-closed rings to shape */ if( nRingNumPoints <= 2 || ! poRing->get_IsClosed() ) return OGRERR_FAILURE; /* Write in the part index */ GUInt32 nPartIndex = CPL_LSBWORD32( nPointIndexCount ); memcpy( pabyPtr, &nPartIndex, 4 ); /* Write in the point data */ poRing->getPoints((OGRRawPoint*)pabyPoints, (double*)pabyPtrZ); if( bHasM ) { for( int k = 0; k < nRingNumPoints; k++ ) { double dfM = poRing->getM(k); memcpy( pabyPtrM + 8*k, &dfM, 8); if( dfM < dfMinM ) dfMinM = dfM; if( dfM > dfMaxM ) dfMaxM = dfM; } } /* Swap if necessary */ if( OGR_SWAP( wkbNDR ) ) { for( int k = 0; k < nRingNumPoints; k++ ) { CPL_SWAPDOUBLE( pabyPoints + 16*k ); CPL_SWAPDOUBLE( pabyPoints + 16*k + 8 ); if( b3d ) CPL_SWAPDOUBLE( pabyPtrZ + 8*k ); if( bHasM ) CPL_SWAPDOUBLE( pabyPtrM + 8*k ); } } nPointIndexCount += nRingNumPoints; /* Advance the write pointers */ pabyPtr += 4; pabyPoints += 16 * nRingNumPoints; if ( b3d ) pabyPtrZ += 8 * nRingNumPoints; if ( bHasM ) pabyPtrM += 8 * nRingNumPoints; } } /* -------------------------------------------------------------------- */ /* MULTIPOINT and MULTIPOINTZ */ /* -------------------------------------------------------------------- */ else if ( nOGRType == wkbMultiPoint ) { OGRMultiPoint *poMPoint = (OGRMultiPoint*)poGeom; /* Write in the total point count */ GUInt32 nPointsLsb = CPL_LSBWORD32( nPoints ); memcpy( pabyPtr, &nPointsLsb, 4 ); pabyPtr += 4; /* -------------------------------------------------------------------- */ /* Now we have to visit each point write it into the points list */ /* We will use two write pointers. */ /* pabyPtr writes the xy coordinates */ /* pabyPtrZ writes the z coordinates */ /* -------------------------------------------------------------------- */ for( GUInt32 i = 0; i < nPoints; i++ ) { const OGRPoint *poPt = (OGRPoint*)(poMPoint->getGeometryRef(i)); /* Skip empties */ if ( poPt->IsEmpty() ) continue; /* Write the coordinates */ double x = poPt->getX(); double y = poPt->getY(); memcpy(pabyPtr, &x, 8); memcpy(pabyPtr+8, &y, 8); if ( b3d ) { double z = poPt->getZ(); memcpy(pabyPtrZ, &z, 8); } if ( bHasM ) { double dfM = poPt->getM(); memcpy(pabyPtrM, &dfM, 8); if( dfM < dfMinM ) dfMinM = dfM; if( dfM > dfMaxM ) dfMaxM = dfM; } /* Swap if necessary */ if( OGR_SWAP( wkbNDR ) ) { CPL_SWAPDOUBLE( pabyPtr ); CPL_SWAPDOUBLE( pabyPtr + 8 ); if( b3d ) CPL_SWAPDOUBLE( pabyPtrZ ); if( bHasM ) CPL_SWAPDOUBLE( pabyPtrM ); } /* Advance the write pointers */ pabyPtr += 16; if ( b3d ) pabyPtrZ += 8; if ( bHasM ) pabyPtrM += 8; } } /* -------------------------------------------------------------------- */ /* MULTILINESTRING and MULTILINESTRINGZ */ /* -------------------------------------------------------------------- */ else if ( nOGRType == wkbMultiLineString ) { OGRMultiLineString *poMLine = (OGRMultiLineString*)poGeom; /* Write in the part count */ GUInt32 nPartsLsb = CPL_LSBWORD32( nParts ); memcpy( pabyPtr, &nPartsLsb, 4 ); pabyPtr += 4; /* Write in the total point count */ GUInt32 nPointsLsb = CPL_LSBWORD32( nPoints ); memcpy( pabyPtr, &nPointsLsb, 4 ); pabyPtr += 4; /* Just past the partindex[nparts] array */ unsigned char* pabyPoints = pabyPtr + 4*nParts; int nPointIndexCount = 0; for( GUInt32 i = 0; i < nParts; i++ ) { const OGRLineString *poLine = (OGRLineString*)(poMLine->getGeometryRef(i)); /* Skip empties */ if ( poLine->IsEmpty() ) continue; int nLineNumPoints = poLine->getNumPoints(); /* Write in the part index */ GUInt32 nPartIndex = CPL_LSBWORD32( nPointIndexCount ); memcpy( pabyPtr, &nPartIndex, 4 ); /* Write in the point data */ poLine->getPoints((OGRRawPoint*)pabyPoints, (double*)pabyPtrZ); if( bHasM ) { for( int k = 0; k < nLineNumPoints; k++ ) { double dfM = poLine->getM(k); memcpy( pabyPtrM + 8*k, &dfM, 8); if( dfM < dfMinM ) dfMinM = dfM; if( dfM > dfMaxM ) dfMaxM = dfM; } } /* Swap if necessary */ if( OGR_SWAP( wkbNDR ) ) { for( int k = 0; k < nLineNumPoints; k++ ) { CPL_SWAPDOUBLE( pabyPoints + 16*k ); CPL_SWAPDOUBLE( pabyPoints + 16*k + 8 ); if( b3d ) CPL_SWAPDOUBLE( pabyPtrZ + 8*k ); if( bHasM ) CPL_SWAPDOUBLE( pabyPtrM + 8*k ); } } nPointIndexCount += nLineNumPoints; /* Advance the write pointers */ pabyPtr += 4; pabyPoints += 16 * nLineNumPoints; if ( b3d ) pabyPtrZ += 8 * nLineNumPoints; if ( bHasM ) pabyPtrM += 8 * nLineNumPoints; } } /* -------------------------------------------------------------------- */ /* MULTIPOLYGON and MULTIPOLYGONZ */ /* -------------------------------------------------------------------- */ else /* if ( nOGRType == wkbMultiPolygon ) */ { OGRMultiPolygon *poMPoly = (OGRMultiPolygon*)poGeom; /* Write in the part count */ GUInt32 nPartsLsb = CPL_LSBWORD32( nParts ); memcpy( pabyPtr, &nPartsLsb, 4 ); pabyPtr += 4; /* Write in the total point count */ GUInt32 nPointsLsb = CPL_LSBWORD32( nPoints ); memcpy( pabyPtr, &nPointsLsb, 4 ); pabyPtr += 4; /* -------------------------------------------------------------------- */ /* Now we have to visit each ring and write an index number into */ /* the parts list, and the coordinates into the points list. */ /* to do it in one pass, we will use three write pointers. */ /* pabyPtr writes the part indexes */ /* pabyPoints writes the xy coordinates */ /* pabyPtrZ writes the z coordinates */ /* -------------------------------------------------------------------- */ /* Just past the partindex[nparts] array */ unsigned char* pabyPoints = pabyPtr + 4*nParts; int nPointIndexCount = 0; for( int i = 0; i < poMPoly->getNumGeometries(); i++ ) { OGRPolygon *poPoly = (OGRPolygon*)(poMPoly->getGeometryRef(i)); /* Skip empties */ if ( poPoly->IsEmpty() ) continue; int nRings = 1 + poPoly->getNumInteriorRings(); for( int j = 0; j < nRings; j++ ) { /* Check our Ring and condition it */ OGRLinearRing *poRing; if ( j == 0 ) { poRing = poPoly->getExteriorRing(); /* Outer ring must be clockwise */ if ( ! poRing->isClockwise() ) poRing->reverseWindingOrder(); } else { poRing = poPoly->getInteriorRing(j-1); /* Inner rings should be anti-clockwise */ if ( poRing->isClockwise() ) poRing->reverseWindingOrder(); } int nRingNumPoints = poRing->getNumPoints(); /* Cannot write closed rings to shape */ if( nRingNumPoints <= 2 || ! poRing->get_IsClosed() ) return OGRERR_FAILURE; /* Write in the part index */ GUInt32 nPartIndex = CPL_LSBWORD32( nPointIndexCount ); memcpy( pabyPtr, &nPartIndex, 4 ); /* Write in the point data */ poRing->getPoints((OGRRawPoint*)pabyPoints, (double*)pabyPtrZ); if( bHasM ) { for( int k = 0; k < nRingNumPoints; k++ ) { double dfM = poRing->getM(k); memcpy( pabyPtrM + 8*k, &dfM, 8); if( dfM < dfMinM ) dfMinM = dfM; if( dfM > dfMaxM ) dfMaxM = dfM; } } /* Swap if necessary */ if( OGR_SWAP( wkbNDR ) ) { for( int k = 0; k < nRingNumPoints; k++ ) { CPL_SWAPDOUBLE( pabyPoints + 16*k ); CPL_SWAPDOUBLE( pabyPoints + 16*k + 8 ); if( b3d ) CPL_SWAPDOUBLE( pabyPtrZ + 8*k ); if( bHasM ) CPL_SWAPDOUBLE( pabyPtrM + 8*k ); } } nPointIndexCount += nRingNumPoints; /* Advance the write pointers */ pabyPtr += 4; pabyPoints += 16 * nRingNumPoints; if ( b3d ) pabyPtrZ += 8 * nRingNumPoints; if ( bHasM ) pabyPtrM += 8 * nRingNumPoints; } } } if ( bHasM ) { if( dfMinM > dfMaxM ) { dfMinM = 0.0; dfMaxM = 0.0; } memcpy( pabyPtrMBounds, &(dfMinM), 8 ); memcpy( pabyPtrMBounds+8, &(dfMaxM), 8 ); /* Swap M bounds if necessary */ if( OGR_SWAP( wkbNDR ) ) { for ( int i = 0; i < 2; i++ ) CPL_SWAPDOUBLE( pabyPtrMBounds + 8*i ); } } return OGRERR_NONE; } /************************************************************************/ /* OGRWriteMultiPatchToShapeBin() */ /************************************************************************/ OGRErr OGRWriteMultiPatchToShapeBin( OGRGeometry *poGeom, GByte **ppabyShape, int *pnBytes ) { if( wkbFlatten(poGeom->getGeometryType()) != wkbMultiPolygon ) return OGRERR_UNSUPPORTED_OPERATION; poGeom->closeRings(); OGRMultiPolygon *poMPoly = (OGRMultiPolygon*)poGeom; int nParts = 0; int* panPartStart = NULL; int* panPartType = NULL; int nPoints = 0; OGRRawPoint* poPoints = NULL; double* padfZ = NULL; int nBeginLastPart = 0; for( int j = 0; j < poMPoly->getNumGeometries(); j++ ) { OGRPolygon *poPoly = (OGRPolygon*)(poMPoly->getGeometryRef(j)); int nRings = poPoly->getNumInteriorRings() + 1; /* Skip empties */ if ( poPoly->IsEmpty() ) continue; OGRLinearRing *poRing = poPoly->getExteriorRing(); if( nRings == 1 && poRing->getNumPoints() == 4 ) { if( nParts > 0 && poPoints != NULL && ((panPartType[nParts-1] == SHPP_TRIANGLES && nPoints - panPartStart[nParts-1] == 3) || panPartType[nParts-1] == SHPP_TRIFAN) && poRing->getX(0) == poPoints[nBeginLastPart].x && poRing->getY(0) == poPoints[nBeginLastPart].y && poRing->getZ(0) == padfZ[nBeginLastPart] && poRing->getX(1) == poPoints[nPoints-1].x && poRing->getY(1) == poPoints[nPoints-1].y && poRing->getZ(1) == padfZ[nPoints-1] ) { panPartType[nParts-1] = SHPP_TRIFAN; poPoints = (OGRRawPoint*)CPLRealloc(poPoints, (nPoints + 1) * sizeof(OGRRawPoint)); padfZ = (double*)CPLRealloc(padfZ, (nPoints + 1) * sizeof(double)); poPoints[nPoints].x = poRing->getX(2); poPoints[nPoints].y = poRing->getY(2); padfZ[nPoints] = poRing->getZ(2); nPoints ++; } else if( nParts > 0 && poPoints != NULL && ((panPartType[nParts-1] == SHPP_TRIANGLES && nPoints - panPartStart[nParts-1] == 3) || panPartType[nParts-1] == SHPP_TRISTRIP) && poRing->getX(0) == poPoints[nPoints-2].x && poRing->getY(0) == poPoints[nPoints-2].y && poRing->getZ(0) == padfZ[nPoints-2] && poRing->getX(1) == poPoints[nPoints-1].x && poRing->getY(1) == poPoints[nPoints-1].y && poRing->getZ(1) == padfZ[nPoints-1] ) { panPartType[nParts-1] = SHPP_TRISTRIP; poPoints = (OGRRawPoint*)CPLRealloc(poPoints, (nPoints + 1) * sizeof(OGRRawPoint)); padfZ = (double*)CPLRealloc(padfZ, (nPoints + 1) * sizeof(double)); poPoints[nPoints].x = poRing->getX(2); poPoints[nPoints].y = poRing->getY(2); padfZ[nPoints] = poRing->getZ(2); nPoints ++; } else { if( nParts == 0 || panPartType[nParts-1] != SHPP_TRIANGLES ) { nBeginLastPart = nPoints; panPartStart = (int*)CPLRealloc(panPartStart, (nParts + 1) * sizeof(int)); panPartType = (int*)CPLRealloc(panPartType, (nParts + 1) * sizeof(int)); panPartStart[nParts] = nPoints; panPartType[nParts] = SHPP_TRIANGLES; nParts ++; } poPoints = (OGRRawPoint*)CPLRealloc(poPoints, (nPoints + 3) * sizeof(OGRRawPoint)); padfZ = (double*)CPLRealloc(padfZ, (nPoints + 3) * sizeof(double)); for(int i=0;i<3;i++) { poPoints[nPoints+i].x = poRing->getX(i); poPoints[nPoints+i].y = poRing->getY(i); padfZ[nPoints+i] = poRing->getZ(i); } nPoints += 3; } } else { panPartStart = (int*)CPLRealloc(panPartStart, (nParts + nRings) * sizeof(int)); panPartType = (int*)CPLRealloc(panPartType, (nParts + nRings) * sizeof(int)); for ( int i = 0; i < nRings; i++ ) { panPartStart[nParts + i] = nPoints; if ( i == 0 ) { poRing = poPoly->getExteriorRing(); panPartType[nParts + i] = SHPP_OUTERRING; } else { poRing = poPoly->getInteriorRing(i-1); panPartType[nParts + i] = SHPP_INNERRING; } poPoints = (OGRRawPoint*)CPLRealloc(poPoints, (nPoints + poRing->getNumPoints()) * sizeof(OGRRawPoint)); padfZ = (double*)CPLRealloc(padfZ, (nPoints + poRing->getNumPoints()) * sizeof(double)); for( int k = 0; k < poRing->getNumPoints(); k++ ) { poPoints[nPoints+k].x = poRing->getX(k); poPoints[nPoints+k].y = poRing->getY(k); padfZ[nPoints+k] = poRing->getZ(k); } nPoints += poRing->getNumPoints(); } nParts += nRings; } } int nShpSize = 4; /* All types start with integer type number */ nShpSize += 16 * 2; /* xy bbox */ nShpSize += 4; /* nparts */ nShpSize += 4; /* npoints */ nShpSize += 4 * nParts; /* panPartStart[nparts] */ nShpSize += 4 * nParts; /* panPartType[nparts] */ nShpSize += 8 * 2 * nPoints; /* xy points */ nShpSize += 16; /* z bbox */ nShpSize += 8 * nPoints; /* z points */ *pnBytes = nShpSize; *ppabyShape = (GByte*) CPLMalloc(nShpSize); GByte* pabyPtr = *ppabyShape; /* Write in the type number and advance the pointer */ GUInt32 nGType = CPL_LSBWORD32( SHPT_MULTIPATCH ); memcpy( pabyPtr, &nGType, 4 ); pabyPtr += 4; OGREnvelope3D envelope; poGeom->getEnvelope(&envelope); memcpy( pabyPtr, &(envelope.MinX), 8 ); memcpy( pabyPtr+8, &(envelope.MinY), 8 ); memcpy( pabyPtr+8+8, &(envelope.MaxX), 8 ); memcpy( pabyPtr+8+8+8, &(envelope.MaxY), 8 ); int i; /* Swap box if needed. Shape doubles are always LSB */ if( OGR_SWAP( wkbNDR ) ) { for ( i = 0; i < 4; i++ ) CPL_SWAPDOUBLE( pabyPtr + 8*i ); } pabyPtr += 32; /* Write in the part count */ GUInt32 nPartsLsb = CPL_LSBWORD32( nParts ); memcpy( pabyPtr, &nPartsLsb, 4 ); pabyPtr += 4; /* Write in the total point count */ GUInt32 nPointsLsb = CPL_LSBWORD32( nPoints ); memcpy( pabyPtr, &nPointsLsb, 4 ); pabyPtr += 4; for( i = 0; i < nParts; i ++ ) { int nPartStart = CPL_LSBWORD32(panPartStart[i]); memcpy( pabyPtr, &nPartStart, 4 ); pabyPtr += 4; } for( i = 0; i < nParts; i ++ ) { int nPartType = CPL_LSBWORD32(panPartType[i]); memcpy( pabyPtr, &nPartType, 4 ); pabyPtr += 4; } if( poPoints != NULL ) memcpy(pabyPtr, poPoints, 2 * 8 * nPoints); /* Swap box if needed. Shape doubles are always LSB */ if( OGR_SWAP( wkbNDR ) ) { for ( i = 0; i < 2 * nPoints; i++ ) CPL_SWAPDOUBLE( pabyPtr + 8*i ); } pabyPtr += 2 * 8 * nPoints; memcpy( pabyPtr, &(envelope.MinZ), 8 ); memcpy( pabyPtr+8, &(envelope.MaxZ), 8 ); if( OGR_SWAP( wkbNDR ) ) { for ( i = 0; i < 2; i++ ) CPL_SWAPDOUBLE( pabyPtr + 8*i ); } pabyPtr += 16; if( padfZ != NULL ) memcpy(pabyPtr, padfZ, 8 * nPoints); /* Swap box if needed. Shape doubles are always LSB */ if( OGR_SWAP( wkbNDR ) ) { for ( i = 0; i < nPoints; i++ ) CPL_SWAPDOUBLE( pabyPtr + 8*i ); } //pabyPtr += 8 * nPoints; CPLFree(panPartStart); CPLFree(panPartType); CPLFree(poPoints); CPLFree(padfZ); return OGRERR_NONE; } /************************************************************************/ /* OGRCreateFromShapeBin() */ /* */ /* Translate shapefile binary representation to an OGR */ /* geometry. */ /************************************************************************/ OGRErr OGRCreateFromShapeBin( GByte *pabyShape, OGRGeometry **ppoGeom, int nBytes ) { *ppoGeom = NULL; if( nBytes < 4 ) { CPLError(CE_Failure, CPLE_AppDefined, "Shape buffer size (%d) too small", nBytes); return OGRERR_FAILURE; } /* -------------------------------------------------------------------- */ /* Detect zlib compressed shapes and uncompress buffer if necessary */ /* NOTE: this seems to be an undocumented feature, even in the */ /* extended_shapefile_format.pdf found in the FileGDB API documentation*/ /* -------------------------------------------------------------------- */ if( nBytes >= 14 && pabyShape[12] == 0x78 && pabyShape[13] == 0xDA /* zlib marker */) { GInt32 nUncompressedSize, nCompressedSize; memcpy( &nUncompressedSize, pabyShape + 4, 4 ); memcpy( &nCompressedSize, pabyShape + 8, 4 ); CPL_LSBPTR32( &nUncompressedSize ); CPL_LSBPTR32( &nCompressedSize ); if (nCompressedSize + 12 == nBytes && nUncompressedSize > 0) { GByte* pabyUncompressedBuffer = (GByte*)VSI_MALLOC_VERBOSE(nUncompressedSize); if (pabyUncompressedBuffer == NULL) { return OGRERR_FAILURE; } size_t nRealUncompressedSize = 0; if( CPLZLibInflate( pabyShape + 12, nCompressedSize, pabyUncompressedBuffer, nUncompressedSize, &nRealUncompressedSize ) == NULL ) { CPLError(CE_Failure, CPLE_AppDefined, "CPLZLibInflate() failed"); VSIFree(pabyUncompressedBuffer); return OGRERR_FAILURE; } OGRErr eErr = OGRCreateFromShapeBin(pabyUncompressedBuffer, ppoGeom, static_cast<int>(nRealUncompressedSize)); VSIFree(pabyUncompressedBuffer); return eErr; } } int nSHPType = pabyShape[0]; /* -------------------------------------------------------------------- */ /* Return a NULL geometry when SHPT_NULL is encountered. */ /* Watch out, null return does not mean "bad data" it means */ /* "no geometry here". Watch the OGRErr for the error status */ /* -------------------------------------------------------------------- */ if ( nSHPType == SHPT_NULL ) { *ppoGeom = NULL; return OGRERR_NONE; } // CPLDebug( "PGeo", // "Shape type read from PGeo data is nSHPType = %d", // nSHPType ); const bool bIsExtended = ( nSHPType >= SHPT_GENERALPOLYLINE && nSHPType <= SHPT_GENERALMULTIPATCH ); const bool bHasZ = ( nSHPType == SHPT_POINTZ || nSHPType == SHPT_POINTZM || nSHPType == SHPT_MULTIPOINTZ || nSHPType == SHPT_MULTIPOINTZM || nSHPType == SHPT_POLYGONZ || nSHPType == SHPT_POLYGONZM || nSHPType == SHPT_ARCZ || nSHPType == SHPT_ARCZM || nSHPType == SHPT_MULTIPATCH || nSHPType == SHPT_MULTIPATCHM || (bIsExtended && (pabyShape[3] & 0x80) != 0 ) ); const bool bHasM = ( nSHPType == SHPT_POINTM || nSHPType == SHPT_POINTZM || nSHPType == SHPT_MULTIPOINTM || nSHPType == SHPT_MULTIPOINTZM || nSHPType == SHPT_POLYGONM || nSHPType == SHPT_POLYGONZM || nSHPType == SHPT_ARCM || nSHPType == SHPT_ARCZM || nSHPType == SHPT_MULTIPATCHM || (bIsExtended && (pabyShape[3] & 0x40) != 0 ) ); /* -------------------------------------------------------------------- */ /* TODO: These types include additional attributes including */ /* non-linear segments and such. They should be handled. */ /* This is documented in the extended_shapefile_format.pdf */ /* from the FileGDB API */ /* -------------------------------------------------------------------- */ switch( nSHPType ) { case SHPT_GENERALPOLYLINE: nSHPType = SHPT_ARC; break; case SHPT_GENERALPOLYGON: nSHPType = SHPT_POLYGON; break; case SHPT_GENERALPOINT: nSHPType = SHPT_POINT; break; case SHPT_GENERALMULTIPOINT: nSHPType = SHPT_MULTIPOINT; break; case SHPT_GENERALMULTIPATCH: nSHPType = SHPT_MULTIPATCH; } /* ==================================================================== */ /* Extract vertices for a Polygon or Arc. */ /* ==================================================================== */ if( nSHPType == SHPT_ARC || nSHPType == SHPT_ARCZ || nSHPType == SHPT_ARCM || nSHPType == SHPT_ARCZM || nSHPType == SHPT_POLYGON || nSHPType == SHPT_POLYGONZ || nSHPType == SHPT_POLYGONM || nSHPType == SHPT_POLYGONZM || nSHPType == SHPT_MULTIPATCH || nSHPType == SHPT_MULTIPATCHM) { GInt32 nPoints, nParts; int i, nOffset; GInt32 *panPartStart; GInt32 *panPartType = NULL; if (nBytes < 44) { CPLError(CE_Failure, CPLE_AppDefined, "Corrupted Shape : nBytes=%d, nSHPType=%d", nBytes, nSHPType); return OGRERR_FAILURE; } /* -------------------------------------------------------------------- */ /* Extract part/point count, and build vertex and part arrays */ /* to proper size. */ /* -------------------------------------------------------------------- */ memcpy( &nPoints, pabyShape + 40, 4 ); memcpy( &nParts, pabyShape + 36, 4 ); CPL_LSBPTR32( &nPoints ); CPL_LSBPTR32( &nParts ); if (nPoints < 0 || nParts < 0 || nPoints > 50 * 1000 * 1000 || nParts > 10 * 1000 * 1000) { CPLError(CE_Failure, CPLE_AppDefined, "Corrupted Shape : nPoints=%d, nParts=%d.", nPoints, nParts); return OGRERR_FAILURE; } int bIsMultiPatch = ( nSHPType == SHPT_MULTIPATCH || nSHPType == SHPT_MULTIPATCHM ); /* With the previous checks on nPoints and nParts, */ /* we should not overflow here and after */ /* since 50 M * (16 + 8 + 8) = 1 600 MB */ int nRequiredSize = 44 + 4 * nParts + 16 * nPoints; if ( bHasZ ) { nRequiredSize += 16 + 8 * nPoints; } if ( bHasM ) { nRequiredSize += 16 + 8 * nPoints; } if( bIsMultiPatch ) { nRequiredSize += 4 * nParts; } if (nRequiredSize > nBytes) { CPLError(CE_Failure, CPLE_AppDefined, "Corrupted Shape : nPoints=%d, nParts=%d, nBytes=%d, nSHPType=%d, nRequiredSize=%d", nPoints, nParts, nBytes, nSHPType, nRequiredSize); return OGRERR_FAILURE; } panPartStart = (GInt32 *) VSI_CALLOC_VERBOSE(nParts,sizeof(GInt32)); if (panPartStart == NULL) { return OGRERR_FAILURE; } /* -------------------------------------------------------------------- */ /* Copy out the part array from the record. */ /* -------------------------------------------------------------------- */ memcpy( panPartStart, pabyShape + 44, 4 * nParts ); for( i = 0; i < nParts; i++ ) { CPL_LSBPTR32( panPartStart + i ); /* We check that the offset is inside the vertex array */ if (panPartStart[i] < 0 || panPartStart[i] >= nPoints) { CPLError(CE_Failure, CPLE_AppDefined, "Corrupted Shape : panPartStart[%d] = %d, nPoints = %d", i, panPartStart[i], nPoints); CPLFree(panPartStart); return OGRERR_FAILURE; } if (i > 0 && panPartStart[i] <= panPartStart[i-1]) { CPLError(CE_Failure, CPLE_AppDefined, "Corrupted Shape : panPartStart[%d] = %d, panPartStart[%d] = %d", i, panPartStart[i], i - 1, panPartStart[i - 1]); CPLFree(panPartStart); return OGRERR_FAILURE; } } nOffset = 44 + 4*nParts; /* -------------------------------------------------------------------- */ /* If this is a multipatch, we will also have parts types. */ /* -------------------------------------------------------------------- */ if( bIsMultiPatch ) { panPartType = (GInt32 *) VSI_CALLOC_VERBOSE(nParts,sizeof(GInt32)); if (panPartType == NULL) { CPLFree(panPartStart); return OGRERR_FAILURE; } memcpy( panPartType, pabyShape + nOffset, 4*nParts ); for( i = 0; i < nParts; i++ ) { CPL_LSBPTR32( panPartType + i ); } nOffset += 4*nParts; } /* -------------------------------------------------------------------- */ /* Copy out the vertices from the record. */ /* -------------------------------------------------------------------- */ double *padfX = (double *) VSI_MALLOC_VERBOSE(sizeof(double)*nPoints); double *padfY = (double *) VSI_MALLOC_VERBOSE(sizeof(double)*nPoints); double *padfZ = (double *) VSI_CALLOC_VERBOSE(sizeof(double),nPoints); double *padfM = (double *) (bHasM ? VSI_CALLOC_VERBOSE(sizeof(double),nPoints) : NULL); if (padfX == NULL || padfY == NULL || padfZ == NULL || (bHasM && padfM == NULL)) { CPLFree( panPartStart ); CPLFree( panPartType ); CPLFree( padfX ); CPLFree( padfY ); CPLFree( padfZ ); CPLFree( padfM ); return OGRERR_FAILURE; } for( i = 0; i < nPoints; i++ ) { memcpy(padfX + i, pabyShape + nOffset + i * 16, 8 ); memcpy(padfY + i, pabyShape + nOffset + i * 16 + 8, 8 ); CPL_LSBPTR64( padfX + i ); CPL_LSBPTR64( padfY + i ); } nOffset += 16*nPoints; /* -------------------------------------------------------------------- */ /* If we have a Z coordinate, collect that now. */ /* -------------------------------------------------------------------- */ if( bHasZ ) { for( i = 0; i < nPoints; i++ ) { memcpy( padfZ + i, pabyShape + nOffset + 16 + i*8, 8 ); CPL_LSBPTR64( padfZ + i ); } nOffset += 16 + 8*nPoints; } /* -------------------------------------------------------------------- */ /* If we have a M coordinate, collect that now. */ /* -------------------------------------------------------------------- */ if( bHasM ) { for( i = 0; i < nPoints; i++ ) { memcpy( padfM + i, pabyShape + nOffset + 16 + i*8, 8 ); CPL_LSBPTR64( padfM + i ); } //nOffset += 16 + 8*nPoints; } /* -------------------------------------------------------------------- */ /* Build corresponding OGR objects. */ /* -------------------------------------------------------------------- */ if( nSHPType == SHPT_ARC || nSHPType == SHPT_ARCZ || nSHPType == SHPT_ARCM || nSHPType == SHPT_ARCZM ) { /* -------------------------------------------------------------------- */ /* Arc - As LineString */ /* -------------------------------------------------------------------- */ if( nParts == 1 ) { OGRLineString *poLine = new OGRLineString(); *ppoGeom = poLine; poLine->setPoints( nPoints, padfX, padfY, padfZ, padfM ); } /* -------------------------------------------------------------------- */ /* Arc - As MultiLineString */ /* -------------------------------------------------------------------- */ else { OGRMultiLineString *poMulti = new OGRMultiLineString; *ppoGeom = poMulti; for( i = 0; i < nParts; i++ ) { OGRLineString *poLine = new OGRLineString; int nVerticesInThisPart; if( i == nParts-1 ) nVerticesInThisPart = nPoints - panPartStart[i]; else nVerticesInThisPart = panPartStart[i+1] - panPartStart[i]; poLine->setPoints( nVerticesInThisPart, padfX + panPartStart[i], padfY + panPartStart[i], padfZ + panPartStart[i], (padfM != NULL) ? padfM + panPartStart[i] : NULL ); poMulti->addGeometryDirectly( poLine ); } } } /* ARC */ /* -------------------------------------------------------------------- */ /* Polygon */ /* -------------------------------------------------------------------- */ else if( nSHPType == SHPT_POLYGON || nSHPType == SHPT_POLYGONZ || nSHPType == SHPT_POLYGONM || nSHPType == SHPT_POLYGONZM ) { if (nParts != 0) { if (nParts == 1) { OGRPolygon *poOGRPoly = new OGRPolygon; *ppoGeom = poOGRPoly; OGRLinearRing *poRing = new OGRLinearRing; int nVerticesInThisPart = nPoints - panPartStart[0]; poRing->setPoints( nVerticesInThisPart, padfX + panPartStart[0], padfY + panPartStart[0], padfZ + panPartStart[0], (padfM != NULL) ? padfM + panPartStart[0] : NULL ); poOGRPoly->addRingDirectly( poRing ); } else { OGRGeometry *poOGR = NULL; OGRPolygon** tabPolygons = new OGRPolygon*[nParts]; for( i = 0; i < nParts; i++ ) { tabPolygons[i] = new OGRPolygon(); OGRLinearRing *poRing = new OGRLinearRing; int nVerticesInThisPart; if( i == nParts-1 ) nVerticesInThisPart = nPoints - panPartStart[i]; else nVerticesInThisPart = panPartStart[i+1] - panPartStart[i]; poRing->setPoints( nVerticesInThisPart, padfX + panPartStart[i], padfY + panPartStart[i], padfZ + panPartStart[i], (padfM != NULL) ? padfM + panPartStart[i] : NULL ); tabPolygons[i]->addRingDirectly(poRing); } int isValidGeometry; const char* papszOptions[] = { "METHOD=ONLY_CCW", NULL }; poOGR = OGRGeometryFactory::organizePolygons( (OGRGeometry**)tabPolygons, nParts, &isValidGeometry, papszOptions ); if (!isValidGeometry) { CPLError(CE_Warning, CPLE_AppDefined, "Geometry of polygon cannot be translated to Simple Geometry. " "All polygons will be contained in a multipolygon.\n"); } *ppoGeom = poOGR; delete[] tabPolygons; } } } /* polygon */ /* -------------------------------------------------------------------- */ /* Multipatch */ /* -------------------------------------------------------------------- */ else if( bIsMultiPatch ) { *ppoGeom = OGRCreateFromMultiPatch( nParts, panPartStart, panPartType, nPoints, padfX, padfY, padfZ ); } CPLFree( panPartStart ); CPLFree( panPartType ); CPLFree( padfX ); CPLFree( padfY ); CPLFree( padfZ ); CPLFree( padfM ); if (*ppoGeom != NULL) { if( !bHasZ ) (*ppoGeom)->set3D(FALSE); } return OGRERR_NONE; } /* ==================================================================== */ /* Extract vertices for a MultiPoint. */ /* ==================================================================== */ else if( nSHPType == SHPT_MULTIPOINT || nSHPType == SHPT_MULTIPOINTM || nSHPType == SHPT_MULTIPOINTZ || nSHPType == SHPT_MULTIPOINTZM ) { GInt32 nPoints; GInt32 nOffsetZ; GInt32 nOffsetM = 0; int i; memcpy( &nPoints, pabyShape + 36, 4 ); CPL_LSBPTR32( &nPoints ); if (nPoints < 0 || nPoints > 50 * 1000 * 1000 ) { CPLError(CE_Failure, CPLE_AppDefined, "Corrupted Shape : nPoints=%d.", nPoints); return OGRERR_FAILURE; } nOffsetZ = 40 + 2*8*nPoints + 2*8; if( bHasM ) nOffsetM = (bHasZ) ? nOffsetZ + 2*8 * 8*nPoints : nOffsetZ; OGRMultiPoint *poMultiPt = new OGRMultiPoint; *ppoGeom = poMultiPt; for( i = 0; i < nPoints; i++ ) { double x, y; OGRPoint *poPt = new OGRPoint; /* Copy X */ memcpy(&x, pabyShape + 40 + i*16, 8); CPL_LSBPTR64(&x); poPt->setX(x); /* Copy Y */ memcpy(&y, pabyShape + 40 + i*16 + 8, 8); CPL_LSBPTR64(&y); poPt->setY(y); /* Copy Z */ if ( bHasZ ) { double z; memcpy(&z, pabyShape + nOffsetZ + i*8, 8); CPL_LSBPTR64(&z); poPt->setZ(z); } /* Copy M */ if ( bHasM ) { double m; memcpy(&m, pabyShape + nOffsetM + i*8, 8); CPL_LSBPTR64(&m); poPt->setM(m); } poMultiPt->addGeometryDirectly( poPt ); } poMultiPt->set3D( bHasZ ); poMultiPt->setMeasured( bHasM ); return OGRERR_NONE; } /* ==================================================================== */ /* Extract vertices for a point. */ /* ==================================================================== */ else if( nSHPType == SHPT_POINT || nSHPType == SHPT_POINTM || nSHPType == SHPT_POINTZ || nSHPType == SHPT_POINTZM ) { /* int nOffset; */ double dfX, dfY, dfZ = 0, dfM = 0; if (nBytes < 4 + 8 + 8 + ((bHasZ) ? 8 : 0) + ((bHasM) ? 8 : 0)) { CPLError(CE_Failure, CPLE_AppDefined, "Corrupted Shape : nBytes=%d, nSHPType=%d", nBytes, nSHPType); return OGRERR_FAILURE; } memcpy( &dfX, pabyShape + 4, 8 ); memcpy( &dfY, pabyShape + 4 + 8, 8 ); CPL_LSBPTR64( &dfX ); CPL_LSBPTR64( &dfY ); /* nOffset = 20 + 8; */ if( bHasZ ) { memcpy( &dfZ, pabyShape + 4 + 16, 8 ); CPL_LSBPTR64( &dfZ ); } if( bHasM ) { memcpy( &dfM, pabyShape + 4 + 16 + ((bHasZ) ? 8 : 0), 8 ); CPL_LSBPTR64( &dfM ); } if( bHasZ && bHasM ) *ppoGeom = new OGRPoint( dfX, dfY, dfZ, dfM ); else if( bHasZ ) *ppoGeom = new OGRPoint( dfX, dfY, dfZ ); else if( bHasM ) { OGRPoint* poPoint = new OGRPoint( dfX, dfY ); poPoint->setM(dfM); *ppoGeom = poPoint; } else *ppoGeom = new OGRPoint( dfX, dfY ); return OGRERR_NONE; } CPLError(CE_Failure, CPLE_AppDefined, "Unsupported geometry type: %d", nSHPType ); return OGRERR_FAILURE; }
jwoyame/node-gdal
deps/libgdal/gdal/ogr/ogrpgeogeometry.cpp
C++
apache-2.0
64,965
var estabelecimentoViewCtrl = angular.module('estabelecimentoViewCtrl', ['ngResource']); estabelecimentoViewCtrl.controller('estabelecimentoViewCtrl', ['$scope', '$http', function ($scope, $http) { $scope.estabelecimentos = []; $scope.carregarPontosCriticos = function(){ $http.get("../webresources/com.andepuc.estabelecimentos").success(function (data, status){ $scope.estabelecimentos = data; }); }; }]);
ScHaFeR/AndePUCRS-WebService
andePuc/target/andePuc-1.0/js/controllers/estabelecimentoViewController.js
JavaScript
apache-2.0
497
/* * Copyright 2000-2015 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.psi.impl.source.tree.injected; import com.intellij.lang.injection.MultiHostInjector; import com.intellij.openapi.editor.ex.DocumentEx; import com.intellij.openapi.project.Project; import com.intellij.psi.FileViewProvider; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiManager; import com.intellij.psi.util.CachedValueProvider; import com.intellij.psi.util.ParameterizedCachedValueProvider; import com.intellij.psi.util.PsiModificationTracker; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; class InjectedPsiCachedValueProvider implements ParameterizedCachedValueProvider<InjectionResult, PsiElement> { @Override public CachedValueProvider.Result<InjectionResult> compute(PsiElement element) { PsiFile hostPsiFile = element.getContainingFile(); if (hostPsiFile == null) return null; FileViewProvider viewProvider = hostPsiFile.getViewProvider(); if (viewProvider instanceof InjectedFileViewProvider) return null; // no injection inside injection final DocumentEx hostDocument = (DocumentEx)viewProvider.getDocument(); if (hostDocument == null) return null; PsiManager psiManager = viewProvider.getManager(); final Project project = psiManager.getProject(); InjectedLanguageManagerImpl injectedManager = InjectedLanguageManagerImpl.getInstanceImpl(project); InjectionResult result = doCompute(element, injectedManager, project, hostPsiFile); return CachedValueProvider.Result.create(result, PsiModificationTracker.MODIFICATION_COUNT, hostDocument); } @Nullable static InjectionResult doCompute(@NotNull final PsiElement element, @NotNull InjectedLanguageManagerImpl injectedManager, @NotNull Project project, @NotNull PsiFile hostPsiFile) { MyInjProcessor processor = new MyInjProcessor(project, hostPsiFile); injectedManager.processInPlaceInjectorsFor(element, processor); InjectionRegistrarImpl registrar = processor.hostRegistrar; return registrar == null ? null : registrar.getInjectedResult(); } private static class MyInjProcessor implements InjectedLanguageManagerImpl.InjProcessor { private InjectionRegistrarImpl hostRegistrar; private final Project myProject; private final PsiFile myHostPsiFile; private MyInjProcessor(@NotNull Project project, @NotNull PsiFile hostPsiFile) { myProject = project; myHostPsiFile = hostPsiFile; } @Override public boolean process(@NotNull PsiElement element, @NotNull MultiHostInjector injector) { if (hostRegistrar == null) { hostRegistrar = new InjectionRegistrarImpl(myProject, myHostPsiFile, element); } injector.getLanguagesToInject(hostRegistrar, element); return hostRegistrar.getInjectedResult() == null; } } }
goodwinnk/intellij-community
platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedPsiCachedValueProvider.java
Java
apache-2.0
3,537
/* Copyright 2011-2016 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ package com.google.security.zynamics.reil.algorithms.mono.valuetracking.elements; import java.math.BigInteger; import java.util.Set; import com.google.common.collect.Sets; import com.google.security.zynamics.zylib.disassembly.IAddress; import com.google.security.zynamics.zylib.general.Convert; public class Symbol implements IValueElement { private final String m_value; private final IAddress m_address; public Symbol(final IAddress address, final String value) { if (Convert.isDecString(value)) { throw new IllegalStateException(); } m_address = address; m_value = value; } @Override public Symbol clone() { return new Symbol(m_address, m_value); } @Override public boolean equals(final Object rhs) { return (rhs instanceof Symbol) && ((Symbol) rhs).m_value.equals(m_value) && ((Symbol) rhs).m_address.equals(m_address); } @Override public BigInteger evaluate() { // TODO Auto-generated method stub throw new IllegalStateException("Not yet implemented"); } @Override public IValueElement getSimplified() { return this; } @Override public Set<String> getVariables() { return Sets.newHashSet(m_value); } @Override public int hashCode() { return m_address.hashCode() * m_value.hashCode(); } @Override public String toString() { return m_value + "/" + m_address.toHexString(); } }
chubbymaggie/binnavi
src/main/java/com/google/security/zynamics/reil/algorithms/mono/valuetracking/elements/Symbol.java
Java
apache-2.0
1,988
#!/usr/bin/python """ Program for creating HTML plots """ import os import sys import json import time from readevtlog import * def imaging_iters(logs): start_time = 40.0 start_msg = "kernel init" end_msg = "imaging cleanup" got_start = False for k in sorted(logs): tt = logs[k].time for e in tt : if e.msg == start_msg: start = e.t1 got_start = True if got_start and e.msg == end_msg: print e.t2-start, ",", print "" data_commands = { "imaging_iters" : imaging_iters, } # Get parameters cmd = sys.argv[1] nm = sys.argv[2] # Open input files logs = read_timelines(nm) # Write table data_commands[cmd](logs)
SKA-ScienceDataProcessor/RC
MS6/visualize/csv_generator.py
Python
apache-2.0
744
/* * Copyright 2014 The Netty Project * * The Netty Project licenses this file to you under the Apache License, version 2.0 (the * "License"); you may not use this file except in compliance with the License. You may obtain a * copy of the License at: * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package io.netty.handler.codec.http2; import io.netty.buffer.ByteBuf; import io.netty.channel.ChannelHandlerContext; import io.netty.util.internal.UnstableApi; /** * An listener of HTTP/2 frames. */ @UnstableApi public interface Http2FrameListener { /** * Handles an inbound {@code DATA} frame. * * @param ctx the context from the handler where the frame was read. * @param streamId the subject stream for the frame. * @param data payload buffer for the frame. This buffer will be released by the codec. * @param padding the number of padding bytes found at the end of the frame. * @param endOfStream Indicates whether this is the last frame to be sent from the remote endpoint for this stream. * @return the number of bytes that have been processed by the application. The returned bytes are used by the * inbound flow controller to determine the appropriate time to expand the inbound flow control window (i.e. send * {@code WINDOW_UPDATE}). Returning a value equal to the length of {@code data} + {@code padding} will effectively * opt-out of application-level flow control for this frame. Returning a value less than the length of {@code data} * + {@code padding} will defer the returning of the processed bytes, which the application must later return via * {@link Http2LocalFlowController#consumeBytes(Http2Stream, int)}. The returned value must * be >= {@code 0} and <= {@code data.readableBytes()} + {@code padding}. */ int onDataRead(ChannelHandlerContext ctx, int streamId, ByteBuf data, int padding, boolean endOfStream) throws Http2Exception; /** * Handles an inbound {@code HEADERS} frame. * <p> * Only one of the following methods will be called for each {@code HEADERS} frame sequence. * One will be called when the {@code END_HEADERS} flag has been received. * <ul> * <li>{@link #onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, boolean)}</li> * <li>{@link #onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, short, boolean, int, boolean)}</li> * <li>{@link #onPushPromiseRead(ChannelHandlerContext, int, int, Http2Headers, int)}</li> * </ul> * <p> * To say it another way; the {@link Http2Headers} will contain all of the headers * for the current message exchange step (additional queuing is not necessary). * * @param ctx the context from the handler where the frame was read. * @param streamId the subject stream for the frame. * @param headers the received headers. * @param padding the number of padding bytes found at the end of the frame. * @param endOfStream Indicates whether this is the last frame to be sent from the remote endpoint * for this stream. */ void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int padding, boolean endOfStream) throws Http2Exception; /** * Handles an inbound {@code HEADERS} frame with priority information specified. * Only called if {@code END_HEADERS} encountered. * <p> * Only one of the following methods will be called for each {@code HEADERS} frame sequence. * One will be called when the {@code END_HEADERS} flag has been received. * <ul> * <li>{@link #onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, boolean)}</li> * <li>{@link #onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, short, boolean, int, boolean)}</li> * <li>{@link #onPushPromiseRead(ChannelHandlerContext, int, int, Http2Headers, int)}</li> * </ul> * <p> * To say it another way; the {@link Http2Headers} will contain all of the headers * for the current message exchange step (additional queuing is not necessary). * * @param ctx the context from the handler where the frame was read. * @param streamId the subject stream for the frame. * @param headers the received headers. * @param streamDependency the stream on which this stream depends, or 0 if dependent on the * connection. * @param weight the new weight for the stream. * @param exclusive whether or not the stream should be the exclusive dependent of its parent. * @param padding the number of padding bytes found at the end of the frame. * @param endOfStream Indicates whether this is the last frame to be sent from the remote endpoint * for this stream. */ void onHeadersRead(ChannelHandlerContext ctx, int streamId, Http2Headers headers, int streamDependency, short weight, boolean exclusive, int padding, boolean endOfStream) throws Http2Exception; /** * Handles an inbound {@code PRIORITY} frame. * <p> * Note that is it possible to have this method called and no stream object exist for either * {@code streamId}, {@code streamDependency}, or both. This is because the {@code PRIORITY} frame can be * sent/received when streams are in the {@code CLOSED} state. * * @param ctx the context from the handler where the frame was read. * @param streamId the subject stream for the frame. * @param streamDependency the stream on which this stream depends, or 0 if dependent on the * connection. * @param weight the new weight for the stream. * @param exclusive whether or not the stream should be the exclusive dependent of its parent. */ void onPriorityRead(ChannelHandlerContext ctx, int streamId, int streamDependency, short weight, boolean exclusive) throws Http2Exception; /** * Handles an inbound {@code RST_STREAM} frame. * * @param ctx the context from the handler where the frame was read. * @param streamId the stream that is terminating. * @param errorCode the error code identifying the type of failure. */ void onRstStreamRead(ChannelHandlerContext ctx, int streamId, long errorCode) throws Http2Exception; /** * Handles an inbound {@code SETTINGS} acknowledgment frame. * @param ctx the context from the handler where the frame was read. */ void onSettingsAckRead(ChannelHandlerContext ctx) throws Http2Exception; /** * Handles an inbound {@code SETTINGS} frame. * * @param ctx the context from the handler where the frame was read. * @param settings the settings received from the remote endpoint. */ void onSettingsRead(ChannelHandlerContext ctx, Http2Settings settings) throws Http2Exception; /** * Handles an inbound {@code PING} frame. * * @param ctx the context from the handler where the frame was read. * @param data the payload of the frame. If this buffer needs to be retained by the listener * they must make a copy. */ void onPingRead(ChannelHandlerContext ctx, ByteBuf data) throws Http2Exception; /** * Handles an inbound {@code PING} acknowledgment. * * @param ctx the context from the handler where the frame was read. * @param data the payload of the frame. If this buffer needs to be retained by the listener * they must make a copy. */ void onPingAckRead(ChannelHandlerContext ctx, ByteBuf data) throws Http2Exception; /** * Handles an inbound {@code PUSH_PROMISE} frame. Only called if {@code END_HEADERS} encountered. * <p> * Promised requests MUST be authoritative, cacheable, and safe. * See <a href="https://tools.ietf.org/html/draft-ietf-httpbis-http2-17#section-8.2">[RFC http2], Seciton 8.2</a>. * <p> * Only one of the following methods will be called for each {@code HEADERS} frame sequence. * One will be called when the {@code END_HEADERS} flag has been received. * <ul> * <li>{@link #onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, boolean)}</li> * <li>{@link #onHeadersRead(ChannelHandlerContext, int, Http2Headers, int, short, boolean, int, boolean)}</li> * <li>{@link #onPushPromiseRead(ChannelHandlerContext, int, int, Http2Headers, int)}</li> * </ul> * <p> * To say it another way; the {@link Http2Headers} will contain all of the headers * for the current message exchange step (additional queuing is not necessary). * * @param ctx the context from the handler where the frame was read. * @param streamId the stream the frame was sent on. * @param promisedStreamId the ID of the promised stream. * @param headers the received headers. * @param padding the number of padding bytes found at the end of the frame. */ void onPushPromiseRead(ChannelHandlerContext ctx, int streamId, int promisedStreamId, Http2Headers headers, int padding) throws Http2Exception; /** * Handles an inbound {@code GO_AWAY} frame. * * @param ctx the context from the handler where the frame was read. * @param lastStreamId the last known stream of the remote endpoint. * @param errorCode the error code, if abnormal closure. * @param debugData application-defined debug data. If this buffer needs to be retained by the * listener they must make a copy. */ void onGoAwayRead(ChannelHandlerContext ctx, int lastStreamId, long errorCode, ByteBuf debugData) throws Http2Exception; /** * Handles an inbound {@code WINDOW_UPDATE} frame. * * @param ctx the context from the handler where the frame was read. * @param streamId the stream the frame was sent on. * @param windowSizeIncrement the increased number of bytes of the remote endpoint's flow * control window. */ void onWindowUpdateRead(ChannelHandlerContext ctx, int streamId, int windowSizeIncrement) throws Http2Exception; /** * Handler for a frame not defined by the HTTP/2 spec. * * @param ctx the context from the handler where the frame was read. * @param frameType the frame type from the HTTP/2 header. * @param streamId the stream the frame was sent on. * @param flags the flags in the frame header. * @param payload the payload of the frame. */ void onUnknownFrame(ChannelHandlerContext ctx, byte frameType, int streamId, Http2Flags flags, ByteBuf payload) throws Http2Exception; }
yrcourage/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/Http2FrameListener.java
Java
apache-2.0
11,025
/* * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.jetbrains.python.psi.impl; import com.intellij.lang.ASTNode; import com.intellij.openapi.util.Ref; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiPolyVariantReference; import com.intellij.psi.PsiReference; import com.intellij.psi.util.QualifiedName; import com.jetbrains.python.PyElementTypes; import com.jetbrains.python.PyNames; import com.jetbrains.python.PyTokenTypes; import com.jetbrains.python.PythonDialectsTokenSetProvider; import com.jetbrains.python.codeInsight.typing.PyTypingTypeProvider; import com.jetbrains.python.psi.*; import com.jetbrains.python.psi.impl.references.PyOperatorReference; import com.jetbrains.python.psi.resolve.PyResolveContext; import com.jetbrains.python.psi.types.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.ArrayList; import java.util.List; /** * @author yole */ public class PyPrefixExpressionImpl extends PyElementImpl implements PyPrefixExpression { public PyPrefixExpressionImpl(ASTNode astNode) { super(astNode); } @Override public PyExpression getOperand() { return (PyExpression)childToPsi(PythonDialectsTokenSetProvider.INSTANCE.getExpressionTokens(), 0); } @Nullable public PsiElement getPsiOperator() { final ASTNode node = getNode(); final ASTNode child = node.findChildByType(PyElementTypes.UNARY_OPS); return child != null ? child.getPsi() : null; } @NotNull @Override public PyElementType getOperator() { final PsiElement op = getPsiOperator(); assert op != null; return (PyElementType)op.getNode().getElementType(); } @Override protected void acceptPyVisitor(PyElementVisitor pyVisitor) { pyVisitor.visitPyPrefixExpression(this); } @Override public PsiReference getReference() { return getReference(PyResolveContext.noImplicits()); } @NotNull @Override public PsiPolyVariantReference getReference(@NotNull PyResolveContext context) { return new PyOperatorReference(this, context); } @Override public PyType getType(@NotNull TypeEvalContext context, @NotNull TypeEvalContext.Key key) { if (getOperator() == PyTokenTypes.NOT_KEYWORD) { return PyBuiltinCache.getInstance(this).getBoolType(); } final boolean isAwait = getOperator() == PyTokenTypes.AWAIT_KEYWORD; if (isAwait) { final PyExpression operand = getOperand(); if (operand != null) { final PyType operandType = context.getType(operand); final PyType type = getGeneratorReturnType(operandType, context); if (type != null) { return type; } } } final PsiReference ref = getReference(PyResolveContext.noImplicits().withTypeEvalContext(context)); final PsiElement resolved = ref.resolve(); if (resolved instanceof PyCallable) { // TODO: Make PyPrefixExpression a PyCallSiteExpression, use getCallType() here and analyze it in PyTypeChecker.analyzeCallSite() final PyType returnType = ((PyCallable)resolved).getReturnType(context, key); return isAwait ? getGeneratorReturnType(returnType, context) : returnType; } return null; } @Override public PyExpression getQualifier() { return getOperand(); } @Nullable @Override public QualifiedName asQualifiedName() { return PyPsiUtils.asQualifiedName(this); } @Override public boolean isQualified() { return getQualifier() != null; } @Override public String getReferencedName() { PyElementType t = getOperator(); if (t == PyTokenTypes.PLUS) { return PyNames.POS; } else if (t == PyTokenTypes.MINUS) { return PyNames.NEG; } return getOperator().getSpecialMethodName(); } @Override public ASTNode getNameElement() { final PsiElement op = getPsiOperator(); return op != null ? op.getNode() : null; } @Nullable private static PyType getGeneratorReturnType(@Nullable PyType type, @NotNull TypeEvalContext context) { if (type instanceof PyClassLikeType && type instanceof PyCollectionType) { if (type instanceof PyClassType && PyNames.AWAITABLE.equals(((PyClassType)type).getPyClass().getName())) { return ((PyCollectionType)type).getIteratedItemType(); } else { return Ref.deref(PyTypingTypeProvider.coroutineOrGeneratorElementType(type, context)); } } else if (type instanceof PyUnionType) { final List<PyType> memberReturnTypes = new ArrayList<>(); final PyUnionType unionType = (PyUnionType)type; for (PyType member : unionType.getMembers()) { memberReturnTypes.add(getGeneratorReturnType(member, context)); } return PyUnionType.union(memberReturnTypes); } return null; } }
apixandru/intellij-community
python/src/com/jetbrains/python/psi/impl/PyPrefixExpressionImpl.java
Java
apache-2.0
5,338
//// [typeOfThisInStaticMembers13.ts] class C { static readonly c: "foo" = "foo" static bar = class Inner { static [this.c] = 123; [this.c] = 123; } } //// [typeOfThisInStaticMembers13.js] var C = /** @class */ (function () { function C() { } var _a, _b, _c, _d; _a = C; Object.defineProperty(C, "c", { enumerable: true, configurable: true, writable: true, value: "foo" }); Object.defineProperty(C, "bar", { enumerable: true, configurable: true, writable: true, value: (_b = /** @class */ (function () { function Inner() { Object.defineProperty(this, _d, { enumerable: true, configurable: true, writable: true, value: 123 }); } return Inner; }()), _c = _a.c, _d = _a.c, Object.defineProperty(_b, _c, { enumerable: true, configurable: true, writable: true, value: 123 }), _b) }); return C; }());
Microsoft/TypeScript
tests/baselines/reference/typeOfThisInStaticMembers13(target=es5).js
JavaScript
apache-2.0
1,288
package com.mapswithme.maps.widget; import android.app.Activity; import android.support.annotation.StringRes; import android.support.v7.widget.Toolbar; import android.view.View; import com.mapswithme.maps.R; import com.mapswithme.util.UiUtils; import com.mapswithme.util.Utils; public class ToolbarController { protected final Activity mActivity; protected final Toolbar mToolbar; public ToolbarController(View root, Activity activity) { mActivity = activity; mToolbar = (Toolbar) root.findViewById(R.id.toolbar); UiUtils.showHomeUpButton(mToolbar); mToolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { onUpClick(); } }); } public void onUpClick() { Utils.navigateToParent(mActivity); } public ToolbarController setTitle(CharSequence title) { mToolbar.setTitle(title); return this; } public ToolbarController setTitle(@StringRes int title) { mToolbar.setTitle(title); return this; } public Toolbar getToolbar() { return mToolbar; } }
programming086/omim
android/src/com/mapswithme/maps/widget/ToolbarController.java
Java
apache-2.0
1,109
/** * Copyright 2005-2015 Red Hat, Inc. * * Red Hat licenses this file to you under the Apache License, version * 2.0 (the "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. */ package io.fabric8.insight.elasticsearch.discovery; import org.elasticsearch.common.collect.Lists; import org.elasticsearch.common.inject.Module; import org.elasticsearch.common.settings.Settings; import org.elasticsearch.plugins.AbstractPlugin; import java.util.Collection; public class FabricDiscoveryPlugin extends AbstractPlugin { private final Settings settings; public FabricDiscoveryPlugin(Settings settings) { this.settings = settings; } @Override public String name() { return "fabric8-discovery"; } @Override public String description() { return "Discovery module using Fabric8"; } }
chirino/fabric8
insight/insight-elasticsearch-discovery/src/main/java/io/fabric8/insight/elasticsearch/discovery/FabricDiscoveryPlugin.java
Java
apache-2.0
1,300
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/ec2/model/InstanceHealthStatus.h> #include <aws/core/utils/HashingUtils.h> #include <aws/core/Globals.h> #include <aws/core/utils/EnumParseOverflowContainer.h> using namespace Aws::Utils; namespace Aws { namespace EC2 { namespace Model { namespace InstanceHealthStatusMapper { static const int healthy_HASH = HashingUtils::HashString("healthy"); static const int unhealthy_HASH = HashingUtils::HashString("unhealthy"); InstanceHealthStatus GetInstanceHealthStatusForName(const Aws::String& name) { int hashCode = HashingUtils::HashString(name.c_str()); if (hashCode == healthy_HASH) { return InstanceHealthStatus::healthy; } else if (hashCode == unhealthy_HASH) { return InstanceHealthStatus::unhealthy; } EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { overflowContainer->StoreOverflow(hashCode, name); return static_cast<InstanceHealthStatus>(hashCode); } return InstanceHealthStatus::NOT_SET; } Aws::String GetNameForInstanceHealthStatus(InstanceHealthStatus enumValue) { switch(enumValue) { case InstanceHealthStatus::healthy: return "healthy"; case InstanceHealthStatus::unhealthy: return "unhealthy"; default: EnumParseOverflowContainer* overflowContainer = Aws::GetEnumOverflowContainer(); if(overflowContainer) { return overflowContainer->RetrieveOverflow(static_cast<int>(enumValue)); } return {}; } } } // namespace InstanceHealthStatusMapper } // namespace Model } // namespace EC2 } // namespace Aws
awslabs/aws-sdk-cpp
aws-cpp-sdk-ec2/source/model/InstanceHealthStatus.cpp
C++
apache-2.0
2,041
/* * JBoss, Home of Professional Open Source * Copyright 2010 Red Hat Inc. and/or its affiliates and other * contributors as indicated by the @author tags. All rights reserved. * See the copyright.txt in the distribution for a full listing of * individual contributors. * * This is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as * published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This software is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this software; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ package org.infinispan.loaders.cassandra; import java.io.IOException; import java.io.InputStream; import java.util.Properties; import net.dataforte.cassandra.pool.PoolProperties; import org.apache.cassandra.thrift.ConsistencyLevel; import org.infinispan.config.ConfigurationException; import org.infinispan.loaders.AbstractCacheStoreConfig; import org.infinispan.loaders.keymappers.DefaultTwoWayKey2StringMapper; import org.infinispan.util.FileLookupFactory; import org.infinispan.util.Util; /** * Configures {@link CassandraCacheStore}. */ public class CassandraCacheStoreConfig extends AbstractCacheStoreConfig { /** * @configRef desc="The Cassandra keyspace" */ String keySpace = "Infinispan"; /** * @configRef desc="The Cassandra column family for entries" */ String entryColumnFamily = "InfinispanEntries"; /** * @configRef desc="The Cassandra column family for expirations" */ String expirationColumnFamily = "InfinispanExpiration"; /** * @configRef desc="Whether the keySpace is shared between multiple caches" */ boolean sharedKeyspace = false; /** * @configRef desc="Which Cassandra consistency level to use when reading" */ String readConsistencyLevel = "ONE"; /** * @configRef desc="Which Cassandra consistency level to use when writing" */ String writeConsistencyLevel = "ONE"; /** * @configRef desc= * "An optional properties file for configuring the underlying cassandra connection pool" */ String configurationPropertiesFile; /** * @configRef desc= * "The keymapper for converting keys to strings (uses the DefaultTwoWayKey2Stringmapper by default)" */ String keyMapper = DefaultTwoWayKey2StringMapper.class.getName(); /** * @configRef desc= * "Whether to automatically create the keyspace with the appropriate column families (true by default)" */ boolean autoCreateKeyspace = true; protected PoolProperties poolProperties; public CassandraCacheStoreConfig() { setCacheLoaderClassName(CassandraCacheStore.class.getName()); poolProperties = new PoolProperties(); } public String getKeySpace() { return keySpace; } public void setKeySpace(String keySpace) { this.keySpace = keySpace; } public String getEntryColumnFamily() { return entryColumnFamily; } public void setEntryColumnFamily(String entryColumnFamily) { this.entryColumnFamily = entryColumnFamily; } public String getExpirationColumnFamily() { return expirationColumnFamily; } public void setExpirationColumnFamily(String expirationColumnFamily) { this.expirationColumnFamily = expirationColumnFamily; } public boolean isSharedKeyspace() { return sharedKeyspace; } public void setSharedKeyspace(boolean sharedKeyspace) { this.sharedKeyspace = sharedKeyspace; } public String getReadConsistencyLevel() { return readConsistencyLevel; } public void setReadConsistencyLevel(String readConsistencyLevel) { this.readConsistencyLevel = readConsistencyLevel; } public String getWriteConsistencyLevel() { return writeConsistencyLevel; } public void setWriteConsistencyLevel(String writeConsistencyLevel) { this.writeConsistencyLevel = writeConsistencyLevel; } public PoolProperties getPoolProperties() { return poolProperties; } public void setHost(String host) { poolProperties.setHost(host); } public String getHost() { return poolProperties.getHost(); } public void setPort(int port) { poolProperties.setPort(port); } public int getPort() { return poolProperties.getPort(); } public boolean isFramed() { return poolProperties.isFramed(); } public String getPassword() { return poolProperties.getPassword(); } public String getUsername() { return poolProperties.getUsername(); } public void setFramed(boolean framed) { poolProperties.setFramed(framed); } public void setPassword(String password) { poolProperties.setPassword(password); } public void setUsername(String username) { poolProperties.setUsername(username); } public void setDatasourceJndiLocation(String location) { poolProperties.setDataSourceJNDI(location); } public String getDatasourceJndiLocation() { return poolProperties.getDataSourceJNDI(); } public String getConfigurationPropertiesFile() { return configurationPropertiesFile; } public void setConfigurationPropertiesFile(String configurationPropertiesFile) { this.configurationPropertiesFile = configurationPropertiesFile; readConfigurationProperties(); } private void readConfigurationProperties() { if (configurationPropertiesFile == null || configurationPropertiesFile.trim().length() == 0) return; InputStream i = FileLookupFactory.newInstance().lookupFile(configurationPropertiesFile, getClassLoader()); if (i != null) { Properties p = new Properties(); try { p.load(i); } catch (IOException ioe) { throw new ConfigurationException("Unable to read environment properties file " + configurationPropertiesFile, ioe); } finally { Util.close(i); } // Apply all properties to the PoolProperties object for (String propertyName : p.stringPropertyNames()) { poolProperties.set(propertyName, p.getProperty(propertyName)); } } } public String getKeyMapper() { return keyMapper; } public void setKeyMapper(String keyMapper) { this.keyMapper = keyMapper; } public boolean isAutoCreateKeyspace() { return autoCreateKeyspace; } public void setAutoCreateKeyspace(boolean autoCreateKeyspace) { this.autoCreateKeyspace = autoCreateKeyspace; } public void setReadConsistencyLevel(ConsistencyLevel readConsistencyLevel) { this.readConsistencyLevel = readConsistencyLevel.toString(); } public void setWriteConsistencyLevel(ConsistencyLevel writeConsistencyLevel) { this.writeConsistencyLevel = writeConsistencyLevel.toString(); } }
nmldiegues/stibt
infinispan/cachestore/cassandra/src/main/java/org/infinispan/loaders/cassandra/CassandraCacheStoreConfig.java
Java
apache-2.0
7,387
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package lsp import ( "context" "strings" "golang.org/x/tools/internal/lsp/protocol" "golang.org/x/tools/internal/lsp/source" "golang.org/x/tools/internal/lsp/telemetry" "golang.org/x/tools/internal/span" "golang.org/x/tools/internal/telemetry/log" ) func (s *Server) Diagnostics(ctx context.Context, view source.View, uri span.URI) { ctx = telemetry.File.With(ctx, uri) f, err := view.GetFile(ctx, uri) if err != nil { log.Error(ctx, "no file", err, telemetry.File) return } // For non-Go files, don't return any diagnostics. gof, ok := f.(source.GoFile) if !ok { return } reports, err := source.Diagnostics(ctx, view, gof, s.disabledAnalyses) if err != nil { log.Error(ctx, "failed to compute diagnostics", err, telemetry.File) return } s.undeliveredMu.Lock() defer s.undeliveredMu.Unlock() for uri, diagnostics := range reports { if err := s.publishDiagnostics(ctx, uri, diagnostics); err != nil { if s.undelivered == nil { s.undelivered = make(map[span.URI][]source.Diagnostic) } log.Error(ctx, "failed to deliver diagnostic (will retry)", err, telemetry.File) s.undelivered[uri] = diagnostics continue } // In case we had old, undelivered diagnostics. delete(s.undelivered, uri) } // Anytime we compute diagnostics, make sure to also send along any // undelivered ones (only for remaining URIs). for uri, diagnostics := range s.undelivered { if err := s.publishDiagnostics(ctx, uri, diagnostics); err != nil { log.Error(ctx, "failed to deliver diagnostic for (will not retry)", err, telemetry.File) } // If we fail to deliver the same diagnostics twice, just give up. delete(s.undelivered, uri) } } func (s *Server) publishDiagnostics(ctx context.Context, uri span.URI, diagnostics []source.Diagnostic) error { protocolDiagnostics, err := toProtocolDiagnostics(ctx, diagnostics) if err != nil { return err } s.client.PublishDiagnostics(ctx, &protocol.PublishDiagnosticsParams{ Diagnostics: protocolDiagnostics, URI: protocol.NewURI(uri), }) return nil } func toProtocolDiagnostics(ctx context.Context, diagnostics []source.Diagnostic) ([]protocol.Diagnostic, error) { reports := []protocol.Diagnostic{} for _, diag := range diagnostics { diagnostic, err := toProtocolDiagnostic(ctx, diag) if err != nil { return nil, err } reports = append(reports, diagnostic) } return reports, nil } func toProtocolDiagnostic(ctx context.Context, diag source.Diagnostic) (protocol.Diagnostic, error) { var severity protocol.DiagnosticSeverity switch diag.Severity { case source.SeverityError: severity = protocol.SeverityError case source.SeverityWarning: severity = protocol.SeverityWarning } return protocol.Diagnostic{ Message: strings.TrimSpace(diag.Message), // go list returns errors prefixed by newline Range: diag.Range, Severity: severity, Source: diag.Source, }, nil }
Miciah/origin
vendor/golang.org/x/tools/internal/lsp/diagnostics.go
GO
apache-2.0
3,070
// create table view var tableview = Titanium.UI.createTableView(); Ti.App.fireEvent("show_indicator"); // create table view event listener tableview.addEventListener('click', function(e) { // event data var index = e.index; var section = e.section; var row = e.row; var rowdata = e.rowData; Titanium.UI.createAlertDialog({title:'Table View',message:'row ' + row + ' index ' + index + ' section ' + section + ' row data ' + rowdata}).show(); }); var navActInd = Titanium.UI.createActivityIndicator(); navActInd.show(); if (Titanium.Platform.name == 'iPhone OS') { Titanium.UI.currentWindow.setRightNavButton(navActInd); } // add table view to the window Titanium.UI.currentWindow.add(tableview); Titanium.Yahoo.yql('select * from flickr.photos.search where text="Cat" limit 10',function(e) { var images = []; var data = e.data; for (var c=0;c<data.photo.length;c++) { var photo = data.photo[c]; // form the flickr url var url = 'http://farm' + photo.farm + '.static.flickr.com/' + photo.server + '/' + photo.id + '_' + photo.secret + '_m.jpg'; Ti.API.info("flickr url = "+url); var row = Ti.UI.createTableViewRow({height:60}); var title = Ti.UI.createLabel({ left:70, right:10, textAlign:'left', height:50, text:photo.title ? photo.title : "Untitled", font:{fontWeight:'bold',fontSize:18} }); var image; if (Titanium.Platform.name == 'android') { // iphone moved to a single image property - android needs to do the same image = Ti.UI.createImageView({ url : url, height:50, width:50, left:10, defaultImage:'../modules/ui/images/photoDefault.png' }); } else { image = Ti.UI.createImageView({ image : url, height:50, width:50, left:10, defaultImage:'../modules/ui/images/photoDefault.png' }); } row.add(image); row.add(title); images[c] = row; } tableview.setData(images); navActInd.hide(); Ti.App.fireEvent("hide_indicator"); });
arnaudsj/titanium_mobile
demos/SmokeTest/Resources/examples/yql_flickr.js
JavaScript
apache-2.0
1,970
package gwt.material.design.client.ui; /* * #%L * GwtMaterial * %% * Copyright (C) 2015 GwtMaterialDesign * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Style; import gwt.material.design.client.base.mixin.ColorsMixin; import gwt.material.design.client.base.mixin.CssNameMixin; import gwt.material.design.client.base.mixin.ToggleStyleMixin; import gwt.material.design.client.constants.IconPosition; import gwt.material.design.client.constants.IconSize; import gwt.material.design.client.base.AbstractButton; import gwt.material.design.client.base.HasIcon; import gwt.material.design.client.base.HasSeparator; import gwt.material.design.client.constants.IconType; //@formatter:off /** * We have included 740 Material Design Icons courtesy of Google. * You can download them directly from the Material Design specs. * * <h3>UiBinder Usage:</h3> * <pre> *{@code <m:MaterialIcon waves="LIGHT" iconType="POLYMER"/> * <m:MaterialIcon waves="LIGHT" iconType="POLYMER" textColor="blue" type="CIRCLE"/> * <m:MaterialIcon waves="LIGHT" iconType="POLYMER" backgroundColor="blue" textColor="white" type="CIRCLE" tooltip="Tooltip" tooltipLocation="BOTTOM"/>} * </pre> * * @author kevzlou7979 * @author Ben Dol * @see <a href="http://www.google.com/design/icons/">Search Google Icons</a> * @see <a href="http://gwt-material-demo.herokuapp.com/#icons">Material Icons Documentation</a> */ //@formatter:on public class MaterialIcon extends AbstractButton implements HasSeparator, HasIcon { private final CssNameMixin<MaterialIcon, IconPosition> posMixin = new CssNameMixin<>(this); private final CssNameMixin<MaterialIcon, IconSize> sizeMixin = new CssNameMixin<>(this); private final ToggleStyleMixin<MaterialIcon> prefixMixin = new ToggleStyleMixin<>(this, "prefix"); private final ColorsMixin<MaterialIcon> colorsMixin = new ColorsMixin<>(this); /** * Creates an empty icon. */ public MaterialIcon() { super(); addStyleName("material-icons"); } /** * Sets a simple icon with a given type. */ public MaterialIcon(IconType iconType) { this(); setIconType(iconType); } /** * Sets an icon with textColor and backgroundColor. */ public MaterialIcon(IconType iconType, String textColor, String bgColor) { this(); setIconType(iconType); setTextColor(textColor); setBackgroundColor(bgColor); } public void setInnerText(String innerText){ getElement().setInnerText(innerText); } @Override protected Element createElement() { return Document.get().createElement("i"); } @Override public MaterialIcon getIcon() { return this; } @Override public void setIconType(IconType icon) { getElement().setInnerText(icon.getCssName()); } @Override public void setIconPosition(IconPosition position) { posMixin.setCssName(position); } @Override public void setIconSize(IconSize size) { sizeMixin.setCssName(size); } @Override public void setIconColor(String iconColor) { colorsMixin.setTextColor(iconColor); } @Override public void setIconFontSize(double size, Style.Unit unit) { getElement().getStyle().setFontSize(size, unit); } @Override public void setIconPrefix(boolean prefix) { prefixMixin.setOn(prefix); } @Override public boolean isIconPrefix() { return prefixMixin.isOn(); } }
gilberto-torrezan/gwt-material
gwt-material/src/main/java/gwt/material/design/client/ui/MaterialIcon.java
Java
apache-2.0
4,174
# Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or # implied. # See the License for the specific language governing permissions and # limitations under the License. from oslo_log import log as logging from oslo_service import threadgroup from blazar.db import api as db_api LOG = logging.getLogger(__name__) class BaseMonitor(object): """Base class for monitoring classes.""" def __init__(self, monitor_plugins): self.monitor_plugins = monitor_plugins self.tg = threadgroup.ThreadGroup() self.healing_timers = [] def start_monitoring(self): """Start monitoring.""" self.start_periodic_healing() def stop_monitoring(self): """Stop monitoring.""" self.stop_periodic_healing() def start_periodic_healing(self): """Start periodic healing process.""" for plugin in self.monitor_plugins: healing_interval_mins = plugin.get_healing_interval() if healing_interval_mins > 0: self.healing_timers.append( self.tg.add_timer(healing_interval_mins * 60, self.call_monitor_plugin, None, plugin.heal)) def stop_periodic_healing(self): """Stop periodic healing process.""" for timer in self.healing_timers: self.tg.timer_done(timer) def call_monitor_plugin(self, callback, *args, **kwargs): """Call a callback and update lease/reservation flags.""" # This method has to handle any exception internally. It shouldn't # raise an exception because the timer threads in the BaseMonitor class # terminates its execution once the thread has received any exception. try: # The callback() has to return a dictionary of # {reservation id: flags to update}. # e.g. {'dummyid': {'missing_resources': True}} reservation_flags = callback(*args, **kwargs) if reservation_flags: self._update_flags(reservation_flags) except Exception as e: LOG.exception('Caught an exception while executing a callback. ' '%s', str(e)) def _update_flags(self, reservation_flags): """Update lease/reservation flags.""" lease_ids = set([]) for reservation_id, flags in reservation_flags.items(): db_api.reservation_update(reservation_id, flags) LOG.debug('Reservation %s was updated: %s', reservation_id, flags) reservation = db_api.reservation_get(reservation_id) lease_ids.add(reservation['lease_id']) for lease_id in lease_ids: LOG.debug('Lease %s was updated: {"degraded": True}', lease_id) db_api.lease_update(lease_id, {'degraded': True})
stackforge/blazar
blazar/monitor/base.py
Python
apache-2.0
3,283
/** * Copyright 2014 * SMEdit https://github.com/StarMade/SMEdit * SMTools https://github.com/StarMade/SMTools * * Licensed under the Apache License, Version 2.0 (the "License"); you may not * use this file except in compliance with the License. You may obtain a copy of * the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the * License for the specific language governing permissions and limitations under * the License. **/ package jo.sm.plugins.all.props; import jo.sm.ui.act.plugin.Description; /** * @Auther Jo Jaquinta for SMEdit Classic - version 1.0 **/ @Description(displayName = "Properties", shortDescription = "Properties affecting the whole application.") public class PropsParameters { @Description(displayName = "Invert X", shortDescription = "Invert X Axis on mouse") private boolean mInvertXAxis; @Description(displayName = "Invert Y", shortDescription = "Invert Y Axis on mouse") private boolean mInvertYAxis; public PropsParameters() { } public boolean isInvertXAxis() { return mInvertXAxis; } public void setInvertXAxis(boolean invertXAxis) { mInvertXAxis = invertXAxis; } public boolean isInvertYAxis() { return mInvertYAxis; } public void setInvertYAxis(boolean invertYAxis) { mInvertYAxis = invertYAxis; } }
skunkiferous/SMEdit
jo_plugin/src/main/java/jo/sm/plugins/all/props/PropsParameters.java
Java
apache-2.0
1,578
// // AuthenticationMethods.cs // // Author: // Jim Borden <jim.borden@couchbase.com> // // Copyright (c) 2015 Couchbase, Inc All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // using System; using System.Collections.Generic; using Couchbase.Lite.Auth; namespace Couchbase.Lite.Listener { /// <summary> /// Methods dealing with authentication for the client /// </summary> internal static class AuthenticationMethods { #region Public Methods /// <summary> /// Verifies and registers a facebook token for use in replication authentication /// </summary> /// <returns>The response state for further HTTP processing</returns> /// <param name="context">The context of the Couchbase Lite HTTP request</param> public static ICouchbaseResponseState RegisterFacebookToken(ICouchbaseListenerContext context) { var response = context.CreateResponse(); var body = context.BodyAs<Dictionary<string, object>>(); string email = body.GetCast<string>("email"); string remoteUrl = body.GetCast<string>("remote_url"); string accessToken = body.GetCast<string>("access_token"); if (email != null && remoteUrl != null && accessToken != null) { Uri siteUrl; if (!Uri.TryCreate(remoteUrl, UriKind.Absolute, out siteUrl)) { response.InternalStatus = StatusCode.BadParam; response.JsonBody = new Body(new Dictionary<string, object> { { "error", "invalid remote_url" } }); } else if (!FacebookAuthorizer.RegisterAccessToken(accessToken, email, siteUrl)) { response.InternalStatus = StatusCode.BadParam; response.JsonBody = new Body(new Dictionary<string, object> { { "error", "invalid access_token" } }); } else { response.JsonBody = new Body(new Dictionary<string, object> { { "ok", "registered" }, { "email", email } }); } } else { response.InternalStatus = StatusCode.BadParam; response.JsonBody = new Body(new Dictionary<string, object> { { "error", "required fields: access_token, email, remote_url" } }); } return response.AsDefaultState(); } /// <summary> /// Verifies and registers a persona token for use in replication authentication /// </summary> /// <returns>The response state for further HTTP processing</returns> /// <param name="context">The context of the Couchbase Lite HTTP request</param> public static ICouchbaseResponseState RegisterPersonaToken(ICouchbaseListenerContext context) { var response = context.CreateResponse(); var body = context.BodyAs<Dictionary<string, object>>(); string email = PersonaAuthorizer.RegisterAssertion(body.GetCast<string>("assertion")); if (email != null) { response.JsonBody = new Body(new Dictionary<string, object> { { "ok", "registered" }, { "email", email } }); } else { response.InternalStatus = StatusCode.BadParam; response.JsonBody = new Body(new Dictionary<string, object> { { "error", "invalid assertion" } }); } return response.AsDefaultState(); } #endregion } }
brettharrisonzya/couchbase-lite-net
src/ListenerComponent/Couchbase.Lite.Listener.Shared/PeerToPeer/AuthenticationMethods.cs
C#
apache-2.0
4,263
/* * Copyright 2021 Apollo Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package com.ctrip.framework.apollo.spring.config; import java.util.List; import com.ctrip.framework.apollo.Config; import com.google.common.collect.Lists; public class ConfigPropertySourceFactory { private final List<ConfigPropertySource> configPropertySources = Lists.newLinkedList(); public ConfigPropertySource getConfigPropertySource(String name, Config source) { ConfigPropertySource configPropertySource = new ConfigPropertySource(name, source); configPropertySources.add(configPropertySource); return configPropertySource; } public List<ConfigPropertySource> getAllConfigPropertySources() { return Lists.newLinkedList(configPropertySources); } }
lepdou/apollo
apollo-client/src/main/java/com/ctrip/framework/apollo/spring/config/ConfigPropertySourceFactory.java
Java
apache-2.0
1,284
/** * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.lens.cube.parse; import static org.apache.hadoop.hive.ql.parse.HiveParser.Identifier; import static org.apache.hadoop.hive.ql.parse.HiveParser.TOK_TABLE_OR_COL; import java.util.Iterator; import org.apache.lens.cube.error.LensCubeErrorCode; import org.apache.lens.cube.metadata.CubeMeasure; import org.apache.lens.cube.parse.CandidateTablePruneCause.CandidateTablePruneCode; import org.apache.lens.server.api.error.LensException; import org.apache.commons.lang.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hive.ql.parse.ASTNode; import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer; import org.apache.hadoop.hive.ql.parse.HiveParser; import org.antlr.runtime.CommonToken; import lombok.extern.slf4j.Slf4j; /** * <p> Replace select and having columns with default aggregate functions on them, if default aggregate is defined and * if there isn't already an aggregate function specified on the columns. </p> <p/> <p> Expressions which already * contain aggregate sub-expressions will not be changed. </p> <p/> <p> At this point it's assumed that aliases have * been added to all columns. </p> */ @Slf4j class AggregateResolver implements ContextRewriter { public AggregateResolver(Configuration conf) { } @Override public void rewriteContext(CubeQueryContext cubeql) throws LensException { if (cubeql.getCube() == null) { return; } boolean nonDefaultAggregates = false; boolean aggregateResolverDisabled = cubeql.getConf().getBoolean(CubeQueryConfUtil.DISABLE_AGGREGATE_RESOLVER, CubeQueryConfUtil.DEFAULT_DISABLE_AGGREGATE_RESOLVER); // Check if the query contains measures // 1. not inside default aggregate expressions // 2. With no default aggregate defined // 3. there are distinct selection of measures // If yes, only the raw (non aggregated) fact can answer this query. // In that case remove aggregate facts from the candidate fact list if (hasMeasuresInDistinctClause(cubeql, cubeql.getSelectAST(), false) || hasMeasuresInDistinctClause(cubeql, cubeql.getHavingAST(), false) || hasMeasuresNotInDefaultAggregates(cubeql, cubeql.getSelectAST(), null, aggregateResolverDisabled) || hasMeasuresNotInDefaultAggregates(cubeql, cubeql.getHavingAST(), null, aggregateResolverDisabled) || hasMeasures(cubeql, cubeql.getWhereAST()) || hasMeasures(cubeql, cubeql.getGroupByAST()) || hasMeasures(cubeql, cubeql.getOrderByAST())) { Iterator<CandidateFact> factItr = cubeql.getCandidateFacts().iterator(); while (factItr.hasNext()) { CandidateFact candidate = factItr.next(); if (candidate.fact.isAggregated()) { cubeql.addFactPruningMsgs(candidate.fact, CandidateTablePruneCause.missingDefaultAggregate()); factItr.remove(); } } nonDefaultAggregates = true; log.info("Query has non default aggregates, no aggregate resolution will be done"); } cubeql.pruneCandidateFactSet(CandidateTablePruneCode.MISSING_DEFAULT_AGGREGATE); if (nonDefaultAggregates || aggregateResolverDisabled) { return; } resolveClause(cubeql, cubeql.getSelectAST()); resolveClause(cubeql, cubeql.getHavingAST()); Configuration distConf = cubeql.getConf(); boolean isDimOnlyDistinctEnabled = distConf.getBoolean(CubeQueryConfUtil.ENABLE_ATTRFIELDS_ADD_DISTINCT, CubeQueryConfUtil.DEFAULT_ATTR_FIELDS_ADD_DISTINCT); if (isDimOnlyDistinctEnabled) { // Check if any measure/aggregate columns and distinct clause used in // select tree. If not, update selectAST token "SELECT" to "SELECT DISTINCT" if (!hasMeasures(cubeql, cubeql.getSelectAST()) && !isDistinctClauseUsed(cubeql.getSelectAST()) && !HQLParser.hasAggregate(cubeql.getSelectAST())) { cubeql.getSelectAST().getToken().setType(HiveParser.TOK_SELECTDI); } } } // We need to traverse the clause looking for eligible measures which can be // wrapped inside aggregates // We have to skip any columns that are already inside an aggregate UDAF private String resolveClause(CubeQueryContext cubeql, ASTNode clause) throws LensException { if (clause == null) { return null; } for (int i = 0; i < clause.getChildCount(); i++) { transform(cubeql, clause, (ASTNode) clause.getChild(i), i); } return HQLParser.getString(clause); } private void transform(CubeQueryContext cubeql, ASTNode parent, ASTNode node, int nodePos) throws LensException { if (node == null) { return; } int nodeType = node.getToken().getType(); if (!(HQLParser.isAggregateAST(node))) { if (nodeType == HiveParser.TOK_TABLE_OR_COL || nodeType == HiveParser.DOT) { // Leaf node ASTNode wrapped = wrapAggregate(cubeql, node); if (wrapped != node) { if (parent != null) { parent.setChild(nodePos, wrapped); // Check if this node has an alias ASTNode sibling = HQLParser.findNodeByPath(parent, Identifier); String expr; if (sibling != null) { expr = HQLParser.getString(parent); } else { expr = HQLParser.getString(wrapped); } cubeql.addAggregateExpr(expr.trim()); } } } else { // Dig deeper in non-leaf nodes for (int i = 0; i < node.getChildCount(); i++) { transform(cubeql, node, (ASTNode) node.getChild(i), i); } } } } // Wrap an aggregate function around the node if its a measure, leave it // unchanged otherwise private ASTNode wrapAggregate(CubeQueryContext cubeql, ASTNode node) throws LensException { String tabname = null; String colname; if (node.getToken().getType() == HiveParser.TOK_TABLE_OR_COL) { colname = ((ASTNode) node.getChild(0)).getText(); } else { // node in 'alias.column' format ASTNode tabident = HQLParser.findNodeByPath(node, TOK_TABLE_OR_COL, Identifier); ASTNode colIdent = (ASTNode) node.getChild(1); colname = colIdent.getText(); tabname = tabident.getText(); } String msrname = StringUtils.isBlank(tabname) ? colname : tabname + "." + colname; if (cubeql.isCubeMeasure(msrname)) { if (cubeql.getQueriedExprs().contains(colname)) { String alias = cubeql.getAliasForTableName(cubeql.getCube().getName()); for (ASTNode exprNode : cubeql.getExprCtx().getExpressionContext(colname, alias).getAllASTNodes()) { transform(cubeql, null, exprNode, 0); } return node; } else { CubeMeasure measure = cubeql.getCube().getMeasureByName(colname); String aggregateFn = measure.getAggregate(); if (StringUtils.isBlank(aggregateFn)) { throw new LensException(LensCubeErrorCode.NO_DEFAULT_AGGREGATE.getLensErrorInfo(), colname); } ASTNode fnroot = new ASTNode(new CommonToken(HiveParser.TOK_FUNCTION)); fnroot.setParent(node.getParent()); ASTNode fnIdentNode = new ASTNode(new CommonToken(HiveParser.Identifier, aggregateFn)); fnIdentNode.setParent(fnroot); fnroot.addChild(fnIdentNode); node.setParent(fnroot); fnroot.addChild(node); return fnroot; } } else { return node; } } private boolean hasMeasuresNotInDefaultAggregates(CubeQueryContext cubeql, ASTNode node, String function, boolean aggregateResolverDisabled) { if (node == null) { return false; } if (HQLParser.isAggregateAST(node)) { if (node.getChild(0).getType() == HiveParser.Identifier) { function = BaseSemanticAnalyzer.unescapeIdentifier(node.getChild(0).getText()); } } else if (cubeql.isCubeMeasure(node)) { // Exit for the recursion String colname; if (node.getToken().getType() == HiveParser.TOK_TABLE_OR_COL) { colname = ((ASTNode) node.getChild(0)).getText(); } else { // node in 'alias.column' format ASTNode colIdent = (ASTNode) node.getChild(1); colname = colIdent.getText(); } colname = colname.toLowerCase(); if (cubeql.getQueriedExprs().contains(colname)) { String cubeAlias = cubeql.getAliasForTableName(cubeql.getCube().getName()); for (ASTNode exprNode : cubeql.getExprCtx().getExpressionContext(colname, cubeAlias).getAllASTNodes()) { if (hasMeasuresNotInDefaultAggregates(cubeql, exprNode, function, aggregateResolverDisabled)) { return true; } } return false; } else { CubeMeasure measure = cubeql.getCube().getMeasureByName(colname); if (function != null && !function.isEmpty()) { // Get the cube measure object and check if the passed function is the // default one set for this measure return !function.equalsIgnoreCase(measure.getAggregate()); } else if (!aggregateResolverDisabled && measure.getAggregate() != null) { // not inside any aggregate, but default aggregate exists return false; } return true; } } for (int i = 0; i < node.getChildCount(); i++) { if (hasMeasuresNotInDefaultAggregates(cubeql, (ASTNode) node.getChild(i), function, aggregateResolverDisabled)) { // Return on the first measure not inside its default aggregate return true; } } return false; } /* * Check if distinct keyword used in node */ private boolean isDistinctClauseUsed(ASTNode node) { if (node == null) { return false; } if (node.getToken() != null) { if (node.getToken().getType() == HiveParser.TOK_FUNCTIONDI || node.getToken().getType() == HiveParser.TOK_SELECTDI) { return true; } } for (int i = 0; i < node.getChildCount(); i++) { if (isDistinctClauseUsed((ASTNode) node.getChild(i))) { return true; } } return false; } private boolean hasMeasuresInDistinctClause(CubeQueryContext cubeql, ASTNode node, boolean hasDistinct) { if (node == null) { return false; } int exprTokenType = node.getToken().getType(); boolean isDistinct = hasDistinct; if (exprTokenType == HiveParser.TOK_FUNCTIONDI || exprTokenType == HiveParser.TOK_SELECTDI) { isDistinct = true; } else if (cubeql.isCubeMeasure(node) && isDistinct) { // Exit for the recursion return true; } for (int i = 0; i < node.getChildCount(); i++) { if (hasMeasuresInDistinctClause(cubeql, (ASTNode) node.getChild(i), isDistinct)) { // Return on the first measure in distinct clause return true; } } return false; } private boolean hasMeasures(CubeQueryContext cubeql, ASTNode node) { if (node == null) { return false; } if (cubeql.isCubeMeasure(node)) { return true; } for (int i = 0; i < node.getChildCount(); i++) { if (hasMeasures(cubeql, (ASTNode) node.getChild(i))) { return true; } } return false; } static void updateAggregates(ASTNode root, CubeQueryContext cubeql) { if (root == null) { return; } if (HQLParser.isAggregateAST(root)) { cubeql.addAggregateExpr(HQLParser.getString(root).trim()); } else { for (int i = 0; i < root.getChildCount(); i++) { ASTNode child = (ASTNode) root.getChild(i); updateAggregates(child, cubeql); } } } }
adeelmahmood/lens
lens-cube/src/main/java/org/apache/lens/cube/parse/AggregateResolver.java
Java
apache-2.0
12,371
# ---------------------------------------------------------------------------- # Copyright 2014 Nervana Systems Inc. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ---------------------------------------------------------------------------- """ For machine generated datasets. """ import numpy as np from neon import NervanaObject class Task(NervanaObject): """ Base class from which ticker tasks inherit. """ def fetch_io(self, time_steps): """ Generate inputs, outputs numpy tensor pair of size appropriate for this minibatch """ columns = time_steps * self.be.bsz inputs = np.zeros((self.nin, columns)) outputs = np.zeros((self.nout, columns)) return inputs, outputs def fill_buffers(self, time_steps, inputs, outputs, in_tensor, out_tensor, mask): """ Do some logistical stuff to get our numpy arrays safely to device. This can almost certainly be cleaned up. """ # Put inputs and outputs, which are too small, into properly shaped arrays columns = time_steps * self.be.bsz inC = np.zeros((self.nin, self.max_columns)) outC = np.zeros((self.nout, self.max_columns)) inC[:, :columns] = inputs outC[:, :columns] = outputs # Copy those arrays to device in_tensor.set(inC) out_tensor.set(outC) # Set a mask over the unused part of the buffer mask[:, :columns] = 1 mask[:, columns:] = 0 class CopyTask(Task): """ The copy task from the Neural Turing Machines paper: http://arxiv.org/abs/1410.5401 This version of the task is batched. All sequences in the same mini-batch are the same length, but every new minibatch has a randomly chosen minibatch length. When a given minibatch has length < seq_len_max, we mask the outputs for time steps after time_steps_max. The generated data is laid out in the same way as other RNN data in neon. """ def __init__(self, seq_len_max, vec_size): """ Set up the attributes that Ticker needs to see. Args: seq_len_max (int): longest allowable sequence length vec_size (int): width of the bit-vector to be copied (was 8 in paper) """ self.seq_len_max = seq_len_max self.vec_size = vec_size self.nout = self.vec_size # output has the same dimension as the underlying bit vector self.nin = self.vec_size + 2 # input has more dims (for the start and stop channels) self.time_steps_func = lambda l: 2 * l + 2 self.time_steps_max = 2 * self.seq_len_max + 2 self.time_steps_max = self.time_steps_func(self.seq_len_max) self.max_columns = self.time_steps_max * self.be.bsz def synthesize(self, in_tensor, out_tensor, mask): """ Create a new minibatch of ticker copy task data. Args: in_tensor: device buffer holding inputs out_tensor: device buffer holding outputs mask: device buffer for the output mask """ # All sequences in a minibatch are the same length for convenience seq_len = np.random.randint(1, self.seq_len_max + 1) time_steps = self.time_steps_func(seq_len) # Generate intermediate buffers of the right size inputs, outputs = super(CopyTask, self).fetch_io(time_steps) # Set the start bit inputs[-2, :self.be.bsz] = 1 # Generate the sequence to be copied seq = np.random.randint(2, size=(self.vec_size, seq_len * self.be.bsz)) # Set the stop bit stop_loc = self.be.bsz * (seq_len + 1) inputs[-1, stop_loc:stop_loc + self.be.bsz] = 1 # Place the actual sequence to copy in inputs inputs[:self.vec_size, self.be.bsz:stop_loc] = seq # Now place that same sequence in a different place in outputs outputs[:, self.be.bsz * (seq_len + 2):] = seq # Fill the device minibatch buffers super(CopyTask, self).fill_buffers(time_steps, inputs, outputs, in_tensor, out_tensor, mask) class RepeatCopyTask(Task): """ The repeat copy task from the Neural Turing Machines paper: http://arxiv.org/abs/1410.5401 See comments on CopyTask class for more details. """ def __init__(self, seq_len_max, repeat_count_max, vec_size): """ Set up the attributes that Ticker needs to see. Args: seq_len_max (int): longest allowable sequence length repeat_count_max (int): max number of repeats vec_size (int): width of the bit-vector to be copied (was 8 in paper) """ self.seq_len_max = seq_len_max self.repeat_count_max = seq_len_max self.vec_size = vec_size self.nout = self.vec_size + 1 # we output the sequence and a stop bit in a stop channel self.nin = self.vec_size + 2 # input has more dims (for the start and stop channels) # seq is seen once as input, repeat_count times as output, with a # start bit, stop bit, and output stop bit self.time_steps_func = lambda l, r: l * (r + 1) + 3 self.time_steps_max = self.time_steps_func(self.seq_len_max, self.repeat_count_max) self.max_columns = self.time_steps_max * self.be.bsz def synthesize(self, in_tensor, out_tensor, mask): """ Create a new minibatch of ticker repeat copy task data. Args: in_tensor: device buffer holding inputs out_tensor: device buffer holding outputs mask: device buffer for the output mask """ # All sequences in a minibatch are the same length for convenience seq_len = np.random.randint(1, self.seq_len_max + 1) repeat_count = np.random.randint(1, self.repeat_count_max + 1) time_steps = self.time_steps_func(seq_len, repeat_count) # Get the minibatch specific numpy buffers inputs, outputs = super(RepeatCopyTask, self).fetch_io(time_steps) # Set the start bit inputs[-2, :self.be.bsz] = 1 # Generate the sequence to be copied seq = np.random.randint(2, size=(self.vec_size, seq_len * self.be.bsz)) # Set the repeat count # TODO: should we normalize repeat count? stop_loc = self.be.bsz * (seq_len + 1) inputs[-1, stop_loc:stop_loc + self.be.bsz] = repeat_count # Place the actual sequence to copy in inputs inputs[:self.vec_size, self.be.bsz:stop_loc] = seq # Now place that same sequence repeat_copy times in outputs for i in range(repeat_count): start = self.be.bsz * ((i + 1) * seq_len + 2) stop = start + seq_len * self.be.bsz outputs[:-1, start:stop] = seq # Place the output finish bit outputs[-1, -self.be.bsz:] = 1 # Fill the device minibatch buffers super(RepeatCopyTask, self).fill_buffers(time_steps, inputs, outputs, in_tensor, out_tensor, mask) class PrioritySortTask(Task): """ The priority sort task from the Neural Turing Machines paper: http://arxiv.org/abs/1410.5401 See comments on CopyTask class for more details. """ def __init__(self, seq_len_max, vec_size): """ Set up the attributes that Ticker needs to see. Args: seq_len_max (int): longest allowable sequence length vec_size (int): width of the bit-vector to be copied (was 8 in paper) """ self.seq_len_max = seq_len_max self.vec_size = vec_size self.nout = self.vec_size # we output the sorted sequence, with no stop bit self.nin = self.vec_size + 3 # extra channels for start, stop, and priority # seq is seen once as input with start and stop bits # then we output seq in sorted order self.time_steps_func = lambda l: 2 * l + 2 self.time_steps_max = self.time_steps_func(self.seq_len_max) self.max_columns = self.time_steps_max * self.be.bsz def synthesize(self, in_tensor, out_tensor, mask): """ Create a new minibatch of ticker priority sort task data. Args: in_tensor: device buffer holding inputs out_tensor: device buffer holding outputs mask: device buffer for the output mask """ # All sequences in a minibatch are the same length for convenience seq_len = np.random.randint(1, self.seq_len_max + 1) time_steps = self.time_steps_func(seq_len) # Get the minibatch specific numpy buffers inputs, outputs = super(PrioritySortTask, self).fetch_io(time_steps) # Set the start bit inputs[-3, :self.be.bsz] = 1 # Generate the sequence to be copied seq = np.random.randint(2, size=(self.nin, seq_len * self.be.bsz)).astype(float) # Zero out the start, stop, and priority channels seq[-3:, :] = 0 # Generate the scalar priorities and put them in seq priorities = np.random.uniform(-1, 1, size=(seq_len * self.be.bsz,)) seq[-1, :] = priorities # Set the stop bit stop_loc = self.be.bsz * (seq_len + 1) inputs[-2, stop_loc:stop_loc + self.be.bsz] = 1 # Place the actual sequence to copy in inputs inputs[:, self.be.bsz:stop_loc] = seq # sort the sequences for i in range(self.be.bsz): # for every sequence in the batch # x <- every column in the sequence x = seq[:, i::self.be.bsz] # sort that set of columns by elt in the last row (the priority) x = x[:, x[-1, :].argsort()] # put those columns back into minibatch in the right places seq[:, i::self.be.bsz] = x outputs[:, self.be.bsz * (seq_len + 2):] = seq[:self.nout, :] # Fill the device minibatch buffers super(PrioritySortTask, self).fill_buffers(time_steps, inputs, outputs, in_tensor, out_tensor, mask) class Ticker(NervanaObject): """ This class defines methods for generating and iterating over ticker datasets. """ def reset(self): """ Reset has no meaning in the context of ticker data. """ pass def __init__(self, task): """ Construct a ticker dataset object. Args: Task is an object representing the task to be trained on It contains information about input and output size, sequence length, etc. It also implements a synthesize function, which is used to generate the next minibatch of data. """ self.task = task # These attributes don't make much sense in the context of tickers # but I suspect it will be hard to get rid of them self.batch_index = 0 self.nbatches = 100 self.ndata = self.nbatches * self.be.bsz # Alias these because other code relies on datasets having nin and nout self.nout = task.nout self.nin = task.nin # Configuration elsewhere relies on the existence of this self.shape = (self.nin, self.task.time_steps_max) # Initialize the inputs, the outputs, and the mask self.dev_X = self.be.iobuf((self.nin, self.task.time_steps_max)) self.dev_y = self.be.iobuf((self.nout, self.task.time_steps_max)) self.mask = self.be.iobuf((self.nout, self.task.time_steps_max)) def __iter__(self): """ Generator that can be used to iterate over this dataset. Yields: tuple : the next minibatch of data. The second element of the tuple is itself a tuple (t,m) with: t: the actual target as generated by the task object m: the output mask to account for the difference between the seq_length for this minibatch and the max seq_len, which is also the number of columns in X,t, and m """ self.batch_index = 0 while self.batch_index < self.nbatches: # The task object writes minibatch data into buffers we pass it self.task.synthesize(self.dev_X, self.dev_y, self.mask) self.batch_index += 1 yield self.dev_X, (self.dev_y, self.mask)
coufon/neon-distributed
neon/data/ticker.py
Python
apache-2.0
13,214
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package datafu.pig.random; import java.io.IOException; import java.util.UUID; import org.apache.pig.EvalFunc; import org.apache.pig.builtin.Nondeterministic; import org.apache.pig.data.*; import org.apache.pig.impl.logicalLayer.schema.Schema; /** * Generates a random UUID using java.util.UUID */ @Nondeterministic public class RandomUUID extends EvalFunc<String> { public String exec(Tuple input) throws IOException { return UUID.randomUUID().toString(); } @Override public Schema outputSchema(Schema input) { return new Schema(new Schema.FieldSchema("uuid", DataType.CHARARRAY)); } }
apache/incubator-datafu
datafu-pig/src/main/java/datafu/pig/random/RandomUUID.java
Java
apache-2.0
1,445
package mem import ( "bytes" "encoding/json" "errors" "fmt" "strings" "sync" "sync/atomic" "time" "github.com/portworx/kvdb" "github.com/portworx/kvdb/common" "github.com/sirupsen/logrus" ) const ( // Name is the name of this kvdb implementation. Name = "kv-mem" // KvSnap is an option passed to designate this kvdb as a snap. KvSnap = "KvSnap" // KvUseInterface is an option passed that configures the mem to store // the values as interfaces instead of bytes. It will not create a // copy of the interface that is passed in. USE WITH CAUTION KvUseInterface = "KvUseInterface" bootstrapKey = "bootstrap" ) var ( // ErrSnap is returned if an operation is not supported on a snap. ErrSnap = errors.New("operation not supported on snap") // ErrSnapWithInterfaceNotSupported is returned when a snap kv-mem is // created with KvUseInterface flag on ErrSnapWithInterfaceNotSupported = errors.New("snap kvdb not supported with interfaces") // ErrIllegalSelect is returned when an incorrect select function // implementation is detected. ErrIllegalSelect = errors.New("Illegal Select implementation") ) func init() { if err := kvdb.Register(Name, New, Version); err != nil { panic(err.Error()) } } type memKV struct { common.BaseKvdb // m is the key value database m map[string]*memKVPair // updates is the list of latest few updates dist WatchDistributor // mutex protects m, w, wt mutex sync.Mutex // index current kvdb index index uint64 domain string // locks is the map of currently held locks locks map[string]chan int // noByte will store all the values as interface noByte bool kvdb.Controller } type memKVPair struct { kvdb.KVPair // ivalue is the value for this kv pair stored as an interface ivalue interface{} } func (mkvp *memKVPair) copy() *kvdb.KVPair { copyKvp := mkvp.KVPair if mkvp.Value == nil && mkvp.ivalue != nil { copyKvp.Value, _ = common.ToBytes(mkvp.ivalue) } return &copyKvp } type snapMem struct { *memKV } // watchUpdate refers to an update to this kvdb type watchUpdate struct { // key is the key that was updated key string // kvp is the key-value that was updated kvp memKVPair // err is any error on update err error } // WatchUpdateQueue is a producer consumer queue. type WatchUpdateQueue interface { // Enqueue will enqueue an update. It is non-blocking. Enqueue(update *watchUpdate) // Dequeue will either return an element from front of the queue or // will block until element becomes available Dequeue() *watchUpdate } // WatchDistributor distributes updates to the watchers type WatchDistributor interface { // Add creates a new watch queue to send updates Add() WatchUpdateQueue // Remove removes an existing watch queue Remove(WatchUpdateQueue) // NewUpdate is invoked to distribute a new update NewUpdate(w *watchUpdate) } // distributor implements WatchDistributor interface type distributor struct { sync.Mutex // updates is the list of latest few updates updates []*watchUpdate // watchers watch for updates watchers []WatchUpdateQueue } // NewWatchDistributor returns a new instance of // the WatchDistrubtor interface func NewWatchDistributor() WatchDistributor { return &distributor{} } func (d *distributor) Add() WatchUpdateQueue { d.Lock() defer d.Unlock() q := NewWatchUpdateQueue() for _, u := range d.updates { q.Enqueue(u) } d.watchers = append(d.watchers, q) return q } func (d *distributor) Remove(r WatchUpdateQueue) { d.Lock() defer d.Unlock() for i, q := range d.watchers { if q == r { copy(d.watchers[i:], d.watchers[i+1:]) d.watchers[len(d.watchers)-1] = nil d.watchers = d.watchers[:len(d.watchers)-1] } } } func (d *distributor) NewUpdate(u *watchUpdate) { d.Lock() defer d.Unlock() // collect update d.updates = append(d.updates, u) if len(d.updates) > 100 { d.updates = d.updates[100:] } // send update to watchers for _, q := range d.watchers { q.Enqueue(u) } } // watchQueue implements WatchUpdateQueue interface for watchUpdates type watchQueue struct { // updates is the list of updates updates []*watchUpdate // m is the mutex to protect updates m *sync.Mutex // cv is used to coordinate the producer-consumer threads cv *sync.Cond } // NewWatchUpdateQueue returns an instance of WatchUpdateQueue func NewWatchUpdateQueue() WatchUpdateQueue { mtx := &sync.Mutex{} return &watchQueue{ m: mtx, cv: sync.NewCond(mtx), updates: make([]*watchUpdate, 0)} } func (w *watchQueue) Dequeue() *watchUpdate { w.m.Lock() for { if len(w.updates) > 0 { update := w.updates[0] w.updates = w.updates[1:] w.m.Unlock() return update } w.cv.Wait() } } // Enqueue enqueues and never blocks func (w *watchQueue) Enqueue(update *watchUpdate) { w.m.Lock() w.updates = append(w.updates, update) w.cv.Signal() w.m.Unlock() } type watchData struct { cb kvdb.WatchCB opaque interface{} waitIndex uint64 } // New constructs a new kvdb.Kvdb. func New( domain string, machines []string, options map[string]string, fatalErrorCb kvdb.FatalErrorCB, ) (kvdb.Kvdb, error) { if domain != "" && !strings.HasSuffix(domain, "/") { domain = domain + "/" } mem := &memKV{ BaseKvdb: common.BaseKvdb{FatalCb: fatalErrorCb}, m: make(map[string]*memKVPair), dist: NewWatchDistributor(), domain: domain, Controller: kvdb.ControllerNotSupported, locks: make(map[string]chan int), } var noByte bool if _, noByte = options[KvUseInterface]; noByte { mem.noByte = true } if _, ok := options[KvSnap]; ok && !noByte { return &snapMem{memKV: mem}, nil } else if ok && noByte { return nil, ErrSnapWithInterfaceNotSupported } return mem, nil } // Version returns the supported version of the mem implementation func Version(url string, kvdbOptions map[string]string) (string, error) { return kvdb.MemVersion1, nil } func (kv *memKV) String() string { return Name } func (kv *memKV) Capabilities() int { return kvdb.KVCapabilityOrderedUpdates } func (kv *memKV) get(key string) (*memKVPair, error) { key = kv.domain + key v, ok := kv.m[key] if !ok { return nil, kvdb.ErrNotFound } return v, nil } func (kv *memKV) exists(key string) (*memKVPair, error) { return kv.get(key) } func (kv *memKV) Get(key string) (*kvdb.KVPair, error) { kv.mutex.Lock() defer kv.mutex.Unlock() v, err := kv.get(key) if err != nil { return nil, err } return v.copy(), nil } func (kv *memKV) Snapshot(prefixes []string, consistent bool) (kvdb.Kvdb, uint64, error) { kv.mutex.Lock() defer kv.mutex.Unlock() _, err := kv.put(bootstrapKey, time.Now().UnixNano(), 0) if err != nil { return nil, 0, fmt.Errorf("Failed to create snap bootstrap key: %v", err) } data := make(map[string]*memKVPair) for key, value := range kv.m { if strings.Contains(key, "/_") { continue } found := false for _, prefix := range prefixes { prefix = kv.domain + prefix if strings.HasPrefix(key, prefix) { found = true break } } if !found { continue } snap := &memKVPair{} snap.KVPair = value.KVPair cpy := value.copy() snap.Value = make([]byte, len(cpy.Value)) copy(snap.Value, cpy.Value) data[key] = snap } highestKvPair, _ := kv.delete(bootstrapKey) // Snapshot only data, watches are not copied. return &snapMem{ &memKV{ m: data, domain: kv.domain, }, }, highestKvPair.ModifiedIndex, nil } func (kv *memKV) put( key string, value interface{}, ttl uint64, ) (*kvdb.KVPair, error) { var ( kvp *memKVPair b []byte err error ival interface{} ) suffix := key key = kv.domain + suffix index := atomic.AddUint64(&kv.index, 1) // Either set bytes or interface value if !kv.noByte { b, err = common.ToBytes(value) if err != nil { return nil, err } } else { ival = value } if old, ok := kv.m[key]; ok { old.Value = b old.ivalue = ival old.Action = kvdb.KVSet old.ModifiedIndex = index old.KVDBIndex = index kvp = old } else { kvp = &memKVPair{ KVPair: kvdb.KVPair{ Key: key, Value: b, TTL: int64(ttl), KVDBIndex: index, ModifiedIndex: index, CreatedIndex: index, Action: kvdb.KVCreate, }, ivalue: ival, } kv.m[key] = kvp } kv.normalize(&kvp.KVPair) kv.dist.NewUpdate(&watchUpdate{key, *kvp, nil}) if ttl != 0 { time.AfterFunc(time.Second*time.Duration(ttl), func() { // TODO: handle error kv.mutex.Lock() defer kv.mutex.Unlock() _, _ = kv.delete(suffix) }) } return kvp.copy(), nil } func (kv *memKV) Put( key string, value interface{}, ttl uint64, ) (*kvdb.KVPair, error) { kv.mutex.Lock() defer kv.mutex.Unlock() return kv.put(key, value, ttl) } func (kv *memKV) GetVal(key string, v interface{}) (*kvdb.KVPair, error) { kv.mutex.Lock() defer kv.mutex.Unlock() kvp, err := kv.get(key) if err != nil { return nil, err } cpy := kvp.copy() err = json.Unmarshal(cpy.Value, v) return cpy, err } func (kv *memKV) Create( key string, value interface{}, ttl uint64, ) (*kvdb.KVPair, error) { kv.mutex.Lock() defer kv.mutex.Unlock() result, err := kv.exists(key) if err != nil { return kv.put(key, value, ttl) } return &result.KVPair, kvdb.ErrExist } func (kv *memKV) Update( key string, value interface{}, ttl uint64, ) (*kvdb.KVPair, error) { kv.mutex.Lock() defer kv.mutex.Unlock() if _, err := kv.exists(key); err != nil { return nil, kvdb.ErrNotFound } return kv.put(key, value, ttl) } func (kv *memKV) Enumerate(prefix string) (kvdb.KVPairs, error) { kv.mutex.Lock() defer kv.mutex.Unlock() return kv.enumerate(prefix) } // enumerate returns a list of values and creates a copy if specified func (kv *memKV) enumerate(prefix string) (kvdb.KVPairs, error) { var kvp = make(kvdb.KVPairs, 0, 100) prefix = kv.domain + prefix for k, v := range kv.m { if strings.HasPrefix(k, prefix) && !strings.Contains(k, "/_") { kvpLocal := v.copy() kvpLocal.Key = k kv.normalize(kvpLocal) kvp = append(kvp, kvpLocal) } } return kvp, nil } func (kv *memKV) delete(key string) (*kvdb.KVPair, error) { kvp, err := kv.get(key) if err != nil { return nil, err } kvp.KVDBIndex = atomic.AddUint64(&kv.index, 1) kvp.ModifiedIndex = kvp.KVDBIndex kvp.Action = kvdb.KVDelete delete(kv.m, kv.domain+key) kv.dist.NewUpdate(&watchUpdate{kv.domain + key, *kvp, nil}) return &kvp.KVPair, nil } func (kv *memKV) Delete(key string) (*kvdb.KVPair, error) { kv.mutex.Lock() defer kv.mutex.Unlock() return kv.delete(key) } func (kv *memKV) DeleteTree(prefix string) error { kv.mutex.Lock() defer kv.mutex.Unlock() if len(prefix) > 0 && !strings.HasSuffix(prefix, kvdb.DefaultSeparator) { prefix += kvdb.DefaultSeparator } kvp, err := kv.enumerate(prefix) if err != nil { return err } for _, v := range kvp { // TODO: multiple errors if _, iErr := kv.delete(v.Key); iErr != nil { err = iErr } } return err } func (kv *memKV) Keys(prefix, sep string) ([]string, error) { if "" == sep { sep = "/" } prefix = kv.domain + prefix lenPrefix := len(prefix) lenSep := len(sep) if prefix[lenPrefix-lenSep:] != sep { prefix += sep lenPrefix += lenSep } seen := make(map[string]bool) kv.mutex.Lock() defer kv.mutex.Unlock() for k := range kv.m { if strings.HasPrefix(k, prefix) && !strings.Contains(k, "/_") { key := k[lenPrefix:] if idx := strings.Index(key, sep); idx > 0 { key = key[:idx] } seen[key] = true } } retList := make([]string, len(seen)) i := 0 for k := range seen { retList[i] = k i++ } return retList, nil } func (kv *memKV) CompareAndSet( kvp *kvdb.KVPair, flags kvdb.KVFlags, prevValue []byte, ) (*kvdb.KVPair, error) { kv.mutex.Lock() defer kv.mutex.Unlock() result, err := kv.exists(kvp.Key) if err != nil { return nil, err } if prevValue != nil { cpy := result.copy() if !bytes.Equal(cpy.Value, prevValue) { return nil, kvdb.ErrValueMismatch } } if flags == kvdb.KVModifiedIndex { if kvp.ModifiedIndex != result.ModifiedIndex { return nil, kvdb.ErrValueMismatch } } return kv.put(kvp.Key, kvp.Value, 0) } func (kv *memKV) CompareAndDelete( kvp *kvdb.KVPair, flags kvdb.KVFlags, ) (*kvdb.KVPair, error) { kv.mutex.Lock() defer kv.mutex.Unlock() result, err := kv.exists(kvp.Key) if err != nil { return nil, err } if flags&kvdb.KVModifiedIndex > 0 && result.ModifiedIndex != kvp.ModifiedIndex { return nil, kvdb.ErrModified } else { cpy := result.copy() if !bytes.Equal(cpy.Value, kvp.Value) { return nil, kvdb.ErrNotFound } } return kv.delete(kvp.Key) } func (kv *memKV) WatchKey( key string, waitIndex uint64, opaque interface{}, cb kvdb.WatchCB, ) error { kv.mutex.Lock() defer kv.mutex.Unlock() key = kv.domain + key go kv.watchCb(kv.dist.Add(), key, &watchData{cb: cb, waitIndex: waitIndex, opaque: opaque}, false) return nil } func (kv *memKV) WatchTree( prefix string, waitIndex uint64, opaque interface{}, cb kvdb.WatchCB, ) error { kv.mutex.Lock() defer kv.mutex.Unlock() prefix = kv.domain + prefix go kv.watchCb(kv.dist.Add(), prefix, &watchData{cb: cb, waitIndex: waitIndex, opaque: opaque}, true) return nil } func (kv *memKV) Lock(key string) (*kvdb.KVPair, error) { return kv.LockWithID(key, "locked") } func (kv *memKV) LockWithID( key string, lockerID string, ) (*kvdb.KVPair, error) { return kv.LockWithTimeout(key, lockerID, kvdb.DefaultLockTryDuration, kv.GetLockTimeout()) } func (kv *memKV) LockWithTimeout( key string, lockerID string, lockTryDuration time.Duration, lockHoldDuration time.Duration, ) (*kvdb.KVPair, error) { key = kv.domain + key duration := time.Second result, err := kv.Create(key, lockerID, uint64(duration*3)) startTime := time.Now() for count := 0; err != nil; count++ { time.Sleep(duration) result, err = kv.Create(key, lockerID, uint64(duration*3)) if err != nil && count > 0 && count%15 == 0 { var currLockerID string if _, errGet := kv.GetVal(key, currLockerID); errGet == nil { logrus.Infof("Lock %v locked for %v seconds, tag: %v", key, count, currLockerID) } } if err != nil && time.Since(startTime) > lockTryDuration { return nil, err } } if err != nil { return nil, err } lockChan := make(chan int) kv.mutex.Lock() kv.locks[key] = lockChan kv.mutex.Unlock() if lockHoldDuration > 0 { go func() { timeout := time.After(lockHoldDuration) for { select { case <-timeout: kv.LockTimedout(key) case <-lockChan: return } } }() } return result, err } func (kv *memKV) Unlock(kvp *kvdb.KVPair) error { kv.mutex.Lock() lockChan, ok := kv.locks[kvp.Key] if ok { delete(kv.locks, kvp.Key) } kv.mutex.Unlock() if lockChan != nil { close(lockChan) } _, err := kv.CompareAndDelete(kvp, kvdb.KVFlags(0)) return err } func (kv *memKV) EnumerateWithSelect( prefix string, enumerateSelect kvdb.EnumerateSelect, copySelect kvdb.CopySelect, ) ([]interface{}, error) { if enumerateSelect == nil || copySelect == nil { return nil, ErrIllegalSelect } kv.mutex.Lock() defer kv.mutex.Unlock() var kvi []interface{} prefix = kv.domain + prefix for k, v := range kv.m { if strings.HasPrefix(k, prefix) && !strings.Contains(k, "/_") { if enumerateSelect(v.ivalue) { cpy := copySelect(v.ivalue) if cpy == nil { return nil, ErrIllegalSelect } kvi = append(kvi, cpy) } } } return kvi, nil } func (kv *memKV) EnumerateKVPWithSelect( prefix string, enumerateSelect kvdb.EnumerateKVPSelect, copySelect kvdb.CopyKVPSelect, ) (kvdb.KVPairs, error) { if enumerateSelect == nil || copySelect == nil { return nil, ErrIllegalSelect } kv.mutex.Lock() defer kv.mutex.Unlock() var kvi kvdb.KVPairs prefix = kv.domain + prefix for k, v := range kv.m { if strings.HasPrefix(k, prefix) && !strings.Contains(k, "/_") { if enumerateSelect(&v.KVPair, v.ivalue) { cpy := copySelect(&v.KVPair, v.ivalue) if cpy == nil { return nil, ErrIllegalSelect } kvi = append(kvi, cpy) } } } return kvi, nil } func (kv *memKV) GetWithCopy( key string, copySelect kvdb.CopySelect, ) (interface{}, error) { if copySelect == nil { return nil, ErrIllegalSelect } kv.mutex.Lock() defer kv.mutex.Unlock() kvp, err := kv.get(key) if err != nil { return nil, err } return copySelect(kvp.ivalue), nil } func (kv *memKV) TxNew() (kvdb.Tx, error) { return nil, kvdb.ErrNotSupported } func (kv *memKV) normalize(kvp *kvdb.KVPair) { kvp.Key = strings.TrimPrefix(kvp.Key, kv.domain) } func copyWatchKeys(w map[string]*watchData) []string { keys := make([]string, len(w)) i := 0 for key := range w { keys[i] = key i++ } return keys } func (kv *memKV) watchCb( q WatchUpdateQueue, prefix string, v *watchData, treeWatch bool, ) { for { update := q.Dequeue() if ((treeWatch && strings.HasPrefix(update.key, prefix)) || (!treeWatch && update.key == prefix)) && (v.waitIndex == 0 || v.waitIndex < update.kvp.ModifiedIndex) { kvpCopy := update.kvp.copy() err := v.cb(update.key, v.opaque, kvpCopy, update.err) if err != nil { _ = v.cb("", v.opaque, nil, kvdb.ErrWatchStopped) kv.dist.Remove(q) return } } } } func (kv *memKV) SnapPut(snapKvp *kvdb.KVPair) (*kvdb.KVPair, error) { return nil, kvdb.ErrNotSupported } func (kv *snapMem) SnapPut(snapKvp *kvdb.KVPair) (*kvdb.KVPair, error) { var kvp *memKVPair key := kv.domain + snapKvp.Key kv.mutex.Lock() defer kv.mutex.Unlock() if old, ok := kv.m[key]; ok { old.Value = snapKvp.Value old.Action = kvdb.KVSet old.ModifiedIndex = snapKvp.ModifiedIndex old.KVDBIndex = snapKvp.KVDBIndex kvp = old } else { kvp = &memKVPair{ KVPair: kvdb.KVPair{ Key: key, Value: snapKvp.Value, TTL: 0, KVDBIndex: snapKvp.KVDBIndex, ModifiedIndex: snapKvp.ModifiedIndex, CreatedIndex: snapKvp.CreatedIndex, Action: kvdb.KVCreate, }, } kv.m[key] = kvp } kv.normalize(&kvp.KVPair) return &kvp.KVPair, nil } func (kv *snapMem) Put( key string, value interface{}, ttl uint64, ) (*kvdb.KVPair, error) { return nil, ErrSnap } func (kv *snapMem) Create( key string, value interface{}, ttl uint64, ) (*kvdb.KVPair, error) { return nil, ErrSnap } func (kv *snapMem) Update( key string, value interface{}, ttl uint64, ) (*kvdb.KVPair, error) { return nil, ErrSnap } func (kv *snapMem) Delete(snapKey string) (*kvdb.KVPair, error) { key := kv.domain + snapKey kv.mutex.Lock() defer kv.mutex.Unlock() kvp, ok := kv.m[key] if !ok { return nil, kvdb.ErrNotFound } kvPair := kvp.KVPair delete(kv.m, key) return &kvPair, nil } func (kv *snapMem) DeleteTree(prefix string) error { return ErrSnap } func (kv *snapMem) CompareAndSet( kvp *kvdb.KVPair, flags kvdb.KVFlags, prevValue []byte, ) (*kvdb.KVPair, error) { return nil, ErrSnap } func (kv *snapMem) CompareAndDelete( kvp *kvdb.KVPair, flags kvdb.KVFlags, ) (*kvdb.KVPair, error) { return nil, ErrSnap } func (kv *snapMem) WatchKey( key string, waitIndex uint64, opaque interface{}, watchCB kvdb.WatchCB, ) error { return ErrSnap } func (kv *snapMem) WatchTree( prefix string, waitIndex uint64, opaque interface{}, watchCB kvdb.WatchCB, ) error { return ErrSnap } func (kv *memKV) AddUser(username string, password string) error { return kvdb.ErrNotSupported } func (kv *memKV) RemoveUser(username string) error { return kvdb.ErrNotSupported } func (kv *memKV) GrantUserAccess( username string, permType kvdb.PermissionType, subtree string, ) error { return kvdb.ErrNotSupported } func (kv *memKV) RevokeUsersAccess( username string, permType kvdb.PermissionType, subtree string, ) error { return kvdb.ErrNotSupported } func (kv *memKV) Serialize() ([]byte, error) { kvps, err := kv.Enumerate("") if err != nil { return nil, err } return kv.SerializeAll(kvps) } func (kv *memKV) Deserialize(b []byte) (kvdb.KVPairs, error) { return kv.DeserializeAll(b) }
libopenstorage/stork
vendor/github.com/portworx/kvdb/mem/kv_mem.go
GO
apache-2.0
20,068
require 'spec_helper' require 'rack/test' include Rack::Test::Methods describe Crono::Web do let(:app) { Crono::Web } before do Crono::CronoJob.destroy_all @test_job_id = 'Perform TestJob every 5 seconds' @test_job_log = 'All runs ok' @test_job = Crono::CronoJob.create!( job_id: @test_job_id, log: @test_job_log ) end after { @test_job.destroy } describe '/' do it 'should show all jobs' do get '/' expect(last_response).to be_ok expect(last_response.body).to include @test_job_id end it 'should show a error mark when a job is unhealthy' do @test_job.update(healthy: false, last_performed_at: 10.minutes.ago) get '/' expect(last_response.body).to include 'Error' end it 'should show a success mark when a job is healthy' do @test_job.update(healthy: true, last_performed_at: 10.minutes.ago) get '/' expect(last_response.body).to include 'Success' end it 'should show a pending mark when a job is pending' do @test_job.update(healthy: nil) get '/' expect(last_response.body).to include 'Pending' end end describe '/job/:id' do it 'should show job log' do get "/job/#{@test_job.id}" expect(last_response).to be_ok expect(last_response.body).to include @test_job_id expect(last_response.body).to include @test_job_log end it 'should show a message about the unhealthy job' do message = 'An error occurs during the last execution of this job' @test_job.update(healthy: false) get "/job/#{@test_job.id}" expect(last_response.body).to include message end end end
plashchynski/crono
spec/web_spec.rb
Ruby
apache-2.0
1,684
/* * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.intellij.util.ref; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.TestOnly; import java.beans.Introspector; import java.lang.ref.ReferenceQueue; import java.lang.ref.SoftReference; import java.lang.ref.WeakReference; import java.util.ArrayList; public class GCUtil { /** * Try to force VM to collect all the garbage along with soft- and weak-references. * Method doesn't guarantee to succeed, and should not be used in the production code. */ @TestOnly public static void tryForceGC() { tryGcSoftlyReachableObjects(); WeakReference<Object> weakReference = new WeakReference<Object>(new Object()); do { System.gc(); } while (weakReference.get() != null); } /** * Try to force VM to collect soft references if possible. * Method doesn't guarantee to succeed, and should not be used in the production code. * Commits / hours optimized method code: 5 / 3 */ @TestOnly public static void tryGcSoftlyReachableObjects() { //long started = System.nanoTime(); ReferenceQueue<Object> q = new ReferenceQueue<Object>(); SoftReference<Object> ref = new SoftReference<Object>(new Object(), q); ArrayList<SoftReference<?>> list = ContainerUtil.newArrayListWithCapacity(100 + useReference(ref)); System.gc(); final long freeMemory = Runtime.getRuntime().freeMemory(); int i = 0; while (q.poll() == null) { // full gc is caused by allocation of large enough array below, SoftReference will be cleared after two full gc int bytes = Math.min((int)(freeMemory * 0.05), Integer.MAX_VALUE / 2); list.add(new SoftReference<Object>(new byte[bytes])); i++; if (i > 1000) { //noinspection UseOfSystemOutOrSystemErr System.out.println("GCUtil.tryGcSoftlyReachableObjects: giving up"); break; } } // use ref is important as to loop to finish with several iterations: long runs of the method (~80 run of PsiModificationTrackerTest) // discovered 'ref' being collected and loop iterated 100 times taking a lot of time list.ensureCapacity(list.size() + useReference(ref)); // do not leave a chance for our created SoftReference's content to lie around until next full GC's for(SoftReference createdReference:list) createdReference.clear(); //System.out.println("Done gc'ing refs:" + ((System.nanoTime() - started) / 1000000)); } private static int useReference(SoftReference<Object> ref) { Object o = ref.get(); return o == null ? 0 : Math.abs(o.hashCode()) % 10; } /** * Using java beans (e.g. Groovy does it) results in all referenced class infos being cached in ThreadGroupContext. A valid fix * would be to hold BeanInfo objects on soft references, but that should be done in JDK. So let's clear this cache manually for now, * in clients that are known to create bean infos. */ public static void clearBeanInfoCache() { Introspector.flushCaches(); } }
goodwinnk/intellij-community
platform/util/src/com/intellij/util/ref/GCUtil.java
Java
apache-2.0
3,604
/** * * Copyright 2003-2007 Jive Software. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.jivesoftware.smackx.bookmarks; import java.io.IOException; import java.util.ArrayList; import java.util.List; import org.jivesoftware.smack.util.ParserUtils; import org.jivesoftware.smack.util.XmlStringBuilder; import org.jivesoftware.smack.xml.XmlPullParser; import org.jivesoftware.smack.xml.XmlPullParserException; import org.jivesoftware.smackx.iqprivate.packet.PrivateData; import org.jivesoftware.smackx.iqprivate.provider.PrivateDataProvider; import org.jxmpp.jid.EntityBareJid; import org.jxmpp.jid.parts.Resourcepart; /** * Bookmarks is used for storing and retrieving URLS and Conference rooms. * Bookmark Storage (XEP-0048) defined a protocol for the storage of bookmarks to conference rooms and other entities * in a Jabber user's account. * See the following code sample for saving Bookmarks: * <pre> * XMPPConnection con = new XMPPTCPConnection("jabber.org"); * con.login("john", "doe"); * Bookmarks bookmarks = new Bookmarks(); * // Bookmark a URL * BookmarkedURL url = new BookmarkedURL(); * url.setName("Google"); * url.setURL("http://www.jivesoftware.com"); * bookmarks.addURL(url); * // Bookmark a Conference room. * BookmarkedConference conference = new BookmarkedConference(); * conference.setName("My Favorite Room"); * conference.setAutoJoin("true"); * conference.setJID("dev@conference.jivesoftware.com"); * bookmarks.addConference(conference); * // Save Bookmarks using PrivateDataManager. * PrivateDataManager manager = new PrivateDataManager(con); * manager.setPrivateData(bookmarks); * LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org"); * </pre> * * @author Derek DeMoro */ public class Bookmarks implements PrivateData { public static final String NAMESPACE = "storage:bookmarks"; public static final String ELEMENT = "storage"; private final List<BookmarkedURL> bookmarkedURLS; private final List<BookmarkedConference> bookmarkedConferences; /** * Required Empty Constructor to use Bookmarks. */ public Bookmarks() { bookmarkedURLS = new ArrayList<>(); bookmarkedConferences = new ArrayList<>(); } /** * Adds a BookmarkedURL. * * @param bookmarkedURL the bookmarked bookmarkedURL. */ public void addBookmarkedURL(BookmarkedURL bookmarkedURL) { bookmarkedURLS.add(bookmarkedURL); } /** * Removes a bookmarked bookmarkedURL. * * @param bookmarkedURL the bookmarked bookmarkedURL to remove. */ public void removeBookmarkedURL(BookmarkedURL bookmarkedURL) { bookmarkedURLS.remove(bookmarkedURL); } /** * Removes all BookmarkedURLs from user's bookmarks. */ public void clearBookmarkedURLS() { bookmarkedURLS.clear(); } /** * Add a BookmarkedConference to bookmarks. * * @param bookmarkedConference the conference to remove. */ public void addBookmarkedConference(BookmarkedConference bookmarkedConference) { bookmarkedConferences.add(bookmarkedConference); } /** * Removes a BookmarkedConference. * * @param bookmarkedConference the BookmarkedConference to remove. */ public void removeBookmarkedConference(BookmarkedConference bookmarkedConference) { bookmarkedConferences.remove(bookmarkedConference); } /** * Removes all BookmarkedConferences from Bookmarks. */ public void clearBookmarkedConferences() { bookmarkedConferences.clear(); } /** * Returns a Collection of all Bookmarked URLs for this user. * * @return a collection of all Bookmarked URLs. */ public List<BookmarkedURL> getBookmarkedURLS() { return bookmarkedURLS; } /** * Returns a Collection of all Bookmarked Conference for this user. * * @return a collection of all Bookmarked Conferences. */ public List<BookmarkedConference> getBookmarkedConferences() { return bookmarkedConferences; } /** * Returns the root element name. * * @return the element name. */ @Override public String getElementName() { return ELEMENT; } /** * Returns the root element XML namespace. * * @return the namespace. */ @Override public String getNamespace() { return NAMESPACE; } /** * Returns the XML representation of the PrivateData. * * @return the private data as XML. */ @Override public XmlStringBuilder toXML() { XmlStringBuilder buf = new XmlStringBuilder(); buf.halfOpenElement(ELEMENT).xmlnsAttribute(NAMESPACE).rightAngleBracket(); for (BookmarkedURL urlStorage : getBookmarkedURLS()) { if (urlStorage.isShared()) { continue; } buf.halfOpenElement("url").attribute("name", urlStorage.getName()).attribute("url", urlStorage.getURL()); buf.condAttribute(urlStorage.isRss(), "rss", "true"); buf.closeEmptyElement(); } // Add Conference additions for (BookmarkedConference conference : getBookmarkedConferences()) { if (conference.isShared()) { continue; } buf.halfOpenElement("conference"); buf.attribute("name", conference.getName()); buf.attribute("autojoin", Boolean.toString(conference.isAutoJoin())); buf.attribute("jid", conference.getJid()); buf.rightAngleBracket(); buf.optElement("nick", conference.getNickname()); buf.optElement("password", conference.getPassword()); buf.closeElement("conference"); } buf.closeElement(ELEMENT); return buf; } /** * The IQ Provider for BookmarkStorage. * * @author Derek DeMoro */ public static class Provider implements PrivateDataProvider { /** * Empty Constructor for PrivateDataProvider. */ public Provider() { super(); } @Override public PrivateData parsePrivateData(XmlPullParser parser) throws XmlPullParserException, IOException { Bookmarks storage = new Bookmarks(); boolean done = false; while (!done) { XmlPullParser.Event eventType = parser.next(); if (eventType == XmlPullParser.Event.START_ELEMENT && "url".equals(parser.getName())) { final BookmarkedURL urlStorage = getURLStorage(parser); if (urlStorage != null) { storage.addBookmarkedURL(urlStorage); } } else if (eventType == XmlPullParser.Event.START_ELEMENT && "conference".equals(parser.getName())) { final BookmarkedConference conference = getConferenceStorage(parser); storage.addBookmarkedConference(conference); } else if (eventType == XmlPullParser.Event.END_ELEMENT && "storage".equals(parser.getName())) { done = true; } } return storage; } } private static BookmarkedURL getURLStorage(XmlPullParser parser) throws IOException, XmlPullParserException { String name = parser.getAttributeValue("", "name"); String url = parser.getAttributeValue("", "url"); String rssString = parser.getAttributeValue("", "rss"); boolean rss = rssString != null && "true".equals(rssString); BookmarkedURL urlStore = new BookmarkedURL(url, name, rss); boolean done = false; while (!done) { XmlPullParser.Event eventType = parser.next(); if (eventType == XmlPullParser.Event.START_ELEMENT && "shared_bookmark".equals(parser.getName())) { urlStore.setShared(true); } else if (eventType == XmlPullParser.Event.END_ELEMENT && "url".equals(parser.getName())) { done = true; } } return urlStore; } private static BookmarkedConference getConferenceStorage(XmlPullParser parser) throws XmlPullParserException, IOException { String name = parser.getAttributeValue("", "name"); boolean autojoin = ParserUtils.getBooleanAttribute(parser, "autojoin", false); EntityBareJid jid = ParserUtils.getBareJidAttribute(parser); BookmarkedConference conf = new BookmarkedConference(jid); conf.setName(name); conf.setAutoJoin(autojoin); // Check for nickname boolean done = false; while (!done) { XmlPullParser.Event eventType = parser.next(); if (eventType == XmlPullParser.Event.START_ELEMENT && "nick".equals(parser.getName())) { String nickString = parser.nextText(); conf.setNickname(Resourcepart.from(nickString)); } else if (eventType == XmlPullParser.Event.START_ELEMENT && "password".equals(parser.getName())) { conf.setPassword(parser.nextText()); } else if (eventType == XmlPullParser.Event.START_ELEMENT && "shared_bookmark".equals(parser.getName())) { conf.setShared(true); } else if (eventType == XmlPullParser.Event.END_ELEMENT && "conference".equals(parser.getName())) { done = true; } } return conf; } }
igniterealtime/Smack
smack-extensions/src/main/java/org/jivesoftware/smackx/bookmarks/Bookmarks.java
Java
apache-2.0
10,216
/* * Copyright (C) FuseSource, Inc. * http://fusesource.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ @XmlSchema(namespace = "http://fuse.fusesource.org/schema/bai", xmlns = { @XmlNs(namespaceURI = Namespaces.DEFAULT_NAMESPACE, prefix = "c"), @XmlNs(namespaceURI = AuditConstants.AUDIT_NAMESPACE, prefix = AuditConstants.EXPRESSION_NAMESPACE_PREFIX) }, elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED) package org.fusesource.bai.config; import org.apache.camel.builder.xml.Namespaces; import org.fusesource.bai.AuditConstants; import javax.xml.bind.annotation.XmlNs; import javax.xml.bind.annotation.XmlSchema;
janstey/fuse
bai/bai-core/src/main/java/org/fusesource/bai/config/package-info.java
Java
apache-2.0
1,208
/** * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the * specific language governing permissions and limitations under the License. * * Copyright 2012-2017 the original author or authors. */ package org.assertj.core.error.future; import static java.lang.String.format; import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.error.future.ShouldBeCompletedExceptionally.shouldHaveCompletedExceptionally; import java.util.concurrent.CompletableFuture; import org.assertj.core.internal.TestDescription; import org.junit.Test; public class ShouldHaveCompletedExceptionally_create_Test { @Test public void should_create_error_message() throws Exception { String error = shouldHaveCompletedExceptionally(new CompletableFuture<Object>()).create(new TestDescription("TEST")); assertThat(error).isEqualTo(format("[TEST] %n" + "Expecting%n" + " <CompletableFuture[Incomplete]>%n" + "to be completed exceptionally")); } }
ChrisA89/assertj-core
src/test/java/org/assertj/core/error/future/ShouldHaveCompletedExceptionally_create_Test.java
Java
apache-2.0
1,500
// // This file was pubmed.openAccess.jaxb.generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vJAXB 2.1.10 in JDK 6 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2011.06.04 at 07:58:30 PM BST // package elsevier.jaxb.math.mathml; import java.math.BigInteger; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; /** * <p>Java class for mglyph.type complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="mglyph.type"> * &lt;complexContent> * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> * &lt;attGroup ref="{http://www.w3.org/1998/Math/MathML}mglyph.attlist"/> * &lt;/restriction> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "mglyph.type") @XmlRootElement(name = "mglyph") public class Mglyph { @XmlAttribute protected String alt; @XmlAttribute protected String fontfamily; @XmlAttribute @XmlSchemaType(name = "positiveInteger") protected BigInteger index; /** * Gets the value of the alt property. * * @return * possible object is * {@link String } * */ public String getAlt() { return alt; } /** * Sets the value of the alt property. * * @param value * allowed object is * {@link String } * */ public void setAlt(String value) { this.alt = value; } /** * Gets the value of the fontfamily property. * * @return * possible object is * {@link String } * */ public String getFontfamily() { return fontfamily; } /** * Sets the value of the fontfamily property. * * @param value * allowed object is * {@link String } * */ public void setFontfamily(String value) { this.fontfamily = value; } /** * Gets the value of the index property. * * @return * possible object is * {@link BigInteger } * */ public BigInteger getIndex() { return index; } /** * Sets the value of the index property. * * @param value * allowed object is * {@link BigInteger } * */ public void setIndex(BigInteger value) { this.index = value; } }
alexgarciac/biotea
src/elsevier/jaxb/math/mathml/Mglyph.java
Java
apache-2.0
2,890
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.util.indexing; import com.intellij.openapi.application.ReadAction; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.ex.FileTypeManagerEx; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.openapi.vfs.VirtualFileWithId; import com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry; import com.intellij.psi.search.FileTypeIndex; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.indexing.projectFilter.ProjectIndexableFilesFilterHolder; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.IOException; import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; final class UnindexedFilesFinder { private static final Logger LOG = Logger.getInstance(UnindexedFilesFinder.class); private final Project myProject; private final boolean myDoTraceForFilesToBeIndexed = FileBasedIndexImpl.LOG.isTraceEnabled(); private final FileBasedIndexImpl myFileBasedIndex; private final UpdatableIndex<FileType, Void, FileContent> myFileTypeIndex; private final Collection<FileBasedIndexInfrastructureExtension.FileIndexingStatusProcessor> myStateProcessors; private final @NotNull ProjectIndexableFilesFilterHolder myIndexableFilesFilterHolder; private final boolean myShouldProcessUpToDateFiles; UnindexedFilesFinder(@NotNull Project project, @NotNull FileBasedIndexImpl fileBasedIndex) { myProject = project; myFileBasedIndex = fileBasedIndex; myFileTypeIndex = fileBasedIndex.getIndex(FileTypeIndex.NAME); myStateProcessors = FileBasedIndexInfrastructureExtension .EP_NAME .extensions() .map(ex -> ex.createFileIndexingStatusProcessor(project)) .filter(Objects::nonNull) .collect(Collectors.toList()); myShouldProcessUpToDateFiles = ContainerUtil.find(myStateProcessors, p -> p.shouldProcessUpToDateFiles()) != null; myIndexableFilesFilterHolder = fileBasedIndex.getIndexableFilesFilterHolder(); } @Nullable("null if the file is not subject for indexing (a directory, invalid, etc.)") public UnindexedFileStatus getFileStatus(@NotNull VirtualFile file) { return ReadAction.compute(() -> { if (myProject.isDisposed() || !file.isValid() || !(file instanceof VirtualFileWithId)) { return null; } AtomicBoolean indexesWereProvidedByInfrastructureExtension = new AtomicBoolean(); AtomicLong timeProcessingUpToDateFiles = new AtomicLong(); AtomicLong timeUpdatingContentLessIndexes = new AtomicLong(); AtomicLong timeIndexingWithoutContent = new AtomicLong(); IndexedFileImpl indexedFile = new IndexedFileImpl(file, myProject); int inputId = FileBasedIndex.getFileId(file); boolean fileWereJustAdded = myIndexableFilesFilterHolder.addFileId(inputId, myProject); if (file instanceof VirtualFileSystemEntry && ((VirtualFileSystemEntry)file).isFileIndexed()) { boolean wasInvalidated = false; if (fileWereJustAdded) { List<ID<?, ?>> ids = IndexingStamp.getNontrivialFileIndexedStates(inputId); for (FileBasedIndexInfrastructureExtension.FileIndexingStatusProcessor processor : myStateProcessors) { for (ID<?, ?> id : ids) { if (myFileBasedIndex.needsFileContentLoading(id)) { long nowTime = System.nanoTime(); try { if (!processor.processUpToDateFile(indexedFile, inputId, id)) { wasInvalidated = true; } } finally { timeProcessingUpToDateFiles.addAndGet(System.nanoTime() - nowTime); } } } } } if (!wasInvalidated) { IndexingStamp.flushCache(inputId); return new UnindexedFileStatus(false, false, timeProcessingUpToDateFiles.get(), timeUpdatingContentLessIndexes.get(), timeIndexingWithoutContent.get()); } } AtomicBoolean shouldIndex = new AtomicBoolean(); FileTypeManagerEx.getInstanceEx().freezeFileTypeTemporarilyIn(file, () -> { boolean isDirectory = file.isDirectory(); FileIndexingState fileTypeIndexState = null; if (!isDirectory && !myFileBasedIndex.isTooLarge(file)) { if ((fileTypeIndexState = myFileTypeIndex.getIndexingStateForFile(inputId, indexedFile)) == FileIndexingState.OUT_DATED) { myFileBasedIndex.dropNontrivialIndexedStates(inputId); shouldIndex.set(true); } else { final List<ID<?, ?>> affectedIndexCandidates = myFileBasedIndex.getAffectedIndexCandidates(indexedFile); //noinspection ForLoopReplaceableByForEach for (int i = 0, size = affectedIndexCandidates.size(); i < size; ++i) { final ID<?, ?> indexId = affectedIndexCandidates.get(i); try { if (myFileBasedIndex.needsFileContentLoading(indexId)) { FileIndexingState fileIndexingState = myFileBasedIndex.shouldIndexFile(indexedFile, indexId); boolean indexInfrastructureExtensionInvalidated = false; if (fileIndexingState == FileIndexingState.UP_TO_DATE) { if (myShouldProcessUpToDateFiles) { for (FileBasedIndexInfrastructureExtension.FileIndexingStatusProcessor p : myStateProcessors) { long nowTime = System.nanoTime(); try { if (!p.processUpToDateFile(indexedFile, inputId, indexId)) { indexInfrastructureExtensionInvalidated = true; } } finally { timeProcessingUpToDateFiles.addAndGet(System.nanoTime() - nowTime); } } } } if (indexInfrastructureExtensionInvalidated) { fileIndexingState = myFileBasedIndex.shouldIndexFile(indexedFile, indexId); } if (fileIndexingState.updateRequired()) { if (myDoTraceForFilesToBeIndexed) { LOG.trace("Scheduling indexing of " + file + " by request of index " + indexId); } long nowTime = System.nanoTime(); boolean wasIndexedByInfrastructure; try { wasIndexedByInfrastructure = tryIndexWithoutContentViaInfrastructureExtension(indexedFile, inputId, indexId); } finally { timeIndexingWithoutContent.addAndGet(System.nanoTime() - nowTime); } if (wasIndexedByInfrastructure) { indexesWereProvidedByInfrastructureExtension.set(true); } else { shouldIndex.set(true); // NOTE! Do not break the loop here. We must process ALL IDs and pass them to the FileIndexingStatusProcessor // so that it can invalidate all "indexing states" (by means of clearing IndexingStamp) // for all indexes that became invalid. See IDEA-252846 for more details. } } } } catch (RuntimeException e) { final Throwable cause = e.getCause(); if (cause instanceof IOException || cause instanceof StorageException) { LOG.info(e); myFileBasedIndex.requestRebuild(indexId); } else { throw e; } } } } } long nowTime = System.nanoTime(); try { for (ID<?, ?> indexId : myFileBasedIndex.getContentLessIndexes(isDirectory)) { if (FileTypeIndex.NAME.equals(indexId) && fileTypeIndexState != null && !fileTypeIndexState.updateRequired()) { continue; } if (myFileBasedIndex.shouldIndexFile(indexedFile, indexId).updateRequired()) { myFileBasedIndex.updateSingleIndex(indexId, file, inputId, new IndexedFileWrapper(indexedFile)); } } } finally { timeUpdatingContentLessIndexes.addAndGet(System.nanoTime() - nowTime); } IndexingStamp.flushCache(inputId); if (!shouldIndex.get()) { IndexingFlag.setFileIndexed(file); } }); return new UnindexedFileStatus(shouldIndex.get(), indexesWereProvidedByInfrastructureExtension.get(), timeProcessingUpToDateFiles.get(), timeUpdatingContentLessIndexes.get(), timeIndexingWithoutContent.get()); }); } private boolean tryIndexWithoutContentViaInfrastructureExtension(IndexedFile fileContent, int inputId, ID<?, ?> indexId) { for (FileBasedIndexInfrastructureExtension.FileIndexingStatusProcessor processor : myStateProcessors) { if (processor.tryIndexFileWithoutContent(fileContent, inputId, indexId)) { FileBasedIndexImpl.setIndexedState(myFileBasedIndex.getIndex(indexId), fileContent, inputId, true); return true; } } return false; } }
ingokegel/intellij-community
platform/lang-impl/src/com/intellij/util/indexing/UnindexedFilesFinder.java
Java
apache-2.0
10,024
'use strict'; let angular = require('angular'); module.exports = angular.module('spinnaker.serverGroup.configure.gce.instanceArchetypeCtrl', []) .controller('gceInstanceArchetypeCtrl', function($scope, instanceTypeService, modalWizardService) { var wizard = modalWizardService.getWizard(); $scope.$watch('command.viewState.instanceProfile', function() { if (!$scope.command.viewState.instanceProfile || $scope.command.viewState.instanceProfile === 'custom') { wizard.excludePage('instance-type'); } else { wizard.includePage('instance-type'); wizard.markClean('instance-profile'); wizard.markComplete('instance-profile'); } }); $scope.$watch('command.viewState.instanceType', function(newVal) { if (newVal) { wizard.markClean('instance-profile'); wizard.markComplete('instance-profile'); } }); }).name;
zanthrash/deck-1
app/scripts/modules/google/serverGroup/configure/wizard/ServerGroupInstanceArchetype.controller.js
JavaScript
apache-2.0
911
<?php /** * Utility functions for the DrEdit PHP application. * * @author Burcu Dogan <jbd@google.com> * * Copyright 2013 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * Returns the current user in the session or NULL. */ function get_user() { if (isset($_SESSION["user"])) { return json_decode($_SESSION["user"]); } return NULL; } /** * Sets the current user. */ function set_user($tokens) { $_SESSION["user"] = json_encode(array( 'tokens' => $tokens )); } /** * Deletes the user in the session. */ function delete_user() { $_SESSION["user"] = NULL; } /** * Checks whether or not there is an authenticated * user in the session. If not, responds with error message. */ function checkUserAuthentication($app) { $user = get_user(); if (!$user) { $app->renderErrJson($app, 401, 'User is not authenticated.'); } } /** * Checks whether or not all given params are represented in the * request's query parameters. If not, responds with error message. */ function checkRequiredQueryParams($app, $params = array()) { foreach ($params as &$param) { if (!$app->request()->get($param)) { renderErrJson($app, 400, 'Required parameter missing.'); } } }; /** * Renders the given object as JSON. */ function renderJson($app, $obj) { echo json_encode($obj); } /** * Renders the given message as JSON and responds with the * given HTTP status code. */ function renderErrJson($app, $statusCode, $message) { echo json_encode(array( message => $message )); $app->halt($statusCode); } /** * Renders the given Exception object as JSON. */ function renderEx($app, $ex) { echo json_encode($ex); }
murat8505/dredit_text_editor_Google-Drive
php/utils.php
PHP
apache-2.0
2,194
/// Copyright (c) 2009 Microsoft Corporation /// /// Redistribution and use in source and binary forms, with or without modification, are permitted provided /// that the following conditions are met: /// * Redistributions of source code must retain the above copyright notice, this list of conditions and /// the following disclaimer. /// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and /// the following disclaimer in the documentation and/or other materials provided with the distribution. /// * Neither the name of Microsoft nor the names of its contributors may be used to /// endorse or promote products derived from this software without specific prior written permission. /// /// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR /// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS /// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE /// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT /// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS /// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, /// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF /// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ES5Harness.registerTest({ id: "15.4.4.14-9-b-i-6", path: "TestCases/chapter15/15.4/15.4.4/15.4.4.14/15.4.4.14-9-b-i-6.js", description: "Array.prototype.indexOf - element to be retrieved is own data property that overrides an inherited accessor property on an Array-like object", test: function testcase() { try { Object.defineProperty(Object.prototype, "0", { get: function () { return false; }, configurable: true }); return 0 === Array.prototype.indexOf.call({ 0: true, 1: 1, length: 2 }, true); } finally { delete Object.prototype[0]; } }, precondition: function prereq() { return fnExists(Array.prototype.indexOf) && fnExists(Object.defineProperty) && fnSupportsArrayIndexGettersOnObjects(); } });
hnafar/IronJS
Src/Tests/ietestcenter/chapter15/15.4/15.4.4/15.4.4.14/15.4.4.14-9-b-i-6.js
JavaScript
apache-2.0
2,446