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 return _STOP_; // stopping the state machine in any other case
} }
int getNextCharacter(char* src) { int getNextCharacter(char* pos) {
return _STOP_; // placeholder 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) { int readIdentifier(char* src) {
@@ -28,3 +31,17 @@ int readOperator(char* src) {
int readPunctuation(char* src) { int readPunctuation(char* src) {
return _STOP_; // placeholder 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
}
+1
View File
@@ -24,3 +24,4 @@ int readNumLit(char*);
int readOperator(char*); int readOperator(char*);
int readPunctuation(char*); int readPunctuation(char*);
int main(); int main();
int isLetter(char);