Пример #1
0
void put_local(void)
{
    if (nargs) fputc('[', output_file);
    if (linecolor) {
	fprintf(output_file, "linecolor=%s%c", linecolor, punct(nargs));
	linecolor = NULL;
    }
    if (dotstyle) {
	fprintf(output_file, "dotstyle=%s%c", dotstyle, punct(nargs));
	dotstyle = NULL;
    }
    if (dotscale != 1) {
	fprintf(output_file, "dotscale=%g%c", dotscale, punct(nargs));
	dotscale = 1;
    }
    if (linestyle) {
	fprintf(output_file, "linestyle=%s%c", linestyle, punct(nargs));
	linestyle = NULL;
    }
    if (linewidth) {
	fprintf(output_file, "linewidth=%gpt%c", linewidth, punct(nargs));
	linewidth = 0;
    }
    if (arrowscale != 1) {
	fprintf(output_file, "arrowscale=%g%c", arrowscale, punct(nargs));
	arrowscale = 1;
    }
    if (hatched) {
	fprintf(output_file,
		"linestyle=none,fillstyle=hlines,hatchangle=%g%c",
		hatchangle, punct(nargs));
	hatched = 0;
    }
    if (hatchcolor) {
	fprintf(output_file, "hatchcolor=%s%c", hatchcolor, punct(nargs));
	hatchcolor = NULL;
    }
    if (hatchsep) {
	fprintf(output_file, "hatchsep=%gpt%c", hatchsep, punct(nargs));
	hatchsep = 0;
    }
}
Пример #2
0
Lexer::Token Figcap::parse( Lexer* lexer )
{
    Lexer::Token tok( parseAttributes( lexer) );
    while( tok != Lexer::END ) {
        //may contain inline, not block
        if( tok == Lexer::WORD ) {
            Word* word( new Word( document, this, document->dataName(),
                document->dataLine(), document->dataCol() ) );
            appendChild( word );
            tok = word->parse( lexer );
        }
        else if( tok == Lexer::ENTITY ) {
            Entity* entity( new Entity( document, this, document->dataName(),
                document->dataLine(), document->dataCol() ) );
            appendChild( entity );
            tok = entity->parse( lexer );
        }
        else if( tok == Lexer::PUNCTUATION ) {
            Punctuation* punct( new Punctuation( document, this, document->dataName(),
                document->dataLine(), document->dataCol() ) );
            appendChild( punct );
            tok = punct->parse( lexer );
        }
        else if( tok == Lexer::WHITESPACE ) {
            WhiteSpace* ws( new WhiteSpace( document, this, document->dataName(),
                document->dataLine(), document->dataCol(), Tag::LITERAL ) );
            appendChild( ws );
            tok = ws->parse( lexer );
        }
        else if( tok == Lexer::COMMAND )
            tok = document->processCommand( lexer, this );
        else if( tok == Lexer::TAG ) {
            if( lexer->tagId() == Lexer::EUSERDOC || lexer->tagId() == Lexer::EFIG )
                break;
            else
                parseCleanup( lexer, tok );
        }
        else if( tok == Lexer::ERROR_TAG ) {
            document->printError( ERR1_TAGNOTDEF );
            tok = document->getNextToken();
        }
        else if( tok == Lexer::ERROR_ENTITY ) {
            document->printError( ERR1_TAGNOTDEF );
            tok = document->getNextToken();
        }
    }
    return tok;
}
Пример #3
0
oriental_language_rep::oriental_language_rep (string lan_name):
  language_rep (lan_name), punct (false)
{
  punct (".")= true;
  punct (",")= true;
  punct (":")= true;
  punct (";")= true;
  punct ("!")= true;
  punct ("?")= true;
  punct ("<#3000>")= true;
  punct ("<#3001>")= true;
  punct ("<#3002>")= true;
  punct ("<#3003>")= true;
  punct ("<#3004>")= true;
  punct ("<#3005>")= true;
  punct ("<#3006>")= true;
  punct ("<#3007>")= true;
  punct ("<#3008>")= true;
  punct ("<#3009>")= true;
  punct ("<#300a>")= true;
  punct ("<#300b>")= true;
  punct ("<#300c>")= true;
  punct ("<#300d>")= true;
  punct ("<#300e>")= true;
  punct ("<#300f>")= true;
  punct ("<#300A>")= true;
  punct ("<#300B>")= true;
  punct ("<#300C>")= true;
  punct ("<#300D>")= true;
  punct ("<#300E>")= true;
  punct ("<#300F>")= true;
  punct ("<#ff01>")= true;
  punct ("<#ff0c>")= true;
  punct ("<#ff0e>")= true;
  punct ("<#ff1a>")= true;
  punct ("<#ff1b>")= true;
  punct ("<#ff1f>")= true;
  punct ("<#FF01>")= true;
  punct ("<#FF0C>")= true;
  punct ("<#FF0E>")= true;
  punct ("<#FF1A>")= true;
  punct ("<#FF1B>")= true;
  punct ("<#FF1F>")= true;
}
Пример #4
0
bool Tag::parseInline( Lexer* lexer, Lexer::Token& tok )
{
    bool notHandled( false );
    if( tok == Lexer::WORD ) {
        Word* word( new Word( document, this, document->dataName(),
            document->lexerLine(), document->lexerCol(), whiteSpace ) );
        appendChild( word );
        tok = word->parse( lexer );
    }
    else if( tok == Lexer::ENTITY ) {
        Entity* entity( new Entity( document, this, document->dataName(),
            document->lexerLine(), document->lexerCol(), whiteSpace ) );
        appendChild( entity );
        tok = entity->parse( lexer );
    }
    else if( tok == Lexer::PUNCTUATION ) {
        Punctuation* punct( new Punctuation( document, this, document->dataName(),
            document->lexerLine(), document->lexerCol(), whiteSpace ) );
        appendChild( punct );
        tok = punct->parse( lexer );
    }
    else if( tok == Lexer::WHITESPACE ) {
        WhiteSpace* ws( new WhiteSpace( document, this, document->dataName(),
        document->lexerLine(), document->lexerCol(), whiteSpace ) );
        appendChild( ws );
        tok = ws->parse( lexer );
    }
    else if( tok == Lexer::COMMAND )
        tok = document->processCommand( lexer, this );
    else if( tok == Lexer::TAG ) {
        switch( lexer->tagId() ) {
        //make new tag
        //append pointer to this tag's list
        case Lexer::ARTLINK:
            {
                Element* elt( new Artlink( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol() ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::EARTLINK:
            {
                Element* elt( new EArtlink( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol() ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::ARTWORK:
            {
                Element* elt( new Artwork( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol() ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::COLOR:
            {
                Element* elt( new Color( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol() ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::FONT:
            {
                Element* elt( new Font( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol() ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::HDREF:
            {
                Element* elt( new Hdref( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol() ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::HIDE:
            {
                Element* elt( new Hide( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol() ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::EHIDE:
            {
                Element* elt( new EHide( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol() ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::HP1:
            {
                Element* elt( new Hpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 1 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::HP2:
            {
                Element* elt( new Hpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 2 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::HP3:
            {
                Element* elt( new Hpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 3 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::HP4:
            {
                Element* elt( new Hpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 4 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::HP5:
            {
                Element* elt( new Hpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 5 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::HP6:
            {
                Element* elt( new Hpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 6 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::HP7:
            {
                Element* elt( new Hpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 7 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::HP8:
            {
                Element* elt( new Hpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 8 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::HP9:
            {
                Element* elt( new Hpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 9 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::EHP1:
            {
                Element* elt( new EHpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 1 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::EHP2:
            {
                Element* elt( new EHpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 2 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::EHP3:
            {
                Element* elt( new EHpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 3 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::EHP4:
            {
                Element* elt( new EHpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 4 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::EHP5:
            {
                Element* elt( new EHpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 5 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::EHP6:
            {
                Element* elt( new EHpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 6 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::EHP7:
            {
                Element* elt( new EHpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 7 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::EHP8:
            {
                Element* elt( new EHpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 8 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::EHP9:
            {
                Element* elt( new EHpn( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), 9 ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::LINK:
            {
                Element* elt( new Link( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol(), whiteSpace ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::ELINK:
            {
                Element* elt( new ELink( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol() ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::LM:
            {
                Element* elt( new Lm( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol() ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::RM:
            {
                Element* elt( new Rm( document, this, document->dataName(),
                    document->lexerLine(), document->lexerCol() ) );
                appendChild( elt );
                tok = elt->parse( lexer );
            }
            break;
        case Lexer::EUSERDOC:
            break;
        default:
            notHandled = true;
            break;
        }
    }
    else if( tok == Lexer::ERROR_TAG ) {
        document->printError( ERR1_TAGNOTDEF );
        tok = document->getNextToken();
    }
    else if( tok == Lexer::ERROR_ENTITY ) {
        document->printError( ERR1_TAGNOTDEF );
        tok = document->getNextToken();
    }
    return notHandled;
}