[Mesa-dev] [PATCH 1/2] split-to-files.py: fix parsing when #version is not at the beginning

Ilia Mirkin imirkin at alum.mit.edu
Mon Jan 25 07:25:20 PST 2016


On Mon, Jan 25, 2016 at 10:35 AM, Eero Tamminen
<eero.t.tamminen at intel.com> wrote:
> Hi,
>
>
> On 23.01.2016 15:24, Ilia Mirkin wrote:
>>
>> On Sat, Jan 23, 2016 at 8:05 AM, Marek Olšák <maraeo at gmail.com> wrote:
>>>
>>> On Sat, Jan 23, 2016 at 1:28 PM, Ilia Mirkin <imirkin at alum.mit.edu>
>>> wrote:
>>>>
>>>> Hmmmm... Because you can have
>>>>
>>>> // asdf
>>>> #version 150?
>>>>
>>>> Unfortunately this would also catch
>>>>
>>>> // #version 450
>>>> #version 150
>>>>
>>>> Would it work to put a ^ in the regex, i.e. r".*^#version....",
>>>> re.DOTALL?
>>>
>>>
>>> I don't know. I don't remember the app I needed this for. Also, I'm not
>>> sure
>>> if ^ works with DOTALL.
>>
>>
>> I just checked - it doesn't. I've definitely seen shaders with //
>> #version foo in them though. Perhaps just make the .* non-greedy, i.e.
>> .*? -- that should hopefully be good enough.
>
>
> "^[:space:]*#[:space:]*version..."?

Nope. We really do need . and not just . but DOTALL -- pretty sure
this is legal:

// asdf
#version foo

So we want to get rid of the "// asdf" as well.

  -ilia


More information about the mesa-dev mailing list