oppc: decouple attribute name
authorDmitry Selyutin <ghostmansd@gmail.com>
Sun, 14 Jan 2024 18:05:05 +0000 (21:05 +0300)
committerDmitry Selyutin <ghostmansd@gmail.com>
Tue, 16 Jan 2024 19:10:07 +0000 (22:10 +0300)
src/openpower/oppc/pc_ast.py
src/openpower/oppc/pc_parser.py

index 2626b3583032ec50ad8336143728bd60b80dc5da..b3ec17b9dc8a3a5327e93a0f91dac8c4e493896e 100644 (file)
@@ -193,7 +193,10 @@ class Symbol(Token):
 
 
 class Attribute(Dataclass):
-    name: Symbol
+    class Name(Symbol):
+        pass
+
+    name: Name
     subject: Node = Node()
 
 
index 8f385d6deedb5d8b0957ace81046c3916bbed22a..a7a0ffbef6b4c0ad7bf7f1dd00c420ff6d0b8fea 100644 (file)
@@ -549,7 +549,7 @@ class Parser:
         """
         trailer_attr    : PERIOD NAME
         """
-        p[0] = pc_ast.Attribute(name=p[2])
+        p[0] = pc_ast.Attribute(name=pc_ast.Attribute.Name(p[2]))
 
     # subscript: '.' '.' '.' | test | [test] ':' [test]
     def p_subscript(self, p):