mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-09 04:59:31 -06:00
implemented nonExist
This commit is contained in:
@@ -310,10 +310,20 @@ void PgfLinearizer::free_ref(object x)
|
||||
PgfLinearizationOutput::PgfLinearizationOutput() : printer(NULL,0,NULL)
|
||||
{
|
||||
bind = true;
|
||||
nonexist = false;
|
||||
capit = false;
|
||||
allcapit = false;
|
||||
}
|
||||
|
||||
PgfText *PgfLinearizationOutput::get_text()
|
||||
{
|
||||
if (nonexist) {
|
||||
free(printer.get_text());
|
||||
return NULL;
|
||||
}
|
||||
return printer.get_text();
|
||||
}
|
||||
|
||||
void PgfLinearizationOutput::symbol_token(PgfText *tok)
|
||||
{
|
||||
if (!bind) {
|
||||
@@ -375,6 +385,7 @@ void PgfLinearizationOutput::end_phrase(PgfText *cat, int fid, PgfText *ann, Pgf
|
||||
|
||||
void PgfLinearizationOutput::symbol_ne()
|
||||
{
|
||||
nonexist = true;
|
||||
}
|
||||
|
||||
void PgfLinearizationOutput::symbol_bind()
|
||||
|
||||
@@ -4,14 +4,15 @@
|
||||
class PGF_INTERNAL_DECL PgfLinearizationOutput : public PgfLinearizationOutputIface {
|
||||
PgfPrinter printer;
|
||||
bool bind;
|
||||
bool nonexist;
|
||||
bool capit;
|
||||
bool allcapit;
|
||||
|
||||
public:
|
||||
PgfLinearizationOutput();
|
||||
|
||||
PgfText *get_text() { return printer.get_text(); };
|
||||
|
||||
PgfText *get_text();
|
||||
|
||||
virtual void symbol_token(PgfText *tok);
|
||||
virtual void begin_phrase(PgfText *cat, int fid, PgfText *ann, PgfText *fun);
|
||||
virtual void end_phrase(PgfText *cat, int fid, PgfText *ann, PgfText *fun);
|
||||
|
||||
@@ -71,11 +71,13 @@ again: {
|
||||
|
||||
PgfText *PgfPrinter::get_text()
|
||||
{
|
||||
if (res == NULL) {
|
||||
res = (PgfText*) malloc(sizeof(PgfText));
|
||||
res->size = 0;
|
||||
PgfText *tmp = res;
|
||||
if (tmp == NULL) {
|
||||
tmp = (PgfText*) malloc(sizeof(PgfText));
|
||||
tmp->size = 0;
|
||||
}
|
||||
return res;
|
||||
res = NULL;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
void PgfPrinter::flush_lambdas()
|
||||
|
||||
@@ -584,7 +584,9 @@ linearize c e =
|
||||
bracket (newStablePtr e) freeStablePtr $ \c_e ->
|
||||
withForeignPtr marshaller $ \m ->
|
||||
bracket (withPgfExn "linearize" (pgf_linearize (c_db c) c_revision c_e m)) free $ \c_text ->
|
||||
peekText c_text
|
||||
if c_text == nullPtr
|
||||
then return ""
|
||||
else peekText c_text
|
||||
|
||||
-- | Generates all possible linearizations of an expression
|
||||
linearizeAll :: Concr -> Expr -> [String]
|
||||
|
||||
Reference in New Issue
Block a user