예제 #1
0
파일: ast.py 프로젝트: stasm/l20n
class Entity(Entry):
    id = pyast.field(Identifier)
    index = pyast.seq(Expression, null=True)
    value = pyast.field(Value, null=True)
    attrs = pyast.dict(Attribute, null=True)
    local = pyast.field(bool, default=False)

    def _template(self):
        return "<%(id)s %(value)s>"
예제 #2
0
        class Entity(ast.Node):
            _debug = True
            id = ast.field(str)
            value = ast.field(Value, null=True)

            @property
            def _template(self):
                if self.value:
                    return '<%(id)s %(value)s>'
                return '<%(id)s>'
예제 #3
0
        class Value(ast.Node):
            content = ast.field(str)

            _template = '"%(content)s"'

            def __repr__(self):
                content = self.content.replace('"', '\\"')
                return super(Value, self).__repr__(fields={'content': content})
예제 #4
0
파일: ast.py 프로젝트: stasm/l20n
class Expander(Node):
    expression = pyast.field(Expression)
예제 #5
0
파일: ast.py 프로젝트: stasm/l20n
class VariableExpression(Expression):
    id = pyast.field(Identifier)
예제 #6
0
파일: ast.py 프로젝트: stasm/l20n
class ImportStatement(Statement):
    uri = pyast.field(String)
예제 #7
0
        class Value(ast.Node):
            content = ast.field(str)

            @property
            def _template(self):
                return '"%(content)s"'
예제 #8
0
파일: ast.py 프로젝트: stasm/l20n
class Attribute(KeyValuePair):
    local = pyast.field(bool, default=False)
예제 #9
0
파일: ast.py 프로젝트: stasm/l20n
class BinaryOperator(Operator):
    token = pyast.field(
        ("==", "!=", "<", "<=", ">", ">=", "+", "-", "*", "/", "%"))
예제 #10
0
파일: ast.py 프로젝트: stasm/l20n
class UnaryExpression(Expression):
    operator = pyast.field(UnaryOperator)
    argument = pyast.field(Expression)
예제 #11
0
파일: ast.py 프로젝트: stasm/l20n
class CallExpression(MemberExpression):
    callee = pyast.field(Expression)
    arguments = pyast.seq(Expression, null=True)
예제 #12
0
파일: ast.py 프로젝트: stasm/l20n
class BinaryExpression(Expression):
    operator = pyast.field(BinaryOperator)
    left = pyast.field(Expression)
    right = pyast.field(Expression)
예제 #13
0
파일: ast.py 프로젝트: stasm/l20n
class ConditionalExpression(Expression):
    test = pyast.field(Expression)
    consequent = pyast.field(Expression)
    alternate = pyast.field(Expression)
예제 #14
0
파일: ast.py 프로젝트: stasm/l20n
class LogicalExpression(Expression):
    operator = pyast.field(LogicalOperator)
    left = pyast.field(Expression)
    right = pyast.field(Expression)
예제 #15
0
파일: ast.py 프로젝트: stasm/l20n
class Literal(Expression):
    value = pyast.field(int)

    __template = '%(value)s'
예제 #16
0
파일: ast.py 프로젝트: stasm/l20n
class LogicalOperator(Operator):
    token = pyast.field(("||", "&&"))
예제 #17
0
파일: ast.py 프로젝트: stasm/l20n
class KeyValuePair(Node):
    key = pyast.field(Identifier)
    value = pyast.field(Value)
    _abstract = True
예제 #18
0
파일: ast.py 프로젝트: stasm/l20n
class Comment(Entry):
    content = pyast.field(basestring, null=True)

    _template = "/* %(content)s */"
예제 #19
0
파일: ast.py 프로젝트: stasm/l20n
class HashItem(KeyValuePair):
    default = pyast.field(bool, default=False)
예제 #20
0
 class KVP(ast.Node):
     key = ast.field(str)
     value = ast.field(str)
예제 #21
0
파일: ast.py 프로젝트: stasm/l20n
class PropertyExpression(MemberExpression):
    expression = pyast.field(Expression)
    property = pyast.field(Expression)
    computed = pyast.field(bool)
예제 #22
0
파일: ast.py 프로젝트: stasm/l20n
class UnaryOperator(Operator):
    token = pyast.field(("-", "+", "!"))
예제 #23
0
파일: ast.py 프로젝트: stasm/l20n
class Macro(Entry):
    id = pyast.field(Identifier)
    args = pyast.seq(VariableExpression)
    expression = pyast.field(Expression)
    attrs = pyast.seq(Attribute, null=True)
예제 #24
0
파일: ast.py 프로젝트: stasm/l20n
class AttributeExpression(MemberExpression):
    expression = pyast.field(Expression)
    attribute = pyast.field(Expression)
    computed = pyast.field(bool)
예제 #25
0
        class Value(ast.Node):
            content = ast.field(str)

            _template = '"%(content)s"'
예제 #26
0
파일: ast.py 프로젝트: stasm/l20n
class ParenthesisExpression(Expression):
    expression = pyast.field(Expression)
예제 #27
0
        class Entity(ast.Node):
            _debug = True
            id = ast.field(str)
            value = ast.field(str)

            _template = '<%(id)s %(value)s>'
예제 #28
0
파일: ast.py 프로젝트: stasm/l20n
class GlobalsExpression(Expression):
    id = pyast.field(Identifier)
예제 #29
0
파일: ast.py 프로젝트: stasm/l20n
class Identifier(Expression):
    name = pyast.field(pyast.re('[_a-zA-Z]\w*'))

    _template = "%(name)s"
예제 #30
0
파일: ast.py 프로젝트: stasm/l20n
class String(Value):
    content = pyast.field(basestring)

    _template = "\"%(content)s\""