diff options
Diffstat (limited to 'src/doctokenizer.l')
-rw-r--r-- | src/doctokenizer.l | 84 |
1 files changed, 75 insertions, 9 deletions
diff --git a/src/doctokenizer.l b/src/doctokenizer.l index e0e72a7..9fd3c46 100644 --- a/src/doctokenizer.l +++ b/src/doctokenizer.l @@ -400,6 +400,7 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2} %x St_Para %x St_Comment %x St_Title +%x St_Caption %x St_TitleN %x St_TitleQ %x St_TitleA @@ -853,14 +854,18 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2} <St_Msc>. { /* msc text */ g_token->verb+=yytext; } -<St_PlantUMLOpt>\n { - g_token->sectionId=g_token->sectionId.stripWhiteSpace(); - BEGIN(St_PlantUML); - } -<St_PlantUMLOpt>["{}] { // skip curly brackets or quotes around the optional image name +<St_PlantUMLOpt>{BLANK}*"{"[^}]*"}" { // skip curly brackets around the optional image name + g_token->sectionId = yytext; + g_token->sectionId = g_token->sectionId.stripWhiteSpace(); + g_token->sectionId = g_token->sectionId.left(g_token->sectionId.length()-1); + g_token->sectionId = g_token->sectionId.right(g_token->sectionId.length()-1); + g_token->sectionId = g_token->sectionId.stripWhiteSpace(); + return RetVal_OK; } <St_PlantUMLOpt>. { - g_token->sectionId += yytext; + g_token->sectionId = ""; + unput(*yytext); + return RetVal_OK; } <St_PlantUML>{CMD}"enduml" { return RetVal_OK; @@ -870,6 +875,19 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2} <St_PlantUML>. { /* plantuml text */ g_token->verb+=yytext; } +<St_Caption>"\"" { // quoted title + BEGIN(St_TitleQ); + return TK_WORD; + } +<St_Caption>[ \t]+ { + g_token->name=""; + g_token->chars=yytext; + return TK_WHITESPACE; + } +<St_Caption>\n { + unput(*yytext); + return 0; + } <St_Title>"\"" { // quoted title BEGIN(St_TitleQ); } @@ -940,10 +958,38 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2} unput(*yytext); return 0; } +<St_Caption>{BLANK}*"min"{BLANK}* { // title special case min / max + g_token->name = "min"; + BEGIN(St_TitleA); + return TK_WORD; + } +<St_Caption>{BLANK}*"max"{BLANK}* { // title special case min / max + g_token->name = "max"; + BEGIN(St_TitleA); + return TK_WORD; + } +<St_Caption>{BLANK}*"width="{BLANK}* { // title attribute + g_token->name = yytext; + g_token->name = g_token->name.stripWhiteSpace(); + BEGIN(St_TitleV); + } +<St_Caption>{BLANK}*"height="{BLANK}* { // title attribute + g_token->name = yytext; + g_token->name = g_token->name.stripWhiteSpace(); + BEGIN(St_TitleV); + } +<St_TitleA>{BLANK}*"min"{BLANK}* { // title special case min / max + g_token->name = "min"; + return TK_WORD; + } +<St_TitleA>{BLANK}*"max"{BLANK}* { // title special case min / max + g_token->name = "max"; + return TK_WORD; + } <St_TitleA>{BLANK}*{ID}{BLANK}*"="{BLANK}* { // title attribute g_token->name = yytext; g_token->name = g_token->name.left( - g_token->name.find('=')).stripWhiteSpace(); + g_token->name.find('=')).stripWhiteSpace(); BEGIN(St_TitleV); } <St_TitleV>[^ \t\r\n]+ { // attribute value @@ -951,6 +997,10 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2} BEGIN(St_TitleN); return TK_WORD; } +<St_TitleV,St_TitleA>[ \t] { + g_token->chars=yytext; + return TK_WHITESPACE; + } <St_TitleV,St_TitleA>. { unput(*yytext); return 0; @@ -1224,7 +1274,7 @@ REFWORD {LABELID}|{REFWORD2}|{REFWORD3}|{LNKWORD2} return TK_COMMAND; } <*>. { - warn(g_fileName,yylineno,"Unexpected character `%s'",yytext); + warn(g_fileName,yylineno,"Unexpected character `%s'",yytext); } %% @@ -1267,6 +1317,16 @@ void doctokenizerYYsetStateTitle() BEGIN(St_Title); } +void doctokenizerYYsetStateCaption() +{ + BEGIN(St_Caption); +} + +void doctokenizerYYsetStateTitleAttr() +{ + BEGIN(St_TitleA); +} + void doctokenizerYYsetStateTitleAttrValue() { BEGIN(St_TitleV); @@ -1341,13 +1401,19 @@ void doctokenizerYYsetStateMsc() BEGIN(St_Msc); } -void doctokenizerYYsetStatePlantUML() +void doctokenizerYYsetStatePlantUMLOpt() { g_token->verb=""; g_token->sectionId=""; BEGIN(St_PlantUMLOpt); } +void doctokenizerYYsetStatePlantUML() +{ + g_token->verb=""; + BEGIN(St_PlantUML); +} + void doctokenizerYYsetStateParam() { BEGIN(St_Param); |