[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
Sat Jan 23 04:28:49 PST 2016


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?

  -ilia


On Sat, Jan 23, 2016 at 6:47 AM, Marek Olšák <maraeo at gmail.com> wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
>  split-to-files.py | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/split-to-files.py b/split-to-files.py
> index 151681e..14f19a4 100755
> --- a/split-to-files.py
> +++ b/split-to-files.py
> @@ -71,7 +71,7 @@ def write_shader_test(filename, shaders):
>      min_version = 110
>      for stage, num in shaders:
>          shader = shaders[(stage, num)]
> -        m = re.match(r"^#version (\d\d\d)", shader)
> +        m = re.match(r".*#version (\d\d\d)", shader, re.DOTALL)
>          if m:
>              version = int(m.group(1), 10)
>              if version > min_version:
> --
> 2.1.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list