aboutsummaryrefslogtreecommitdiff
path: root/engines/sci/parser
diff options
context:
space:
mode:
authorFilippos Karapetis2010-01-23 19:10:56 +0000
committerFilippos Karapetis2010-01-23 19:10:56 +0000
commit722233fd0ddc4447b30f352f6b4bb19728d824fa (patch)
tree8f70437935084ea34abc658165188ef86f4a89aa /engines/sci/parser
parentedbc3683987faf7487b10513a812ca2857a04771 (diff)
downloadscummvm-rg350-722233fd0ddc4447b30f352f6b4bb19728d824fa.tar.gz
scummvm-rg350-722233fd0ddc4447b30f352f6b4bb19728d824fa.tar.bz2
scummvm-rg350-722233fd0ddc4447b30f352f6b4bb19728d824fa.zip
- Moved all of the parser-related variables inside the Vocabulary class
- Moved the kSetSynonyms() function inside kscripts (as it's for script synonyms, not parser word synonyms) - The parser vocabulary is now only initialized for SCI0 and SCI01 games, which had a parser svn-id: r47483
Diffstat (limited to 'engines/sci/parser')
-rw-r--r--engines/sci/parser/said.cpp2
-rw-r--r--engines/sci/parser/said.y4
-rw-r--r--engines/sci/parser/vocabulary.cpp4
-rw-r--r--engines/sci/parser/vocabulary.h6
4 files changed, 13 insertions, 3 deletions
diff --git a/engines/sci/parser/said.cpp b/engines/sci/parser/said.cpp
index 32bd1fcf8d..98e5db7299 100644
--- a/engines/sci/parser/said.cpp
+++ b/engines/sci/parser/said.cpp
@@ -2446,7 +2446,7 @@ int said(EngineState *s, byte *spec, bool verbose) {
parse_tree_node_t *parse_tree_ptr = s->_voc->_parserNodes;
- if (s->parserIsValid) {
+ if (s->_voc->parserIsValid) {
if (said_parse_spec(spec)) {
printf("Offending spec was: ");
s->_voc->decipherSaidBlock(spec);
diff --git a/engines/sci/parser/said.y b/engines/sci/parser/said.y
index 1a3b2f52c8..9f30e56302 100644
--- a/engines/sci/parser/said.y
+++ b/engines/sci/parser/said.y
@@ -802,7 +802,7 @@ int said(EngineState *s, byte *spec, bool verbose) {
parse_tree_node_t *parse_tree_ptr = s->_voc->_parser_nodes;
- if (s->parserIsValid) {
+ if (s->_voc->parserIsValid) {
if (said_parse_spec(s, spec)) {
warning("Offending spec was: ");
s->_voc->decipherSaidBlock(spec);
@@ -830,7 +830,7 @@ int main (int argc, char *argv) {
byte block[] = {0x01, 0x00, 0xf8, 0xf5, 0x02, 0x01, 0xf6, 0xf2, 0x02, 0x01, 0xf2, 0x01, 0x03, 0xff};
EngineState s;
- s.parser_valid = 1;
+ s._voc->parser_valid = 1;
said(&s, block);
}
#endif
diff --git a/engines/sci/parser/vocabulary.cpp b/engines/sci/parser/vocabulary.cpp
index 5ecea03899..0e84a34cfd 100644
--- a/engines/sci/parser/vocabulary.cpp
+++ b/engines/sci/parser/vocabulary.cpp
@@ -108,6 +108,10 @@ Vocabulary::Vocabulary(ResourceManager *resMan) : _resMan(resMan) {
debug(2, "Assuming that this game does not use a parser.");
_parserRules = NULL;
}
+
+ parser_base = NULL_REG;
+ parser_event = NULL_REG;
+ parserIsValid = false;
}
Vocabulary::~Vocabulary() {
diff --git a/engines/sci/parser/vocabulary.h b/engines/sci/parser/vocabulary.h
index 00b8780d1c..d624ccc3fb 100644
--- a/engines/sci/parser/vocabulary.h
+++ b/engines/sci/parser/vocabulary.h
@@ -32,6 +32,7 @@
#include "common/list.h"
#include "sci/sci.h"
+#include "sci/engine/vm_types.h"
namespace Sci {
@@ -313,6 +314,11 @@ private:
public:
// Accessed by said()
parse_tree_node_t _parserNodes[VOCAB_TREE_NODES]; /**< The parse tree */
+
+ // Parser data:
+ reg_t parser_base; /**< Base address for the parser error reporting mechanism */
+ reg_t parser_event; /**< The event passed to Parse() and later used by Said() */
+ bool parserIsValid; /**< If something has been correctly parsed */
};
/**