OmniSciDB  085a039ca4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
generate_TableFunctionsFactory_init.Parser Class Reference

Public Member Functions

def __init__
 
def tokens
 
def is_at_end
 
def current_token
 
def advance
 
def expect
 
def consume
 
def current_pos
 
def raise_parser_error
 
def match
 
def lookahead
 
def parse_udtf
 
def parse_args
 
def parse_arg
 
def parse_type
 
def parse_composed
 
def parse_primitive
 
def parse_templates
 
def parse_template
 
def parse_annotation
 
def parse_identifier
 
def parse_string
 
def parse_number
 
def parse
 

Public Attributes

 line
 

Private Attributes

 _tokens
 
 _curr
 

Detailed Description

Definition at line 1219 of file generate_TableFunctionsFactory_init.py.

Constructor & Destructor Documentation

Member Function Documentation

def generate_TableFunctionsFactory_init.Parser.advance (   self)

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.consume (   self,
  expected_type 
)
consumes the current token iff its type matches the
expected_type. Otherwise, an error is raised

Definition at line 1249 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Tokenize._tokens, generate_TableFunctionsFactory_init.Parser._tokens, generate_TableFunctionsFactory_init.Tokenize.advance(), generate_TableFunctionsFactory_init.Parser.advance(), anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator.advance(), generate_TableFunctionsFactory_init.Tokenize.current_token(), generate_TableFunctionsFactory_init.Parser.current_token(), and generate_TableFunctionsFactory_init.Parser.raise_parser_error().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_annotation(), generate_TableFunctionsFactory_init.Parser.parse_arg(), generate_TableFunctionsFactory_init.Parser.parse_args(), generate_TableFunctionsFactory_init.Parser.parse_composed(), generate_TableFunctionsFactory_init.Parser.parse_identifier(), generate_TableFunctionsFactory_init.Parser.parse_number(), generate_TableFunctionsFactory_init.Parser.parse_string(), generate_TableFunctionsFactory_init.Parser.parse_template(), generate_TableFunctionsFactory_init.Parser.parse_templates(), and generate_TableFunctionsFactory_init.Parser.parse_udtf().

1250  def consume(self, expected_type):
1251  """consumes the current token iff its type matches the
1252  expected_type. Otherwise, an error is raised
1253  """
1254  curr_token = self.current_token()
1255  if curr_token.type == expected_type:
1256  self.advance()
1257  return curr_token
1258  else:
1259  expected_token = Token.tok_name(expected_type)
1260  self.raise_parser_error(
1261  'Token mismatch at function consume. '
1262  'Expected type "%s" but got token "%s"\n\n'
1263  'Tokens: %s\n' % (expected_token, curr_token, self._tokens)
1264  )

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.current_pos (   self)

Definition at line 1265 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser._curr.

Referenced by generate_TableFunctionsFactory_init.Parser.raise_parser_error().

1266  def current_pos(self):
1267  return self._curr

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.current_token (   self)

Definition at line 1232 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser._curr, generate_TableFunctionsFactory_init.Tokenize._tokens, and generate_TableFunctionsFactory_init.Parser._tokens.

Referenced by generate_TableFunctionsFactory_init.Parser.consume(), generate_TableFunctionsFactory_init.Parser.expect(), generate_TableFunctionsFactory_init.Parser.match(), and generate_TableFunctionsFactory_init.Parser.raise_parser_error().

1233  def current_token(self):
1234  return self._tokens[self._curr]

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.expect (   self,
  expected_type 
)

Definition at line 1238 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser._curr, generate_TableFunctionsFactory_init.Tokenize._tokens, generate_TableFunctionsFactory_init.Parser._tokens, generate_TableFunctionsFactory_init.Tokenize.advance(), generate_TableFunctionsFactory_init.Parser.advance(), anonymous_namespace{RelAlgDagBuilder.cpp}::RANodeIterator.advance(), generate_TableFunctionsFactory_init.Tokenize.current_token(), and generate_TableFunctionsFactory_init.Parser.current_token().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_udtf().

