Commit bbf32586 authored by Kateřina Sloupová's avatar Kateřina Sloupová
Browse files

renaming, reg.py middle module added

parent 757ac88b
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
grammar DFA_grammar;
grammar DFA;

/* Parser Rules */

+3 −3
Original line number Diff line number Diff line
# Generated from DFA_grammar.g4 by ANTLR 4.8
# Generated from DFA.g4 by ANTLR 4.8
from antlr4 import *
from io import StringIO
from typing.io import TextIO
@@ -32,7 +32,7 @@ def serializedATN():
        return buf.getvalue()


class DFA_grammarLexer(Lexer):
class DFALexer(Lexer):

    atn = ATNDeserializer().deserialize(serializedATN())

@@ -64,7 +64,7 @@ class DFA_grammarLexer(Lexer):
                  "LEFT_BRACKET", "RIGHT_BRACKET", "COMMA", "FINAL", "STATE", 
                  "WS" ]

    grammarFileName = "DFA_grammar.g4"
    grammarFileName = "DFA.g4"

    def __init__(self, input=None, output:TextIO = sys.stdout):
        super().__init__(input, output)

DFAListener.py

0 → 100644
+57 −0
Original line number Diff line number Diff line
# Generated from DFA.g4 by ANTLR 4.8
from antlr4 import *
if __name__ is not None and "." in __name__:
    from .DFAParser import DFAParser
else:
    from DFAParser import DFAParser

# This class defines a complete listener for a parse tree produced by DFAParser.
class DFAListener(ParseTreeListener):

    # Enter a parse tree produced by DFAParser#start.
    def enterStart(self, ctx:DFAParser.StartContext):
        pass

    # Exit a parse tree produced by DFAParser#start.
    def exitStart(self, ctx:DFAParser.StartContext):
        pass


    # Enter a parse tree produced by DFAParser#init.
    def enterInit(self, ctx:DFAParser.InitContext):
        pass

    # Exit a parse tree produced by DFAParser#init.
    def exitInit(self, ctx:DFAParser.InitContext):
        pass


    # Enter a parse tree produced by DFAParser#production.
    def enterProduction(self, ctx:DFAParser.ProductionContext):
        pass

    # Exit a parse tree produced by DFAParser#production.
    def exitProduction(self, ctx:DFAParser.ProductionContext):
        pass


    # Enter a parse tree produced by DFAParser#final.
    def enterFinal(self, ctx:DFAParser.FinalContext):
        pass

    # Exit a parse tree produced by DFAParser#final.
    def exitFinal(self, ctx:DFAParser.FinalContext):
        pass


    # Enter a parse tree produced by DFAParser#statename.
    def enterStatename(self, ctx:DFAParser.StatenameContext):
        pass

    # Exit a parse tree produced by DFAParser#statename.
    def exitStatename(self, ctx:DFAParser.StatenameContext):
        pass



del DFAParser
 No newline at end of file
+53 −53
Original line number Diff line number Diff line
# Generated from DFA_grammar.g4 by ANTLR 4.8
# Generated from DFA.g4 by ANTLR 4.8
# encoding: utf-8
from antlr4 import *
from io import StringIO
@@ -32,9 +32,9 @@ def serializedATN():
        return buf.getvalue()


class DFA_grammarParser ( Parser ):
class DFAParser ( Parser ):

    grammarFileName = "DFA_grammar.g4"
    grammarFileName = "DFA.g4"

    atn = ATNDeserializer().deserialize(serializedATN())

