c4189fd1b2
add: 词法分析器剩下数字、标识符的细节处理以及错误处理 Co-authored-by: duqoo <92306417+duqoo@users.noreply.github.com> Reviewed-on: PostGuard/Canon#15 Co-authored-by: Huaps <1183155719@qq.com> Co-committed-by: Huaps <1183155719@qq.com>
106 lines
1.3 KiB
C#
106 lines
1.3 KiB
C#
namespace Canon.Core.Enums;
|
|
|
|
public enum SemanticTokenType
|
|
{
|
|
Keyword,
|
|
Number,
|
|
Operator,
|
|
Delimiter,
|
|
Identifier,
|
|
Character,
|
|
Empty,
|
|
Error, // 加了一个错误token
|
|
/// <summary>
|
|
/// 语法分析中的栈底符号
|
|
/// </summary>
|
|
End
|
|
}
|
|
|
|
public enum DelimiterType
|
|
{
|
|
Comma,
|
|
Period,
|
|
Colon,
|
|
Semicolon,
|
|
LeftParenthesis,
|
|
RightParenthesis,
|
|
LeftSquareBracket,
|
|
RightSquareBracket,
|
|
SingleQuotation,
|
|
DoubleQuotation,
|
|
/// <summary>
|
|
/// 访问记录字段用的点 x.a
|
|
/// </summary>
|
|
Dot,
|
|
/// <summary>
|
|
/// 数组声明上下界之间的分隔符 1..50
|
|
/// </summary>
|
|
DoubleDots
|
|
}
|
|
|
|
public enum KeywordType
|
|
{
|
|
Program,
|
|
Const,
|
|
Var,
|
|
Procedure,
|
|
Function,
|
|
Begin,
|
|
End,
|
|
Array,
|
|
Of,
|
|
If,
|
|
Then,
|
|
Else,
|
|
For,
|
|
To,
|
|
Do,
|
|
Integer,
|
|
Real,
|
|
Boolean,
|
|
Character,
|
|
Divide,
|
|
Not,
|
|
Mod,
|
|
And,
|
|
Or
|
|
}
|
|
|
|
public enum OperatorType
|
|
{
|
|
Equal,
|
|
NotEqual,
|
|
Less,
|
|
LessEqual,
|
|
Greater,
|
|
GreaterEqual,
|
|
Plus,
|
|
Minus,
|
|
Multiply,
|
|
Divide,
|
|
Assign
|
|
}
|
|
|
|
public enum NumberType
|
|
{
|
|
Integer,
|
|
Real,
|
|
Hex
|
|
}
|
|
|
|
public enum StateType
|
|
{
|
|
Word,
|
|
Digit,
|
|
Delimiter,
|
|
Operator
|
|
}
|
|
|
|
public enum BasicIdType
|
|
{
|
|
Int,
|
|
Real,
|
|
Char,
|
|
Bool
|
|
}
|