Documentation

arx.parser.core

arx.parser.core

Source: packages/arx/src/arx/parser/core.py

title: Shared parser core.
summary: >-
  Hold parser state, scope bookkeeping, token helpers, and module-level
  orchestration for the concern-grouped parser mixins.

Classes

ParserCore(ParserMixinBase)

title: Shared parser state and orchestration.
attributes:
  bin_op_precedence:
    type: dict[str, int]
  indent_level:
    type: int
  list_scopes:
    type: list[set[str]]
  known_class_names:
    type: set[str]
  imported_type_names:
    type: set[str]
  namespace_roots:
    type: set[str]
  builtin_type_bindings:
    type: dict[str, astx.DataType]
  tensor_scopes:
    type: list[dict[str, TensorBinding | None]]
  dataframe_scopes:
    type: list[dict[str, DataFrameBinding | None]]
  return_type_scopes:
    type: list[astx.DataType]
  template_type_scopes:
    type: list[dict[str, astx.DataType]]
  type_aliases:
    type: dict[str, astx.DataType]
  value_scopes:
    type: list[set[str]]
  tokens:
    type: TokenList

Methods

clean(self) -> None
title: Reset the Parser static variables.
parse(self, tokens: TokenList, module_name: str='main', *, builtin_types: dict[str, astx.DataType] | None=None) -> astx.Module
title: Parse the input code.
parameters:
  tokens:
    type: TokenList
  module_name:
    type: str
  builtin_types:
    type: dict[str, astx.DataType] | None
returns:
  type: astx.Module
match_clause(self, kind: TokenKind, indentation: int) -> bool
title: Consume line markers only when a same-level clause follows.
parameters:
  kind:
    type: TokenKind
  indentation:
    type: int
returns:
  type: bool
get_tok_precedence(self) -> int
title: Get the precedence of the pending binary operator token.
returns:
  type: int

Search documentation

Type to search.