mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-01-20 09:17:23 +01:00
[apps] When renaming a function, check that the name is not reserved
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include "storage_function.h"
|
||||
#include <poincare/symbol.h>
|
||||
#include "poincare/src/parsing/parser.h"
|
||||
#include <string.h>
|
||||
#include <cmath>
|
||||
#include <assert.h>
|
||||
@@ -16,6 +17,8 @@ bool StorageFunction::BaseNameCompliant(const char * baseName) {
|
||||
return false;
|
||||
}
|
||||
const char * currentChar = baseName;
|
||||
|
||||
// The name should only have allowed characters
|
||||
while (*currentChar != 0) {
|
||||
if (!((*currentChar >= 'A' && *currentChar <= 'Z')
|
||||
|| (*currentChar >= 'a' && *currentChar <= 'z')
|
||||
@@ -25,6 +28,11 @@ bool StorageFunction::BaseNameCompliant(const char * baseName) {
|
||||
}
|
||||
currentChar++;
|
||||
}
|
||||
|
||||
// The name should not be a reserved name
|
||||
if (Parser::IsReservedName(baseName, strlen(baseName))) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user