Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/objc/DNObjectiveCContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,17 @@ class DNPropertyContext extends DNContext {
class DNProtocolContext extends DNContext {
constructor(internal) {
super(internal)
this.name = internal.children[1].start.text
this.name = internal.name.start.text
this.properties = []
this.methods = []
this.protocols = []
this.macros = []
this.availability = []
}

parse() {
var result = 'abstract class ' + this.name
var result = this.availability.map((a) => a.parse()).join(' ') + '\n'
result += 'abstract class ' + this.name
if (typeof this.protocols !== 'undefined' && this.protocols.length > 0) {
result += ' implements ' + this.protocols.join(',')
}
Expand Down
3 changes: 2 additions & 1 deletion lib/objc/DNObjectiveCParserListener.js
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,8 @@ class DNObjectiveCParserListener extends ObjectiveCParserListener {
this.currentContext instanceof DNClassContext ||
this.currentContext instanceof DNPropertyContext ||
this.currentContext instanceof DNEnumDefContext ||
this.currentContext instanceof DNEnumItemContext) {
this.currentContext instanceof DNEnumItemContext ||
this.currentContext instanceof DNProtocolContext) {
var name = ctx.start.text
this.currentContext.macros.push(name)

Expand Down
5 changes: 3 additions & 2 deletions parser/objc/ObjectiveCParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ genericTypeSpecifier
;

protocolDeclaration
: '@protocol'
protocolName (LT protocolList GT)? protocolDeclarationSection*
: macro*
'@protocol'
name = protocolName (LT protocolList GT)? protocolDeclarationSection*
'@end'
;

Expand Down
Loading