OmniSciDB  6686921089
 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 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 1155 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 1185 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().

1186  def consume(self, expected_type):
1187  """consumes the current token iff its type matches the
1188  expected_type. Otherwise, an error is raised
1189  """
1190  curr_token = self.current_token()
1191  if curr_token.type == expected_type:
1192  self.advance()
1193  return curr_token
1194  else:
1195  expected_token = Token.tok_name(expected_type)
1196  self.raise_parser_error(
1197  'Token mismatch at function consume. '
1198  'Expected type "%s" but got token "%s"\n\n'
1199  'Tokens: %s\n' % (expected_token, curr_token, self._tokens)
1200  )

+ 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 1201 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser._curr.

Referenced by generate_TableFunctionsFactory_init.Parser.raise_parser_error().

1202  def current_pos(self):
1203  return self._curr

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.current_token (   self)

Definition at line 1168 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().

1169  def current_token(self):
1170  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 1174 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().

1175  def expect(self, expected_type):
1176  curr_token = self.current_token()
1177  msg = "Expected token %s but got %s at pos %d.\n Tokens: %s" % (
1178  curr_token,
1179  Token.tok_name(expected_type),
1180  self._curr,
1181  self._tokens,
1182  )
1183  assert curr_token.type == expected_type, msg
1184  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 1165 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().

1166  def is_at_end(self):
1167  return self._curr >= len(self._tokens)

+ Here is the caller graph for this function:

def generate_TableFunctionsFactory_init.Parser.match (   self,
  expected_type 
)

Definition at line 1216 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().

1217  def match(self, expected_type):
1218  curr_token = self.current_token()
1219  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)?

args: arg ("," arg)*

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

type: composed
    | primitive

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

primitive: IDENTIFIER
 | NUMBER

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 1459 of file generate_TableFunctionsFactory_init.py.

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

1460  def parse(self):
1461  """fmt: off
1462 
1463  udtf: IDENTIFIER "(" (args)? ")" ("|" annotation)* "->" args ("," templates)?
1464 
1465  args: arg ("," arg)*
1466 
1467  arg: type IDENTIFIER? ("|" annotation)*
1468 
1469  type: composed
1470  | primitive
1471 
1472  composed: "Cursor" "<" arg ("," arg)* ">"
1473  | IDENTIFIER "<" type ("," type)* ">"
1474 
1475  primitive: IDENTIFIER
1476  | NUMBER
1477 
1478  annotation: IDENTIFIER "=" IDENTIFIER ("<" NUMBER ("," NUMBER) ">")?
1479  | IDENTIFIER "=" "[" PRIMITIVE? ("," PRIMITIVE)* "]"
1480  | "require" "=" STRING
1481 
1482  templates: template ("," template)
1483  template: IDENTIFIER "=" "[" IDENTIFIER ("," IDENTIFIER)* "]"
1484 
1485  IDENTIFIER: [A-Za-z_][A-Za-z0-9_]*
1486  NUMBER: [0-9]+
1487  STRING: \".*?\"
1488 
1489  fmt: on
1490  """
1491  self._curr = 0
1492  udtf = self.parse_udtf()
1493 
1494  # set parent
1495  udtf.parent = None
1496  d = deque()
1497  d.append(udtf)
1498  while d:
1499  node = d.pop()
1500  if isinstance(node, Iterable):
1501  for child in node:
1502  child.parent = node
1503  d.append(child)
1504  return udtf
1505 
1506 
# 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 1392 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().

1393  def parse_annotation(self):
1394  """fmt: off
1395 
1396  annotation: IDENTIFIER "=" IDENTIFIER ("<" NUMBER ("," NUMBER) ">")?
1397  | IDENTIFIER "=" "[" PRIMITIVE? ("," PRIMITIVE)* "]"
1398  | "require" "=" STRING
1399 
1400  fmt: on
1401  """
1402  key = self.parse_identifier()
1403  self.consume(Token.EQUAL)
1404 
1405  if key == "require":
1406  value = self.parse_string()
1407  elif not self.is_at_end() and self.match(Token.LSQB):
1408  value = []
1409  self.consume(Token.LSQB)
1410  if not self.match(Token.RSQB):
1411  value.append(self.parse_primitive())
1412  while self.match(Token.COMMA):
1413  self.consume(Token.COMMA)
1414  value.append(self.parse_primitive())
1415  self.consume(Token.RSQB)
1416  else:
1417  value = self.parse_identifier()
1418  if not self.is_at_end() and self.match(Token.LESS):
1419  self.consume(Token.LESS)
1420  num1 = self.parse_number()
1421  if self.match(Token.COMMA):
1422  self.consume(Token.COMMA)
1423  num2 = self.parse_number()
1424  value += "<%s,%s>" % (num1, num2)
1425  else:
1426  value += "<%s>" % (num1)
1427  self.consume(Token.GREATER)
1428  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 1280 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_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().