1239  def expect(self, expected_type):
1240  curr_token = self.current_token()
1241  msg = "Expected token %s but got %s at pos %d.\n Tokens: %s" % (
1242  curr_token,
1243  Token.tok_name(expected_type),
1244  self._curr,
1245  self._tokens,
1246  )
1247  assert curr_token.type == expected_type, msg
1248  self.advance()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.is_at_end (   self)

Definition at line 1229 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser._curr, generate_TableFunctionsFactory_init.Tokenize._tokens, and generate_TableFunctionsFactory_init.Parser._tokens.

Referenced by generate_TableFunctionsFactory_init.Parser.parse_annotation(), generate_TableFunctionsFactory_init.Parser.parse_arg(), generate_TableFunctionsFactory_init.Parser.parse_args(), generate_TableFunctionsFactory_init.Parser.parse_templates(), generate_TableFunctionsFactory_init.Parser.parse_type(), and generate_TableFunctionsFactory_init.Parser.parse_udtf().

1230  def is_at_end(self):
1231  return self._curr >= len(self._tokens)

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.lookahead (   self)

Definition at line 1284 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser._curr, generate_TableFunctionsFactory_init.Tokenize._tokens, and generate_TableFunctionsFactory_init.Parser._tokens.

Referenced by generate_TableFunctionsFactory_init.Parser.parse_arg().

1285  def lookahead(self):
1286  return self._tokens[self._curr + 1]

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.match (   self,
  expected_type 
)

Definition at line 1280 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Tokenize.current_token(), and generate_TableFunctionsFactory_init.Parser.current_token().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_annotation(), generate_TableFunctionsFactory_init.Parser.parse_arg(), generate_TableFunctionsFactory_init.Parser.parse_args(), generate_TableFunctionsFactory_init.Parser.parse_composed(), generate_TableFunctionsFactory_init.Parser.parse_primitive(), generate_TableFunctionsFactory_init.Parser.parse_template(), generate_TableFunctionsFactory_init.Parser.parse_templates(), generate_TableFunctionsFactory_init.Parser.parse_type(), and generate_TableFunctionsFactory_init.Parser.parse_udtf().

1281  def match(self, expected_type):
1282  curr_token = self.current_token()
1283  return curr_token.type == expected_type

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse (   self)
fmt: off

udtf: IDENTIFIER "(" (args)? ")" ("|" annotation)* "->" args ("," templates)? ("|" "output_row_size" "=" primitive)?

args: arg ("," arg)*

arg: type IDENTIFIER? ("|" annotation)*

type: composed
    | primitive

composed: "Cursor" "<" arg ("," arg)* ">"
| IDENTIFIER "<" type ("," type)* ">"

primitive: IDENTIFIER
 | NUMBER
 | STRING

annotation: IDENTIFIER "=" IDENTIFIER ("<" NUMBER ("," NUMBER) ">")?
  | IDENTIFIER "=" "[" PRIMITIVE? ("," PRIMITIVE)* "]"
  | "require" "=" STRING

templates: template ("," template)
template: IDENTIFIER "=" "[" IDENTIFIER ("," IDENTIFIER)* "]"

IDENTIFIER: [A-Za-z_][A-Za-z0-9_]*
NUMBER: [0-9]+
STRING: \".*?\"

fmt: on

Definition at line 1545 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser._curr, and generate_TableFunctionsFactory_init.Parser.parse_udtf().

1546  def parse(self):
1547  """fmt: off
1548 
1549  udtf: IDENTIFIER "(" (args)? ")" ("|" annotation)* "->" args ("," templates)? ("|" "output_row_size" "=" primitive)?
1550 
1551  args: arg ("," arg)*
1552 
1553  arg: type IDENTIFIER? ("|" annotation)*
1554 
1555  type: composed
1556  | primitive
1557 
1558  composed: "Cursor" "<" arg ("," arg)* ">"
1559  | IDENTIFIER "<" type ("," type)* ">"
1560 
1561  primitive: IDENTIFIER
1562  | NUMBER
1563  | STRING
1564 
1565  annotation: IDENTIFIER "=" IDENTIFIER ("<" NUMBER ("," NUMBER) ">")?
1566  | IDENTIFIER "=" "[" PRIMITIVE? ("," PRIMITIVE)* "]"
1567  | "require" "=" STRING
1568 
1569  templates: template ("," template)
1570  template: IDENTIFIER "=" "[" IDENTIFIER ("," IDENTIFIER)* "]"
1571 
1572  IDENTIFIER: [A-Za-z_][A-Za-z0-9_]*
1573  NUMBER: [0-9]+
1574  STRING: \".*?\"
1575 
1576  fmt: on
1577  """
1578  self._curr = 0
1579  udtf = self.parse_udtf()
1580 
1581  # set parent
1582  udtf.parent = None
1583  d = deque()
1584  d.append(udtf)
1585  while d:
1586  node = d.pop()
1587  if isinstance(node, Iterable):
1588  for child in node:
1589  child.parent = node
1590  d.append(child)
1591  return udtf
1592 
1593 
# fmt: off

+ Here is the call graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse_annotation (   self)
fmt: off

annotation: IDENTIFIER "=" IDENTIFIER ("<" NUMBER ("," NUMBER) ">")?
  | IDENTIFIER "=" "[" PRIMITIVE? ("," PRIMITIVE)* "]"
  | "require" "=" STRING

fmt: on

Definition at line 1475 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser.consume(), generate_TableFunctionsFactory_init.Tokenize.is_at_end(), generate_TableFunctionsFactory_init.Parser.is_at_end(), generate_TableFunctionsFactory_init.Parser.match(), generate_TableFunctionsFactory_init.Parser.parse_identifier(), generate_TableFunctionsFactory_init.Parser.parse_number(), generate_TableFunctionsFactory_init.Parser.parse_primitive(), and generate_TableFunctionsFactory_init.Parser.parse_string().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_arg(), and generate_TableFunctionsFactory_init.Parser.parse_udtf().

1476  def parse_annotation(self):
1477  """fmt: off
1478 
1479  annotation: IDENTIFIER "=" IDENTIFIER ("<" NUMBER ("," NUMBER) ">")?
1480  | IDENTIFIER "=" "[" PRIMITIVE? ("," PRIMITIVE)* "]"
1481  | "require" "=" STRING
1482 
1483  fmt: on
1484  """
1485  key = self.parse_identifier()
1486  self.consume(Token.EQUAL)
1487 
1488  if key == "require":
1489  value = self.parse_string()
1490  elif not self.is_at_end() and self.match(Token.LSQB):
1491  value = []
1492  self.consume(Token.LSQB)
1493  if not self.match(Token.RSQB):
1494  value.append(self.parse_primitive())
1495  while self.match(Token.COMMA):
1496  self.consume(Token.COMMA)
1497  value.append(self.parse_primitive())
1498  self.consume(Token.RSQB)
1499  else:
1500  value = self.parse_identifier()
1501  if not self.is_at_end() and self.match(Token.LESS):
1502  self.consume(Token.LESS)
1503  if self.match(Token.GREATER):
1504  value += "<%s>" % (-1) # Signifies no input
1505  else:
1506  num1 = self.parse_number()
1507  if self.match(Token.COMMA):
1508  self.consume(Token.COMMA)
1509  num2 = self.parse_number()
1510  value += "<%s,%s>" % (num1, num2)
1511  else:
1512  value += "<%s>" % (num1)
1513  self.consume(Token.GREATER)
1514  return AnnotationNode(key, value)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse_arg (   self)
fmt: off

arg: type IDENTIFIER? ("|" annotation)*

fmt: on

