ass_tag_parser icon indicating copy to clipboard operation
ass_tag_parser copied to clipboard

Don't raise an exception, simply have a class for unknow tag

Open moi15moi opened this issue 2 years ago • 2 comments

Currently, ass_tag_parser can't parse VSFilterMod tag which is totally ok, because they have they are useless.

But, it would be better if it could not raise an exception. It should simply have a class for unknowtag.

Here is the code I have:

result = parse_ass(
    r"{\fnJester\fsc20}test"
)
print(result)

What it currently does: ass_tag_parser.errors.BadAssTagArgument: syntax error at pos 16: \fs requires an integer

What it could do: [AssTagListOpening(), AssTagFontName(name='Jester'), AssUnknowTag(text=fsc20), AssTagListEnding(), AssText(text='test')]

moi15moi avatar Apr 25 '22 22:04 moi15moi

@moi15moi

The AssUnknownTag approach won't work because we don't know the grammar of unknown tags. We don't know where they end and where a comment should start.

Since I don't have time to actively maintain this project, please consider opening a pull request that introduces strict argument to the parse function which ignores exceptions and treats unknown tags as comments.

rr- avatar Apr 26 '22 07:04 rr-

Thanks for the fast answer.

I will see if I do something, but I doubt I will be able to do anything.

moi15moi avatar Apr 26 '22 23:04 moi15moi