1281  def parse_arg(self):
1282  """fmt: off
1283 
1284  arg: type IDENTIFIER? ("|" annotation)*
1285 
1286  fmt: on
1287  """
1288  typ = self.parse_type()
1289 
1290  annotations = []
1291 
1292  if not self.is_at_end() and self.match(Token.IDENTIFIER):
1293  name = self.parse_identifier()
1294  annotations.append(AnnotationNode('name', name))
1295 
1296  while not self.is_at_end() and self.match(Token.VBAR):
1297  self.consume(Token.VBAR)
1298  annotations.append(self.parse_annotation())
1299 
1300  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 1258 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().

1259  def parse_args(self):
1260  """fmt: off
1261 
1262  args: arg IDENTIFIER ("," arg)*
1263 
1264  fmt: on
1265  """
1266  args = []
1267  args.append(self.parse_arg())
1268  while not self.is_at_end() and self.match(Token.COMMA):
1269  curr = self._curr
1270  self.consume(Token.COMMA)
1271  self.parse_type() # assuming that we are not ending with COMMA
1272  if not self.is_at_end() and self.match(Token.EQUAL):
1273  # arg type cannot be assigned, so this must be a template specification
1274  self._curr = curr # step back and let the code below parse the templates
1275  break
1276  else:
1277  self._curr = curr + 1 # step back from self.parse_type(), parse_arg will parse it again
1278  args.append(self.parse_arg())
1279  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 1321 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().

1322  def parse_composed(self):
1323  """fmt: off
1324 
1325  composed: "Cursor" "<" arg ("," arg)* ">"
1326  | IDENTIFIER "<" type ("," type)* ">"
1327 
1328  fmt: on
1329  """
1330  idtn = self.parse_identifier()
1331  self.consume(Token.LESS)
1332  if is_identifier_cursor(idtn):
1333  inner = [self.parse_arg()]
1334  while self.match(Token.COMMA):
1335  self.consume(Token.COMMA)
1336  inner.append(self.parse_arg())
1337  else:
1338  inner = [self.parse_type()]
1339  while self.match(Token.COMMA):
1340  self.consume(Token.COMMA)
1341  inner.append(self.parse_type())
1342  self.consume(Token.GREATER)
1343  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 1429 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().

1430  def parse_identifier(self):
1431  """ fmt: off
1432 
1433  IDENTIFIER: [A-Za-z_][A-Za-z0-9_]*
1434 
1435  fmt: on
1436  """
1437  token = self.consume(Token.IDENTIFIER)
1438  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 1449 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().

1450  def parse_number(self):
1451  """ fmt: off
1452 
1453  NUMBER: [0-9]+
1454 
1455  fmt: on
1456  """
1457  token = self.consume(Token.NUMBER)
1458  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

fmt: on

Definition at line 1344 of file generate_TableFunctionsFactory_init.py.

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

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

1345  def parse_primitive(self):
1346  """fmt: off
1347 
1348  primitive: IDENTIFIER
1349  | NUMBER
1350 
1351  fmt: on
1352  """
1353  if self.match(Token.IDENTIFIER):
1354  lexeme = self.parse_identifier()
1355  elif self.match(Token.NUMBER):
1356  lexeme = self.parse_number()
1357  else:
1358  raise self.raise_parser_error()
1359  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 1439 of file generate_TableFunctionsFactory_init.py.

References generate_TableFunctionsFactory_init.Parser.consume().

Referenced by generate_TableFunctionsFactory_init.Parser.parse_annotation().

