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();
|
||||
}
|
||||
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
|
||||
throw coreutils::Exception("expecting name subfield in received CGI data.");
|
||||
} else
|
||||
|
1
Global.h
1
Global.h
@ -27,6 +27,7 @@ namespace jet {
|
||||
void outputHeaders();
|
||||
void setupFormData(coreutils::ZString &formdata);
|
||||
void setupFormURLEncoded(coreutils::ZString &formdata);
|
||||
char *errorCursor = NULL;
|
||||
|
||||
std::map<coreutils::MString, coreutils::MString> variables;
|
||||
std::map<coreutils::MString, coreutils::MString> cgiVariables;
|
||||
|
10
Tag.cpp
10
Tag.cpp
@ -31,6 +31,7 @@ namespace jet {
|
||||
Tag::Tag(coreutils::ZString &in, coreutils::MString &parentOut, Global &global, Tag *parent, coreutils::ZString splitTagName)
|
||||
: ZString(in), parentOut(parentOut), global(global), parent(parent) {
|
||||
this->splitTagName = splitTagName;
|
||||
global.errorCursor = in.getCursor();
|
||||
if(parent && in.ifNext("<")) {
|
||||
name = in.getTokenInclude("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_!");
|
||||
if(in.startsWith(" ") || in.startsWith("/") || in.startsWith(">")) {
|
||||
@ -196,15 +197,14 @@ namespace jet {
|
||||
in.ifNext("/>");
|
||||
continue;
|
||||
} else {
|
||||
out.write(in.charAt(0));
|
||||
in.nextChar();
|
||||
out.write(in.nextChar());
|
||||
continue;
|
||||
}
|
||||
} else if(in.startsWith("$[") || in.startsWith("#[")) {
|
||||
} else if(in.startsWith("$[") || in.startsWith("#[")) {
|
||||
global.errorCursor = in.getCursor();
|
||||
out.write(global.getVariable(in, variables));
|
||||
} else {
|
||||
out.write(in.charAt(0));
|
||||
in.nextChar();
|
||||
out.write(in.nextChar());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
4
__tag.h
4
__tag.h
@ -3,6 +3,8 @@
|
||||
|
||||
#include "Tag.h"
|
||||
#include "ZString.h"
|
||||
#include "MString.h"
|
||||
#include <map>
|
||||
|
||||
namespace jet {
|
||||
|
||||
@ -10,6 +12,8 @@ namespace jet {
|
||||
|
||||
public:
|
||||
__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 {
|
||||
coreutils::MString out;
|
||||
data.reset();
|
||||
global.errorCursor = data.getCursor();
|
||||
jet::__jet *jet = new jet::__jet(data, out, global, NULL);
|
||||
delete jet;
|
||||
global.outputHeaders();
|
||||
std::cout << out;
|
||||
}
|
||||
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 << "******** Error caught: " << e.text << std::endl;
|
||||
std::cout << data.unparsed() << std::endl;
|
||||
std::cout << "Error caught: " << e.text << std::endl;
|
||||
global.dump();
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
$[modified1;$[tohex]]
|
||||
<set name="complete" value="$[modified1];$[tohex]" />
|
||||
$[complete]
|
||||
<set name="" value="xxx" />
|
||||
the unnamed variable value: [$[]]
|
||||
---
|
||||
$[nonexistant]
|
||||
$[%HOME]
|
||||
@ -21,7 +23,8 @@
|
||||
<set name="division" expr="5/3" />
|
||||
<set name="divisor" value="8" />
|
||||
<set name="nested" expr="(2*(4+4)/$[divisor])*32" />
|
||||
$[nested]
|
||||
<set name="error" value="$[$x]" />
|
||||
$[$nested]
|
||||
<set name="numbers">0123456789</set>
|
||||
<set name="lefty" expr="LEFT($[numbers],5)" />
|
||||
lefty=[$[lefty]]
|
||||
|
Loading…
x
Reference in New Issue
Block a user