代码拉取完成,页面将自动刷新
<?php
/*
ex: set ro:
DO NOT EDIT.
generated by smc (http://smc.sourceforge.net/)
from file : word_parser.sm
*/
require_once 'StateMachine/statemap.php';
class word_parState extends State {
public function Entry($fsm) {
}
public function Exit_($fsm) {
}
public function getchar($fsm, $c) {
$this->Default_($fsm);
}
public function Default_($fsm) {
$state = $fsm->getState()->getName();
$transition = $fsm->getTransition();
$msg = "\n\tState: $state\n\tTransition: $transition";
throw new TransitionUndefinedException($msg);
}
}
class Main_Default extends word_parState {
public function getchar($fsm, $c) {
$ctxt = $fsm->getOwner();
$endState = $fsm->getState();
$fsm->clearState();
$exception = NULL;
try {
$ctxt->printError($c);
}
catch (Exception $exception) {}
$fsm->setState($endState);
if ($exception != NULL) {
throw $exception;
}
}
}
class Main_IDLE extends Main_Default {
public function getchar($fsm, $c) {
$ctxt = $fsm->getOwner();
if ($ctxt->isChracter($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doBeginItem($c, "char");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Character);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif ($ctxt->isNum($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doBeginItem($c, "num");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Number);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif (bin2hex('/') == bin2hex($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doBeginItem($c, "pre_div");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Operator_div);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif ($ctxt->isBorder($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doBeginItem($c, "border");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Border);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
} else {
parent::getchar($fsm, $c);
}
}
}
class Main_Character extends Main_Default {
public function getchar($fsm, $c) {
$ctxt = $fsm->getOwner();
if ($ctxt->isChracter($c) || $ctxt->isNum($c)) {
$endState = $fsm->getState();
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doAppend($c);
}
catch (Exception $exception) {}
$fsm->setState($endState);
if ($exception != NULL) {
throw $exception;
}
}
elseif ($ctxt->isBorder($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "border");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Border);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif (bin2hex('/') == bin2hex($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "unknown");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Operator_div);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif ($ctxt->isOperator($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "opt");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Operator_Comm);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
} else {
parent::getchar($fsm, $c);
}
}
}
class Main_Number extends Main_Default {
public function getchar($fsm, $c) {
$ctxt = $fsm->getOwner();
if ($ctxt->isNum($c) || bin2hex($c) == bin2hex('.')) {
$endState = $fsm->getState();
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doAppend($c);
}
catch (Exception $exception) {}
$fsm->setState($endState);
if ($exception != NULL) {
throw $exception;
}
}
elseif ($ctxt->isBorder($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "border");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Border);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif (bin2hex('/') == bin2hex($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "unknown");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Operator_div);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif ($ctxt->isOperator($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "opt");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Operator_Comm);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
} else {
parent::getchar($fsm, $c);
}
}
}
class Main_Border extends Main_Default {
public function getchar($fsm, $c) {
$ctxt = $fsm->getOwner();
if ($ctxt->isChracter($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "char");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Character);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif ($ctxt->isNum($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "num");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Number);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif (bin2hex('/') == bin2hex($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "unknown");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Operator_div);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif ($ctxt->isOperator($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "opt");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Operator_Comm);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif ((bin2hex($c) == bin2hex("\n")) || (bin2hex($c) == bin2hex("\r")) || (bin2hex($c) == bin2hex(" "))) {
# No actions.
}
elseif ($ctxt->isBorder($c)) {
$endState = $fsm->getState();
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "border");
}
catch (Exception $exception) {}
$fsm->setState($endState);
if ($exception != NULL) {
throw $exception;
}
} else {
parent::getchar($fsm, $c);
}
}
}
class Main_Operator_Comm extends Main_Default {
public function getchar($fsm, $c) {
$ctxt = $fsm->getOwner();
if ($ctxt->isChracter($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "char");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Character);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif (bin2hex($c) == bin2hex('/')) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "unknown");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Operator_div);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif ($ctxt->isNum($c)) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "num");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Number);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif ($ctxt->isBorder($c)) {
$endState = $fsm->getState();
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem($c, "border");
}
catch (Exception $exception) {}
$fsm->setState($endState);
if ($exception != NULL) {
throw $exception;
}
} else {
parent::getchar($fsm, $c);
}
}
}
class Main_Operator_div extends Main_Default {
public function getchar($fsm, $c) {
$ctxt = $fsm->getOwner();
if (bin2hex($c) == bin2hex('*')) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doAppend($c);
$ctxt->set_type("block_note");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Block_Note);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
elseif (bin2hex($c) == bin2hex('/')) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doAppend($c);
$ctxt->set_type("row_note");
}
catch (Exception $exception) {}
$fsm->setState(Main::$Row_Note);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
else {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
}
catch (Exception $exception) {}
$fsm->setState(Main::$IDLE);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
}
}
class Main_Block_Note extends Main_Default {
public function getchar($fsm, $c) {
$ctxt = $fsm->getOwner();
if (bin2hex($c) != bin2hex('*')) {
$endState = $fsm->getState();
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doAppend($c);
}
catch (Exception $exception) {}
$fsm->setState($endState);
if ($exception != NULL) {
throw $exception;
}
}
else {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doAppend($c);
}
catch (Exception $exception) {}
$fsm->setState(Main::$Block_Note_Meet_Mult);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
}
}
class Main_Block_Note_Meet_Mult extends Main_Default {
public function getchar($fsm, $c) {
$ctxt = $fsm->getOwner();
if (bin2hex($c) == bin2hex('/')) {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doAppend($c);
$ctxt->doSave();
$ctxt->doBeginItem("", "unknown");
}
catch (Exception $exception) {}
$fsm->setState(Main::$IDLE);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
else {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doAppend($c);
}
catch (Exception $exception) {}
$fsm->setState(Main::$Block_Note);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
}
}
class Main_Row_Note extends Main_Default {
public function getchar($fsm, $c) {
$ctxt = $fsm->getOwner();
if (bin2hex($c) != bin2hex("\n")) {
$endState = $fsm->getState();
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doAppend($c);
}
catch (Exception $exception) {}
$fsm->setState($endState);
if ($exception != NULL) {
throw $exception;
}
}
else {
$fsm->getState()->Exit_($fsm);
$fsm->clearState();
$exception = NULL;
try {
$ctxt->doSave();
$ctxt->doBeginItem("", "unknown");
}
catch (Exception $exception) {}
$fsm->setState(Main::$IDLE);
$fsm->getState()->Entry($fsm);
if ($exception != NULL) {
throw $exception;
}
}
}
}
class Main {
public static $IDLE;
public static $Character;
public static $Number;
public static $Border;
public static $Operator_Comm;
public static $Operator_div;
public static $Block_Note;
public static $Block_Note_Meet_Mult;
public static $Row_Note;
public static $Default_;
}
Main::$IDLE = new Main_IDLE('Main.IDLE', 4);
Main::$Character = new Main_Character('Main.Character', 5);
Main::$Number = new Main_Number('Main.Number', 6);
Main::$Border = new Main_Border('Main.Border', 7);
Main::$Operator_Comm = new Main_Operator_Comm('Main.Operator_Comm', 8);
Main::$Operator_div = new Main_Operator_div('Main.Operator_div', 9);
Main::$Block_Note = new Main_Block_Note('Main.Block_Note', 10);
Main::$Block_Note_Meet_Mult = new Main_Block_Note_Meet_Mult('Main.Block_Note_Meet_Mult', 11);
Main::$Row_Note = new Main_Row_Note('Main.Row_Note', 12);
Main::$Default_ = new Main_Default('Main.Default_', -1);
class word_par_sm extends FSMContext {
public function __construct($owner) {
parent::__construct(Main::$IDLE);
$this->_owner = $owner;
}
public function getchar($c) {
$this->_transition = "getchar";
$this->getState()->getchar($this, $c);
$this->_transition = NULL;
}
public function getState() {
if ($this->_state == NULL) {
throw new StateUndefinedException();
}
return $this->_state;
}
public function enterStartState() {
$this->_state->Entry($this);
}
public function getOwner() {
return $this->_owner;
}
}
/*
Local variables:
buffer-read-only: t
End:
*/
?>
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。