Add plain stringFromSlice()

Doesn't try to ignore quote marks. objFromSlice() utilizes it, but should have the same behavior as before.
This commit is contained in:
Sage Vaillancourt 2020-11-02 15:55:55 -05:00
parent 963996f3a0
commit f8176fef4f
2 changed files with 7 additions and 1 deletions

View File

@ -668,7 +668,12 @@ inline Object boolObject(int b)
// Skips first and last chars! Assumed to be '"'
inline Object objFromSlice(const char *string, int len)
{
Object o = symFromSlice(&string[1], len - 1);
return stringFromSlice(&string[1], len - 1);
}
inline Object stringFromSlice(const char *string, int len)
{
Object o = symFromSlice(string, len);
o.type = TYPE_STRING;
return o;
}

View File

@ -124,6 +124,7 @@ Object newObject(Type type);
Object listObject();
Object startList(const Object start);
Object objFromSlice(const char *string, int len);
Object stringFromSlice(const char *string, int len);
Object symFromSlice(const char *string, int len);
Object boolObject(int b);
Object numberObject(int num);