3
V'íc±Y ã @ sÐ d Z ddlZddlmZmZmZmZmZmZm Z m
Z
ddlmZm
Z
mZmZmZmZmZmZmZ ddlmZmZ dddd gZd
d ZG dd deeZG d
d deeZG dd deZG dd d eZdS )zß
pygments.lexers.objective
~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for Objective-C family languages.
:copyright: Copyright 2006-2022 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
é N)Ú
RegexLexerÚincludeÚbygroupsÚusingÚthisÚwordsÚinheritÚdefault) ÚTextÚKeywordÚNameÚStringÚOperatorÚNumberÚPunctuationÚLiteralÚComment)ÚCLexerÚCppLexerÚObjectiveCLexerÚObjectiveCppLexerÚ
LogosLexerÚ
SwiftLexerc s0 t jd t jdG fddd}|S )z^
Generate a subclass of baselexer that accepts the Objective-C syntax
extensions.
z @(?:end|implementation|protocol)z<\[\s*[a-zA-Z_]\w*\s+(?:[a-zA-Z_]\w*\s*\]|(?:[a-zA-Z_]\w*)?:)c 6 s| e Zd ZdZdedfdefdejfdejfdejfdejfd ej fd
ej
fdedfd
edfdedfedtd;d<e
fedud;d<e
jfdFejfdGejfdHe
jfdIejfdJee
edvfdMee
edwfdOefegdPeejeejeedxfdReejeejdKfdSeejeejeedyfdTeejeejdKfdUeejeedzfdVejdKfgdWeejedNfdXeejedKfgedYedZd[efd\ed]fd^edKfgd_eeeeeeejd`fegedYdaefdbefdceeeeejfddejfd[edKfd\edefedKgdfedgfdhedKfedigdfed]fdhedKfedigdjedkfdledKfedigdjed]fdledKfedigd^edKfedigdmZ fdndoZd|fdqdr ZdsS )}z-objective.<locals>.GeneratedObjectiveCVariantzU
Implements Objective-C syntax on top of an existing C family lexer.
z@"Ústringz @(YES|NO)z3@'(\\.|\\[0-7]{1,3}|\\x[a-fA-F0-9]{1,2}|[^\\\'\n])'z&@(\d+\.\d*|\.\d+|\d+)[eE][+-]?\d+[lL]?z@(\d+\.\d*|\.\d+|\d+[fF])[fF]?z@0x[0-9a-fA-F]+[Ll]?z
@0[0-7]+[Ll]?z @\d+[Ll]?z@\(Úliteral_numberz@\[Ú
literal_arrayz@\{Úliteral_dictionaryú @selectorú@privateú
@protectedú@publicú@encodeú
@synchronizedú@tryú@throwú@catchú@finallyú@endú @propertyú@synthesizeÚ__bridgeÚ__bridge_transferÚ__autoreleasingÚ__blockÚ__weakÚ__strongÚweakÚstrongÚcopyÚretainÚassignÚunsafe_unretainedÚatomicÚ nonatomicÚreadonlyÚ readwriteÚsetterÚgetterÚtypeofÚinÚoutÚinoutÚreleaseÚclassú@dynamicú @optionalú @requiredú@autoreleasepoolú@importz\b)ÚsuffixÚidÚinstancetypeÚClassÚIMPÚSELÚBOOLÚIBOutletÚIBActionÚunicharz@(true|false|YES|NO)\nz(YES|NO|nil|self|super)\bz3(Boolean|UInt8|SInt8|UInt16|SInt16|UInt32|SInt32)\bz(TRUE|FALSE)\bz!(@interface|@implementation)(\s+)ú#popÚoc_classnamez(@class|@protocol)(\s+)Úoc_forward_classnameú@z7([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?(\s*)(\{)Úoc_ivarsz.([a-zA-Z$_][\w$]*)(\s*:\s*)([a-zA-Z$_][\w$]*)?z6([a-zA-Z$_][\w$]*)(\s*)(\([a-zA-Z$_][\w$]*\))(\s*)(\{)z-([a-zA-Z$_][\w$]*)(\s*)(\([a-zA-Z$_][\w$]*\))z([a-zA-Z$_][\w$]*)(\s*)(\{)z([a-zA-Z$_][\w$]*)z([a-zA-Z$_][\w$]*)(\s*,\s*)z([a-zA-Z$_][\w$]*)(\s*;?)Ú
whitespaceÚ
statementsú;z\{z#pushz\}z/^([-+])(\s*)(\(.*?\))?(\s*)([a-zA-Z$_][\w$]*:?)Úmethodú,z\.\.\.z (\(.*?\))(\s*)([a-zA-Z$_][\w$]*)z[a-zA-Z$_][\w$]*:Úfunctionz\(Úliteral_number_innerz\)Z statementz\[Úliteral_array_innerz\])rW rR rS rU ÚrootrY r r\ r r] r c s<