diff options
author | Willem Jan Palenstijn | 2010-10-03 10:49:42 +0000 |
---|---|---|
committer | Willem Jan Palenstijn | 2010-10-03 10:49:42 +0000 |
commit | f98536eef5b24bf98730c3b555aeb63ed9de0927 (patch) | |
tree | 15fb88e221e8eb64e4fe60e53d64056e57778911 /engines/sci/console.cpp | |
parent | 694758fd2a0e98513c436e02cdf13d690fe9565d (diff) | |
download | scummvm-rg350-f98536eef5b24bf98730c3b555aeb63ed9de0927.tar.gz scummvm-rg350-f98536eef5b24bf98730c3b555aeb63ed9de0927.tar.bz2 scummvm-rg350-f98536eef5b24bf98730c3b555aeb63ed9de0927.zip |
SCI: Allow multiple word groups in parser
In SCI01 and up, each typed word may be interpreted as multiple
class,group pairs. This patch adds support to the vocabulary and
parser. It uses the matcher support added in r52985.
This fixes parser issues in German LSL3, but needs testing.
svn-id: r52989
Diffstat (limited to 'engines/sci/console.cpp')
-rw-r--r-- | engines/sci/console.cpp | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/engines/sci/console.cpp b/engines/sci/console.cpp index c26cd60a25..51ec9cfe9e 100644 --- a/engines/sci/console.cpp +++ b/engines/sci/console.cpp @@ -1204,7 +1204,6 @@ bool Console::cmdParse(int argc, const char **argv) { return true; } - ResultWordList words; char *error; char string[1000]; @@ -1216,6 +1215,8 @@ bool Console::cmdParse(int argc, const char **argv) { } DebugPrintf("Parsing '%s'\n", string); + + ResultWordListList words; bool res = _engine->getVocabulary()->tokenizeString(words, string, &error); if (res && !words.empty()) { int syntax_fail = 0; @@ -1224,8 +1225,13 @@ bool Console::cmdParse(int argc, const char **argv) { DebugPrintf("Parsed to the following blocks:\n"); - for (ResultWordList::const_iterator i = words.begin(); i != words.end(); ++i) - DebugPrintf(" Type[%04x] Group[%04x]\n", i->_class, i->_group); + for (ResultWordListList::const_iterator i = words.begin(); i != words.end(); ++i) { + DebugPrintf(" "); + for (ResultWordList::const_iterator j = i->begin(); j != i->end(); ++j) { + DebugPrintf("%sType[%04x] Group[%04x]", j == i->begin() ? "" : " / ", j->_class, j->_group); + } + DebugPrintf("\n"); + } if (_engine->getVocabulary()->parseGNF(words, true)) syntax_fail = 1; // Building a tree failed @@ -1252,7 +1258,6 @@ bool Console::cmdSaid(int argc, const char **argv) { return true; } - ResultWordList words; char *error; char string[1000]; byte spec[1000]; @@ -1326,6 +1331,7 @@ bool Console::cmdSaid(int argc, const char **argv) { _engine->getVocabulary()->debugDecipherSaidBlock(spec); printf("\n"); + ResultWordListList words; bool res = _engine->getVocabulary()->tokenizeString(words, string, &error); if (res && !words.empty()) { int syntax_fail = 0; @@ -1334,8 +1340,15 @@ bool Console::cmdSaid(int argc, const char **argv) { DebugPrintf("Parsed to the following blocks:\n"); - for (ResultWordList::const_iterator i = words.begin(); i != words.end(); ++i) - DebugPrintf(" Type[%04x] Group[%04x]\n", i->_class, i->_group); + for (ResultWordListList::const_iterator i = words.begin(); i != words.end(); ++i) { + DebugPrintf(" "); + for (ResultWordList::const_iterator j = i->begin(); j != i->end(); ++j) { + DebugPrintf("%sType[%04x] Group[%04x]", j == i->begin() ? "" : " / ", j->_class, j->_group); + } + DebugPrintf("\n"); + } + + if (_engine->getVocabulary()->parseGNF(words, true)) syntax_fail = 1; // Building a tree failed |