1440  def parse_string(self):
1441  """ fmt: off
1442 
1443  STRING: \".*?\"
1444 
1445  fmt: on
1446  """
1447  token = self.consume(Token.STRING)
1448  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 1374 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().

1375  def parse_template(self):
1376  """fmt: off
1377 
1378  template: IDENTIFIER "=" "[" IDENTIFIER ("," IDENTIFIER)* "]"
1379 
1380  fmt: on
1381  """
1382  key = self.parse_identifier()
1383  types = []
1384  self.consume(Token.EQUAL)
1385  self.consume(Token.LSQB)
1386  types.append(self.parse_identifier())
1387  while self.match(Token.COMMA):
1388  self.consume(Token.COMMA)
1389  types.append(self.parse_identifier())
1390  self.consume(Token.RSQB)
1391  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 1360 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().

1361  def parse_templates(self):
1362  """fmt: off
1363 
1364  templates: template ("," template)*
1365 
1366  fmt: on
1367  """
1368  T = []
1369  T.append(self.parse_template())
1370  while not self.is_at_end() and self.match(Token.COMMA):
1371  self.consume(Token.COMMA)
1372  T.append(self.parse_template())
1373  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 1301 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().

1302  def parse_type(self):
1303  """fmt: off
1304 
1305  type: composed
1306  | primitive
1307 
1308  fmt: on
1309  """
1310  curr = self._curr # save state
1311  primitive = self.parse_primitive()
1312  if self.is_at_end():
1313  return primitive
1314 
1315  if not self.match(Token.LESS):
1316  return primitive
1317 
1318  self._curr = curr # return state
1319 
1320  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)?

fmt: on

Definition at line 1220 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(), and generate_TableFunctionsFactory_init.Parser.parse_templates().

Referenced by generate_TableFunctionsFactory_init.Parser.parse().

1221  def parse_udtf(self):
1222  """fmt: off
1223 
1224  udtf: IDENTIFIER "(" (args)? ")" ("|" annotation)* "->" args ("," templates)?
1225 
1226  fmt: on
1227  """
1228  name = self.parse_identifier()
1229  self.expect(Token.LPAR) # (
1230  input_args = []
1231  if not self.match(Token.RPAR):
1232  input_args = self.parse_args()
1233  self.expect(Token.RPAR) # )
1234  annotations = []
1235  while not self.is_at_end() and self.match(Token.VBAR): # |
1236  self.consume(Token.VBAR)
1237  annotations.append(self.parse_annotation())
1238  self.expect(Token.RARROW) # ->
1239  output_args = self.parse_args()
1240 
1241  templates = None
1242  if not self.is_at_end() and self.match(Token.COMMA):
1243  self.consume(Token.COMMA)
1244  templates = self.parse_templates()
1245 
1246  # set arg_pos
1247  i = 0
1248  for arg in input_args:
1249  arg.arg_pos = i
1250  arg.kind = "input"
1251  i += arg.type.cursor_length() if arg.type.is_cursor() else 1
1252 
1253  for i, arg in enumerate(output_args):
1254  arg.arg_pos = i
1255  arg.kind = "output"
1256 
1257  return UdtfNode(name, input_args, output_args, annotations, templates, 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 1204 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().

1205  def raise_parser_error(self, msg=None):
1206  if not msg:
1207  token = self.current_token()
1208  pos = self.current_pos()
1209  tokens = self.tokens
1210  msg = "\n\nError while trying to parse token %s at pos %d.\n" "Tokens: %s" % (
1211  token,
1212  pos,
1213  tokens,
1214  )
1215  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 1162 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().

1163  def tokens(self):
1164  return self._tokens

+ Here is the caller graph for this function:

Member Data Documentation

generate_TableFunctionsFactory_init.Parser._curr
private

Definition at line 1158 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.parse(), generate_TableFunctionsFactory_init.Parser.parse_args(), and generate_TableFunctionsFactory_init.Parser.parse_type().

generate_TableFunctionsFactory_init.Parser._tokens
private

Definition at line 1157 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(), and generate_TableFunctionsFactory_init.Parser.tokens().

generate_TableFunctionsFactory_init.Parser.line

Definition at line 1159 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: