def applies(self, element:Element):
     return (
         is_identifier(element.code) and
         identifier_in(element.code, self.sym_vals) and
         not element.is_first() and
         not element.is_last()
     )
 def applies(self, element:Element):
     #  p [ + ] n
     return (is_identifier(element.code) and
             identifier_in(element.code, self.sym_vals) and
             not element.is_first() and
             not element.is_last() and
             not is_form(element.parent, self.head_symbol_name))
 def applies(self, element: Element):
     return ((not isinstance(element.parent, Form)
              or not element.is_first()) and is_identifier(element.code)
             and identifier_in(element.code, self.sym_vals)
             and element.next is not None and element.next.code is not None
             and element.code.range.position_after.index
             == element.next.code.range.first_position.index)
 def applies(self, element: Element):
     next = element.next
     return (is_identifier(element.code) and next is not None
             and is_identifier(next.code)
             and (element.code.name, next.code.name) in self.sym_vals
             and  # FIXME
             not element.is_first() and not next.is_last())
 def applies(self, element:Element):
     return (
         not element.is_first() and
         is_token(element, Tokens.CONSTITUENT) and
         identifier_in(element.value, self.sym_vals) and
         is_not_none(element.prev, ".code.range.position_after.index", element, ".range.first_position.index") and
         element.prev.code.range.position_after.index == element.range.first_position.index
     )
 def applies(self, element: Element):
     return (not element.is_first()
             and is_token(element, Tokens.CONSTITUENT)
             and identifier_in(element.value, self.sym_vals) and
             is_not_none(element.prev, ".code.range.position_after.index",
                         element, ".range.first_position.index")
             and element.prev.code.range.position_after.index
             == element.range.first_position.index)
 def applies(self, element:Element):
     return (
         not element.is_first() and
         is_identifier(element.code) and
         identifier_in(element.code, self.sym_vals) and
         element.prev is not None and
         element.prev.code is not None and
         element.prev.code.range.position_after.index == element.code.range.first_position.index
     )
 def applies(self, element:Element):
     return (
         (not isinstance(element.parent, Form) or not element.is_first()) and
         is_identifier(element.code) and
         identifier_in(element.code, self.sym_vals) and
         element.next is not None and
         element.next.code is not None and
         element.code.range.position_after.index == element.next.code.range.first_position.index
     )
 def applies(self, element:Element):
     next = element.next
     return (
         is_identifier(element.code) and
         next is not None and
         is_identifier(next.code) and
         (element.code.name, next.code.name) in self.sym_vals and # FIXME
         not element.is_first() and
         not next.is_last()
     )
 def applies(self, element: Element):
     next = element.next
     return (next is not None
             and (not (element.is_first() and is_form(element.parent))
                  or not next.is_last()) and is_identifier(element)
             and element.code.name in self.token_vals
             and is_not_none(element, ".range.position_after.index", next,
                             ".range.first_position.index")
             and element.code.range.position_after.index
             == next.code.range.first_position.index)
 def applies(self, element:Element):
     next = element.next
     return (
         next is not None and
         (not (element.is_first() and is_form(element.parent)) or not next.is_last()) and
         is_identifier(element) and
         element.code.name in self.token_vals and
         is_not_none(element, ".range.position_after.index", next, ".range.first_position.index") and
         element.code.range.position_after.index == next.code.range.first_position.index
     )
    def applies(self, element:Element):
        def _is_identifier_or_literal_immediately_after(next, element):
            return ((is_identifier(next) or is_literal(next)) and
                is_not_none(next, ".code.range.first_position.index") and
                element.code.range.position_after.index == next.code.range.first_position.index)

        def _is_begin_macro_token_immediately_after(next, element):
            return (is_token(next, Tokens.BEGIN_MACRO) and
                is_not_none(next, ".range.first_position.index") and
                element.code.range.position_after.index == next.range.first_position.index)

        next = element.next
        return (
            next is not None and
            (not (element.is_first() and is_form(element.parent)) or not next.is_last()) and
            is_identifier(element) and
            identifier_in(element.code, self.sym_vals) and
            is_not_none(element, ".code.range.position_after.index") and
            (_is_identifier_or_literal_immediately_after(next, element) or
             _is_begin_macro_token_immediately_after(next, element))
        )
    def applies(self, element: Element):
        def _is_identifier_or_literal_immediately_after(next, element):
            return ((is_identifier(next) or is_literal(next))
                    and is_not_none(next, ".code.range.first_position.index")
                    and element.code.range.position_after.index
                    == next.code.range.first_position.index)

        def _is_begin_macro_token_immediately_after(next, element):
            return (is_token(next, Tokens.BEGIN_MACRO)
                    and is_not_none(next, ".range.first_position.index")
                    and element.code.range.position_after.index
                    == next.range.first_position.index)

        next = element.next
        return (next is not None
                and (not (element.is_first() and is_form(element.parent))
                     or not next.is_last()) and is_identifier(element)
                and identifier_in(element.code, self.sym_vals)
                and is_not_none(element, ".code.range.position_after.index")
                and
                (_is_identifier_or_literal_immediately_after(next, element)
                 or _is_begin_macro_token_immediately_after(next, element)))
Пример #14
0
 def applies(self, element:Element):
     return (is_identifier(element.code) and
             element.code.name in self.names and
             (element.parent.__class__ is not Form or not element.is_first() or len(element.parent) > 2))
Пример #15
0
 def applies(self, element: Element):
     return (is_identifier(element, ':=') or is_identifier(element, '=')) and \
            not element.is_first() and \
            ( isinstance(element.parent, PreForm) or isinstance(element.parent, PreSeq) )
Пример #16
0
def is_head(element: Element):
    return isinstance(element.parent, Form) and element.is_first()
 def applies(self, element: Element):
     return (is_identifier(element.code)
             and identifier_in(element.code, self.sym_vals)
             and not element.is_first() and not element.is_last())
Пример #18
0
 def applies(self, element: Element):
     return (is_identifier(element.code) and element.code.name in self.names
             and (element.parent.__class__ is not Form
                  or not element.is_first() or len(element.parent) > 2))
Пример #19
0
 def applies(self, element: Element):
     #  p [ + ] n
     return (is_identifier(element.code)
             and identifier_in(element.code, self.sym_vals)
             and not element.is_first() and not element.is_last()
             and not is_form(element.parent, self.head_symbol_name))
Пример #20
0
 def applies(self, element:Element):
     return is_identifier(element.code) and element.code.name in self.arrows and not element.is_first()
 def applies(self, element: Element):
     return (not element.is_first() and is_identifier(element.code)
             and identifier_in(element.code, self.sym_vals)
             and element.prev is not None and element.prev.code is not None
             and element.prev.code.range.position_after.index
             == element.code.range.first_position.index)
Пример #22
0
 def __init__(self, type_, range:StreamRange):
     Element.__init__(self, None)
     self.type = type_
     """The type-number of the token."""
     self._range = range
Пример #23
0
 def applies(self, element:Element):
     return (is_identifier(element, ':=') or is_identifier(element, '=')) and \
            not element.is_first() and \
            ( isinstance(element.parent, PreForm) or isinstance(element.parent, PreSeq) )
Пример #24
0
def is_head(element:Element):
    return isinstance(element.parent, Form) and element.is_first()
Пример #25
0
 def applies(self, element: Element):
     return is_identifier(
         element.code
     ) and element.code.name in self.arrows and not element.is_first()