diff --git a/samples/r.r b/samples/r.r new file mode 100644 index 0000000..e9e2ba8 --- /dev/null +++ b/samples/r.r @@ -0,0 +1,21 @@ +# function declaration +global_function <- function(regular, named = "Hello World!") { + # inner function declaration + inner_function <- function() { + closure_usage <- regular + closure_usage + 1 + } + + print(named) + regular + inner_function() +} + +# function call +global_function(2, named = 'Hello World!') + +cat = list(name = "Smudge", breed = "Maine Coon") +#variable acсess +print(cat$breed) + +# namespace access +print(datasets::cars[1, 2]) \ No newline at end of file diff --git a/samples/swift.swift b/samples/swift.swift new file mode 100644 index 0000000..7b49d93 --- /dev/null +++ b/samples/swift.swift @@ -0,0 +1,62 @@ +#!/usr/bin/swift +/* + Block comment + */ +import Cocoa // line comment + +actor ActorName { var s: [StructName?] } +struct StructName { var s: [StructName?] } +enum EnumName { case Foo, Bar } +protocol ProtocolName { + associatedtype AssociatedType + var p: ProtocolName { get set } + var prop: AssociatedType { get } +} +typealias TypeAlias = EnumName +@attr(arg, *) +class ClassName : ProtocolName { + var property : ClassName + var t : T + func method(p: TypeAlias) { + let c = ClassName(), + tuple: (key: String, value: Int) = (key: 0, value: 1) + self.property = c != nil ? c! : t + } + let prop: String +} + +extension ClassName { } +extension StructName { } + +let i: Int = (2 + 2) * 2; +let _ = { $0 } +let _ = { p in p } +let e = EnumName.Foo; +switch e { + case .Foo: print("foo\n") + default: print(""" + no foo \u{1F596} + """) +} + +func function(externalName paramName : T) throws { + func nestedFunc() { } + nestedFunc() + function(externalName: paramName + 1) + throw NSError() +} + +#if DEBUG + print("debug") +#else + print("nodebug") +#endif +#if swift(>=3.0) + print("conditionally not parsed code") +#endif + +/// Doc comment +/// - Parameter paramName: +/// - Returns: value +/// - Throws: description +foo(paramName: Int) throws -> Int { 0 }