From 7cf0481b5ad2ae2b3b17fbc475bacae5c1a4ddd4 Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Fri, 18 Dec 2015 20:21:08 -0800 Subject: [PATCH] Implement output of Objective-C class field lists. --- ObjectiveC/Output.cpp | 3 +++ Parser.ypp.in | 11 +++-------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ObjectiveC/Output.cpp b/ObjectiveC/Output.cpp index a1101ec..7d21d6f 100644 --- a/ObjectiveC/Output.cpp +++ b/ObjectiveC/Output.cpp @@ -49,6 +49,9 @@ void CYImplementation::Output(CYOutput &out, CYFlags flags) const { } void CYImplementationField::Output(CYOutput &out) const { + out << *typed_; + out.Terminate(); + out << '\n'; } void CYInstanceLiteral::Output(CYOutput &out, CYFlags flags) const { diff --git a/Parser.ypp.in b/Parser.ypp.in index 687218a..f73ccd1 100644 --- a/Parser.ypp.in +++ b/Parser.ypp.in @@ -87,9 +87,9 @@ @end @begin ObjectiveC +%union { CYImplementationField *implementationField_; } %union { CYMessage *message_; } %union { CYMessageParameter *messageParameter_; } -%union { CYImplementationField *implementationField_; } %union { CYProtocol *protocol_; } %union { CYSelectorPart *selector_; } @end @@ -644,13 +644,12 @@ type; }) %type CategoryStatement %type ClassSuperOpt %type ConditionalExpressionClassic -%type ImplementationFieldListOpt -%type ImplementationFields %type ClassMessageDeclaration %type ClassMessageDeclarationListOpt %type ClassProtocolListOpt %type ClassProtocols %type ClassProtocolsOpt +%type ImplementationFieldListOpt %type ImplementationStatement %type MessageExpression %type MessageParameter @@ -2015,10 +2014,6 @@ ImplementationFieldListOpt | { $$ = NULL; } ; -ImplementationFields - : "{" ImplementationFieldListOpt[fields] "}" { $$ = $fields; } - ; - MessageScope : "+" { $$ = false; } | "-" { $$ = true; } @@ -2072,7 +2067,7 @@ ClassProtocolListOpt ; ImplementationStatement - : "@implementation" Identifier[name] ClassSuperOpt[extends] ClassProtocolListOpt[protocols] ImplementationFields[fields] ClassMessageDeclarationListOpt[messages] "@end" { $$ = CYNew CYImplementation($name, $extends, $protocols, $fields, $messages); } + : "@implementation" Identifier[name] ClassSuperOpt[extends] ClassProtocolListOpt[protocols] "{" ImplementationFieldListOpt[fields] "}" ClassMessageDeclarationListOpt[messages] "@end" { $$ = CYNew CYImplementation($name, $extends, $protocols, $fields, $messages); } ; CategoryName -- 2.47.2