mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-13 05:57:00 -04:00
Improved position reporting of script errors
git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@931 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -399,6 +399,7 @@ label:
|
|||||||
mode: Mode
|
mode: Mode
|
||||||
uses: Uses
|
uses: Uses
|
||||||
reminder: Reminder text
|
reminder: Reminder text
|
||||||
|
rules: Additional rules
|
||||||
standard keyword:
|
standard keyword:
|
||||||
This is a standard %s keyword, you can not edit it.
|
This is a standard %s keyword, you can not edit it.
|
||||||
If you make a copy of the keyword your copy will take precedent.
|
If you make a copy of the keyword your copy will take precedent.
|
||||||
@@ -691,6 +692,9 @@ error:
|
|||||||
in function %s
|
in function %s
|
||||||
in parameter:
|
in parameter:
|
||||||
Parameter %s: %s
|
Parameter %s: %s
|
||||||
|
in keyword reminder:
|
||||||
|
%s
|
||||||
|
in reminder text of keyword '%s'
|
||||||
|
|
||||||
# Image stuff
|
# Image stuff
|
||||||
coordinates for blending overlap: Coordinates for blending overlap
|
coordinates for blending overlap: Coordinates for blending overlap
|
||||||
|
|||||||
@@ -59,20 +59,20 @@ KeywordsPanel::KeywordsPanel(Window* parent, int id)
|
|||||||
sp = new wxBoxSizer(wxVERTICAL);
|
sp = new wxBoxSizer(wxVERTICAL);
|
||||||
sp->Add(fixed, 0, wxEXPAND); sp->Show(fixed,false);
|
sp->Add(fixed, 0, wxEXPAND); sp->Show(fixed,false);
|
||||||
wxSizer* s1 = new wxBoxSizer(wxVERTICAL);
|
wxSizer* s1 = new wxBoxSizer(wxVERTICAL);
|
||||||
s1->Add(new wxStaticText(panel, wxID_ANY, _("Keyword:")), 0);
|
s1->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("keyword")+_(":")), 0);
|
||||||
s1->Add(keyword, 0, wxEXPAND | wxTOP, 2);
|
s1->Add(keyword, 0, wxEXPAND | wxTOP, 2);
|
||||||
s1->Add(new wxStaticText(panel, wxID_ANY, _("Mode:")), 0, wxTOP, 2);
|
s1->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("mode")+_(":")), 0, wxTOP, 2);
|
||||||
s1->Add(mode, 0, wxEXPAND | wxTOP, 2);
|
s1->Add(mode, 0, wxEXPAND | wxTOP, 2);
|
||||||
sp->Add(s1, 0, wxEXPAND | wxLEFT, 2);
|
sp->Add(s1, 0, wxEXPAND | wxLEFT, 2);
|
||||||
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8);
|
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8);
|
||||||
wxSizer* s2 = new wxBoxSizer(wxVERTICAL);
|
wxSizer* s2 = new wxBoxSizer(wxVERTICAL);
|
||||||
s2->Add(new wxStaticText(panel, wxID_ANY, _("Match:")), 0);
|
s2->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("match")+_(":")), 0);
|
||||||
s2->Add(match, 0, wxEXPAND | wxTOP, 2);
|
s2->Add(match, 0, wxEXPAND | wxTOP, 2);
|
||||||
s2->Add(add_param, 0, wxALIGN_LEFT | wxTOP, 2);
|
s2->Add(add_param, 0, wxALIGN_LEFT | wxTOP, 2);
|
||||||
sp->Add(s2, 0, wxEXPAND | wxLEFT, 2);
|
sp->Add(s2, 0, wxEXPAND | wxLEFT, 2);
|
||||||
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8);
|
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8);
|
||||||
wxSizer* s3 = new wxBoxSizer(wxVERTICAL);
|
wxSizer* s3 = new wxBoxSizer(wxVERTICAL);
|
||||||
s3->Add(new wxStaticText(panel, wxID_ANY, _("Reminder:")), 0);
|
s3->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("reminder")+_(":")), 0);
|
||||||
s3->Add(reminder, 1, wxEXPAND | wxTOP, 2);
|
s3->Add(reminder, 1, wxEXPAND | wxTOP, 2);
|
||||||
s3->Add(ref_param, 0, wxALIGN_LEFT | wxTOP, 2);
|
s3->Add(ref_param, 0, wxALIGN_LEFT | wxTOP, 2);
|
||||||
s3->Add(errors, 0, wxEXPAND | wxTOP, 4);
|
s3->Add(errors, 0, wxEXPAND | wxTOP, 4);
|
||||||
@@ -80,7 +80,7 @@ KeywordsPanel::KeywordsPanel(Window* parent, int id)
|
|||||||
sp->Add(s3, 1, wxEXPAND | wxLEFT, 2);
|
sp->Add(s3, 1, wxEXPAND | wxLEFT, 2);
|
||||||
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8);
|
sp->Add(new wxStaticLine(panel), 0, wxEXPAND | wxTOP | wxBOTTOM, 8);
|
||||||
wxSizer* s4 = new wxBoxSizer(wxVERTICAL);
|
wxSizer* s4 = new wxBoxSizer(wxVERTICAL);
|
||||||
s4->Add(new wxStaticText(panel, wxID_ANY, _("Rules:")), 0);
|
s4->Add(new wxStaticText(panel, wxID_ANY, _LABEL_("rules")+_(":")), 0);
|
||||||
s4->Add(rules, 1, wxEXPAND | wxTOP, 2);
|
s4->Add(rules, 1, wxEXPAND | wxTOP, 2);
|
||||||
sp->Add(s4, 1, wxEXPAND | wxLEFT, 2);
|
sp->Add(s4, 1, wxEXPAND | wxLEFT, 2);
|
||||||
panel->SetSizer(sp);
|
panel->SetSizer(sp);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# This file contains the keys expected to be in MSE locales
|
# This file contains the keys expected to be in MSE locales
|
||||||
# It was automatically generated by tools/locale/locale.pl
|
# It was automatically generated by tools/locale/locale.pl
|
||||||
# Generated on Sat May 31 21:42:09 2008
|
# Generated on Sun Jun 1 02:54:59 2008
|
||||||
|
|
||||||
action:
|
action:
|
||||||
add control point: 0
|
add control point: 0
|
||||||
@@ -104,6 +104,7 @@ error:
|
|||||||
has no member value: 2
|
has no member value: 2
|
||||||
images used for blending must have the same size: 0
|
images used for blending must have the same size: 0
|
||||||
in function: 2
|
in function: 2
|
||||||
|
in keyword reminder: 2
|
||||||
in parameter: 2
|
in parameter: 2
|
||||||
install packages successful: 1
|
install packages successful: 1
|
||||||
installing updates: 0
|
installing updates: 0
|
||||||
@@ -291,6 +292,7 @@ label:
|
|||||||
reminder: 0
|
reminder: 0
|
||||||
remove package: 0
|
remove package: 0
|
||||||
result: 0
|
result: 0
|
||||||
|
rules: 0
|
||||||
save changes: 1
|
save changes: 1
|
||||||
select cards print: 0
|
select cards print: 0
|
||||||
select columns: 0
|
select columns: 0
|
||||||
|
|||||||
+20
-18
@@ -41,6 +41,7 @@ struct Token {
|
|||||||
TokenType type;
|
TokenType type;
|
||||||
String value;
|
String value;
|
||||||
bool newline; ///< Is there a newline between this token and the previous one?
|
bool newline; ///< Is there a newline between this token and the previous one?
|
||||||
|
size_t pos; ///< Start position of the token
|
||||||
|
|
||||||
inline bool operator == (TokenType t) const { return type == t; }
|
inline bool operator == (TokenType t) const { return type == t; }
|
||||||
inline bool operator != (TokenType t) const { return type != t; }
|
inline bool operator != (TokenType t) const { return type != t; }
|
||||||
@@ -92,7 +93,7 @@ class TokenIterator {
|
|||||||
stack<MoreInput> more; ///< Read tokens from here when we are done with the current input
|
stack<MoreInput> more; ///< Read tokens from here when we are done with the current input
|
||||||
|
|
||||||
/// Add a token to the buffer, with the current newline value, resets newline
|
/// Add a token to the buffer, with the current newline value, resets newline
|
||||||
void addToken(TokenType type, const String& value);
|
void addToken(TokenType type, const String& value, size_t start);
|
||||||
/// Read the next token, and add it to the buffer
|
/// Read the next token, and add it to the buffer
|
||||||
void readToken();
|
void readToken();
|
||||||
/// Read the next token which is a string (after the opening ")
|
/// Read the next token which is a string (after the opening ")
|
||||||
@@ -154,8 +155,8 @@ void TokenIterator::putBack() {
|
|||||||
buffer.insert(buffer.begin(), t);
|
buffer.insert(buffer.begin(), t);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TokenIterator::addToken(TokenType type, const String& value) {
|
void TokenIterator::addToken(TokenType type, const String& value, size_t start) {
|
||||||
Token t = {type, value, newline};
|
Token t = {type, value, newline, start};
|
||||||
buffer.push_back(t);
|
buffer.push_back(t);
|
||||||
newline = false;
|
newline = false;
|
||||||
}
|
}
|
||||||
@@ -170,7 +171,7 @@ void TokenIterator::readToken() {
|
|||||||
more.pop();
|
more.pop();
|
||||||
} else {
|
} else {
|
||||||
// EOF
|
// EOF
|
||||||
addToken(TOK_EOF, _("end of input"));
|
addToken(TOK_EOF, _("end of input"), input.size());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -200,7 +201,7 @@ void TokenIterator::readToken() {
|
|||||||
// name
|
// name
|
||||||
size_t start = pos - 1;
|
size_t start = pos - 1;
|
||||||
while (pos < input.size() && isAlnum_(input.GetChar(pos))) ++pos;
|
while (pos < input.size() && isAlnum_(input.GetChar(pos))) ++pos;
|
||||||
addToken(TOK_NAME, cannocial_name_form(input.substr(start, pos-start))); // convert name to cannocial form
|
addToken(TOK_NAME, cannocial_name_form(input.substr(start, pos-start)), start); // convert name to cannocial form
|
||||||
} else if (isDigit(c)) {
|
} else if (isDigit(c)) {
|
||||||
// number
|
// number
|
||||||
size_t start = pos - 1;
|
size_t start = pos - 1;
|
||||||
@@ -208,16 +209,16 @@ void TokenIterator::readToken() {
|
|||||||
String num = input.substr(start, pos-start);
|
String num = input.substr(start, pos-start);
|
||||||
addToken(
|
addToken(
|
||||||
num.find_first_of('.') == String::npos ? TOK_INT : TOK_DOUBLE,
|
num.find_first_of('.') == String::npos ? TOK_INT : TOK_DOUBLE,
|
||||||
num
|
num, start
|
||||||
);
|
);
|
||||||
} else if (isOper(c)) {
|
} else if (isOper(c)) {
|
||||||
// operator
|
// operator
|
||||||
if (pos < input.size() && isLongOper(input.substr(pos - 1, 2))) {
|
if (pos < input.size() && isLongOper(input.substr(pos - 1, 2))) {
|
||||||
// long operator
|
// long operator
|
||||||
addToken(TOK_OPER, input.substr(pos - 1, 2));
|
addToken(TOK_OPER, input.substr(pos - 1, 2), pos-1);
|
||||||
pos += 1;
|
pos += 1;
|
||||||
} else {
|
} else {
|
||||||
addToken(TOK_OPER, input.substr(pos - 1, 1));
|
addToken(TOK_OPER, input.substr(pos - 1, 1), pos-1);
|
||||||
}
|
}
|
||||||
} else if (c==_('"')) {
|
} else if (c==_('"')) {
|
||||||
// string
|
// string
|
||||||
@@ -226,16 +227,16 @@ void TokenIterator::readToken() {
|
|||||||
} else if (c == _('}') && !open_braces.empty() && open_braces.top() != BRACE_PAREN) {
|
} else if (c == _('}') && !open_braces.empty() && open_braces.top() != BRACE_PAREN) {
|
||||||
// closing smart string, resume to string parsing
|
// closing smart string, resume to string parsing
|
||||||
// "a{e}b" --> "a" "{ e }" "b"
|
// "a{e}b" --> "a" "{ e }" "b"
|
||||||
addToken(TOK_RPAREN, _("}\""));
|
addToken(TOK_RPAREN, _("}\""), pos-1);
|
||||||
readStringToken();
|
readStringToken();
|
||||||
} else if (isLparen(c)) {
|
} else if (isLparen(c)) {
|
||||||
// paranthesis/brace
|
// paranthesis/brace
|
||||||
open_braces.push(BRACE_PAREN);
|
open_braces.push(BRACE_PAREN);
|
||||||
addToken(TOK_LPAREN, String(1,c));
|
addToken(TOK_LPAREN, String(1,c), pos-1);
|
||||||
} else if (isRparen(c)) {
|
} else if (isRparen(c)) {
|
||||||
// paranthesis/brace
|
// paranthesis/brace
|
||||||
if (!open_braces.empty()) open_braces.pop();
|
if (!open_braces.empty()) open_braces.pop();
|
||||||
addToken(TOK_RPAREN, String(1,c));
|
addToken(TOK_RPAREN, String(1,c), pos-1);
|
||||||
} else if(c==_('#')) {
|
} else if(c==_('#')) {
|
||||||
// comment untill end of line
|
// comment untill end of line
|
||||||
while (pos < input.size() && input[pos] != _('\n')) ++pos;
|
while (pos < input.size() && input[pos] != _('\n')) ++pos;
|
||||||
@@ -246,17 +247,18 @@ void TokenIterator::readToken() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TokenIterator::readStringToken() {
|
void TokenIterator::readStringToken() {
|
||||||
|
size_t start = max((size_t)1, pos) - 1;
|
||||||
String str;
|
String str;
|
||||||
while (true) {
|
while (true) {
|
||||||
if (pos >= input.size()) {
|
if (pos >= input.size()) {
|
||||||
if (!open_braces.empty() && open_braces.top() == BRACE_STRING_MODE) {
|
if (!open_braces.empty() && open_braces.top() == BRACE_STRING_MODE) {
|
||||||
// in string mode: end of input = end of string
|
// in string mode: end of input = end of string
|
||||||
addToken(TOK_STRING, str);
|
addToken(TOK_STRING, str, start);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
add_error(_("Unexpected end of input in string constant"));
|
add_error(_("Unexpected end of input in string constant"));
|
||||||
// fix up
|
// fix up
|
||||||
addToken(TOK_STRING, str);
|
addToken(TOK_STRING, str, start);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -264,7 +266,7 @@ void TokenIterator::readStringToken() {
|
|||||||
// parse the string constant
|
// parse the string constant
|
||||||
if (c == _('"') && !open_braces.empty() && open_braces.top() == BRACE_STRING) {
|
if (c == _('"') && !open_braces.empty() && open_braces.top() == BRACE_STRING) {
|
||||||
// end of string
|
// end of string
|
||||||
addToken(TOK_STRING, str);
|
addToken(TOK_STRING, str, start);
|
||||||
open_braces.pop();
|
open_braces.pop();
|
||||||
return;
|
return;
|
||||||
} else if (c == _('\\')) {
|
} else if (c == _('\\')) {
|
||||||
@@ -272,7 +274,7 @@ void TokenIterator::readStringToken() {
|
|||||||
if (pos >= input.size()) {
|
if (pos >= input.size()) {
|
||||||
add_error(_("Unexpected end of input in string constant"));
|
add_error(_("Unexpected end of input in string constant"));
|
||||||
// fix up
|
// fix up
|
||||||
addToken(TOK_STRING, str);
|
addToken(TOK_STRING, str, start);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
c = input.GetChar(pos++);
|
c = input.GetChar(pos++);
|
||||||
@@ -282,8 +284,8 @@ void TokenIterator::readStringToken() {
|
|||||||
} else if (c == _('{')) {
|
} else if (c == _('{')) {
|
||||||
// smart string
|
// smart string
|
||||||
// "a{e}b" --> "a" "{ e }" "b"
|
// "a{e}b" --> "a" "{ e }" "b"
|
||||||
addToken(TOK_STRING, str);
|
addToken(TOK_STRING, str, start);
|
||||||
addToken(TOK_LPAREN, _("\"{"));
|
addToken(TOK_LPAREN, _("\"{"), pos-1);
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
str += c;
|
str += c;
|
||||||
@@ -302,7 +304,7 @@ void TokenIterator::add_error(const String& message) {
|
|||||||
errors.push_back(ScriptParseError(pos, line, filename, message));
|
errors.push_back(ScriptParseError(pos, line, filename, message));
|
||||||
}
|
}
|
||||||
void TokenIterator::expected(const String& expected) {
|
void TokenIterator::expected(const String& expected) {
|
||||||
size_t error_pos = pos - peek(0).value.size();
|
size_t error_pos = peek(0).pos;
|
||||||
if (!errors.empty() && errors.back().start == pos) return; // already an error here
|
if (!errors.empty() && errors.back().start == pos) return; // already an error here
|
||||||
// find line number
|
// find line number
|
||||||
int line = 1;
|
int line = 1;
|
||||||
|
|||||||
@@ -173,6 +173,7 @@ Source: "data/en.mse-locale/*"; DestDir: "{app}/data/en.mse-locale/";
|
|||||||
#emit Package(1, 'magic', 'future', 'style', 'mtg/future/base')
|
#emit Package(1, 'magic', 'future', 'style', 'mtg/future/base')
|
||||||
#emit Package(1, 'magic', 'future-textless', 'style', 'mtg/future/textless')
|
#emit Package(1, 'magic', 'future-textless', 'style', 'mtg/future/textless')
|
||||||
|
|
||||||
|
#emit Font (0, 'ModMatrix.ttf', 'ModMatrix', 'mtg')
|
||||||
#emit Font (0, 'matrixb.ttf', 'Matrix', 'mtg style/yugioh')
|
#emit Font (0, 'matrixb.ttf', 'Matrix', 'mtg style/yugioh')
|
||||||
#emit Font (0, 'matrixbsc.ttf', 'MatrixBoldSmallCaps', 'mtg')
|
#emit Font (0, 'matrixbsc.ttf', 'MatrixBoldSmallCaps', 'mtg')
|
||||||
#emit Font (0, 'magmed.ttf', 'MagicMedieval', 'mtg/old')
|
#emit Font (0, 'magmed.ttf', 'MagicMedieval', 'mtg/old')
|
||||||
@@ -212,6 +213,8 @@ Source: "data/en.mse-locale/*"; DestDir: "{app}/data/en.mse-locale/";
|
|||||||
#emit FontNoReg (0, 'MatrixRegularSmallCaps.pfm', 'MatrixRegularSmallCaps', 'yugioh')
|
#emit FontNoReg (0, 'MatrixRegularSmallCaps.pfm', 'MatrixRegularSmallCaps', 'yugioh')
|
||||||
#emit FontNoReg (0, 'MatrixRegularSmallCaps.pfb', 'MatrixRegularSmallCaps', 'yugioh')
|
#emit FontNoReg (0, 'MatrixRegularSmallCaps.pfb', 'MatrixRegularSmallCaps', 'yugioh')
|
||||||
#emit Font (0, 'pala.ttf', 'Palatino Linotype', 'yugioh')
|
#emit Font (0, 'pala.ttf', 'Palatino Linotype', 'yugioh')
|
||||||
|
#emit Font (0, 'palab.ttf', 'Palatino Linotype Bold', 'yugioh')
|
||||||
|
#emit Font (0, 'MatriBoo.ttf', 'MatrixBook', 'yugioh')
|
||||||
|
|
||||||
; ------------------------------------------------------------------------- : Rest of installer
|
; ------------------------------------------------------------------------- : Rest of installer
|
||||||
|
|
||||||
@@ -228,7 +231,7 @@ Name: "{commonprograms}\Magic Set Editor"; Filename: "{app}\mse.exe"; WorkingDir
|
|||||||
|
|
||||||
#emit Association('.mse-set', 'Set', '2')
|
#emit Association('.mse-set', 'Set', '2')
|
||||||
#emit Association('.mse-symbol', 'Symbol', '3')
|
#emit Association('.mse-symbol', 'Symbol', '3')
|
||||||
;#emit Association('.mse-installer', 'Installer', '1')
|
#emit Association('.mse-installer', 'Installer', '1')
|
||||||
|
|
||||||
[Run]
|
[Run]
|
||||||
Filename: "{app}\mse.exe"; Description: "Start Magic Set Editor"; Flags: postinstall nowait skipifsilent unchecked
|
Filename: "{app}\mse.exe"; Description: "Start Magic Set Editor"; Flags: postinstall nowait skipifsilent unchecked
|
||||||
|
|||||||
Reference in New Issue
Block a user