コード例 #1
0
ファイル: markovsky.cpp プロジェクト: Mego/Markovsky
int Markovsky::LearnLine(string &line) {
  // Ignore quotes
  if (isdigit(line[0])) return false;
  if (line[0] == '<') return false;
  if (line[0] == '[') return false;


  vector<string> curwords;
  tokenizeString(line, curwords);
  string cleanline = joinString(curwords);
  if (lines.find(cleanline) != lines.end()) return false;

  set<string>::iterator lineit = lines.insert(cleanline).first;

  int sz = curwords.size();
  for (int i = 0; i < sz; i++) {
	map<string, word_t>::iterator wit = words.find(curwords[i]);
	if (wit == words.end()) {
	  word_t cword;
	  context_t cxt(lineit, i);
	  cword.push_back(cxt);
	  words[curwords[i]] = cword;
	} else {
	  context_t cxt(lineit, i);
	  ((*wit).second).push_back(cxt);
	}
	num_contexts++;
  }
  
  return true;
}
コード例 #2
0
ファイル: decl.cpp プロジェクト: asutton/beaker-old
// Make a new function declaration.
Function_decl* 
make_function_decl(Location loc, String const* n, Decl_seq const& p, Type const* r, Stmt const* s)
{
  Input_context cxt(loc);
  if (!check_definition(r, s))
    return make_error_node<Function_decl>();
  return new Function_decl(loc, n, get_function_type(p, r), p, s);
}
コード例 #3
0
ファイル: decl.cpp プロジェクト: asutton/beaker-old
// Make a new variable declaration. 
Variable_decl* 
make_variable_decl(Location loc, String const* n, Type const* t, Expr const* e)
{
  Input_context cxt(loc);
  if (!check_initializer(t, e))
    return make_error_node<Variable_decl>();
  return new Variable_decl(loc, n, t, e);
}
コード例 #4
0
ファイル: hm-jitwriter.cpp プロジェクト: ajwfrost/avmplus
void JitWriter::writeEpilogue(const FrameState*) {
  if (enable_verbose) {
#ifdef AVMPLUS_VERBOSE
    console_ << "analyze   " << method_ << "\n";
#endif
  }

  Context cxt(method_, method_->pool()->core->console, toplevel_, abc_env_, calling_context_);

  InstrGraph* ir = parseAbc(method_, jit_mgr_->lattice(), jit_mgr_->infos(),
                            alloc_, abc_,
                            toplevel_, abc_env_, profiled_info_,
                            cxt);
  jit_mgr_->set_ir(method_, ir);
  switch (enable_mode) {
    case kModeInterpret:
      jit_mgr_->set_interp(method_, ir);
      break;
    case kModeLirStubs:
    case kModeLir:
      jit_mgr_->set_lir(method_, ir, profiled_info_);
      break;
  }
}