From d9507dbaf483c8357b690fd0a67fdd9873cceed0 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Tue, 15 Feb 2022 23:05:22 +0000 Subject: [PATCH] We handle variable replacements elsewhere. The markup parser needs to ignore them so they get rendered when we're not doing replacement. --- common/markup_parser.cpp | 2 -- include/markup_parser.h | 21 ++++----------------- 2 files changed, 4 insertions(+), 19 deletions(-) diff --git a/common/markup_parser.cpp b/common/markup_parser.cpp index be2995c33e..4d13c8cc95 100644 --- a/common/markup_parser.cpp +++ b/common/markup_parser.cpp @@ -50,8 +50,6 @@ std::string NODE::typeString() const else if( is_type() ) os << "OVERBAR"; else if( is_type() ) os << "ANYSTRING"; else if( is_type() ) os << "ANYSTRINGWITHINBRACES"; - else if( is_type() ) os << "VARNAMESPACENAME"; - else if( is_type() ) os << "VARNAME"; else os << "other"; return os.str(); diff --git a/include/markup_parser.h b/include/markup_parser.h index eef8402df5..584e4dcbe3 100644 --- a/include/markup_parser.h +++ b/include/markup_parser.h @@ -47,19 +47,10 @@ struct NODE : parse_tree::basic_node bool isSuperscript() const { return is_type(); } }; -struct varName : plus>> {}; - -struct varNamespaceName : plus {}; - -struct varNamespace : seq> {}; - -struct variable : seq< string< '$', '{' >, opt, varName, string< '}' > > {}; - template< typename ControlChar > struct plain : seq< not_at< seq< ControlChar, string< '{' > > >, ControlChar > {}; -struct plainControlChar : sor< plain< string<'$'> >, - plain< string<'_'> >, +struct plainControlChar : sor< plain< string<'_'> >, plain< string<'^'> >, plain< string<'~'> > > {}; /** @@ -67,16 +58,15 @@ struct plainControlChar : sor< plain< string<'$'> >, * a run of characters that do not start a command sequence, or if they do, they do not start * a complete command prefix (command char + open brace) */ -struct anyString : plus< sor< utf8::not_one< '~', '$', '_', '^' >, +struct anyString : plus< sor< utf8::not_one< '~', '_', '^' >, plainControlChar > > {}; -struct anyStringWithinBraces : plus< sor< utf8::not_one< '~', '$', '_', '^', '}' >, +struct anyStringWithinBraces : plus< sor< utf8::not_one< '~', '_', '^', '}' >, plainControlChar > > {}; template< typename ControlChar > struct braces : seq< seq< ControlChar, string< '{' > >, until< string< '}' >, sor< anyStringWithinBraces, - variable, subscript, superscript, overbar > > > {}; @@ -89,7 +79,6 @@ struct overbar : braces< string< '~' > > {}; * Finally, the full grammar */ struct anything : sor< anyString, - variable, subscript, superscript, overbar > {}; @@ -98,9 +87,7 @@ struct grammar : until< tao::pegtl::eof, anything > {}; template using selector = parse_tree::selector< Rule, - parse_tree::store_content::on< varNamespaceName, - varName, - anyStringWithinBraces, + parse_tree::store_content::on< anyStringWithinBraces, anyString >, parse_tree::discard_empty::on< superscript, subscript,