Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit 1e0bc6d8 authored by di68kap's avatar di68kap
Browse files

- compiler code gnerierung in ebnf.py und dsl.py angepasst. Noch nicht getestet

parent 48220a99
...@@ -110,7 +110,7 @@ def compile_{NAME}(source): ...@@ -110,7 +110,7 @@ def compile_{NAME}(source):
"""Compiles ``source`` and returns (result, errors, ast). """Compiles ``source`` and returns (result, errors, ast).
""" """
return full_compilation(source, {NAME}Scanner, return full_compilation(source, {NAME}Scanner,
{NAME}Grammar(), {NAME}_ASTPipeline, {NAME}Compiler()) {NAME}Grammar(), {NAME}Transform, {NAME}Compiler())
if __name__ == "__main__": if __name__ == "__main__":
if len(sys.argv) > 1: if len(sys.argv) > 1:
......
...@@ -215,14 +215,15 @@ class EBNFCompiler(CompilerBase): ...@@ -215,14 +215,15 @@ class EBNFCompiler(CompilerBase):
if not self.definition_names: if not self.definition_names:
raise EBNFCompilerError('Compiler has not been run before calling ' raise EBNFCompilerError('Compiler has not been run before calling '
'"gen_AST_Skeleton()"!') '"gen_AST_Skeleton()"!')
tt_name = self.grammar_name + '_ASTTransform' tt_name = self.grammar_name + '_AST_transformation_table'
pl_name = self.grammar_name + '_ASTPipeline' tf_name = self.grammar_name + 'Transform'
transtable = [tt_name + ' = {', transtable = [tt_name + ' = {',
' # AST Transformations for the ' + ' # AST Transformations for the ' +
self.grammar_name + '-grammar'] self.grammar_name + '-grammar']
for name in self.definition_names: for name in self.definition_names:
transtable.append(' "' + name + '": no_operation,') transtable.append(' "' + name + '": no_operation,')
transtable += [' "": no_operation', '}', '', pl_name + ' = [%s]' % tt_name, ''] transtable += [' "": no_operation', '}', '', tf_name +
' = partial(traverse, processing_table=%s)' % tt_name, '']
return '\n'.join(transtable) return '\n'.join(transtable)
def gen_compiler_skeleton(self): def gen_compiler_skeleton(self):
......
#!/usr/bin/python3
"""test_dsl.py - tests of the dsl-module of DHParser
Author: Eckhart Arnold <arnold@badw.de>
Copyright 2017 Bavarian Academy of Sciences and Humanities
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
#!/usr/bin/python3 #!/usr/bin/python3
"""test_ebnf.py - tests of the EBNFcompiler-module of DHParser """test_ebnf.py - tests of the ebnf module of DHParser
Author: Eckhart Arnold <arnold@badw.de> Author: Eckhart Arnold <arnold@badw.de>
...@@ -24,7 +24,6 @@ from functools import partial ...@@ -24,7 +24,6 @@ from functools import partial
import os import os
import sys import sys
sys.path.append(os.path.abspath('../../')) sys.path.append(os.path.abspath('../../'))
from DHParser.syntaxtree import traverse
from DHParser.parsers import full_compilation, Retrieve, WHITESPACE_KEYWORD from DHParser.parsers import full_compilation, Retrieve, WHITESPACE_KEYWORD
from DHParser.ebnf import EBNFGrammar, EBNFTransform, EBNFCompiler from DHParser.ebnf import EBNFGrammar, EBNFTransform, EBNFCompiler
from DHParser.dsl import compileEBNF from DHParser.dsl import compileEBNF
......
#!/usr/bin/python3 #!/usr/bin/python3
"""test_parsers.py - tests of the parsercombinators-module """test_parsers.py - tests of the parsers-module of DHParser
of DHParser
Author: Eckhart Arnold <arnold@badw.de> Author: Eckhart Arnold <arnold@badw.de>
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
"""test_syntaxtree.py - test of syntaxtree-module of DHParser """test_syntaxtree.py - test of syntaxtree-module of DHParser
Author: Eckhart Arnold <arnold@badw.de> Author: Eckhart Arnold <arnold@badw.de>
Copyright 2017 Bavarian Academy of Sciences and Humanities Copyright 2017 Bavarian Academy of Sciences and Humanities
......
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