Definition at line 1357 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser.consume(), generate_TableFunctionsFactory_init.Tokenize.is_at_end(), generate_TableFunctionsFactory_init.Parser.is_at_end(), generate_TableFunctionsFactory_init.Tokenize.lookahead(), generate_TableFunctionsFactory_init.Parser.lookahead(), generate_TableFunctionsFactory_init.Parser.match(), generate_TableFunctionsFactory_init.Parser.parse_annotation(), generate_TableFunctionsFactory_init.Parser.parse_identifier(), and generate_TableFunctionsFactory_init.Parser.parse_type().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_args(), and generate_TableFunctionsFactory_init.Parser.parse_composed().

1358  def parse_arg(self):
1359  """fmt: off
1360 
1361  arg: type IDENTIFIER? ("|" annotation)*
1362 
1363  fmt: on
1364  """
1365  typ = self.parse_type()
1366 
1367  annotations = []
1368 
1369  if not self.is_at_end() and self.match(Token.IDENTIFIER):
1370  name = self.parse_identifier()
1371  annotations.append(AnnotationNode('name', name))
1372 
1373  while not self.is_at_end() and self.match(Token.VBAR):
1374  ahead = self.lookahead()
1375  if ahead.type == Token.IDENTIFIER and ahead.lexeme == 'output_row_size':
1376  break
1377  self.consume(Token.VBAR)
1378  annotations.append(self.parse_annotation())
1379 
1380  return ArgNode(typ, annotations)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse_args (   self)
fmt: off

args: arg IDENTIFIER ("," arg)*

fmt: on

Definition at line 1335 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser._curr, generate_TableFunctionsFactory_init.Parser.consume(), generate_TableFunctionsFactory_init.Tokenize.is_at_end(), generate_TableFunctionsFactory_init.Parser.is_at_end(), generate_TableFunctionsFactory_init.Parser.match(), generate_TableFunctionsFactory_init.Parser.parse_arg(), and generate_TableFunctionsFactory_init.Parser.parse_type().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_udtf().

1336  def parse_args(self):
1337  """fmt: off
1338 
1339  args: arg IDENTIFIER ("," arg)*
1340 
1341  fmt: on
1342  """
1343  args = []
1344  args.append(self.parse_arg())
1345  while not self.is_at_end() and self.match(Token.COMMA):
1346  curr = self._curr
1347  self.consume(Token.COMMA)
1348  self.parse_type() # assuming that we are not ending with COMMA
1349  if not self.is_at_end() and self.match(Token.EQUAL):
1350  # arg type cannot be assigned, so this must be a template specification
1351  self._curr = curr # step back and let the code below parse the templates
1352  break
1353  else:
1354  self._curr = curr + 1 # step back from self.parse_type(), parse_arg will parse it again
1355  args.append(self.parse_arg())
1356  return args

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse_composed (   self)
fmt: off

composed: "Cursor" "<" arg ("," arg)* ">"
| IDENTIFIER "<" type ("," type)* ">"

fmt: on

Definition at line 1401 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser.consume(), generate_TableFunctionsFactory_init.is_identifier_cursor(), generate_TableFunctionsFactory_init.Parser.match(), generate_TableFunctionsFactory_init.Parser.parse_arg(), generate_TableFunctionsFactory_init.Parser.parse_identifier(), and generate_TableFunctionsFactory_init.Parser.parse_type().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_type().

1402  def parse_composed(self):
1403  """fmt: off
1404 
1405  composed: "Cursor" "<" arg ("," arg)* ">"
1406  | IDENTIFIER "<" type ("," type)* ">"
1407 
1408  fmt: on
1409  """
1410  idtn = self.parse_identifier()
1411  self.consume(Token.LESS)
1412  if is_identifier_cursor(idtn):
1413  inner = [self.parse_arg()]
1414  while self.match(Token.COMMA):
1415  self.consume(Token.COMMA)
1416  inner.append(self.parse_arg())
1417  else:
1418  inner = [self.parse_type()]
1419  while self.match(Token.COMMA):
1420  self.consume(Token.COMMA)
1421  inner.append(self.parse_type())
1422  self.consume(Token.GREATER)
1423  return ComposedNode(idtn, inner)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse_identifier (   self)
fmt: off

IDENTIFIER: [A-Za-z_][A-Za-z0-9_]*

fmt: on

Definition at line 1515 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser.consume().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_annotation(), generate_TableFunctionsFactory_init.Parser.parse_arg(), generate_TableFunctionsFactory_init.Parser.parse_composed(), generate_TableFunctionsFactory_init.Parser.parse_primitive(), generate_TableFunctionsFactory_init.Parser.parse_template(), and generate_TableFunctionsFactory_init.Parser.parse_udtf().

1516  def parse_identifier(self):
1517  """ fmt: off
1518 
1519  IDENTIFIER: [A-Za-z_][A-Za-z0-9_]*
1520 
1521  fmt: on
1522  """
1523  token = self.consume(Token.IDENTIFIER)
1524  return token.lexeme

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse_number (   self)
fmt: off

NUMBER: [0-9]+

fmt: on

Definition at line 1535 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser.consume().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_annotation(), and generate_TableFunctionsFactory_init.Parser.parse_primitive().

1536  def parse_number(self):
1537  """ fmt: off
1538 
1539  NUMBER: [0-9]+
1540 
1541  fmt: on
1542  """
1543  token = self.consume(Token.NUMBER)
1544  return token.lexeme

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse_primitive (   self)
fmt: off

primitive: IDENTIFIER
 | NUMBER
 | STRING

fmt: on

Definition at line 1424 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser.match(), generate_TableFunctionsFactory_init.Parser.parse_identifier(), generate_TableFunctionsFactory_init.Parser.parse_number(), generate_TableFunctionsFactory_init.Parser.parse_string(), and generate_TableFunctionsFactory_init.Parser.raise_parser_error().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_annotation(), generate_TableFunctionsFactory_init.Parser.parse_type(), and generate_TableFunctionsFactory_init.Parser.parse_udtf().

1425  def parse_primitive(self):
1426  """fmt: off
1427 
1428  primitive: IDENTIFIER
1429  | NUMBER
1430  | STRING
1431 
1432  fmt: on
1433  """
1434  if self.match(Token.IDENTIFIER):
1435  lexeme = self.parse_identifier()
1436  elif self.match(Token.NUMBER):
1437  lexeme = self.parse_number()
1438  elif self.match(Token.STRING):
1439  lexeme = self.parse_string()
1440  else:
1441  raise self.raise_parser_error()
1442  return PrimitiveNode(lexeme)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse_string (   self)
fmt: off

STRING: \".*?\"

fmt: on

Definition at line 1525 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser.consume().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_annotation(), and generate_TableFunctionsFactory_init.Parser.parse_primitive().

1526  def parse_string(self):
1527  """ fmt: off
1528 
1529  STRING: \".*?\"
1530 
1531  fmt: on
1532  """
1533  token = self.consume(Token.STRING)
1534  return token.lexeme

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse_template (   self)
fmt: off

template: IDENTIFIER "=" "[" IDENTIFIER ("," IDENTIFIER)* "]"

fmt: on

Definition at line 1457 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser.consume(), generate_TableFunctionsFactory_init.Parser.match(), and generate_TableFunctionsFactory_init.Parser.parse_identifier().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_templates().

1458  def parse_template(self):
1459  """fmt: off
1460 
1461  template: IDENTIFIER "=" "[" IDENTIFIER ("," IDENTIFIER)* "]"
1462 
1463  fmt: on
1464  """
1465  key = self.parse_identifier()
1466  types = []
1467  self.consume(Token.EQUAL)
1468  self.consume(Token.LSQB)
1469  types.append(self.parse_identifier())
1470  while self.match(Token.COMMA):
1471  self.consume(Token.COMMA)
1472  types.append(self.parse_identifier())
1473  self.consume(Token.RSQB)
1474  return TemplateNode(key, tuple(types))

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse_templates (   self)
fmt: off

templates: template ("," template)*

