error reporting now reports accurately to the line.
This commit is contained in:
parent
79d68d6c34
commit
e3d788bc92
@ -165,7 +165,7 @@ namespace jet {
|
|||||||
formdata.goeol();
|
formdata.goeol();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
throw coreutils::Exception("expecting closing double quote on vairable name in received CGI data.");
|
throw coreutils::Exception("expecting closing double quote on variable name in received CGI data.");
|
||||||
} else
|
} else
|
||||||
throw coreutils::Exception("expecting name subfield in received CGI data.");
|
throw coreutils::Exception("expecting name subfield in received CGI data.");
|
||||||
} else
|
} else
|
||||||
|
1
Global.h
1
Global.h
@ -27,6 +27,7 @@ namespace jet {
|
|||||||
void outputHeaders();
|
void outputHeaders();
|
||||||
void setupFormData(coreutils::ZString &formdata);
|
void setupFormData(coreutils::ZString &formdata);
|
||||||
void setupFormURLEncoded(coreutils::ZString &formdata);
|
void setupFormURLEncoded(coreutils::ZString &formdata);
|
||||||
|
char *errorCursor = NULL;
|
||||||
|
|
||||||
std::map<coreutils::MString, coreutils::MString> variables;
|
std::map<coreutils::MString, coreutils::MString> variables;
|
||||||
std::map<coreutils::MString, coreutils::MString> cgiVariables;
|
std::map<coreutils::MString, coreutils::MString> cgiVariables;
|
||||||
|
8
Tag.cpp
8
Tag.cpp
@ -31,6 +31,7 @@ namespace jet {
|
|||||||
Tag::Tag(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, coreutils::ZString splitTagName)
|
Tag::Tag(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, coreutils::ZString splitTagName)
|
||||||
: ZString(in), parentOut(parentOut), global(global), parent(parent) {
|
: ZString(in), parentOut(parentOut), global(global), parent(parent) {
|
||||||
this->splitTagName = splitTagName;
|
this->splitTagName = splitTagName;
|
||||||
|
global.errorCursor = in.getCursor();
|
||||||
if(parent && in.ifNext("<")) {
|
if(parent && in.ifNext("<")) {
|
||||||
name = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_!");
|
name = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_!");
|
||||||
if(in.startsWith(" ") || in.startsWith("/") || in.startsWith(">")) {
|
if(in.startsWith(" ") || in.startsWith("/") || in.startsWith(">")) {
|
||||||
@ -196,15 +197,14 @@ namespace jet {
|
|||||||
in.ifNext("/>");
|
in.ifNext("/>");
|
||||||
continue;
|
continue;
|
||||||
} else {
|
} else {
|
||||||
out.write(in.charAt(0));
|
out.write(in.nextChar());
|
||||||
in.nextChar();
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if(in.startsWith("$[") || in.startsWith("#[")) {
|
} else if(in.startsWith("$[") || in.startsWith("#[")) {
|
||||||
|
global.errorCursor = in.getCursor();
|
||||||
out.write(global.getVariable(in, variables));
|
out.write(global.getVariable(in, variables));
|
||||||
} else {
|
} else {
|
||||||
out.write(in.charAt(0));
|
out.write(in.nextChar());
|
||||||
in.nextChar();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
4
__tag.h
4
__tag.h
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "Tag.h"
|
#include "Tag.h"
|
||||||
#include "ZString.h"
|
#include "ZString.h"
|
||||||
|
#include "MString.h"
|
||||||
|
#include <map>
|
||||||
|
|
||||||
namespace jet {
|
namespace jet {
|
||||||
|
|
||||||
@ -11,6 +13,8 @@ namespace jet {
|
|||||||
public:
|
public:
|
||||||
__tag(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent);
|
__tag(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent);
|
||||||
|
|
||||||
|
std::map<coreutils::MString, coreutils::MString> tags;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -16,16 +16,23 @@ int main(int argc, char **argv, char **envp) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
coreutils::MString out;
|
coreutils::MString out;
|
||||||
|
data.reset();
|
||||||
|
global.errorCursor = data.getCursor();
|
||||||
jet::__jet *jet = new jet::__jet(data, out, global, NULL);
|
jet::__jet *jet = new jet::__jet(data, out, global, NULL);
|
||||||
delete jet;
|
delete jet;
|
||||||
global.outputHeaders();
|
global.outputHeaders();
|
||||||
std::cout << out;
|
std::cout << out;
|
||||||
}
|
}
|
||||||
catch(coreutils::Exception e) {
|
catch(coreutils::Exception e) {
|
||||||
|
data.setCursor(global.errorCursor);
|
||||||
|
data.moveBackToLineStart();
|
||||||
|
std::cout << "-----------------------------" << std::endl;
|
||||||
|
std::cout << "Error in jet script '" << argv[1] << "' at line " << data.getLineNumberAtCursor() << std::endl;
|
||||||
|
std::cout << "Error text: " << e.text << std::endl;
|
||||||
|
std::cout << "-----------------------------" << std::endl;
|
||||||
std::cout << data.parsed() << std::endl;
|
std::cout << data.parsed() << std::endl;
|
||||||
std::cout << "******** Error caught: " << e.text << std::endl;
|
std::cout << "******** Error caught: " << e.text << std::endl;
|
||||||
std::cout << data.unparsed() << std::endl;
|
std::cout << data.unparsed() << std::endl;
|
||||||
std::cout << "Error caught: " << e.text << std::endl;
|
|
||||||
global.dump();
|
global.dump();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,8 @@
|
|||||||
$[modified1;$[tohex]]
|
$[modified1;$[tohex]]
|
||||||
<set name="complete" value="$[modified1];$[tohex]" />
|
<set name="complete" value="$[modified1];$[tohex]" />
|
||||||
$[complete]
|
$[complete]
|
||||||
|
<set name="" value="xxx" />
|
||||||
|
the unnamed variable value: [$[]]
|
||||||
---
|
---
|
||||||
$[nonexistant]
|
$[nonexistant]
|
||||||
$[%HOME]
|
$[%HOME]
|
||||||
@ -21,7 +23,8 @@
|
|||||||
<set name="division" expr="5/3" />
|
<set name="division" expr="5/3" />
|
||||||
<set name="divisor" value="8" />
|
<set name="divisor" value="8" />
|
||||||
<set name="nested" expr="(2*(4+4)/$[divisor])*32" />
|
<set name="nested" expr="(2*(4+4)/$[divisor])*32" />
|
||||||
$[nested]
|
<set name="error" value="$[$x]" />
|
||||||
|
$[$nested]
|
||||||
<set name="numbers">0123456789</set>
|
<set name="numbers">0123456789</set>
|
||||||
<set name="lefty" expr="LEFT($[numbers],5)" />
|
<set name="lefty" expr="LEFT($[numbers],5)" />
|
||||||
lefty=[$[lefty]]
|
lefty=[$[lefty]]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user