Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Source:
- class TestSwiftFile {
- static let file: String = __FILE__
- }
- class TestSwiftFileWithFunction {
- func doWork(a: Int, andB b: String) -> [String] {
- return []
- }
- }
- Output:
- statements {
- statement {
- declaration {
- class_declaration {
- class "class",
- class_name {
- identifier {
- Identifier "TestSwiftFile"
- }
- },
- class_body {
- LCURLY "{",
- declarations {
- declaration {
- constant_declaration {
- declaration_modifiers {
- declaration_modifier {
- static "static"
- }
- },
- let "let",
- pattern_initializer_list {
- pattern_initializer {
- pattern {
- identifier_pattern {
- identifier {
- Identifier "file"
- }
- },
- type_annotation {
- COLON ":",
- type {
- type_identifier {
- type_name {
- identifier {
- Identifier "String"
- }
- }
- }
- }
- }
- },
- initializer {
- assignment_operator {
- EQUAL "="
- },
- expression {
- prefix_expression {
- postfix_expression {
- primary_expression {
- literal_expression {
- __FILE__ "__FILE__"
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- },
- RCURLY "}"
- }
- }
- }
- },
- statement {
- declaration {
- class_declaration {
- class "class",
- class_name {
- identifier {
- Identifier "TestSwiftFileWithFunction"
- }
- },
- class_body {
- LCURLY "{",
- declarations {
- declaration {
- function_declaration {
- function_head {
- func "func"
- },
- function_name {
- identifier {
- Identifier "doWork"
- }
- },
- function_signature {
- parameter_clauses {
- parameter_clause {
- LPAREN "(",
- parameter_list {
- parameter {
- local_parameter_name {
- identifier {
- Identifier "a"
- }
- },
- type_annotation {
- COLON ":",
- type {
- type_identifier {
- type_name {
- identifier {
- Identifier "Int"
- }
- }
- }
- }
- }
- },
- COMMA ",",
- parameter {
- external_parameter_name {
- identifier {
- Identifier "andB"
- }
- },
- local_parameter_name {
- identifier {
- Identifier "b"
- }
- },
- type_annotation {
- COLON ":",
- type {
- type_identifier {
- type_name {
- identifier {
- Identifier "String"
- }
- }
- }
- }
- }
- }
- },
- RPAREN ")"
- }
- },
- function_result {
- arrow_operator {
- SUB "-",
- GT ">"
- },
- type {
- LBRACK "[",
- type {
- type_identifier {
- type_name {
- identifier {
- Identifier "String"
- }
- }
- }
- },
- RBRACK "]"
- }
- }
- },
- function_body {
- code_block {
- LCURLY "{",
- statements {
- statement {
- control_transfer_statement {
- return_statement {
- return "return",
- expression {
- prefix_expression {
- postfix_expression {
- primary_expression {
- literal_expression {
- array_literal {
- LBRACK "[",
- RBRACK "]"
- }
- }
- }
- }
- }
- }
- }
- }
- }
- },
- RCURLY "}"
- }
- }
- }
- }
- },
- RCURLY "}"
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment