aboutsummaryrefslogtreecommitdiffstats
path: root/Exception
diff options
context:
space:
mode:
authorIvan Enderlin <ivan.enderlin@hoa-project.net>2012-08-24 09:15:27 +0200
committerIvan Enderlin <ivan.enderlin@hoa-project.net>2012-08-24 09:15:27 +0200
commitf8b26bf191ebe416679a336b3f66a991e72edf6e (patch)
treebfc22d175d17ac024c1418fcbb2c87ab6327c5f3 /Exception
parent9e48dd776ef853c21357a29ea137f7e771f93d41 (diff)
downloadCompiler-f8b26bf191ebe416679a336b3f66a991e72edf6e.zip
Compiler-f8b26bf191ebe416679a336b3f66a991e72edf6e.tar.gz
Compiler-f8b26bf191ebe416679a336b3f66a991e72edf6e.tar.bz2
Libification (split from Central).
Diffstat (limited to 'Exception')
-rw-r--r--Exception/Exception.php51
-rw-r--r--Exception/FinalStateHasNotBeenReached.php62
-rw-r--r--Exception/IllegalToken.php104
-rw-r--r--Exception/Rule.php63
-rw-r--r--Exception/UnexpectedToken.php62
-rw-r--r--Exception/UnrecognizedToken.php104
6 files changed, 446 insertions, 0 deletions
diff --git a/Exception/Exception.php b/Exception/Exception.php
new file mode 100644
index 0000000..53de5c1
--- /dev/null
+++ b/Exception/Exception.php
@@ -0,0 +1,51 @@
+<?php
+
+/**
+ * Hoa
+ *
+ *
+ * @license
+ *
+ * New BSD License
+ *
+ * Copyright © 2007-2012, Ivan Enderlin. All rights reserved.
+ *
+ * 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 the Hoa 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 HOLDERS AND 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.
+ */
+
+namespace Hoa\Compiler\Exception {
+
+/**
+ * Class \Hoa\Compiler\Exception.
+ *
+ * Extending the \Hoa\Core\Exception class.
+ *
+ * @author Ivan Enderlin <ivan.enderlin@hoa-project.net>
+ * @copyright Copyright © 2007-2012 Ivan Enderlin.
+ * @license New BSD License
+ */
+
+class Exception extends \Hoa\Core\Exception { }
+
+}
diff --git a/Exception/FinalStateHasNotBeenReached.php b/Exception/FinalStateHasNotBeenReached.php
new file mode 100644
index 0000000..4624e6a
--- /dev/null
+++ b/Exception/FinalStateHasNotBeenReached.php
@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * Hoa
+ *
+ *
+ * @license
+ *
+ * New BSD License
+ *
+ * Copyright © 2007-2012, Ivan Enderlin. All rights reserved.
+ *
+ * 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 the Hoa 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 HOLDERS AND 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.
+ */
+
+namespace {
+
+from('Hoa')
+
+/**
+ * \Hoa\Compiler\Exception
+ */
+-> import('Compiler.Exception.~');
+
+}
+
+namespace Hoa\Compiler\Exception {
+
+/**
+ * Class \Hoa\Compiler\Exception\FinalStateHasNotBeenReached.
+ *
+ * Extending the \Hoa\Compiler\Exception class.
+ *
+ * @author Ivan Enderlin <ivan.enderlin@hoa-project.net>
+ * @copyright Copyright © 2007-2012 Ivan Enderlin.
+ * @license New BSD License
+ */
+
+class FinalStateHasNotBeenReached extends Exception { }
+
+}
diff --git a/Exception/IllegalToken.php b/Exception/IllegalToken.php
new file mode 100644
index 0000000..1520f74
--- /dev/null
+++ b/Exception/IllegalToken.php
@@ -0,0 +1,104 @@
+<?php
+
+/**
+ * Hoa
+ *
+ *
+ * @license
+ *
+ * New BSD License
+ *
+ * Copyright © 2007-2012, Ivan Enderlin. All rights reserved.
+ *
+ * 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 the Hoa 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 HOLDERS AND 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.
+ */
+
+namespace {
+
+from('Hoa')
+
+/**
+ * \Hoa\Compiler\Exception
+ */
+-> import('Compiler.Exception');
+
+}
+
+namespace Hoa\Compiler\Exception {
+
+/**
+ * Class \Hoa\Compiler\Exception\IllegalToken.
+ *
+ * Extending the \Hoa\Compiler\Exception class.
+ *
+ * @author Ivan Enderlin <ivan.enderlin@hoa-project.net>
+ * @copyright Copyright © 2007-2012 Ivan Enderlin.
+ * @license New BSD License
+ */
+
+class IllegalToken extends Exception {
+
+ /**
+ * Column.
+ *
+ * @var \Hoa\Compiler\Exception\IllegalToken int
+ */
+ protected $column = 0;
+
+
+
+ /**
+ * Override line and add column support.
+ *
+ * @access public
+ * @param string $message Formatted message.
+ * @param int $code Code (the ID).
+ * @param array $arg RaiseError string arguments.
+ * @param int $line Line.
+ * @param int $column Column.
+ * @return void
+ */
+ public function __construct ( $message, $code, $arg, $line, $column ) {
+
+ parent::__construct($message, $code, $arg);
+
+ $this->line = $line;
+ $this->column = $column;
+
+ return;
+ }
+
+ /**
+ * Get column.
+ *
+ * @access public
+ * @return int
+ */
+ public function getColumn ( ) {
+
+ return $this->column;
+ }
+}
+
+}
diff --git a/Exception/Rule.php b/Exception/Rule.php
new file mode 100644
index 0000000..4cf3378
--- /dev/null
+++ b/Exception/Rule.php
@@ -0,0 +1,63 @@
+<?php
+
+/**
+ * Hoa
+ *
+ *
+ * @license
+ *
+ * New BSD License
+ *
+ * Copyright © 2007-2012, Ivan Enderlin. All rights reserved.
+ *
+ * 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 the Hoa 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 HOLDERS AND 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.
+ */
+
+namespace {
+
+from('Hoa')
+
+/**
+ * \Hoa\Compiler\Exception
+ */
+-> import('Compiler.Exception.~');
+
+}
+
+namespace Hoa\Compiler\Exception {
+
+/**
+ * Class \Hoa\Compiler\Exception\FinalStateHasNotBeenReached.
+ *
+ * Extending the \Hoa\Compiler\Exception class.
+ *
+ * @author Frédéric Dadeau <frederic.dadeau@femto-st.fr>
+ * @author Ivan Enderlin <ivan.enderlin@hoa-project.net>
+ * @copyright Copyright © 2007-2012 Frédéric Dadeau, Ivan Enderlin.
+ * @license New BSD License
+ */
+
+class Rule extends Exception { }
+
+}
diff --git a/Exception/UnexpectedToken.php b/Exception/UnexpectedToken.php
new file mode 100644
index 0000000..846d6a7
--- /dev/null
+++ b/Exception/UnexpectedToken.php
@@ -0,0 +1,62 @@
+<?php
+
+/**
+ * Hoa
+ *
+ *
+ * @license
+ *
+ * New BSD License
+ *
+ * Copyright © 2007-2012, Ivan Enderlin. All rights reserved.
+ *
+ * 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 the Hoa 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 HOLDERS AND 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.
+ */
+
+namespace {
+
+from('Hoa')
+
+/**
+ * \Hoa\Compiler\Exception\UnrecognizedToken
+ */
+-> import('Compiler.Exception.UnrecognizedToken');
+
+}
+
+namespace Hoa\Compiler\Exception {
+
+/**
+ * Class \Hoa\Compiler\Exception\UnexpectedToken.
+ *
+ * Extending the \Hoa\Compiler\Exception class.
+ *
+ * @author Ivan Enderlin <ivan.enderlin@hoa-project.net>
+ * @copyright Copyright © 2007-2012 Ivan Enderlin.
+ * @license New BSD License
+ */
+
+class UnexpectedToken extends UnrecognizedToken { }
+
+}
diff --git a/Exception/UnrecognizedToken.php b/Exception/UnrecognizedToken.php
new file mode 100644
index 0000000..1654251
--- /dev/null
+++ b/Exception/UnrecognizedToken.php
@@ -0,0 +1,104 @@
+<?php
+
+/**
+ * Hoa
+ *
+ *
+ * @license
+ *
+ * New BSD License
+ *
+ * Copyright © 2007-2012, Ivan Enderlin. All rights reserved.
+ *
+ * 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 the Hoa 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 HOLDERS AND 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.
+ */
+
+namespace {
+
+from('Hoa')
+
+/**
+ * \Hoa\Compiler\Exception
+ */
+-> import('Compiler.Exception');
+
+}
+
+namespace Hoa\Compiler\Exception {
+
+/**
+ * Class \Hoa\Compiler\Exception\UnrecognizedToken.
+ *
+ * Extending the \Hoa\Compiler\Exception class.
+ *
+ * @author Ivan Enderlin <ivan.enderlin@hoa-project.net>
+ * @copyright Copyright © 2007-2012 Ivan Enderlin.
+ * @license New BSD License
+ */
+
+class UnrecognizedToken extends Exception {
+
+ /**
+ * Column.
+ *
+ * @var \Hoa\Compiler\Exception\UnrecognizedToken int
+ */
+ protected $column = 0;
+
+
+
+ /**
+ * Override line and add column support.
+ *
+ * @access public
+ * @param string $message Formatted message.
+ * @param int $code Code (the ID).
+ * @param array $arg RaiseError string arguments.
+ * @param int $line Line.
+ * @param int $column Column.
+ * @return void
+ */
+ public function __construct ( $message, $code, $arg, $line, $column ) {
+
+ parent::__construct($message, $code, $arg);
+
+ $this->line = $line;
+ $this->column = $column;
+
+ return;
+ }
+
+ /**
+ * Get column.
+ *
+ * @access public
+ * @return int
+ */
+ public function getColumn ( ) {
+
+ return $this->column;
+ }
+}
+
+}