File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 8
8
"""
9
9
10
10
from enum import Enum
11
- from typing import Dict
12
11
13
12
14
13
class CharType (Enum ):
@@ -29,7 +28,7 @@ class State(Enum):
29
28
EXP_NUMBER = "EXP_NUMBER"
30
29
31
30
32
- state_machine : Dict [State , Dict [CharType , State ]] = {
31
+ state_machine : dict [State , dict [CharType , State ]] = {
33
32
State .INITIAL : {
34
33
CharType .NUMERIC : State .WHOLE ,
35
34
CharType .SIGN : State .SIGNED ,
@@ -61,9 +60,11 @@ def classify_char(char: str) -> CharType | None:
61
60
62
61
- 'CharType.NUMERIC': if the character is a digit (0-9)
63
62
- 'CharType.SIGN': if the character is a plus sign (+) or a minus sign (-)
64
- - 'CharType.EXPONENT': if the character is an 'e' or 'E' (used in exponential notation)
63
+ - 'CharType.EXPONENT': if the character is an 'e' or 'E'
64
+ (used in exponential notation)
65
65
- 'CharType.DECIMAL': if the character is a decimal point (.)
66
- - None: if the character does not fit into any of the above categories or size of char is not 1
66
+ - None: if the character does not fit into any of the above categories
67
+ - None: if size of char is not 1
67
68
68
69
Parameters:
69
70
char (str): The character to be classified
You can’t perform that action at this time.
0 commit comments