예제 #1
0
 def perform_stack_action(self, stack: AutomatonStack, configuration: Configuration):
     current_content = stack.get_current_content()
     if not current_content:
         raise ParsingError('A variable name was expected!')
     stack.add_data(Argument(current_content))
     stack.remove_level()
     AcceptState.add_function_to_stack(stack)
예제 #2
0
 def __init__(self):
     ModifiedPushdownAutomaton.__init__(
         self, FunctionNameState(), [AcceptState()], [
             FunctionNameStateDescription(),
             ArgumentStartStateDescription(),
             ArgumentStateDescription(),
             FreeArgumentStateDescription(),
             RequiredArgumentStateDescription(),
             AcceptStateDescription()
         ])
예제 #3
0
 def __init__(self):
     StateDescription.__init__(
         self, ArgumentStartState(), _ArgumentStartDefaultTransition(), [
             TransitionWithAction(Configuration(ArgumentStartState(), ')'),
                                  Configuration(AcceptState(), ''),
                                  AcceptState.add_function_to_stack),
             TransitionWithAction(Configuration(ArgumentStartState(), '*'),
                                  Configuration(FreeArgumentState(), ''),
                                  lambda stack: stack.add_level())
         ])
예제 #4
0
 def __init__(self):
     TransitionWithoutAction.__init__(
         self, Configuration(FreeArgumentState(), ')'),
         Configuration(AcceptState(), ''))
예제 #5
0
 def __init__(self):
     StateDescription.__init__(self, AcceptState(),
                               _InvalidAcceptTransition(), [])
예제 #6
0
 def __init__(self):
     DefaultTransition.__init__(self, AcceptState())