Esempio n. 1
0
void TreeScriptParser :: parseScope(_ScriptReader& reader, ScriptBookmark& bm, SyntaxWriter& writer)
{
   bm = reader.read();
   while (!reader.Eof() && !reader.compare(")")) {
      parseStatement(reader, bm, writer);

      bm = reader.read();
   }

}
Esempio n. 2
0
bool VMTapeParser :: parse(TapeWriter& writer, _ScriptReader& reader)
{
   bool idle = true;
   ScriptBookmark bm = reader.read();
   while (!reader.Eof()) {
      idle = false;

      parseStatement(reader, bm, writer);

      bm = reader.read();
   }

   return !idle;
}
Esempio n. 3
0
void TreeScriptParser :: parse(_ScriptReader& reader, MemoryDump* output)
{
   MemoryWriter writer(output);
   writer.writeDWord(0); // HOTFIX : end of tape
   int sizePos = writer.Position();
   writer.writeDWord(0);

   SyntaxTree tree;
   SyntaxWriter treeWriter(tree);

   ScriptBookmark bm = reader.read();
   while (!reader.Eof()) {      
      parseStatement(reader, bm, treeWriter);

      bm = reader.read();
   }   

   if (tree.save(output)) {
      writer.seek(sizePos);
      writer.writeDWord(output->Length() - sizePos);
   }
   else output->clear();
}
Esempio n. 4
0
void CFParser :: parse(_ScriptReader& reader, MemoryDump* output)
{
   if (_symbolMode)
      reader.switchDFA(dfaSymbolic);

   ScriptLog log;

   size_t startId = mapRuleId("start");
   while (!reader.Eof()) {
      MemoryWriter writer(&_body);
      int presaved = writer.Position();

      int trace = buildDerivationTree(reader, startId, writer);
      generateOutput(trace, reader, log);

      IdentifierTextReader logReader((const char*)log.getBody());
      ScriptReader scriptReader(&logReader);
      
      _baseParser->parse(scriptReader, output);

      _body.trim(presaved);
      log.clear();
   }
}