mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:47:34 +00:00
AK: Remove the ctype adapters and use the actual ctype functions instead
This finally takes care of the kind-of excessive boilerplate code that were the ctype adapters. On the other hand, I had to link `LibC/ctype.cpp` to the Kernel (for `AK/JsonParser.cpp` and `AK/Format.cpp`). The previous commit actually makes sense now: the `string.h` includes in `ctype.{h,cpp}` would require to link more LibC stuff to the Kernel when it only needs the `_ctype_` array of `ctype.cpp`, and there wasn't any string stuff used in ctype. Instead of all this I could have put static derivatives of `is_any_of()` in the concerned AK files, however that would have meant more boilerplate and workarounds; so I went for the Kernel approach.
This commit is contained in:
parent
f158cb27ea
commit
f0f6b09acb
8 changed files with 33 additions and 125 deletions
|
@ -34,6 +34,7 @@
|
|||
#include <LibCore/File.h>
|
||||
#include <LibJS/Parser.h>
|
||||
#include <LibJS/Runtime/Function.h>
|
||||
#include <ctype.h>
|
||||
|
||||
namespace Spreadsheet {
|
||||
|
||||
|
@ -192,8 +193,8 @@ Cell* Sheet::at(const Position& position)
|
|||
Optional<Position> Sheet::parse_cell_name(const StringView& name)
|
||||
{
|
||||
GenericLexer lexer(name);
|
||||
auto col = lexer.consume_while([](auto c) { return is_alpha(c); });
|
||||
auto row = lexer.consume_while([](auto c) { return is_alphanum(c) && !is_alpha(c); });
|
||||
auto col = lexer.consume_while(isalpha);
|
||||
auto row = lexer.consume_while(isdigit);
|
||||
|
||||
if (!lexer.is_eof() || row.is_empty() || col.is_empty())
|
||||
return {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue