OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
generate_TableFunctionsFactory_init.AstPrinter Class Reference
+ Inheritance diagram for generate_TableFunctionsFactory_init.AstPrinter:
+ Collaboration diagram for generate_TableFunctionsFactory_init.AstPrinter:

Public Member Functions

def visit_udtf_node
 
def visit_template_node
 
def visit_annotation_node
 
def visit_arg_node
 
def visit_composed_node
 
def visit_primitive_node
 
- Public Member Functions inherited from generate_TableFunctionsFactory_init.AstVisitor
def visit_udtf_node
 
def visit_composed_node
 
def visit_arg_node
 
def visit_primitive_node
 
def visit_annotation_node
 
def visit_template_node
 

Detailed Description

Returns a line formatted. Useful for testing

Definition at line 640 of file generate_TableFunctionsFactory_init.py.

Member Function Documentation

def generate_TableFunctionsFactory_init.AstPrinter.visit_annotation_node (   self,
  annotation_node 
)

Definition at line 662 of file generate_TableFunctionsFactory_init.py.

References join().

663  def visit_annotation_node(self, annotation_node):
664  # key=value
665  key = annotation_node.key
666  value = annotation_node.value
667  if isinstance(value, list):
668  return "%s=[%s]" % (key, ','.join([v.accept(self) for v in value]))
669  return "%s=%s" % (key, value)
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.AstPrinter.visit_arg_node (   self,
  arg_node 
)

Definition at line 670 of file generate_TableFunctionsFactory_init.py.

References join().

671  def visit_arg_node(self, arg_node):
672  # type | annotation
673  typ = arg_node.type.accept(self)
674  if arg_node.annotations:
675  ann = " | ".join([a.accept(self) for a in arg_node.annotations])
676  s = "%s | %s" % (typ, ann)
677  else:
678  s = "%s" % (typ,)
679  # insert input_id=args<0> if input_id is not specified
680  if s == "ColumnTextEncodingDict" and arg_node.kind == "output":
681  return s + " | input_id=args<0>"
682  return s
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.AstPrinter.visit_composed_node (   self,
  composed_node 
)

Definition at line 683 of file generate_TableFunctionsFactory_init.py.

References join().

684  def visit_composed_node(self, composed_node):
685  T = composed_node.inner[0].accept(self)
686  if composed_node.is_column():
687  # Column<T>
688  assert len(composed_node.inner) == 1
689  return "Column" + T
690  if composed_node.is_column_list():
691  # ColumnList<T>
692  assert len(composed_node.inner) == 1
693  return "ColumnList" + T
694  if composed_node.is_output_buffer_sizer():
695  # kConstant<N>
696  N = T
697  assert len(composed_node.inner) == 1
698  return translate_map.get(composed_node.type) + "<%s>" % (N,)
699  if composed_node.is_cursor():
700  # Cursor<T1, T2, ..., TN>
701  Ts = ", ".join([i.accept(self) for i in composed_node.inner])
702  return "Cursor<%s>" % (Ts)
703  raise ValueError(composed_node)
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.AstPrinter.visit_primitive_node (   self,
  primitive_node 
)

Definition at line 704 of file generate_TableFunctionsFactory_init.py.

705  def visit_primitive_node(self, primitive_node):
706  t = primitive_node.type
707  if primitive_node.is_output_buffer_sizer():
708  # arg_pos is zero-based
709  return translate_map.get(t, t) + "<%d>" % (
710  primitive_node.get_parent(ArgNode).arg_pos + 1,
711  )
712  return translate_map.get(t, t)
713 
def generate_TableFunctionsFactory_init.AstPrinter.visit_template_node (   self,
  template_node 
)

Definition at line 656 of file generate_TableFunctionsFactory_init.py.

References join().

657  def visit_template_node(self, template_node):
658  # T=[T1, T2, ..., TN]
659  key = template_node.key
660  types = ['"%s"' % typ for typ in template_node.types]
661  return "%s=[%s]" % (key, ", ".join(types))
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.AstPrinter.visit_udtf_node (   self,
  udtf_node 
)

Definition at line 643 of file generate_TableFunctionsFactory_init.py.

References join().

644  def visit_udtf_node(self, udtf_node):
645  name = udtf_node.name
646  inputs = ", ".join([arg.accept(self) for arg in udtf_node.inputs])
647  outputs = ", ".join([arg.accept(self) for arg in udtf_node.outputs])
648  annotations = "| ".join([annot.accept(self) for annot in udtf_node.annotations])
649  if annotations:
650  annotations = ' | ' + annotations
651  if udtf_node.templates:
652  templates = ", ".join([t.accept(self) for t in udtf_node.templates])
653  return "%s(%s)%s -> %s, %s" % (name, inputs, annotations, outputs, templates)
654  else:
655  return "%s(%s)%s -> %s" % (name, inputs, annotations, outputs)
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: