Commit 5efb36b9 by Shahbaz Youssefi Committed by Commit Bot

Automatically call flex/bison if necessary

ANGLE translator's parser code generation is changed to use the binaries of flex/bison stored in the cloud. scripts/run_code_generation.py now automatically runs these files if the input files change. Bug: angleproject:3419 Change-Id: Icce4247f93b27baf8ee12dbb16112fa2cc98c111 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1940572Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Shahbaz Youssefi <syoussefi@chromium.org>
parent 62a93045
* text=auto * text=auto
*.sln eol=crlf *.sln eol=crlf
*.vcxproj eol=crlf *.vcxproj eol=crlf
*.vcxproj.filters eol=crlf *.vcxproj.filters eol=crlf
*.bat eol=crlf *.bat eol=crlf
*.rc eol=crlf *.rc eol=crlf
**/compiled/*.h eol=crlf **/compiled/*.h eol=crlf
**/shaders/gen/*.inc eol=lf **/shaders/gen/*.inc eol=lf
*.sh eol=lf *.sh eol=lf
*.gn eol=lf *.gn eol=lf
*.gni eol=lf *.gni eol=lf
src/compiler/preprocessor/preprocessor_*.* eol=lf
src/compiler/translator/glslang_*.* eol=lf
# Git conflict markers in the json file break the code generator. # Git conflict markers in the json file break the code generator.
# Using a binary merge strategy forces conflicts without changing file contents. # Using a binary merge strategy forces conflicts without changing file contents.
......
...@@ -385,6 +385,34 @@ hooks = [ ...@@ -385,6 +385,34 @@ hooks = [
'-s', 'tools/glslang/glslang_validator.exe.sha1', '-s', 'tools/glslang/glslang_validator.exe.sha1',
], ],
}, },
# Download flex/bison binaries for Linux.
{
'name': 'linux_flex_bison',
'pattern': '.',
'condition': 'checkout_linux and not build_with_chromium',
'action': [ 'download_from_google_storage',
'--no_resume',
'--platform=linux*',
'--no_auth',
'--bucket', 'angle-flex-bison',
'-d', 'tools/flex-bison/linux/',
],
},
# Download flex/bison binaries for Windows.
{
'name': 'win_flex_bison',
'pattern': '.',
'condition': 'checkout_win and not build_with_chromium',
'action': [ 'download_from_google_storage',
'--no_resume',
'--platform=win32*',
'--no_auth',
'--bucket', 'angle-flex-bison',
'-d', 'tools/flex-bison/windows/',
],
},
] ]
recursedeps = [ recursedeps = [
......
...@@ -20,8 +20,6 @@ On Windows: ...@@ -20,8 +20,6 @@ On Windows:
* [Visual Studio Community 2019](https://visualstudio.microsoft.com/vs/) * [Visual Studio Community 2019](https://visualstudio.microsoft.com/vs/)
* [Windows 10 Standalone SDK version 10.0.17134 exactly](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk). * [Windows 10 Standalone SDK version 10.0.17134 exactly](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk).
* Comes with additional features that aid development, such as the Debug runtime for D3D11. Required for the D3D Compiler DLL. * Comes with additional features that aid development, such as the Debug runtime for D3D11. Required for the D3D Compiler DLL.
* (optional) [Cygwin's Bison, flex, and patch](https://cygwin.com/setup-x86_64.exe)
* This is only required if you need to modify GLSL ES grammar files (`glslang.l` and `glslang.y` under `src/compiler/translator`, or `ExpressionParser.y` and `Tokenizer.l` in `src/compiler/preprocessor`).
* (optional) See the [Chromium Windows build instructions](https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md) for more info. * (optional) See the [Chromium Windows build instructions](https://chromium.googlesource.com/chromium/src/+/master/docs/windows_build_instructions.md) for more info.
On Linux: On Linux:
......
{
"src/compiler/preprocessor/generate_parser.py":
"cc871de99688a35bfe32ef501f965d5a",
"src/compiler/preprocessor/preprocessor.l":
"143dec2269b9a49a9588391bb57580ec",
"src/compiler/preprocessor/preprocessor.y":
"a3a7dcbf9fd1cf1721ab635cea0189b2",
"src/compiler/preprocessor/preprocessor_lex_autogen.cpp":
"5e2dd7b0f74393db96ca6d9b0adeae0b",
"src/compiler/preprocessor/preprocessor_tab_autogen.cpp":
"1faa877557cf67e564cabc547aa3f3c0",
"tools/flex-bison/linux/bison.sha1":
"efa86001f00e7bcfdbe899dd15fc88e0",
"tools/flex-bison/linux/flex.sha1":
"3e73ddbd801cf3e8ed759c49572c8bf2",
"tools/flex-bison/windows/bison.exe.sha1":
"ad6345f2fbf1112bae67f0d54a92e574",
"tools/flex-bison/windows/flex.exe.sha1":
"45668fa0dafd4a7e68c2b0480e50e650",
"tools/flex-bison/windows/m4.exe.sha1":
"0e0332c889b12576458bc481f34d6142",
"tools/flex-bison/windows/msys-2.0.dll.sha1":
"59854139bd445e5193812e2b910dc7b5",
"tools/flex-bison/windows/msys-iconv-2.dll.sha1":
"5da154b537d340991bb4cd06eca6d523",
"tools/flex-bison/windows/msys-intl-8.dll.sha1":
"3b5cd216061b9dff4d2ae3956bc344a8"
}
\ No newline at end of file
{
"src/compiler/translator/generate_parser.py":
"566178ecdfae3a29803b3687fc518ebb",
"src/compiler/translator/glslang.l":
"84952cb3af3498f56f4cf9c0435285f2",
"src/compiler/translator/glslang.y":
"e32a1376309bd63368e45a968362d375",
"src/compiler/translator/glslang_lex_autogen.cpp":
"53be7b052dea27573461ae8faf9d837c",
"src/compiler/translator/glslang_tab_autogen.cpp":
"ce4d6a80cebfee9b0c28ebfd51287fea",
"src/compiler/translator/glslang_tab_autogen.h":
"4133ae84a4c17051cf114f404fea0046",
"tools/flex-bison/linux/bison.sha1":
"efa86001f00e7bcfdbe899dd15fc88e0",
"tools/flex-bison/linux/flex.sha1":
"3e73ddbd801cf3e8ed759c49572c8bf2",
"tools/flex-bison/windows/bison.exe.sha1":
"ad6345f2fbf1112bae67f0d54a92e574",
"tools/flex-bison/windows/flex.exe.sha1":
"45668fa0dafd4a7e68c2b0480e50e650",
"tools/flex-bison/windows/m4.exe.sha1":
"0e0332c889b12576458bc481f34d6142",
"tools/flex-bison/windows/msys-2.0.dll.sha1":
"59854139bd445e5193812e2b910dc7b5",
"tools/flex-bison/windows/msys-iconv-2.dll.sha1":
"5da154b537d340991bb4cd06eca6d523",
"tools/flex-bison/windows/msys-intl-8.dll.sha1":
"3b5cd216061b9dff4d2ae3956bc344a8"
}
\ No newline at end of file
...@@ -73,6 +73,10 @@ generators = { ...@@ -73,6 +73,10 @@ generators = {
'src/libANGLE/renderer/gen_angle_format_table.py', 'src/libANGLE/renderer/gen_angle_format_table.py',
'ANGLE load functions table': 'ANGLE load functions table':
'src/libANGLE/renderer/gen_load_functions_table.py', 'src/libANGLE/renderer/gen_load_functions_table.py',
'ANGLE shader preprocessor':
'src/compiler/preprocessor/generate_parser.py',
'ANGLE shader translator':
'src/compiler/translator/generate_parser.py',
'D3D11 blit shader selection': 'D3D11 blit shader selection':
'src/libANGLE/renderer/d3d/d3d11/gen_blit11helper.py', 'src/libANGLE/renderer/d3d/d3d11/gen_blit11helper.py',
'D3D11 format': 'D3D11 format':
......
...@@ -108,9 +108,9 @@ angle_translator_sources = [ ...@@ -108,9 +108,9 @@ angle_translator_sources = [
"src/compiler/translator/VariablePacker.h", "src/compiler/translator/VariablePacker.h",
"src/compiler/translator/blocklayout.cpp", "src/compiler/translator/blocklayout.cpp",
"src/compiler/translator/glslang.h", "src/compiler/translator/glslang.h",
"src/compiler/translator/glslang_lex.cpp", "src/compiler/translator/glslang_lex_autogen.cpp",
"src/compiler/translator/glslang_tab.cpp", "src/compiler/translator/glslang_tab_autogen.cpp",
"src/compiler/translator/glslang_tab.h", "src/compiler/translator/glslang_tab_autogen.h",
"src/compiler/translator/length_limits.h", "src/compiler/translator/length_limits.h",
"src/compiler/translator/util.cpp", "src/compiler/translator/util.cpp",
"src/compiler/translator/util.h", "src/compiler/translator/util.h",
...@@ -325,7 +325,6 @@ angle_preprocessor_sources = [ ...@@ -325,7 +325,6 @@ angle_preprocessor_sources = [
"src/compiler/preprocessor/DirectiveHandlerBase.h", "src/compiler/preprocessor/DirectiveHandlerBase.h",
"src/compiler/preprocessor/DirectiveParser.cpp", "src/compiler/preprocessor/DirectiveParser.cpp",
"src/compiler/preprocessor/DirectiveParser.h", "src/compiler/preprocessor/DirectiveParser.h",
"src/compiler/preprocessor/ExpressionParser.cpp",
"src/compiler/preprocessor/ExpressionParser.h", "src/compiler/preprocessor/ExpressionParser.h",
"src/compiler/preprocessor/Input.cpp", "src/compiler/preprocessor/Input.cpp",
"src/compiler/preprocessor/Input.h", "src/compiler/preprocessor/Input.h",
...@@ -335,12 +334,13 @@ angle_preprocessor_sources = [ ...@@ -335,12 +334,13 @@ angle_preprocessor_sources = [
"src/compiler/preprocessor/Macro.h", "src/compiler/preprocessor/Macro.h",
"src/compiler/preprocessor/MacroExpander.cpp", "src/compiler/preprocessor/MacroExpander.cpp",
"src/compiler/preprocessor/MacroExpander.h", "src/compiler/preprocessor/MacroExpander.h",
"src/compiler/preprocessor/preprocessor_lex_autogen.cpp",
"src/compiler/preprocessor/preprocessor_tab_autogen.cpp",
"src/compiler/preprocessor/Preprocessor.cpp", "src/compiler/preprocessor/Preprocessor.cpp",
"src/compiler/preprocessor/Preprocessor.h", "src/compiler/preprocessor/Preprocessor.h",
"src/compiler/preprocessor/SourceLocation.h", "src/compiler/preprocessor/SourceLocation.h",
"src/compiler/preprocessor/Token.cpp", "src/compiler/preprocessor/Token.cpp",
"src/compiler/preprocessor/Token.h", "src/compiler/preprocessor/Token.h",
"src/compiler/preprocessor/Tokenizer.cpp",
"src/compiler/preprocessor/Tokenizer.h", "src/compiler/preprocessor/Tokenizer.h",
"src/compiler/preprocessor/numeric_lex.h", "src/compiler/preprocessor/numeric_lex.h",
] ]
#!/usr/bin/python
# Copyright 2019 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# generate_parser_tools.py:
# Common functionality to call flex and bison to generate lexer and parser of
# the translator and preprocessor.
import os
import platform
import subprocess
import sys
is_linux = platform.system() == 'Linux'
is_windows = platform.system() == 'Windows'
def get_tool_path_platform(tool_name, platform):
exe_path = os.path.join(sys.path[0], '..', '..', '..', 'tools', 'flex-bison', platform)
return os.path.join(exe_path, tool_name)
def get_tool_path(tool_name):
if is_linux:
platform = 'linux'
ext = ''
else:
assert (is_windows)
platform = 'windows'
ext = '.exe'
return get_tool_path_platform(tool_name + ext, platform)
def get_tool_file_sha1s():
files = [
get_tool_path_platform('flex', 'linux'),
get_tool_path_platform('bison', 'linux'),
get_tool_path_platform('flex.exe', 'windows'),
get_tool_path_platform('bison.exe', 'windows'),
get_tool_path_platform('m4.exe', 'windows')
]
files += [
get_tool_path_platform(dll, 'windows')
for dll in ['msys-2.0.dll', 'msys-iconv-2.dll', 'msys-intl-8.dll']
]
return [f + '.sha1' for f in files]
def run_flex(basename):
flex = get_tool_path('flex')
input_file = basename + '.l'
output_source = basename + '_lex_autogen.cpp'
flex_args = [flex, '--noline', '--nounistd', '--outfile=' + output_source, input_file]
flex_env = os.environ.copy()
if is_windows:
flex_env['M4'] = get_tool_path_platform('m4.exe', 'windows')
process = subprocess.Popen(flex_args, env=flex_env, cwd=sys.path[0])
process.communicate()
if process.returncode != 0:
return process.returncode
# Patch flex output for 64-bit. The patch is simple enough that we could do a string
# replacement. More importantly, the location of the line of code that needs to be substituted
# can vary based on flex version, and the string substitution will find the correct place
# automatically.
patch_in = """
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
yyg->yy_n_chars, num_to_read );"""
patch_out = """
yy_size_t ret = 0;
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
ret, num_to_read );
yyg->yy_n_chars = static_cast<int>(ret);"""
with open(output_source, 'r') as flex_output:
output = flex_output.read()
# If flex's output changes such that this line no longer exists, the patch needs to be
# updated, or possibly removed.
assert (output.find(patch_in) != -1)
patched = output.replace(patch_in, patch_out)
with open(output_source, 'w') as flex_output_patched:
flex_output_patched.write(patched)
return 0
def run_bison(basename, generate_header):
bison = get_tool_path('bison')
input_file = basename + '.y'
output_header = basename + '_tab_autogen.h'
output_source = basename + '_tab_autogen.cpp'
bison_args = [bison, '--no-lines', '--skeleton=yacc.c']
if generate_header:
bison_args += ['--defines=' + output_header]
bison_args += ['--output=' + output_source, input_file]
bison_env = os.environ.copy()
bison_env['BISON_PKGDATADIR'] = get_tool_path_platform('', 'third_party')
if is_windows:
bison_env['M4'] = get_tool_path_platform('m4.exe', 'windows')
process = subprocess.Popen(bison_args, env=bison_env, cwd=sys.path[0])
process.communicate()
return process.returncode
def get_input_files(basename):
files = [basename + '.l', basename + '.y']
return [os.path.join(sys.path[0], f) for f in files]
def get_output_files(basename, generate_header):
optional_header = [basename + '_tab_autogen.h'] if generate_header else []
files = [basename + '_lex_autogen.cpp', basename + '_tab_autogen.cpp'] + optional_header
return [os.path.join(sys.path[0], f) for f in files]
def generate_parser(basename, generate_header):
# Handle inputs/outputs for run_code_generation.py's auto_script
if len(sys.argv) > 1:
if sys.argv[1] == 'inputs':
inputs = get_tool_file_sha1s()
inputs += get_input_files(basename)
print(','.join(inputs))
if sys.argv[1] == 'outputs':
print(','.join(get_output_files(basename, generate_header)))
return 0
# Call flex and bison to generate the lexer and parser.
flex_result = run_flex(basename)
if flex_result != 0:
print 'Failed to run flex. Error ' + str(flex_result)
return 1
bison_result = run_bison(basename, generate_header)
if bison_result != 0:
print 'Failed to run bison. Error ' + str(bison_result)
return 2
return 0
diff --git a/src/compiler/preprocessor/Tokenizer.cpp b/src/compiler/preprocessor/Tokenizer.cpp
index 0d7ad58..5ef0e5e 100644
--- a/src/compiler/preprocessor/Tokenizer.cpp
+++ b/src/compiler/preprocessor/Tokenizer.cpp
@@ -1746,8 +1746,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
+ yy_size_t ret = 0;
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, num_to_read );
+ ret, num_to_read );
+ yyg->yy_n_chars = static_cast<int>(ret);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
}
#!/usr/bin/python
# Copyright 2019 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# generate_parser.py:
# Generate lexer and parser for ANGLE's shader preprocessor.
import sys
sys.path.append('..')
import generate_parser_tools
basename = 'preprocessor'
def main():
return generate_parser_tools.generate_parser(basename, False)
if __name__ == '__main__':
sys.exit(main())
#!/bin/bash
# Copyright 2012 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Generates various components of GLSL ES preprocessor.
run_flex()
{
input_file=$script_dir/$1
output_source=$script_dir/$2
flex --noline --nounistd --outfile=$output_source $input_file
}
run_bison()
{
input_file=$script_dir/$1
output_source=$script_dir/$2
bison --no-lines --skeleton=yacc.c --output=$output_source $input_file
}
script_dir=$(dirname $0)
# Generate preprocessor
run_flex Tokenizer.l Tokenizer.cpp
run_bison ExpressionParser.y ExpressionParser.cpp
patch --silent --forward < 64bit-tokenizer-safety.patch
...@@ -9,17 +9,21 @@ This file contains the Lex specification for GLSL ES preprocessor. ...@@ -9,17 +9,21 @@ This file contains the Lex specification for GLSL ES preprocessor.
Based on Microsoft Visual Studio 2010 Preprocessor Grammar: Based on Microsoft Visual Studio 2010 Preprocessor Grammar:
http://msdn.microsoft.com/en-us/library/2scxys89.aspx http://msdn.microsoft.com/en-us/library/2scxys89.aspx
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh. IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN scripts/run_code_generation.py
*/ */
%top{ %top{
// GENERATED FILE - DO NOT EDIT.
// Generated by generate_parser.py from preprocessor.l
// //
// Copyright 2011 The ANGLE Project Authors. All rights reserved. // Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// preprocessor.l:
// Lexer for the OpenGL shading language preprocessor.
// This file is auto-generated by generate_parser.sh. DO NOT EDIT! // clang-format off
} }
%{ %{
......
...@@ -7,18 +7,22 @@ ...@@ -7,18 +7,22 @@
This file contains the Yacc grammar for GLSL ES preprocessor expression. This file contains the Yacc grammar for GLSL ES preprocessor expression.
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh, IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN scripts/run_code_generation.py
WHICH GENERATES THE GLSL ES preprocessor expression parser. WHICH GENERATES THE GLSL ES preprocessor expression parser.
*/ */
%{ %{
// GENERATED FILE - DO NOT EDIT.
// Generated by generate_parser.py from preprocessor.y
// //
// Copyright 2012 The ANGLE Project Authors. All rights reserved. // Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// preprocessor.y:
// Parser for the OpenGL shading language preprocessor.
// This file is auto-generated by generate_parser.sh. DO NOT EDIT! // clang-format off
#if defined(__GNUC__) #if defined(__GNUC__)
// Triggered by the auto-generated pplval variable. // Triggered by the auto-generated pplval variable.
......
diff --git a/src/compiler/translator/glslang_lex.cpp b/src/compiler/translator/glslang_lex.cpp
index 1ba63df..2a206ab 100644
--- a/src/compiler/translator/glslang_lex.cpp
+++ b/src/compiler/translator/glslang_lex.cpp
@@ -2698,8 +2703,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
+ size_t result = 0;
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, num_to_read );
+ result, num_to_read );
+ yyg->yy_n_chars = static_cast<int>(result);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
}
#!/usr/bin/python
# Copyright 2019 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
# generate_parser.py:
# Generate lexer and parser for ANGLE's translator.
import sys
sys.path.append('..')
import generate_parser_tools
basename = 'glslang'
def main():
return generate_parser_tools.generate_parser(basename, True)
if __name__ == '__main__':
sys.exit(main())
#!/bin/bash
# Copyright 2010 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Generates GLSL ES parser - glslang_lex.cpp, glslang_tab.h, and glslang_tab.cpp
run_flex()
{
input_file=./$1.l
output_source=./$1_lex.cpp
flex --noline --nounistd --outfile=$output_source $input_file
}
run_bison()
{
input_file=./$1.y
output_header=./$1_tab.h
output_source=./$1_tab.cpp
bison --no-lines --skeleton=yacc.c --defines=$output_header --output=$output_source $input_file
}
script_dir=$(dirname $0)
# Generate Parser
cd $script_dir
run_flex glslang
run_bison glslang
patch --silent --forward < 64bit-lexer-safety.patch
...@@ -9,20 +9,22 @@ This file contains the Lex specification for GLSL ES. ...@@ -9,20 +9,22 @@ This file contains the Lex specification for GLSL ES.
Based on ANSI C grammar, Lex specification: Based on ANSI C grammar, Lex specification:
http://www.lysator.liu.se/c/ANSI-C-grammar-l.html http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh, IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN scripts/run_code_generation.py
WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp). WHICH GENERATES THE GLSL ES LEXER (glslang_lex_autogen.cpp).
*/ */
%top{ %top{
// GENERATED FILE - DO NOT EDIT.
// Generated by generate_parser.py from glslang.l
// //
// Copyright 2012 The ANGLE Project Authors. All rights reserved. // Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// glslang.l:
// Lexer for the OpenGL shading language.
// This file is auto-generated by generate_parser.sh. DO NOT EDIT! // clang-format off
/* clang-format off */
// Ignore errors in auto-generated code. // Ignore errors in auto-generated code.
#if defined(__GNUC__) #if defined(__GNUC__)
...@@ -60,7 +62,7 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp). ...@@ -60,7 +62,7 @@ WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
using namespace sh; using namespace sh;
#include "glslang_tab.h" #include "glslang_tab_autogen.h"
/* windows only pragma */ /* windows only pragma */
#ifdef _MSC_VER #ifdef _MSC_VER
......
...@@ -9,18 +9,20 @@ This file contains the Yacc grammar for GLSL ES. ...@@ -9,18 +9,20 @@ This file contains the Yacc grammar for GLSL ES.
Based on ANSI C Yacc grammar: Based on ANSI C Yacc grammar:
http://www.lysator.liu.se/c/ANSI-C-grammar-y.html http://www.lysator.liu.se/c/ANSI-C-grammar-y.html
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh, IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN scripts/run_code_generation.py
WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h). WHICH GENERATES THE GLSL ES PARSER (glslang_tab_autogen.cpp AND glslang_tab_autogen.h).
*/ */
%{ %{
// GENERATED FILE - DO NOT EDIT.
// Generated by generate_parser.py from glslang.y
// //
// Copyright 2002 The ANGLE Project Authors. All rights reserved. // Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// glslang.y:
// This file is auto-generated by generate_parser.sh. DO NOT EDIT! // Parser for the OpenGL shading language.
// clang-format off // clang-format off
......
#line 17 "./glslang.l" #line 17 "glslang.l"
// GENERATED FILE - DO NOT EDIT.
// Generated by generate_parser.py from glslang.l
// //
// Copyright 2012 The ANGLE Project Authors. All rights reserved. // Copyright 2019 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
// glslang.l:
// Lexer for the OpenGL shading language.
// This file is auto-generated by generate_parser.sh. DO NOT EDIT! // clang-format off
/* clang-format off */
// Ignore errors in auto-generated code. // Ignore errors in auto-generated code.
#if defined(__GNUC__) #if defined(__GNUC__)
...@@ -118,10 +120,10 @@ ...@@ -118,10 +120,10 @@
/* First, we deal with platform-specific or compiler-specific issues. */ /* First, we deal with platform-specific or compiler-specific issues. */
/* begin standard C headers. */ /* begin standard C headers. */
#include <errno.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <errno.h>
#include <stdlib.h>
/* end standard C headers. */ /* end standard C headers. */
...@@ -1187,19 +1189,19 @@ This file contains the Lex specification for GLSL ES. ...@@ -1187,19 +1189,19 @@ This file contains the Lex specification for GLSL ES.
Based on ANSI C grammar, Lex specification: Based on ANSI C grammar, Lex specification:
http://www.lysator.liu.se/c/ANSI-C-grammar-l.html http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh, IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN scripts/run_code_generation.py
WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp). WHICH GENERATES THE GLSL ES LEXER (glslang_lex_autogen.cpp).
*/ */
#include "compiler/preprocessor/Token.h"
#include "compiler/translator/ParseContext.h"
#include "compiler/translator/glslang.h" #include "compiler/translator/glslang.h"
#include "compiler/translator/length_limits.h" #include "compiler/translator/ParseContext.h"
#include "compiler/preprocessor/Token.h"
#include "compiler/translator/util.h" #include "compiler/translator/util.h"
#include "compiler/translator/length_limits.h"
using namespace sh; using namespace sh;
#include "glslang_tab.h" #include "glslang_tab_autogen.h"
/* windows only pragma */ /* windows only pragma */
#ifdef _MSC_VER #ifdef _MSC_VER
...@@ -2749,10 +2751,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner) ...@@ -2749,10 +2751,10 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
num_to_read = YY_READ_BUF_SIZE; num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */ /* Read in more data. */
size_t result = 0; yy_size_t ret = 0;
YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
result, num_to_read ); ret, num_to_read );
yyg->yy_n_chars = static_cast<int>(result); yyg->yy_n_chars = static_cast<int>(ret);
YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
} }
......
/* A Bison parser, made by GNU Bison 3.0.4. */ /* A Bison parser, made by GNU Bison 3.3.2. */
/* Bison interface for Yacc-like parsers in C /* Bison interface for Yacc-like parsers in C
Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
Inc.
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -30,8 +31,11 @@ ...@@ -30,8 +31,11 @@
This special exception was added by the Free Software Foundation in This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */ version 2.2 of Bison. */
#ifndef YY_YY_GLSLANG_TAB_H_INCLUDED /* Undocumented macros, especially those whose name start with YY_,
#define YY_YY_GLSLANG_TAB_H_INCLUDED are private implementation details. Do not rely on them. */
#ifndef YY_YY_GLSLANG_TAB_AUTOGEN_H_INCLUDED
#define YY_YY_GLSLANG_TAB_AUTOGEN_H_INCLUDED
/* Debug traces. */ /* Debug traces. */
#ifndef YYDEBUG #ifndef YYDEBUG
# define YYDEBUG 0 # define YYDEBUG 0
...@@ -281,4 +285,4 @@ struct YYLTYPE ...@@ -281,4 +285,4 @@ struct YYLTYPE
int yyparse(TParseContext *context, void *scanner); int yyparse(TParseContext *context, void *scanner);
#endif /* !YY_YY_GLSLANG_TAB_H_INCLUDED */ #endif /* !YY_YY_GLSLANG_TAB_AUTOGEN_H_INCLUDED */
Name: Autoconf M4 macros used by Bison
Short Name: m4sugar
URL: https://www.gnu.org/software/autoconf/
Version: unknown
License: GPL
License File: LICENSE
Security critical: no
Description:
Bison uses M4 to generate its output, and uses the utility M4 macros in this
directory.
This source diff could not be displayed because it is too large. You can view the blob instead.
Name: Bison skeletons
URL: https://www.gnu.org/software/bison/
Version: 3.3.2
License: GPL
License File: LICENSE
Security critical: no
Description:
Bison is a parser generator. It uses skeleton files as templates for building
similar languages.
-*- Autoconf -*-
# Common code for C-like languages (C, C++, Java, etc.)
# Copyright (C) 2012-2015, 2018-2019 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# _b4_comment(TEXT, OPEN, CONTINUE, END)
# --------------------------------------
# Put TEXT in comment. Avoid trailing spaces: don't indent empty lines.
# Avoid adding indentation to the first line, as the indentation comes
# from OPEN. That's why we don't patsubst([$1], [^\(.\)], [ \1]).
#
# Prefix all the output lines with PREFIX.
m4_define([_b4_comment],
[$2[]m4_bpatsubst(m4_expand([[$1]]), [
\(.\)], [
$3\1])$4])
# b4_comment(TEXT, [PREFIX])
# --------------------------
# Put TEXT in comment. Prefix all the output lines with PREFIX.
m4_define([b4_comment],
[_b4_comment([$1], [$2/* ], [$2 ], [ */])])
# _b4_dollar_dollar(VALUE, SYMBOL-NUM, FIELD, DEFAULT-FIELD)
# ----------------------------------------------------------
# If FIELD (or DEFAULT-FIELD) is non-null, return "VALUE.FIELD",
# otherwise just VALUE. Be sure to pass "(VALUE)" if VALUE is a
# pointer.
m4_define([_b4_dollar_dollar],
[b4_symbol_value([$1],
[$2],
m4_if([$3], [[]],
[[$4]], [[$3]]))])
# b4_dollar_pushdef(VALUE-POINTER, SYMBOL-NUM, [TYPE_TAG], LOCATION)
# b4_dollar_popdef
# ------------------------------------------------------------------
# Define b4_dollar_dollar for VALUE-POINTER and DEFAULT-FIELD,
# and b4_at_dollar for LOCATION.
m4_define([b4_dollar_pushdef],
[m4_pushdef([b4_dollar_dollar],
[_b4_dollar_dollar([$1], [$2], m4_dquote($][1), [$3])])dnl
m4_pushdef([b4_at_dollar], [$4])dnl
])
m4_define([b4_dollar_popdef],
[m4_popdef([b4_at_dollar])dnl
m4_popdef([b4_dollar_dollar])dnl
])
...@@ -54,7 +54,7 @@ def main(): ...@@ -54,7 +54,7 @@ def main():
print('') print('')
print('Update flex and bison binaries for %s.' % platform.system()) print('Update flex and bison binaries for %s.' % platform.system())
print('') print('')
print('This binary was updated using %s.' % os.path.basename(__file__)) print('These binaries were updated using %s.' % os.path.basename(__file__))
print('Please see instructions in tools/flex-bison/README.md.') print('Please see instructions in tools/flex-bison/README.md.')
print('') print('')
print('flex is at version TODO.') print('flex is at version TODO.')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment