예제 #1
0
파일: Scheme.cpp 프로젝트: josephzizys/CM
void SchemeThread::read()
{
  bool more=true;
  bool prompt=true;
  String text=String::empty;
  CodeDocument doc;
  CodeDocument::Position pos(&doc,0);
  while (more && !threadShouldExit()) 
    {
      if (prompt)
	{
	  Console::getInstance()->printPrompt();
	  prompt=false;
	}
      std::string line="";
      getline(std::cin, line);
      if (!text.isEmpty())
	text << T("\n");
      text << String(line.c_str());
      int typ;
      doc.replaceAllContent(text);
      pos.setPosition(0);
      typ=LispSyntax::getInstance()->scanCode(doc, pos, true, ScanIDs::MoveExpressions);
      if (typ==ScanIDs::SCAN_LIST || typ==ScanIDs::SCAN_TOKEN || typ==ScanIDs::SCAN_STRING)
	break;
      else if (typ==ScanIDs::SCAN_UNLEVEL)
	break;  // allow too many parens to be passed to lisp?
    }
  if (!text.isEmpty())
    eval(text);
}
예제 #2
0
CodeDocument& ValueList::getDocument (const File& file)
{
    const int index = documentFiles.indexOf (file.getFullPathName());

    if (index >= 0)
        return *documents.getUnchecked (index);

    CodeDocument* doc = documents.add (new CodeDocument());
    documentFiles.add (file);
    doc->replaceAllContent (file.loadFileAsString());
    doc->clearUndoHistory();
    return *doc;
}