error with assignments and functions fixed, todo expressions
This commit is contained in:
parent
b9494b0803
commit
d69c24f4fd
18
DMS/DMS.cpp
18
DMS/DMS.cpp
@ -1,23 +1,5 @@
|
|||||||
// DMS.cpp : This file contains the 'main' function. Program execution begins and ends there.
|
|
||||||
//
|
|
||||||
|
|
||||||
#include <iostream>
|
|
||||||
//#include <string>
|
|
||||||
//#include <exception>
|
|
||||||
#include "value.h"
|
|
||||||
#include "codes.h"
|
|
||||||
#include "cmd.h"
|
|
||||||
#include "dms_exceptions.h"
|
|
||||||
#include "errors.h"
|
|
||||||
#include "utils.h"
|
|
||||||
#include "number_utils.h"
|
|
||||||
#include "string_utils.h"
|
|
||||||
#include "LineParser.h"
|
|
||||||
#include "dms.h"
|
#include "dms.h"
|
||||||
#include "chunk.h"
|
|
||||||
#include "token.h"
|
|
||||||
using namespace dms;
|
using namespace dms;
|
||||||
using namespace dms::utils;
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
LineParser parser = LineParser("test.dms");
|
LineParser parser = LineParser("test.dms");
|
||||||
|
|||||||
@ -162,7 +162,6 @@
|
|||||||
<ClInclude Include="cmd.h" />
|
<ClInclude Include="cmd.h" />
|
||||||
<ClInclude Include="codes.h" />
|
<ClInclude Include="codes.h" />
|
||||||
<ClInclude Include="dms_state.h" />
|
<ClInclude Include="dms_state.h" />
|
||||||
<ClInclude Include="Scope.h" />
|
|
||||||
<ClInclude Include="string_utils.h" />
|
<ClInclude Include="string_utils.h" />
|
||||||
<ClInclude Include="dms_exceptions.h" />
|
<ClInclude Include="dms_exceptions.h" />
|
||||||
<ClInclude Include="errors.h" />
|
<ClInclude Include="errors.h" />
|
||||||
|
|||||||
@ -104,8 +104,5 @@
|
|||||||
<ClInclude Include="token.h">
|
<ClInclude Include="token.h">
|
||||||
<Filter>Header Files\DMS</Filter>
|
<Filter>Header Files\DMS</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="Scope.h">
|
|
||||||
<Filter>Header Files\DMS</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,16 +6,14 @@
|
|||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <stack>
|
||||||
#include "codes.h"
|
#include "codes.h"
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
#include "dms_state.h"
|
#include "dms_state.h"
|
||||||
#include "chunk.h"
|
#include "chunk.h"
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "Scope.h"
|
|
||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
#include <stack>
|
|
||||||
|
|
||||||
|
|
||||||
namespace dms {
|
namespace dms {
|
||||||
struct tokenstream {
|
struct tokenstream {
|
||||||
@ -52,7 +50,6 @@ namespace dms {
|
|||||||
chunk* current_chunk = nullptr;
|
chunk* current_chunk = nullptr;
|
||||||
std::string chunk_name;
|
std::string chunk_name;
|
||||||
blocktype chunk_type = bt_block;
|
blocktype chunk_type = bt_block;
|
||||||
std::stack<scope> scopes;
|
|
||||||
size_t line = 1;
|
size_t line = 1;
|
||||||
std::vector<tokens::token> temp;
|
std::vector<tokens::token> temp;
|
||||||
std::vector<tokens::token> tdump;
|
std::vector<tokens::token> tdump;
|
||||||
@ -61,6 +58,7 @@ namespace dms {
|
|||||||
dms_state* state = nullptr;
|
dms_state* state = nullptr;
|
||||||
void doCheck(passer* stream, std::vector<tokens::token>* t_vec, size_t line, bool& isNum, bool& hasDec, std::vector<uint8_t>* buffer);
|
void doCheck(passer* stream, std::vector<tokens::token>* t_vec, size_t line, bool& isNum, bool& hasDec, std::vector<uint8_t>* buffer);
|
||||||
void _Parse(tokenstream* stream);
|
void _Parse(tokenstream* stream);
|
||||||
|
std::stack<std::string> lastCall;
|
||||||
// Match Process Code
|
// Match Process Code
|
||||||
bool match_process_debug(tokenstream* stream);
|
bool match_process_debug(tokenstream* stream);
|
||||||
bool match_process_disp(tokenstream* stream);
|
bool match_process_disp(tokenstream* stream);
|
||||||
|
|||||||
@ -9,6 +9,7 @@ namespace dms {
|
|||||||
|
|
||||||
Compound DISP
|
Compound DISP
|
||||||
*/
|
*/
|
||||||
|
lastCall.push("MP_disp");
|
||||||
if ((isBlock(bt_block) || isBlock(bt_method)) && stream->match(tokens::newline, tokens::string, tokens::newline)) {
|
if ((isBlock(bt_block) || isBlock(bt_method)) && stream->match(tokens::newline, tokens::string, tokens::newline)) {
|
||||||
stream->next(); // Standard consumption
|
stream->next(); // Standard consumption
|
||||||
std::string msg = stream->next().name;
|
std::string msg = stream->next().name;
|
||||||
@ -17,6 +18,7 @@ namespace dms {
|
|||||||
c->args.push(buildValue());
|
c->args.push(buildValue());
|
||||||
c->args.push(buildValue(msg));
|
c->args.push(buildValue(msg));
|
||||||
current_chunk->addCmd(c); // Add the cmd to the current chunk
|
current_chunk->addCmd(c); // Add the cmd to the current chunk
|
||||||
|
lastCall.pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((isBlock(bt_block) || isBlock(bt_method)) && stream->match(tokens::newline, tokens::name, tokens::colon, tokens::string, tokens::newline)) {
|
else if ((isBlock(bt_block) || isBlock(bt_method)) && stream->match(tokens::newline, tokens::name, tokens::colon, tokens::string, tokens::newline)) {
|
||||||
@ -32,6 +34,7 @@ namespace dms {
|
|||||||
c->args.push(buildValue(msg));
|
c->args.push(buildValue(msg));
|
||||||
current_chunk->addCmd(c); // Add the cmd to the current chunk
|
current_chunk->addCmd(c); // Add the cmd to the current chunk
|
||||||
// We might have to consume a newline... Depends on what's next
|
// We might have to consume a newline... Depends on what's next
|
||||||
|
lastCall.pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if ((isBlock(bt_block) || isBlock(bt_method)) && stream->match(tokens::name,tokens::colon,tokens::cbracketo)) {
|
else if ((isBlock(bt_block) || isBlock(bt_method)) && stream->match(tokens::name,tokens::colon,tokens::cbracketo)) {
|
||||||
@ -78,8 +81,10 @@ namespace dms {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
badSymbol(stream);
|
badSymbol(stream);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if (stream->match(tokens::string)) {
|
else if (stream->match(tokens::string)) {
|
||||||
cmd* c = new cmd;
|
cmd* c = new cmd;
|
||||||
@ -92,53 +97,73 @@ namespace dms {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
badSymbol(stream);
|
badSymbol(stream);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// emotion: "path"
|
// emotion: "path"
|
||||||
// looks like a simple disp command
|
// looks like a simple disp command
|
||||||
else if (isBlock(bt_character) && stream->match(tokens::tab, tokens::name, tokens::colon, tokens::string, tokens::newline)) {
|
else if (isBlock(bt_character) && stream->match(tokens::tab, tokens::name, tokens::colon, tokens::string, tokens::newline)) {
|
||||||
|
lastCall.pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: We still have to implement the compound disp
|
// TODO: We still have to implement the compound disp
|
||||||
|
lastCall.pop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool LineParser::match_process_assignment(tokenstream* stream) {
|
bool LineParser::match_process_assignment(tokenstream* stream) {
|
||||||
// something equals something else lets go
|
// something equals something else lets go
|
||||||
|
lastCall.push("MP_assignment");
|
||||||
if (stream->match(tokens::name,tokens::equal)) {
|
if (stream->match(tokens::name,tokens::equal)) {
|
||||||
value* var = buildVariable(stream->next().name); // The variable that we will be setting stuff to
|
value* var = buildVariable(stream->next().name); // The variable that we will be setting stuff to
|
||||||
stream->next(); // Consume the equal
|
stream->next(); // Consume the equal
|
||||||
cmd* c = new cmd;
|
cmd* c = new cmd;
|
||||||
c->opcode = codes::ASGN;
|
c->opcode = codes::ASGN;
|
||||||
c->args.push(var);
|
c->args.push(var);
|
||||||
if (stream->match(tokens::True)) {
|
if (match_process_expression(stream, var)) {
|
||||||
|
// Expressions can internally set variables
|
||||||
|
// We actually need to clean up our cmds
|
||||||
|
lastCall.pop();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (match_process_function(stream, var)) {
|
||||||
|
// Functions can internally set variables
|
||||||
|
// We actually need to clean up our cmds
|
||||||
|
lastCall.pop();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (stream->match(tokens::True)) {
|
||||||
stream->next();
|
stream->next();
|
||||||
c->args.push(buildValue(true));
|
c->args.push(buildValue(true));
|
||||||
current_chunk->addCmd(c);
|
current_chunk->addCmd(c);
|
||||||
|
lastCall.pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (stream->match(tokens::False)) {
|
else if (stream->match(tokens::False)) {
|
||||||
stream->next();
|
stream->next();
|
||||||
c->args.push(buildValue(false));
|
c->args.push(buildValue(false));
|
||||||
current_chunk->addCmd(c);
|
current_chunk->addCmd(c);
|
||||||
|
lastCall.pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (stream->match(tokens::string)) {
|
else if (stream->match(tokens::string)) {
|
||||||
c->args.push(buildValue(stream->next().name));
|
c->args.push(buildValue(stream->next().name));
|
||||||
current_chunk->addCmd(c);
|
current_chunk->addCmd(c);
|
||||||
|
lastCall.pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (stream->match(tokens::nil)) {
|
else if (stream->match(tokens::nil)) {
|
||||||
stream->next();
|
stream->next();
|
||||||
c->args.push(buildValue());
|
c->args.push(buildValue());
|
||||||
current_chunk->addCmd(c);
|
current_chunk->addCmd(c);
|
||||||
|
lastCall.pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (stream->match(tokens::number)) {
|
else if (stream->match(tokens::number)) {
|
||||||
c->args.push(buildValue(std::stod(stream->next().name)));
|
c->args.push(buildValue(std::stod(stream->next().name)));
|
||||||
current_chunk->addCmd(c);
|
current_chunk->addCmd(c);
|
||||||
|
lastCall.pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (stream->match(tokens::bracketo, tokens::name, tokens::bracketc)) {
|
else if (stream->match(tokens::bracketo, tokens::name, tokens::bracketc)) {
|
||||||
@ -147,28 +172,20 @@ namespace dms {
|
|||||||
c->args.push(buildBlock(stream->next().name));
|
c->args.push(buildBlock(stream->next().name));
|
||||||
current_chunk->addCmd(c);
|
current_chunk->addCmd(c);
|
||||||
stream->next();
|
stream->next();
|
||||||
return true;
|
lastCall.pop();
|
||||||
}
|
|
||||||
else if (match_process_expression(stream,var)) {
|
|
||||||
// Expressions can internally set variables
|
|
||||||
// We actually need to clean up our cmds
|
|
||||||
current_chunk->cmds.pop_back();
|
|
||||||
delete c;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (match_process_function(stream,var)) {
|
|
||||||
// Functions can internally set variables
|
|
||||||
// We actually need to clean up our cmds
|
|
||||||
current_chunk->cmds.pop_back();
|
|
||||||
delete c;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (stream->match(tokens::name)) {
|
else if (stream->match(tokens::name)) {
|
||||||
c->args.push(buildVariable(stream->next().name));
|
c->args.push(buildVariable(stream->next().name));
|
||||||
current_chunk->addCmd(c);
|
current_chunk->addCmd(c);
|
||||||
|
lastCall.pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if (stream->match(tokens::newline)) {
|
||||||
|
stream->next();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
lastCall.pop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool LineParser::match_process_debug(tokenstream* stream) {
|
bool LineParser::match_process_debug(tokenstream* stream) {
|
||||||
@ -195,6 +212,7 @@ namespace dms {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool LineParser::match_process_choice(tokenstream* stream) {
|
bool LineParser::match_process_choice(tokenstream* stream) {
|
||||||
|
lastCall.push("MP_choice");
|
||||||
token temp = stream->peek();
|
token temp = stream->peek();
|
||||||
if (temp.raw == codes::CHOI && stream->match(tokens::control,tokens::string)) {
|
if (temp.raw == codes::CHOI && stream->match(tokens::control,tokens::string)) {
|
||||||
// Let's parse choice blocks.
|
// Let's parse choice blocks.
|
||||||
@ -284,8 +302,10 @@ namespace dms {
|
|||||||
delete cc;
|
delete cc;
|
||||||
if (hasfunc)
|
if (hasfunc)
|
||||||
buildLabel(str);
|
buildLabel(str);
|
||||||
|
lastCall.pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
lastCall.pop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,6 +314,7 @@ namespace dms {
|
|||||||
delete[] v; // We didn't need it, lets clean it up!
|
delete[] v; // We didn't need it, lets clean it up!
|
||||||
}
|
}
|
||||||
bool LineParser::match_process_function(tokenstream* stream, value* v, bool nested) {
|
bool LineParser::match_process_function(tokenstream* stream, value* v, bool nested) {
|
||||||
|
lastCall.push("MP_function");
|
||||||
/*
|
/*
|
||||||
Functions should be able to handle function calls as arguments,
|
Functions should be able to handle function calls as arguments,
|
||||||
HOWEVER functions cannot be passed as values since they aren't values like they are in other languages!
|
HOWEVER functions cannot be passed as values since they aren't values like they are in other languages!
|
||||||
@ -372,6 +393,7 @@ namespace dms {
|
|||||||
else if (tempstream.match(tokens::number)) {
|
else if (tempstream.match(tokens::number)) {
|
||||||
cleanup(tempval);
|
cleanup(tempval);
|
||||||
std::string str = tempstream.next().name;
|
std::string str = tempstream.next().name;
|
||||||
|
print(str);
|
||||||
tempval = buildValue(std::stod(str)); // Get the number and convert it to a double then build a value
|
tempval = buildValue(std::stod(str)); // Get the number and convert it to a double then build a value
|
||||||
c->args.push(tempval); // add this argument to the function opcodes
|
c->args.push(tempval); // add this argument to the function opcodes
|
||||||
}
|
}
|
||||||
@ -410,6 +432,7 @@ namespace dms {
|
|||||||
cleanup(tempval);
|
cleanup(tempval);
|
||||||
tempstream.next();
|
tempstream.next();
|
||||||
current_chunk->addCmd(c); // We push this onto the chunk after all dependants if any have been handled
|
current_chunk->addCmd(c); // We push this onto the chunk after all dependants if any have been handled
|
||||||
|
lastCall.pop();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -418,6 +441,7 @@ namespace dms {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
lastCall.pop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
bool LineParser::match_process_goto(tokenstream* stream) {
|
bool LineParser::match_process_goto(tokenstream* stream) {
|
||||||
@ -470,7 +494,7 @@ namespace dms {
|
|||||||
return false; // TODO finish this
|
return false; // TODO finish this
|
||||||
}
|
}
|
||||||
bool LineParser::match_process_expression(tokenstream* stream, value* v) {
|
bool LineParser::match_process_expression(tokenstream* stream, value* v) {
|
||||||
return false; // Method isn't done yet, we will get an error without this!
|
return false;
|
||||||
// I will have to consume for this to work so we need to keep track of what was incase we return false!
|
// I will have to consume for this to work so we need to keep track of what was incase we return false!
|
||||||
size_t start_pos = stream->pos;
|
size_t start_pos = stream->pos;
|
||||||
// It has to start with one of these 3 to even be considered an expression
|
// It has to start with one of these 3 to even be considered an expression
|
||||||
@ -488,24 +512,6 @@ namespace dms {
|
|||||||
* MOD val v1 v2
|
* MOD val v1 v2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* lua code which was actually really compact and works!
|
|
||||||
if not expr:match("[/%^%+%-%*%%]") then --[[print("No math to do!")]] return expr end
|
|
||||||
-- handle pharanses
|
|
||||||
expr=expr:gsub("([%W])(%-%d)",function(b,a)
|
|
||||||
return b.."(0-"..a:match("%d+")..")"
|
|
||||||
end)
|
|
||||||
-- Work on functions
|
|
||||||
expr = expr:gsub("([_%w]+)(%b())",function(func,args)
|
|
||||||
local v = gen("$")
|
|
||||||
local fnwr = {self.current_line[1],self.current_line[2],FWNR,self.current_line[4],v.." = "..func..args}
|
|
||||||
self:parseFNWR(fnwr)
|
|
||||||
return v
|
|
||||||
end)
|
|
||||||
expr = expr:gsub("(%b())",function(a)
|
|
||||||
return self:parseExpr(a:sub(2,-2))
|
|
||||||
end)
|
|
||||||
return self:chop(expr)
|
|
||||||
*/
|
|
||||||
token left; // lefthand
|
token left; // lefthand
|
||||||
token op; // opperator
|
token op; // opperator
|
||||||
token right; // righthand
|
token right; // righthand
|
||||||
@ -513,7 +519,8 @@ namespace dms {
|
|||||||
if (t.type == tokens::parao) {
|
if (t.type == tokens::parao) {
|
||||||
tokenstream temp;
|
tokenstream temp;
|
||||||
temp.init(&(stream->next(tokens::parao, tokens::parac))); // Balanced match!
|
temp.init(&(stream->next(tokens::parao, tokens::parac))); // Balanced match!
|
||||||
return match_process_expression(&temp,buildVariable("Work On This")); // Return true is everything else checks out!
|
value* tmpvalue = buildVariable();
|
||||||
|
match_process_expression(&temp,tmpvalue);
|
||||||
}
|
}
|
||||||
// We have a number
|
// We have a number
|
||||||
else if (t.type == tokens::number) {
|
else if (t.type == tokens::number) {
|
||||||
|
|||||||
@ -1,6 +1,11 @@
|
|||||||
#include "LineParser.h"
|
#include "LineParser.h"
|
||||||
using namespace dms::tokens;
|
using namespace dms::tokens;
|
||||||
using namespace dms::utils;
|
using namespace dms::utils;
|
||||||
|
bool is_file_exist(const char* fileName)
|
||||||
|
{
|
||||||
|
std::ifstream infile(fileName);
|
||||||
|
return infile.good();
|
||||||
|
}
|
||||||
namespace dms {
|
namespace dms {
|
||||||
dms_state* dms::LineParser::Parse() {
|
dms_state* dms::LineParser::Parse() {
|
||||||
if (fn == "") {
|
if (fn == "") {
|
||||||
@ -10,6 +15,7 @@ namespace dms {
|
|||||||
return Parse(fn);
|
return Parse(fn);
|
||||||
}
|
}
|
||||||
dms_state* dms::LineParser::Parse(std::string file) {
|
dms_state* dms::LineParser::Parse(std::string file) {
|
||||||
|
std::remove("dump.txt");
|
||||||
dms_state* state = new dms_state();
|
dms_state* state = new dms_state();
|
||||||
return Parse(state, fn);
|
return Parse(state, fn);
|
||||||
}
|
}
|
||||||
@ -51,12 +57,16 @@ namespace dms {
|
|||||||
stream.next('\n'); // Seek until you find a newline
|
stream.next('\n'); // Seek until you find a newline
|
||||||
}
|
}
|
||||||
else if (data == '\n') {
|
else if (data == '\n') {
|
||||||
|
std::string str = stream.processBuffer(buffer);
|
||||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||||
t_vec.push_back(token{ tokens::newline,codes::NOOP,"",line });
|
t_vec.push_back(token{ tokens::newline,codes::NOOP,"",line });
|
||||||
if (isNum) {
|
if (isNum && str.size() != 0) {
|
||||||
t_vec.push_back(token{ tokens::number,codes::NOOP,stream.processBuffer(buffer),line });
|
trim(str);
|
||||||
buffer.clear();
|
if (str.size() != 0) {
|
||||||
isNum = false;
|
t_vec.push_back(token{ tokens::number,codes::NOOP,str,line });
|
||||||
|
buffer.clear();
|
||||||
|
isNum = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
line++;
|
line++;
|
||||||
data = ' ';
|
data = ' ';
|
||||||
@ -271,8 +281,11 @@ namespace dms {
|
|||||||
t_vec.push_back(token{ tokens::debug,codes::NOOP,"",line });
|
t_vec.push_back(token{ tokens::debug,codes::NOOP,"",line });
|
||||||
}
|
}
|
||||||
else if (utils::isNum(str) && str.size()!=0) {
|
else if (utils::isNum(str) && str.size()!=0) {
|
||||||
t_vec.push_back(token{ tokens::number,codes::NOOP,stream.processBuffer(buffer),line });
|
trim(str);
|
||||||
isNum = false;
|
if(str!=""){
|
||||||
|
t_vec.push_back(token{ tokens::number,codes::NOOP,stream.processBuffer(buffer),line });
|
||||||
|
isNum = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (utils::isalphanum(str) && str.size() > 0) {
|
else if (utils::isalphanum(str) && str.size() > 0) {
|
||||||
t_vec.push_back(token{ tokens::name,codes::NOOP,stream.processBuffer(buffer),line });
|
t_vec.push_back(token{ tokens::name,codes::NOOP,stream.processBuffer(buffer),line });
|
||||||
@ -289,12 +302,22 @@ namespace dms {
|
|||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
void LineParser::tokenDump(std::vector<token>* v) {
|
void LineParser::tokenDump(std::vector<token>* v) {
|
||||||
std::ofstream outputFile("dump.txt");
|
if (is_file_exist("dump.txt")) {
|
||||||
outputFile << "Token Dump:" << std::endl;
|
std::ofstream outputFile;
|
||||||
for (size_t i = 0; i < v->size(); i++) {
|
outputFile.open("dump.txt", std::ios_base::app); // append instead of overwrite
|
||||||
outputFile << (*v)[i] << std::endl;
|
for (size_t i = 0; i < v->size(); i++) {
|
||||||
|
outputFile << (*v)[i] << std::endl;
|
||||||
|
}
|
||||||
|
outputFile.close();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
std::ofstream outputFile("dump.txt");
|
||||||
|
outputFile << "Token Dump:" << std::endl;
|
||||||
|
for (size_t i = 0; i < v->size(); i++) {
|
||||||
|
outputFile << (*v)[i] << std::endl;
|
||||||
|
}
|
||||||
|
outputFile.close();
|
||||||
}
|
}
|
||||||
outputFile.close();
|
|
||||||
}
|
}
|
||||||
void LineParser::_Parse(tokenstream* stream) {
|
void LineParser::_Parse(tokenstream* stream) {
|
||||||
token current = stream->next();
|
token current = stream->next();
|
||||||
|
|||||||
@ -82,7 +82,6 @@ namespace dms {
|
|||||||
return isBlock(bt_block); // Default block type
|
return isBlock(bt_block); // Default block type
|
||||||
}
|
}
|
||||||
bool LineParser::isBlock(blocktype bk_type) {
|
bool LineParser::isBlock(blocktype bk_type) {
|
||||||
//print();
|
|
||||||
if (current_chunk == nullptr) {
|
if (current_chunk == nullptr) {
|
||||||
return false; // If a chunk wasn't defined then code was probably defined outside of a block
|
return false; // If a chunk wasn't defined then code was probably defined outside of a block
|
||||||
}
|
}
|
||||||
@ -119,10 +118,13 @@ namespace dms {
|
|||||||
void LineParser::doCheck(passer* stream, std::vector<token>* t_vec, size_t line, bool& isNum, bool& hasDec, std::vector<uint8_t>* buffer) {
|
void LineParser::doCheck(passer* stream, std::vector<token>* t_vec, size_t line, bool& isNum, bool& hasDec, std::vector<uint8_t>* buffer) {
|
||||||
std::string str = stream->processBuffer(*buffer);
|
std::string str = stream->processBuffer(*buffer);
|
||||||
if (utils::isNum(str) && isNum) {
|
if (utils::isNum(str) && isNum) {
|
||||||
t_vec->push_back(token{ tokens::number,codes::NOOP,stream->processBuffer(*buffer),line });
|
trim(str);
|
||||||
buffer->clear();
|
if (str.size() != 0) {
|
||||||
isNum = false;
|
t_vec->push_back(token{ tokens::number,codes::NOOP,stream->processBuffer(*buffer),line });
|
||||||
hasDec = false;
|
buffer->clear();
|
||||||
|
isNum = false;
|
||||||
|
hasDec = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (buffer->size() > 0) {
|
else if (buffer->size() > 0) {
|
||||||
if (str == "nil") {
|
if (str == "nil") {
|
||||||
@ -141,10 +143,13 @@ namespace dms {
|
|||||||
hasDec = false;
|
hasDec = false;
|
||||||
}
|
}
|
||||||
else if (utils::isNum(str) && str.size() > 0) {
|
else if (utils::isNum(str) && str.size() > 0) {
|
||||||
t_vec->push_back(token{ tokens::number,codes::NOOP,stream->processBuffer(*buffer),line });
|
trim(str);
|
||||||
buffer->clear();
|
if (str.size() != 0) {
|
||||||
isNum = false;
|
t_vec->push_back(token{ tokens::number,codes::NOOP,stream->processBuffer(*buffer),line });
|
||||||
hasDec = false;
|
buffer->clear();
|
||||||
|
isNum = false;
|
||||||
|
hasDec = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (utils::isalphanum(str) && str.size() > 0) {
|
else if (utils::isalphanum(str) && str.size() > 0) {
|
||||||
t_vec->push_back(token{ tokens::name,codes::NOOP,stream->processBuffer(*buffer),line });
|
t_vec->push_back(token{ tokens::name,codes::NOOP,stream->processBuffer(*buffer),line });
|
||||||
@ -160,7 +165,7 @@ namespace dms {
|
|||||||
state->push_error(errors::error{ err,concat("Unexpected symbol '",stream->next().toString(),"'"),true,stream->peek().line_num,current_chunk });
|
state->push_error(errors::error{ err,concat("Unexpected symbol '",stream->next().toString(),"'"),true,stream->peek().line_num,current_chunk });
|
||||||
}
|
}
|
||||||
void LineParser::badSymbol(tokenstream* stream) {
|
void LineParser::badSymbol(tokenstream* stream) {
|
||||||
state->push_error(errors::error{ errors::unknown,concat("Unexpected symbol '",stream->next().toString(),"'"),true,stream->peek().line_num,current_chunk });
|
state->push_error(errors::error{ errors::unknown,concat("Unexpected symbol '",stream->next().toString(),"' RAW:",stream->last(), " Last Call: ",lastCall.top()),true,stream->peek().line_num,current_chunk });
|
||||||
}
|
}
|
||||||
void LineParser::badSymbol() {
|
void LineParser::badSymbol() {
|
||||||
state->push_error(errors::error{ errors::unknown,concat("Unexpected symbol '",_stream->next().toString(),"'"),true,_stream->peek().line_num,current_chunk });
|
state->push_error(errors::error{ errors::unknown,concat("Unexpected symbol '",_stream->next().toString(),"'"),true,_stream->peek().line_num,current_chunk });
|
||||||
|
|||||||
22
DMS/Scope.h
22
DMS/Scope.h
@ -1,22 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
#include <vector>
|
|
||||||
#include "cmd.h"
|
|
||||||
namespace dms {
|
|
||||||
enum scopetype {
|
|
||||||
none,
|
|
||||||
iff,
|
|
||||||
elif,
|
|
||||||
elsee,
|
|
||||||
disp,
|
|
||||||
choice,
|
|
||||||
forr,
|
|
||||||
whilee,
|
|
||||||
};
|
|
||||||
struct scope {
|
|
||||||
std::vector<cmd> cmds;
|
|
||||||
scopetype type = scopetype::none;
|
|
||||||
void addCmd(cmd c) {
|
|
||||||
cmds.push_back(c);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -15,10 +15,10 @@ Ryan: {
|
|||||||
"It's a nice day we are having!"
|
"It's a nice day we are having!"
|
||||||
}
|
}
|
||||||
|
|
||||||
DISP ""
|
SSPK Ryan
|
||||||
DSPD Ryan 100
|
DSPD 100
|
||||||
DACT Ryan [path defined by: Ryan.calm]
|
DACT [path defined by: Ryan.calm]
|
||||||
APND Ryan "Hello Bob, "
|
APND "Hello Bob, "
|
||||||
WAIT 0.455
|
WAIT 0.455
|
||||||
DACT Ryan [path defined by: Ryan.excited]
|
DACT [path defined by: Ryan.excited]
|
||||||
APND "how are you doing?"
|
APND "how are you doing?"
|
||||||
|
|||||||
13
DMS/dms.h
13
DMS/dms.h
@ -1,13 +1,14 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "value.h"
|
#include "chunk.h"
|
||||||
#include "codes.h"
|
|
||||||
#include "cmd.h"
|
#include "cmd.h"
|
||||||
|
#include "codes.h"
|
||||||
#include "dms_exceptions.h"
|
#include "dms_exceptions.h"
|
||||||
|
#include "dms_state.h"
|
||||||
#include "errors.h"
|
#include "errors.h"
|
||||||
#include "utils.h"
|
#include "LineParser.h"
|
||||||
#include "number_utils.h"
|
#include "number_utils.h"
|
||||||
#include "string_utils.h"
|
#include "string_utils.h"
|
||||||
#include "LineParser.h"
|
|
||||||
#include "dms.h"
|
|
||||||
#include "chunk.h"
|
|
||||||
#include "token.h"
|
#include "token.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "value.h"
|
||||||
|
|
||||||
|
|||||||
BIN
DMS/dump.bin
BIN
DMS/dump.bin
Binary file not shown.
242
DMS/dump.txt
242
DMS/dump.txt
@ -1,157 +1,209 @@
|
|||||||
Token Dump:
|
Token Dump:
|
||||||
Line <1>NOOP newline
|
Line <1>NOOP newline
|
||||||
Line <1>NOOP newline
|
Line <1>NOOP newline
|
||||||
Line <1>NOOP bracketo
|
Line <1>ENTR flag
|
||||||
Line <1>NOOP name default
|
Line <1>NOOP name main
|
||||||
Line <1>NOOP colon
|
|
||||||
Line <1>NOOP name char
|
|
||||||
Line <1>NOOP bracketc
|
|
||||||
Line <1>NOOP newline
|
Line <1>NOOP newline
|
||||||
Line <1>NOOP newline
|
Line <1>NOOP newline
|
||||||
|
Line <2>ENAB flag
|
||||||
|
Line <2>NOOP name warnings
|
||||||
Line <2>NOOP newline
|
Line <2>NOOP newline
|
||||||
Line <3>NOOP name money
|
Line <2>NOOP newline
|
||||||
Line <3>NOOP equal
|
Line <3>DISA flag
|
||||||
Line <3>NOOP number 0
|
Line <3>NOOP name omniscient
|
||||||
Line <3>NOOP newline
|
Line <3>NOOP newline
|
||||||
Line <3>NOOP newline
|
Line <3>NOOP newline
|
||||||
Line <4>NOOP name test
|
Line <4>ENAB flag
|
||||||
Line <4>NOOP equal
|
Line <4>NOOP name debugging
|
||||||
Line <4>NOOP nil nil
|
|
||||||
Line <4>NOOP newline
|
Line <4>NOOP newline
|
||||||
Line <4>NOOP newline
|
Line <4>NOOP newline
|
||||||
Line <5>NOOP newline
|
Line <5>NOOP newline
|
||||||
Line <5>NOOP newline
|
Line <6>VERN flag
|
||||||
Line <6>NOOP bracketo
|
Line <6>NOOP number 1.2
|
||||||
Line <6>NOOP name Ryan
|
|
||||||
Line <6>NOOP colon
|
|
||||||
Line <6>NOOP name char
|
|
||||||
Line <6>NOOP bracketc
|
|
||||||
Line <6>NOOP newline
|
Line <6>NOOP newline
|
||||||
Line <6>NOOP newline
|
Line <6>NOOP newline
|
||||||
Line <7>NOOP name age
|
Line <7>USIN flag
|
||||||
Line <7>NOOP equal
|
Line <7>NOOP name extendedDefine
|
||||||
Line <7>NOOP number 21
|
|
||||||
Line <7>NOOP newline
|
Line <7>NOOP newline
|
||||||
Line <7>NOOP newline
|
Line <7>NOOP newline
|
||||||
Line <8>NOOP name money
|
|
||||||
Line <8>NOOP equal
|
|
||||||
Line <8>NOOP number 1000
|
|
||||||
Line <8>NOOP newline
|
Line <8>NOOP newline
|
||||||
Line <8>NOOP newline
|
Line <8>NOOP newline
|
||||||
|
Line <9>NOOP bracketo
|
||||||
|
Line <9>NOOP name main
|
||||||
|
Line <9>NOOP bracketc
|
||||||
Line <9>NOOP newline
|
Line <9>NOOP newline
|
||||||
Line <10>NOOP name calm
|
Line <9>NOOP newline
|
||||||
Line <10>NOOP colon
|
Line <10>NOOP string hello?
|
||||||
Line <10>NOOP string ./path/to/file
|
|
||||||
Line <10>NOOP newline
|
Line <10>NOOP newline
|
||||||
Line <10>NOOP newline
|
Line <10>NOOP newline
|
||||||
Line <11>NOOP name excited
|
Line <11>NOOP name var1
|
||||||
Line <11>NOOP colon
|
Line <11>NOOP equal
|
||||||
Line <11>NOOP string ./path/to/file
|
Line <11>NOOP name func
|
||||||
|
Line <11>NOOP parao
|
||||||
|
Line <11>NOOP number 1
|
||||||
|
Line <11>NOOP seperator
|
||||||
|
Line <11>NOOP string string
|
||||||
|
Line <11>NOOP seperator
|
||||||
|
Line <11>NOOP name test
|
||||||
|
Line <11>NOOP parao
|
||||||
|
Line <11>NOOP number 1
|
||||||
|
Line <11>NOOP seperator
|
||||||
|
Line <11>NOOP number 2
|
||||||
|
Line <11>NOOP parac
|
||||||
|
Line <11>NOOP seperator
|
||||||
|
Line <11>NOOP name test2
|
||||||
|
Line <11>NOOP parao
|
||||||
|
Line <11>NOOP parac
|
||||||
|
Line <11>NOOP parac
|
||||||
Line <11>NOOP newline
|
Line <11>NOOP newline
|
||||||
Line <11>NOOP newline
|
Line <11>NOOP newline
|
||||||
|
Line <12>NOOP name a
|
||||||
|
Line <12>NOOP equal
|
||||||
|
Line <12>NOOP number 100
|
||||||
|
Line <12>NOOP plus
|
||||||
|
Line <12>NOOP name func
|
||||||
|
Line <12>NOOP parao
|
||||||
|
Line <12>NOOP number 1
|
||||||
|
Line <12>NOOP seperator
|
||||||
|
Line <12>NOOP string string
|
||||||
|
Line <12>NOOP seperator
|
||||||
|
Line <12>NOOP number 2
|
||||||
|
Line <12>NOOP plus
|
||||||
|
Line <12>NOOP number 5
|
||||||
|
Line <12>NOOP parac
|
||||||
|
Line <12>NOOP plus
|
||||||
|
Line <12>NOOP number 100
|
||||||
Line <12>NOOP newline
|
Line <12>NOOP newline
|
||||||
Line <12>NOOP newline
|
Line <12>NOOP newline
|
||||||
Line <13>NOOP bracketo
|
Line <13>NOOP name func
|
||||||
Line <13>NOOP name step
|
|
||||||
Line <13>NOOP colon
|
|
||||||
Line <13>NOOP name function
|
|
||||||
Line <13>NOOP parao
|
Line <13>NOOP parao
|
||||||
Line <13>NOOP name a
|
Line <13>NOOP number 1
|
||||||
Line <13>NOOP seperator
|
Line <13>NOOP seperator
|
||||||
Line <13>NOOP name b
|
Line <13>NOOP string string
|
||||||
Line <13>NOOP seperator
|
Line <13>NOOP seperator
|
||||||
Line <13>NOOP name c
|
Line <13>NOOP number 2
|
||||||
|
Line <13>NOOP plus
|
||||||
|
Line <13>NOOP number 5
|
||||||
Line <13>NOOP parac
|
Line <13>NOOP parac
|
||||||
Line <13>NOOP bracketc
|
|
||||||
Line <13>NOOP newline
|
Line <13>NOOP newline
|
||||||
Line <13>NOOP newline
|
Line <13>NOOP newline
|
||||||
Line <14>NOOP string Testing...
|
Line <14>NOOP label mylabel
|
||||||
|
Line <14>NOOP newline
|
||||||
Line <14>NOOP newline
|
Line <14>NOOP newline
|
||||||
Line <15>NOOP name d
|
|
||||||
Line <15>NOOP equal
|
|
||||||
Line <15>NOOP parao
|
|
||||||
Line <15>NOOP number 100
|
|
||||||
Line <15>NOOP plus
|
|
||||||
Line <15>NOOP name b
|
|
||||||
Line <15>NOOP parac
|
|
||||||
Line <15>NOOP divide
|
|
||||||
Line <15>NOOP name c
|
|
||||||
Line <15>NOOP newline
|
Line <15>NOOP newline
|
||||||
Line <15>NOOP newline
|
Line <15>NOOP newline
|
||||||
Line <16>NOOP name e
|
Line <16>CHOI control
|
||||||
Line <16>NOOP equal
|
Line <16>NOOP string Pick one:
|
||||||
Line <16>NOOP string somestring
|
Line <16>NOOP cbracketo
|
||||||
Line <16>NOOP newline
|
Line <16>NOOP newline
|
||||||
Line <16>NOOP newline
|
Line <16>NOOP newline
|
||||||
Line <17>NOOP name e
|
Line <17>NOOP string first
|
||||||
Line <17>NOOP equal
|
Line <17>NOOP name func
|
||||||
Line <17>NOOP nil nil
|
Line <17>NOOP parao
|
||||||
|
Line <17>NOOP number 1
|
||||||
|
Line <17>NOOP seperator
|
||||||
|
Line <17>NOOP number 2
|
||||||
|
Line <17>NOOP seperator
|
||||||
|
Line <17>NOOP number 3
|
||||||
|
Line <17>NOOP parac
|
||||||
Line <17>NOOP newline
|
Line <17>NOOP newline
|
||||||
Line <17>NOOP newline
|
Line <17>NOOP newline
|
||||||
Line <18>NOOP name g
|
Line <18>NOOP string second
|
||||||
Line <18>NOOP equal
|
Line <18>NOOP name func
|
||||||
|
Line <18>NOOP parao
|
||||||
|
Line <18>NOOP true true
|
||||||
|
Line <18>NOOP seperator
|
||||||
Line <18>NOOP false false
|
Line <18>NOOP false false
|
||||||
|
Line <18>NOOP parac
|
||||||
Line <18>NOOP newline
|
Line <18>NOOP newline
|
||||||
Line <18>NOOP newline
|
Line <18>NOOP newline
|
||||||
Line <19>RETN ret
|
Line <19>NOOP string third
|
||||||
Line <19>NOOP name d
|
Line <19>NOOP name func
|
||||||
|
Line <19>NOOP parao
|
||||||
|
Line <19>NOOP string hehe
|
||||||
|
Line <19>NOOP parac
|
||||||
Line <19>NOOP newline
|
Line <19>NOOP newline
|
||||||
Line <19>NOOP newline
|
Line <19>NOOP newline
|
||||||
|
Line <20>NOOP string forth
|
||||||
|
Line <20>NOOP name func
|
||||||
|
Line <20>NOOP parao
|
||||||
|
Line <20>NOOP string 1
|
||||||
|
Line <20>NOOP seperator
|
||||||
|
Line <20>NOOP number 2
|
||||||
|
Line <20>NOOP seperator
|
||||||
|
Line <20>NOOP false false
|
||||||
|
Line <20>NOOP parac
|
||||||
Line <20>NOOP newline
|
Line <20>NOOP newline
|
||||||
Line <20>NOOP newline
|
Line <20>NOOP newline
|
||||||
Line <21>NOOP bracketo
|
Line <21>NOOP string fifth
|
||||||
Line <21>NOOP name inventory
|
Line <21>NOOP gotoo
|
||||||
Line <21>NOOP colon
|
Line <21>NOOP string here
|
||||||
Line <21>NOOP name env
|
|
||||||
Line <21>NOOP bracketc
|
|
||||||
Line <21>NOOP newline
|
Line <21>NOOP newline
|
||||||
Line <21>NOOP newline
|
Line <21>NOOP newline
|
||||||
Line <22>NOOP name slot1
|
Line <22>NOOP string sixth
|
||||||
Line <22>NOOP number
|
Line <22>NOOP gotoo
|
||||||
Line <22>NOOP equal
|
Line <22>NOOP name name
|
||||||
Line <22>NOOP string
|
|
||||||
Line <22>NOOP newline
|
Line <22>NOOP newline
|
||||||
Line <22>NOOP newline
|
Line <22>NOOP newline
|
||||||
Line <23>NOOP name slot2
|
Line <23>NOOP string sevinth
|
||||||
Line <23>NOOP number
|
Line <23>NOOP jump
|
||||||
Line <23>NOOP equal
|
Line <23>NOOP string there
|
||||||
Line <23>NOOP string
|
|
||||||
Line <23>NOOP newline
|
Line <23>NOOP newline
|
||||||
Line <23>NOOP newline
|
Line <23>NOOP newline
|
||||||
Line <24>NOOP name slot3
|
Line <24>NOOP string eight
|
||||||
Line <24>NOOP number
|
Line <24>NOOP jump
|
||||||
Line <24>NOOP equal
|
Line <24>NOOP name name
|
||||||
Line <24>NOOP string
|
|
||||||
Line <24>NOOP newline
|
Line <24>NOOP newline
|
||||||
Line <24>NOOP newline
|
Line <24>NOOP newline
|
||||||
Line <25>NOOP name slot4
|
Line <25>NOOP string nine
|
||||||
Line <25>NOOP number
|
Line <25>NOOP name exit
|
||||||
Line <25>NOOP equal
|
|
||||||
Line <25>NOOP string
|
|
||||||
Line <25>NOOP newline
|
Line <25>NOOP newline
|
||||||
Line <25>NOOP newline
|
Line <25>NOOP newline
|
||||||
Line <26>NOOP name slot5
|
Line <26>NOOP string ten
|
||||||
Line <26>NOOP number
|
Line <26>NOOP exit
|
||||||
Line <26>NOOP equal
|
Line <26>NOOP number 0
|
||||||
Line <26>NOOP string
|
|
||||||
Line <26>NOOP newline
|
Line <26>NOOP newline
|
||||||
Line <26>NOOP newline
|
Line <26>NOOP newline
|
||||||
Line <27>NOOP name slot6
|
Line <27>NOOP cbracketc
|
||||||
Line <27>NOOP number
|
|
||||||
Line <27>NOOP equal
|
|
||||||
Line <27>NOOP string
|
|
||||||
Line <27>NOOP newline
|
Line <27>NOOP newline
|
||||||
Line <27>NOOP newline
|
Line <27>NOOP newline
|
||||||
Line <28>NOOP name slot7
|
|
||||||
Line <28>NOOP number
|
|
||||||
Line <28>NOOP equal
|
|
||||||
Line <28>NOOP string
|
|
||||||
Line <28>NOOP newline
|
Line <28>NOOP newline
|
||||||
Line <28>NOOP newline
|
Line <28>NOOP newline
|
||||||
Line <29>NOOP name slot8
|
Line <29>NOOP bracketo
|
||||||
Line <29>NOOP number
|
Line <29>NOOP name Bob
|
||||||
Line <29>NOOP equal
|
Line <29>NOOP colon
|
||||||
Line <29>NOOP string
|
Line <29>NOOP name char
|
||||||
|
Line <29>NOOP bracketc
|
||||||
Line <29>NOOP newline
|
Line <29>NOOP newline
|
||||||
Line <29>NOOP newline
|
Line <29>NOOP newline
|
||||||
Line <29>NOOP eof
|
Line <30>NOOP name age
|
||||||
|
Line <30>NOOP equal
|
||||||
|
Line <30>NOOP number 24
|
||||||
|
Line <30>NOOP newline
|
||||||
|
Line <30>NOOP newline
|
||||||
|
Line <31>NOOP name money
|
||||||
|
Line <31>NOOP equal
|
||||||
|
Line <31>NOOP number 100
|
||||||
|
Line <31>NOOP newline
|
||||||
|
Line <31>NOOP newline
|
||||||
|
Line <32>NOOP newline
|
||||||
|
Line <32>NOOP newline
|
||||||
|
Line <33>NOOP bracketo
|
||||||
|
Line <33>NOOP name newblock
|
||||||
|
Line <33>NOOP colon
|
||||||
|
Line <33>NOOP name function
|
||||||
|
Line <33>NOOP parao
|
||||||
|
Line <33>NOOP parac
|
||||||
|
Line <33>NOOP bracketc
|
||||||
|
Line <33>NOOP newline
|
||||||
|
Line <33>NOOP newline
|
||||||
|
Line <34>NOOP string Test #2
|
||||||
|
Line <34>NOOP newline
|
||||||
|
Line <34>NOOP newline
|
||||||
|
Line <35>NOOP string Does it parse this part properly?
|
||||||
|
Line <35>NOOP newline
|
||||||
|
Line <35>NOOP newline
|
||||||
|
Line <36>NOOP string huh
|
||||||
|
Line <36>NOOP newline
|
||||||
|
Line <36>NOOP newline
|
||||||
|
Line <36>NOOP eof
|
||||||
|
|||||||
93
DMS/test.dms
93
DMS/test.dms
@ -2,100 +2,13 @@ entry main
|
|||||||
enable warnings
|
enable warnings
|
||||||
disable omniscient
|
disable omniscient
|
||||||
enable debugging
|
enable debugging
|
||||||
loadfile "loadtest.dms"
|
//loadfile "loadtest.dms"
|
||||||
version 1.2
|
version 1.2
|
||||||
using extendedDefine
|
using extendedDefine
|
||||||
|
|
||||||
[main]
|
[main]
|
||||||
Bob: "Hi Ryan!"
|
"hello?"
|
||||||
DEBUG "What's up" // Debug lines are removed when debug mode is disabled
|
var1 = func(1,"string",test(1,2),test2())
|
||||||
Ryan: {
|
|
||||||
speed 100;calm "Hello Bob, "
|
|
||||||
wait 0.455
|
|
||||||
excited "how are you doing?"
|
|
||||||
// Becomes: Hello Bob, how are you doing?
|
|
||||||
}
|
|
||||||
Bob: {
|
|
||||||
speed 50
|
|
||||||
happy "You won't believe what just happened!"
|
|
||||||
}
|
|
||||||
Ryan: "Let me gue..."
|
|
||||||
Bob: {
|
|
||||||
speed 150
|
|
||||||
excited "I got the job! "
|
|
||||||
"The pay is amazing, "
|
|
||||||
speed 50
|
|
||||||
calm "but wait theres more!"
|
|
||||||
excited "I also get to go on a company trip and "
|
|
||||||
"I'm able to invite 2 friends to come along"
|
|
||||||
}
|
|
||||||
Ryan: {
|
|
||||||
happy "That's awesome! "
|
|
||||||
curious "Who do you plan on inviting?"
|
|
||||||
}
|
|
||||||
Bob: {
|
|
||||||
calm "Well you obviously, but I'm not sure who else I would want to bring..."
|
|
||||||
curious "Wanted to ask if you had any suggestions?"
|
|
||||||
}
|
|
||||||
Ryan: "Hmm, let me see..."
|
|
||||||
CHOICE "Who should I pick?" {
|
|
||||||
"Marie" goto "pickMarie"
|
|
||||||
"Sammy" goto "pickSammy"
|
|
||||||
"Ana" goto "pickAna"
|
|
||||||
"No Idea" goto "noIdea"
|
|
||||||
}
|
|
||||||
::pickMarie::
|
|
||||||
Ryan: "I think inviting Marie would be a good idea."
|
|
||||||
Bob: "I was actually thinking the same thing, let's invite her."
|
|
||||||
friend = [Marie] // Marie is a character block so obviously we set friend to a block
|
|
||||||
goto endpick
|
|
||||||
::pickSammy::
|
|
||||||
Ryan: "I think inviting Sammy would be a good idea."
|
|
||||||
Bob: "I haven't hung out with Sammy in too long, good pick."
|
|
||||||
friend = [Sammy]
|
|
||||||
goto endpick
|
|
||||||
::pickAna::
|
|
||||||
Ryan: "I think inviting Ana would be a good idea."
|
|
||||||
Bob: "Ana a name I haven't heard in a long time, sure sounds like a good time."
|
|
||||||
friend = [Ana]
|
|
||||||
goto endpick
|
|
||||||
::noIdea::
|
|
||||||
Ryan: "I really don't know who to bring..."
|
|
||||||
Bob: "Huh you having issues thinking of someone too. How about we bring Frank?"
|
|
||||||
Ryan: "Oh man Frank, for sure its been a minute since I last saw him."
|
|
||||||
friend = [Frank]
|
|
||||||
::endpick::
|
|
||||||
Bob: "Ill give ${friend} a call later!"
|
|
||||||
Ryan: "Sounds good looking forward to the trip!"
|
|
||||||
Bob: "Same, I'll send you the details later as well, see ya!"
|
|
||||||
Ryan: "Take care!"
|
|
||||||
|
|
||||||
tester = "Hello"
|
|
||||||
food = 3
|
|
||||||
|
|
||||||
if statment {
|
|
||||||
"test"
|
|
||||||
} elseif statement {
|
|
||||||
"test"
|
|
||||||
} if statement {
|
|
||||||
"test"
|
|
||||||
"test"
|
|
||||||
if statement {
|
|
||||||
"test"
|
|
||||||
} else {
|
|
||||||
"test"
|
|
||||||
}
|
|
||||||
} elseif statement {
|
|
||||||
"test"
|
|
||||||
} else {
|
|
||||||
"test"
|
|
||||||
}
|
|
||||||
|
|
||||||
goto "somewhere"
|
|
||||||
jump "overhere"
|
|
||||||
|
|
||||||
hungry = (-2+4-((5*5)/sqrt(144+5)))^2*2+2
|
|
||||||
var1 = func(1,"string", 2+5)
|
|
||||||
a = 100 + func(1,"string", 2+5) + 100
|
a = 100 + func(1,"string", 2+5) + 100
|
||||||
func(1,"string", 2+5)
|
func(1,"string", 2+5)
|
||||||
::mylabel::
|
::mylabel::
|
||||||
|
|||||||
BIN
Debug/DMS.exe
BIN
Debug/DMS.exe
Binary file not shown.
BIN
Debug/DMS.ilk
BIN
Debug/DMS.ilk
Binary file not shown.
BIN
Debug/DMS.pdb
BIN
Debug/DMS.pdb
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user