简体   繁体   中英

Is there a tokenizer to tokenize Swift language code in python [closed]

import SwiftUI

struct ContentView: View {
    
    @State var moveOnPath = false
    
    var body: some View {
        
        ZStack {
            Circle()
                .stroke()
                .frame(width: 100, height: 100, alignment: .center)
            
            Circle()
                .frame(width: 15, height: 15, alignment: .center)
                .foregroundColor(.blue)
                .offset(x: -50)
                .rotationEffect(.degrees(moveOnPath ? 0 : 360))
                .animation(Animation.linear(duration: 4).repeatCount(10, autoreverses: false))
                .onAppear() {
                    moveOnPath.toggle()
                }
               
        }
        .rotation3DEffect(
            .degrees(70),
            axis: (x: 10, y: 0.5, z: 0.0))
    }
}

struct ContentView_Previews: PreviewProvider {
    static var previews: some View {
        ContentView()
    }
}

Like for example I have code above available and I would like to tokenize so that only the relevant tokens are extracted such as animation, Animation.linear, duration etc.

If not do I have to write my own tokenizer? Are they are resources that you guys can recommend.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM