More work on getting parsing to be functional
This commit is contained in:
@@ -1,20 +1,21 @@
|
||||
// AUTOGENERATED COPYRIGHT HEADER START
|
||||
// Copyright (C) 2017-2024 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
||||
// Copyright (C) 2017-2025 Michael Fabian 'Xaymar' Dirks <info@xaymar.com>
|
||||
// AUTOGENERATED COPYRIGHT HEADER END
|
||||
#include <clocale>
|
||||
#include <iostream>
|
||||
#include "compiler.hpp"
|
||||
#include "error.hpp"
|
||||
#include "lexer.hpp"
|
||||
#include "parser.hpp"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::setlocale(LC_ALL, "en_US.UTF-8");
|
||||
|
||||
std::cout << argv[1] << std::endl;
|
||||
blitz::lexer lex(argv[1]);
|
||||
|
||||
try {
|
||||
std::setlocale(LC_ALL, "en_US.UTF-8");
|
||||
|
||||
std::cout << argv[1] << std::endl;
|
||||
|
||||
blitz::lexer lex(argv[1]);
|
||||
for (blitz::token token = lex.next(); (token.type != blitz::token::variant::ENDOFFILE); token = lex.next()) {
|
||||
switch (token.type) {
|
||||
case blitz::token::variant::COMMENT:
|
||||
@@ -44,15 +45,19 @@ int main(int argc, char** argv)
|
||||
std::cin.get();
|
||||
}
|
||||
}
|
||||
|
||||
blitz::parser pars(argv[1]);
|
||||
|
||||
//std::cin.get();
|
||||
return 0;
|
||||
} catch (blitz::error const& ex) {
|
||||
std::cout << ex.file() << std::endl;
|
||||
std::cout << "Line " << ex.at().first << ", Char " << ex.at().second << ": " << ex.what() << std::endl;
|
||||
return 1;
|
||||
} catch (std::runtime_error const& ex) {
|
||||
std::cout << ex.what() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
//std::cin.get();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// BlitzBasic is a strange but powerful language in the right hands. While it has
|
||||
@@ -79,6 +84,7 @@ int main(int argc, char** argv)
|
||||
//
|
||||
// 3. Function calls don't always need Parenthesis:
|
||||
// ```
|
||||
// Local myName
|
||||
// Function myName() : End Function
|
||||
// If myName() Then : EndIf ; <- Calls myName
|
||||
// myName ; <- Calls myName, because there is no = after it.
|
||||
|
||||
Reference in New Issue
Block a user