Extend and modify RTF grammar to handle \NeXTHelpLink and \NeXTHelpMarker

commands possibly used in old documents generated on NeXTstep/OpenStep.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@31826 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Wolfgang Lux 2011-01-03 08:50:17 +00:00
parent 3831a1ef4e
commit 9f861c89a5
2 changed files with 44 additions and 4 deletions

View file

@ -124,6 +124,12 @@ int GSRTFlex(void *lvalp, void *lctxt);
%token <cmd> RTFNeXTGraphic
%token <cmd> RTFNeXTGraphicWidth
%token <cmd> RTFNeXTGraphicHeight
%token <cmd> RTFNeXTHelpLink
%token <cmd> RTFNeXTHelpMarker
%token <cmd> RTFNeXTfilename
%token <cmd> RTFNeXTmarkername
%token <cmd> RTFNeXTlinkFilename
%token <cmd> RTFNeXTlinkMarkername
%token <cmd> RTFpaperWidth
%token <cmd> RTFpaperHeight
%token <cmd> RTFmarginLeft
@ -183,7 +189,6 @@ rtfCharset: RTFansi { $$ = 1; }
;
rtfIngredients: /* empty */
| rtfIngredients rtfNeXTGraphic
| rtfIngredients rtfFontList
| rtfIngredients rtfColorDef
| rtfIngredients rtfStatement
@ -192,7 +197,7 @@ rtfIngredients: /* empty */
| rtfIngredients error
;
rtfBlock: '{' { GSRTFopenBlock(CTXT, NO); } rtfIngredients '}' { GSRTFcloseBlock(CTXT, NO); } /* may be empty */
rtfBlock: '{' { GSRTFopenBlock(CTXT, NO); } rtfIngredients rtfNeXTstuff '}' { GSRTFcloseBlock(CTXT, NO); } /* may be empty */
| '{' { GSRTFopenBlock(CTXT, YES); } RTFignore rtfIngredients '}' { GSRTFcloseBlock(CTXT, YES); }
| '{' { GSRTFopenBlock(CTXT, YES); } RTFinfo rtfIngredients '}' { GSRTFcloseBlock(CTXT, YES); }
| '{' { GSRTFopenBlock(CTXT, YES); } RTFstylesheet rtfIngredients '}' { GSRTFcloseBlock(CTXT, YES); }
@ -364,6 +369,12 @@ rtfStatement: RTFfont { int font;
free((void*)$1.name); }
;
rtfNeXTstuff: /* empty */
| rtfNeXTGraphic
| rtfNeXTHelpLink
| rtfNeXTHelpMarker
;
/*
NeXTGraphic (images)
This is a Apple/NeXT extension. The format of the command is
@ -373,11 +384,34 @@ rtfStatement: RTFfont { int font;
Attributed Strings Programming Guide.
*/
rtfNeXTGraphic: '{' '{' RTFNeXTGraphic RTFtext RTFNeXTGraphicWidth RTFNeXTGraphicHeight '}' { GSRTFopenBlock(CTXT, YES); } rtfIngredients { GSRTFcloseBlock(CTXT, YES); } '}'
rtfNeXTGraphic: '{' RTFNeXTGraphic RTFtext RTFNeXTGraphicWidth RTFNeXTGraphicHeight '}' { GSRTFopenBlock(CTXT, YES); } rtfIngredients { GSRTFcloseBlock(CTXT, YES); }
{
GSRTFNeXTGraphic (CTXT, $4, $5.parameter, $6.parameter);
GSRTFNeXTGraphic (CTXT, $3, $4.parameter, $5.parameter);
};
/*
NeXTHelpLink
This is a NeXT extension. The format of the command is
{{\NeXTHelpLinkN \markername markername; \linkFilename filename;
\linkMarkername markername;} string}
and the string is ignored (it is always 0xAC on NeXT).
Note that the {\NeXTHelpLink } group may itself be preceded by
other commands.
*/
rtfNeXTHelpLink: '{' RTFNeXTHelpLink RTFNeXTmarkername RTFtext RTFNeXTlinkFilename RTFtext RTFNeXTlinkMarkername RTFtext '}' { GSRTFopenBlock(CTXT, YES); } rtfIngredients { GSRTFcloseBlock(CTXT, YES); };
/*
NeXTHelpMarker
This is a NeXT extension. The format of the command is
{{\NeXTHelpMarkerN \markername markername;} string}
and the string is ignored (it is always 0xAC on NeXT).
Note that the {\NeXTHelpLink } group may itself be preceded by
other commands.
*/
rtfNeXTHelpMarker: '{' RTFNeXTHelpMarker RTFNeXTmarkername RTFtext '}' { GSRTFopenBlock(CTXT, YES); } rtfIngredients { GSRTFcloseBlock(CTXT, YES); };
/*
Font description
*/

View file

@ -160,6 +160,8 @@ int findStringFromKeywordArray(const char *string, const LexKeyword *array,
LexKeyword RTFcommands[] =
{
{"NeXTGraphic",token(RTFNeXTGraphic)},
{"NeXTHelpLink",token(RTFNeXTHelpLink)},
{"NeXTHelpMarker",token(RTFNeXTHelpMarker)},
{"ansi", token(RTFansi)},
{"b", token(RTFbold)},
{"blue", token(RTFblue)},
@ -178,6 +180,7 @@ LexKeyword RTFcommands[] =
{"fcharset", token(RTFfcharset)},
{"fdecor", token(RTFfamilyDecor)},
{"fi", token(RTFfirstLineIndent)},
{"filename", token(RTFNeXTfilename)},
{"fmodern", token(RTFfamilyModern)},
{"fnil", token(RTFfamilyNil)},
{"fonttbl", token(RTFfontListStart)},
@ -204,12 +207,15 @@ LexKeyword RTFcommands[] =
{"info", token(RTFinfo)},
{"ldblquote", token(RTFldblquote)},
{"li", token(RTFleftIndent)},
{"linkFilename",token(RTFNeXTlinkFilename)},
{"linkMarkername",token(RTFNeXTlinkMarkername)},
{"lquote", token(RTFlquote)},
{"mac", token(RTFmac)},
{"margb", token(RTFmarginButtom)},
{"margl", token(RTFmarginLeft)},
{"margr", token(RTFmarginRight)},
{"margt", token(RTFmarginTop)},
{"markername",token(RTFNeXTmarkername)},
{"paperh", token(RTFpaperHeight)},
{"paperw", token(RTFpaperWidth)},
{"par", token(RTFparagraph)},