@@ -85,22 +85,22 @@ class DFA_grammarParser ( Parser ):
            self.parser = parser

        def init(self):
            return self.getTypedRuleContext(DFA_grammarParser.InitContext,0)
            return self.getTypedRuleContext(DFAParser.InitContext,0)


        def final(self):
            return self.getTypedRuleContext(DFA_grammarParser.FinalContext,0)
            return self.getTypedRuleContext(DFAParser.FinalContext,0)


        def production(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(DFA_grammarParser.ProductionContext)
                return self.getTypedRuleContexts(DFAParser.ProductionContext)
            else:
                return self.getTypedRuleContext(DFA_grammarParser.ProductionContext,i)
                return self.getTypedRuleContext(DFAParser.ProductionContext,i)


        def getRuleIndex(self):
            return DFA_grammarParser.RULE_start
            return DFAParser.RULE_start

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStart" ):
@@ -115,7 +115,7 @@ class DFA_grammarParser ( Parser ):

    def start(self):

        localctx = DFA_grammarParser.StartContext(self, self._ctx, self.state)
        localctx = DFAParser.StartContext(self, self._ctx, self.state)
        self.enterRule(localctx, 0, self.RULE_start)
        self._la = 0 # Token type
        try:
@@ -125,7 +125,7 @@ class DFA_grammarParser ( Parser ):
            self.state = 14
            self._errHandler.sync(self)
            _la = self._input.LA(1)
            while _la==DFA_grammarParser.LEFT_PARENTHESIS:
            while _la==DFAParser.LEFT_PARENTHESIS:
                self.state = 11
                self.production()
                self.state = 16
@@ -150,17 +150,17 @@ class DFA_grammarParser ( Parser ):
            self.parser = parser

        def INIT(self):
            return self.getToken(DFA_grammarParser.INIT, 0)
            return self.getToken(DFAParser.INIT, 0)

        def EQUALS(self):
            return self.getToken(DFA_grammarParser.EQUALS, 0)
            return self.getToken(DFAParser.EQUALS, 0)

        def statename(self):
            return self.getTypedRuleContext(DFA_grammarParser.StatenameContext,0)
            return self.getTypedRuleContext(DFAParser.StatenameContext,0)


        def getRuleIndex(self):
            return DFA_grammarParser.RULE_init
            return DFAParser.RULE_init

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterInit" ):
@@ -175,22 +175,22 @@ class DFA_grammarParser ( Parser ):

    def init(self):

        localctx = DFA_grammarParser.InitContext(self, self._ctx, self.state)
        localctx = DFAParser.InitContext(self, self._ctx, self.state)
        self.enterRule(localctx, 2, self.RULE_init)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 23
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [DFA_grammarParser.INIT]:
            if token in [DFAParser.INIT]:
                self.state = 19
                self.match(DFA_grammarParser.INIT)
                self.match(DFAParser.INIT)
                self.state = 20
                self.match(DFA_grammarParser.EQUALS)
                self.match(DFAParser.EQUALS)
                self.state = 21
                self.statename()
                pass
            elif token in [DFA_grammarParser.LEFT_PARENTHESIS, DFA_grammarParser.FINAL]:
            elif token in [DFAParser.LEFT_PARENTHESIS, DFAParser.FINAL]:
                pass
            else:
                raise NoViableAltException(self)
@@ -211,26 +211,26 @@ class DFA_grammarParser ( Parser ):
            self.parser = parser

        def LEFT_PARENTHESIS(self):
            return self.getToken(DFA_grammarParser.LEFT_PARENTHESIS, 0)
            return self.getToken(DFAParser.LEFT_PARENTHESIS, 0)

        def statename(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(DFA_grammarParser.StatenameContext)
                return self.getTypedRuleContexts(DFAParser.StatenameContext)
            else:
                return self.getTypedRuleContext(DFA_grammarParser.StatenameContext,i)
                return self.getTypedRuleContext(DFAParser.StatenameContext,i)


        def COMMA(self):
            return self.getToken(DFA_grammarParser.COMMA, 0)
            return self.getToken(DFAParser.COMMA, 0)

        def RIGHT_PARENTHESIS(self):
            return self.getToken(DFA_grammarParser.RIGHT_PARENTHESIS, 0)
            return self.getToken(DFAParser.RIGHT_PARENTHESIS, 0)

        def EQUALS(self):
            return self.getToken(DFA_grammarParser.EQUALS, 0)
            return self.getToken(DFAParser.EQUALS, 0)

        def getRuleIndex(self):
            return DFA_grammarParser.RULE_production
            return DFAParser.RULE_production

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterProduction" ):
@@ -245,22 +245,22 @@ class DFA_grammarParser ( Parser ):

    def production(self):

        localctx = DFA_grammarParser.ProductionContext(self, self._ctx, self.state)
        localctx = DFAParser.ProductionContext(self, self._ctx, self.state)
        self.enterRule(localctx, 4, self.RULE_production)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 25
            self.match(DFA_grammarParser.LEFT_PARENTHESIS)
            self.match(DFAParser.LEFT_PARENTHESIS)
            self.state = 26
            self.statename()
            self.state = 27
            self.match(DFA_grammarParser.COMMA)
            self.match(DFAParser.COMMA)
            self.state = 28
            self.statename()
            self.state = 29
            self.match(DFA_grammarParser.RIGHT_PARENTHESIS)
            self.match(DFAParser.RIGHT_PARENTHESIS)
            self.state = 30
            self.match(DFA_grammarParser.EQUALS)
            self.match(DFAParser.EQUALS)
            self.state = 31
            self.statename()
        except RecognitionException as re:
@@ -279,32 +279,32 @@ class DFA_grammarParser ( Parser ):
            self.parser = parser

        def FINAL(self):
            return self.getToken(DFA_grammarParser.FINAL, 0)
            return self.getToken(DFAParser.FINAL, 0)

        def EQUALS(self):
            return self.getToken(DFA_grammarParser.EQUALS, 0)
            return self.getToken(DFAParser.EQUALS, 0)

        def LEFT_BRACKET(self):
            return self.getToken(DFA_grammarParser.LEFT_BRACKET, 0)
            return self.getToken(DFAParser.LEFT_BRACKET, 0)

        def RIGHT_BRACKET(self):
            return self.getToken(DFA_grammarParser.RIGHT_BRACKET, 0)
            return self.getToken(DFAParser.RIGHT_BRACKET, 0)

        def statename(self, i:int=None):
            if i is None:
                return self.getTypedRuleContexts(DFA_grammarParser.StatenameContext)
                return self.getTypedRuleContexts(DFAParser.StatenameContext)
            else:
                return self.getTypedRuleContext(DFA_grammarParser.StatenameContext,i)
                return self.getTypedRuleContext(DFAParser.StatenameContext,i)


        def COMMA(self, i:int=None):
            if i is None:
                return self.getTokens(DFA_grammarParser.COMMA)
                return self.getTokens(DFAParser.COMMA)
            else:
                return self.getToken(DFA_grammarParser.COMMA, i)
                return self.getToken(DFAParser.COMMA, i)

        def getRuleIndex(self):
            return DFA_grammarParser.RULE_final
            return DFAParser.RULE_final

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterFinal" ):
@@ -319,29 +319,29 @@ class DFA_grammarParser ( Parser ):

    def final(self):

        localctx = DFA_grammarParser.FinalContext(self, self._ctx, self.state)
        localctx = DFAParser.FinalContext(self, self._ctx, self.state)
        self.enterRule(localctx, 6, self.RULE_final)
        self._la = 0 # Token type
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 33
            self.match(DFA_grammarParser.FINAL)
            self.match(DFAParser.FINAL)
            self.state = 34
            self.match(DFA_grammarParser.EQUALS)
            self.match(DFAParser.EQUALS)
            self.state = 35
            self.match(DFA_grammarParser.LEFT_BRACKET)
            self.match(DFAParser.LEFT_BRACKET)
            self.state = 45
            self._errHandler.sync(self)
            token = self._input.LA(1)
            if token in [DFA_grammarParser.STATE]:
            if token in [DFAParser.STATE]:
                self.state = 36
                self.statename()
                self.state = 41
                self._errHandler.sync(self)
                _la = self._input.LA(1)
                while _la==DFA_grammarParser.COMMA:
                while _la==DFAParser.COMMA:
                    self.state = 37
                    self.match(DFA_grammarParser.COMMA)
                    self.match(DFAParser.COMMA)
                    self.state = 38
                    self.statename()
                    self.state = 43
@@ -349,13 +349,13 @@ class DFA_grammarParser ( Parser ):
                    _la = self._input.LA(1)

                pass
            elif token in [DFA_grammarParser.RIGHT_BRACKET]:
            elif token in [DFAParser.RIGHT_BRACKET]:
                pass
            else:
                raise NoViableAltException(self)

            self.state = 47
            self.match(DFA_grammarParser.RIGHT_BRACKET)
            self.match(DFAParser.RIGHT_BRACKET)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)
@@ -372,10 +372,10 @@ class DFA_grammarParser ( Parser ):
            self.parser = parser

        def STATE(self):
            return self.getToken(DFA_grammarParser.STATE, 0)
            return self.getToken(DFAParser.STATE, 0)

        def getRuleIndex(self):
            return DFA_grammarParser.RULE_statename
            return DFAParser.RULE_statename

        def enterRule(self, listener:ParseTreeListener):
            if hasattr( listener, "enterStatename" ):
@@ -390,12 +390,12 @@ class DFA_grammarParser ( Parser ):

    def statename(self):

        localctx = DFA_grammarParser.StatenameContext(self, self._ctx, self.state)
        localctx = DFAParser.StatenameContext(self, self._ctx, self.state)
        self.enterRule(localctx, 8, self.RULE_statename)
        try:
            self.enterOuterAlt(localctx, 1)
            self.state = 49
            self.match(DFA_grammarParser.STATE)
            self.match(DFAParser.STATE)
        except RecognitionException as re:
            localctx.exception = re
            self._errHandler.reportError(self, re)

DFA_grammar.interp

deleted100644 → 0
+0 −36
Original line number Diff line number Diff line
token literal names:
null
'init'
'='
'('
')'
'{'
'}'
','
null
null
null

token symbolic names:
null
INIT
EQUALS
LEFT_PARENTHESIS
RIGHT_PARENTHESIS
LEFT_BRACKET
RIGHT_BRACKET
COMMA
FINAL
STATE
WS

rule names:
start
init
production
final
statename


atn:
[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 12, 54, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 3, 2, 3, 2, 7, 2, 15, 10, 2, 12, 2, 14, 2, 18, 11, 2,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2, 2, 2, 47, 38, 3, 2, 2, 2, 47, 46, 3, 2, 2, 2, 48, 49, 3, 2, 2, 2, 49, 50, 7, 8, 2, 2, 50, 9, 3, 2, 2, 2, 51, 52, 7, 11, 2, 2, 52, 11, 3, 2, 2, 2, 6, 16, 25, 43, 47]
 No newline at end of file
Loading