Example #1
0
File: main.cpp Project: 8l/zl
void parse_maps(ast::Environ & env) {
  SourceFile * code = new_source_file(SOURCE_PREFIX "grammer.ins");
  code->internal = true;
  try {
    SourceStr str(code);
    parse_prod("S_SPACING", str, ParseInfo(env.peg), &env);
    while (!str.empty()) {
      const Syntax * p = parse_prod("SEXP", str, ParseInfo(env.peg), &env);
      parse_prod("S_SPACING", str, ParseInfo(env.peg), &env); 
      read_macro(p, env);
    }
  } catch (Error * err) {
    fprintf(stderr, "%s\n", err->message().c_str());
    exit(1);
  }
}
Example #2
0
void VCFont::Initialize()
{
	std::ifstream f (m_fntPath, std::ios::in | std::ios::binary);
	if (!f.is_open())
	{
		std::cout << "Failed to open file: " << m_fntPath << std::endl;
		return;
	}

	// Header
	char c1, c2, c3, c4;
	f >> c1 >> c2 >> c3 >> c4;
	if (c1 != 66 || c2 != 77 || c3 != 70 || c4 != 3)
	{
		std::cout << "FNT must be binary, version 3!" << std::endl;
		return;
	}
	
	if (!ParseInfo(f))
		return;

	if (!ParseCommon(f) )
		return;

	if (!ParsePages(f) )
		return;

	if (!ParseCharacters(f) )
		return;

	if (!ParseKerning(f) )
		return;

	PreCompileQuads();

	f.close();

	// Load DDS
	//m_ddsTexture = VCTexture::CreateUnfilteredTexture(m_ddsPath.c_str());
	VCTextureParams tparam;
	tparam.Filtering = VCTextureFiltering::None;
	m_ddsTexture = VCResourceManager::GetTexure(m_ddsPath, tparam);

	// Name
	std::ostringstream ss;
	ss << FontName << "-" << Info.fontSize;

	if ( Info.bitField & 32)
		ss << "-Italic";

	if ( Info.bitField & 16)
		ss << "-Bold";

	Name = ss.str();
}
Example #3
0
unsigned POETTypeTor::compute_lookaheadInfo(EvaluatePOET* op, unsigned index, unsigned need)
{
     for (unsigned i = parseInfo.size(); i <= index; ++i) 
         { parseInfo.push_back(ParseInfo()); }
     ParseInfo& cur = parseInfo[index];
     if (!cur.filter.size()) {
        cur.lookahead = op->compute_lookaheadInfo(args[index], cur.filter, need);
#ifdef DEBUG_LOOKAHEAD
std::cerr << "lookahead for: " << toString() << ":" << index << ":";
        for (int i = 0; i < cur.filter.size(); ++i) 
std::cerr << cur.filter[i]->toString() << ";";
        std::cerr << "\n";
#endif
     }
     return cur.lookahead;
}
Example #4
0
TestingSet1 getTestingSet1() {
	TestingSet1 testingSet;
	testingSet.sorttable = TableUtils::createSortTable(-2, 2); //[-2,2]
	testingSet.sort = new Sort("sort", testingSet.sorttable); // sort  [-2,2]
	testingSet.x = new Variable(testingSet.sort); // variable of [-2,2]
	testingSet.sortterm = new VarTerm(testingSet.x, TermParseInfo()); //varterm of [-2,2]
	testingSet.nul = DomainElementFactory::createGlobal()->create(0);
	testingSet.nulterm = new DomainTerm(testingSet.sort, testingSet.nul, TermParseInfo());
	testingSet.p = new Predicate("P", { testingSet.sort }, {}, false); //predicate P of [-2,2]
	testingSet.q = new Predicate("Q", { testingSet.sort }, {}, false); //predicate Q of [-2,2]
	testingSet.r = new Predicate("R", { testingSet.sort }, {}, false);
	testingSet.s = new Predicate("S", { testingSet.sort,testingSet.sort }, {}, false);
	testingSet.vocabulary = new Vocabulary("V");
	testingSet.vocabulary->add(testingSet.sort);
	testingSet.vocabulary->add(testingSet.p);
	testingSet.vocabulary->add(testingSet.q);
	testingSet.vocabulary->add(testingSet.r);
	testingSet.vocabulary->add(testingSet.s);
	testingSet.structure = new Structure("S", ParseInfo());
	testingSet.structure->changeVocabulary(testingSet.vocabulary);

	testingSet.px = new PredForm(SIGN::POS, testingSet.p, { testingSet.sortterm }, FormulaParseInfo()); //P(x)
	testingSet.qx = new PredForm(SIGN::POS, testingSet.q, { testingSet.sortterm }, FormulaParseInfo()); //Q(x)
	testingSet.rx = new PredForm(SIGN::POS, testingSet.r, { testingSet.sortterm }, FormulaParseInfo()); //Q(x)
	testingSet.sxx = new PredForm(SIGN::POS, testingSet.s, { testingSet.sortterm,testingSet.sortterm->clone() }, FormulaParseInfo()); //S(x,x)
	testingSet.p0 = new PredForm(SIGN::POS, testingSet.p, { testingSet.nulterm }, FormulaParseInfo()); //P(0)
	testingSet.q0 = new PredForm(SIGN::POS, testingSet.q, { testingSet.nulterm }, FormulaParseInfo()); //Q(0)
	testingSet.r0 = new PredForm(SIGN::POS, testingSet.r, { testingSet.nulterm }, FormulaParseInfo()); //Q(0)
	testingSet.xpx = new QuantSetExpr( { testingSet.x }, testingSet.px, testingSet.sortterm, SetParseInfo()); //{x|p(x)}
	testingSet.maxxpx = new AggTerm(new EnumSetExpr( { testingSet.xpx }, testingSet.xpx->pi()), AggFunction::MAX, TermParseInfo()); //MAX{x|p(x)}

	testingSet.np0iffq0 = new EquivForm(SIGN::NEG, testingSet.p0, testingSet.q0, FormulaParseInfo()); // ~(P(0) <=> Q(0))
	testingSet.p0vq0 = new BoolForm(SIGN::POS, false, testingSet.p0, testingSet.q0, FormulaParseInfo()); //P(0) | Q(0)
	testingSet.Axpx = new QuantForm(SIGN::POS, QUANT::UNIV, { testingSet.x }, testingSet.px, FormulaParseInfo()); // !x: P(x)
	testingSet.nAxpx = new QuantForm(SIGN::NEG, QUANT::UNIV, { testingSet.x }, testingSet.px, FormulaParseInfo()); // ~!x: P(x)
	testingSet.nExqx = new QuantForm(SIGN::NEG, QUANT::EXIST, { testingSet.x }, testingSet.qx, FormulaParseInfo()); // ?x: Q(x)
	testingSet.xF = new EqChainForm(SIGN::POS, true, {testingSet.nulterm, testingSet.nulterm, testingSet.nulterm}, {CompType::LEQ, CompType::LEQ}, FormulaParseInfo()); // 0 =< 0 =< 0
	testingSet.maxxpxgeq0 = new AggForm(SIGN::POS, testingSet.nulterm, CompType::LEQ, testingSet.maxxpx, FormulaParseInfo()); // MAX{x|P(x)} >= 0
	return testingSet;
}