Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
b7bd4f83
Commit
b7bd4f83
authored
Mar 29, 2007
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nicer error messags when aliases don't but should apply
parent
56043e7e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
7 deletions
+21
-7
src/util/io/reader.cpp
src/util/io/reader.cpp
+15
-6
src/util/io/reader.hpp
src/util/io/reader.hpp
+6
-1
No files found.
src/util/io/reader.cpp
View file @
b7bd4f83
...
@@ -32,9 +32,9 @@ Reader::Reader(const String& filename)
...
@@ -32,9 +32,9 @@ Reader::Reader(const String& filename)
}
}
void
Reader
::
addAlias
(
Version
end_version
,
const
Char
*
a
,
const
Char
*
b
)
{
void
Reader
::
addAlias
(
Version
end_version
,
const
Char
*
a
,
const
Char
*
b
)
{
if
(
file_app_version
<
end_version
)
{
Alias
&
alias
=
aliasses
[
a
];
aliasses
[
a
]
=
b
;
alias
.
new_key
=
b
;
}
alias
.
end_version
=
end_version
;
}
}
void
Reader
::
handleAppVersion
()
{
void
Reader
::
handleAppVersion
()
{
...
@@ -126,13 +126,22 @@ void Reader::readLine() {
...
@@ -126,13 +126,22 @@ void Reader::readLine() {
void
Reader
::
unknownKey
()
{
void
Reader
::
unknownKey
()
{
// aliasses?
// aliasses?
map
<
String
,
String
>::
const_iterator
it
=
aliasses
.
find
(
key
);
map
<
String
,
Alias
>::
const_iterator
it
=
aliasses
.
find
(
key
);
if
(
it
!=
aliasses
.
end
())
{
if
(
it
!=
aliasses
.
end
())
{
if
(
aliasses
.
find
(
it
->
second
)
!=
aliasses
.
end
())
{
if
(
aliasses
.
find
(
it
->
second
.
new_key
)
!=
aliasses
.
end
())
{
// alias points to another alias, don't follow it, there is the risk of infinite loops
// alias points to another alias, don't follow it, there is the risk of infinite loops
}
else
if
(
it
->
second
.
end_version
<=
file_version
)
{
// alias not used for this version, use in warning
if
(
indent
==
expected_indent
)
{
warning
(
_
(
"Unexpected key: '"
)
+
key
+
_
(
"' try '"
)
+
it
->
second
.
new_key
+
_
(
"'"
));
do
{
moveNext
();
}
while
(
indent
>
expected_indent
);
return
;
}
}
else
{
}
else
{
// try this key instead
// try this key instead
key
=
it
->
second
;
key
=
it
->
second
.
new_key
;
return
;
return
;
}
}
}
}
...
...
src/util/io/reader.hpp
View file @
b7bd4f83
...
@@ -121,7 +121,12 @@ class Reader {
...
@@ -121,7 +121,12 @@ class Reader {
/// Did we just open a block (i.e. not read any more lines of it)?
/// Did we just open a block (i.e. not read any more lines of it)?
bool
just_opened
;
bool
just_opened
;
/// Aliasses for compatability
/// Aliasses for compatability
map
<
String
,
String
>
aliasses
;
struct
Alias
{
String
new_key
;
Version
end_version
;
};
/// Aliasses for compatability
map
<
String
,
Alias
>
aliasses
;
/// Filename for error messages
/// Filename for error messages
String
filename
;
String
filename
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment