[DevState] Added and tested with python sly
This commit is contained in:
67
src/Models/CCLang/TokenDefinition.py
Normal file
67
src/Models/CCLang/TokenDefinition.py
Normal 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'
|
0
src/Models/CCLang/__init__.py
Normal file
0
src/Models/CCLang/__init__.py
Normal 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'
|
||||
|
Reference in New Issue
Block a user