mirror of https://github.com/odrling/Aegisub
Small fixes to SRT tag parser. Updates #1301.
Originally committed to SVN as r5435.
This commit is contained in:
parent
b62bdb9b12
commit
4f1013d0b7
|
@ -59,7 +59,7 @@ class SrtTagParser {
|
||||||
wxString color;
|
wxString color;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum TagType {
|
||||||
// leave 0 unused so indexing an unknown tag in the map won't clash
|
// leave 0 unused so indexing an unknown tag in the map won't clash
|
||||||
TAG_BOLD_OPEN = 1,
|
TAG_BOLD_OPEN = 1,
|
||||||
TAG_BOLD_CLOSE,
|
TAG_BOLD_CLOSE,
|
||||||
|
@ -75,12 +75,12 @@ class SrtTagParser {
|
||||||
|
|
||||||
wxRegEx tag_matcher;
|
wxRegEx tag_matcher;
|
||||||
wxRegEx attrib_matcher;
|
wxRegEx attrib_matcher;
|
||||||
std::map<wxString,int> tag_name_cases;
|
std::map<wxString,TagType> tag_name_cases;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SrtTagParser()
|
SrtTagParser()
|
||||||
: tag_matcher(L"^(.*?)<(/?b|/?i|/?u|/?s|/?font)(.*?)>(.*)$", wxRE_ICASE|wxRE_ADVANCED)
|
: tag_matcher(L"^(.*?)<(/?b|/?i|/?u|/?s|/?font)(.*?)>(.*)$", wxRE_ICASE|wxRE_ADVANCED)
|
||||||
, attrib_matcher(L"^[[:space:]](face|size|color)=('.*?'|\".*?\"|[^[:space:]]+)", wxRE_ICASE|wxRE_ADVANCED)
|
, attrib_matcher(L"^[[:space:]]+(face|size|color)=('.*?'|\".*?\"|[^[:space:]]+)", wxRE_ICASE|wxRE_ADVANCED)
|
||||||
{
|
{
|
||||||
if (!tag_matcher.IsValid())
|
if (!tag_matcher.IsValid())
|
||||||
throw Aegisub::InternalError(L"Parsing SRT: Failed compiling tag matching regex", 0);
|
throw Aegisub::InternalError(L"Parsing SRT: Failed compiling tag matching regex", 0);
|
||||||
|
@ -107,7 +107,7 @@ public:
|
||||||
int strikeout_level = 0;
|
int strikeout_level = 0;
|
||||||
std::vector<FontAttribs> font_stack;
|
std::vector<FontAttribs> font_stack;
|
||||||
|
|
||||||
wxString ass; // result to be built
|
wxString ass = L""; // result to be built
|
||||||
|
|
||||||
while (!srt.IsEmpty())
|
while (!srt.IsEmpty())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue