[FFmpeg-trac] #11096(undetermined:new): Chaotic escaping rules
FFmpeg
trac at avcodec.org
Thu Jul 11 08:03:39 EEST 2024
#11096: Chaotic escaping rules
-------------------------------------+-------------------------------------
Reporter: ManDay | Owner: (none)
Type: enhancement | Status: new
Priority: normal | Component:
| undetermined
Version: git-master | Resolution:
Keywords: | Blocked By:
filter_complex expression |
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
Comment (by ManDay):
I don't see a general (conceptual) issue. Could you elaborate what you
mean (I'm not a CStist and "Reverse Solidus Toothbrush" didn't bring up
any results).
In principle, I think escaping and quoting follows a simple pattern, which
is unrecognizable in FFMPEG:
Starting from the "top" (whole data), **recursively** define parsers which
operate on the input and, by their respective syntactic elements,
decompose the data into semantically related blocks, which are fed into
"lower" parsers. These blocks are atomic/opaque to the parser at this
level.
To prevent data from being (mis)interpreted as syntactic elements, two
special syntactic elements are defined:
- Quotes (prevent interpretation in their range)
- Escapes (prevent interpretation immediately after)
In this case, one possibility to split the parsing could be:
At the "top" we have the //filter-complex// parser with escape `\` and
quote `'` which parses `drawtext=text='%{e:if(1,\'a\',\'b\')}'` into
blocks `drawtext` `text` `%{e:if(1,'a','b')}`. By their semantics,
`drawtext` is used to create a filter to which the arguments of type
`pair[]`, here {(`text`,`%{e:if(1,'a','b')}`)} are handed over.
At a lower level we have the //drawtext// parser for //parameter names//
which parses `text` (trivial) and the //drawtext text// parser which
parses `%{e:if(1,'a','b')}`. The //drawtext text// parser uses escape `\`
and no quotes (afaik). It yields the blocks: `e` and `if(1,'a','b')`.
At the lowest level we have the //expression// parser with escape `\` and
quote `'`.
--
Ticket URL: <https://trac.ffmpeg.org/ticket/11096#comment:3>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list