getNextCharacter

This commit is contained in:
SinusFox
2023-05-15 15:27:23 +02:00
parent ab399b12fa
commit 73510cb48f
2 changed files with 20 additions and 2 deletions
+19 -2
View File
@@ -9,8 +9,11 @@ int start(char* src) {
return _STOP_; // stopping the state machine in any other case
}
int getNextCharacter(char* src) {
return _STOP_; // placeholder
int getNextCharacter(char* pos) {
if (isLetter(*pos)) {
return _READ_IDENTIFIER_; // continues to read the identifier
}
return _STOP_; // stopping the state machine in any other case
}
int readIdentifier(char* src) {
@@ -28,3 +31,17 @@ int readOperator(char* src) {
int readPunctuation(char* src) {
return _STOP_; // placeholder
}
int isLetter(char in) {
if (in >= 'A') { // capital letters
if (in <= 'Z') {
return 1;
}
}
if (in >= 'a') { // non-capital letters
if (in <= 'z') {
return 1;
}
}
return 0; // returning 0 if it's no letter
}