- if (lexrc.next())
- category_ = lexrc.getDocString();
- break;
-
- case LT_COPYSTYLE: // initialize with a known style
- if (lexrc.next()) {
- docstring const style = subst(lexrc.getDocString(),
- '_', ' ');
-
- if (tclass.hasLayout(style)) {
- docstring const tmpname = name_;
- this->operator=(tclass[style]);
- name_ = tmpname;
- } else {
- lyxerr << "Cannot copy unknown style `"
- << to_utf8(style) << "'\n"
- << "All layouts so far:"
- << endl;
- DocumentClass::const_iterator lit = tclass.begin();
- DocumentClass::const_iterator len = tclass.end();
- for (; lit != len; ++lit)
- lyxerr << to_utf8(lit->name()) << endl;
-
- //lexrc.printError("Cannot copy known "
- // "style `$$Token'");
- }
+ lex >> category_;
+ break;
+
+ case LT_COPYSTYLE: { // initialize with a known style
+ docstring style;
+ lex >> style;
+ style = subst(style, '_', ' ');
+
+ if (tclass.hasLayout(style)) {
+ docstring const tmpname = name_;
+ this->operator=(tclass[style]);
+ name_ = tmpname;
+ } else {
+ lyxerr << "Cannot copy unknown style `"
+ << to_utf8(style) << "'\n"
+ << "All layouts so far:"
+ << endl;
+ DocumentClass::const_iterator lit = tclass.begin();
+ DocumentClass::const_iterator len = tclass.end();
+ for (; lit != len; ++lit)
+ lyxerr << to_utf8(lit->name()) << endl;
+
+ //lex.printError("Cannot copy known "
+ // "style `$$Token'");
- case LT_OBSOLETEDBY: // replace with a known style
- if (lexrc.next()) {
- docstring const style =
- subst(lexrc.getDocString(), '_', ' ');
-
- if (tclass.hasLayout(style)) {
- docstring const tmpname = name_;
- this->operator=(tclass[style]);
- name_ = tmpname;
- if (obsoleted_by().empty())
- obsoleted_by_ = style;
- } else {
- lyxerr << "Cannot replace with unknown style `"
- << to_utf8(style) << '\'' << endl;
-
- //lexrc.printError("Cannot replace with"
- // " unknown style "
- // "`$$Token'");
- }
+ case LT_OBSOLETEDBY: { // replace with a known style
+ docstring style;
+ lex >> style;
+ style = subst(style, '_', ' ');
+
+ if (tclass.hasLayout(style)) {
+ docstring const tmpname = name_;
+ this->operator=(tclass[style]);
+ name_ = tmpname;
+ if (obsoleted_by().empty())
+ obsoleted_by_ = style;
+ } else {
+ lyxerr << "Cannot replace with unknown style `"
+ << to_utf8(style) << '\'' << endl;
+
+ //lex.printError("Cannot replace with"
+ // " unknown style "
+ // "`$$Token'");
- if (lexrc.next()) {
- labelstring_ = trim(lexrc.getDocString());
- labelstring_appendix_ = labelstring_;
- }
+ // FIXME: this means LT_ENDLABELSTRING may only
+ // occur after LT_LABELSTRING
+ lex >> labelstring_;
+ labelstring_ = trim(labelstring_);
+ labelstring_appendix_ = labelstring_;
-void Layout::readAlign(Lexer & lexrc)
-{
- LexerKeyword alignTags[] = {
- { "block", AT_BLOCK },
- { "center", AT_CENTER },
- { "layout", AT_LAYOUT },
- { "left", AT_LEFT },
- { "right", AT_RIGHT }
- };
+LexerKeyword alignTags[] = {
+ { "block", AT_BLOCK },
+ { "center", AT_CENTER },
+ { "layout", AT_LAYOUT },
+ { "left", AT_LEFT },
+ { "right", AT_RIGHT }
+};
+
- PushPopHelper pph(lexrc, alignTags, AT_LAYOUT);
- int le = lexrc.lex();
+void Layout::readAlign(Lexer & lex)
+{
+ PushPopHelper pph(lex, alignTags);
+ int le = lex.lex();
- LexerKeyword alignTags[] = {
- { "block", AT_BLOCK },
- { "center", AT_CENTER },
- { "layout", AT_LAYOUT },
- { "left", AT_LEFT },
- { "right", AT_RIGHT }
- };
-
- lexrc.pushTable(alignTags);
+ lex.pushTable(alignTags);
- { "bibliography", LA_BIBLIO },
- { "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT },
- { "counter", LA_COUNTER },
- { "enumerate", LA_ENUMERATE },
- { "itemize", LA_ITEMIZE },
- { "manual", LA_MANUAL },
- { "no_label", LA_NO_LABEL },
- { "sensitive", LA_SENSITIVE },
- { "static", LA_STATIC },
- { "top_environment", LA_TOP_ENVIRONMENT }
+ { "bibliography", LA_BIBLIO },
+ { "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT },
+ { "counter", LA_COUNTER },
+ { "enumerate", LA_ENUMERATE },
+ { "itemize", LA_ITEMIZE },
+ { "manual", LA_MANUAL },
+ { "no_label", LA_NO_LABEL },
+ { "sensitive", LA_SENSITIVE },
+ { "static", LA_STATIC },
+ { "top_environment", LA_TOP_ENVIRONMENT }
- { "box", END_LABEL_BOX },
- { "filled_box", END_LABEL_FILLED_BOX },
- { "no_label", END_LABEL_NO_LABEL },
- { "static", END_LABEL_STATIC }
-};
-
+ static LexerKeyword endlabelTypeTags[] = {
+ { "box", END_LABEL_BOX },
+ { "filled_box", END_LABEL_FILLED_BOX },
+ { "no_label", END_LABEL_NO_LABEL },
+ { "static", END_LABEL_STATIC }
+ };
-void Layout::readEndLabelType(Lexer & lexrc)
-{
- PushPopHelper pph(lexrc, endlabelTypeTags,
- END_LABEL_ENUM_LAST-END_LABEL_ENUM_FIRST+1);
- int le = lexrc.lex();
+ PushPopHelper pph(lex, endlabelTypeTags);
+ int le = lex.lex();
{
LexerKeyword marginTags[] = {
{ "dynamic", MARGIN_DYNAMIC },
{
LexerKeyword marginTags[] = {
{ "dynamic", MARGIN_DYNAMIC },
{
LexerKeyword latexTypeTags[] = {
{ "bib_environment", LATEX_BIB_ENVIRONMENT },
{
LexerKeyword latexTypeTags[] = {
{ "bib_environment", LATEX_BIB_ENVIRONMENT },
LexerKeyword spacingTags[] = {
{"double", ST_SPACING_DOUBLE },
{"onehalf", ST_SPACING_ONEHALF },
LexerKeyword spacingTags[] = {
{"double", ST_SPACING_DOUBLE },
{"onehalf", ST_SPACING_ONEHALF },
-Layout * Layout::forCaption()
-{
- Layout * lay = new Layout();
- lay->name_ = from_ascii("Caption");
- lay->latexname_ = "caption";
- lay->latextype = LATEX_COMMAND;
- lay->optionalargs = 1;
- return lay;
-}
-