fmt: on

Definition at line 1443 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser.consume(), generate_TableFunctionsFactory_init.Tokenize.is_at_end(), generate_TableFunctionsFactory_init.Parser.is_at_end(), generate_TableFunctionsFactory_init.Parser.match(), and generate_TableFunctionsFactory_init.Parser.parse_template().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_udtf().

1444  def parse_templates(self):
1445  """fmt: off
1446 
1447  templates: template ("," template)*
1448 
1449  fmt: on
1450  """
1451  T = []
1452  T.append(self.parse_template())
1453  while not self.is_at_end() and self.match(Token.COMMA):
1454  self.consume(Token.COMMA)
1455  T.append(self.parse_template())
1456  return T

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse_type (   self)
fmt: off

type: composed
    | primitive

fmt: on

Definition at line 1381 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser._curr, generate_TableFunctionsFactory_init.Tokenize.is_at_end(), generate_TableFunctionsFactory_init.Parser.is_at_end(), generate_TableFunctionsFactory_init.Parser.match(), generate_TableFunctionsFactory_init.Parser.parse_composed(), and generate_TableFunctionsFactory_init.Parser.parse_primitive().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_arg(), generate_TableFunctionsFactory_init.Parser.parse_args(), and generate_TableFunctionsFactory_init.Parser.parse_composed().

1382  def parse_type(self):
1383  """fmt: off
1384 
1385  type: composed
1386  | primitive
1387 
1388  fmt: on
1389  """
1390  curr = self._curr # save state
1391  primitive = self.parse_primitive()
1392  if self.is_at_end():
1393  return primitive
1394 
1395  if not self.match(Token.LESS):
1396  return primitive
1397 
1398  self._curr = curr # return state
1399 
1400  return self.parse_composed()

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.parse_udtf (   self)
fmt: off

udtf: IDENTIFIER "(" (args)? ")" ("|" annotation)* "->" args ("," templates)? ("|" "output_row_size" "=" primitive)?

fmt: on

Definition at line 1287 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser.consume(), generate_TableFunctionsFactory_init.Parser.expect(), generate_TableFunctionsFactory_init.Tokenize.is_at_end(), generate_TableFunctionsFactory_init.Parser.is_at_end(), generate_TableFunctionsFactory_init.UdtfNode.line, generate_TableFunctionsFactory_init.Parser.line, generate_TableFunctionsFactory_init.Parser.match(), generate_TableFunctionsFactory_init.Parser.parse_annotation(), generate_TableFunctionsFactory_init.Parser.parse_args(), generate_TableFunctionsFactory_init.Parser.parse_identifier(), generate_TableFunctionsFactory_init.Parser.parse_primitive(), and generate_TableFunctionsFactory_init.Parser.parse_templates().

Referenced by generate_TableFunctionsFactory_init.Parser.parse().

1288  def parse_udtf(self):
1289  """fmt: off
1290 
1291  udtf: IDENTIFIER "(" (args)? ")" ("|" annotation)* "->" args ("," templates)? ("|" "output_row_size" "=" primitive)?
1292 
1293  fmt: on
1294  """
1295  name = self.parse_identifier()
1296  self.expect(Token.LPAR) # (
1297  input_args = []
1298  if not self.match(Token.RPAR):
1299  input_args = self.parse_args()
1300  self.expect(Token.RPAR) # )
1301  annotations = []
1302  while not self.is_at_end() and self.match(Token.VBAR): # |
1303  self.consume(Token.VBAR)
1304  annotations.append(self.parse_annotation())
1305  self.expect(Token.RARROW) # ->
1306  output_args = self.parse_args()
1307 
1308  templates = None
1309  if not self.is_at_end() and self.match(Token.COMMA):
1310  self.consume(Token.COMMA)
1311  templates = self.parse_templates()
1312 
1313  sizer = None
1314  if not self.is_at_end() and self.match(Token.VBAR):
1315  self.consume(Token.VBAR)
1316  idtn = self.parse_identifier()
1317  assert idtn == "output_row_size"
1318  self.consume(Token.EQUAL)
1319  node = self.parse_primitive()
1320  key = "kPreFlightParameter"
1321  sizer = AnnotationNode(key, value=node.type)
1322 
1323  # set arg_pos
1324  i = 0
1325  for arg in input_args:
1326  arg.arg_pos = i
1327  arg.kind = "input"
1328  i += arg.type.cursor_length() if arg.type.is_cursor() else 1
1329 
1330  for i, arg in enumerate(output_args):
1331  arg.arg_pos = i
1332  arg.kind = "output"
1333 
1334  return UdtfNode(name, input_args, output_args, annotations, templates, sizer, self.line)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.raise_parser_error (   self,
  msg = None 
)

