├── .gitignore ├── Java ├── .project ├── ObjC.g4 ├── classes │ └── artifacts │ │ └── Objc2Lua_jar │ │ └── Objc2Lua.jar ├── lib │ └── antlr-4.5.1-complete.jar ├── src │ ├── META-INF │ │ └── MANIFEST.MF │ └── bos │ │ └── consoar │ │ └── objc2lua │ │ ├── ClassDescription.java │ │ ├── CodeFormatter.java │ │ ├── DescriptiveErrorListener.java │ │ ├── MainActivity.java │ │ ├── Parse.java │ │ ├── ParseOptions.java │ │ ├── ParserObjcListener.java │ │ ├── Translations.java │ │ └── parser │ │ ├── ObjC.tokens │ │ ├── ObjCBaseListener.java │ │ ├── ObjCLexer.java │ │ ├── ObjCLexer.tokens │ │ ├── ObjCListener.java │ │ └── ObjCParser.java └── translate.dat ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | # built application files 2 | *.apk 3 | *.ap_ 4 | 5 | # files for the dex VM 6 | *.dex 7 | 8 | # Java class files 9 | *.class 10 | 11 | # generated files 12 | bin/ 13 | gen/ 14 | 15 | # Local configuration file (sdk path, etc) 16 | local.properties 17 | 18 | # Eclipse project files 19 | .classpath 20 | .settings 21 | 22 | # Proguard folder generated by Eclipse 23 | proguard/ 24 | 25 | # Intellij project files 26 | *.iml 27 | *.ipr 28 | *.iws 29 | .idea/ 30 | 31 | # Editor debris 32 | *.swp 33 | 34 | -------------------------------------------------------------------------------- /Java/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | Objc2Lua 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /Java/ObjC.g4: -------------------------------------------------------------------------------- 1 | // Converted to ANTLR 4 by Terence Parr; added @property and a few others. 2 | // Seems to handle stuff like this except for blocks: 3 | // https://google-api-objectivec-client.googlecode.com/svn/trunk/Examples/ShoppingSample/ShoppingSampleWindowController.m 4 | 5 | /** 6 | * ObjectiveC version 2 7 | * based on an LL ansic grammars and 8 | * and ObjectiveC grammar found in Learning Object C 9 | * 10 | * It's a Work in progress, most of the .h file can be parsed 11 | * June 2008 Cedric Cuche 12 | **/ 13 | 14 | grammar ObjC; 15 | 16 | @lexer::members { 17 | public static final int PREPROCESSER_CHANNEL = 2; 18 | public static final int COMMENT_CHANNEL = 3; 19 | } 20 | 21 | translation_unit: external_declaration+ EOF; 22 | 23 | external_declaration: 24 | preprocessor_declaration 25 | | function_definition 26 | | declaration 27 | | class_interface 28 | | class_implementation 29 | | category_interface 30 | | category_implementation 31 | | protocol_declaration 32 | | protocol_declaration_list 33 | | class_declaration_list 34 | | comment 35 | ; 36 | 37 | preprocessor_declaration: 38 | IMPORT 39 | | INCLUDE 40 | | define_statement 41 | | '#ifdef' expression 42 | | '#if' expression 43 | | '#undef' expression 44 | | '#ifndef' expression 45 | | '#endif'; 46 | 47 | define_statement : 48 | '#define' identifier constant_expression 49 | ; 50 | 51 | macro_specification: '.+'; 52 | 53 | class_interface: 54 | '@interface' 55 | class_name (':' superclass_name)? 56 | protocol_reference_list? 57 | instance_variables? 58 | interface_declaration_list? 59 | '@end'; 60 | 61 | category_interface: 62 | '@interface' 63 | class_name '(' category_name? ')' 64 | protocol_reference_list? 65 | instance_variables? 66 | interface_declaration_list? 67 | '@end'; 68 | 69 | class_implementation: 70 | '@implementation' 71 | ( 72 | class_name ( ':' superclass_name )? 73 | instance_variables? 74 | ( implementation_definition_list )? 75 | ) 76 | '@end'; 77 | 78 | category_implementation: 79 | '@implementation'( 80 | class_name '(' category_name ')' 81 | ( implementation_definition_list )? 82 | )'@end'; 83 | 84 | protocol_declaration: 85 | '@protocol'( 86 | protocol_name ( protocol_reference_list )? 87 | (protocol_requirement)? 88 | ( interface_declaration_list )? 89 | )'@end'; 90 | 91 | protocol_declaration_list: 92 | ('@protocol' protocol_list';') 93 | ; 94 | 95 | protocol_requirement : 96 | '@optional' 97 | | '@required' 98 | ; 99 | 100 | class_declaration_list: 101 | ('@class' class_list';') 102 | ; 103 | 104 | class_list: 105 | class_name (',' class_name)*; 106 | 107 | protocol_reference_list: 108 | ('<' protocol_list '>'); 109 | 110 | protocol_list: 111 | protocol_name (',' protocol_name)*; 112 | 113 | property_declaration 114 | : '@property' property_attributes_declaration? ib_outlet_specifier? struct_declaration 115 | ; 116 | 117 | property_attributes_declaration 118 | : '(' property_attributes_list ')' 119 | ; 120 | 121 | property_attributes_list 122 | : property_attribute (',' property_attribute)* 123 | ; 124 | 125 | property_attribute 126 | : IDENTIFIER 127 | | IDENTIFIER '=' IDENTIFIER // getter 128 | | IDENTIFIER '=' IDENTIFIER ':' // setter 129 | ; 130 | 131 | ib_outlet_specifier 132 | : IDENTIFIER '(' class_name ')' 133 | | IDENTIFIER 134 | ; 135 | 136 | class_name: 137 | identifier; 138 | 139 | superclass_name: 140 | identifier; 141 | 142 | category_name: 143 | IDENTIFIER; 144 | 145 | protocol_name: 146 | IDENTIFIER; 147 | 148 | instance_variables 149 | : '{' struct_declaration* '}' #instance_decl 150 | | '{' visibility_specification struct_declaration+ '}' #instance_sdecl 151 | | '{' struct_declaration+ instance_variables '}' #instance_idecl 152 | | '{' visibility_specification struct_declaration+ instance_variables '}' 153 | #instance_sidecl ; 154 | 155 | visibility_specification: 156 | '@private' 157 | | '@protected' 158 | | '@package' 159 | | '@public' 160 | ; 161 | 162 | interface_declaration_list: 163 | (declaration 164 | | class_method_declaration 165 | | instance_method_declaration 166 | | property_declaration)+ 167 | ; 168 | class_method_declaration: 169 | ('+' method_declaration) 170 | ; 171 | 172 | instance_method_declaration: 173 | ('-' method_declaration) 174 | ; 175 | 176 | method_declaration: 177 | ( method_type )? method_selector ';'; 178 | 179 | implementation_definition_list 180 | : ( implementation_definition)+ 181 | ; 182 | 183 | implementation_definition : 184 | function_definition 185 | | declaration 186 | | class_method_definition 187 | | instance_method_definition 188 | | property_implementation 189 | ; 190 | 191 | class_method_definition: 192 | ('+' method_definition) 193 | ; 194 | 195 | instance_method_definition: 196 | ('-' method_definition) 197 | ; 198 | 199 | method_definition: 200 | (method_type)? method_selector (init_declarator_list)? ';'? compound_statement; 201 | 202 | method_selector: 203 | selector |(keyword_declarator+ (parameter_list)? ) 204 | ; 205 | 206 | keyword_declarator: 207 | selector? ':' method_type* identifier; 208 | 209 | selector: 210 | identifier | dotidentifier | 'retain'; 211 | 212 | method_type: '(' type_name ')'; 213 | 214 | property_implementation 215 | : '@synthesize' property_synthesize_list ';' 216 | | '@dynamic' property_synthesize_list ';' 217 | ; 218 | 219 | property_synthesize_list 220 | : property_synthesize_item (',' property_synthesize_item)* 221 | ; 222 | 223 | property_synthesize_item 224 | : IDENTIFIER | IDENTIFIER '=' IDENTIFIER 225 | ; 226 | 227 | block_type:type_specifier '(''^' type_specifier? ')' block_parameters? ; 228 | 229 | type_specifier: 230 | simple_type_specifier 231 | | other_type_specifier 232 | ; 233 | 234 | other_type_specifier : 235 | ('id' ( protocol_reference_list )? ) #idTypeSpec 236 | | (class_name ( protocol_reference_list )?) #classTypeSpec 237 | | unusual_type_specifier #structTypeSpec 238 | ; 239 | unusual_type_specifier : 240 | struct_or_union_specifier 241 | ; 242 | 243 | simple_type_specifier: 244 | primitive_type_specifier 245 | | identifier 246 | | enum_specifier 247 | ; 248 | 249 | primitive_type_specifier: 250 | 'void' | 'char' | 'short' | 'int' | 'long' | 'float' | 'double' | 'signed' | 'unsigned' ; 251 | 252 | type_qualifier: 253 | 'const' #constTypeQualifier 254 | | 'volatile' #ignoreTypeQualifier 255 | | protocol_qualifier #ignoreTypeQualifier 256 | ; 257 | 258 | protocol_qualifier: 259 | 'in' | 'out' | 'inout' | 'bycopy' | 'byref' | 'oneway'; 260 | 261 | primary_expression: 262 | simple_expression 263 | | parenthetical_expression 264 | | selector_expression 265 | ; 266 | 267 | simple_expression : 268 | identifier 269 | | constant 270 | | string_constant 271 | | ('(' expression ')') 272 | | self_expression 273 | | super_expression 274 | | message_expression 275 | | setter_call 276 | | getter_call 277 | | code_block 278 | | selector_expression 279 | | protocol_expression 280 | | encode_expression 281 | | dictionary_expression 282 | | array_expression 283 | | box_expression 284 | | block_expression 285 | ; 286 | 287 | 288 | parenthetical_expression : ('(' expression ')') 289 | ; 290 | 291 | self_expression : 'self' ; 292 | 293 | super_expression : 'super' ; 294 | 295 | unsupported_instruction : 296 | encode_expression 297 | | protocol_expression 298 | ; 299 | 300 | string_constant: STRING_LITERAL | CSTRING_LITERAL; 301 | 302 | dictionary_pair: 303 | postfix_expression':'postfix_expression; 304 | 305 | dictionary_expression: 306 | '@''{' dictionary_pair? (',' dictionary_pair)* ','? '}'; 307 | 308 | array_expression: 309 | '@''[' postfix_expression? (',' postfix_expression)* ','? ']'; 310 | 311 | box_expression: 312 | '@' '(' (postfix_expression | expression) ')' | 313 | '@'constant; 314 | 315 | block_parameters: '(' (type_variable_declarator | type_name | 'void')? (',' (type_variable_declarator | type_name))* ')'; 316 | 317 | block_expression:'^' type_specifier? block_parameters? compound_statement; 318 | 319 | message_expression: 320 | '[' receiver message_selector ']' ('.' dotidentifier)? 321 | ; 322 | 323 | receiver: 324 | expression 325 | | class_name 326 | | message_expression; 327 | 328 | message_selector: 329 | selector 330 | | keyword_argument+ 331 | | identifier; 332 | 333 | keyword_argument: 334 | selector? ':' expression; 335 | 336 | selector_expression: 337 | '@selector' '(' selector_name ')'; 338 | 339 | selector_name: 340 | selector 341 | | (selector? ':')+; 342 | 343 | protocol_expression: 344 | '@protocol' '(' protocol_name ')'; 345 | 346 | encode_expression: 347 | '@encode' '(' type_name ')'; 348 | 349 | exception_declarator: 350 | declarator; 351 | 352 | type_variable_declarator: 353 | declaration_specifiers declarator; 354 | 355 | try_statement: 356 | '@try' statement; 357 | 358 | catch_statement: 359 | '@catch' '('exception_declarator')'statement; 360 | 361 | finally_statement: 362 | '@finally' statement; 363 | 364 | throw_statement: 365 | '@throw' '('IDENTIFIER')'; 366 | 367 | try_block: 368 | try_statement 369 | ( catch_statement)* 370 | ( finally_statement )?; 371 | 372 | synchronized_statement: 373 | '@synchronized' '(' IDENTIFIER ')' statement; 374 | 375 | autorelease_statement: 376 | '@autoreleasepool' compound_statement; 377 | 378 | function_definition : declaration_specifiers? declarator compound_statement ; 379 | 380 | declaration_minus_semi : declaration_specifiers init_declarator_list? ; 381 | 382 | declaration : declaration_minus_semi ';'; 383 | 384 | declaration_specifiers 385 | : (declaration_specifier)+ ; 386 | 387 | declaration_specifier : 388 | arc_behaviour_specifier | storage_class_specifier | type_specifier | type_qualifier; 389 | arc_behaviour_specifier: '__unsafe_unretained' | '__weak'; 390 | storage_class_specifier: 'auto' #ignoreStoreClass 391 | | 'register' #ignoreStoreClass 392 | | 'static' #staticStoreClass 393 | | 'extern' #ignoreStoreClass 394 | | 'typedef' #ignoreStoreClass 395 | ; 396 | 397 | init_declarator_list : init_declarator (',' init_declarator)* ; 398 | init_declarator : declarator ('=' initializer)? ; 399 | 400 | struct_or_union_specifier: ('struct' | 'union') 401 | ( IDENTIFIER | identifier? '{' struct_declaration+ '}' identifier?) ; 402 | 403 | struct_declaration : specifier_qualifier_list struct_declarator_list ';' ; 404 | 405 | specifier_qualifier_list : (specifier_qualifier)+ ; 406 | 407 | specifier_qualifier : arc_behaviour_specifier | type_specifier | type_qualifier ; 408 | 409 | struct_declarator_list : struct_declarator (',' struct_declarator)* ; 410 | 411 | struct_declarator : declarator | declarator? ':' constant; 412 | 413 | enum_specifier : 'enum' (IDENTIFIER? ':' type_name)? 414 | ( identifier ('{' enumerator_list '}')? 415 | | '{' enumerator_list '}') 416 | | 'NS_OPTIONS' '(' type_name ',' identifier ')' '{' enumerator_list '}' 417 | | 'NS_ENUM' '(' type_name ',' identifier ')' '{' enumerator_list '}' ; 418 | 419 | 420 | enumerator_list : enumerator (',' enumerator)* ','? ; 421 | 422 | enumerator : identifier ('=' constant_expression)?; 423 | 424 | declarator :'*' type_qualifier* declarator | direct_declarator ; 425 | 426 | direct_declarator : identifier declarator_suffix* 427 | | '(' declarator ')' declarator_suffix* 428 | | '(''^' identifier? ')' block_parameters; 429 | 430 | declarator_suffix : '[' constant_expression? ']' 431 | | '(' parameter_list? ')'; 432 | 433 | parameter_list : parameter_declaration_list ( ',' '...' )? ; 434 | 435 | parameter_declaration 436 | : declaration_specifiers (declarator? | abstract_declarator) ; 437 | 438 | initializer : assignment_expression 439 | | '{' initializer (',' initializer)* (',')? '}' (',')? ; 440 | 441 | type_name : specifier_qualifier_list abstract_declarator 442 | | block_type; 443 | 444 | abstract_declarator : '*' type_qualifier* abstract_declarator #adecType 445 | | '(' abstract_declarator ')' abstract_declarator_suffix+ #adecRecurse 446 | | ('[' constant_expression? ']')+ #adecConst 447 | | #adecNone 448 | ; 449 | 450 | abstract_declarator_suffix 451 | : '[' constant_expression? ']' 452 | | '(' parameter_declaration_list? ')' ; 453 | 454 | parameter_declaration_list 455 | : parameter_declaration ( ',' parameter_declaration )* ; 456 | 457 | statement_list : statement+ ; 458 | 459 | statement 460 | : labeled_statement 461 | | semi_statement 462 | | compound_statement 463 | | selection_statement 464 | | jump_statement 465 | | while_statement 466 | | for_statement 467 | | do_while_statement 468 | | synchronized_statement 469 | | autorelease_statement 470 | | try_block 471 | ; 472 | 473 | semi_statement 474 | : expression ';' 475 | | ';' 476 | ; 477 | 478 | labeled_statement 479 | : identifier ':' statement #labelid 480 | | 'case' constant_expression ':' statement #case 481 | | 'default' ':' statement #default ; 482 | 483 | compound_statement : ('@autoreleasepool')?'{' (compound_statement_parts)* '}' ; 484 | compound_statement_parts : declaration|statement_list ; 485 | 486 | selection_statement 487 | : 'if' '(' expression ')' statement ('else' statement)? #ifstmt 488 | | 'switch' '(' expression ')' statement #switch 489 | ; 490 | 491 | while_statement : 492 | 'while' '(' expression ')' statement ; 493 | 494 | for_statement : 495 | 'for' '(' for_complete statement ; 496 | 497 | do_while_statement : 498 | 'do' statement 'while' '(' expression ')' ';' ; 499 | 500 | for_complete : 501 | expression ';' expression? ';' expression? ')' 502 | | ';' expression? ';' expression? ')' 503 | | declaration_minus_semi for_declaration_complete 504 | ; 505 | 506 | for_declaration_complete: 507 | ';' expression? ';' expression? ')' # forcomplete1 508 | | 'in' expression ')' # forcomplete2 509 | ; 510 | 511 | jump_statement 512 | : 'goto' identifier ';' 513 | | 'continue' ';' 514 | | 'break' ';' 515 | | 'return' expression? ';' 516 | ; 517 | 518 | setter_call : 519 | dotidentifier '=' expression 520 | ; 521 | 522 | getter_call : 523 | dotidentifier 524 | ; 525 | 526 | dotidentifier : DOTIDENTIFIER; 527 | 528 | expression : assignment_expression (',' assignment_expression)* ; 529 | 530 | assignment_expression 531 | : conditional_expression 532 | | unary_expression assignment_operator assignment_expression 533 | ; 534 | 535 | assignment_operator: 536 | '=' | '*=' | '/=' | '%=' | '+=' | '-=' | '<<=' | '>>=' | '&=' | '^=' | '|='; 537 | 538 | conditional_expression : logical_or_expression 539 | ('?' logical_or_expression* ':' logical_or_expression)? ; 540 | 541 | 542 | constant_expression : conditional_expression ; 543 | 544 | logical_or_expression : logical_and_expression 545 | ('||' logical_and_expression)* ; 546 | 547 | logical_and_expression : inclusive_or_expression 548 | ('&&' inclusive_or_expression)* ; 549 | 550 | inclusive_or_expression : exclusive_or_expression 551 | ('|' exclusive_or_expression)* ; 552 | 553 | exclusive_or_expression : and_expression ('^' and_expression)* ; 554 | 555 | and_expression : equality_expression ('&' equality_expression)* ; 556 | 557 | equality_expression : relational_expression 558 | (equality_op relational_expression)* ; 559 | 560 | equality_op : 561 | '!=' | '==' 562 | ; 563 | 564 | relational_expression : shift_expression 565 | (relational_op shift_expression)* ; 566 | 567 | relational_op : 568 | '<' | '>' | '<=' | '>=' 569 | ; 570 | 571 | shift_expression : additive_expression (shift_op additive_expression)* ; 572 | 573 | shift_op : 574 | '<<' | '>>' 575 | ; 576 | 577 | additive_expression : multiplicative_expression 578 | (add_op multiplicative_expression)* ; 579 | 580 | add_op : 581 | '-' | '+' 582 | ; 583 | 584 | 585 | multiplicative_expression : cast_expression 586 | (multiply_op cast_expression)* ; 587 | 588 | multiply_op : 589 | '*' | '/' | '%' 590 | ; 591 | 592 | cast_expression : '(' type_name ')' cast_expression | unary_expression ; 593 | 594 | unary_expression 595 | : postfix_expression 596 | | '++' unary_expression 597 | | '--' unary_expression 598 | | unary_operator cast_expression 599 | | 'sizeof' ('(' type_name ')' | unary_expression) ; 600 | 601 | unary_operator : '&' | '*' | '-' | '~' | '!' ; 602 | 603 | postfix_expression : primary_expression 604 | ( postfix_expression_complete)* ; 605 | 606 | postfix_expression_complete : 607 | '[' expression ']' 608 | | '(' argument_expression_list? ')' 609 | | '.' identifier 610 | | '->' identifier 611 | | '++' 612 | | '--' 613 | ; 614 | 615 | comment : 616 | COMMENT | LINE_COMMENT 617 | ; 618 | 619 | argument_expression_list 620 | : assignment_expression (',' assignment_expression)* ; 621 | 622 | identifier : IDENTIFIER; 623 | 624 | code_block : '^' statement ; 625 | 626 | constant : DECIMAL_LITERAL | HEX_LITERAL | OCTAL_LITERAL | CHARACTER_LITERAL | FLOATING_POINT_LITERAL; 627 | 628 | DOTIDENTIFIER : 629 | IDENTIFIER '.' IDENTIFIER ('.' IDENTIFIER)* 630 | ; 631 | 632 | // LEXER 633 | 634 | // ��3.9 Keywords 635 | 636 | AUTORELEASEPOOL : '@autoreleasepool'; 637 | CATCH : '@catch'; 638 | CLASS : '@class'; 639 | DYNAMIC : '@dynamic'; 640 | ENCODE : '@encode'; 641 | END : '@end'; 642 | FINALLY : '@finally'; 643 | IMPLEMENTATION : '@implementation'; 644 | INTERFACE : '@interface'; 645 | PACKAGE : '@package'; 646 | PROTOCOL : '@protocol'; 647 | OPTIONAL : '@optional'; 648 | PRIVATE : '@private'; 649 | PROPERTY : '@property'; 650 | PROTECTED : '@protected'; 651 | PUBLIC : '@public'; 652 | SELECTOR : '@selector'; 653 | SYNCHRONIZED : '@synchronized'; 654 | SYNTHESIZE : '@synthesize'; 655 | THROW : '@throw'; 656 | TRY : '@try'; 657 | 658 | SUPER : 'super'; 659 | SELF : 'self'; 660 | 661 | 662 | ABSTRACT : 'abstract'; 663 | AUTO : 'auto'; 664 | BOOLEAN : 'boolean'; 665 | BREAK : 'break'; 666 | BYCOPY : 'bycopy'; 667 | BYREF : 'byref'; 668 | CASE : 'case'; 669 | CHAR : 'char'; 670 | CONST : 'const'; 671 | CONTINUE : 'continue'; 672 | DEFAULT : 'default'; 673 | DO : 'do'; 674 | DOUBLE : 'double'; 675 | ELSE : 'else'; 676 | ENUM : 'enum'; 677 | EXTERN : 'extern'; 678 | FLOAT : 'float'; 679 | FOR : 'for'; 680 | ID : 'id'; 681 | IF : 'if'; 682 | IN : 'in'; 683 | INOUT : 'inout'; 684 | GOTO : 'goto'; 685 | INT : 'int'; 686 | LONG : 'long'; 687 | ONEWAY : 'oneway'; 688 | OUT : 'out'; 689 | REGISTER : 'register'; 690 | RETURN : 'return'; 691 | SHORT : 'short'; 692 | SIGNED : 'signed'; 693 | SIZEOF : 'sizeof'; 694 | STATIC : 'static'; 695 | STRUCT : 'struct'; 696 | SWITCH : 'switch'; 697 | TYPEDEF : 'typedef'; 698 | UNION : 'union'; 699 | UNSIGNED : 'unsigned'; 700 | VOID : 'void'; 701 | VOLATILE : 'volatile'; 702 | WHILE : 'while'; 703 | 704 | NS_OPTIONS : 'NS_OPTIONS'; 705 | NS_ENUM : 'NS_ENUM'; 706 | WWEAK : '__weak'; 707 | WUNSAFE_UNRETAINED : '__unsafe_unretained'; 708 | TYPEOF : '__typeof'; 709 | 710 | 711 | LPAREN : '('; 712 | RPAREN : ')'; 713 | LBRACE : '{'; 714 | RBRACE : '}'; 715 | LBRACK : '['; 716 | RBRACK : ']'; 717 | SEMI : ';'; 718 | COMMA : ','; 719 | DOT : '.'; 720 | STRUCTACCESS : '->'; 721 | AT : '@'; 722 | 723 | // Operators 724 | 725 | ASSIGN : '='; 726 | GT : '>'; 727 | LT : '<'; 728 | BANG : '!'; 729 | TILDE : '~'; 730 | QUESTION : '?'; 731 | COLON : ':'; 732 | EQUAL : '=='; 733 | LE : '<='; 734 | GE : '>='; 735 | NOTEQUAL : '!='; 736 | AND : '&&'; 737 | OR : '||'; 738 | INC : '++'; 739 | DEC : '--'; 740 | ADD : '+'; 741 | SUB : '-'; 742 | MUL : '*'; 743 | DIV : '/'; 744 | BITAND : '&'; 745 | BITOR : '|'; 746 | CARET : '^'; 747 | MOD : '%'; 748 | SHIFT_R : '>>'; 749 | SHIFT_L : '<<'; 750 | 751 | // Assignment 752 | 753 | ADD_ASSIGN : '+='; 754 | SUB_ASSIGN : '-='; 755 | MUL_ASSIGN : '*='; 756 | DIV_ASSIGN : '/='; 757 | AND_ASSIGN : '&='; 758 | OR_ASSIGN : '|='; 759 | XOR_ASSIGN : '^='; 760 | MOD_ASSIGN : '%='; 761 | LSHIFT_ASSIGN : '<<='; 762 | RSHIFT_ASSIGN : '>>='; 763 | ELIPSIS : '...'; 764 | 765 | // Property attributes 766 | ASSIGNPA : 'assign'; 767 | GETTER : 'getter'; 768 | NONATOMIC : 'nonatomic'; 769 | SETTER : 'setter'; 770 | STRONG : 'strong'; 771 | RETAIN : 'retain'; 772 | READONLY : 'readonly'; 773 | READWRITE : 'readwrite'; 774 | WEAK : 'weak'; 775 | 776 | IDENTIFIER 777 | : LETTER (LETTER|'0'..'9')* 778 | ; 779 | 780 | fragment 781 | LETTER 782 | : '$' 783 | | 'A'..'Z' 784 | | 'a'..'z' 785 | | '_' 786 | ; 787 | 788 | CHARACTER_LITERAL 789 | : '\'' ( EscapeSequence | ~('\''|'\\') ) '\'' 790 | ; 791 | 792 | /* 793 | s_char = [[[any_char - '"'] - '\'] - nl] | escape_sequence; 794 | string_literal = ('L' | '@') '"' s_char* '"'; 795 | */ 796 | 797 | CSTRING_LITERAL 798 | : STRING 799 | ; 800 | 801 | STRING_LITERAL 802 | : [L@] STRING 803 | ; 804 | 805 | fragment 806 | STRING : '"' ( EscapeSequence | ~('\\'|'"') )* '"' ; 807 | 808 | HEX_LITERAL : '0' ('x'|'X') HexDigit+ IntegerTypeSuffix? ; 809 | 810 | DECIMAL_LITERAL : ('0' | '1'..'9' '0'..'9'*) IntegerTypeSuffix? ; 811 | 812 | OCTAL_LITERAL : '0' ('0'..'7')+ IntegerTypeSuffix? ; 813 | 814 | fragment 815 | HexDigit : ('0'..'9'|'a'..'f'|'A'..'F') ; 816 | 817 | fragment 818 | IntegerTypeSuffix 819 | : ('u'|'U'|'l'|'L' | 'UL' | 'ul') 820 | ; 821 | 822 | FLOATING_POINT_LITERAL 823 | : ('0'..'9')+ ('.' ('0'..'9')*)? Exponent? FloatTypeSuffix? 824 | ; 825 | 826 | fragment 827 | Exponent : ('e'|'E') ('+'|'-')? ('0'..'9')+ ; 828 | 829 | fragment 830 | FloatTypeSuffix : ('f'|'F'|'d'|'D') ; 831 | 832 | fragment 833 | EscapeSequence 834 | : '\\' ('b'|'t'|'n'|'f'|'r'|'\"'|'\''|'\\') 835 | | OctalEscape 836 | ; 837 | 838 | fragment 839 | OctalEscape 840 | : '\\' ('0'..'3') ('0'..'7') ('0'..'7') 841 | | '\\' ('0'..'7') ('0'..'7') 842 | | '\\' ('0'..'7') 843 | ; 844 | 845 | fragment 846 | UnicodeEscape 847 | : '\\' 'u' HexDigit HexDigit HexDigit HexDigit 848 | ; 849 | 850 | IMPORT : '#import' [ \t]* (STRING|ANGLE_STRING) WS -> channel(HIDDEN) ; 851 | INCLUDE: '#include'[ \t]* (STRING|ANGLE_STRING) WS -> channel(HIDDEN) ; 852 | PRAGMA : '#pragma' ~[\r\n]* -> channel(HIDDEN) ; 853 | 854 | fragment 855 | ANGLE_STRING 856 | : '<' .*? '>' 857 | ; 858 | 859 | WS : [ \r\n\t\u000C] -> channel(HIDDEN) ; 860 | 861 | COMMENT 862 | : '/*' .*? '*/' -> channel(COMMENT_CHANNEL) 863 | ; 864 | 865 | LINE_COMMENT 866 | : '//' ~[\r\n]* -> channel(COMMENT_CHANNEL) 867 | ; 868 | 869 | // ignore preprocessor defines for now 870 | 871 | //HDEFINE : '#define' ~[\r\n]* -> channel(HIDDEN); 872 | //HIF : '#if' ~[\r\n]* -> channel(HIDDEN); 873 | //HELSE : '#else' ~[\r\n]* -> channel(HIDDEN); 874 | //HUNDEF : '#undef' ~[\r\n]* -> channel(HIDDEN); 875 | //HIFNDEF : '#ifndef' ~[\r\n]* -> channel(HIDDEN); 876 | //HENDIF : '#endif' ~[\r\n]* -> channel(HIDDEN); 877 | -------------------------------------------------------------------------------- /Java/classes/artifacts/Objc2Lua_jar/Objc2Lua.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consoar/Objc2Lua/b56fcf3d995aaa5db18898c23271996c71a46170/Java/classes/artifacts/Objc2Lua_jar/Objc2Lua.jar -------------------------------------------------------------------------------- /Java/lib/antlr-4.5.1-complete.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Consoar/Objc2Lua/b56fcf3d995aaa5db18898c23271996c71a46170/Java/lib/antlr-4.5.1-complete.jar -------------------------------------------------------------------------------- /Java/src/META-INF/MANIFEST.MF: -------------------------------------------------------------------------------- 1 | Manifest-Version: 1.0 2 | Main-Class: bos.consoar.objc2lua.MainActivity 3 | 4 | -------------------------------------------------------------------------------- /Java/src/bos/consoar/objc2lua/ClassDescription.java: -------------------------------------------------------------------------------- 1 | package bos.consoar.objc2lua; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | /** 8 | * @author Dad 9 | * Maintains a list of the declarations obtained while parsing 10 | */ 11 | public class ClassDescription { 12 | private Map headers; 13 | private Map mFiles; 14 | private String tempClassName; 15 | 16 | /** 17 | * @return headers 18 | */ 19 | public Map getHeaders() { 20 | return headers; 21 | } 22 | 23 | /** 24 | * @param headers 25 | */ 26 | public void setHeaders(Map headers) { 27 | this.headers = headers; 28 | } 29 | 30 | /** 31 | * @return descriptions for dot-M files 32 | */ 33 | public Map getmFiles() { 34 | return mFiles; 35 | } 36 | 37 | /** 38 | * @param mFiles 39 | */ 40 | public void setmFiles(Map mFiles) { 41 | this.mFiles = mFiles; 42 | } 43 | 44 | /** 45 | * @return temp class name based on file name 46 | */ 47 | public String getTempClassName() { 48 | return tempClassName; 49 | } 50 | 51 | /** 52 | * @param classFileName 53 | */ 54 | public void setTempClassName(String classFileName) { 55 | this.tempClassName = classFileName; 56 | } 57 | 58 | ClassDescription(Map headerFile) { 59 | this.headers = headerFile; 60 | this.mFiles = new HashMap(); 61 | } 62 | 63 | ClassDescription() { 64 | this.headers = new HashMap(); 65 | this.mFiles = new HashMap(); 66 | } 67 | 68 | /** 69 | * @author Dad 70 | * Maintains a list of the methods variables 71 | * properties find while parsing and converting to Java 72 | */ 73 | public static class ClassDeclaration { 74 | 75 | /** 76 | * @return superClassName 77 | */ 78 | public String getSuperClassName() { 79 | return superClassName; 80 | } 81 | 82 | /** 83 | * @param superClassName 84 | */ 85 | public void setSuperClassName(String superClassName) { 86 | this.superClassName = superClassName; 87 | } 88 | 89 | /** 90 | * @return protocol collection 91 | */ 92 | public ArrayList getProtocols() { 93 | return protocols; 94 | } 95 | 96 | /** 97 | * 98 | */ 99 | public void clearProtocols() { 100 | protocols.clear(); 101 | } 102 | 103 | /** 104 | * @param protocol add protocol to collection 105 | */ 106 | public void addProtocol(String protocol) { 107 | protocols.add(protocol); 108 | } 109 | 110 | /** 111 | * @return variables 112 | */ 113 | public ArrayList getVariables() { 114 | return variables; 115 | } 116 | 117 | /** 118 | * clear variables 119 | */ 120 | public void clearVariables() { 121 | variables.clear(); 122 | } 123 | 124 | /** 125 | * @param variable 126 | */ 127 | public void addVariable(String variable) { 128 | variables.add(variable); 129 | } 130 | 131 | /** 132 | * @param variables 133 | */ 134 | public void addVariables(ArrayList variables) { 135 | for (String variable : variables) { 136 | this.addVariable(variable); 137 | } 138 | } 139 | 140 | /** 141 | * @return property collection 142 | */ 143 | public ArrayList getProperties() { 144 | return properties; 145 | } 146 | 147 | /** 148 | * 149 | */ 150 | public void clearProperties() { 151 | properties.clear(); 152 | } 153 | 154 | /** 155 | * @param property 156 | */ 157 | public void addProperty(String property) { 158 | properties.add(property); 159 | } 160 | 161 | /** 162 | * @param declarations 163 | */ 164 | public void addProperties(ArrayList declarations) { 165 | for (String decl : declarations) { 166 | this.addProperty(decl); 167 | } 168 | } 169 | 170 | /** 171 | * @return synthesized collection 172 | */ 173 | public ArrayList getSynthesized() { 174 | return synthesized; 175 | } 176 | 177 | /** 178 | * 179 | */ 180 | public void clearSynthesized() { 181 | synthesized.clear(); 182 | } 183 | 184 | /** 185 | * @param synthesize 186 | */ 187 | public void addSynthesized(String synthesize) { 188 | synthesized.add(synthesize); 189 | } 190 | 191 | /** 192 | * @param definitions 193 | */ 194 | public void addSynthesized(ArrayList definitions) { 195 | for (String def : definitions) { 196 | this.addSynthesized(def); 197 | } 198 | } 199 | 200 | /** 201 | * @return dynamic synthesizer collection 202 | */ 203 | public ArrayList getDynamic() { 204 | return dynamic; 205 | } 206 | 207 | /** 208 | * 209 | */ 210 | public void clearDynamic() { 211 | dynamic.clear(); 212 | } 213 | 214 | /** 215 | * @param dyn 216 | */ 217 | public void addDynamic(String dyn) { 218 | dynamic.add(dyn); 219 | } 220 | 221 | /** 222 | * @param dynamic 223 | */ 224 | public void addDynamic(ArrayList dynamic) { 225 | for (String def : dynamic) { 226 | this.addDynamic(def); 227 | } 228 | } 229 | 230 | /** 231 | * @return enums collection 232 | */ 233 | public ArrayList getEnums() { 234 | return enums; 235 | } 236 | 237 | /** 238 | * 239 | */ 240 | public void clearEnums() { 241 | enums.clear(); 242 | } 243 | 244 | /** 245 | * @param en 246 | */ 247 | public void addEnum(String en) { 248 | enums.add(en); 249 | } 250 | 251 | /** 252 | * @return method definition collection 253 | */ 254 | public ArrayList getMethod_definitions() { 255 | return method_definitions; 256 | } 257 | 258 | /** 259 | * @param method_definition 260 | */ 261 | public void addMethod_definition(String method_definition) { 262 | this.method_definitions.add(method_definition); 263 | } 264 | 265 | /** 266 | * @param definitions 267 | */ 268 | public void addMethod_definitions(ArrayList definitions) { 269 | for (String def : definitions) { 270 | this.addMethod_definition(def); 271 | } 272 | } 273 | 274 | /** 275 | * 276 | */ 277 | public void clearMethod_definition() { 278 | this.method_definitions.clear(); 279 | } 280 | 281 | /** 282 | * @return constructor definition collection 283 | */ 284 | public ArrayList getConstructor_definitions() { 285 | return constructor_definitions; 286 | } 287 | 288 | /** 289 | * @param constructor_definition 290 | */ 291 | public void addConstructor_definition(String constructor_definition) { 292 | this.constructor_definitions.add(constructor_definition); 293 | } 294 | 295 | /** 296 | * @param definitions 297 | */ 298 | public void addConstructor_definitions(ArrayList definitions) { 299 | for (String def : definitions) { 300 | this.addConstructor_definition(def); 301 | } 302 | } 303 | 304 | /** 305 | * 306 | */ 307 | public void clearConstructor_definition() { 308 | this.constructor_definitions.clear(); 309 | } 310 | 311 | /** 312 | * @return function definition collection 313 | */ 314 | public ArrayList getFunction_definitions() { 315 | return function_definitions; 316 | } 317 | 318 | /** 319 | * @param function_definition 320 | */ 321 | public void addFunction_definition(String function_definition) { 322 | this.function_definitions.add(function_definition); 323 | } 324 | 325 | /** 326 | * @param definitions 327 | */ 328 | public void addFunction_definitions(ArrayList definitions) { 329 | for (String def : definitions) { 330 | this.addFunction_definition(def); 331 | } 332 | } 333 | 334 | /** 335 | * 336 | */ 337 | public void clearFunction_definition() { 338 | this.function_definitions.clear(); 339 | } 340 | 341 | /** 342 | * @return method declaration collection 343 | */ 344 | public ArrayList getMethod_declarations() { 345 | return method_declarations; 346 | } 347 | 348 | /** 349 | * @param declaration 350 | */ 351 | public void addMethod_declarations(ArrayList declaration) { 352 | for (String decl : declaration) { 353 | this.addMethod_declaration(decl); 354 | } 355 | } 356 | 357 | /** 358 | * @param method_declaration 359 | */ 360 | public void addMethod_declaration(String method_declaration) { 361 | this.method_declarations.add(method_declaration); 362 | } 363 | 364 | /** 365 | * 366 | */ 367 | public void clearMethod_declaration() { 368 | this.method_declarations.clear(); 369 | } 370 | 371 | /** 372 | * @return function collection 373 | */ 374 | public ArrayList getFunction_declarations() { 375 | return function_declarations; 376 | } 377 | 378 | /** 379 | * @param function_declaration 380 | */ 381 | public void addFunction_declaration(String function_declaration) { 382 | this.function_declarations.add(function_declaration); 383 | } 384 | 385 | /** 386 | * 387 | */ 388 | public void clearFunction_declaration() { 389 | this.function_declarations.clear(); 390 | } 391 | 392 | /** 393 | * @return the tag 394 | */ 395 | public String getTag() { 396 | return tag; 397 | } 398 | 399 | /** 400 | * @param tag the tag to set 401 | */ 402 | public void setTag(String tag) { 403 | this.tag = tag; 404 | } 405 | 406 | private ArrayList protocols; 407 | private ArrayList variables; 408 | private ArrayList properties; 409 | private ArrayList method_definitions; 410 | private ArrayList constructor_definitions; 411 | private ArrayList function_definitions; 412 | private ArrayList method_declarations; 413 | private ArrayList function_declarations; 414 | // used to declare and make setters getters 415 | private ArrayList synthesized; 416 | private ArrayList dynamic; 417 | private ArrayList enums; 418 | private String superClassName; 419 | private String tag; 420 | 421 | ClassDeclaration() { 422 | protocols = new ArrayList(); 423 | variables = new ArrayList(); 424 | properties = new ArrayList(); 425 | synthesized = new ArrayList(); 426 | dynamic = new ArrayList(); 427 | enums = new ArrayList(); 428 | method_definitions = new ArrayList(); 429 | constructor_definitions = new ArrayList(); 430 | function_definitions = new ArrayList(); 431 | method_declarations = new ArrayList(); 432 | function_declarations = new ArrayList(); 433 | setTag(""); 434 | setSuperClassName(""); 435 | } 436 | 437 | /** 438 | * @param map 439 | * @param className 440 | * @return a declaration holder for the className 441 | */ 442 | public static ClassDeclaration getClassDeclaration( 443 | Map map, String className) { 444 | ClassDeclaration cd = map.get(className); 445 | if (cd == null) { 446 | cd = new ClassDeclaration(); 447 | cd.setTag(className); 448 | map.put(className, cd); 449 | } 450 | return cd; 451 | } 452 | } 453 | } 454 | -------------------------------------------------------------------------------- /Java/src/bos/consoar/objc2lua/CodeFormatter.java: -------------------------------------------------------------------------------- 1 | package bos.consoar.objc2lua; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | import java.util.regex.Matcher; 7 | import java.util.regex.Pattern; 8 | 9 | /** 10 | * @author Isaac Clark Reformats code as needed after parsing 11 | */ 12 | public class CodeFormatter { 13 | /** 14 | * Marker for identifying method needing reversed pair of arguments. 15 | */ 16 | public static final String REVERSE_ARGS_MARKER = "ReverseArgs"; 17 | private static final String SETTER = "\n%s %s get%s() {\nreturn this.%s; \n}\n"; 18 | private static final String GETTER = "\n%s void set%s(%s %s) {\nthis.%s = %s;\n}\n"; 19 | private ArrayList constructorSignalsList; 20 | 21 | @SuppressWarnings("serial") 22 | static final Map SIMPLESTRINGS = new HashMap() { 23 | { 24 | put("NSError", "NSError"); 25 | put("NSInteger", ""); 26 | put("NSUInteger", ""); 27 | put("YES", "true"); 28 | put("TRUE", "true"); 29 | put("NO", "false"); 30 | put("FALSE", "false"); 31 | put("NSObject", ""); 32 | put("self", "self"); 33 | put("nil", "nil"); 34 | put("NULL", "nil"); 35 | put("bool", ""); 36 | put("IBAction", ""); 37 | put("IBOutlet", ""); 38 | } 39 | }; 40 | 41 | @SuppressWarnings("serial") 42 | static final Map SIMPLEFUNCTIONS = new HashMap() { 43 | { 44 | put(".autorelease()", ""); 45 | put(".retain()", ""); 46 | put("NSNull.null()", "NSNull:null()"); 47 | 48 | } 49 | }; 50 | 51 | CodeFormatter() { 52 | constructorSignalsList = new ArrayList(); 53 | constructorSignalsList.add("init"); 54 | } 55 | 56 | /** 57 | * @param id 58 | * @param options 59 | * @return id after reformatting to Java conventions 60 | */ 61 | 62 | public String identifierFormatter(String id, ParseOptions options) { 63 | if (options.useExternalTranslations()) { 64 | id = makeSimpleIDSubtitutions( 65 | Translations.getTranslation(Translations.GLOBALMAPKEY, 66 | Translations.TranslationType.ID), id); 67 | id = makeSimpleIDSubtitutions( 68 | Translations.getTranslation(options.getInputFileName(), 69 | Translations.TranslationType.ID), id); 70 | } else { 71 | id = makeSimpleIDSubtitutions(SIMPLESTRINGS, id); 72 | } 73 | id = makeSimpleIDSubtitutions(options.getIdentityPairs(), id); 74 | return id; 75 | } 76 | 77 | /** 78 | * @param map mapping of identifier to target 79 | * @param ID to be substituted for 80 | * @return re-mapped identifier 81 | */ 82 | 83 | public static String makeSimpleIDSubtitutions(Map map, 84 | String ID) { 85 | String match = null; 86 | if (map != null) { 87 | match = map.get(ID); 88 | if (match != null) { 89 | ID = match; 90 | } 91 | } 92 | return ID; 93 | 94 | } 95 | 96 | /** 97 | * @param map keys = signatures; values = replacements 98 | * @param code function call 99 | * @return rewritten as needed 100 | */ 101 | public static String makeSimpleMethodSubtitutions(Map map, 102 | String code) { 103 | 104 | if (map == null) { 105 | return code; 106 | } 107 | 108 | for (String signature : map.keySet()) { 109 | if (code.contains(signature)) { 110 | String replaceCode = map.get(signature); 111 | if (replaceCode.startsWith("+")) { 112 | replaceCode = replaceCode.substring(1); 113 | if (replaceCode.length() == 0) { 114 | code = ""; 115 | } else { 116 | int index = code.indexOf(signature) 117 | + signature.length(); 118 | ArrayList args = getFunctionArguments(code 119 | .substring(index - 1)); 120 | String nCode = ""; 121 | for (int i = 0; i < args.size(); i++) { 122 | String arg = args.get(i); 123 | if (arg.length() == 0) { 124 | continue; 125 | } 126 | if (nCode.length() == 0) { 127 | nCode = replaceCode + arg; 128 | } else { 129 | nCode += ", " + arg; 130 | } 131 | } 132 | if (nCode.length() == 0) { 133 | nCode = replaceCode 134 | + code.substring(0, code.indexOf(signature)); 135 | } else { 136 | nCode += ", " 137 | + code.substring(0, code.indexOf(signature)); 138 | } 139 | code = nCode + ")"; 140 | } 141 | } else { 142 | code = code.replace(signature, replaceCode); 143 | } 144 | break; 145 | } 146 | } 147 | return code; 148 | } 149 | 150 | /** 151 | * @param cd class description holder, 152 | * @param cDec class description for getters 153 | * @param className 154 | * @return getters and setters for properties 155 | */ 156 | public ArrayList generateGetters(ClassDescription cd, 157 | ClassDescription.ClassDeclaration cDec, String className) { 158 | ArrayList code = new ArrayList(); 159 | 160 | ArrayList synths = cDec.getSynthesized(); 161 | for (String syn : synths) { 162 | String type = getPropertyType(syn, className, cd, cDec); 163 | if (type.length() > 0) { 164 | String[] parts = type.split(":"); 165 | String getSet = makeSetGet(syn, parts[0], parts[1]); 166 | code.add(getSet); 167 | } 168 | // code.add(fixDeclarations(c)); 169 | } 170 | 171 | return code; 172 | } 173 | 174 | private String makeSetGet(String vName, String type, String visibility) { 175 | String code = ""; 176 | if (visibility == null) { 177 | // this should never happen 178 | visibility = ""; 179 | } 180 | String vCap = vName.substring(0, 1).toUpperCase() + vName.substring(1); 181 | code = String.format(SETTER, visibility, type, vCap, vName); 182 | code += String.format(GETTER, visibility, vCap, type, vName, vName, vName); 183 | return code; 184 | } 185 | 186 | private String getPropertyType(String vName, String className, 187 | ClassDescription cd, ClassDescription.ClassDeclaration cDecl) { 188 | String type = ""; 189 | ClassDescription.ClassDeclaration cDec = null; 190 | String prefix = ""; 191 | for (int i = 0; i < 4; i++) { 192 | switch (i) { 193 | case 0: 194 | cDec = ParserObjcListener.chooseMapAndDeclaration(cd, 195 | className, false); 196 | prefix = "private"; 197 | break; 198 | case 1: 199 | cDec = ParserObjcListener.chooseMapAndDeclaration(cd, 200 | className, true); 201 | prefix = "public"; 202 | break; 203 | case 2: 204 | cDec = ParserObjcListener 205 | .chooseMapAndDeclaration(cd, "", false); 206 | prefix = "private"; 207 | break; 208 | case 3: 209 | cDec = ParserObjcListener.chooseMapAndDeclaration(cd, "", true); 210 | prefix = "public"; 211 | break; 212 | } 213 | if (cDec != null) { 214 | ArrayList properties = cDec.getProperties(); 215 | for (String property : properties) { 216 | String[] parts = property.split("[ ]+"); 217 | if (parts[parts.length - 1].equals(vName)) { 218 | type = parts[0]; 219 | for (int j = 1; j < parts.length - 1; j++) { 220 | type += " " + parts[j]; 221 | } 222 | if (type.length() > 0) { 223 | // append visibility to prefix 224 | type = type + ":" + prefix; 225 | } 226 | return type; 227 | } 228 | } 229 | } 230 | } 231 | return type; 232 | } 233 | 234 | /** 235 | * @param statement 236 | * @param options 237 | * @return statements after applying regular expression translations 238 | */ 239 | public String applyRegexToStatement(String statement, ParseOptions options) { 240 | String fName = options.getInputFileName(); 241 | statement = applyRegex(Translations.getTranslation( 242 | Translations.GLOBALMAPKEY, Translations.TranslationType.REGEX), 243 | statement); 244 | statement = applyRegex(Translations.getTranslation(fName, 245 | Translations.TranslationType.REGEX), statement); 246 | return statement; 247 | } 248 | 249 | private String applyRegex(Map transMap, String statement) { 250 | String code = String.format("%s", statement); 251 | if (transMap != null) { 252 | for (String regex : transMap.keySet()) { 253 | Pattern pattern = Pattern.compile(regex); 254 | Matcher matcher = pattern.matcher(code); 255 | if (matcher.matches()) { 256 | code = replaceCodeWithPattern(matcher, code, 257 | transMap.get(regex)); 258 | break; 259 | } 260 | } 261 | } 262 | return code; 263 | } 264 | 265 | private String replaceCodeWithPattern(Matcher matcher, String statement, 266 | String pattern) { 267 | String code = pattern; 268 | return code; 269 | } 270 | 271 | /** 272 | * Note that for constructor methods starting with init a flag is set to 273 | * true allowing some additional treatment if smartConstructor is turned on 274 | * 275 | * @param code the construction declaration 276 | * @param className 277 | * @param options parsing options 278 | * @return converts method definition into a constructor definition FIXME 279 | * does not use signatures yet 280 | */ 281 | public String generateConstructor(String code, String className, 282 | ParseOptions options) { 283 | String proto = String.format("%s", code); 284 | options.setConstructorMethod(false); 285 | String[] parts = proto.split(" "); 286 | for (String signature : options.getConstructorSignatures()) { 287 | if (parts[1].startsWith(signature)) { 288 | String cName = parts[0]; 289 | if (cName.equals("Object")) { 290 | cName = className; 291 | } 292 | if (parts[1].equals("init")) { 293 | proto = cName + "()"; 294 | options.setConstructorMethod(true); 295 | } else { 296 | int index = signature.length(); 297 | if (signature.startsWith("init")) { 298 | options.setConstructorMethod(true); 299 | } 300 | if (!proto.contains("(")) { 301 | proto = cName + "()"; 302 | } else { 303 | while (proto.charAt(index) != '(') 304 | index++; 305 | proto = cName + proto.substring(index); 306 | } 307 | } 308 | break; 309 | } 310 | } 311 | return proto; 312 | } 313 | 314 | private String reformatConstructorCall(String call, ParseOptions options) { 315 | String proto = String.format("%s", call); 316 | ArrayList signatures = new ArrayList(); 317 | signatures.addAll(options.getConstructorSignatures()); 318 | if (signatures.contains("init")) { 319 | signatures.add(0, "alloc().init"); 320 | } 321 | for (String signature : signatures) { 322 | if (proto.contains(signature)) { 323 | // We must be more sophisticated about init 324 | if (signature.equals("init")) { 325 | int indx = proto.indexOf("init") + 4; 326 | if (indx < proto.length()) { 327 | char c = proto.charAt(indx); 328 | if (c != '(' && Character.isLowerCase(c)) { 329 | // !!not a constructor 330 | continue; 331 | } 332 | } 333 | } 334 | int start = proto.indexOf(signature) - 1; 335 | int end = start + signature.length() - 1; 336 | while (proto.charAt(end) != '(') 337 | end++; 338 | if (call.startsWith("super")) { 339 | proto = proto.substring(0, start) 340 | + proto.substring(end, call.length()); 341 | } else { 342 | proto = "new " + proto.substring(0, start) 343 | + proto.substring(end, call.length()); 344 | } 345 | break; 346 | } 347 | } 348 | return proto; 349 | } 350 | 351 | /** 352 | * @param call the method call to convert 353 | * @param options for converting 354 | * @return reformatted method call 355 | */ 356 | public String reformatMethodCall(String call, ParseOptions options) { 357 | // String proto = String.format("%s", call); 358 | String proto = reformatConstructorCall(call, options); 359 | if (!options.useExternalTranslations()) { 360 | proto = makeSimpleMethodSubtitutions(SIMPLEFUNCTIONS, proto); 361 | } else { 362 | proto = makeSimpleMethodSubtitutions(Translations.getTranslation( 363 | Translations.GLOBALMAPKEY, 364 | Translations.TranslationType.FUNCTION), proto); 365 | proto = makeSimpleMethodSubtitutions(Translations.getTranslation( 366 | options.getInputFileName(), 367 | Translations.TranslationType.FUNCTION), proto); 368 | } 369 | proto = fixReverseArgs(proto); 370 | 371 | if (proto.contains("isKindOf(")) { 372 | proto = isKindOf(proto); 373 | } 374 | return proto; 375 | } 376 | 377 | private String isKindOf(String proto) { 378 | return proto; 379 | } 380 | 381 | String fixReverseArgs(String fCall) { 382 | String call = String.format("%s", fCall); 383 | int start = call.indexOf(REVERSE_ARGS_MARKER); 384 | if (start != -1) { 385 | int startArgs = start + REVERSE_ARGS_MARKER.length(); 386 | ArrayList args = getFunctionArguments(fCall 387 | .substring(startArgs)); 388 | call = call.substring(0, startArgs + 1) + args.get(1) + ", " 389 | + args.get(0) + ")"; 390 | call = call.replace(REVERSE_ARGS_MARKER, ""); 391 | } 392 | return call; 393 | } 394 | 395 | String tabsForLevel(int level) { 396 | String tabs = ""; 397 | for (int i = 0; i < level; i++) { 398 | tabs += "\t"; 399 | } 400 | return tabs; 401 | } 402 | 403 | String codeIndenter(String code) { 404 | int level = 0; 405 | boolean insideQuote = false; 406 | boolean insideSingleQuote = false; 407 | boolean escape = false; 408 | boolean addTabs = false; 409 | StringBuffer rewrite = new StringBuffer(""); 410 | for (int i = 0; i < code.length(); i++) { 411 | char c = code.charAt(i); 412 | addTabs = false; 413 | 414 | if (insideQuote || insideSingleQuote) { 415 | if (!escape && c == '\\') { 416 | escape = true; 417 | } else if (escape) { 418 | escape = false; 419 | } 420 | if (insideSingleQuote) { 421 | if (c == '\'' && !escape) { 422 | insideSingleQuote = false; 423 | } 424 | } 425 | if (insideQuote) { 426 | if (c == '\"' && !escape) { 427 | insideQuote = false; 428 | } 429 | } 430 | } 431 | if (!insideQuote && !insideSingleQuote) { 432 | if (c == '\n') { 433 | addTabs = true; 434 | } else if (c == '}') { 435 | // appendAgain = true; 436 | level--; 437 | } else if (c == '{') { 438 | level++; 439 | } 440 | } 441 | if (addTabs) { 442 | rewrite.append(c + tabsForLevel(level)); 443 | addTabs = false; 444 | } else if (c == '}') { 445 | // remove 1 tab 446 | if (rewrite.charAt(rewrite.length() - 1) == '\t') { 447 | rewrite.setCharAt(rewrite.length() - 1, c); 448 | } else { 449 | rewrite.append(c); 450 | } 451 | } else { 452 | rewrite.append(c); 453 | } 454 | } 455 | // try removing some semicolon only lines 456 | String finalCode = rewrite.toString().replaceAll("\n[\t]+;\n", "\n"); 457 | // replace tab to 4 space 458 | finalCode = finalCode.replaceAll("\t", " "); 459 | return finalCode; 460 | } 461 | 462 | /** 463 | * @param call 464 | * @return array of args from function call 465 | */ 466 | public static ArrayList getFunctionArguments(String call) { 467 | return getEnclosedArguments(call, '('); 468 | } 469 | 470 | private static ArrayList getEnclosedArguments(String call, 471 | char openBrace) { 472 | char closeBrace = ')'; 473 | if (openBrace == '{') 474 | closeBrace = '}'; 475 | ArrayList args = new ArrayList(); 476 | boolean insideQuote = false; 477 | boolean insideSingleQuote = false; 478 | int parenCount = 0; 479 | // move to starting paren 480 | int start = 0; 481 | String arg; 482 | while (call.charAt(start) != openBrace) 483 | start++; 484 | int end = start + 1; 485 | 486 | while (true) { 487 | char cPrior; // the previous character 488 | char c = call.charAt(end); 489 | cPrior = (end == 0) ? ' ' : call.charAt(end - 1); 490 | if (!insideQuote && !insideSingleQuote) { 491 | if (c == ',') { 492 | if (parenCount == 0) { 493 | arg = call.substring(start + 1, end); 494 | args.add(arg.trim()); 495 | start = end; 496 | } 497 | } else if (c == openBrace) { 498 | parenCount++; 499 | } else if (c == '\'' && cPrior != '\\') { 500 | insideSingleQuote = !insideSingleQuote; 501 | } else if (c == '\"' && cPrior != '\\') { 502 | insideQuote = !insideQuote; 503 | } else if (c == closeBrace) { 504 | parenCount--; 505 | if (parenCount < 0) { 506 | arg = call.substring(start + 1, end); 507 | args.add(arg.trim()); 508 | break; 509 | } 510 | } 511 | end++; 512 | } else if (insideQuote) { 513 | if (c == '\"' && cPrior != '\\') { 514 | insideQuote = !insideQuote; 515 | } 516 | end++; 517 | } else if (insideSingleQuote) { 518 | if (c == '\'' && cPrior != '\\') { 519 | insideSingleQuote = !insideSingleQuote; 520 | } 521 | end++; 522 | } else { 523 | end++; 524 | } 525 | } 526 | return args; 527 | } 528 | 529 | /** 530 | * methDef must be pre-screen to be from an init-based constructor. Removes 531 | * return values, and if(self) stuff that came from IOS 532 | * 533 | * @param methDef code to convert 534 | * @return code with IOS specific stuff removed 535 | */ 536 | public String applyConstructorFixes(String methDef) { 537 | String code = String.format("%s", methDef); 538 | code = code.replace("this = super(", "super("); 539 | code = code.replace("return this;", ""); 540 | code = code.replace("this = new this(", "this("); 541 | if (code.contains("if(this != null){")) { 542 | String anIf = "if(this != null){"; 543 | int index = code.indexOf(anIf) + anIf.length() - 1; 544 | ArrayList contents = getEnclosedArguments( 545 | code.substring(index), '{'); 546 | if (contents.size() == 1) { 547 | int start = index + contents.get(0).length(); 548 | while (code.charAt(start) != '}') { 549 | start++; 550 | } 551 | code = code.substring(0, code.indexOf(anIf)) 552 | + contents.get(0).trim() + code.substring(start + 1); 553 | code = code.replaceAll("\n[\n]+", "\n"); 554 | } 555 | } 556 | return code; 557 | } 558 | 559 | /** 560 | * @param conditional left side of assignment 561 | * @param opCode operation 562 | * @param assignExpression rightSide of assignment 563 | * @return assigment statement 564 | */ 565 | public String assignment_expression(String conditional, String opCode, 566 | String assignExpression) { 567 | String statement = conditional; 568 | boolean useEquals = false; 569 | if (opCode != null) { 570 | // make sure left side does not contain multiplication 571 | String[] parts = statement.split("\\*"); 572 | // found multiplication left of equal sign? 573 | if (parts.length == 2 && opCode.endsWith("=")) { 574 | // get rid of "*" as it is likely pointer representation 575 | // statement = parts[0].trim() + " " + parts[1].trim() + " = " 576 | // + assignExpression; 577 | //LUA不需要数据类型 578 | statement = parts[1].trim() + " = " 579 | + assignExpression; 580 | } 581 | // check for a getter is present where a setter is required 582 | else if (opCode.equals("=") && statement.endsWith("()")) { 583 | useEquals = true; 584 | // double check for a getter 585 | String[] dotParts = statement.split("\\."); 586 | // double check for a getter 587 | if (dotParts.length > 1 588 | && dotParts[dotParts.length - 1].startsWith("get")) { 589 | // convert to setter!! 590 | useEquals = false; 591 | for (int i = 0; i < dotParts.length - 1; i++) { 592 | if (i == 0) { 593 | statement = dotParts[0].trim(); 594 | } else { 595 | statement += "." + dotParts[i].trim(); 596 | } 597 | } 598 | String ending = dotParts[dotParts.length - 1]; 599 | // change statement to setter 600 | statement += ".s" 601 | + ending.substring(1, ending.length() - 2) + "(" 602 | + assignExpression + ")"; 603 | } else { // not a getter use normal code probably wrong!! 604 | useEquals = true; 605 | statement += " " + opCode + " " + assignExpression; 606 | } 607 | } else { // normal assignment 608 | if (opCode.equals("=")) { 609 | useEquals = true; 610 | } 611 | statement += " " + opCode + " " + assignExpression; 612 | } 613 | } 614 | if (useEquals) { 615 | statement = reformatAssignmentStatements(statement); 616 | } 617 | return statement; 618 | } 619 | 620 | /** 621 | * @param statement an assignment statement 622 | * @return reformatted assignment statement 623 | */ 624 | public String reformatAssignmentStatements(String statement) { 625 | if (statement.contains("SharedPreferences")) { 626 | String[] parts = statement.split("=", 2); 627 | String[] sub1 = parts[0].trim().split(" "); 628 | String var = sub1[sub1.length - 1]; 629 | statement += ";\nEditor edit = " + var + ".edit()"; 630 | } 631 | 632 | // TODO Auto-generated method stub 633 | return statement; 634 | } 635 | 636 | @SuppressWarnings("javadoc") 637 | public String preProcessorInstructions(String directive, String expression) { 638 | return ""; 639 | } 640 | 641 | /** 642 | * @param text 643 | * @param code 644 | * @return code for define statement 645 | */ 646 | public String convertDefineToAssignment(String text, String code) { 647 | String stmt = text + " = " + code + ";"; 648 | if (!code.isEmpty()) { 649 | if (code.charAt(0) == '\"') { 650 | stmt = "String " + stmt; 651 | } else { 652 | stmt = "Number " + stmt; 653 | } 654 | } 655 | return stmt; 656 | } 657 | } 658 | -------------------------------------------------------------------------------- /Java/src/bos/consoar/objc2lua/DescriptiveErrorListener.java: -------------------------------------------------------------------------------- 1 | package bos.consoar.objc2lua; 2 | 3 | import org.antlr.v4.runtime.BaseErrorListener; 4 | import org.antlr.v4.runtime.RecognitionException; 5 | import org.antlr.v4.runtime.Recognizer; 6 | 7 | public class DescriptiveErrorListener extends BaseErrorListener { 8 | public static DescriptiveErrorListener INSTANCE = new DescriptiveErrorListener(); 9 | private static final boolean REPORT_SYNTAX_ERRORS = true; 10 | 11 | @Override 12 | public void syntaxError(Recognizer recognizer, Object offendingSymbol, 13 | int line, int charPositionInLine, 14 | String msg, RecognitionException e) { 15 | if (!REPORT_SYNTAX_ERRORS) { 16 | return; 17 | } 18 | 19 | String sourceName = recognizer.getInputStream().getSourceName(); 20 | if (!sourceName.isEmpty()) { 21 | sourceName = String.format("%s:%d:%d: ", sourceName, line, charPositionInLine); 22 | } 23 | 24 | System.err.println(sourceName + "line " + line + ":" + charPositionInLine + " " + msg); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Java/src/bos/consoar/objc2lua/MainActivity.java: -------------------------------------------------------------------------------- 1 | package bos.consoar.objc2lua; 2 | 3 | import javax.swing.*; 4 | import java.awt.*; 5 | import java.awt.event.ActionEvent; 6 | import java.awt.event.ActionListener; 7 | import java.io.File; 8 | import java.io.IOException; 9 | import java.io.OutputStream; 10 | import java.io.PrintStream; 11 | 12 | public class MainActivity implements ActionListener { 13 | private boolean DEBUG_TEST = false; 14 | private PrintStream printStream; 15 | 16 | JFrame frame = new JFrame("Objc2Lua");// 框架布局 17 | JTabbedPane tabPane = new JTabbedPane();// 选项卡布局 18 | Container main = new Container();//主界面 19 | Container about = new Container();//关于界面 20 | Container setting = new Container();//设置界面 21 | 22 | JLabel label1 = new JLabel("文件目录"); 23 | JTextField text1 = new JTextField();// TextField 目录的路径 24 | JButton chooseDirButton = new JButton("选择");// 选择 25 | JFileChooser jfc = new JFileChooser();// 文件选择器 26 | JButton convertButton = new JButton("开始转换");// 27 | JTextArea txtLog = new JTextArea(); 28 | 29 | //about 30 | JLabel versionLabel = new JLabel("版本号:1.0.1_beta", JLabel.CENTER); 31 | JLabel aboutLabel = new JLabel("如有转换错误的Bug或无法转换的语法,欢迎反馈", JLabel.CENTER); 32 | 33 | //setting 34 | private MainActivity() { 35 | // if (DEBUG_TEST) { 36 | // try { 37 | // new Parse().Convert("E:\\waxtest\\"); 38 | // } catch (IOException e) { 39 | // e.printStackTrace(); 40 | // } 41 | // return; 42 | // } 43 | // 用自己的重载的OutputStream创建一个PrintStream 44 | printStream = new PrintStream(new MyOutputStream()); 45 | // 指定标准输出到自己创建的PrintStream 46 | System.setOut(printStream); 47 | System.setErr(printStream); 48 | double lx = Toolkit.getDefaultToolkit().getScreenSize().getWidth(); 49 | double ly = Toolkit.getDefaultToolkit().getScreenSize().getHeight(); 50 | frame.setLocation(new Point((int) (lx / 2) - 300, (int) (ly / 2) - 240));// 设定窗口出现位置 51 | frame.setSize(600, 480);// 设定窗口大小 52 | frame.setContentPane(tabPane);// 设置布局 53 | label1.setBounds(10, 10, 70, 20); 54 | text1.setBounds(75, 10, 400, 20); 55 | chooseDirButton.setBounds(500, 10, 70, 20); 56 | convertButton.setBounds(250, 60, 100, 20); 57 | txtLog.setBounds(10, 90, 570, 300); 58 | txtLog.setLineWrap(true); //激活自动换行功能 59 | txtLog.setWrapStyleWord(true); // 激活断行不断字功能 60 | 61 | chooseDirButton.addActionListener(this); // 添加事件处理 62 | convertButton.addActionListener(this); // 添加事件处理 63 | main.add(label1); 64 | main.add(text1); 65 | main.add(chooseDirButton); 66 | main.add(convertButton); 67 | JScrollPane scr = new JScrollPane(txtLog); 68 | scr.setBounds(10, 90, 570, 300); 69 | main.add(scr); 70 | frame.setVisible(true);// 窗口可见 71 | frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);// 使能关闭窗口,结束程序 72 | tabPane.add("主界面", main);// 添加布局1 73 | 74 | // tabPane.add("设置", setting); 75 | 76 | versionLabel.setBounds(100, 60, 400, 20); 77 | aboutLabel.setBounds(100, 80, 400, 100); 78 | about.add(versionLabel); 79 | about.add(aboutLabel); 80 | tabPane.add("关于", about); 81 | } 82 | 83 | public void actionPerformed(ActionEvent e) { 84 | if (e.getSource().equals(chooseDirButton)) {// 判断触发方法的按钮是哪个 85 | jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);// 设定只能选择到文件夹 86 | int state = jfc.showOpenDialog(null);// 此句是打开文件选择器界面的触发语句 87 | if (state == 1) { 88 | return; 89 | } else { 90 | File f = jfc.getSelectedFile();// f为选择到的目录 91 | text1.setText(f.getAbsolutePath()); 92 | } 93 | } 94 | 95 | if (e.getSource().equals(convertButton)) { 96 | String dir = text1.getText() + File.separator; 97 | if (dir.length() > 0) { 98 | try { 99 | new Parse().Convert(dir); 100 | } catch (IOException e1) { 101 | e1.printStackTrace(); 102 | } 103 | } else { 104 | JOptionPane.showMessageDialog(null, "请先选择目录~", "错误", 2); 105 | } 106 | 107 | } 108 | } 109 | 110 | public static void main(String[] args) { 111 | new MainActivity(); 112 | } 113 | 114 | //重定向system的输出 115 | public class MyOutputStream extends OutputStream { 116 | public void write(int arg0) throws IOException { 117 | // 写入指定的字节,忽略 118 | } 119 | 120 | public void write(byte data[]) throws IOException { 121 | // 追加一行字符串 122 | txtLog.append(new String(data)); 123 | } 124 | 125 | public void write(byte data[], int off, int len) throws IOException { 126 | // 追加一行字符串中指定的部分,这个最重要 127 | txtLog.append(new String(data, off, len)); 128 | // 移动TextArea的光标到最后,实现自动滚动 129 | txtLog.setCaretPosition(txtLog.getText().length()); 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /Java/src/bos/consoar/objc2lua/Parse.java: -------------------------------------------------------------------------------- 1 | package bos.consoar.objc2lua; 2 | 3 | import bos.consoar.objc2lua.parser.ObjCLexer; 4 | import bos.consoar.objc2lua.parser.ObjCParser; 5 | import org.antlr.v4.runtime.ANTLRInputStream; 6 | import org.antlr.v4.runtime.CommonTokenStream; 7 | import org.antlr.v4.runtime.RuleContext; 8 | import org.antlr.v4.runtime.tree.ParseTreeWalker; 9 | 10 | import java.io.BufferedInputStream; 11 | import java.io.File; 12 | import java.io.FileInputStream; 13 | import java.io.IOException; 14 | import java.util.ArrayList; 15 | import java.util.Map; 16 | 17 | /** 18 | * @author Isaac Clark Driver class for running the parser from the command line 19 | */ 20 | 21 | public class Parse { 22 | private static String outputFileName = ""; 23 | private static String directoryName = ""; 24 | private static ArrayList inputFileNames = new ArrayList(); 25 | private static String baseName = ""; 26 | private static String packageName = ""; 27 | private static ArrayList cStructSignals = new ArrayList(); 28 | 29 | public void Convert(String directoryInput) throws IOException { 30 | 31 | ParseOptions options = new ParseOptions(); 32 | options.setUseExternalTranslations(Translations.readTranslations(Translations.TRANSLATIONFILE)); 33 | 34 | directoryName = directoryInput; 35 | File f = new File(directoryName); 36 | File[] files = f.listFiles(); 37 | inputFileNames.clear(); 38 | for (File file : files) { 39 | if (file.isFile()) { 40 | if (file.getAbsolutePath().endsWith(".m")) { 41 | inputFileNames.add(file.getAbsolutePath()); 42 | } 43 | } 44 | } 45 | 46 | for (String con : cStructSignals) { 47 | options.getConstructorSignatures().add(con); 48 | } 49 | ClassDescription cd = new ClassDescription(); 50 | Map headerDeclarations = cd 51 | .getHeaders(); 52 | 53 | // Set keys = cd.getHeaders().keySet(); 54 | options.setParsingheader(false); 55 | options.setPackageName(packageName); 56 | for (String inputFileName : inputFileNames) { 57 | baseName = baseNameFromPath(inputFileName); 58 | options.setInputFileName(inputFileName); 59 | if (inputFileName.length() > 0) { 60 | BufferedInputStream instream = null; 61 | instream = new BufferedInputStream(new FileInputStream( 62 | inputFileName)); 63 | ANTLRInputStream antlrStream = null; 64 | antlrStream = new ANTLRInputStream(instream); 65 | // lexing 66 | ObjCLexer lexer = new ObjCLexer(antlrStream); 67 | CommonTokenStream tokens = new CommonTokenStream(lexer); 68 | ObjCParser parser = new ObjCParser(tokens); 69 | RuleContext tree = parser.translation_unit(); 70 | 71 | // walk the tree and activate so we can listen 72 | ParseTreeWalker walker = new ParseTreeWalker(); 73 | cd = new ClassDescription(headerDeclarations); 74 | options.setClassName(baseName); 75 | cd.setTempClassName(baseName); 76 | options.setParsingheader(false); 77 | String fName = outputFileName; 78 | if (fName.length() == 0) { 79 | fName = combinePathWithFileName( 80 | directoryName, baseName + ".lua"); 81 | } 82 | options.setOutputFileName(fName); 83 | 84 | walker.walk(new ParserObjcListener(cd, tokens, options), tree); 85 | System.out.print(options.getOutputFileName() + "\n"); 86 | 87 | } 88 | } 89 | } 90 | 91 | /** 92 | * @param fName filename 93 | * @return returns the base for the given file name 94 | */ 95 | public static String getBaseName(String fName) { 96 | String bName = fName; 97 | int index = fName.lastIndexOf('.'); 98 | if (index >= 0) { 99 | bName = fName.substring(0, index); 100 | } 101 | return bName; 102 | } 103 | 104 | static String baseNameFromPath(String fName) { 105 | File f = new File(fName); 106 | String bName = f.getName(); 107 | return getBaseName(bName); 108 | } 109 | 110 | private static String combinePathWithFileName(String directory, String fName) { 111 | return directory + fName; 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /Java/src/bos/consoar/objc2lua/ParseOptions.java: -------------------------------------------------------------------------------- 1 | package bos.consoar.objc2lua; 2 | 3 | import java.util.ArrayList; 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | /** 8 | * @author Isaac Clark 9 | * Holds Parsing Options 10 | */ 11 | public class ParseOptions { 12 | private ArrayList constructorSignatures; 13 | private String outputFileName; 14 | private String inputFileName; 15 | private String className; 16 | private String packageName; 17 | private String directoryTypes; 18 | private boolean parsingheader; 19 | private boolean smartConstructorGeneration; 20 | private boolean constructor; 21 | private boolean useExternalTranslations; 22 | private Map identityPairs; 23 | 24 | ParseOptions() { 25 | constructorSignatures = new ArrayList(); 26 | setDirectoryTypes(""); 27 | setSmartConstructorGeneration(true); 28 | setPackageName(""); 29 | this.setUseExternalTranslations(false); 30 | identityPairs = new HashMap(); 31 | } 32 | 33 | /** 34 | * @return signature collection 35 | */ 36 | public ArrayList getConstructorSignatures() { 37 | return constructorSignatures; 38 | } 39 | 40 | /** 41 | * @param constructorSignatures 42 | */ 43 | public void setConstructorSignatures(ArrayList constructorSignatures) { 44 | this.constructorSignatures = constructorSignatures; 45 | } 46 | 47 | /** 48 | * @return output file name 49 | */ 50 | public String getOutputFileName() { 51 | return outputFileName; 52 | } 53 | 54 | /** 55 | * @param outputFileName 56 | */ 57 | public void setOutputFileName(String outputFileName) { 58 | this.outputFileName = outputFileName; 59 | } 60 | 61 | /** 62 | * @return the inputFileName 63 | */ 64 | public String getInputFileName() { 65 | return inputFileName; 66 | } 67 | 68 | /** 69 | * @param inputFileName the inputFileName to set 70 | */ 71 | public void setInputFileName(String inputFileName) { 72 | this.inputFileName = inputFileName; 73 | } 74 | 75 | /** 76 | * @return class name 77 | */ 78 | public String getClassName() { 79 | return className; 80 | } 81 | 82 | /** 83 | * @param className 84 | */ 85 | public void setClassName(String className) { 86 | this.className = className; 87 | } 88 | 89 | /** 90 | * @return the packageName 91 | */ 92 | public String getPackageName() { 93 | return packageName; 94 | } 95 | 96 | /** 97 | * @param packageName the packageName to set 98 | */ 99 | public void setPackageName(String packageName) { 100 | this.packageName = packageName; 101 | } 102 | 103 | /** 104 | * @return the identityPairs 105 | */ 106 | public Map getIdentityPairs() { 107 | return identityPairs; 108 | } 109 | 110 | /** 111 | * @param key 112 | * @param value add new identityPair 113 | */ 114 | public void addIdentityPair(String key, String value) { 115 | this.identityPairs.put(key, value); 116 | } 117 | 118 | /** 119 | * @return true if parsing a header file; false if implementation file 120 | */ 121 | public boolean isParsingheader() { 122 | return parsingheader; 123 | } 124 | 125 | /** 126 | * @param parsingheader 127 | */ 128 | public void setParsingheader(boolean parsingheader) { 129 | this.parsingheader = parsingheader; 130 | } 131 | 132 | /** 133 | * @return the smartConstructorGeneration 134 | */ 135 | public boolean useSmartConstructorGeneration() { 136 | return smartConstructorGeneration; 137 | } 138 | 139 | /** 140 | * @param smartConstructorGeneration the smartConstructorGeneration to set 141 | */ 142 | public void setSmartConstructorGeneration(boolean smartConstructorGeneration) { 143 | this.smartConstructorGeneration = smartConstructorGeneration; 144 | } 145 | 146 | /** 147 | * @return the directoryTypes 148 | */ 149 | public String getDirectoryTypes() { 150 | return directoryTypes; 151 | } 152 | 153 | /** 154 | * @param directoryTypes the directoryTypes to set 155 | */ 156 | public void setDirectoryTypes(String directoryTypes) { 157 | this.directoryTypes = directoryTypes; 158 | } 159 | 160 | /** 161 | * @return the constructor 162 | */ 163 | public boolean isConstructorMethod() { 164 | return constructor; 165 | } 166 | 167 | /** 168 | * @param constructor the constructor to set 169 | */ 170 | public void setConstructorMethod(boolean constructor) { 171 | this.constructor = constructor; 172 | } 173 | 174 | /** 175 | * @return the useExternalTranslations 176 | */ 177 | public boolean useExternalTranslations() { 178 | return useExternalTranslations; 179 | } 180 | 181 | /** 182 | * @param useExternalTranslations the useExternalTranslations to set 183 | */ 184 | public void setUseExternalTranslations(boolean useExternalTranslations) { 185 | this.useExternalTranslations = useExternalTranslations; 186 | } 187 | 188 | } 189 | -------------------------------------------------------------------------------- /Java/src/bos/consoar/objc2lua/Translations.java: -------------------------------------------------------------------------------- 1 | package bos.consoar.objc2lua; 2 | 3 | import java.io.File; 4 | import java.io.FileNotFoundException; 5 | import java.util.*; 6 | 7 | /** 8 | * @author Isaac Clark read translations from external file 9 | * and produce them on demand 10 | */ 11 | public class Translations { 12 | private static Map allTranslations = new HashMap(); 13 | public static final String GLOBALMAPKEY = "GLOBALMAPKEY"; 14 | /** 15 | * name of default external translation file 16 | */ 17 | public static final String TRANSLATIONFILE = "translate.dat"; 18 | 19 | /** 20 | * Read id and function translations from an external file 21 | * 22 | * @param fileName 23 | * @return true if successful at finding translation file 24 | */ 25 | public static boolean readTranslations(String fileName) { 26 | File f = new File(fileName); 27 | ArrayList fileNames = new ArrayList(); 28 | Scanner sc = null; 29 | List lines = new ArrayList(); 30 | try { 31 | sc = new Scanner(f); 32 | } catch (FileNotFoundException e) { 33 | return false; 34 | } 35 | boolean appendNext = false; 36 | while (sc.hasNextLine()) { 37 | String line = sc.nextLine().trim(); 38 | if (line.length() == 0 || line.charAt(0) == '#') { 39 | continue; 40 | } 41 | if (appendNext) { 42 | line = lines.get(lines.size() - 1) + line; 43 | lines.remove(lines.size() - 1); 44 | appendNext = false; 45 | } 46 | if (line.length() - 1 == '\\') { 47 | appendNext = true; 48 | line = line.substring(0, line.length() - 1); 49 | } 50 | lines.add(line); 51 | } 52 | sc.close(); 53 | // convert lines to translations 54 | for (String line : lines) { 55 | if (line.startsWith("fileNames:")) { 56 | String[] parts = line.split(":", 2); 57 | if (parts.length > 2 && !parts[1].trim().isEmpty()) { 58 | 59 | } 60 | } 61 | String[] parts = line.split("[\t ]+", 2); 62 | if (parts[0].toLowerCase().equals("-replaceid")) { 63 | ArrayList args = splitEscapeUnquote(parts[1]); 64 | saveTranslation(fileNames, TranslationType.ID, args.get(0), 65 | args.get(1)); 66 | } else if (parts[0].toLowerCase().equals("-replacefunc")) { 67 | ArrayList args = splitEscapeUnquote(parts[1]); 68 | String arg2 = args.get(1); 69 | if (arg2.length() > 0 70 | && arg2.substring(arg2.length() - 1).equals("-")) { 71 | arg2 = arg2.substring(0, arg2.length() - 2) 72 | + CodeFormatter.REVERSE_ARGS_MARKER + "("; 73 | } 74 | saveTranslation(fileNames, TranslationType.FUNCTION, 75 | args.get(0), arg2); 76 | } else if (parts[0].toLowerCase().equals("-replaceregex")) { 77 | ArrayList args = splitEscapeUnquote(parts[1]); 78 | saveTranslation(fileNames, TranslationType.REGEX, args.get(0), 79 | args.get(1)); 80 | } else if (parts[0].toLowerCase().equals("replacecode")) { 81 | 82 | } 83 | } 84 | return true; 85 | } 86 | 87 | private static ArrayList splitEscapeUnquote(String string) { 88 | ArrayList args = new ArrayList(); 89 | boolean insideDoubleQuote = false; 90 | boolean insideSingleQuote = false; 91 | int breakPoint = -1; 92 | for (int i = 0; i < string.length(); i++) { 93 | char c = string.charAt(i); 94 | if (!insideDoubleQuote && !insideSingleQuote) { 95 | if (c == ' ' || c == '\t') { 96 | breakPoint = i; 97 | break; 98 | } else if (c == '\"') { 99 | if (i == 0) { 100 | insideDoubleQuote = true; 101 | } else if (string.charAt(i - 1) != '\\') { 102 | insideDoubleQuote = true; 103 | } 104 | } else if (c == '\'') { 105 | if (i == 0) { 106 | insideSingleQuote = true; 107 | } else if (string.charAt(i - 1) != '\\') { 108 | insideSingleQuote = true; 109 | } 110 | } 111 | } else if (insideDoubleQuote) { 112 | if (c == '\"' && string.charAt(i - 1) != '\\') { 113 | insideDoubleQuote = false; 114 | } 115 | } else if (insideSingleQuote) { 116 | if (c == '\'' && string.charAt(i - 1) != '\\') { 117 | insideDoubleQuote = false; 118 | } 119 | } 120 | } 121 | if (breakPoint != -1) { 122 | String arg1 = string.substring(0, breakPoint).trim(); 123 | String arg2 = string.substring(breakPoint).trim(); 124 | arg1 = arg1.substring(1, arg1.length() - 1); 125 | arg2 = arg2.substring(1, arg2.length() - 1); 126 | args.add(unescape(arg1)); 127 | args.add(unescape(arg2)); 128 | } 129 | return args; 130 | } 131 | 132 | private static String unescape(String arg) { 133 | arg = arg.replaceAll("\\n", "\n"); 134 | arg = arg.replaceAll("\\t", "\t"); 135 | arg = arg.replaceAll("\\r", "\r"); 136 | arg = arg.replaceAll("\\\"", "\""); 137 | arg = arg.replaceAll("\\\'", "\'"); 138 | // arg.replaceAll("\\\\", "\\"); 139 | return arg; 140 | } 141 | 142 | /** 143 | * @author Isaac Clark 144 | * Holds the set of mappings for a set of files 145 | */ 146 | public static class TranslationMap { 147 | Map functionMap; 148 | Map identificationMap; 149 | Map regexMap; 150 | 151 | TranslationMap() { 152 | functionMap = new HashMap(); 153 | identificationMap = new HashMap(); 154 | regexMap = new HashMap(); 155 | } 156 | 157 | private Map getTranslation(TranslationType type) { 158 | Map myMap = null; 159 | switch (type) { 160 | case FUNCTION: 161 | myMap = functionMap; 162 | break; 163 | case ID: 164 | myMap = identificationMap; 165 | break; 166 | case REGEX: 167 | myMap = regexMap; 168 | break; 169 | 170 | } 171 | return myMap; 172 | } 173 | } 174 | 175 | /** 176 | * @param fileName 177 | * @param type 178 | * @return the corresponding map for the filename and type; null if not found 179 | */ 180 | public static Map getTranslation(String fileName, 181 | TranslationType type) { 182 | TranslationMap mp = allTranslations.get(fileName); 183 | if (mp == null) { 184 | return null; 185 | } 186 | return mp.getTranslation(type); 187 | } 188 | 189 | private static void saveTranslation(ArrayList files, 190 | TranslationType type, String match, String code) { 191 | ArrayList fileList = new ArrayList(); 192 | if (fileList.size() == 0) { 193 | fileList.add(GLOBALMAPKEY); 194 | } else { 195 | fileList.addAll(files); 196 | } 197 | TranslationMap myMaps = null; 198 | for (String key : fileList) { 199 | myMaps = allTranslations.get(key); 200 | if (myMaps == null) { 201 | myMaps = new TranslationMap(); 202 | allTranslations.put(key, myMaps); 203 | } 204 | Map myTranslation = myMaps.getTranslation(type); 205 | myTranslation.put(match, code); 206 | } 207 | } 208 | 209 | /** 210 | * @author Isaac Clark 211 | */ 212 | public enum TranslationType { 213 | FUNCTION, ID, REGEX 214 | } 215 | 216 | ; 217 | } 218 | -------------------------------------------------------------------------------- /Java/src/bos/consoar/objc2lua/parser/ObjC.tokens: -------------------------------------------------------------------------------- 1 | T__0=1 2 | T__1=2 3 | T__2=3 4 | T__3=4 5 | T__4=5 6 | T__5=6 7 | T__6=7 8 | T__7=8 9 | DOTIDENTIFIER=9 10 | AUTORELEASEPOOL=10 11 | CATCH=11 12 | CLASS=12 13 | DYNAMIC=13 14 | ENCODE=14 15 | END=15 16 | FINALLY=16 17 | IMPLEMENTATION=17 18 | INTERFACE=18 19 | PACKAGE=19 20 | PROTOCOL=20 21 | OPTIONAL=21 22 | PRIVATE=22 23 | PROPERTY=23 24 | PROTECTED=24 25 | PUBLIC=25 26 | SELECTOR=26 27 | SYNCHRONIZED=27 28 | SYNTHESIZE=28 29 | THROW=29 30 | TRY=30 31 | SUPER=31 32 | SELF=32 33 | ABSTRACT=33 34 | AUTO=34 35 | BOOLEAN=35 36 | BREAK=36 37 | BYCOPY=37 38 | BYREF=38 39 | CASE=39 40 | CHAR=40 41 | CONST=41 42 | CONTINUE=42 43 | DEFAULT=43 44 | DO=44 45 | DOUBLE=45 46 | ELSE=46 47 | ENUM=47 48 | EXTERN=48 49 | FLOAT=49 50 | FOR=50 51 | ID=51 52 | IF=52 53 | IN=53 54 | INOUT=54 55 | GOTO=55 56 | INT=56 57 | LONG=57 58 | ONEWAY=58 59 | OUT=59 60 | REGISTER=60 61 | RETURN=61 62 | SHORT=62 63 | SIGNED=63 64 | SIZEOF=64 65 | STATIC=65 66 | STRUCT=66 67 | SWITCH=67 68 | TYPEDEF=68 69 | UNION=69 70 | UNSIGNED=70 71 | VOID=71 72 | VOLATILE=72 73 | WHILE=73 74 | NS_OPTIONS=74 75 | NS_ENUM=75 76 | WWEAK=76 77 | WUNSAFE_UNRETAINED=77 78 | TYPEOF=78 79 | LPAREN=79 80 | RPAREN=80 81 | LBRACE=81 82 | RBRACE=82 83 | LBRACK=83 84 | RBRACK=84 85 | SEMI=85 86 | COMMA=86 87 | DOT=87 88 | STRUCTACCESS=88 89 | AT=89 90 | ASSIGN=90 91 | GT=91 92 | LT=92 93 | BANG=93 94 | TILDE=94 95 | QUESTION=95 96 | COLON=96 97 | EQUAL=97 98 | LE=98 99 | GE=99 100 | NOTEQUAL=100 101 | AND=101 102 | OR=102 103 | INC=103 104 | DEC=104 105 | ADD=105 106 | SUB=106 107 | MUL=107 108 | DIV=108 109 | BITAND=109 110 | BITOR=110 111 | CARET=111 112 | MOD=112 113 | SHIFT_R=113 114 | SHIFT_L=114 115 | ADD_ASSIGN=115 116 | SUB_ASSIGN=116 117 | MUL_ASSIGN=117 118 | DIV_ASSIGN=118 119 | AND_ASSIGN=119 120 | OR_ASSIGN=120 121 | XOR_ASSIGN=121 122 | MOD_ASSIGN=122 123 | LSHIFT_ASSIGN=123 124 | RSHIFT_ASSIGN=124 125 | ELIPSIS=125 126 | ASSIGNPA=126 127 | GETTER=127 128 | NONATOMIC=128 129 | SETTER=129 130 | STRONG=130 131 | RETAIN=131 132 | READONLY=132 133 | READWRITE=133 134 | WEAK=134 135 | IDENTIFIER=135 136 | CHARACTER_LITERAL=136 137 | CSTRING_LITERAL=137 138 | STRING_LITERAL=138 139 | HEX_LITERAL=139 140 | DECIMAL_LITERAL=140 141 | OCTAL_LITERAL=141 142 | FLOATING_POINT_LITERAL=142 143 | IMPORT=143 144 | INCLUDE=144 145 | PRAGMA=145 146 | WS=146 147 | COMMENT=147 148 | LINE_COMMENT=148 149 | '#ifdef'=1 150 | '#if'=2 151 | '#undef'=3 152 | '#ifndef'=4 153 | '#endif'=5 154 | '#define'=6 155 | '.+'=7 156 | '@required'=8 157 | '@autoreleasepool'=10 158 | '@catch'=11 159 | '@class'=12 160 | '@dynamic'=13 161 | '@encode'=14 162 | '@end'=15 163 | '@finally'=16 164 | '@implementation'=17 165 | '@interface'=18 166 | '@package'=19 167 | '@protocol'=20 168 | '@optional'=21 169 | '@private'=22 170 | '@property'=23 171 | '@protected'=24 172 | '@public'=25 173 | '@selector'=26 174 | '@synchronized'=27 175 | '@synthesize'=28 176 | '@throw'=29 177 | '@try'=30 178 | 'super'=31 179 | 'self'=32 180 | 'abstract'=33 181 | 'auto'=34 182 | 'boolean'=35 183 | 'break'=36 184 | 'bycopy'=37 185 | 'byref'=38 186 | 'case'=39 187 | 'char'=40 188 | 'const'=41 189 | 'continue'=42 190 | 'default'=43 191 | 'do'=44 192 | 'double'=45 193 | 'else'=46 194 | 'enum'=47 195 | 'extern'=48 196 | 'float'=49 197 | 'for'=50 198 | 'id'=51 199 | 'if'=52 200 | 'in'=53 201 | 'inout'=54 202 | 'goto'=55 203 | 'int'=56 204 | 'long'=57 205 | 'oneway'=58 206 | 'out'=59 207 | 'register'=60 208 | 'return'=61 209 | 'short'=62 210 | 'signed'=63 211 | 'sizeof'=64 212 | 'static'=65 213 | 'struct'=66 214 | 'switch'=67 215 | 'typedef'=68 216 | 'union'=69 217 | 'unsigned'=70 218 | 'void'=71 219 | 'volatile'=72 220 | 'while'=73 221 | 'NS_OPTIONS'=74 222 | 'NS_ENUM'=75 223 | '__weak'=76 224 | '__unsafe_unretained'=77 225 | '__typeof'=78 226 | '('=79 227 | ')'=80 228 | '{'=81 229 | '}'=82 230 | '['=83 231 | ']'=84 232 | ';'=85 233 | ','=86 234 | '.'=87 235 | '->'=88 236 | '@'=89 237 | '='=90 238 | '>'=91 239 | '<'=92 240 | '!'=93 241 | '~'=94 242 | '?'=95 243 | ':'=96 244 | '=='=97 245 | '<='=98 246 | '>='=99 247 | '!='=100 248 | '&&'=101 249 | '||'=102 250 | '++'=103 251 | '--'=104 252 | '+'=105 253 | '-'=106 254 | '*'=107 255 | '/'=108 256 | '&'=109 257 | '|'=110 258 | '^'=111 259 | '%'=112 260 | '>>'=113 261 | '<<'=114 262 | '+='=115 263 | '-='=116 264 | '*='=117 265 | '/='=118 266 | '&='=119 267 | '|='=120 268 | '^='=121 269 | '%='=122 270 | '<<='=123 271 | '>>='=124 272 | '...'=125 273 | 'assign'=126 274 | 'getter'=127 275 | 'nonatomic'=128 276 | 'setter'=129 277 | 'strong'=130 278 | 'retain'=131 279 | 'readonly'=132 280 | 'readwrite'=133 281 | 'weak'=134 282 | -------------------------------------------------------------------------------- /Java/src/bos/consoar/objc2lua/parser/ObjCLexer.java: -------------------------------------------------------------------------------- 1 | package bos.consoar.objc2lua.parser; 2 | 3 | import org.antlr.v4.runtime.*; 4 | import org.antlr.v4.runtime.atn.ATN; 5 | import org.antlr.v4.runtime.atn.ATNDeserializer; 6 | import org.antlr.v4.runtime.atn.LexerATNSimulator; 7 | import org.antlr.v4.runtime.atn.PredictionContextCache; 8 | import org.antlr.v4.runtime.dfa.DFA; 9 | 10 | @SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"}) 11 | public class ObjCLexer extends Lexer { 12 | static { 13 | RuntimeMetaData.checkVersion("4.5.1", RuntimeMetaData.VERSION); 14 | } 15 | 16 | protected static final DFA[] _decisionToDFA; 17 | protected static final PredictionContextCache _sharedContextCache = 18 | new PredictionContextCache(); 19 | public static final int 20 | T__0 = 1, T__1 = 2, T__2 = 3, T__3 = 4, T__4 = 5, T__5 = 6, T__6 = 7, T__7 = 8, DOTIDENTIFIER = 9, 21 | AUTORELEASEPOOL = 10, CATCH = 11, CLASS = 12, DYNAMIC = 13, ENCODE = 14, END = 15, 22 | FINALLY = 16, IMPLEMENTATION = 17, INTERFACE = 18, PACKAGE = 19, PROTOCOL = 20, 23 | OPTIONAL = 21, PRIVATE = 22, PROPERTY = 23, PROTECTED = 24, PUBLIC = 25, SELECTOR = 26, 24 | SYNCHRONIZED = 27, SYNTHESIZE = 28, THROW = 29, TRY = 30, SUPER = 31, SELF = 32, ABSTRACT = 33, 25 | AUTO = 34, BOOLEAN = 35, BREAK = 36, BYCOPY = 37, BYREF = 38, CASE = 39, CHAR = 40, 26 | CONST = 41, CONTINUE = 42, DEFAULT = 43, DO = 44, DOUBLE = 45, ELSE = 46, ENUM = 47, 27 | EXTERN = 48, FLOAT = 49, FOR = 50, ID = 51, IF = 52, IN = 53, INOUT = 54, GOTO = 55, INT = 56, 28 | LONG = 57, ONEWAY = 58, OUT = 59, REGISTER = 60, RETURN = 61, SHORT = 62, SIGNED = 63, 29 | SIZEOF = 64, STATIC = 65, STRUCT = 66, SWITCH = 67, TYPEDEF = 68, UNION = 69, UNSIGNED = 70, 30 | VOID = 71, VOLATILE = 72, WHILE = 73, NS_OPTIONS = 74, NS_ENUM = 75, WWEAK = 76, WUNSAFE_UNRETAINED = 77, 31 | TYPEOF = 78, LPAREN = 79, RPAREN = 80, LBRACE = 81, RBRACE = 82, LBRACK = 83, RBRACK = 84, 32 | SEMI = 85, COMMA = 86, DOT = 87, STRUCTACCESS = 88, AT = 89, ASSIGN = 90, GT = 91, LT = 92, 33 | BANG = 93, TILDE = 94, QUESTION = 95, COLON = 96, EQUAL = 97, LE = 98, GE = 99, NOTEQUAL = 100, 34 | AND = 101, OR = 102, INC = 103, DEC = 104, ADD = 105, SUB = 106, MUL = 107, DIV = 108, 35 | BITAND = 109, BITOR = 110, CARET = 111, MOD = 112, SHIFT_R = 113, SHIFT_L = 114, ADD_ASSIGN = 115, 36 | SUB_ASSIGN = 116, MUL_ASSIGN = 117, DIV_ASSIGN = 118, AND_ASSIGN = 119, OR_ASSIGN = 120, 37 | XOR_ASSIGN = 121, MOD_ASSIGN = 122, LSHIFT_ASSIGN = 123, RSHIFT_ASSIGN = 124, 38 | ELIPSIS = 125, ASSIGNPA = 126, GETTER = 127, NONATOMIC = 128, SETTER = 129, STRONG = 130, 39 | RETAIN = 131, READONLY = 132, READWRITE = 133, WEAK = 134, IDENTIFIER = 135, CHARACTER_LITERAL = 136, 40 | CSTRING_LITERAL = 137, STRING_LITERAL = 138, HEX_LITERAL = 139, DECIMAL_LITERAL = 140, 41 | OCTAL_LITERAL = 141, FLOATING_POINT_LITERAL = 142, IMPORT = 143, INCLUDE = 144, 42 | PRAGMA = 145, WS = 146, COMMENT = 147, LINE_COMMENT = 148; 43 | public static String[] modeNames = { 44 | "DEFAULT_MODE" 45 | }; 46 | 47 | public static final String[] ruleNames = { 48 | "T__0", "T__1", "T__2", "T__3", "T__4", "T__5", "T__6", "T__7", "DOTIDENTIFIER", 49 | "AUTORELEASEPOOL", "CATCH", "CLASS", "DYNAMIC", "ENCODE", "END", "FINALLY", 50 | "IMPLEMENTATION", "INTERFACE", "PACKAGE", "PROTOCOL", "OPTIONAL", "PRIVATE", 51 | "PROPERTY", "PROTECTED", "PUBLIC", "SELECTOR", "SYNCHRONIZED", "SYNTHESIZE", 52 | "THROW", "TRY", "SUPER", "SELF", "ABSTRACT", "AUTO", "BOOLEAN", "BREAK", 53 | "BYCOPY", "BYREF", "CASE", "CHAR", "CONST", "CONTINUE", "DEFAULT", "DO", 54 | "DOUBLE", "ELSE", "ENUM", "EXTERN", "FLOAT", "FOR", "ID", "IF", "IN", 55 | "INOUT", "GOTO", "INT", "LONG", "ONEWAY", "OUT", "REGISTER", "RETURN", 56 | "SHORT", "SIGNED", "SIZEOF", "STATIC", "STRUCT", "SWITCH", "TYPEDEF", 57 | "UNION", "UNSIGNED", "VOID", "VOLATILE", "WHILE", "NS_OPTIONS", "NS_ENUM", 58 | "WWEAK", "WUNSAFE_UNRETAINED", "TYPEOF", "LPAREN", "RPAREN", "LBRACE", 59 | "RBRACE", "LBRACK", "RBRACK", "SEMI", "COMMA", "DOT", "STRUCTACCESS", 60 | "AT", "ASSIGN", "GT", "LT", "BANG", "TILDE", "QUESTION", "COLON", "EQUAL", 61 | "LE", "GE", "NOTEQUAL", "AND", "OR", "INC", "DEC", "ADD", "SUB", "MUL", 62 | "DIV", "BITAND", "BITOR", "CARET", "MOD", "SHIFT_R", "SHIFT_L", "ADD_ASSIGN", 63 | "SUB_ASSIGN", "MUL_ASSIGN", "DIV_ASSIGN", "AND_ASSIGN", "OR_ASSIGN", "XOR_ASSIGN", 64 | "MOD_ASSIGN", "LSHIFT_ASSIGN", "RSHIFT_ASSIGN", "ELIPSIS", "ASSIGNPA", 65 | "GETTER", "NONATOMIC", "SETTER", "STRONG", "RETAIN", "READONLY", "READWRITE", 66 | "WEAK", "IDENTIFIER", "LETTER", "CHARACTER_LITERAL", "CSTRING_LITERAL", 67 | "STRING_LITERAL", "STRING", "HEX_LITERAL", "DECIMAL_LITERAL", "OCTAL_LITERAL", 68 | "HexDigit", "IntegerTypeSuffix", "FLOATING_POINT_LITERAL", "Exponent", 69 | "FloatTypeSuffix", "EscapeSequence", "OctalEscape", "UnicodeEscape", "IMPORT", 70 | "INCLUDE", "PRAGMA", "ANGLE_STRING", "WS", "COMMENT", "LINE_COMMENT" 71 | }; 72 | 73 | private static final String[] _LITERAL_NAMES = { 74 | null, "'#ifdef'", "'#if'", "'#undef'", "'#ifndef'", "'#endif'", "'#define'", 75 | "'.+'", "'@required'", null, "'@autoreleasepool'", "'@catch'", "'@class'", 76 | "'@dynamic'", "'@encode'", "'@end'", "'@finally'", "'@implementation'", 77 | "'@interface'", "'@package'", "'@protocol'", "'@optional'", "'@private'", 78 | "'@property'", "'@protected'", "'@public'", "'@selector'", "'@synchronized'", 79 | "'@synthesize'", "'@throw'", "'@try'", "'super'", "'self'", "'abstract'", 80 | "'auto'", "'boolean'", "'break'", "'bycopy'", "'byref'", "'case'", "'char'", 81 | "'const'", "'continue'", "'default'", "'do'", "'double'", "'else'", "'enum'", 82 | "'extern'", "'float'", "'for'", "'id'", "'if'", "'in'", "'inout'", "'goto'", 83 | "'int'", "'long'", "'oneway'", "'out'", "'register'", "'return'", "'short'", 84 | "'signed'", "'sizeof'", "'static'", "'struct'", "'switch'", "'typedef'", 85 | "'union'", "'unsigned'", "'void'", "'volatile'", "'while'", "'NS_OPTIONS'", 86 | "'NS_ENUM'", "'__weak'", "'__unsafe_unretained'", "'__typeof'", "'('", 87 | "')'", "'{'", "'}'", "'['", "']'", "';'", "','", "'.'", "'->'", "'@'", 88 | "'='", "'>'", "'<'", "'!'", "'~'", "'?'", "':'", "'=='", "'<='", "'>='", 89 | "'!='", "'&&'", "'||'", "'++'", "'--'", "'+'", "'-'", "'*'", "'/'", "'&'", 90 | "'|'", "'^'", "'%'", "'>>'", "'<<'", "'+='", "'-='", "'*='", "'/='", "'&='", 91 | "'|='", "'^='", "'%='", "'<<='", "'>>='", "'...'", "'assign'", "'getter'", 92 | "'nonatomic'", "'setter'", "'strong'", "'retain'", "'readonly'", "'readwrite'", 93 | "'weak'" 94 | }; 95 | private static final String[] _SYMBOLIC_NAMES = { 96 | null, null, null, null, null, null, null, null, null, "DOTIDENTIFIER", 97 | "AUTORELEASEPOOL", "CATCH", "CLASS", "DYNAMIC", "ENCODE", "END", "FINALLY", 98 | "IMPLEMENTATION", "INTERFACE", "PACKAGE", "PROTOCOL", "OPTIONAL", "PRIVATE", 99 | "PROPERTY", "PROTECTED", "PUBLIC", "SELECTOR", "SYNCHRONIZED", "SYNTHESIZE", 100 | "THROW", "TRY", "SUPER", "SELF", "ABSTRACT", "AUTO", "BOOLEAN", "BREAK", 101 | "BYCOPY", "BYREF", "CASE", "CHAR", "CONST", "CONTINUE", "DEFAULT", "DO", 102 | "DOUBLE", "ELSE", "ENUM", "EXTERN", "FLOAT", "FOR", "ID", "IF", "IN", 103 | "INOUT", "GOTO", "INT", "LONG", "ONEWAY", "OUT", "REGISTER", "RETURN", 104 | "SHORT", "SIGNED", "SIZEOF", "STATIC", "STRUCT", "SWITCH", "TYPEDEF", 105 | "UNION", "UNSIGNED", "VOID", "VOLATILE", "WHILE", "NS_OPTIONS", "NS_ENUM", 106 | "WWEAK", "WUNSAFE_UNRETAINED", "TYPEOF", "LPAREN", "RPAREN", "LBRACE", 107 | "RBRACE", "LBRACK", "RBRACK", "SEMI", "COMMA", "DOT", "STRUCTACCESS", 108 | "AT", "ASSIGN", "GT", "LT", "BANG", "TILDE", "QUESTION", "COLON", "EQUAL", 109 | "LE", "GE", "NOTEQUAL", "AND", "OR", "INC", "DEC", "ADD", "SUB", "MUL", 110 | "DIV", "BITAND", "BITOR", "CARET", "MOD", "SHIFT_R", "SHIFT_L", "ADD_ASSIGN", 111 | "SUB_ASSIGN", "MUL_ASSIGN", "DIV_ASSIGN", "AND_ASSIGN", "OR_ASSIGN", "XOR_ASSIGN", 112 | "MOD_ASSIGN", "LSHIFT_ASSIGN", "RSHIFT_ASSIGN", "ELIPSIS", "ASSIGNPA", 113 | "GETTER", "NONATOMIC", "SETTER", "STRONG", "RETAIN", "READONLY", "READWRITE", 114 | "WEAK", "IDENTIFIER", "CHARACTER_LITERAL", "CSTRING_LITERAL", "STRING_LITERAL", 115 | "HEX_LITERAL", "DECIMAL_LITERAL", "OCTAL_LITERAL", "FLOATING_POINT_LITERAL", 116 | "IMPORT", "INCLUDE", "PRAGMA", "WS", "COMMENT", "LINE_COMMENT" 117 | }; 118 | public static final Vocabulary VOCABULARY = new VocabularyImpl(_LITERAL_NAMES, _SYMBOLIC_NAMES); 119 | 120 | /** 121 | * @deprecated Use {@link #VOCABULARY} instead. 122 | */ 123 | @Deprecated 124 | public static final String[] tokenNames; 125 | 126 | static { 127 | tokenNames = new String[_SYMBOLIC_NAMES.length]; 128 | for (int i = 0; i < tokenNames.length; i++) { 129 | tokenNames[i] = VOCABULARY.getLiteralName(i); 130 | if (tokenNames[i] == null) { 131 | tokenNames[i] = VOCABULARY.getSymbolicName(i); 132 | } 133 | 134 | if (tokenNames[i] == null) { 135 | tokenNames[i] = ""; 136 | } 137 | } 138 | } 139 | 140 | @Override 141 | @Deprecated 142 | public String[] getTokenNames() { 143 | return tokenNames; 144 | } 145 | 146 | @Override 147 | 148 | public Vocabulary getVocabulary() { 149 | return VOCABULARY; 150 | } 151 | 152 | 153 | public static final int PREPROCESSER_CHANNEL = 2; 154 | public static final int COMMENT_CHANNEL = 3; 155 | 156 | 157 | public ObjCLexer(CharStream input) { 158 | super(input); 159 | _interp = new LexerATNSimulator(this, _ATN, _decisionToDFA, _sharedContextCache); 160 | } 161 | 162 | @Override 163 | public String getGrammarFileName() { 164 | return "ObjC.g4"; 165 | } 166 | 167 | @Override 168 | public String[] getRuleNames() { 169 | return ruleNames; 170 | } 171 | 172 | @Override 173 | public String getSerializedATN() { 174 | return _serializedATN; 175 | } 176 | 177 | @Override 178 | public String[] getModeNames() { 179 | return modeNames; 180 | } 181 | 182 | @Override 183 | public ATN getATN() { 184 | return _ATN; 185 | } 186 | 187 | @Override 188 | public void action(RuleContext _localctx, int ruleIndex, int actionIndex) { 189 | switch (ruleIndex) { 190 | case 156: 191 | COMMENT_action((RuleContext) _localctx, actionIndex); 192 | break; 193 | case 157: 194 | LINE_COMMENT_action((RuleContext) _localctx, actionIndex); 195 | break; 196 | } 197 | } 198 | 199 | private void COMMENT_action(RuleContext _localctx, int actionIndex) { 200 | switch (actionIndex) { 201 | case 0: 202 | _channel = COMMENT_CHANNEL; 203 | break; 204 | } 205 | } 206 | 207 | private void LINE_COMMENT_action(RuleContext _localctx, int actionIndex) { 208 | switch (actionIndex) { 209 | case 1: 210 | _channel = COMMENT_CHANNEL; 211 | break; 212 | } 213 | } 214 | 215 | public static final String _serializedATN = 216 | "\3\u0430\ud6d1\u8206\uad2d\u4417\uaef1\u8d80\uaadd\2\u0096\u0526\b\1\4" + 217 | "\2\t\2\4\3\t\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\4\t\t\t\4\n\t\n" + 218 | "\4\13\t\13\4\f\t\f\4\r\t\r\4\16\t\16\4\17\t\17\4\20\t\20\4\21\t\21\4\22" + 219 | "\t\22\4\23\t\23\4\24\t\24\4\25\t\25\4\26\t\26\4\27\t\27\4\30\t\30\4\31" + 220 | "\t\31\4\32\t\32\4\33\t\33\4\34\t\34\4\35\t\35\4\36\t\36\4\37\t\37\4 \t" + 221 | " \4!\t!\4\"\t\"\4#\t#\4$\t$\4%\t%\4&\t&\4\'\t\'\4(\t(\4)\t)\4*\t*\4+\t" + 222 | "+\4,\t,\4-\t-\4.\t.\4/\t/\4\60\t\60\4\61\t\61\4\62\t\62\4\63\t\63\4\64" + 223 | "\t\64\4\65\t\65\4\66\t\66\4\67\t\67\48\t8\49\t9\4:\t:\4;\t;\4<\t<\4=\t" + 224 | "=\4>\t>\4?\t?\4@\t@\4A\tA\4B\tB\4C\tC\4D\tD\4E\tE\4F\tF\4G\tG\4H\tH\4" + 225 | "I\tI\4J\tJ\4K\tK\4L\tL\4M\tM\4N\tN\4O\tO\4P\tP\4Q\tQ\4R\tR\4S\tS\4T\t" + 226 | "T\4U\tU\4V\tV\4W\tW\4X\tX\4Y\tY\4Z\tZ\4[\t[\4\\\t\\\4]\t]\4^\t^\4_\t_" + 227 | "\4`\t`\4a\ta\4b\tb\4c\tc\4d\td\4e\te\4f\tf\4g\tg\4h\th\4i\ti\4j\tj\4k" + 228 | "\tk\4l\tl\4m\tm\4n\tn\4o\to\4p\tp\4q\tq\4r\tr\4s\ts\4t\tt\4u\tu\4v\tv" + 229 | "\4w\tw\4x\tx\4y\ty\4z\tz\4{\t{\4|\t|\4}\t}\4~\t~\4\177\t\177\4\u0080\t" + 230 | "\u0080\4\u0081\t\u0081\4\u0082\t\u0082\4\u0083\t\u0083\4\u0084\t\u0084" + 231 | "\4\u0085\t\u0085\4\u0086\t\u0086\4\u0087\t\u0087\4\u0088\t\u0088\4\u0089" + 232 | "\t\u0089\4\u008a\t\u008a\4\u008b\t\u008b\4\u008c\t\u008c\4\u008d\t\u008d" + 233 | "\4\u008e\t\u008e\4\u008f\t\u008f\4\u0090\t\u0090\4\u0091\t\u0091\4\u0092" + 234 | "\t\u0092\4\u0093\t\u0093\4\u0094\t\u0094\4\u0095\t\u0095\4\u0096\t\u0096" + 235 | "\4\u0097\t\u0097\4\u0098\t\u0098\4\u0099\t\u0099\4\u009a\t\u009a\4\u009b" + 236 | "\t\u009b\4\u009c\t\u009c\4\u009d\t\u009d\4\u009e\t\u009e\4\u009f\t\u009f" + 237 | "\3\2\3\2\3\2\3\2\3\2\3\2\3\2\3\3\3\3\3\3\3\3\3\4\3\4\3\4\3\4\3\4\3\4\3" + 238 | "\4\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\5\3\6\3\6\3\6\3\6\3\6\3\6\3\6\3\7\3\7" + 239 | "\3\7\3\7\3\7\3\7\3\7\3\7\3\b\3\b\3\b\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3\t\3" + 240 | "\t\3\t\3\n\3\n\3\n\3\n\3\n\7\n\u017b\n\n\f\n\16\n\u017e\13\n\3\13\3\13" + 241 | "\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13\3\13" + 242 | "\3\13\3\f\3\f\3\f\3\f\3\f\3\f\3\f\3\r\3\r\3\r\3\r\3\r\3\r\3\r\3\16\3\16" + 243 | "\3\16\3\16\3\16\3\16\3\16\3\16\3\16\3\17\3\17\3\17\3\17\3\17\3\17\3\17" + 244 | "\3\17\3\20\3\20\3\20\3\20\3\20\3\21\3\21\3\21\3\21\3\21\3\21\3\21\3\21" + 245 | "\3\21\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22\3\22" + 246 | "\3\22\3\22\3\22\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23\3\23" + 247 | "\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\24\3\25\3\25\3\25\3\25\3\25" + 248 | "\3\25\3\25\3\25\3\25\3\25\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26\3\26" + 249 | "\3\26\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\27\3\30\3\30\3\30\3\30" + 250 | "\3\30\3\30\3\30\3\30\3\30\3\30\3\31\3\31\3\31\3\31\3\31\3\31\3\31\3\31" + 251 | "\3\31\3\31\3\31\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\32\3\33\3\33\3\33" + 252 | "\3\33\3\33\3\33\3\33\3\33\3\33\3\33\3\34\3\34\3\34\3\34\3\34\3\34\3\34" + 253 | "\3\34\3\34\3\34\3\34\3\34\3\34\3\34\3\35\3\35\3\35\3\35\3\35\3\35\3\35" + 254 | "\3\35\3\35\3\35\3\35\3\35\3\36\3\36\3\36\3\36\3\36\3\36\3\36\3\37\3\37" + 255 | "\3\37\3\37\3\37\3 \3 \3 \3 \3 \3 \3!\3!\3!\3!\3!\3\"\3\"\3\"\3\"\3\"\3" + 256 | "\"\3\"\3\"\3\"\3#\3#\3#\3#\3#\3$\3$\3$\3$\3$\3$\3$\3$\3%\3%\3%\3%\3%\3" + 257 | "%\3&\3&\3&\3&\3&\3&\3&\3\'\3\'\3\'\3\'\3\'\3\'\3(\3(\3(\3(\3(\3)\3)\3" + 258 | ")\3)\3)\3*\3*\3*\3*\3*\3*\3+\3+\3+\3+\3+\3+\3+\3+\3+\3,\3,\3,\3,\3,\3" + 259 | ",\3,\3,\3-\3-\3-\3.\3.\3.\3.\3.\3.\3.\3/\3/\3/\3/\3/\3\60\3\60\3\60\3" + 260 | "\60\3\60\3\61\3\61\3\61\3\61\3\61\3\61\3\61\3\62\3\62\3\62\3\62\3\62\3" + 261 | "\62\3\63\3\63\3\63\3\63\3\64\3\64\3\64\3\65\3\65\3\65\3\66\3\66\3\66\3" + 262 | "\67\3\67\3\67\3\67\3\67\3\67\38\38\38\38\38\39\39\39\39\3:\3:\3:\3:\3" + 263 | ":\3;\3;\3;\3;\3;\3;\3;\3<\3<\3<\3<\3=\3=\3=\3=\3=\3=\3=\3=\3=\3>\3>\3" + 264 | ">\3>\3>\3>\3>\3?\3?\3?\3?\3?\3?\3@\3@\3@\3@\3@\3@\3@\3A\3A\3A\3A\3A\3" + 265 | "A\3A\3B\3B\3B\3B\3B\3B\3B\3C\3C\3C\3C\3C\3C\3C\3D\3D\3D\3D\3D\3D\3D\3" + 266 | "E\3E\3E\3E\3E\3E\3E\3E\3F\3F\3F\3F\3F\3F\3G\3G\3G\3G\3G\3G\3G\3G\3G\3" + 267 | "H\3H\3H\3H\3H\3I\3I\3I\3I\3I\3I\3I\3I\3I\3J\3J\3J\3J\3J\3J\3K\3K\3K\3" + 268 | "K\3K\3K\3K\3K\3K\3K\3K\3L\3L\3L\3L\3L\3L\3L\3L\3M\3M\3M\3M\3M\3M\3M\3" + 269 | "N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3N\3O\3O\3O\3" + 270 | "O\3O\3O\3O\3O\3O\3P\3P\3Q\3Q\3R\3R\3S\3S\3T\3T\3U\3U\3V\3V\3W\3W\3X\3" + 271 | "X\3Y\3Y\3Y\3Z\3Z\3[\3[\3\\\3\\\3]\3]\3^\3^\3_\3_\3`\3`\3a\3a\3b\3b\3b" + 272 | "\3c\3c\3c\3d\3d\3d\3e\3e\3e\3f\3f\3f\3g\3g\3g\3h\3h\3h\3i\3i\3i\3j\3j" + 273 | "\3k\3k\3l\3l\3m\3m\3n\3n\3o\3o\3p\3p\3q\3q\3r\3r\3r\3s\3s\3s\3t\3t\3t" + 274 | "\3u\3u\3u\3v\3v\3v\3w\3w\3w\3x\3x\3x\3y\3y\3y\3z\3z\3z\3{\3{\3{\3|\3|" + 275 | "\3|\3|\3}\3}\3}\3}\3~\3~\3~\3~\3\177\3\177\3\177\3\177\3\177\3\177\3\177" + 276 | "\3\u0080\3\u0080\3\u0080\3\u0080\3\u0080\3\u0080\3\u0080\3\u0081\3\u0081" + 277 | "\3\u0081\3\u0081\3\u0081\3\u0081\3\u0081\3\u0081\3\u0081\3\u0081\3\u0082" + 278 | "\3\u0082\3\u0082\3\u0082\3\u0082\3\u0082\3\u0082\3\u0083\3\u0083\3\u0083" + 279 | "\3\u0083\3\u0083\3\u0083\3\u0083\3\u0084\3\u0084\3\u0084\3\u0084\3\u0084" + 280 | "\3\u0084\3\u0084\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085\3\u0085" + 281 | "\3\u0085\3\u0085\3\u0086\3\u0086\3\u0086\3\u0086\3\u0086\3\u0086\3\u0086" + 282 | "\3\u0086\3\u0086\3\u0086\3\u0087\3\u0087\3\u0087\3\u0087\3\u0087\3\u0088" + 283 | "\3\u0088\3\u0088\7\u0088\u0448\n\u0088\f\u0088\16\u0088\u044b\13\u0088" + 284 | "\3\u0089\3\u0089\3\u008a\3\u008a\3\u008a\5\u008a\u0452\n\u008a\3\u008a" + 285 | "\3\u008a\3\u008b\3\u008b\3\u008c\3\u008c\3\u008c\3\u008d\3\u008d\3\u008d" + 286 | "\7\u008d\u045e\n\u008d\f\u008d\16\u008d\u0461\13\u008d\3\u008d\3\u008d" + 287 | "\3\u008e\3\u008e\3\u008e\6\u008e\u0468\n\u008e\r\u008e\16\u008e\u0469" + 288 | "\3\u008e\5\u008e\u046d\n\u008e\3\u008f\3\u008f\3\u008f\7\u008f\u0472\n" + 289 | "\u008f\f\u008f\16\u008f\u0475\13\u008f\5\u008f\u0477\n\u008f\3\u008f\5" + 290 | "\u008f\u047a\n\u008f\3\u0090\3\u0090\6\u0090\u047e\n\u0090\r\u0090\16" + 291 | "\u0090\u047f\3\u0090\5\u0090\u0483\n\u0090\3\u0091\3\u0091\3\u0092\3\u0092" + 292 | "\3\u0092\3\u0092\3\u0092\5\u0092\u048c\n\u0092\3\u0093\6\u0093\u048f\n" + 293 | "\u0093\r\u0093\16\u0093\u0490\3\u0093\3\u0093\7\u0093\u0495\n\u0093\f" + 294 | "\u0093\16\u0093\u0498\13\u0093\5\u0093\u049a\n\u0093\3\u0093\5\u0093\u049d" + 295 | "\n\u0093\3\u0093\5\u0093\u04a0\n\u0093\3\u0094\3\u0094\5\u0094\u04a4\n" + 296 | "\u0094\3\u0094\6\u0094\u04a7\n\u0094\r\u0094\16\u0094\u04a8\3\u0095\3" + 297 | "\u0095\3\u0096\3\u0096\3\u0096\5\u0096\u04b0\n\u0096\3\u0097\3\u0097\3" + 298 | "\u0097\3\u0097\3\u0097\3\u0097\3\u0097\3\u0097\3\u0097\5\u0097\u04bb\n" + 299 | "\u0097\3\u0098\3\u0098\3\u0098\3\u0098\3\u0098\3\u0098\3\u0098\3\u0099" + 300 | "\3\u0099\3\u0099\3\u0099\3\u0099\3\u0099\3\u0099\3\u0099\3\u0099\7\u0099" + 301 | "\u04cd\n\u0099\f\u0099\16\u0099\u04d0\13\u0099\3\u0099\3\u0099\5\u0099" + 302 | "\u04d4\n\u0099\3\u0099\3\u0099\3\u0099\3\u0099\3\u009a\3\u009a\3\u009a" + 303 | "\3\u009a\3\u009a\3\u009a\3\u009a\3\u009a\3\u009a\3\u009a\7\u009a\u04e4" + 304 | "\n\u009a\f\u009a\16\u009a\u04e7\13\u009a\3\u009a\3\u009a\5\u009a\u04eb" + 305 | "\n\u009a\3\u009a\3\u009a\3\u009a\3\u009a\3\u009b\3\u009b\3\u009b\3\u009b" + 306 | "\3\u009b\3\u009b\3\u009b\3\u009b\3\u009b\7\u009b\u04fa\n\u009b\f\u009b" + 307 | "\16\u009b\u04fd\13\u009b\3\u009b\3\u009b\3\u009c\3\u009c\7\u009c\u0503" + 308 | "\n\u009c\f\u009c\16\u009c\u0506\13\u009c\3\u009c\3\u009c\3\u009d\3\u009d" + 309 | "\3\u009d\3\u009d\3\u009e\3\u009e\3\u009e\3\u009e\7\u009e\u0512\n\u009e" + 310 | "\f\u009e\16\u009e\u0515\13\u009e\3\u009e\3\u009e\3\u009e\3\u009e\3\u009e" + 311 | "\3\u009f\3\u009f\3\u009f\3\u009f\7\u009f\u0520\n\u009f\f\u009f\16\u009f" + 312 | "\u0523\13\u009f\3\u009f\3\u009f\4\u0504\u0513\2\u00a0\3\3\5\4\7\5\t\6" + 313 | "\13\7\r\b\17\t\21\n\23\13\25\f\27\r\31\16\33\17\35\20\37\21!\22#\23%\24" + 314 | "\'\25)\26+\27-\30/\31\61\32\63\33\65\34\67\359\36;\37= ?!A\"C#E$G%I&K" + 315 | "\'M(O)Q*S+U,W-Y.[/]\60_\61a\62c\63e\64g\65i\66k\67m8o9q:s;u{?}@\177" + 316 | "A\u0081B\u0083C\u0085D\u0087E\u0089F\u008bG\u008dH\u008fI\u0091J\u0093" + 317 | "K\u0095L\u0097M\u0099N\u009bO\u009dP\u009fQ\u00a1R\u00a3S\u00a5T\u00a7" + 318 | "U\u00a9V\u00abW\u00adX\u00afY\u00b1Z\u00b3[\u00b5\\\u00b7]\u00b9^\u00bb" + 319 | "_\u00bd`\u00bfa\u00c1b\u00c3c\u00c5d\u00c7e\u00c9f\u00cbg\u00cdh\u00cf" + 320 | "i\u00d1j\u00d3k\u00d5l\u00d7m\u00d9n\u00dbo\u00ddp\u00dfq\u00e1r\u00e3" + 321 | "s\u00e5t\u00e7u\u00e9v\u00ebw\u00edx\u00efy\u00f1z\u00f3{\u00f5|\u00f7" + 322 | "}\u00f9~\u00fb\177\u00fd\u0080\u00ff\u0081\u0101\u0082\u0103\u0083\u0105" + 323 | "\u0084\u0107\u0085\u0109\u0086\u010b\u0087\u010d\u0088\u010f\u0089\u0111" + 324 | "\2\u0113\u008a\u0115\u008b\u0117\u008c\u0119\2\u011b\u008d\u011d\u008e" + 325 | "\u011f\u008f\u0121\2\u0123\2\u0125\u0090\u0127\2\u0129\2\u012b\2\u012d" + 326 | "\2\u012f\2\u0131\u0091\u0133\u0092\u0135\u0093\u0137\2\u0139\u0094\u013b" + 327 | "\u0095\u013d\u0096\3\2\20\6\2&&C\\aac|\4\2))^^\4\2BBNN\4\2$$^^\4\2ZZz" + 328 | "z\5\2\62;CHch\6\2NNWWnnww\4\2GGgg\4\2--//\6\2FFHHffhh\n\2$$))^^ddhhpp" + 329 | "ttvv\4\2\13\13\"\"\4\2\f\f\17\17\5\2\13\f\16\17\"\"\u053c\2\3\3\2\2\2" + 330 | "\2\5\3\2\2\2\2\7\3\2\2\2\2\t\3\2\2\2\2\13\3\2\2\2\2\r\3\2\2\2\2\17\3\2" + 331 | "\2\2\2\21\3\2\2\2\2\23\3\2\2\2\2\25\3\2\2\2\2\27\3\2\2\2\2\31\3\2\2\2" + 332 | "\2\33\3\2\2\2\2\35\3\2\2\2\2\37\3\2\2\2\2!\3\2\2\2\2#\3\2\2\2\2%\3\2\2" + 333 | "\2\2\'\3\2\2\2\2)\3\2\2\2\2+\3\2\2\2\2-\3\2\2\2\2/\3\2\2\2\2\61\3\2\2" + 334 | "\2\2\63\3\2\2\2\2\65\3\2\2\2\2\67\3\2\2\2\29\3\2\2\2\2;\3\2\2\2\2=\3\2" + 335 | "\2\2\2?\3\2\2\2\2A\3\2\2\2\2C\3\2\2\2\2E\3\2\2\2\2G\3\2\2\2\2I\3\2\2\2" + 336 | "\2K\3\2\2\2\2M\3\2\2\2\2O\3\2\2\2\2Q\3\2\2\2\2S\3\2\2\2\2U\3\2\2\2\2W" + 337 | "\3\2\2\2\2Y\3\2\2\2\2[\3\2\2\2\2]\3\2\2\2\2_\3\2\2\2\2a\3\2\2\2\2c\3\2" + 338 | "\2\2\2e\3\2\2\2\2g\3\2\2\2\2i\3\2\2\2\2k\3\2\2\2\2m\3\2\2\2\2o\3\2\2\2" + 339 | "\2q\3\2\2\2\2s\3\2\2\2\2u\3\2\2\2\2w\3\2\2\2\2y\3\2\2\2\2{\3\2\2\2\2}" + 340 | "\3\2\2\2\2\177\3\2\2\2\2\u0081\3\2\2\2\2\u0083\3\2\2\2\2\u0085\3\2\2\2" + 341 | "\2\u0087\3\2\2\2\2\u0089\3\2\2\2\2\u008b\3\2\2\2\2\u008d\3\2\2\2\2\u008f" + 342 | "\3\2\2\2\2\u0091\3\2\2\2\2\u0093\3\2\2\2\2\u0095\3\2\2\2\2\u0097\3\2\2" + 343 | "\2\2\u0099\3\2\2\2\2\u009b\3\2\2\2\2\u009d\3\2\2\2\2\u009f\3\2\2\2\2\u00a1" + 344 | "\3\2\2\2\2\u00a3\3\2\2\2\2\u00a5\3\2\2\2\2\u00a7\3\2\2\2\2\u00a9\3\2\2" + 345 | "\2\2\u00ab\3\2\2\2\2\u00ad\3\2\2\2\2\u00af\3\2\2\2\2\u00b1\3\2\2\2\2\u00b3" + 346 | "\3\2\2\2\2\u00b5\3\2\2\2\2\u00b7\3\2\2\2\2\u00b9\3\2\2\2\2\u00bb\3\2\2" + 347 | "\2\2\u00bd\3\2\2\2\2\u00bf\3\2\2\2\2\u00c1\3\2\2\2\2\u00c3\3\2\2\2\2\u00c5" + 348 | "\3\2\2\2\2\u00c7\3\2\2\2\2\u00c9\3\2\2\2\2\u00cb\3\2\2\2\2\u00cd\3\2\2" + 349 | "\2\2\u00cf\3\2\2\2\2\u00d1\3\2\2\2\2\u00d3\3\2\2\2\2\u00d5\3\2\2\2\2\u00d7" + 350 | "\3\2\2\2\2\u00d9\3\2\2\2\2\u00db\3\2\2\2\2\u00dd\3\2\2\2\2\u00df\3\2\2" + 351 | "\2\2\u00e1\3\2\2\2\2\u00e3\3\2\2\2\2\u00e5\3\2\2\2\2\u00e7\3\2\2\2\2\u00e9" + 352 | "\3\2\2\2\2\u00eb\3\2\2\2\2\u00ed\3\2\2\2\2\u00ef\3\2\2\2\2\u00f1\3\2\2" + 353 | "\2\2\u00f3\3\2\2\2\2\u00f5\3\2\2\2\2\u00f7\3\2\2\2\2\u00f9\3\2\2\2\2\u00fb" + 354 | "\3\2\2\2\2\u00fd\3\2\2\2\2\u00ff\3\2\2\2\2\u0101\3\2\2\2\2\u0103\3\2\2" + 355 | "\2\2\u0105\3\2\2\2\2\u0107\3\2\2\2\2\u0109\3\2\2\2\2\u010b\3\2\2\2\2\u010d" + 356 | "\3\2\2\2\2\u010f\3\2\2\2\2\u0113\3\2\2\2\2\u0115\3\2\2\2\2\u0117\3\2\2" + 357 | "\2\2\u011b\3\2\2\2\2\u011d\3\2\2\2\2\u011f\3\2\2\2\2\u0125\3\2\2\2\2\u0131" + 358 | "\3\2\2\2\2\u0133\3\2\2\2\2\u0135\3\2\2\2\2\u0139\3\2\2\2\2\u013b\3\2\2" + 359 | "\2\2\u013d\3\2\2\2\3\u013f\3\2\2\2\5\u0146\3\2\2\2\7\u014a\3\2\2\2\t\u0151" + 360 | "\3\2\2\2\13\u0159\3\2\2\2\r\u0160\3\2\2\2\17\u0168\3\2\2\2\21\u016b\3" + 361 | "\2\2\2\23\u0175\3\2\2\2\25\u017f\3\2\2\2\27\u0190\3\2\2\2\31\u0197\3\2" + 362 | "\2\2\33\u019e\3\2\2\2\35\u01a7\3\2\2\2\37\u01af\3\2\2\2!\u01b4\3\2\2\2" + 363 | "#\u01bd\3\2\2\2%\u01cd\3\2\2\2\'\u01d8\3\2\2\2)\u01e1\3\2\2\2+\u01eb\3" + 364 | "\2\2\2-\u01f5\3\2\2\2/\u01fe\3\2\2\2\61\u0208\3\2\2\2\63\u0213\3\2\2\2" + 365 | "\65\u021b\3\2\2\2\67\u0225\3\2\2\29\u0233\3\2\2\2;\u023f\3\2\2\2=\u0246" + 366 | "\3\2\2\2?\u024b\3\2\2\2A\u0251\3\2\2\2C\u0256\3\2\2\2E\u025f\3\2\2\2G" + 367 | "\u0264\3\2\2\2I\u026c\3\2\2\2K\u0272\3\2\2\2M\u0279\3\2\2\2O\u027f\3\2" + 368 | "\2\2Q\u0284\3\2\2\2S\u0289\3\2\2\2U\u028f\3\2\2\2W\u0298\3\2\2\2Y\u02a0" + 369 | "\3\2\2\2[\u02a3\3\2\2\2]\u02aa\3\2\2\2_\u02af\3\2\2\2a\u02b4\3\2\2\2c" + 370 | "\u02bb\3\2\2\2e\u02c1\3\2\2\2g\u02c5\3\2\2\2i\u02c8\3\2\2\2k\u02cb\3\2" + 371 | "\2\2m\u02ce\3\2\2\2o\u02d4\3\2\2\2q\u02d9\3\2\2\2s\u02dd\3\2\2\2u\u02e2" + 372 | "\3\2\2\2w\u02e9\3\2\2\2y\u02ed\3\2\2\2{\u02f6\3\2\2\2}\u02fd\3\2\2\2\177" + 373 | "\u0303\3\2\2\2\u0081\u030a\3\2\2\2\u0083\u0311\3\2\2\2\u0085\u0318\3\2" + 374 | "\2\2\u0087\u031f\3\2\2\2\u0089\u0326\3\2\2\2\u008b\u032e\3\2\2\2\u008d" + 375 | "\u0334\3\2\2\2\u008f\u033d\3\2\2\2\u0091\u0342\3\2\2\2\u0093\u034b\3\2" + 376 | "\2\2\u0095\u0351\3\2\2\2\u0097\u035c\3\2\2\2\u0099\u0364\3\2\2\2\u009b" + 377 | "\u036b\3\2\2\2\u009d\u037f\3\2\2\2\u009f\u0388\3\2\2\2\u00a1\u038a\3\2" + 378 | "\2\2\u00a3\u038c\3\2\2\2\u00a5\u038e\3\2\2\2\u00a7\u0390\3\2\2\2\u00a9" + 379 | "\u0392\3\2\2\2\u00ab\u0394\3\2\2\2\u00ad\u0396\3\2\2\2\u00af\u0398\3\2" + 380 | "\2\2\u00b1\u039a\3\2\2\2\u00b3\u039d\3\2\2\2\u00b5\u039f\3\2\2\2\u00b7" + 381 | "\u03a1\3\2\2\2\u00b9\u03a3\3\2\2\2\u00bb\u03a5\3\2\2\2\u00bd\u03a7\3\2" + 382 | "\2\2\u00bf\u03a9\3\2\2\2\u00c1\u03ab\3\2\2\2\u00c3\u03ad\3\2\2\2\u00c5" + 383 | "\u03b0\3\2\2\2\u00c7\u03b3\3\2\2\2\u00c9\u03b6\3\2\2\2\u00cb\u03b9\3\2" + 384 | "\2\2\u00cd\u03bc\3\2\2\2\u00cf\u03bf\3\2\2\2\u00d1\u03c2\3\2\2\2\u00d3" + 385 | "\u03c5\3\2\2\2\u00d5\u03c7\3\2\2\2\u00d7\u03c9\3\2\2\2\u00d9\u03cb\3\2" + 386 | "\2\2\u00db\u03cd\3\2\2\2\u00dd\u03cf\3\2\2\2\u00df\u03d1\3\2\2\2\u00e1" + 387 | "\u03d3\3\2\2\2\u00e3\u03d5\3\2\2\2\u00e5\u03d8\3\2\2\2\u00e7\u03db\3\2" + 388 | "\2\2\u00e9\u03de\3\2\2\2\u00eb\u03e1\3\2\2\2\u00ed\u03e4\3\2\2\2\u00ef" + 389 | "\u03e7\3\2\2\2\u00f1\u03ea\3\2\2\2\u00f3\u03ed\3\2\2\2\u00f5\u03f0\3\2" + 390 | "\2\2\u00f7\u03f3\3\2\2\2\u00f9\u03f7\3\2\2\2\u00fb\u03fb\3\2\2\2\u00fd" + 391 | "\u03ff\3\2\2\2\u00ff\u0406\3\2\2\2\u0101\u040d\3\2\2\2\u0103\u0417\3\2" + 392 | "\2\2\u0105\u041e\3\2\2\2\u0107\u0425\3\2\2\2\u0109\u042c\3\2\2\2\u010b" + 393 | "\u0435\3\2\2\2\u010d\u043f\3\2\2\2\u010f\u0444\3\2\2\2\u0111\u044c\3\2" + 394 | "\2\2\u0113\u044e\3\2\2\2\u0115\u0455\3\2\2\2\u0117\u0457\3\2\2\2\u0119" + 395 | "\u045a\3\2\2\2\u011b\u0464\3\2\2\2\u011d\u0476\3\2\2\2\u011f\u047b\3\2" + 396 | "\2\2\u0121\u0484\3\2\2\2\u0123\u048b\3\2\2\2\u0125\u048e\3\2\2\2\u0127" + 397 | "\u04a1\3\2\2\2\u0129\u04aa\3\2\2\2\u012b\u04af\3\2\2\2\u012d\u04ba\3\2" + 398 | "\2\2\u012f\u04bc\3\2\2\2\u0131\u04c3\3\2\2\2\u0133\u04d9\3\2\2\2\u0135" + 399 | "\u04f0\3\2\2\2\u0137\u0500\3\2\2\2\u0139\u0509\3\2\2\2\u013b\u050d\3\2" + 400 | "\2\2\u013d\u051b\3\2\2\2\u013f\u0140\7%\2\2\u0140\u0141\7k\2\2\u0141\u0142" + 401 | "\7h\2\2\u0142\u0143\7f\2\2\u0143\u0144\7g\2\2\u0144\u0145\7h\2\2\u0145" + 402 | "\4\3\2\2\2\u0146\u0147\7%\2\2\u0147\u0148\7k\2\2\u0148\u0149\7h\2\2\u0149" + 403 | "\6\3\2\2\2\u014a\u014b\7%\2\2\u014b\u014c\7w\2\2\u014c\u014d\7p\2\2\u014d" + 404 | "\u014e\7f\2\2\u014e\u014f\7g\2\2\u014f\u0150\7h\2\2\u0150\b\3\2\2\2\u0151" + 405 | "\u0152\7%\2\2\u0152\u0153\7k\2\2\u0153\u0154\7h\2\2\u0154\u0155\7p\2\2" + 406 | "\u0155\u0156\7f\2\2\u0156\u0157\7g\2\2\u0157\u0158\7h\2\2\u0158\n\3\2" + 407 | "\2\2\u0159\u015a\7%\2\2\u015a\u015b\7g\2\2\u015b\u015c\7p\2\2\u015c\u015d" + 408 | "\7f\2\2\u015d\u015e\7k\2\2\u015e\u015f\7h\2\2\u015f\f\3\2\2\2\u0160\u0161" + 409 | "\7%\2\2\u0161\u0162\7f\2\2\u0162\u0163\7g\2\2\u0163\u0164\7h\2\2\u0164" + 410 | "\u0165\7k\2\2\u0165\u0166\7p\2\2\u0166\u0167\7g\2\2\u0167\16\3\2\2\2\u0168" + 411 | "\u0169\7\60\2\2\u0169\u016a\7-\2\2\u016a\20\3\2\2\2\u016b\u016c\7B\2\2" + 412 | "\u016c\u016d\7t\2\2\u016d\u016e\7g\2\2\u016e\u016f\7s\2\2\u016f\u0170" + 413 | "\7w\2\2\u0170\u0171\7k\2\2\u0171\u0172\7t\2\2\u0172\u0173\7g\2\2\u0173" + 414 | "\u0174\7f\2\2\u0174\22\3\2\2\2\u0175\u0176\5\u010f\u0088\2\u0176\u0177" + 415 | "\7\60\2\2\u0177\u017c\5\u010f\u0088\2\u0178\u0179\7\60\2\2\u0179\u017b" + 416 | "\5\u010f\u0088\2\u017a\u0178\3\2\2\2\u017b\u017e\3\2\2\2\u017c\u017a\3" + 417 | "\2\2\2\u017c\u017d\3\2\2\2\u017d\24\3\2\2\2\u017e\u017c\3\2\2\2\u017f" + 418 | "\u0180\7B\2\2\u0180\u0181\7c\2\2\u0181\u0182\7w\2\2\u0182\u0183\7v\2\2" + 419 | "\u0183\u0184\7q\2\2\u0184\u0185\7t\2\2\u0185\u0186\7g\2\2\u0186\u0187" + 420 | "\7n\2\2\u0187\u0188\7g\2\2\u0188\u0189\7c\2\2\u0189\u018a\7u\2\2\u018a" + 421 | "\u018b\7g\2\2\u018b\u018c\7r\2\2\u018c\u018d\7q\2\2\u018d\u018e\7q\2\2" + 422 | "\u018e\u018f\7n\2\2\u018f\26\3\2\2\2\u0190\u0191\7B\2\2\u0191\u0192\7" + 423 | "e\2\2\u0192\u0193\7c\2\2\u0193\u0194\7v\2\2\u0194\u0195\7e\2\2\u0195\u0196" + 424 | "\7j\2\2\u0196\30\3\2\2\2\u0197\u0198\7B\2\2\u0198\u0199\7e\2\2\u0199\u019a" + 425 | "\7n\2\2\u019a\u019b\7c\2\2\u019b\u019c\7u\2\2\u019c\u019d\7u\2\2\u019d" + 426 | "\32\3\2\2\2\u019e\u019f\7B\2\2\u019f\u01a0\7f\2\2\u01a0\u01a1\7{\2\2\u01a1" + 427 | "\u01a2\7p\2\2\u01a2\u01a3\7c\2\2\u01a3\u01a4\7o\2\2\u01a4\u01a5\7k\2\2" + 428 | "\u01a5\u01a6\7e\2\2\u01a6\34\3\2\2\2\u01a7\u01a8\7B\2\2\u01a8\u01a9\7" + 429 | "g\2\2\u01a9\u01aa\7p\2\2\u01aa\u01ab\7e\2\2\u01ab\u01ac\7q\2\2\u01ac\u01ad" + 430 | "\7f\2\2\u01ad\u01ae\7g\2\2\u01ae\36\3\2\2\2\u01af\u01b0\7B\2\2\u01b0\u01b1" + 431 | "\7g\2\2\u01b1\u01b2\7p\2\2\u01b2\u01b3\7f\2\2\u01b3 \3\2\2\2\u01b4\u01b5" + 432 | "\7B\2\2\u01b5\u01b6\7h\2\2\u01b6\u01b7\7k\2\2\u01b7\u01b8\7p\2\2\u01b8" + 433 | "\u01b9\7c\2\2\u01b9\u01ba\7n\2\2\u01ba\u01bb\7n\2\2\u01bb\u01bc\7{\2\2" + 434 | "\u01bc\"\3\2\2\2\u01bd\u01be\7B\2\2\u01be\u01bf\7k\2\2\u01bf\u01c0\7o" + 435 | "\2\2\u01c0\u01c1\7r\2\2\u01c1\u01c2\7n\2\2\u01c2\u01c3\7g\2\2\u01c3\u01c4" + 436 | "\7o\2\2\u01c4\u01c5\7g\2\2\u01c5\u01c6\7p\2\2\u01c6\u01c7\7v\2\2\u01c7" + 437 | "\u01c8\7c\2\2\u01c8\u01c9\7v\2\2\u01c9\u01ca\7k\2\2\u01ca\u01cb\7q\2\2" + 438 | "\u01cb\u01cc\7p\2\2\u01cc$\3\2\2\2\u01cd\u01ce\7B\2\2\u01ce\u01cf\7k\2" + 439 | "\2\u01cf\u01d0\7p\2\2\u01d0\u01d1\7v\2\2\u01d1\u01d2\7g\2\2\u01d2\u01d3" + 440 | "\7t\2\2\u01d3\u01d4\7h\2\2\u01d4\u01d5\7c\2\2\u01d5\u01d6\7e\2\2\u01d6" + 441 | "\u01d7\7g\2\2\u01d7&\3\2\2\2\u01d8\u01d9\7B\2\2\u01d9\u01da\7r\2\2\u01da" + 442 | "\u01db\7c\2\2\u01db\u01dc\7e\2\2\u01dc\u01dd\7m\2\2\u01dd\u01de\7c\2\2" + 443 | "\u01de\u01df\7i\2\2\u01df\u01e0\7g\2\2\u01e0(\3\2\2\2\u01e1\u01e2\7B\2" + 444 | "\2\u01e2\u01e3\7r\2\2\u01e3\u01e4\7t\2\2\u01e4\u01e5\7q\2\2\u01e5\u01e6" + 445 | "\7v\2\2\u01e6\u01e7\7q\2\2\u01e7\u01e8\7e\2\2\u01e8\u01e9\7q\2\2\u01e9" + 446 | "\u01ea\7n\2\2\u01ea*\3\2\2\2\u01eb\u01ec\7B\2\2\u01ec\u01ed\7q\2\2\u01ed" + 447 | "\u01ee\7r\2\2\u01ee\u01ef\7v\2\2\u01ef\u01f0\7k\2\2\u01f0\u01f1\7q\2\2" + 448 | "\u01f1\u01f2\7p\2\2\u01f2\u01f3\7c\2\2\u01f3\u01f4\7n\2\2\u01f4,\3\2\2" + 449 | "\2\u01f5\u01f6\7B\2\2\u01f6\u01f7\7r\2\2\u01f7\u01f8\7t\2\2\u01f8\u01f9" + 450 | "\7k\2\2\u01f9\u01fa\7x\2\2\u01fa\u01fb\7c\2\2\u01fb\u01fc\7v\2\2\u01fc" + 451 | "\u01fd\7g\2\2\u01fd.\3\2\2\2\u01fe\u01ff\7B\2\2\u01ff\u0200\7r\2\2\u0200" + 452 | "\u0201\7t\2\2\u0201\u0202\7q\2\2\u0202\u0203\7r\2\2\u0203\u0204\7g\2\2" + 453 | "\u0204\u0205\7t\2\2\u0205\u0206\7v\2\2\u0206\u0207\7{\2\2\u0207\60\3\2" + 454 | "\2\2\u0208\u0209\7B\2\2\u0209\u020a\7r\2\2\u020a\u020b\7t\2\2\u020b\u020c" + 455 | "\7q\2\2\u020c\u020d\7v\2\2\u020d\u020e\7g\2\2\u020e\u020f\7e\2\2\u020f" + 456 | "\u0210\7v\2\2\u0210\u0211\7g\2\2\u0211\u0212\7f\2\2\u0212\62\3\2\2\2\u0213" + 457 | "\u0214\7B\2\2\u0214\u0215\7r\2\2\u0215\u0216\7w\2\2\u0216\u0217\7d\2\2" + 458 | "\u0217\u0218\7n\2\2\u0218\u0219\7k\2\2\u0219\u021a\7e\2\2\u021a\64\3\2" + 459 | "\2\2\u021b\u021c\7B\2\2\u021c\u021d\7u\2\2\u021d\u021e\7g\2\2\u021e\u021f" + 460 | "\7n\2\2\u021f\u0220\7g\2\2\u0220\u0221\7e\2\2\u0221\u0222\7v\2\2\u0222" + 461 | "\u0223\7q\2\2\u0223\u0224\7t\2\2\u0224\66\3\2\2\2\u0225\u0226\7B\2\2\u0226" + 462 | "\u0227\7u\2\2\u0227\u0228\7{\2\2\u0228\u0229\7p\2\2\u0229\u022a\7e\2\2" + 463 | "\u022a\u022b\7j\2\2\u022b\u022c\7t\2\2\u022c\u022d\7q\2\2\u022d\u022e" + 464 | "\7p\2\2\u022e\u022f\7k\2\2\u022f\u0230\7|\2\2\u0230\u0231\7g\2\2\u0231" + 465 | "\u0232\7f\2\2\u02328\3\2\2\2\u0233\u0234\7B\2\2\u0234\u0235\7u\2\2\u0235" + 466 | "\u0236\7{\2\2\u0236\u0237\7p\2\2\u0237\u0238\7v\2\2\u0238\u0239\7j\2\2" + 467 | "\u0239\u023a\7g\2\2\u023a\u023b\7u\2\2\u023b\u023c\7k\2\2\u023c\u023d" + 468 | "\7|\2\2\u023d\u023e\7g\2\2\u023e:\3\2\2\2\u023f\u0240\7B\2\2\u0240\u0241" + 469 | "\7v\2\2\u0241\u0242\7j\2\2\u0242\u0243\7t\2\2\u0243\u0244\7q\2\2\u0244" + 470 | "\u0245\7y\2\2\u0245<\3\2\2\2\u0246\u0247\7B\2\2\u0247\u0248\7v\2\2\u0248" + 471 | "\u0249\7t\2\2\u0249\u024a\7{\2\2\u024a>\3\2\2\2\u024b\u024c\7u\2\2\u024c" + 472 | "\u024d\7w\2\2\u024d\u024e\7r\2\2\u024e\u024f\7g\2\2\u024f\u0250\7t\2\2" + 473 | "\u0250@\3\2\2\2\u0251\u0252\7u\2\2\u0252\u0253\7g\2\2\u0253\u0254\7n\2" + 474 | "\2\u0254\u0255\7h\2\2\u0255B\3\2\2\2\u0256\u0257\7c\2\2\u0257\u0258\7" + 475 | "d\2\2\u0258\u0259\7u\2\2\u0259\u025a\7v\2\2\u025a\u025b\7t\2\2\u025b\u025c" + 476 | "\7c\2\2\u025c\u025d\7e\2\2\u025d\u025e\7v\2\2\u025eD\3\2\2\2\u025f\u0260" + 477 | "\7c\2\2\u0260\u0261\7w\2\2\u0261\u0262\7v\2\2\u0262\u0263\7q\2\2\u0263" + 478 | "F\3\2\2\2\u0264\u0265\7d\2\2\u0265\u0266\7q\2\2\u0266\u0267\7q\2\2\u0267" + 479 | "\u0268\7n\2\2\u0268\u0269\7g\2\2\u0269\u026a\7c\2\2\u026a\u026b\7p\2\2" + 480 | "\u026bH\3\2\2\2\u026c\u026d\7d\2\2\u026d\u026e\7t\2\2\u026e\u026f\7g\2" + 481 | "\2\u026f\u0270\7c\2\2\u0270\u0271\7m\2\2\u0271J\3\2\2\2\u0272\u0273\7" + 482 | "d\2\2\u0273\u0274\7{\2\2\u0274\u0275\7e\2\2\u0275\u0276\7q\2\2\u0276\u0277" + 483 | "\7r\2\2\u0277\u0278\7{\2\2\u0278L\3\2\2\2\u0279\u027a\7d\2\2\u027a\u027b" + 484 | "\7{\2\2\u027b\u027c\7t\2\2\u027c\u027d\7g\2\2\u027d\u027e\7h\2\2\u027e" + 485 | "N\3\2\2\2\u027f\u0280\7e\2\2\u0280\u0281\7c\2\2\u0281\u0282\7u\2\2\u0282" + 486 | "\u0283\7g\2\2\u0283P\3\2\2\2\u0284\u0285\7e\2\2\u0285\u0286\7j\2\2\u0286" + 487 | "\u0287\7c\2\2\u0287\u0288\7t\2\2\u0288R\3\2\2\2\u0289\u028a\7e\2\2\u028a" + 488 | "\u028b\7q\2\2\u028b\u028c\7p\2\2\u028c\u028d\7u\2\2\u028d\u028e\7v\2\2" + 489 | "\u028eT\3\2\2\2\u028f\u0290\7e\2\2\u0290\u0291\7q\2\2\u0291\u0292\7p\2" + 490 | "\2\u0292\u0293\7v\2\2\u0293\u0294\7k\2\2\u0294\u0295\7p\2\2\u0295\u0296" + 491 | "\7w\2\2\u0296\u0297\7g\2\2\u0297V\3\2\2\2\u0298\u0299\7f\2\2\u0299\u029a" + 492 | "\7g\2\2\u029a\u029b\7h\2\2\u029b\u029c\7c\2\2\u029c\u029d\7w\2\2\u029d" + 493 | "\u029e\7n\2\2\u029e\u029f\7v\2\2\u029fX\3\2\2\2\u02a0\u02a1\7f\2\2\u02a1" + 494 | "\u02a2\7q\2\2\u02a2Z\3\2\2\2\u02a3\u02a4\7f\2\2\u02a4\u02a5\7q\2\2\u02a5" + 495 | "\u02a6\7w\2\2\u02a6\u02a7\7d\2\2\u02a7\u02a8\7n\2\2\u02a8\u02a9\7g\2\2" + 496 | "\u02a9\\\3\2\2\2\u02aa\u02ab\7g\2\2\u02ab\u02ac\7n\2\2\u02ac\u02ad\7u" + 497 | "\2\2\u02ad\u02ae\7g\2\2\u02ae^\3\2\2\2\u02af\u02b0\7g\2\2\u02b0\u02b1" + 498 | "\7p\2\2\u02b1\u02b2\7w\2\2\u02b2\u02b3\7o\2\2\u02b3`\3\2\2\2\u02b4\u02b5" + 499 | "\7g\2\2\u02b5\u02b6\7z\2\2\u02b6\u02b7\7v\2\2\u02b7\u02b8\7g\2\2\u02b8" + 500 | "\u02b9\7t\2\2\u02b9\u02ba\7p\2\2\u02bab\3\2\2\2\u02bb\u02bc\7h\2\2\u02bc" + 501 | "\u02bd\7n\2\2\u02bd\u02be\7q\2\2\u02be\u02bf\7c\2\2\u02bf\u02c0\7v\2\2" + 502 | "\u02c0d\3\2\2\2\u02c1\u02c2\7h\2\2\u02c2\u02c3\7q\2\2\u02c3\u02c4\7t\2" + 503 | "\2\u02c4f\3\2\2\2\u02c5\u02c6\7k\2\2\u02c6\u02c7\7f\2\2\u02c7h\3\2\2\2" + 504 | "\u02c8\u02c9\7k\2\2\u02c9\u02ca\7h\2\2\u02caj\3\2\2\2\u02cb\u02cc\7k\2" + 505 | "\2\u02cc\u02cd\7p\2\2\u02cdl\3\2\2\2\u02ce\u02cf\7k\2\2\u02cf\u02d0\7" + 506 | "p\2\2\u02d0\u02d1\7q\2\2\u02d1\u02d2\7w\2\2\u02d2\u02d3\7v\2\2\u02d3n" + 507 | "\3\2\2\2\u02d4\u02d5\7i\2\2\u02d5\u02d6\7q\2\2\u02d6\u02d7\7v\2\2\u02d7" + 508 | "\u02d8\7q\2\2\u02d8p\3\2\2\2\u02d9\u02da\7k\2\2\u02da\u02db\7p\2\2\u02db" + 509 | "\u02dc\7v\2\2\u02dcr\3\2\2\2\u02dd\u02de\7n\2\2\u02de\u02df\7q\2\2\u02df" + 510 | "\u02e0\7p\2\2\u02e0\u02e1\7i\2\2\u02e1t\3\2\2\2\u02e2\u02e3\7q\2\2\u02e3" + 511 | "\u02e4\7p\2\2\u02e4\u02e5\7g\2\2\u02e5\u02e6\7y\2\2\u02e6\u02e7\7c\2\2" + 512 | "\u02e7\u02e8\7{\2\2\u02e8v\3\2\2\2\u02e9\u02ea\7q\2\2\u02ea\u02eb\7w\2" + 513 | "\2\u02eb\u02ec\7v\2\2\u02ecx\3\2\2\2\u02ed\u02ee\7t\2\2\u02ee\u02ef\7" + 514 | "g\2\2\u02ef\u02f0\7i\2\2\u02f0\u02f1\7k\2\2\u02f1\u02f2\7u\2\2\u02f2\u02f3" + 515 | "\7v\2\2\u02f3\u02f4\7g\2\2\u02f4\u02f5\7t\2\2\u02f5z\3\2\2\2\u02f6\u02f7" + 516 | "\7t\2\2\u02f7\u02f8\7g\2\2\u02f8\u02f9\7v\2\2\u02f9\u02fa\7w\2\2\u02fa" + 517 | "\u02fb\7t\2\2\u02fb\u02fc\7p\2\2\u02fc|\3\2\2\2\u02fd\u02fe\7u\2\2\u02fe" + 518 | "\u02ff\7j\2\2\u02ff\u0300\7q\2\2\u0300\u0301\7t\2\2\u0301\u0302\7v\2\2" + 519 | "\u0302~\3\2\2\2\u0303\u0304\7u\2\2\u0304\u0305\7k\2\2\u0305\u0306\7i\2" + 520 | "\2\u0306\u0307\7p\2\2\u0307\u0308\7g\2\2\u0308\u0309\7f\2\2\u0309\u0080" + 521 | "\3\2\2\2\u030a\u030b\7u\2\2\u030b\u030c\7k\2\2\u030c\u030d\7|\2\2\u030d" + 522 | "\u030e\7g\2\2\u030e\u030f\7q\2\2\u030f\u0310\7h\2\2\u0310\u0082\3\2\2" + 523 | "\2\u0311\u0312\7u\2\2\u0312\u0313\7v\2\2\u0313\u0314\7c\2\2\u0314\u0315" + 524 | "\7v\2\2\u0315\u0316\7k\2\2\u0316\u0317\7e\2\2\u0317\u0084\3\2\2\2\u0318" + 525 | "\u0319\7u\2\2\u0319\u031a\7v\2\2\u031a\u031b\7t\2\2\u031b\u031c\7w\2\2" + 526 | "\u031c\u031d\7e\2\2\u031d\u031e\7v\2\2\u031e\u0086\3\2\2\2\u031f\u0320" + 527 | "\7u\2\2\u0320\u0321\7y\2\2\u0321\u0322\7k\2\2\u0322\u0323\7v\2\2\u0323" + 528 | "\u0324\7e\2\2\u0324\u0325\7j\2\2\u0325\u0088\3\2\2\2\u0326\u0327\7v\2" + 529 | "\2\u0327\u0328\7{\2\2\u0328\u0329\7r\2\2\u0329\u032a\7g\2\2\u032a\u032b" + 530 | "\7f\2\2\u032b\u032c\7g\2\2\u032c\u032d\7h\2\2\u032d\u008a\3\2\2\2\u032e" + 531 | "\u032f\7w\2\2\u032f\u0330\7p\2\2\u0330\u0331\7k\2\2\u0331\u0332\7q\2\2" + 532 | "\u0332\u0333\7p\2\2\u0333\u008c\3\2\2\2\u0334\u0335\7w\2\2\u0335\u0336" + 533 | "\7p\2\2\u0336\u0337\7u\2\2\u0337\u0338\7k\2\2\u0338\u0339\7i\2\2\u0339" + 534 | "\u033a\7p\2\2\u033a\u033b\7g\2\2\u033b\u033c\7f\2\2\u033c\u008e\3\2\2" + 535 | "\2\u033d\u033e\7x\2\2\u033e\u033f\7q\2\2\u033f\u0340\7k\2\2\u0340\u0341" + 536 | "\7f\2\2\u0341\u0090\3\2\2\2\u0342\u0343\7x\2\2\u0343\u0344\7q\2\2\u0344" + 537 | "\u0345\7n\2\2\u0345\u0346\7c\2\2\u0346\u0347\7v\2\2\u0347\u0348\7k\2\2" + 538 | "\u0348\u0349\7n\2\2\u0349\u034a\7g\2\2\u034a\u0092\3\2\2\2\u034b\u034c" + 539 | "\7y\2\2\u034c\u034d\7j\2\2\u034d\u034e\7k\2\2\u034e\u034f\7n\2\2\u034f" + 540 | "\u0350\7g\2\2\u0350\u0094\3\2\2\2\u0351\u0352\7P\2\2\u0352\u0353\7U\2" + 541 | "\2\u0353\u0354\7a\2\2\u0354\u0355\7Q\2\2\u0355\u0356\7R\2\2\u0356\u0357" + 542 | "\7V\2\2\u0357\u0358\7K\2\2\u0358\u0359\7Q\2\2\u0359\u035a\7P\2\2\u035a" + 543 | "\u035b\7U\2\2\u035b\u0096\3\2\2\2\u035c\u035d\7P\2\2\u035d\u035e\7U\2" + 544 | "\2\u035e\u035f\7a\2\2\u035f\u0360\7G\2\2\u0360\u0361\7P\2\2\u0361\u0362" + 545 | "\7W\2\2\u0362\u0363\7O\2\2\u0363\u0098\3\2\2\2\u0364\u0365\7a\2\2\u0365" + 546 | "\u0366\7a\2\2\u0366\u0367\7y\2\2\u0367\u0368\7g\2\2\u0368\u0369\7c\2\2" + 547 | "\u0369\u036a\7m\2\2\u036a\u009a\3\2\2\2\u036b\u036c\7a\2\2\u036c\u036d" + 548 | "\7a\2\2\u036d\u036e\7w\2\2\u036e\u036f\7p\2\2\u036f\u0370\7u\2\2\u0370" + 549 | "\u0371\7c\2\2\u0371\u0372\7h\2\2\u0372\u0373\7g\2\2\u0373\u0374\7a\2\2" + 550 | "\u0374\u0375\7w\2\2\u0375\u0376\7p\2\2\u0376\u0377\7t\2\2\u0377\u0378" + 551 | "\7g\2\2\u0378\u0379\7v\2\2\u0379\u037a\7c\2\2\u037a\u037b\7k\2\2\u037b" + 552 | "\u037c\7p\2\2\u037c\u037d\7g\2\2\u037d\u037e\7f\2\2\u037e\u009c\3\2\2" + 553 | "\2\u037f\u0380\7a\2\2\u0380\u0381\7a\2\2\u0381\u0382\7v\2\2\u0382\u0383" + 554 | "\7{\2\2\u0383\u0384\7r\2\2\u0384\u0385\7g\2\2\u0385\u0386\7q\2\2\u0386" + 555 | "\u0387\7h\2\2\u0387\u009e\3\2\2\2\u0388\u0389\7*\2\2\u0389\u00a0\3\2\2" + 556 | "\2\u038a\u038b\7+\2\2\u038b\u00a2\3\2\2\2\u038c\u038d\7}\2\2\u038d\u00a4" + 557 | "\3\2\2\2\u038e\u038f\7\177\2\2\u038f\u00a6\3\2\2\2\u0390\u0391\7]\2\2" + 558 | "\u0391\u00a8\3\2\2\2\u0392\u0393\7_\2\2\u0393\u00aa\3\2\2\2\u0394\u0395" + 559 | "\7=\2\2\u0395\u00ac\3\2\2\2\u0396\u0397\7.\2\2\u0397\u00ae\3\2\2\2\u0398" + 560 | "\u0399\7\60\2\2\u0399\u00b0\3\2\2\2\u039a\u039b\7/\2\2\u039b\u039c\7@" + 561 | "\2\2\u039c\u00b2\3\2\2\2\u039d\u039e\7B\2\2\u039e\u00b4\3\2\2\2\u039f" + 562 | "\u03a0\7?\2\2\u03a0\u00b6\3\2\2\2\u03a1\u03a2\7@\2\2\u03a2\u00b8\3\2\2" + 563 | "\2\u03a3\u03a4\7>\2\2\u03a4\u00ba\3\2\2\2\u03a5\u03a6\7#\2\2\u03a6\u00bc" + 564 | "\3\2\2\2\u03a7\u03a8\7\u0080\2\2\u03a8\u00be\3\2\2\2\u03a9\u03aa\7A\2" + 565 | "\2\u03aa\u00c0\3\2\2\2\u03ab\u03ac\7<\2\2\u03ac\u00c2\3\2\2\2\u03ad\u03ae" + 566 | "\7?\2\2\u03ae\u03af\7?\2\2\u03af\u00c4\3\2\2\2\u03b0\u03b1\7>\2\2\u03b1" + 567 | "\u03b2\7?\2\2\u03b2\u00c6\3\2\2\2\u03b3\u03b4\7@\2\2\u03b4\u03b5\7?\2" + 568 | "\2\u03b5\u00c8\3\2\2\2\u03b6\u03b7\7#\2\2\u03b7\u03b8\7?\2\2\u03b8\u00ca" + 569 | "\3\2\2\2\u03b9\u03ba\7(\2\2\u03ba\u03bb\7(\2\2\u03bb\u00cc\3\2\2\2\u03bc" + 570 | "\u03bd\7~\2\2\u03bd\u03be\7~\2\2\u03be\u00ce\3\2\2\2\u03bf\u03c0\7-\2" + 571 | "\2\u03c0\u03c1\7-\2\2\u03c1\u00d0\3\2\2\2\u03c2\u03c3\7/\2\2\u03c3\u03c4" + 572 | "\7/\2\2\u03c4\u00d2\3\2\2\2\u03c5\u03c6\7-\2\2\u03c6\u00d4\3\2\2\2\u03c7" + 573 | "\u03c8\7/\2\2\u03c8\u00d6\3\2\2\2\u03c9\u03ca\7,\2\2\u03ca\u00d8\3\2\2" + 574 | "\2\u03cb\u03cc\7\61\2\2\u03cc\u00da\3\2\2\2\u03cd\u03ce\7(\2\2\u03ce\u00dc" + 575 | "\3\2\2\2\u03cf\u03d0\7~\2\2\u03d0\u00de\3\2\2\2\u03d1\u03d2\7`\2\2\u03d2" + 576 | "\u00e0\3\2\2\2\u03d3\u03d4\7\'\2\2\u03d4\u00e2\3\2\2\2\u03d5\u03d6\7@" + 577 | "\2\2\u03d6\u03d7\7@\2\2\u03d7\u00e4\3\2\2\2\u03d8\u03d9\7>\2\2\u03d9\u03da" + 578 | "\7>\2\2\u03da\u00e6\3\2\2\2\u03db\u03dc\7-\2\2\u03dc\u03dd\7?\2\2\u03dd" + 579 | "\u00e8\3\2\2\2\u03de\u03df\7/\2\2\u03df\u03e0\7?\2\2\u03e0\u00ea\3\2\2" + 580 | "\2\u03e1\u03e2\7,\2\2\u03e2\u03e3\7?\2\2\u03e3\u00ec\3\2\2\2\u03e4\u03e5" + 581 | "\7\61\2\2\u03e5\u03e6\7?\2\2\u03e6\u00ee\3\2\2\2\u03e7\u03e8\7(\2\2\u03e8" + 582 | "\u03e9\7?\2\2\u03e9\u00f0\3\2\2\2\u03ea\u03eb\7~\2\2\u03eb\u03ec\7?\2" + 583 | "\2\u03ec\u00f2\3\2\2\2\u03ed\u03ee\7`\2\2\u03ee\u03ef\7?\2\2\u03ef\u00f4" + 584 | "\3\2\2\2\u03f0\u03f1\7\'\2\2\u03f1\u03f2\7?\2\2\u03f2\u00f6\3\2\2\2\u03f3" + 585 | "\u03f4\7>\2\2\u03f4\u03f5\7>\2\2\u03f5\u03f6\7?\2\2\u03f6\u00f8\3\2\2" + 586 | "\2\u03f7\u03f8\7@\2\2\u03f8\u03f9\7@\2\2\u03f9\u03fa\7?\2\2\u03fa\u00fa" + 587 | "\3\2\2\2\u03fb\u03fc\7\60\2\2\u03fc\u03fd\7\60\2\2\u03fd\u03fe\7\60\2" + 588 | "\2\u03fe\u00fc\3\2\2\2\u03ff\u0400\7c\2\2\u0400\u0401\7u\2\2\u0401\u0402" + 589 | "\7u\2\2\u0402\u0403\7k\2\2\u0403\u0404\7i\2\2\u0404\u0405\7p\2\2\u0405" + 590 | "\u00fe\3\2\2\2\u0406\u0407\7i\2\2\u0407\u0408\7g\2\2\u0408\u0409\7v\2" + 591 | "\2\u0409\u040a\7v\2\2\u040a\u040b\7g\2\2\u040b\u040c\7t\2\2\u040c\u0100" + 592 | "\3\2\2\2\u040d\u040e\7p\2\2\u040e\u040f\7q\2\2\u040f\u0410\7p\2\2\u0410" + 593 | "\u0411\7c\2\2\u0411\u0412\7v\2\2\u0412\u0413\7q\2\2\u0413\u0414\7o\2\2" + 594 | "\u0414\u0415\7k\2\2\u0415\u0416\7e\2\2\u0416\u0102\3\2\2\2\u0417\u0418" + 595 | "\7u\2\2\u0418\u0419\7g\2\2\u0419\u041a\7v\2\2\u041a\u041b\7v\2\2\u041b" + 596 | "\u041c\7g\2\2\u041c\u041d\7t\2\2\u041d\u0104\3\2\2\2\u041e\u041f\7u\2" + 597 | "\2\u041f\u0420\7v\2\2\u0420\u0421\7t\2\2\u0421\u0422\7q\2\2\u0422\u0423" + 598 | "\7p\2\2\u0423\u0424\7i\2\2\u0424\u0106\3\2\2\2\u0425\u0426\7t\2\2\u0426" + 599 | "\u0427\7g\2\2\u0427\u0428\7v\2\2\u0428\u0429\7c\2\2\u0429\u042a\7k\2\2" + 600 | "\u042a\u042b\7p\2\2\u042b\u0108\3\2\2\2\u042c\u042d\7t\2\2\u042d\u042e" + 601 | "\7g\2\2\u042e\u042f\7c\2\2\u042f\u0430\7f\2\2\u0430\u0431\7q\2\2\u0431" + 602 | "\u0432\7p\2\2\u0432\u0433\7n\2\2\u0433\u0434\7{\2\2\u0434\u010a\3\2\2" + 603 | "\2\u0435\u0436\7t\2\2\u0436\u0437\7g\2\2\u0437\u0438\7c\2\2\u0438\u0439" + 604 | "\7f\2\2\u0439\u043a\7y\2\2\u043a\u043b\7t\2\2\u043b\u043c\7k\2\2\u043c" + 605 | "\u043d\7v\2\2\u043d\u043e\7g\2\2\u043e\u010c\3\2\2\2\u043f\u0440\7y\2" + 606 | "\2\u0440\u0441\7g\2\2\u0441\u0442\7c\2\2\u0442\u0443\7m\2\2\u0443\u010e" + 607 | "\3\2\2\2\u0444\u0449\5\u0111\u0089\2\u0445\u0448\5\u0111\u0089\2\u0446" + 608 | "\u0448\4\62;\2\u0447\u0445\3\2\2\2\u0447\u0446\3\2\2\2\u0448\u044b\3\2" + 609 | "\2\2\u0449\u0447\3\2\2\2\u0449\u044a\3\2\2\2\u044a\u0110\3\2\2\2\u044b" + 610 | "\u0449\3\2\2\2\u044c\u044d\t\2\2\2\u044d\u0112\3\2\2\2\u044e\u0451\7)" + 611 | "\2\2\u044f\u0452\5\u012b\u0096\2\u0450\u0452\n\3\2\2\u0451\u044f\3\2\2" + 612 | "\2\u0451\u0450\3\2\2\2\u0452\u0453\3\2\2\2\u0453\u0454\7)\2\2\u0454\u0114" + 613 | "\3\2\2\2\u0455\u0456\5\u0119\u008d\2\u0456\u0116\3\2\2\2\u0457\u0458\t" + 614 | "\4\2\2\u0458\u0459\5\u0119\u008d\2\u0459\u0118\3\2\2\2\u045a\u045f\7$" + 615 | "\2\2\u045b\u045e\5\u012b\u0096\2\u045c\u045e\n\5\2\2\u045d\u045b\3\2\2" + 616 | "\2\u045d\u045c\3\2\2\2\u045e\u0461\3\2\2\2\u045f\u045d\3\2\2\2\u045f\u0460" + 617 | "\3\2\2\2\u0460\u0462\3\2\2\2\u0461\u045f\3\2\2\2\u0462\u0463\7$\2\2\u0463" + 618 | "\u011a\3\2\2\2\u0464\u0465\7\62\2\2\u0465\u0467\t\6\2\2\u0466\u0468\5" + 619 | "\u0121\u0091\2\u0467\u0466\3\2\2\2\u0468\u0469\3\2\2\2\u0469\u0467\3\2" + 620 | "\2\2\u0469\u046a\3\2\2\2\u046a\u046c\3\2\2\2\u046b\u046d\5\u0123\u0092" + 621 | "\2\u046c\u046b\3\2\2\2\u046c\u046d\3\2\2\2\u046d\u011c\3\2\2\2\u046e\u0477" + 622 | "\7\62\2\2\u046f\u0473\4\63;\2\u0470\u0472\4\62;\2\u0471\u0470\3\2\2\2" + 623 | "\u0472\u0475\3\2\2\2\u0473\u0471\3\2\2\2\u0473\u0474\3\2\2\2\u0474\u0477" + 624 | "\3\2\2\2\u0475\u0473\3\2\2\2\u0476\u046e\3\2\2\2\u0476\u046f\3\2\2\2\u0477" + 625 | "\u0479\3\2\2\2\u0478\u047a\5\u0123\u0092\2\u0479\u0478\3\2\2\2\u0479\u047a" + 626 | "\3\2\2\2\u047a\u011e\3\2\2\2\u047b\u047d\7\62\2\2\u047c\u047e\4\629\2" + 627 | "\u047d\u047c\3\2\2\2\u047e\u047f\3\2\2\2\u047f\u047d\3\2\2\2\u047f\u0480" + 628 | "\3\2\2\2\u0480\u0482\3\2\2\2\u0481\u0483\5\u0123\u0092\2\u0482\u0481\3" + 629 | "\2\2\2\u0482\u0483\3\2\2\2\u0483\u0120\3\2\2\2\u0484\u0485\t\7\2\2\u0485" + 630 | "\u0122\3\2\2\2\u0486\u048c\t\b\2\2\u0487\u0488\7W\2\2\u0488\u048c\7N\2" + 631 | "\2\u0489\u048a\7w\2\2\u048a\u048c\7n\2\2\u048b\u0486\3\2\2\2\u048b\u0487" + 632 | "\3\2\2\2\u048b\u0489\3\2\2\2\u048c\u0124\3\2\2\2\u048d\u048f\4\62;\2\u048e" + 633 | "\u048d\3\2\2\2\u048f\u0490\3\2\2\2\u0490\u048e\3\2\2\2\u0490\u0491\3\2" + 634 | "\2\2\u0491\u0499\3\2\2\2\u0492\u0496\7\60\2\2\u0493\u0495\4\62;\2\u0494" + 635 | "\u0493\3\2\2\2\u0495\u0498\3\2\2\2\u0496\u0494\3\2\2\2\u0496\u0497\3\2" + 636 | "\2\2\u0497\u049a\3\2\2\2\u0498\u0496\3\2\2\2\u0499\u0492\3\2\2\2\u0499" + 637 | "\u049a\3\2\2\2\u049a\u049c\3\2\2\2\u049b\u049d\5\u0127\u0094\2\u049c\u049b" + 638 | "\3\2\2\2\u049c\u049d\3\2\2\2\u049d\u049f\3\2\2\2\u049e\u04a0\5\u0129\u0095" + 639 | "\2\u049f\u049e\3\2\2\2\u049f\u04a0\3\2\2\2\u04a0\u0126\3\2\2\2\u04a1\u04a3" + 640 | "\t\t\2\2\u04a2\u04a4\t\n\2\2\u04a3\u04a2\3\2\2\2\u04a3\u04a4\3\2\2\2\u04a4" + 641 | "\u04a6\3\2\2\2\u04a5\u04a7\4\62;\2\u04a6\u04a5\3\2\2\2\u04a7\u04a8\3\2" + 642 | "\2\2\u04a8\u04a6\3\2\2\2\u04a8\u04a9\3\2\2\2\u04a9\u0128\3\2\2\2\u04aa" + 643 | "\u04ab\t\13\2\2\u04ab\u012a\3\2\2\2\u04ac\u04ad\7^\2\2\u04ad\u04b0\t\f" + 644 | "\2\2\u04ae\u04b0\5\u012d\u0097\2\u04af\u04ac\3\2\2\2\u04af\u04ae\3\2\2" + 645 | "\2\u04b0\u012c\3\2\2\2\u04b1\u04b2\7^\2\2\u04b2\u04b3\4\62\65\2\u04b3" + 646 | "\u04b4\4\629\2\u04b4\u04bb\4\629\2\u04b5\u04b6\7^\2\2\u04b6\u04b7\4\62" + 647 | "9\2\u04b7\u04bb\4\629\2\u04b8\u04b9\7^\2\2\u04b9\u04bb\4\629\2\u04ba\u04b1" + 648 | "\3\2\2\2\u04ba\u04b5\3\2\2\2\u04ba\u04b8\3\2\2\2\u04bb\u012e\3\2\2\2\u04bc" + 649 | "\u04bd\7^\2\2\u04bd\u04be\7w\2\2\u04be\u04bf\5\u0121\u0091\2\u04bf\u04c0" + 650 | "\5\u0121\u0091\2\u04c0\u04c1\5\u0121\u0091\2\u04c1\u04c2\5\u0121\u0091" + 651 | "\2\u04c2\u0130\3\2\2\2\u04c3\u04c4\7%\2\2\u04c4\u04c5\7k\2\2\u04c5\u04c6" + 652 | "\7o\2\2\u04c6\u04c7\7r\2\2\u04c7\u04c8\7q\2\2\u04c8\u04c9\7t\2\2\u04c9" + 653 | "\u04ca\7v\2\2\u04ca\u04ce\3\2\2\2\u04cb\u04cd\t\r\2\2\u04cc\u04cb\3\2" + 654 | "\2\2\u04cd\u04d0\3\2\2\2\u04ce\u04cc\3\2\2\2\u04ce\u04cf\3\2\2\2\u04cf" + 655 | "\u04d3\3\2\2\2\u04d0\u04ce\3\2\2\2\u04d1\u04d4\5\u0119\u008d\2\u04d2\u04d4" + 656 | "\5\u0137\u009c\2\u04d3\u04d1\3\2\2\2\u04d3\u04d2\3\2\2\2\u04d4\u04d5\3" + 657 | "\2\2\2\u04d5\u04d6\5\u0139\u009d\2\u04d6\u04d7\3\2\2\2\u04d7\u04d8\b\u0099" + 658 | "\2\2\u04d8\u0132\3\2\2\2\u04d9\u04da\7%\2\2\u04da\u04db\7k\2\2\u04db\u04dc" + 659 | "\7p\2\2\u04dc\u04dd\7e\2\2\u04dd\u04de\7n\2\2\u04de\u04df\7w\2\2\u04df" + 660 | "\u04e0\7f\2\2\u04e0\u04e1\7g\2\2\u04e1\u04e5\3\2\2\2\u04e2\u04e4\t\r\2" + 661 | "\2\u04e3\u04e2\3\2\2\2\u04e4\u04e7\3\2\2\2\u04e5\u04e3\3\2\2\2\u04e5\u04e6" + 662 | "\3\2\2\2\u04e6\u04ea\3\2\2\2\u04e7\u04e5\3\2\2\2\u04e8\u04eb\5\u0119\u008d" + 663 | "\2\u04e9\u04eb\5\u0137\u009c\2\u04ea\u04e8\3\2\2\2\u04ea\u04e9\3\2\2\2" + 664 | "\u04eb\u04ec\3\2\2\2\u04ec\u04ed\5\u0139\u009d\2\u04ed\u04ee\3\2\2\2\u04ee" + 665 | "\u04ef\b\u009a\2\2\u04ef\u0134\3\2\2\2\u04f0\u04f1\7%\2\2\u04f1\u04f2" + 666 | "\7r\2\2\u04f2\u04f3\7t\2\2\u04f3\u04f4\7c\2\2\u04f4\u04f5\7i\2\2\u04f5" + 667 | "\u04f6\7o\2\2\u04f6\u04f7\7c\2\2\u04f7\u04fb\3\2\2\2\u04f8\u04fa\n\16" + 668 | "\2\2\u04f9\u04f8\3\2\2\2\u04fa\u04fd\3\2\2\2\u04fb\u04f9\3\2\2\2\u04fb" + 669 | "\u04fc\3\2\2\2\u04fc\u04fe\3\2\2\2\u04fd\u04fb\3\2\2\2\u04fe\u04ff\b\u009b" + 670 | "\2\2\u04ff\u0136\3\2\2\2\u0500\u0504\7>\2\2\u0501\u0503\13\2\2\2\u0502" + 671 | "\u0501\3\2\2\2\u0503\u0506\3\2\2\2\u0504\u0505\3\2\2\2\u0504\u0502\3\2" + 672 | "\2\2\u0505\u0507\3\2\2\2\u0506\u0504\3\2\2\2\u0507\u0508\7@\2\2\u0508" + 673 | "\u0138\3\2\2\2\u0509\u050a\t\17\2\2\u050a\u050b\3\2\2\2\u050b\u050c\b" + 674 | "\u009d\2\2\u050c\u013a\3\2\2\2\u050d\u050e\7\61\2\2\u050e\u050f\7,\2\2" + 675 | "\u050f\u0513\3\2\2\2\u0510\u0512\13\2\2\2\u0511\u0510\3\2\2\2\u0512\u0515" + 676 | "\3\2\2\2\u0513\u0514\3\2\2\2\u0513\u0511\3\2\2\2\u0514\u0516\3\2\2\2\u0515" + 677 | "\u0513\3\2\2\2\u0516\u0517\7,\2\2\u0517\u0518\7\61\2\2\u0518\u0519\3\2" + 678 | "\2\2\u0519\u051a\b\u009e\3\2\u051a\u013c\3\2\2\2\u051b\u051c\7\61\2\2" + 679 | "\u051c\u051d\7\61\2\2\u051d\u0521\3\2\2\2\u051e\u0520\n\16\2\2\u051f\u051e" + 680 | "\3\2\2\2\u0520\u0523\3\2\2\2\u0521\u051f\3\2\2\2\u0521\u0522\3\2\2\2\u0522" + 681 | "\u0524\3\2\2\2\u0523\u0521\3\2\2\2\u0524\u0525\b\u009f\4\2\u0525\u013e" + 682 | "\3\2\2\2\"\2\u017c\u0447\u0449\u0451\u045d\u045f\u0469\u046c\u0473\u0476" + 683 | "\u0479\u047f\u0482\u048b\u0490\u0496\u0499\u049c\u049f\u04a3\u04a8\u04af" + 684 | "\u04ba\u04ce\u04d3\u04e5\u04ea\u04fb\u0504\u0513\u0521\5\2\3\2\3\u009e" + 685 | "\2\3\u009f\3"; 686 | public static final ATN _ATN = 687 | new ATNDeserializer().deserialize(_serializedATN.toCharArray()); 688 | 689 | static { 690 | _decisionToDFA = new DFA[_ATN.getNumberOfDecisions()]; 691 | for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) { 692 | _decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i); 693 | } 694 | } 695 | } -------------------------------------------------------------------------------- /Java/src/bos/consoar/objc2lua/parser/ObjCLexer.tokens: -------------------------------------------------------------------------------- 1 | T__0=1 2 | T__1=2 3 | T__2=3 4 | T__3=4 5 | T__4=5 6 | T__5=6 7 | T__6=7 8 | T__7=8 9 | DOTIDENTIFIER=9 10 | AUTORELEASEPOOL=10 11 | CATCH=11 12 | CLASS=12 13 | DYNAMIC=13 14 | ENCODE=14 15 | END=15 16 | FINALLY=16 17 | IMPLEMENTATION=17 18 | INTERFACE=18 19 | PACKAGE=19 20 | PROTOCOL=20 21 | OPTIONAL=21 22 | PRIVATE=22 23 | PROPERTY=23 24 | PROTECTED=24 25 | PUBLIC=25 26 | SELECTOR=26 27 | SYNCHRONIZED=27 28 | SYNTHESIZE=28 29 | THROW=29 30 | TRY=30 31 | SUPER=31 32 | SELF=32 33 | ABSTRACT=33 34 | AUTO=34 35 | BOOLEAN=35 36 | BREAK=36 37 | BYCOPY=37 38 | BYREF=38 39 | CASE=39 40 | CHAR=40 41 | CONST=41 42 | CONTINUE=42 43 | DEFAULT=43 44 | DO=44 45 | DOUBLE=45 46 | ELSE=46 47 | ENUM=47 48 | EXTERN=48 49 | FLOAT=49 50 | FOR=50 51 | ID=51 52 | IF=52 53 | IN=53 54 | INOUT=54 55 | GOTO=55 56 | INT=56 57 | LONG=57 58 | ONEWAY=58 59 | OUT=59 60 | REGISTER=60 61 | RETURN=61 62 | SHORT=62 63 | SIGNED=63 64 | SIZEOF=64 65 | STATIC=65 66 | STRUCT=66 67 | SWITCH=67 68 | TYPEDEF=68 69 | UNION=69 70 | UNSIGNED=70 71 | VOID=71 72 | VOLATILE=72 73 | WHILE=73 74 | NS_OPTIONS=74 75 | NS_ENUM=75 76 | WWEAK=76 77 | WUNSAFE_UNRETAINED=77 78 | TYPEOF=78 79 | LPAREN=79 80 | RPAREN=80 81 | LBRACE=81 82 | RBRACE=82 83 | LBRACK=83 84 | RBRACK=84 85 | SEMI=85 86 | COMMA=86 87 | DOT=87 88 | STRUCTACCESS=88 89 | AT=89 90 | ASSIGN=90 91 | GT=91 92 | LT=92 93 | BANG=93 94 | TILDE=94 95 | QUESTION=95 96 | COLON=96 97 | EQUAL=97 98 | LE=98 99 | GE=99 100 | NOTEQUAL=100 101 | AND=101 102 | OR=102 103 | INC=103 104 | DEC=104 105 | ADD=105 106 | SUB=106 107 | MUL=107 108 | DIV=108 109 | BITAND=109 110 | BITOR=110 111 | CARET=111 112 | MOD=112 113 | SHIFT_R=113 114 | SHIFT_L=114 115 | ADD_ASSIGN=115 116 | SUB_ASSIGN=116 117 | MUL_ASSIGN=117 118 | DIV_ASSIGN=118 119 | AND_ASSIGN=119 120 | OR_ASSIGN=120 121 | XOR_ASSIGN=121 122 | MOD_ASSIGN=122 123 | LSHIFT_ASSIGN=123 124 | RSHIFT_ASSIGN=124 125 | ELIPSIS=125 126 | ASSIGNPA=126 127 | GETTER=127 128 | NONATOMIC=128 129 | SETTER=129 130 | STRONG=130 131 | RETAIN=131 132 | READONLY=132 133 | READWRITE=133 134 | WEAK=134 135 | IDENTIFIER=135 136 | CHARACTER_LITERAL=136 137 | CSTRING_LITERAL=137 138 | STRING_LITERAL=138 139 | HEX_LITERAL=139 140 | DECIMAL_LITERAL=140 141 | OCTAL_LITERAL=141 142 | FLOATING_POINT_LITERAL=142 143 | IMPORT=143 144 | INCLUDE=144 145 | PRAGMA=145 146 | WS=146 147 | COMMENT=147 148 | LINE_COMMENT=148 149 | '#ifdef'=1 150 | '#if'=2 151 | '#undef'=3 152 | '#ifndef'=4 153 | '#endif'=5 154 | '#define'=6 155 | '.+'=7 156 | '@required'=8 157 | '@autoreleasepool'=10 158 | '@catch'=11 159 | '@class'=12 160 | '@dynamic'=13 161 | '@encode'=14 162 | '@end'=15 163 | '@finally'=16 164 | '@implementation'=17 165 | '@interface'=18 166 | '@package'=19 167 | '@protocol'=20 168 | '@optional'=21 169 | '@private'=22 170 | '@property'=23 171 | '@protected'=24 172 | '@public'=25 173 | '@selector'=26 174 | '@synchronized'=27 175 | '@synthesize'=28 176 | '@throw'=29 177 | '@try'=30 178 | 'super'=31 179 | 'self'=32 180 | 'abstract'=33 181 | 'auto'=34 182 | 'boolean'=35 183 | 'break'=36 184 | 'bycopy'=37 185 | 'byref'=38 186 | 'case'=39 187 | 'char'=40 188 | 'const'=41 189 | 'continue'=42 190 | 'default'=43 191 | 'do'=44 192 | 'double'=45 193 | 'else'=46 194 | 'enum'=47 195 | 'extern'=48 196 | 'float'=49 197 | 'for'=50 198 | 'id'=51 199 | 'if'=52 200 | 'in'=53 201 | 'inout'=54 202 | 'goto'=55 203 | 'int'=56 204 | 'long'=57 205 | 'oneway'=58 206 | 'out'=59 207 | 'register'=60 208 | 'return'=61 209 | 'short'=62 210 | 'signed'=63 211 | 'sizeof'=64 212 | 'static'=65 213 | 'struct'=66 214 | 'switch'=67 215 | 'typedef'=68 216 | 'union'=69 217 | 'unsigned'=70 218 | 'void'=71 219 | 'volatile'=72 220 | 'while'=73 221 | 'NS_OPTIONS'=74 222 | 'NS_ENUM'=75 223 | '__weak'=76 224 | '__unsafe_unretained'=77 225 | '__typeof'=78 226 | '('=79 227 | ')'=80 228 | '{'=81 229 | '}'=82 230 | '['=83 231 | ']'=84 232 | ';'=85 233 | ','=86 234 | '.'=87 235 | '->'=88 236 | '@'=89 237 | '='=90 238 | '>'=91 239 | '<'=92 240 | '!'=93 241 | '~'=94 242 | '?'=95 243 | ':'=96 244 | '=='=97 245 | '<='=98 246 | '>='=99 247 | '!='=100 248 | '&&'=101 249 | '||'=102 250 | '++'=103 251 | '--'=104 252 | '+'=105 253 | '-'=106 254 | '*'=107 255 | '/'=108 256 | '&'=109 257 | '|'=110 258 | '^'=111 259 | '%'=112 260 | '>>'=113 261 | '<<'=114 262 | '+='=115 263 | '-='=116 264 | '*='=117 265 | '/='=118 266 | '&='=119 267 | '|='=120 268 | '^='=121 269 | '%='=122 270 | '<<='=123 271 | '>>='=124 272 | '...'=125 273 | 'assign'=126 274 | 'getter'=127 275 | 'nonatomic'=128 276 | 'setter'=129 277 | 'strong'=130 278 | 'retain'=131 279 | 'readonly'=132 280 | 'readwrite'=133 281 | 'weak'=134 282 | -------------------------------------------------------------------------------- /Java/translate.dat: -------------------------------------------------------------------------------- 1 | # Define translations performed by program 2 | # translates functions and identifiers 3 | # 4 | 5 | # Miscellaneous translations 6 | # 7 | # Miscellaneous Identifier Translations 8 | -replaceID "YES" "true" 9 | -replaceID "TRUE" "true" 10 | -replaceID "NO" "false" 11 | -replaceID "FALSE" "false" 12 | -replaceID "nil" "nil" 13 | -replaceID "NULL" "nil" 14 | -replaceID "bool" "" 15 | -replaceID "IBAction" "" 16 | -replaceID "IBOutlet" "" 17 | 18 | # Miscellaneous Function Translations 19 | -replaceFUNC ".autorelease()" "" 20 | -replaceFUNC ".retain()" "" 21 | -replaceFUNC ".release()" "" 22 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Objc2Lua 2 | 3 | ##限制: 4 | 5 | - 它不保证生成完全可执行的lua文件,仍需要程序要人工后期处理(例如需要自行添加WaxClass的头描述,对宏的处理,和一些转换错误的语法进行人工修正转换等等) 6 | 7 | - 它不完全支持C/C + +的语法(可能会出现相关语法无法识别或者转换错误,到时候请手动转换,而且LUA并不支持直接调用C方法,仍需要在OC封装一层) 8 | 9 | - 它不合并Categories(请手动将Catergory合并到同一个lua中) 10 | 11 | - 它不支持协议的转换(程序不会对协议进行转换输出) 12 | 13 | - 它对宏不进行太多处理,所以宏仍需要程序员自行处理,但会提取出可以的宏作为注释放到LUA开头 14 | 15 | - 它不完全支持Block(Block转换后会提示不支持) 16 | 17 | - 不完全的For循环转换(主要在循环体部分,需要人工改写,例如使用i=1,100,1或paris循环等) 18 | 19 | - 可能会出End不匹配的现象(可能出现在Switch,For,If等语句的转换上,如果{}都写的话的话应该会匹配,主要出现在没有只有一行时省略{}的情况) 20 | 21 | ##支持: 22 | 23 | - 自动将消息调用转成WAX的形式 24 | 25 | - 自动将方法声明转换成WAX的形式 26 | 27 | - 自动将对属性的操作转换成对应的get/set方法调用格式 28 | 29 | - 自动将switch转换成if-elseif嵌套的方式,但不完美需要可能需要人工校对 30 | 31 | - 自动将do-while转换成repeat-until形式 32 | 33 | - 自动将if,For等语句进行转换,但由于Lua与OC的语法不同,所以仍然需要人工校正 34 | 35 | - 支持@[],@{}的语法糖,并自动转换为LUA中的Table表述形式 36 | 37 | - 自动判断可能的宏定义和宏函数,添加到文件中(在文件最后以注释的形式添加),便于手工查找并修改 38 | 39 | - 自动将CGSizeMake->CGSize(还有一些其他wax支持的结构体如CGRect等) 40 | 41 | - 还有其他一些细节就不一一列举了 42 | 43 | ##其他说明: 44 | 45 | - 对OC中_XXX的变量不做转换(可以自行替换为self.xxx的形式或其他变量声明形式,但依旧不提倡使用self.xxx,该方法存取变量的性能开销较大,能使用local请尽量使用local) 46 | 47 | - 宏的识别暂时为以下三种 48 | 49 | 1.k+大写字母+任意字符 50 | 51 | 2.AAA_BBB_CCC类似的形式 52 | 53 | 3._+纯大写 54 | 55 | ##需要预处理: 56 | 57 | 1.Block(如果能替换成非Block方法或注释掉最好,不替换也行,但会提示不支持) 58 | 59 | 2.多线程,现WAX还不支持多线程,所以如果有用到GCD或其他多线程的地方也需要进行处理 60 | 61 | 3.纯C\C++方法 62 | 63 | 特别注意:如果语句最后不是分号,一定要加上分号,否则会影响识别的!!! 64 | 65 | ##转换完之后仍然需要人工校对,以下方面需要特别关注: 66 | 67 | 1.For 68 | 69 | 2.Switch 70 | 71 | 3.IF 72 | 73 | 4.所有使用到宏的地方 74 | 75 | 5.转换时提示报错的地方 76 | 77 | 6.依然建议逐行校对,防止转换失误 78 | 79 | 7.建议将一些结构使用LUA中的table之类的代替,以减少使用WAX带来的性能损失,并能用local变量的请尽量用local变量 80 | 81 | ##使用方法: 82 | 83 | 1.安装JRE或者JDK 84 | 85 | 2.双击运行jar包 86 | 87 | 3.选择要转换的目录,程序会自动转换该目录下的所有.m文件 88 | 89 | 4.生成的文件在同目录下扩展名为.lua 90 | 91 | 5.相关报错会在开始按钮下方的控制台输出 92 | 93 | ##特别感谢以下开源程序: 94 | 95 | https://github.com/yahoojapan/objc2swift 96 | 97 | https://github.com/bang590/JSPatchConvertor 98 | 99 | https://github.com/irclark2000/ObjcToJava 100 | 101 | ##jar文件 102 | Java/classes/artifacts/Objc2Lua_jar目录下 103 | --------------------------------------------------------------------------------