[DevState] Added and tested with python sly

This commit is contained in:
Sven Heidemann
2020-09-24 20:44:16 +02:00
parent fa2a42dcc8
commit c537a95043
14 changed files with 521 additions and 20 deletions

View File

@@ -0,0 +1,67 @@
from enum import Enum
class TokenDefinition(Enum):
""" Keywords """
# define keywords
Library = r'lib'
Class = r'class'
Function = r'func'
Variable = r'var'
Use = r'use'
From = r'from'
# builtin functions
Output = r'output'
Input = r'input'
Length = r'length'
Range = r'range'
Exit = r'exit'
# normal keywords
If = r'if'
ElseIf = r'elseif'
Else = r'else'
Continue = r'continue'
In = r'in'
Return = r'return'
# loops
While = r'while'
For = r'for'
# access
Public = r'public'
This = r'this'
""" Chars """
# format
Left_Brace = r'\{'
Right_Brace = r'\}'
Left_Parenthesis = r'\('
Right_Parenthesis = r'\)'
Left_Bracket = r'\['
Right_Bracket = r'\]'
Semicolon = r'\;'
Colon = r'\:'
Comma = r'\,'
Point = r'\.'
# expr
Plus = r'\+'
Minus = r'\-'
Asterisk = r'\*'
Slash = r'\/'
Equal = r'\='
Caret = r'\^'
""" Values """
# bool
BoolTrue = r'true'
BoolFalse = r'false'
Name = r'[a-zA-Z_][a-zA-Z0-9_]*'
String = r'\".*?\"'
Number = r'\d+'
""" Datatypes """
Empty = r'empty'

View File

View File

@@ -4,6 +4,7 @@ from enum import Enum
class ErrorCodes(Enum):
StartFailed = 'Start failed'
FileNotFound = 'File not found'
WrongFileType = 'Wrong file type'
Unknown = 'Unknown {}'
Inaccessible = '{} inaccessible'