mirror of
https://github.com/open-goal/jak-project
synced 2026-09-03 10:21:36 -04:00
Merge branch 'windows-nodeci-before-merge' into windows-nodeci
This commit is contained in:
+24
-22
@@ -66,6 +66,10 @@ void TextStream::seek_past_whitespace_and_comments() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reader::~Reader() {
|
||||||
|
printf("destroying reader\n");
|
||||||
|
}
|
||||||
|
|
||||||
Reader::Reader() {
|
Reader::Reader() {
|
||||||
// third-party library used for a fancy line in
|
// third-party library used for a fancy line in
|
||||||
linenoise::SetHistoryMaxLen(400);
|
linenoise::SetHistoryMaxLen(400);
|
||||||
@@ -76,27 +80,18 @@ Reader::Reader() {
|
|||||||
add_reader_macro(",", "unquote");
|
add_reader_macro(",", "unquote");
|
||||||
add_reader_macro(",@", "unquote-splicing");
|
add_reader_macro(",@", "unquote-splicing");
|
||||||
|
|
||||||
// setup table of which characters are valid for starting a symbol
|
uint8_t valid[256] = {
|
||||||
for (auto& x : valid_symbols_chars) {
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
x = false;
|
0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
}
|
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
|
1, 1, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||||
for (char x = 'a'; x <= 'z'; x++) {
|
1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
valid_symbols_chars[(int)x] = true;
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
}
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||||
for (char x = 'A'; x <= 'Z'; x++) {
|
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
|
||||||
valid_symbols_chars[(int)x] = true;
|
for (int i = 0; i < 256; i++) {
|
||||||
}
|
valid_symbols_chars[i] = valid[i];
|
||||||
|
|
||||||
for (char x = '0'; x <= '9'; x++) {
|
|
||||||
valid_symbols_chars[(int)x] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char bonus[] = "!$%&*+-/\\.,@^_-;:<>?~=#";
|
|
||||||
|
|
||||||
for (const char* c = bonus; *c; c++) {
|
|
||||||
valid_symbols_chars[(int)*c] = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// find the source directory
|
// find the source directory
|
||||||
@@ -639,6 +634,7 @@ bool Reader::try_token_as_hex(const Token& tok, Object& obj) {
|
|||||||
* 64-bit signed. Won't accept values between INT64_MAX and UINT64_MAX.
|
* 64-bit signed. Won't accept values between INT64_MAX and UINT64_MAX.
|
||||||
*/
|
*/
|
||||||
bool Reader::try_token_as_integer(const Token& tok, Object& obj) {
|
bool Reader::try_token_as_integer(const Token& tok, Object& obj) {
|
||||||
|
printf("try token as integer %ld %s\n", tok.text.size(), tok.text.c_str());
|
||||||
if (decimal_start(tok.text[0]) && !str_contains(tok.text, '.')) {
|
if (decimal_start(tok.text[0]) && !str_contains(tok.text, '.')) {
|
||||||
// determine if we look like a number or not. If we look like a number, but stoll fails,
|
// determine if we look like a number or not. If we look like a number, but stoll fails,
|
||||||
// it means that the number is too big or too small, and we should error
|
// it means that the number is too big or too small, and we should error
|
||||||
@@ -653,12 +649,17 @@ bool Reader::try_token_as_integer(const Token& tok, Object& obj) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("going to try stoll...\n");
|
||||||
uint64_t v = 0;
|
uint64_t v = 0;
|
||||||
try {
|
try {
|
||||||
std::size_t end = 0;
|
std::size_t end = 0;
|
||||||
v = std::stoll(tok.text, &end);
|
v = std::stoll(tok.text, &end);
|
||||||
if (end != tok.text.size())
|
printf("stoll didn't throw, got %ld\n", v);
|
||||||
|
if (end != tok.text.size()) {
|
||||||
|
printf("didn't read whole thing\n");
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
printf("returning object!\n");
|
||||||
obj = Object::make_integer(v);
|
obj = Object::make_integer(v);
|
||||||
return true;
|
return true;
|
||||||
} catch (std::exception& e) {
|
} catch (std::exception& e) {
|
||||||
@@ -666,6 +667,7 @@ bool Reader::try_token_as_integer(const Token& tok, Object& obj) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Reader::try_token_as_char(const Token& tok, Object& obj) {
|
bool Reader::try_token_as_char(const Token& tok, Object& obj) {
|
||||||
|
|||||||
@@ -68,6 +68,7 @@ struct Token {
|
|||||||
class Reader {
|
class Reader {
|
||||||
public:
|
public:
|
||||||
Reader();
|
Reader();
|
||||||
|
~Reader();
|
||||||
Object read_from_string(const std::string& str);
|
Object read_from_string(const std::string& str);
|
||||||
Object read_from_stdin(const std::string& prompt_name);
|
Object read_from_stdin(const std::string& prompt_name);
|
||||||
Object read_from_file(const std::string& filename);
|
Object read_from_file(const std::string& filename);
|
||||||
|
|||||||
+4
-4
@@ -6,10 +6,10 @@ add_executable(goalc-test
|
|||||||
test_reader.cpp
|
test_reader.cpp
|
||||||
test_goos.cpp
|
test_goos.cpp
|
||||||
test_listener_deci2.cpp
|
test_listener_deci2.cpp
|
||||||
all_jak1_symbols.cpp
|
all_jak1_symbols.cpp
|
||||||
test_kernel.cpp
|
#test_kernel.cpp
|
||||||
test_CodeTester.cpp
|
#test_CodeTester.cpp
|
||||||
test_type_system.cpp
|
#test_type_system.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
IF (WIN32)
|
IF (WIN32)
|
||||||
|
|||||||
Reference in New Issue
Block a user