aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction/parser.h
diff options
context:
space:
mode:
authorNicola Mettifogo2009-01-03 14:03:12 +0000
committerNicola Mettifogo2009-01-03 14:03:12 +0000
commitb2d7ae871bb82da68caa08a9c8695bcacbc67ce8 (patch)
treeab74222f586877752a2f63a967840ed31b5c2ac5 /engines/parallaction/parser.h
parentc40b7b184025dfd94962fccce00d8868fdda6662 (diff)
downloadscummvm-rg350-b2d7ae871bb82da68caa08a9c8695bcacbc67ce8.tar.gz
scummvm-rg350-b2d7ae871bb82da68caa08a9c8695bcacbc67ce8.tar.bz2
scummvm-rg350-b2d7ae871bb82da68caa08a9c8695bcacbc67ce8.zip
Dropped the script preprocessor introduced to fix the broken scripts. The parser has evolved in the meantime and can deal with it accordingly.
svn-id: r35700
Diffstat (limited to 'engines/parallaction/parser.h')
-rw-r--r--engines/parallaction/parser.h113
1 files changed, 0 insertions, 113 deletions
diff --git a/engines/parallaction/parser.h b/engines/parallaction/parser.h
index 48facb620e..f83fc1384b 100644
--- a/engines/parallaction/parser.h
+++ b/engines/parallaction/parser.h
@@ -415,119 +415,6 @@ public:
};
-/*
- This simple stream is temporarily needed to hook the
- preprocessor output to the parser. It will go away
- when the parser is rewritten to fully exploit the
- statement list provided by the preprocessor.
-*/
-
-class ReadStringStream : public Common::ReadStream {
-
- char *_text;
- uint32 _pos;
- uint32 _size;
- bool _eos;
-
-public:
- ReadStringStream(const Common::String &text) {
- _text = new char[text.size() + 1];
- strcpy(_text, text.c_str());
- _size = text.size();
- _pos = 0;
- _eos = false;
- }
-
- ~ReadStringStream() {
- delete []_text;
- }
-
- uint32 read(void *buffer, uint32 size) {
- if (_pos + size > _size) {
- size = _size - _pos;
- _eos = true;
- }
- memcpy(buffer, _text + _pos, size);
- _pos += size;
- return size;
- }
-
- bool eos() const {
- return _eos;
- }
-
-};
-
-
-/*
- Demented as it may sound, the success of a parsing operation in the
- original BRA depends on what has been parsed before. The game features
- an innovative chaos system that involves the parser and the very game
- engine, in order to inflict the user an unforgettable game experience.
-
- Ok, now for the serious stuff.
-
- The PreProcessor implemented here fixes the location scripts before
- they are fed to the parser. It tries to do so by a preliminary scan
- of the text file, during which a score is assigned to each statement
- (more on this later). When the whole file has been analyzed, the
- statements are sorted according to their score, to create a parsable
- sequence.
-
- For parsing, the statements in location scripts can be conveniently
- divided into 3 groups:
-
- * location definitions
- * element definitions
- * start-up commands
-
- Since the parsing of element definitions requires location parameters
- to be set, location definitions should be encountered first in the
- script. Start-up commands in turn may reference elements, so they can
- be parsed last. The first goal is to make sure the parser gets these
- three sets in this order.
-
- Location definitions must also be presented in a certain sequence,
- because resource files are not fully self-describing. In short, some
- critical game data in contained in certain files, that must obviously
- be read before any other can be analyzed. This is the second goal.
-
- TODO: some words about actual implementation.
-*/
-
-class StatementDef;
-
-struct StatementListNode {
- int _score;
- Common::String _name;
- Common::String _text;
-
- StatementListNode(int score, const Common::String &name, const Common::String &text) : _score(score), _name(name), _text(text) { }
-
- bool operator<(const StatementListNode& node) const {
- return _score < node._score;
- }
-};
-typedef Common::List<StatementListNode> StatementList;
-
-
-class PreProcessor {
- typedef Common::List<StatementDef*> DefList;
-
- int _numZones;
- DefList _defs;
-
- StatementDef* findDef(const char* name);
- uint getDefScore(StatementDef*);
-
-public:
- PreProcessor();
- ~PreProcessor();
- void preprocessScript(Script &script, StatementList &list);
-};
-
-
-
} // namespace Parallaction
#endif