TypePHP 编译器
https://swoole.com/aot/
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
790 B
40 lines
790 B
<?php
|
|
|
|
namespace PhpAot\Core;
|
|
|
|
abstract class Translator
|
|
{
|
|
protected int $indentLevel = 0;
|
|
protected string $indentStr = "\t";
|
|
public string $mode = 'cli';
|
|
protected string $lang;
|
|
|
|
public function setMode($mode): void
|
|
{
|
|
$this->mode = $mode;
|
|
}
|
|
|
|
public function setIndent(string $indent): void
|
|
{
|
|
$this->indentStr = $indent;
|
|
}
|
|
|
|
public function setIndentLevel(int $level): void
|
|
{
|
|
$this->indentLevel = $level;
|
|
}
|
|
|
|
public function getLang(): string
|
|
{
|
|
return $this->lang;
|
|
}
|
|
|
|
abstract public function getLine($node): int;
|
|
|
|
abstract public function getType($node): string;
|
|
|
|
protected function getIndent(): string
|
|
{
|
|
return str_repeat($this->indentStr, $this->indentLevel);
|
|
}
|
|
}
|
|
|