ports/devel/libgraphqlparser/files/patch-ast-c.py
Sunpoet Po-Chuan Hsieh f0508af695 Add libgraphqlparser 0.7.0
libgraphqlparser is a parser for GraphQL, a query language for describing data
requirements on complex application data models, implemented in C++11. It can be
used on its own in C++ code (or in C code via the pure C API defined in the c
subdirectory), or you can use it as the basis for an extension module for your
favorite programming language instead of writing your own parser from scratch.

WWW: https://github.com/graphql/libgraphqlparser
2020-05-03 20:46:12 +00:00

53 lines
1.1 KiB
Python

--- ast/c.py.orig 2017-10-16 21:39:41 UTC
+++ ast/c.py
@@ -62,7 +62,7 @@ class Printer(object):
self._current_type = None
def start_file(self):
- print C_LICENSE_COMMENT + '''/** @generated */
+ print(C_LICENSE_COMMENT + '''/** @generated */
#pragma once
@@ -70,33 +70,33 @@ class Printer(object):
extern "C" {
#endif
-'''
+''')
def end_file(self):
- print '''
+ print('''
#ifdef __cplusplus
}
#endif
-'''
+''')
def start_type(self, name):
# Forward declarations for AST nodes.
st_name = struct_name(name)
- print 'struct ' + st_name + ';'
+ print('struct ' + st_name + ';')
self._current_type = name
def field(self, type, name, nullable, plural):
- print field_prototype(self._current_type, type, name, nullable, plural) + ';'
+ print(field_prototype(self._current_type, type, name, nullable, plural) + ';')
def end_type(self, name):
- print
+ print()
def start_union(self, name):
- print 'struct ' + struct_name(name) + ';'
+ print('struct ' + struct_name(name) + ';')
def union_option(self, option):
pass
def end_union(self, name):
- print
+ print()