diff --git a/src/tokens.cpp b/src/tokens.cpp index b9535ff..6cb4eb2 100644 --- a/src/tokens.cpp +++ b/src/tokens.cpp @@ -159,13 +159,13 @@ namespace token { i++; // Skip second " tokens.push_back(token::Token{ token::Type::LiteralStr, content, meta + (content.size() + 2) }); } - else if (std::isalpha(c)) { + else if (std::isalpha(c) || c == '_') { std::string content{}; do { content += c; if ((i + 1) >= text_length) break; c = text[++i]; - } while (std::isalnum(c)); + } while (std::isalnum(c) || c == '_'); token::Type type = token::Type::Ident; if (content == "return") { diff --git a/test.c b/test.c index 8ad90e2..7d3bb52 100644 --- a/test.c +++ b/test.c @@ -6,13 +6,13 @@ int fibonacci(int n) { return fibonacci(n - 1) + fibonacci(n - 2); } -void modifyvalue(char* otus) { +void modify_value(char* otus) { *otus = 20; } int main() { printf("10th fibonacci number is %d!", fibonacci(10)); char res = 10; - modifyvalue(&res); + modify_value(&res); return res; } \ No newline at end of file