[DevState] Improved Parsing for AST Lib, Class, Func, Var, Call
This commit is contained in:
@@ -11,62 +11,63 @@ class Repo:
|
||||
# interpreter
|
||||
self.keywords = [
|
||||
# define keywords
|
||||
Keywords.Library,
|
||||
Keywords.Class,
|
||||
Keywords.Function,
|
||||
Keywords.Variable,
|
||||
Keywords.Use,
|
||||
Keywords.From,
|
||||
Keywords.Library.value,
|
||||
Keywords.Class.value,
|
||||
Keywords.Function.value,
|
||||
Keywords.Variable.value,
|
||||
Keywords.Use.value,
|
||||
Keywords.From.value,
|
||||
# builtin functions
|
||||
Keywords.Output,
|
||||
Keywords.Input,
|
||||
Keywords.Length,
|
||||
Keywords.Range,
|
||||
Keywords.Exit,
|
||||
Keywords.Output.value,
|
||||
Keywords.Input.value,
|
||||
Keywords.Length.value,
|
||||
Keywords.Range.value,
|
||||
Keywords.Exit.value,
|
||||
# normal keywords
|
||||
Keywords.If,
|
||||
Keywords.ElseIf,
|
||||
Keywords.Else,
|
||||
Keywords.Continue,
|
||||
Keywords.If,
|
||||
Keywords.Return,
|
||||
Keywords.If.value,
|
||||
Keywords.ElseIf.value,
|
||||
Keywords.Else.value,
|
||||
Keywords.Continue.value,
|
||||
Keywords.If.value,
|
||||
Keywords.Return.value,
|
||||
# loops
|
||||
Keywords.While,
|
||||
Keywords.For,
|
||||
Keywords.While.value,
|
||||
Keywords.For.value,
|
||||
# access
|
||||
Keywords.Public
|
||||
Keywords.Public.value,
|
||||
Keywords.This.value
|
||||
]
|
||||
self.datatypes = [
|
||||
Datatypes.strings.value[Datatypes.Empty.value],
|
||||
Datatypes.strings.value[Datatypes.Any.value],
|
||||
Datatypes.strings.value[Datatypes.Number.value],
|
||||
Datatypes.strings.value[Datatypes.String.value],
|
||||
Datatypes.strings.value[Datatypes.Bool.value],
|
||||
Datatypes.strings.value[Datatypes.List.value],
|
||||
Datatypes.strings.value[Datatypes.Dict.value]
|
||||
Datatypes.Empty.value,
|
||||
Datatypes.Any.value,
|
||||
Datatypes.Number.value,
|
||||
Datatypes.String.value,
|
||||
Datatypes.Bool.value,
|
||||
Datatypes.List.value,
|
||||
Datatypes.Dict.value
|
||||
]
|
||||
self.format_chars = [
|
||||
FormatCharacters.chars.value[FormatCharacters.Left_Brace.value],
|
||||
FormatCharacters.chars.value[FormatCharacters.Right_Brace.value],
|
||||
FormatCharacters.chars.value[FormatCharacters.Left_Parenthesis.value],
|
||||
FormatCharacters.chars.value[FormatCharacters.Right_Parenthesis.value],
|
||||
FormatCharacters.chars.value[FormatCharacters.Left_Bracket.value],
|
||||
FormatCharacters.chars.value[FormatCharacters.Right_Bracket.value],
|
||||
FormatCharacters.chars.value[FormatCharacters.Semicolon.value],
|
||||
FormatCharacters.chars.value[FormatCharacters.Colon.value],
|
||||
FormatCharacters.chars.value[FormatCharacters.Comma.value],
|
||||
FormatCharacters.chars.value[FormatCharacters.Point.value]
|
||||
FormatCharacters.Left_Brace.value,
|
||||
FormatCharacters.Right_Brace.value,
|
||||
FormatCharacters.Left_Parenthesis.value,
|
||||
FormatCharacters.Right_Parenthesis.value,
|
||||
FormatCharacters.Left_Bracket.value,
|
||||
FormatCharacters.Right_Bracket.value,
|
||||
FormatCharacters.Semicolon.value,
|
||||
FormatCharacters.Colon.value,
|
||||
FormatCharacters.Comma.value,
|
||||
FormatCharacters.Point.value
|
||||
]
|
||||
self.expr_chars = [
|
||||
ExpressionCharacters.chars.value[ExpressionCharacters.Plus.value],
|
||||
ExpressionCharacters.chars.value[ExpressionCharacters.Minus.value],
|
||||
ExpressionCharacters.chars.value[ExpressionCharacters.Asterisk.value],
|
||||
ExpressionCharacters.chars.value[ExpressionCharacters.Slash.value],
|
||||
ExpressionCharacters.chars.value[ExpressionCharacters.Equal.value],
|
||||
ExpressionCharacters.chars.value[ExpressionCharacters.Caret.value]
|
||||
ExpressionCharacters.Plus.value,
|
||||
ExpressionCharacters.Minus.value,
|
||||
ExpressionCharacters.Asterisk.value,
|
||||
ExpressionCharacters.Slash.value,
|
||||
ExpressionCharacters.Equal.value,
|
||||
ExpressionCharacters.Caret.value
|
||||
]
|
||||
self.bool_expr_chars = ['<', '>', '!', '!=', '==', '>=', '<=', '&&', '||']
|
||||
self.bool_values = [Booleans.Right, Booleans.Wrong]
|
||||
self.bool_values = [Booleans.Right.value, Booleans.Wrong.value]
|
||||
|
||||
# runtime
|
||||
self.is_error = None
|
||||
|
Reference in New Issue
Block a user