You've already forked MyDSL
基础内容
This commit is contained in:
15
src/Grammar/Grammar.php
Normal file
15
src/Grammar/Grammar.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename Grammar.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 14:13
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Grammar;
|
||||
|
||||
|
||||
class Grammar extends GrammarInterface
|
||||
{
|
||||
|
||||
}
|
15
src/Grammar/GrammarInterface.php
Normal file
15
src/Grammar/GrammarInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename GrammarInterface.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 14:11
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Grammar;
|
||||
|
||||
|
||||
abstract class GrammarInterface
|
||||
{
|
||||
|
||||
}
|
21
src/Output/CnTextOutput.php
Normal file
21
src/Output/CnTextOutput.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename CnTextOutput.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:33
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Output;
|
||||
|
||||
|
||||
/**
|
||||
* 又以中文形式重新输出一遍
|
||||
* @package JerryYan\DSL\Output
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 16:12
|
||||
*/
|
||||
class CnTextOutput extends OutputInterface
|
||||
{
|
||||
|
||||
}
|
15
src/Output/DiagramOutput.php
Normal file
15
src/Output/DiagramOutput.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename DiagramOutput.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:30
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Output;
|
||||
|
||||
|
||||
class DiagramOutput extends OutputInterface
|
||||
{
|
||||
|
||||
}
|
15
src/Output/HTMLOutput.php
Normal file
15
src/Output/HTMLOutput.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename HTMLOutput.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:09
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Output;
|
||||
|
||||
|
||||
class HTMLOutput extends OutputInterface
|
||||
{
|
||||
|
||||
}
|
15
src/Output/OutputInterface.php
Normal file
15
src/Output/OutputInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename OutputInterface.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:08
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Output;
|
||||
|
||||
|
||||
abstract class OutputInterface
|
||||
{
|
||||
|
||||
}
|
15
src/Parser/Parser.php
Normal file
15
src/Parser/Parser.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename Parser.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:35
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Parser;
|
||||
|
||||
|
||||
class Parser extends ParserInterface
|
||||
{
|
||||
|
||||
}
|
15
src/Parser/ParserInterface.php
Normal file
15
src/Parser/ParserInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename ParserInterface.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:35
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Parser;
|
||||
|
||||
|
||||
abstract class ParserInterface
|
||||
{
|
||||
|
||||
}
|
15
src/Reader/FileReader.php
Normal file
15
src/Reader/FileReader.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename FileReader.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 14:58
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Reader;
|
||||
|
||||
|
||||
class FileReader extends ReaderInterface
|
||||
{
|
||||
|
||||
}
|
44
src/Reader/ReaderInterface.php
Normal file
44
src/Reader/ReaderInterface.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename ReaderInterface.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 14:58
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Reader;
|
||||
|
||||
|
||||
/**
|
||||
* 解析器需要使用到的读取类
|
||||
* @package JerryYan\DSL\Reader
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:37
|
||||
*/
|
||||
abstract class ReaderInterface
|
||||
{
|
||||
protected $currentLine = 0;
|
||||
protected $currentPosition = 0;
|
||||
protected $currentLinePosition = 0;
|
||||
#abstract public function getNextChar(): ?string;
|
||||
#abstract public function getCurrentToken(): ?string;
|
||||
#abstract public function getNextToken(): ?string;
|
||||
#abstract public function moveToNextToken(): ?string;
|
||||
|
||||
/**
|
||||
* 跳过当前行
|
||||
* @return bool
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:43
|
||||
*/
|
||||
#abstract public function skipCurrentLine(): bool;
|
||||
|
||||
/**
|
||||
* 从当前位置跳到结束位置
|
||||
* @param string $end
|
||||
* @return bool
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:43
|
||||
*/
|
||||
#abstract public function skipUntil(string $end="*/"): bool;
|
||||
}
|
15
src/Reader/StreamReader.php
Normal file
15
src/Reader/StreamReader.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename StreamReader.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 14:58
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Reader;
|
||||
|
||||
|
||||
class StreamReader extends ReaderInterface
|
||||
{
|
||||
|
||||
}
|
22
src/Token/Token.php
Normal file
22
src/Token/Token.php
Normal file
@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename Token.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 14:51
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Token;
|
||||
|
||||
|
||||
/**
|
||||
* Token实体分类Enum
|
||||
* @package JerryYan\DSL\Token
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:11
|
||||
*/
|
||||
final class Token
|
||||
{
|
||||
const AND = "And";
|
||||
const OR = "Or";
|
||||
}
|
15
src/Token/TokenAnd.php
Normal file
15
src/Token/TokenAnd.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename TokenAnd.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:20
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Token;
|
||||
|
||||
|
||||
class TokenAnd
|
||||
{
|
||||
|
||||
}
|
19
src/Token/TokenFactory.php
Normal file
19
src/Token/TokenFactory.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename TokenFactory.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 14:48
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Token;
|
||||
|
||||
|
||||
class TokenFactory
|
||||
{
|
||||
/** @var array<string, string> Token类型及映射类 */
|
||||
#private $tokenMap = [
|
||||
# Token::AND => TokenAnd::class,
|
||||
#];
|
||||
|
||||
}
|
15
src/Token/TokenInterface.php
Normal file
15
src/Token/TokenInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename TokenInterface.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 14:23
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Token;
|
||||
|
||||
|
||||
abstract class TokenInterface
|
||||
{
|
||||
|
||||
}
|
21
src/Token/TokenType.php
Normal file
21
src/Token/TokenType.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename TokenType.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:04
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Token;
|
||||
|
||||
|
||||
/**
|
||||
* Token分类Enum
|
||||
* @package JerryYan\DSL\Token
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:04
|
||||
*/
|
||||
final class TokenType
|
||||
{
|
||||
|
||||
}
|
15
src/Tokenizer/Tokenizer.php
Normal file
15
src/Tokenizer/Tokenizer.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename Tokenizer.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:22
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Tokenizer;
|
||||
|
||||
|
||||
class Tokenizer extends TokenizerInterface
|
||||
{
|
||||
|
||||
}
|
15
src/Tokenizer/TokenizerInterface.php
Normal file
15
src/Tokenizer/TokenizerInterface.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
/**
|
||||
* @filename TokenizerInterface.php
|
||||
* @author Jerry Yan <792602257@qq.com>
|
||||
* @date 2020/12/17 15:22
|
||||
*/
|
||||
|
||||
|
||||
namespace JerryYan\DSL\Tokenizer;
|
||||
|
||||
|
||||
abstract class TokenizerInterface
|
||||
{
|
||||
|
||||
}
|
Reference in New Issue
Block a user