Definition at line 1268 of file generate_TableFunctionsFactory_init.py.

References ChunkIter.current_pos, generate_TableFunctionsFactory_init.Parser.current_pos(), generate_TableFunctionsFactory_init.Tokenize.current_token(), generate_TableFunctionsFactory_init.Parser.current_token(), generate_TableFunctionsFactory_init.Tokenize.tokens(), and generate_TableFunctionsFactory_init.Parser.tokens().

Referenced by generate_TableFunctionsFactory_init.Parser.consume(), and generate_TableFunctionsFactory_init.Parser.parse_primitive().

1269  def raise_parser_error(self, msg=None):
1270  if not msg:
1271  token = self.current_token()
1272  pos = self.current_pos()
1273  tokens = self.tokens
1274  msg = "\n\nError while trying to parse token %s at pos %d.\n" "Tokens: %s" % (
1275  token,
1276  pos,
1277  tokens,
1278  )
1279  raise ParserException(msg)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.tokens (   self)

Definition at line 1226 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Tokenize._tokens, and generate_TableFunctionsFactory_init.Parser._tokens.

Referenced by generate_TableFunctionsFactory_init.Parser.raise_parser_error().

1227  def tokens(self):
1228  return self._tokens

+ Here is the caller graph for this function:

Member Data Documentation

generate_TableFunctionsFactory_init.Parser._curr
private

Definition at line 1222 of file generate_TableFunctionsFactory_init.py.

Referenced by generate_TableFunctionsFactory_init.Parser.advance(), generate_TableFunctionsFactory_init.Parser.current_pos(), generate_TableFunctionsFactory_init.Parser.current_token(), generate_TableFunctionsFactory_init.Parser.expect(), generate_TableFunctionsFactory_init.Parser.is_at_end(), generate_TableFunctionsFactory_init.Parser.lookahead(), generate_TableFunctionsFactory_init.Parser.parse(), generate_TableFunctionsFactory_init.Parser.parse_args(), and generate_TableFunctionsFactory_init.Parser.parse_type().

generate_TableFunctionsFactory_init.Parser._tokens
private

Definition at line 1221 of file generate_TableFunctionsFactory_init.py.

Referenced by generate_TableFunctionsFactory_init.Parser.consume(), generate_TableFunctionsFactory_init.Parser.current_token(), generate_TableFunctionsFactory_init.Parser.expect(), generate_TableFunctionsFactory_init.Parser.is_at_end(), generate_TableFunctionsFactory_init.Parser.lookahead(), and generate_TableFunctionsFactory_init.Parser.tokens().

generate_TableFunctionsFactory_init.Parser.line

Definition at line 1223 of file generate_TableFunctionsFactory_init.py.

Referenced by generate_TableFunctionsFactory_init.Tokenize.add_token(), generate_TableFunctionsFactory_init.Tokenize.current_token(), generate_TableFunctionsFactory_init.Tokenize.is_at_end(), generate_TableFunctionsFactory_init.Tokenize.lookahead(), generate_TableFunctionsFactory_init.Parser.parse_udtf(), generate_TableFunctionsFactory_init.Tokenize.peek(), and generate_TableFunctionsFactory_init.Tokenize.raise_tokenize_error().


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