Fixed error line number bug, started working on compound disp cmd
This commit is contained in:
parent
c504f41dcb
commit
120ad85461
@ -25,8 +25,8 @@
|
||||
<Keywords name="Folders in comment, middle"></Keywords>
|
||||
<Keywords name="Folders in comment, close"></Keywords>
|
||||
<Keywords name="Keywords1">ENABLE DISABLE LOADFILE ENTRY USING VERSION as AS enable disable loadfile entry using version</Keywords>
|
||||
<Keywords name="Keywords2">if then return and or true false for while choice end else elseif goto jump exit</Keywords>
|
||||
<Keywords name="Keywords3">leaking debugging warnings statesave hostmsg</Keywords>
|
||||
<Keywords name="Keywords2">if then return and or true false for while choice end else elseif goto jump exit debug nil</Keywords>
|
||||
<Keywords name="Keywords3">leaking debugging warnings statesave omniscient</Keywords>
|
||||
<Keywords name="Keywords4">ceil tan CSIM log10 sinh GOTOE lshift deg MUL QUIT cosh exp rad GOTO SUB log ADD error POW randomseed floor tanh max atan SKIP acos DIV abs rshif COMPARE print atan2 asin cos sin mod sqrt function getInput sleep getVar setVar newThread setGlobalVar getGlobalVar SAVE LOAD WATCH env char</Keywords>
|
||||
<Keywords name="Keywords5">_VERSION</Keywords>
|
||||
<Keywords name="Keywords6">filesystem extendedDefine</Keywords>
|
||||
@ -36,19 +36,19 @@
|
||||
</KeywordLists>
|
||||
<Styles>
|
||||
<WordsStyle name="DEFAULT" fgColor="C3C3C3" bgColor="293135" fontName="獵牥敄楦敮挮浯敭瑮s潷摲㡳�" fontStyle="0" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="COMMENTS" fgColor="808080" bgColor="293134" fontName="獵牥敄楦敮昮汯敤獲湉潃敤䴱摩汤e䳘᐀Ⴈ踀楦敬祳瑳浥攀瑸湥敤䑤晥湩e" fontStyle="0" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="COMMENTS" fgColor="808080" bgColor="293134" fontName="獵牥敄楦敮昮汯敤獲湉潃敤䴱摩汤e䳘᐀Ⴈ耀楦敬祳瑳浥攀瑸湥敤䑤晥湩e" fontStyle="0" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="LINE COMMENTS" fgColor="808080" bgColor="293134" fontName="獵牥敄楦敮昮汯敤獲湉潃敤䌱潬敳" fontStyle="0" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="NUMBERS" fgColor="FF8080" bgColor="293134" fontName="獵牥敄楦敮搮捥浩污敓慰慲潴r" fontStyle="0" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="KEYWORDS1" fgColor="FF8000" bgColor="293134" fontName="獵牥敄楦敮瀮敲楦䭸祥潷摲㍳" fontStyle="1" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="KEYWORDS2" fgColor="0080C0" bgColor="293134" fontName="콸̇麐ʕࠋ" fontStyle="1" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="KEYWORDS3" fgColor="408080" bgColor="293134" fontName="0o⍻磾춘̇ " fontStyle="1" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="KEYWORDS4" fgColor="5959AC" bgColor="293134" fontName="" fontStyle="1" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="KEYWORDS5" fgColor="FF0080" bgColor="293134" fontName="ꌈ̈磾쿰̇ꈀʕࠋ" fontStyle="0" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="KEYWORDS2" fgColor="0080C0" bgColor="293134" fontName="케̇麐ʕࠋ" fontStyle="1" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="KEYWORDS3" fgColor="408080" bgColor="293134" fontName="" fontStyle="1" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="KEYWORDS4" fgColor="5959AC" bgColor="293134" fontName="" fontStyle="1" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="KEYWORDS5" fgColor="FF0080" bgColor="293134" fontName="ꌈ̈磾케̇ꈀʕࠋ" fontStyle="0" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="KEYWORDS6" fgColor="149311" bgColor="293134" fontName="閨ʕMMENT" fontStyle="1" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="KEYWORDS7" fgColor="0080C0" bgColor="293134" fontName="293134" fontStyle="1" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="KEYWORDS8" fgColor="000000" bgColor="FFFFFF" fontName="̈STRUC" fontStyle="0" nesting="0" />
|
||||
<WordsStyle name="OPERATORS" fgColor="EAC195" bgColor="293134" fontName="獵牥敄楦敮渮獥楴杮㈮0̏✟ᑸȴ耀✞ᑹ̘蠀獵牥敄楦敮渮獥楴杮㈮3" fontStyle="1" nesting="0" />
|
||||
<WordsStyle name="FOLDER IN CODE1" fgColor="EAC195" bgColor="293134" fontName="" fontStyle="1" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="OPERATORS" fgColor="EAC195" bgColor="293134" fontName="獵牥敄楦敮渮獥楴杮㈮0̏✟ᑸȴ耀✞ᑹ̘耀獵牥敄楦敮渮獥楴杮㈮3" fontStyle="1" nesting="0" />
|
||||
<WordsStyle name="FOLDER IN CODE1" fgColor="EAC195" bgColor="293134" fontName="" fontStyle="1" fontSize="12" nesting="0" />
|
||||
<WordsStyle name="FOLDER IN CODE2" fgColor="000000" bgColor="FFFFFF" fontName="FFCD22" fontStyle="0" nesting="0" />
|
||||
<WordsStyle name="FOLDER IN COMMENT" fgColor="000000" bgColor="FFFFFF" fontName="" fontStyle="0" nesting="0" />
|
||||
<WordsStyle name="DELIMITERS1" fgColor="8080C0" bgColor="293134" fontName="獵牥敄楦敮渮獥楴杮ㄮ9(Ž" fontStyle="1" fontSize="12" nesting="0" />
|
||||
|
||||
@ -1,5 +1,2 @@
|
||||
LineParserBuilds.cpp
|
||||
LineParserParse.cpp
|
||||
chunk.cpp
|
||||
Generating Code...
|
||||
LineParserParse.cpp
|
||||
DMS.vcxproj -> F:\VSCWorkspace\DMS\Debug\DMS.exe
|
||||
|
||||
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.
@ -56,6 +56,7 @@ namespace dms {
|
||||
std::vector<tokens::token> temp;
|
||||
std::vector<tokens::token> tdump;
|
||||
size_t tabs = 0;
|
||||
tokenstream* _stream;
|
||||
dms_state* state;
|
||||
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);
|
||||
@ -73,8 +74,14 @@ namespace dms {
|
||||
void buildGoto(std::string g, bool v = false);
|
||||
void buildNoop();
|
||||
void buildLabel(std::string l);
|
||||
void buildSpeed(double s);
|
||||
void buildWait(double w);
|
||||
|
||||
// Utils
|
||||
void badSymbol(errors::errortype err, tokenstream* stream);
|
||||
void badSymbol(tokenstream* stream);
|
||||
void badSymbol();
|
||||
|
||||
void tokenDump(std::vector<tokens::token>* v);
|
||||
bool createBlock(std::string bk_name, blocktype bk_type);
|
||||
|
||||
|
||||
@ -15,11 +15,12 @@ namespace dms {
|
||||
print("DISP := ", msg);
|
||||
cmd* c = new cmd;
|
||||
c->opcode = codes::DISP;
|
||||
c->args.push(buildValue());
|
||||
c->args.push(buildValue(msg));
|
||||
current_chunk->addCmd(c); // Add the cmd to the current chunk
|
||||
return true;
|
||||
}
|
||||
else if (isBlock(bt_block) && 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)) {
|
||||
// We might have to handle scope here
|
||||
// Here we match 'Ryan: "This guy said this!"' Note the colon is needed!
|
||||
stream->next(); // Standard consumption
|
||||
@ -29,12 +30,66 @@ namespace dms {
|
||||
print("DISP := ", name, " says '", msg, "'");
|
||||
cmd* c = new cmd;
|
||||
c->opcode = codes::DISP;
|
||||
c->args.push(buildValue(msg));
|
||||
c->args.push(buildValue(name));
|
||||
c->args.push(buildValue(msg));
|
||||
current_chunk->addCmd(c); // Add the cmd to the current chunk
|
||||
// We might have to consume a newline... Depends on what's next
|
||||
return true;
|
||||
}
|
||||
else if ((isBlock(bt_block) || isBlock(bt_method)) && stream->match(tokens::name,tokens::colon,tokens::cbracketo)) {
|
||||
std::string name = stream->next().name;
|
||||
cmd* c = new cmd;
|
||||
c->opcode = codes::SSPK;
|
||||
c->args.push(buildVariable(name));
|
||||
current_chunk->addCmd(c);
|
||||
// Command to set the speaker
|
||||
stream->next();
|
||||
stream->next();
|
||||
print("Doing disp!!!");
|
||||
while (stream->peek().type != tokens::cbracketc) {
|
||||
print(stream->peek());
|
||||
if (stream->match(tokens::name)) {
|
||||
std::string mode = stream->next().name;
|
||||
if (mode == "speed") {
|
||||
if (stream->match(tokens::number)) {
|
||||
buildSpeed(std::stod(stream->next().name));
|
||||
}
|
||||
else {
|
||||
badSymbol(stream);
|
||||
}
|
||||
}
|
||||
else if (mode == "wait") {
|
||||
if (stream->match(tokens::number)) {
|
||||
buildWait(std::stod(stream->next().name));
|
||||
}
|
||||
else {
|
||||
badSymbol(errors::disp_unknown, stream);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Assume we have a dact
|
||||
if (stream->match(tokens::string)) {
|
||||
cmd* c = new cmd;
|
||||
c->opcode = codes::DACT;
|
||||
c->args.push(buildVariable(mode));
|
||||
current_chunk->addCmd(c);
|
||||
}
|
||||
else {
|
||||
badSymbol(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (stream->match(tokens::string)) {
|
||||
|
||||
}
|
||||
else if (stream->match(tokens::newline)) {
|
||||
stream->next();
|
||||
}
|
||||
else {
|
||||
badSymbol(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
// emotion: "path"
|
||||
// looks like a simple disp command
|
||||
else if (isBlock(bt_character) && stream->match(tokens::tab, tokens::name, tokens::colon, tokens::string, tokens::newline)) {
|
||||
@ -122,7 +177,7 @@ namespace dms {
|
||||
stream->next();
|
||||
}
|
||||
else if (stream->match(tokens::cbracketo) && start) {
|
||||
state->push_error(errors::error{ errors::choice_unknown,concat("Unexpected symbol ",stream->next()),true,stream->peek().line_num,current_chunk });
|
||||
badSymbol(stream);
|
||||
}
|
||||
else if (stream->match(tokens::string)) {
|
||||
std::string name = stream->next().name;
|
||||
@ -148,7 +203,7 @@ namespace dms {
|
||||
stream->next(); // Consume
|
||||
}
|
||||
else {
|
||||
state->push_error(errors::error{ errors::choice_unknown,concat("Unexpected symbol ",stream->next()),true,stream->peek().line_num,current_chunk });
|
||||
badSymbol(stream);
|
||||
}
|
||||
}
|
||||
buildLabel(str);
|
||||
@ -282,7 +337,7 @@ namespace dms {
|
||||
}
|
||||
else {
|
||||
cleanup(tempval); // Cleanup
|
||||
state->push_error(errors::error{ errors::badtoken,concat("Invalid symbol: ",tempstream.peek()),true, tempstream.peek().line_num,current_chunk });
|
||||
badSymbol(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -23,11 +23,11 @@ namespace dms {
|
||||
if (myfile.is_open())
|
||||
{
|
||||
std::string line;
|
||||
rawdata << "\n\n"; // For things to work I added 2 newlines. The issue is with how I decided to parse things.
|
||||
rawdata << ";;"; // For things to work I added 2 newlines. The issue is with how I decided to parse things.
|
||||
// This way you are allowed to start a block at the top of the screen!
|
||||
while (std::getline(myfile, line)) {
|
||||
trim(line);
|
||||
rawdata << line << "\n";
|
||||
rawdata << line << ";\n";
|
||||
}
|
||||
myfile.close();
|
||||
//std::cout << rawdata.str() << std::endl;
|
||||
@ -53,9 +53,9 @@ namespace dms {
|
||||
}
|
||||
else if (data == '\n') {
|
||||
doCheck(&stream, &t_vec, line-2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::newline,codes::NOOP,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::newline,codes::NOOP,"",line });
|
||||
if (isNum) {
|
||||
t_vec.push_back(token{ tokens::number,codes::NOOP,stream.processBuffer(buffer),line - 2 });
|
||||
t_vec.push_back(token{ tokens::number,codes::NOOP,stream.processBuffer(buffer),line });
|
||||
buffer.clear();
|
||||
isNum = false;
|
||||
}
|
||||
@ -70,7 +70,7 @@ namespace dms {
|
||||
stream.next();
|
||||
}
|
||||
else if (data == ':' && stream.peek() == ':' && labelStart) {
|
||||
t_vec.push_back(token{ tokens::label,codes::NOOP,stream.processBuffer(buffer),line - 2 });
|
||||
t_vec.push_back(token{ tokens::label,codes::NOOP,stream.processBuffer(buffer),line });
|
||||
buffer.clear();
|
||||
stream.next();
|
||||
labelStart = false;
|
||||
@ -81,7 +81,7 @@ namespace dms {
|
||||
}
|
||||
else if (data == '"' && isStr) {
|
||||
isStr = false;
|
||||
t_vec.push_back(token{ tokens::string,codes::NOOP,stream.processBuffer(buffer),line - 2 });
|
||||
t_vec.push_back(token{ tokens::string,codes::NOOP,stream.processBuffer(buffer),line });
|
||||
buffer.clear();
|
||||
}
|
||||
else if (isStr) {
|
||||
@ -99,190 +99,184 @@ namespace dms {
|
||||
buffer.push_back(data);
|
||||
}
|
||||
else if (data == '.' && isNum && hasDec) {
|
||||
t_vec.push_back(token{ tokens::number,codes::ERRO,"Malformed number!",line - 2 });
|
||||
t_vec.push_back(token{ tokens::number,codes::ERRO,"Malformed number!",line });
|
||||
}
|
||||
else if (data == '[') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::bracketo,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::bracketo,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == ']') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::bracketc,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::bracketc,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '(') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::parao,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::parao,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == ')') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::parac,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::parac,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == ',') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::seperator,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::seperator,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '.') {
|
||||
//doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::dot,codes::NOOP,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::dot,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '{') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::cbracketo,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::cbracketo,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '}') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::cbracketc,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::cbracketc,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '+') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::plus,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::plus,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '-') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::minus,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::minus,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '*') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::multiply,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::multiply,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '/') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::divide,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::divide,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '^') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::caret,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::caret,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '%') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::percent,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::percent,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '=') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::equal,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::equal,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == ':') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::colon,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::colon,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == ';') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::newline,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::newline,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '!') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::exclamation,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::exclamation,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '~') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::tilde,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::tilde,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '`') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::backtick,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::backtick,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '@') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::at,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::at,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '#') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::pound,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::pound,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '$') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::dollar,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::dollar,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '&') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::ampersand,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::ampersand,codes::NOOP,"",line });
|
||||
}
|
||||
else if (data == '\t') {
|
||||
doCheck(&stream, &t_vec, line - 2, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::tab,codes::NOOP,"",line - 2 });
|
||||
doCheck(&stream, &t_vec, line, isNum, hasDec, &buffer);
|
||||
t_vec.push_back(token{ tokens::tab,codes::NOOP,"",line });
|
||||
}
|
||||
|
||||
if (data == ' ' && !isStr) { // tokens end with a space
|
||||
std::string str = stream.processBuffer(buffer);
|
||||
tolower(str);
|
||||
if (str == "enable") {
|
||||
t_vec.push_back(token{ tokens::flag,codes::ENAB,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::flag,codes::ENAB,"",line });
|
||||
}
|
||||
else if (str == "entry") {
|
||||
t_vec.push_back(token{ tokens::flag,codes::ENTR,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::flag,codes::ENTR,"",line });
|
||||
}
|
||||
else if (str == "loadfile") {
|
||||
t_vec.push_back(token{ tokens::flag,codes::LOAD,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::flag,codes::LOAD,"",line });
|
||||
}
|
||||
else if (str == "version") {
|
||||
t_vec.push_back(token{ tokens::flag,codes::VERN,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::flag,codes::VERN,"",line });
|
||||
}
|
||||
else if (str == "using") {
|
||||
t_vec.push_back(token{ tokens::flag,codes::USIN,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::flag,codes::USIN,"",line });
|
||||
}
|
||||
else if (str == "disable") {
|
||||
t_vec.push_back(token{ tokens::flag,codes::DISA,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::flag,codes::DISA,"",line });
|
||||
}
|
||||
else if (str == "if") {
|
||||
t_vec.push_back(token{ tokens::control,codes::IFFF,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::control,codes::IFFF,"",line });
|
||||
}
|
||||
else if (str == "elseif") {
|
||||
t_vec.push_back(token{ tokens::control,codes::ELIF,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::control,codes::ELIF,"",line });
|
||||
}
|
||||
else if (str == "while") {
|
||||
t_vec.push_back(token{ tokens::control,codes::WHLE,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::control,codes::WHLE,"",line });
|
||||
}
|
||||
else if (str == "true") {
|
||||
t_vec.push_back(token{ tokens::True,codes::NOOP,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::True,codes::NOOP,"",line });
|
||||
}
|
||||
else if (str == "false") {
|
||||
t_vec.push_back(token{ tokens::False,codes::NOOP,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::False,codes::NOOP,"",line });
|
||||
}
|
||||
else if (str == "else") {
|
||||
t_vec.push_back(token{ tokens::control,codes::ELSE,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::control,codes::ELSE,"",line });
|
||||
}
|
||||
else if (str == "and") {
|
||||
t_vec.push_back(token{ tokens::And,codes::NOOP,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::And,codes::NOOP,"",line });
|
||||
}
|
||||
else if (str == "or") {
|
||||
t_vec.push_back(token{ tokens::Or,codes::NOOP,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::Or,codes::NOOP,"",line });
|
||||
}
|
||||
else if (str == "for") {
|
||||
t_vec.push_back(token{ tokens::For,codes::NOOP,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::For,codes::NOOP,"",line });
|
||||
}
|
||||
else if (str == "choice") {
|
||||
t_vec.push_back(token{ tokens::control,codes::CHOI,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::control,codes::CHOI,"",line });
|
||||
}
|
||||
else if (str == "return") {
|
||||
t_vec.push_back(token{ tokens::ret,codes::RETN,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::ret,codes::RETN,"",line });
|
||||
}
|
||||
else if (str == "nil") {
|
||||
t_vec.push_back(token{ tokens::nil,codes::NOOP,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::nil,codes::NOOP,"",line });
|
||||
}
|
||||
else if (str == "goto") {
|
||||
t_vec.push_back(token{ tokens::gotoo,codes::NOOP,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::gotoo,codes::NOOP,"",line });
|
||||
}
|
||||
else if (str == "jump") {
|
||||
t_vec.push_back(token{ tokens::jump,codes::NOOP,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::jump,codes::NOOP,"",line });
|
||||
}
|
||||
else if (str == "exit") {
|
||||
t_vec.push_back(token{ tokens::exit,codes::NOOP,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::exit,codes::NOOP,"",line });
|
||||
}
|
||||
else if (str == "debug") {
|
||||
t_vec.push_back(token{ tokens::debug,codes::NOOP,"",line - 2 });
|
||||
t_vec.push_back(token{ tokens::debug,codes::NOOP,"",line });
|
||||
}
|
||||
else if (utils::isNum(str) && str.size()!=0) {
|
||||
t_vec.push_back(token{ tokens::number,codes::NOOP,stream.processBuffer(buffer),line - 2 });
|
||||
t_vec.push_back(token{ tokens::number,codes::NOOP,stream.processBuffer(buffer),line });
|
||||
isNum = false;
|
||||
}
|
||||
else if (utils::isalphanum(str) && str.size() > 0) {
|
||||
t_vec.push_back(token{ tokens::name,codes::NOOP,stream.processBuffer(buffer),line - 2 });
|
||||
}
|
||||
else {
|
||||
// Unknown command!
|
||||
/*tok.build(tokens::noop, codes::UNWN);
|
||||
tok.name = str;
|
||||
tok.line_num = line;*/
|
||||
t_vec.push_back(token{ tokens::name,codes::NOOP,stream.processBuffer(buffer),line });
|
||||
}
|
||||
buffer.clear();
|
||||
}
|
||||
@ -306,7 +300,7 @@ namespace dms {
|
||||
void LineParser::_Parse(tokenstream stream) {
|
||||
token current = stream.next();
|
||||
while (stream.peek().type != tokens::eof) {
|
||||
//print(current);
|
||||
print(current);
|
||||
if (current.type == tokens::flag) {
|
||||
temp = stream.next(tokens::newline);
|
||||
stream.prev(); // Unconsume the newline piece
|
||||
@ -343,7 +337,8 @@ namespace dms {
|
||||
}
|
||||
}
|
||||
// Default block
|
||||
if (stream.match(tokens::newline, tokens::bracketo, tokens::name, tokens::bracketc)) {
|
||||
if (stream.match(tokens::newline,tokens::bracketo, tokens::name, tokens::bracketc)) {
|
||||
stream.next();
|
||||
stream.next();
|
||||
std::string name = stream.next().name;
|
||||
createBlock(name, bt_block);
|
||||
@ -432,6 +427,6 @@ namespace dms {
|
||||
// tabs = 0;
|
||||
current = stream.next();
|
||||
}
|
||||
state->push_chunk(current_chunk->name, current_chunk);
|
||||
createBlock("$END$", bt_block);
|
||||
}
|
||||
}
|
||||
@ -82,6 +82,7 @@ namespace dms {
|
||||
return isBlock(bt_block); // Default block type
|
||||
}
|
||||
bool LineParser::isBlock(blocktype bk_type) {
|
||||
//print();
|
||||
if (current_chunk == nullptr) {
|
||||
return false; // If a chunk wasn't defined then code was probably defined outside of a block
|
||||
}
|
||||
@ -155,6 +156,27 @@ namespace dms {
|
||||
}
|
||||
}
|
||||
}
|
||||
void LineParser::badSymbol(errors::errortype err,tokenstream* stream) {
|
||||
state->push_error(errors::error{ err,concat("Unexpected symbol '",stream->next().toString(),"'"),true,stream->peek().line_num,current_chunk });
|
||||
}
|
||||
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 });
|
||||
}
|
||||
void LineParser::badSymbol() {
|
||||
state->push_error(errors::error{ errors::unknown,concat("Unexpected symbol '",_stream->next().toString(),"'"),true,_stream->peek().line_num,current_chunk });
|
||||
}
|
||||
void LineParser::buildSpeed(double s) {
|
||||
cmd* c = new cmd;
|
||||
c->opcode = codes::DSPD;
|
||||
c->args.push(buildValue(s));
|
||||
current_chunk->addCmd(c);
|
||||
}
|
||||
void LineParser::buildWait(double w) {
|
||||
cmd* c = new cmd;
|
||||
c->opcode = codes::WAIT;
|
||||
c->args.push(buildValue(w));
|
||||
current_chunk->addCmd(c);
|
||||
}
|
||||
bool LineParser::createBlock(std::string bk_name, blocktype bk_type) {
|
||||
if (current_chunk != nullptr) {
|
||||
if (!state->chunks.count(current_chunk->name))
|
||||
@ -176,6 +198,7 @@ namespace dms {
|
||||
void LineParser::tokenizer(dms_state* state,std::vector<token> &toks) {
|
||||
tokenstream stream;
|
||||
stream.init(&toks);
|
||||
_stream = &stream;
|
||||
this->state = state; // Grab the pointer to the state and store it within the parser object
|
||||
_Parse(stream);
|
||||
}
|
||||
|
||||
@ -1,5 +1,17 @@
|
||||
#include "chunk.h"
|
||||
namespace dms {
|
||||
std::string getBlockType(const blocktype b) {
|
||||
if (b == bt_block)
|
||||
return "block";
|
||||
if (b == bt_method)
|
||||
return "method";
|
||||
if (b == bt_env)
|
||||
return "env";
|
||||
if (b == bt_character)
|
||||
return "character";
|
||||
if (b == bt_menu)
|
||||
return "menu";
|
||||
}
|
||||
void chunk::addCmd(cmd* c) {
|
||||
cmds.push_back(c);
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
#include "cmd.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
namespace dms {
|
||||
@ -10,6 +11,7 @@ namespace dms {
|
||||
bt_character,
|
||||
bt_menu
|
||||
};
|
||||
std::string getBlockType(const blocktype b);
|
||||
struct chunk
|
||||
{
|
||||
blocktype type = bt_block;
|
||||
|
||||
@ -1,3 +1,40 @@
|
||||
#pragma once
|
||||
#include "Codes.h"
|
||||
const std::string dms::codes::list[] = { "NOOP","ENTR","ENAB","DISA","LOAD","VERN","USIN","STAT","DISP","ASGN","LABL","CHOI","OPTN","FORE","????","WHLE","FUNC","IFFF","ELIF","ELSE","DEFN","SKIP","COMP","INDX","JMPZ","INST","ERRO" ,"GOTO","JUMP","RETN", "EXIT", "DEBG" };
|
||||
const std::string dms::codes::list[] = {
|
||||
"NOOP",
|
||||
"ENTR",
|
||||
"ENAB",
|
||||
"DISA",
|
||||
"LOAD",
|
||||
"VERN",
|
||||
"USIN",
|
||||
"STAT",
|
||||
"DISP",
|
||||
"ASGN",
|
||||
"LABL",
|
||||
"CHOI",
|
||||
"OPTN",
|
||||
"FORE",
|
||||
"WHLE",
|
||||
"FUNC",
|
||||
"IFFF",
|
||||
"ELIF",
|
||||
"ELSE",
|
||||
"DEFN",
|
||||
"SKIP",
|
||||
"COMP",
|
||||
"INDX",
|
||||
"JMPZ",
|
||||
"INST",
|
||||
"ERRO",
|
||||
"GOTO",
|
||||
"JUMP",
|
||||
"RETN",
|
||||
"EXIT",
|
||||
"DEBG",
|
||||
"DSPD",
|
||||
"DACT",
|
||||
"WAIT",
|
||||
"APND",
|
||||
"SSPK"
|
||||
};
|
||||
@ -17,7 +17,6 @@ namespace dms::codes {
|
||||
CHOI,
|
||||
OPTN,
|
||||
FORE,
|
||||
UNWN,
|
||||
WHLE,
|
||||
FUNC,
|
||||
IFFF,
|
||||
@ -34,7 +33,12 @@ namespace dms::codes {
|
||||
JUMP,
|
||||
RETN,
|
||||
EXIT,
|
||||
DEBG
|
||||
DEBG,
|
||||
DSPD,
|
||||
DACT,
|
||||
WAIT,
|
||||
APND,
|
||||
SSPK
|
||||
};
|
||||
extern const std::string list[];
|
||||
static bool isControl(const op code) {
|
||||
|
||||
24
DMS/diaplsy cmd.txt
Normal file
24
DMS/diaplsy cmd.txt
Normal file
@ -0,0 +1,24 @@
|
||||
Chat Stuff
|
||||
--------------------------------------------------------------------------
|
||||
DISP spk "msg" display message from a speaker
|
||||
DSPD # set display speed
|
||||
DACT path
|
||||
WAIT # delay until next cmd is processed
|
||||
APND "msg" appends text to last message, keeping all applied stats
|
||||
SSPK spk sets the speaker
|
||||
|
||||
Ryan: {
|
||||
speed 100
|
||||
calm "Hello Bob, "
|
||||
wait 0.455
|
||||
excited "how are you doing? "
|
||||
"It's a nice day we are having!"
|
||||
}
|
||||
|
||||
DISP ""
|
||||
DSPD Ryan 100
|
||||
DACT Ryan [path defined by: Ryan.calm]
|
||||
APND Ryan "Hello Bob, "
|
||||
WAIT 0.455
|
||||
DACT Ryan [path defined by: Ryan.excited]
|
||||
APND "how are you doing?"
|
||||
@ -2,11 +2,11 @@
|
||||
namespace dms {
|
||||
dms_state::dms_state() {
|
||||
// We should define the defaults for the enables
|
||||
//chunks.insert_or_assign("leaking",false);
|
||||
//chunks.insert_or_assign("debugging",false);
|
||||
//chunks.insert_or_assign("warnings",false); //
|
||||
//chunks.insert_or_assign("statesave",true); // Allows you to save state
|
||||
//chunks.insert_or_assign("omniscient",true); // Allows you to know who's who when you first meet them
|
||||
enables.insert_or_assign("leaking",false);
|
||||
enables.insert_or_assign("debugging",false);
|
||||
enables.insert_or_assign("warnings",false); //
|
||||
enables.insert_or_assign("statesave",true); // Allows you to save state
|
||||
enables.insert_or_assign("omniscient",true); // Allows you to know who's who when you first meet them
|
||||
}
|
||||
bool dms_state::isEnabled(std::string flag) {
|
||||
if (enables.count(flag)) {
|
||||
@ -18,7 +18,7 @@ namespace dms {
|
||||
std::cout << std::endl << "STATE DUMP" << std::endl << "Number of chunks: " << chunks.size();
|
||||
std::ofstream outputFile("dump.bin");
|
||||
for (const auto& [key, val] : chunks) {
|
||||
std::cout << "Key: " << key << " Value: " << *val << '\n';
|
||||
std::cout << "Key: " << key << "<" << getBlockType(val->type) << ">" << std::endl << *val << std::endl;
|
||||
}
|
||||
//If the error has a chunk then we get the data from it
|
||||
if (err.current_chunk != nullptr) {
|
||||
@ -27,10 +27,10 @@ namespace dms {
|
||||
outputFile.close();
|
||||
}
|
||||
void dms_state::dump() {
|
||||
std::cout << "Number of chunks: " << chunks.size();
|
||||
std::cout << "Number of chunks: " << chunks.size() << std::endl;
|
||||
std::ofstream outputFile("dump.bin");
|
||||
for (const auto& [key, val] : chunks) {
|
||||
std::cout << "Key: " << key << " Value: " << *val << '\n';
|
||||
std::cout << "Key: " << key << "<" << getBlockType(val->type) << ">" << std::endl << *val << std::endl;
|
||||
}
|
||||
outputFile.close();
|
||||
}
|
||||
@ -39,11 +39,9 @@ namespace dms {
|
||||
}
|
||||
void dms_state::push_error(errors::error err) {
|
||||
std::cout << err.err_msg << " On Line <" << err.linenum << ">" << std::endl;
|
||||
if (err.crash) {
|
||||
dump(err);
|
||||
if (err.crash)
|
||||
std::exit(err.code);
|
||||
}
|
||||
}
|
||||
void dms_state::push_warning(errors::error err) {
|
||||
err.crash = false; // Force code to not crash then push the error
|
||||
if(enables.count("warnings"))
|
||||
|
||||
32
DMS/dump.txt
32
DMS/dump.txt
@ -1,21 +1,25 @@
|
||||
Token Dump:
|
||||
Line <4294967295>NOOP newline
|
||||
Line <0>NOOP newline
|
||||
Line <1>NOOP newline
|
||||
Line <1>NOOP newline
|
||||
Line <1>NOOP bracketo
|
||||
Line <1>NOOP name default
|
||||
Line <1>NOOP colon
|
||||
Line <1>NOOP name char
|
||||
Line <1>NOOP bracketc
|
||||
Line <1>NOOP newline
|
||||
Line <1>NOOP newline
|
||||
Line <2>NOOP newline
|
||||
Line <3>NOOP name money
|
||||
Line <3>NOOP equal
|
||||
Line <3>NOOP number 0
|
||||
Line <3>NOOP newline
|
||||
Line <3>NOOP newline
|
||||
Line <4>NOOP name test
|
||||
Line <4>NOOP equal
|
||||
Line <4>NOOP nil nil
|
||||
Line <4>NOOP newline
|
||||
Line <4>NOOP newline
|
||||
Line <5>NOOP newline
|
||||
Line <5>NOOP newline
|
||||
Line <6>NOOP bracketo
|
||||
Line <6>NOOP name Ryan
|
||||
@ -23,23 +27,29 @@ Line <6>NOOP colon
|
||||
Line <6>NOOP name char
|
||||
Line <6>NOOP bracketc
|
||||
Line <6>NOOP newline
|
||||
Line <6>NOOP newline
|
||||
Line <7>NOOP name age
|
||||
Line <7>NOOP equal
|
||||
Line <7>NOOP number 21
|
||||
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 <9>NOOP newline
|
||||
Line <10>NOOP name calm
|
||||
Line <10>NOOP colon
|
||||
Line <10>NOOP string ./path/to/file
|
||||
Line <10>NOOP newline
|
||||
Line <10>NOOP newline
|
||||
Line <11>NOOP name excited
|
||||
Line <11>NOOP colon
|
||||
Line <11>NOOP string ./path/to/file
|
||||
Line <11>NOOP newline
|
||||
Line <11>NOOP newline
|
||||
Line <12>NOOP newline
|
||||
Line <12>NOOP newline
|
||||
Line <13>NOOP bracketo
|
||||
Line <13>NOOP name step
|
||||
@ -54,6 +64,7 @@ Line <13>NOOP name c
|
||||
Line <13>NOOP parac
|
||||
Line <13>NOOP bracketc
|
||||
Line <13>NOOP newline
|
||||
Line <13>NOOP newline
|
||||
Line <14>NOOP string Testing...
|
||||
Line <14>NOOP newline
|
||||
Line <15>NOOP name d
|
||||
@ -66,21 +77,27 @@ Line <15>NOOP parac
|
||||
Line <15>NOOP divide
|
||||
Line <15>NOOP name c
|
||||
Line <15>NOOP newline
|
||||
Line <15>NOOP newline
|
||||
Line <16>NOOP name e
|
||||
Line <16>NOOP equal
|
||||
Line <16>NOOP string somestring
|
||||
Line <16>NOOP newline
|
||||
Line <16>NOOP newline
|
||||
Line <17>NOOP name e
|
||||
Line <17>NOOP equal
|
||||
Line <17>NOOP nil nil
|
||||
Line <17>NOOP newline
|
||||
Line <17>NOOP newline
|
||||
Line <18>NOOP name g
|
||||
Line <18>NOOP equal
|
||||
Line <18>NOOP false false
|
||||
Line <18>NOOP newline
|
||||
Line <18>NOOP newline
|
||||
Line <19>RETN ret
|
||||
Line <19>NOOP name d
|
||||
Line <19>NOOP newline
|
||||
Line <19>NOOP newline
|
||||
Line <20>NOOP newline
|
||||
Line <20>NOOP newline
|
||||
Line <21>NOOP bracketo
|
||||
Line <21>NOOP name inventory
|
||||
@ -88,44 +105,53 @@ Line <21>NOOP colon
|
||||
Line <21>NOOP name env
|
||||
Line <21>NOOP bracketc
|
||||
Line <21>NOOP newline
|
||||
Line <21>NOOP newline
|
||||
Line <22>NOOP name slot1
|
||||
Line <22>NOOP number
|
||||
Line <22>NOOP equal
|
||||
Line <22>NOOP string
|
||||
Line <22>NOOP newline
|
||||
Line <22>NOOP newline
|
||||
Line <23>NOOP name slot2
|
||||
Line <23>NOOP number
|
||||
Line <23>NOOP equal
|
||||
Line <23>NOOP string
|
||||
Line <23>NOOP newline
|
||||
Line <23>NOOP newline
|
||||
Line <24>NOOP name slot3
|
||||
Line <24>NOOP number
|
||||
Line <24>NOOP equal
|
||||
Line <24>NOOP string
|
||||
Line <24>NOOP newline
|
||||
Line <24>NOOP newline
|
||||
Line <25>NOOP name slot4
|
||||
Line <25>NOOP number
|
||||
Line <25>NOOP equal
|
||||
Line <25>NOOP string
|
||||
Line <25>NOOP newline
|
||||
Line <25>NOOP newline
|
||||
Line <26>NOOP name slot5
|
||||
Line <26>NOOP number
|
||||
Line <26>NOOP equal
|
||||
Line <26>NOOP string
|
||||
Line <26>NOOP newline
|
||||
Line <26>NOOP newline
|
||||
Line <27>NOOP name slot6
|
||||
Line <27>NOOP number
|
||||
Line <27>NOOP equal
|
||||
Line <27>NOOP string
|
||||
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 <29>NOOP name slot8
|
||||
Line <29>NOOP number
|
||||
Line <29>NOOP equal
|
||||
Line <29>NOOP string
|
||||
Line <29>NOOP newline
|
||||
Line <31>NOOP eof
|
||||
Line <29>NOOP newline
|
||||
Line <29>NOOP eof
|
||||
|
||||
@ -11,7 +11,8 @@ namespace dms::errors {
|
||||
badtoken,
|
||||
block_already_defined,
|
||||
choice_unknown,
|
||||
nested_function
|
||||
nested_function,
|
||||
disp_unknown
|
||||
};
|
||||
struct error {
|
||||
errortype code=unknown;
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
excited: "./path/to/file"
|
||||
|
||||
[step:function(a,b,c)]
|
||||
"Testing..."
|
||||
"Testing..." // testing
|
||||
d = (100 + b) / c
|
||||
e = "somestring"
|
||||
e = nil
|
||||
|
||||
11
DMS/test.dms
11
DMS/test.dms
@ -1,17 +1,20 @@
|
||||
entry main
|
||||
enable warnings
|
||||
disable omniscient
|
||||
//enable debugging
|
||||
enable debugging
|
||||
loadfile "loadtest.dms"
|
||||
version 1.2
|
||||
using extendedDefine
|
||||
|
||||
[testblockpro]
|
||||
"hehe"
|
||||
|
||||
[main] {
|
||||
[main]
|
||||
Ryan: "This works!"
|
||||
DEBUG "What's up" // Debug lines are removed when debug mode is disabled
|
||||
Ryan: {
|
||||
speed 100%;calm "Hello Bob, "
|
||||
true
|
||||
speed 100;calm "Hello Bob, "
|
||||
wait 0.455
|
||||
excited "how are you doing?"
|
||||
// Becomes: Hello Bob, how are you doing?
|
||||
@ -62,7 +65,6 @@ using extendedDefine
|
||||
"nine" exit
|
||||
"ten" exit 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -73,3 +75,4 @@ using extendedDefine
|
||||
[newblock:function()]
|
||||
"Test #2"
|
||||
"Does it parse this part properly?"
|
||||
"huh"
|
||||
|
||||
@ -68,8 +68,13 @@ namespace dms::tokens {
|
||||
raw = o;
|
||||
name = s;
|
||||
}
|
||||
std::string toString() {
|
||||
std::stringstream str;
|
||||
str << name;
|
||||
return str.str();
|
||||
}
|
||||
friend std::ostream& operator << (std::ostream& out, const token& c) {
|
||||
const std::string temp1[] = {
|
||||
const std::string tokenlist[] = {
|
||||
"none",
|
||||
"noop",
|
||||
"flag",
|
||||
@ -116,7 +121,7 @@ namespace dms::tokens {
|
||||
"ampersand",
|
||||
"nil"
|
||||
};
|
||||
out << "Line <" << c.line_num << ">" << codes::list[c.raw] << " " << temp1[c.type] << " \t\t " << c.name;
|
||||
out << "Line <" << c.line_num << ">" << codes::list[c.raw] << " " << tokenlist[c.type] << " \t\t " << c.name;
|
||||
return out;
|
||||
}
|
||||
};
|
||||
|
||||
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