Skip to content
Snippets Groups Projects
Commit 5fbbb0c4 authored by Tomáš Orviský's avatar Tomáš Orviský
Browse files

Changed file structure

parent 88ec019a
No related merge requests found
from manim import *
from typing import Type
from PUMLParser import PUMLParser
from pyPlantUML import *
import argparse
......
import ply.yacc as yacc
from PUMLexer import PUMLexer
from pyPlantUML import *
from .PUMLexer import PUMLexer
from .Diagram import Diagram
class PUMLParser(object):
......@@ -166,6 +165,25 @@ class PUMLParser(object):
self.diagram.addObject(classObj)
# def p_class_attr(self, p):
# """
# class_attr : IDENTIFIER COLON identifier_list
# | STRING COLON identifier_list
# """
# print('cattr', list(p))
# def p_identifier_list(self, p):
# """
# identifier_list : identifier_list IDENTIFIER
# | IDENTIFIER
# """
# if len(p) == 2:
# p[0] = [p[1]]
# else:
# p[0] = p[1] + [p[2]]
def p_error(self, p):
print("Parser syntax error:")
print("\t", p)
......
......@@ -28,7 +28,7 @@ class PUMLexer(object):
"STRING",
"IDENTIFIER",
"LINE",
"COLON",
"AFTERCOLON",
] + list(keywords.values())
def t_LINE(self, t):
......@@ -90,10 +90,15 @@ class PUMLexer(object):
return t
def t_IDENTIFIER(self, t):
r'@*\w+'
r'@*\w+[()]*'
t.type = self.keywords.get(t.value, 'IDENTIFIER')
return t
def t_AFTERCOLON(self, t):
r':.+'
t.value = t.value[1:].strip()
return t
def t_error(self, t):
print("Illegal character: '{}'".format(t.value[0]))
t.lexer.skip(1)
......@@ -101,8 +106,6 @@ class PUMLexer(object):
t_ignore = ' \n\t'
t_ignore_COMMENT = r"('.*)|(\/'(.|\s)*\'\/)"
t_COLON = r':'
def __init__(self, **kwargs):
self.lexer = lex.lex(module=self, **kwargs)
......
from .PUMLexer import PUMLexer
from .PUMLParser import PUMLParser
from .Diagram import Diagram
from .DiagramObject import DiagramObject
from .DiagramClass import DiagramClass
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment