summaryrefslogtreecommitdiff
path: root/buildscripts/phing/classes/phing/parser/RootHandler.php
diff options
context:
space:
mode:
Diffstat (limited to 'buildscripts/phing/classes/phing/parser/RootHandler.php')
-rwxr-xr-xbuildscripts/phing/classes/phing/parser/RootHandler.php82
1 files changed, 82 insertions, 0 deletions
diff --git a/buildscripts/phing/classes/phing/parser/RootHandler.php b/buildscripts/phing/classes/phing/parser/RootHandler.php
new file mode 100755
index 00000000..435aae40
--- /dev/null
+++ b/buildscripts/phing/classes/phing/parser/RootHandler.php
@@ -0,0 +1,82 @@
+<?php
+/*
+ * $Id: 061d3ffe06257d551822050020d0e64689663334 $
+ *
+ * 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 please see
+ * <http://phing.info>.
+ */
+
+require_once 'phing/parser/AbstractHandler.php';
+include_once 'phing/parser/ExpatParseException.php';
+include_once 'phing/parser/ProjectHandler.php';
+
+/**
+ * Root filter class for a phing buildfile.
+ *
+ * The root filter is called by the parser first. This is where the phing
+ * specific parsing starts. RootHandler decides what to do next.
+ *
+ * @author Andreas Aderhold <andi@binarycloud.com>
+ * @copyright 2001,2002 THYRELL. All rights reserved
+ * @version $Id$
+ * @package phing.parser
+ */
+class RootHandler extends AbstractHandler {
+
+ /**
+ * The phing project configurator object
+ */
+ private $configurator;
+
+ /**
+ * Constructs a new RootHandler
+ *
+ * The root filter is required so the parser knows what to do. It's
+ * called by the ExpatParser that is instatiated in ProjectConfigurator.
+ *
+ * It recieves the expat parse object ref and a reference to the
+ * configurator
+ *
+ * @param AbstractSAXParser $parser The ExpatParser object.
+ * @param ProjectConfigurator $configurator The ProjectConfigurator object.
+ */
+ function __construct(AbstractSAXParser $parser, ProjectConfigurator $configurator) {
+ $this->configurator = $configurator;
+ parent::__construct($parser, $this);
+ }
+
+ /**
+ * Kick off a custom action for a start element tag.
+ *
+ * The root element of our buildfile is the &lt;project&gt; element. The
+ * root filter handles this element if it occurs, creates ProjectHandler
+ * to handle any nested tags & attributes of the &lt;project&gt; tag,
+ * and calls init.
+ *
+ * @param string $tag The xml tagname
+ * @param array $attrs The attributes of the tag
+ * @throws ExpatParseException if the first element within our build file
+ * is not the &gt;project&lt; element
+ */
+ function startElement($tag, $attrs) {
+ if ($tag === "project") {
+ $ph = new ProjectHandler($this->parser, $this, $this->configurator);
+ $ph->init($tag, $attrs);
+ } else {
+ throw new ExpatParseException("Unexpected tag <$tag> in top-level of build file.", $this->parser->getLocation());
+ }
+ }
+}