Example #1
0

from iast.python.python34 import (parse as _parse, extract_tree,
                                  make_pattern, Templater,
                                  pyToStruct, structToPy,
                                  MacroProcessor, ContextSetter,
                                  literal_eval,
                                  py_nodes as python_nodes)

from incoq.util.misc import flood_namespace, new_namespace

from . import iast_common
from .iast_common import ExtractMixin
from .unparse import Unparser

P = new_namespace(python_nodes)


# Flood the module namespace with Python nodes and iAST exports.
flood_namespace(globals(), python_nodes)
flood_namespace(globals(), iast_common)


class CommentUnparser(Unparser):
    
    """Unparser that turns a special COMMENT construct into
    an actual lexical comment in the emitted source code.
    
    The recognized pattern has the form:
    
        Expr(Call(Name('COMMENT', Load()),
Example #2
0
"""Config, symbols, names, and queries."""

from incoq.util.misc import new_namespace

from . import common
from . import symbols
from . import config
from . import symtab

S = new_namespace(config, symbols, symtab)
N = symtab.N
Example #3
0
    'IncASTConversionError',
    'import_incast',
    'export_incast',
    'Parser',
]


import keyword

from incoq.util.misc import new_namespace

from . import nodes as _nodes
from . import tools as _tools
from . import pynodes as P

L = new_namespace(_nodes, _tools)


class IncASTConversionError(Exception):
    pass
# Alias.
ASTErr = IncASTConversionError


def is_valid_identifier(s):
    return s.isidentifier() and not keyword.iskeyword(s)


# Trivial nodes are nodes that exist in both languages and whose
# translation is simply to map the conversion function to each of
# the node's children.
Example #4
0
    'ContextSetter',
    'literal_eval',
]

from iast.python.python34 import (parse as _parse, extract_tree, make_pattern,
                                  Templater, pyToStruct, structToPy,
                                  MacroProcessor, ContextSetter, literal_eval,
                                  py_nodes as python_nodes)

from incoq.util.misc import flood_namespace, new_namespace

from . import iast_common
from .iast_common import ExtractMixin
from .unparse import Unparser

P = new_namespace(python_nodes)

# Flood the module namespace with Python nodes and iAST exports.
flood_namespace(globals(), python_nodes)
flood_namespace(globals(), iast_common)


class CommentUnparser(Unparser):
    """Unparser that turns a special COMMENT construct into
    an actual lexical comment in the emitted source code.
    
    The recognized pattern has the form:
    
        Expr(Call(Name('COMMENT', Load()),
                  [Str(<TEXT>)],
                  [], None, None))
Example #5
0
"""Type system and analysis."""


from incoq.util.misc import new_namespace

from . import types
from . import analysis


T = new_namespace(types, analysis)
Example #6
0
"""Asymptotic cost analysis."""

from incoq.util.misc import new_namespace

from .costs import *
from .algebra import *
from .analyze import *

C = new_namespace(costs, algebra, analyze)
Example #7
0
"""Basic features for manipulating Python and IncAST code."""


from incoq.util.misc import new_namespace

from . import nodes
from . import pynodes as P
from . import tools
from . import pyconv
from . import error
from . import mask
from . import util
from . import functions


L = new_namespace(nodes, tools, pyconv, error, mask, util, functions)
Example #8
0
"""Asymptotic cost analysis."""


from incoq.util.misc import new_namespace

from .costs import *
from .algebra import *
from .analyze import *


C = new_namespace(costs, algebra, analyze)
Example #9
0
"""Basic features for manipulating Python and IncAST code."""

from incoq.util.misc import new_namespace

from . import nodes
from . import pynodes as P
from . import tools
from . import pyconv
from . import error
from . import mask
from . import util
from . import functions

L = new_namespace(nodes, tools, pyconv, error, mask, util, functions)
Example #10
0
"""Config, symbols, names, and queries."""


from incoq.util.misc import new_namespace

from . import common
from . import symbols
from . import config
from . import symtab


S = new_namespace(config, symbols, symtab)
N = symtab.N